I have the following C code:
#include <stdio.h>
void function(int a, int b, int c) {
int buff_1[5];
int buff_2[10];
buff_1[0] = 6;
buff_2[0] = 'A';
buff_2[1] = 'B';
}
int main(void) {
int i = 1;
function(1,2,3);
return 0;
}
now I want to analyze the associated assembly code: The assembly instructions before the function call, according to the book I'm reading are:
pushl $3
pushl $2
pushl $1
call function
The underlying object file was created using gcc-5.3 -O0 -c functions.c
.
However, if I create the assembly code using objdump
I get the following instructions:
movl $3, %edx
movl $2, %esi
movl $1, %edi
As far as I understand assembly (I'm pretty new to it) the first one makes more sense to me.
Is the book simply wrong? Or is the books output just outdated because of using gcc 2.9