Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Program koji provjerava da li se string_2 nalazi u string_1
- # dmarjanovic
- .section .data
- string_2: .ascii "nmar\0"
- string_1: .ascii "dragutinmarjanovic\0"
- .section .text
- .globl main
- main:
- # Brojac za string_1
- movl $0, %esi
- # Brojac za string_2
- movl $0, %ebx
- for_string:
- cmpb $0, string_2(,%ebx,1)
- je substr_true
- cmpb $0, string_1(,%esi,1)
- je substr_false
- movb string_2(,%ebx,1), %cl
- cmpb string_1(,%esi,1), %cl
- je maybe_substr
- incl %esi
- movl $0, %ebx
- jmp for_string
- maybe_substr:
- incl %esi
- incl %ebx
- jmp for_string
- substr_true:
- movl $2, %eax
- jmp end
- substr_false:
- movl $-2, %eax
- end:
- movl $1, %eax
- int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement