Advertisement
Guest User

Untitled

a guest
Oct 31st, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. .section .data
  2. niz1: .long -6, -5, 4, 6, 7
  3. niz2: .long 0, 0, 0, 0, 0
  4. .section .text
  5. .globl main
  6.  
  7. main:
  8.     movl $0, %esi
  9.     movl $2, %ebx
  10.  
  11. poredi:
  12.     cmpl $4, %esi
  13.     je kraj
  14.     cmpl $-5, niz1(, %esi, 4)  
  15.     jge veci
  16.     jl manji
  17.  
  18. manji:
  19.     movl niz1(, %esi, 4), %eax
  20.     imull %eax
  21.     movl %eax, niz2(, %esi, 4)
  22.     addl $1, %esi
  23.     jmp poredi
  24.  
  25. veci:
  26.     cmpl $5, niz1(, %esi, 4)
  27.     jg veciveci
  28.     jmp vecimanji
  29.    
  30. vecimanji:
  31.     cmpl $0, niz1(, %esi, 4)
  32.     jg poz
  33.     jl neg
  34.     je nula
  35.    
  36.     poz:
  37.         movl $0, %edx
  38.         movl niz1(, %esi, 4), %eax
  39.         idivl %ebx
  40.  
  41.     neg:
  42.         movl $0xffffffff, %edx
  43.         movl niz1(, %esi, 4), %eax
  44.         idivl %ebx
  45.  
  46.     nula:
  47.         movl $0, %edx
  48.  
  49.     movl %edx, niz2(, %esi, 4)
  50.     addl $1, %esi
  51.     jmp poredi
  52.  
  53. veciveci:
  54.     movl %esi, %edi
  55.     movl $0, %eax
  56.     addl niz1(, %esi, 4), %eax
  57.  
  58.     cmpl $0, %esi
  59.     je prvi
  60.     cmpl $4, %esi
  61.     je poslednji
  62.  
  63.     subl $1, %edi
  64.     addl niz1(, %edi, 4), %eax
  65.     addl $2, %edi
  66.     addl niz1(, %edi, 4), %eax
  67.     movl %eax, niz2(, %esi, 4)
  68.  
  69.     prvi:
  70.         addl $1, %edi
  71.         addl niz1(, %edi, 4), %eax
  72.         movl %eax, niz2(, %esi, 4)
  73.  
  74.         addl $1, %esi
  75.         jmp poredi
  76.  
  77.     poslednji:
  78.         subl $1, %edi
  79.         addl niz1(, %edi, 4), %eax
  80.         movl %eax, niz2(, %esi, 4) 
  81.        
  82.         addl $1, %esi
  83.         jmp kraj
  84.  
  85. kraj:
  86.     movl $1, %eax
  87.     movl $0, %ebx
  88.     int $0x80
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement