The anesthesiologist's principal task is providing pain relief and maintenance of a stable condition during an operation. The anesthesiologist assesses the risk of the patient undergoing surgery and optimize the patient's condition prior to, during, and after surgery. Anesthesiologists also diagnose and treat acute and long-standing pain problems. They also direct resuscitation in the care of patients with cardiac and respiratory emergencies, including the provision of artificial ventilation. They also supervise and teach others involved in anesthesia, respiratory, and intensive care.