Advertisement
Guest User

Untitled

a guest
Feb 18th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.         .text
  2.         .global mystrspn
  3. mystrspn:
  4.         push    %ebp
  5.         mov     %esp, %ebp
  6.         push    %esi
  7.         push    %edx
  8.         mov     8(%ebp), %eax
  9.         mov     12(%ebp), %esi
  10.         movl    $0, %ebx
  11. continue:
  12.         movzb   (%eax), %ecx
  13.         movzb   (%esi), %edx
  14.         sub     %edx, %ecx
  15.         jz      equal
  16.         movzb   (%eax), %ecx
  17.         inc     %esi
  18.         movzb   (%esi), %edx
  19.         test    %edx, %edx
  20.         jnz     continue
  21.  
  22.         jmp     end
  23. equal:  
  24.         movzb   (%eax), %ecx
  25.         movzb   (%esi), %edx
  26.         inc     %ebx
  27.         inc     %eax
  28.         movzb   (%eax), %ecx
  29.         cmp     $0, %ecx
  30.         jz      end
  31.         mov     12(%ebp), %esi
  32.         movzb   (%esi), %edx
  33.         jmp     continue
  34.  
  35. end:
  36.         mov     %ebx, %eax
  37.         pop     %edi
  38.         pop     %edx
  39.         pop     %esi
  40.         movl    %ebp, %esp
  41.         popl    %ebp
  42.         ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement