Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- .text
- .global mystrcmp
- mystrcmp:
- pushl %ebp
- movl %esp, %ebp
- pushl %ebx
- pushl %esi
- pushl %edi
- movl 8(%ebp), %ecx
- movl 12(%ebp), %edx
- movl $0, %esi
- for:
- movl (%edx,%esi,1), %eax //str1[i]
- movl (%ecx,%esi,1), %ebx //str2[i]
- cmpl %ebx, %eax
- jne compare // compare
- incl %esi
- cmpl $0, %eax
- jg for
- compare:
- cmpl %ebx, %eax
- jl less
- je equal
- jg greater
- less:
- movl $-1, %eax
- jmp end
- equal:
- movl $0, %eax
- jmp end
- greater:
- movl $1, %eax
- jmp end
- end:
- popl %edi
- popl %esi
- popl %ebx
- popl %ebp
- ret
Add Comment
Please, Sign In to add comment