rendered paste bodyTesting inlining with gcc 4.0.4:
test.c:
#include <stdio.h>
inline void test(int a) {
printf("%d\n", a);
}
int main(void) {
void (*fnc)(int);
test(1);
fnc = &test;
(*fnc)(2);
return 0;
}
Compiling: gcc -O test.c
Disasm:
08048360 <test>:
8048360: 55 push %ebp
8048361: 89 e5 mov %esp,%ebp
8048363: 83 ec 08 sub $0x8,%esp
8048366: 8b 45 08 mov 0x8(%ebp),%eax
8048369: 89 44 24 04 mov %eax,0x4(%esp)
804836d: c7 04 24 a0 84 04 08 movl $0x80484a0,(%esp)
8048374: e8 37 ff ff ff call 80482b0 <printf@plt>
8048379: c9 leave
804837a: c3 ret
0804837b <main>:
804837b: 55 push %ebp
804837c: 89 e5 mov %esp,%ebp
804837e: 83 ec 08 sub $0x8,%esp
8048381: 83 e4 f0 and $0xfffffff0,%esp
8048384: 83 ec 10 sub $0x10,%esp
8048387: c7 44 24 04 01 00 00 movl $0x1,0x4(%esp)
804838e: 00
804838f: c7 04 24 a0 84 04 08 movl $0x80484a0,(%esp)
8048396: e8 15 ff ff ff call 80482b0 <printf@plt>
804839b: c7 04 24 02 00 00 00 movl $0x2,(%esp)
80483a2: e8 b9 ff ff ff call 8048360 <test>
80483a7: b8 00 00 00 00 mov $0x0,%eax
80483ac: c9 leave
80483ad: c3 ret
80483ae: 90 nop
80483af: 90 nop