Advertisement
Guest User

Untitled

a guest
Jan 28th, 2017
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2. s:         .asciz  "%llu\n"
  3. .text
  4. .global mystrspn
  5.  
  6. mystrspn:
  7.     pushl   %ebp
  8.     movl    %esp, %ebp
  9.     pushl   %ebx
  10.     pushl   %edi
  11.     pushl   %esi
  12.  
  13.     movl    8(%ebp), %eax
  14.     movl    12(%ebp), %ebx
  15.  
  16.     movl    $0, %ecx
  17. Loop1:
  18.     movzbl  (%eax), %edx
  19.     cmpl    $0, %edx
  20.     jz      end
  21.  
  22.     movl    12(%ebp), %ebx
  23. Loop2:
  24.     movzbl    (%ebx), %esi
  25.     cmpl    $0, %esi
  26.     jz      end
  27.     cmpl    %edx,   %esi
  28.     jz      next_letter
  29.     incl    %ebx
  30.     jmp     Loop2
  31. next_letter:
  32.     incl    %ecx
  33.     incl    %eax
  34.     jmp     Loop1
  35. end:
  36.     movl    %ecx, %eax
  37.     popl    %esi
  38.     popl    %edi
  39.     popl    %ebx
  40.     popl    %ebp
  41.     ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement