This disclosure describes methods and systems for preventing, moderating, and/or treating brain injury. The methods herein may include obtaining a test result reflecting a condition of a brain in the subject, determining a stimulation parameter based on the test result, and stimulating a nerve based on the stimulation parameter, wherein stimulation of the nerve assists or causes contraction of a respiratory muscle in the subject. The systems herein may include a processor configured to: receive a test result reflecting a condition of a brain in a subject, and determine a stimulation parameter based on the test result; and a stimulator configured to stimulate a nerve based on the stimulation parameter, wherein stimulation of the nerve assists or causes contraction of a respiratory muscle in the subject.