Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2018
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.62 KB | None | 0 0
  1. #unsigned parrot(unsigned *x);
  2.  
  3. .section .text
  4. .globl parrot
  5.  
  6. parrot:
  7. pushl %ebp
  8. movl %esp, %ebp
  9. movl 8(%ebp), %eax
  10. andl $0x7fffffff, (%eax) #bit pariteta na 0, jer se on ne broji
  11. movl (%eax), %eax #vrijednost u %eax
  12. movb $0, %cl #cl brojac zbog rotacija
  13.  
  14. petlja:
  15. cmpl $0, %eax
  16. je done
  17. shrl %eax
  18. jnc petlja
  19. incb %cl
  20. jmp petlja
  21.  
  22. done:
  23. movl 8(%ebp), %eax
  24. testb $1, %cl
  25. jnz neparan
  26. roll %cl, (%eax)
  27. movl $0, %eax
  28. movb %cl, %al
  29. movl %ebp, %esp
  30. popl %ebp
  31. ret
  32.  
  33. neparan:
  34. orl $0x80000000, (%eax)
  35. rorl %cl, (%eax)
  36. movl $0, %eax
  37. movb %cl, %al
  38. movl %ebp, %esp
  39. popl %ebp
  40. ret
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement