Advertisement
Guest User

Untitled

a guest
Aug 19th, 2017
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2. NELEM=3
  3. smax=96
  4. a: .long 0x12345678, 0x23456789, 0x34567890
  5. max: .long 0
  6. poz: .long 0
  7. string: .fill smax,1,0
  8. .section .text
  9. .globl main
  10. main:
  11.     movl $0, %esi
  12. restart:
  13.     movl $0, %edx
  14.     cmpl $NELEM, %esi
  15.     je dalje
  16.     movl a(,%esi,4), %eax
  17. nesto1:
  18.     andl %eax, %eax
  19.     jz nesto2
  20.     shrl $1, %eax
  21.     jnc nesto1
  22.     incl %edx
  23.     jmp nesto1
  24. nesto2:
  25.     incl %esi
  26.     cmpl max, %edx
  27. jbe restart
  28.     movl %edx, max
  29.     movl %esi, poz
  30.     decl poz
  31.     jmp restart
  32. dalje:
  33.     leal string, %edi
  34.     movl poz, %esi
  35.     movl a(, %esi,4), %ebx
  36.     movl $1, %esi           ##0 ili 1, brojac
  37. petlja:
  38.     xorl %edx, %edx
  39.     movl %esi, %eax
  40.     shrl $1, %ebx
  41.     jnc nije_kec
  42.     movl $10, %ecx
  43.     divl %ecx
  44.     andl %eax, %eax
  45.     jz dalje2
  46.     addb $48, %al
  47.     movb %al, (%edi)
  48.     incl %edi
  49. dalje2:
  50.     addb $48, %dl
  51.     movb %dl, (%edi)
  52.     incl %edi
  53.     movb $' ', (%edi)
  54.     incl %edi  
  55. nije_kec:
  56.     incl %esi
  57.     andl %ebx, %ebx
  58.     jz dalje3
  59.     jmp petlja
  60. dalje3:
  61.     movl $4, %eax
  62.     movl $1, %ebx
  63.     leal string, %ecx
  64.     movl %edi, %edx
  65.     decl %edi
  66.     int $0x80
  67. kraj:
  68.     movl $1, %eax
  69.     int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement