The control flow of the above program goes in following order main -> f -> g -> f -> main
main calls f with 1,2,3.
Notice the push instructions and calling convention. f checks whether 1 == 0 (ebp - 8). The answer is no. So, it calls g. This is the major hint for you. I am sure you will be able to figure rest of it :-)