	.file	1 "bubblepass.c"
	.section .mdebug.abi32
	.previous
	.gnu_attribute 4, 3
	.abicalls
	.text
	.align	2
	.globl	bubblePass
	.set	nomips16
	.ent	bubblePass
	.type	bubblePass, @function
bubblePass:
	.frame	$sp,0,$ra		# vars= 0, regs= 0/0, args= 0, gp= 0
	.mask	0x00000000,0
	.fmask	0x00000000,0
	.set	noreorder
	.set	nomacro
	addiu	$a1,$a1,-1                     # n <-- n-1
	blez	$a1,$L9                        # leave if n <= 0
	move	$v0,$zero                      # $v0 holds swappedCount

	move	$v1,$zero                      # $v1 holds i
$L4:
	lw	$a2,0($a0)                     # $a0 points to &V[i]
	lw	$a3,4($a0)
	addiu	$v1,$v1,1                      # i <-- i+1
	slt	$t1,$a3,$a2                    # $t1 <-- V[i+1] < V[i]
	beq	$t1,$zero,$L3                  # skip element switch, if V[i] < V[i+1]
	slt	$t0,$v1,$a1                    # $t0 <-- i < n-1

	sw	$a3,0($a0)                     # switching V[i] and V[i+1]
	sw	$a2,4($a0)
	addiu	$v0,$v0,1                      # adding 1 to swappedCount
$L3:
	bne	$t0,$zero,$L4                  # if i < n-1, keep going
	addiu	$a0,$a0,4                      # move $a0 to next element of array

$L9:
	j	$ra
	nop

	.set	macro
	.set	reorder
	.end	bubblePass
	.size	bubblePass, .-bubblePass
	.ident	"GCC: (GNU) 4.6.2"
