.title "string.ic" # global declarations .global _ic_main # data section .data .align 4 .int 4 str1: .string "abcd" .align 4 .int 3 str2: .string "aba" .align 4 .int 13 str3: .string "greater than\n" .align 4 .int 14 str4: .string "less or equal\n" .align 4 # text (code) section .text #---------------------------------------------------- .align 4 _ic_main: push %ebp # prologue mov %esp,%ebp # prologue # _stringcat function call push $str2 # pre-call push $str1 # pre-call call __stringcat add $8, %esp # post-call mov %eax, %ebx # print result push %ebx # pre-call call _print add $4, %esp # post-call # print new line push $10 # pre-call call _printc add $4, %esp # post-call # print result length push -4(%ebx) # pre-call call _printi add $4, %esp # post-call # print new line push $10 # pre-call call _printc add $4, %esp # post-call # stringcompare function call push $str2 # pre-call push $str1 # pre-call call __stringcompare add $8, %esp # post-call cmp $0, %eax # %eax > 0 ? jg L1 # print push $str4 # pre-call call _print add $4, %esp # post-call jmp L2 # print result L1: push $str3 # pre-call call _print add $4, %esp # post-call L2: xor %eax, %eax # return 0 epilogue_ic_main: mov %ebp,%esp # epilogue pop %ebp # epilogue ret # epilogue