## %rdi  is  V
## %esi  is  n-1   [initially n]

## %eax  is  SwappedCount
## %rdx  is  i
## %ecx  is  V[i]
## %r8d  is  V[i+1]


     .file    "bubblepass.c"
     .text
     .p2align 4,,15
     .globl   bubblePass
     .type    bubblePass, @function
                                       # int bubblePass(int V[], int n)
                                       # %rdi is V, %esi is n
bubblePass:
.LFB0:
     .cfi_startproc
     subl     $1, %esi                 # %esi is n-1
     testl    %esi, %esi               # if n-1 < 0 (i.e.,n < 1)
     jle      .L5                      #    goto .L5
     xorl     %edx, %edx               # %edx is i, initialized to 0
     xorl     %eax, %eax               # %eax is swappedCount, init to 0
     .p2align 4,,10
     .p2align 3
.L4:
     movl     (%rdi,%rdx,4), %ecx      # %ecx is V[i]
     movl     4(%rdi,%rdx,4), %r8d     # %r8d is V[i+1]
     cmpl      %r8d, %ecx              # if V[i-1] < V[i]
     jle      .L3                      #    goto .L3
     movl     %r8d, (%rdi,%rdx,4)      # V[i] <-- %r8d (i.e., V[i+1])
     movl     %ecx, 4(%rdi,%rdx,4)     # V[i+1] <-- %ecx (i.e., V[i])
     addl     $1, %eax                 # ++swappedCount
.L3:
     addq     $1, %rdx                 # ++i
     cmpl     %edx, %esi               # if i > n-1
     jg       .L4                      #    goto .L4
     rep ret                           # return %eax (swappedCount)
.L5:
     xorl     %eax, %eax               # %eax <-- 0
     ret                                return 0
     .cfi_endproc
.LFE0:
     .size    bubblePass, .-bubblePass
     .ident   "GCC: (Ubuntu 4.8.4-2ubuntu1~14.04) 4.8.4"
     .section .note.GNU-stack,"",@progbits
