bits 32
section .text ;section declaration
global _start
_start:
    mov edx, 9
    jmp outerloop

outerloop:
    mov ecx, 0          ; instead of 0, value should be the number of times outerloop has traversed
    jmp innerloop

innerloop:
    mov eax, [array + ecx * 4]
    mov ebx, [array + 4 + ecx * 4]
    cmp eax, ebx
    jge next
    mov [array + ecx * 4], ebx
    mov [array + 4 + ecx * 4], eax
next:
    inc ecx
    cmp ecx, edx
    jl innerloop
    je endinner
endinner:
    dec edx
    jnz outerloop
done:
    mov ebx,0       ;first syscall argument: exit code
    mov eax,1       ;system call number (sys_exit)
    int 0x80        ;"trap" to kernel

section .data       ;section declaration
; This variable must remain named exactly 'array'
array dd 3, 9, 1, 6, 2, 4, 0, 5, 7, 8

section .bss