Another important things to understand related to function call is how the variable is passed to the function. Lets see the code below
in the code above I am going to pass 3 variable int var1, int var2 and int var3 to pass a function
we can now check the assembly in IDA as follow
As normal, all the variable shall be initilized in the main function stack frame but we can see that in the main function all the variable is accessed using ESP where the variables be access using positive because of the sub esp, 20h, it make esp pointing to lower memory address. where if EBP as the reference then it will using minus number.
Let jump to the passing variable. We can see that all the 3 varible is move backward toward the function signature void pass(int var1, int var2, int var3) where var3 is processed for the first time and var2 and the last is var1. it is the convetion of passing the variable will be read from the right to the left.