ArduCopter - run() function

how does the function: input_euler_angle_roll_pitch_euler_rate_yaw()
works?
from what i understand, its inputs are target_roll , target_pitch and target_yaw_rate that are made in the function run().
what happenes in this function? why do we need it? what is its output?