# # Data section for static data declarations # .section .rodata .LC1: .string "foo" .LC2: .string "bar" .LC3: .string "strcmp(\"%s\", \"%s\") = %d \n" # # Text section for code # .text # Function declarations .globl strcmp .type strcmp, @function .globl main .type main, @function ### int main(int argc, char* argv[]) ### main: # Prologue pushl %ebp movl %esp, %ebp andl $-16, %esp subl $32, %esp # Setup & call strcmp movl $.LC1, 20(%esp) movl $.LC2, 24(%esp) movl 24(%esp), %eax movl %eax, 4(%esp) movl 20(%esp), %eax movl %eax, (%esp) call strcmp # Print result movl %eax, 28(%esp) movl $.LC3, %eax movl 28(%esp), %edx movl %edx, 12(%esp) movl 24(%esp), %edx movl %edx, 8(%esp) movl 20(%esp), %edx movl %edx, 4(%esp) movl %eax, (%esp) call printf # Return 0 movl $0, %eax # Epilogue leave ret ### int strcmp(char* a, char* b) ### strcmp: # Prologue pushl %ebp movl %esp, %ebp movl 8(%ebp), %esi movl 12(%ebp), %edi # ??? # # Epilogue leave ret