Created
September 2, 2016 14:51
-
-
Save vendethiel/6e0619dde1269ecaedd1ece7cf19d013 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
.global _start | |
.text | |
_start: | |
pushq %rbp | |
movq %rsp, %rbp | |
movabsq $str1, %rdi | |
movabsq $str2, %rsi | |
#movl $str2_size, %ecx | |
#decl %ecx | |
call strcmp | |
leave | |
ret | |
strcmp: | |
pushq %rbp | |
movq %rsp, %rbp | |
cld | |
repe cmpsb | |
xor %rax, %rax | |
jecxz eq | |
jmp strcmp_end | |
eq: | |
#movq $1, %rax | |
inc %rax | |
strcmp_end: | |
leave | |
ret | |
str1: | |
.ascii "Hello mate" | |
#.set str1_size, .-str1 | |
str2: | |
.ascii "Hello mate" | |
.set str2_size, .-str2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment