Repair this code
Repair safe_div so it divides a by b only after both illegal divisions have been ruled out, writing the quotient through out when the division is legal.
Steps
$ int out = 777; safe_div(84, 2, &out)
ret=0 out=42
$ int out = 777; safe_div(-7, 2, &out)
ret=0 out=-3
$ int out = 777; safe_div(10, 0, &out)
ret=-1 out=777
$ int out = 777; safe_div(INT_MIN, -1, &out)
ret=-1 out=777
$ int out = 777; safe_div(INT_MIN, 1, &out)
ret=0 out=-2147483648
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Repair this code
Repair safe_div so it divides a by b only after both illegal divisions have been ruled out, writing the quotient through out when the division is legal.
Steps
$ int out = 777; safe_div(84, 2, &out)
ret=0 out=42
$ int out = 777; safe_div(-7, 2, &out)
ret=0 out=-3
$ int out = 777; safe_div(10, 0, &out)
ret=-1 out=777
$ int out = 777; safe_div(INT_MIN, -1, &out)
ret=-1 out=777
$ int out = 777; safe_div(INT_MIN, 1, &out)
ret=0 out=-2147483648
Expected files
Allowed functions
None. Write every helper yourself.
Allowed headers

Tests
Run the tests to grade your code