Advertisement
Guest User

Untitled

a guest
Feb 2nd, 2017
109
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .data
  2.  
  3. A: .asciz "helloworld123а567890"
  4. B: .asciz "helloworld123б567890"
  5.  
  6. .text
  7. .global mystrcmp
  8.  
  9. .global A
  10. .global B
  11. .global main
  12.  
  13. mystrcmp:
  14.   pushl %ebp
  15.   movl  %esp, %ebp
  16.   pushl %ebx
  17.   pushl %esi
  18.  
  19.   pushl %edi
  20.   pushl %ecx
  21.  
  22.   movl  8(%ebp), %ebx
  23.   movl  12(%ebp), %esi
  24.  
  25.   xorl    %edi, %edi
  26.   xorl    %ecx, %ecx
  27.  
  28.   movzx (%esi), %edi
  29.   movzx (%ebx), %ecx
  30.  
  31.   movl  $1, %eax
  32.   loop:
  33.   cmpl   $0, %ecx
  34.   jz str1_end
  35.   cmpl   $0, %edi
  36.   jz out
  37.     cmpl %ecx, %edi
  38.     jl out
  39.     jnz neg
  40.     addl $1, %ebx
  41.     addl $1, %esi
  42.     movzx (%esi), %edi
  43.     movzx (%ebx), %ecx
  44.     jmp loop
  45.   str1_end:
  46.     movl $0, %eax
  47.     cmpl  $0, %edi
  48.     jz out
  49.     neg:
  50.       movl $-1, %eax
  51.   out:
  52.  
  53.   popl  %ecx
  54.   popl  %edi
  55.  
  56.   popl  %esi
  57.   popl  %ebx
  58.   popl  %ebp
  59.   ret
  60.  
  61. main:
  62.   pushl $B
  63.   pushl $A
  64.   call mystrcmp
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement