main:
	SPAWN Program_init, q1
	MAPQC q2, q0, q1
	MOVECL 2, q2
	MAPQC q2, q1, q0
	PROCID q2
	MOVECL 3, q2
	HALT 4, 17
Program_init:
	MAPSQ q0, q1			; sources of method invoke requests to q1
	ALLOCATEC 1, q2			; allocate space for object ivars
	MMS q6, q7			; open store queue
	MOVE @q2, q6			; store to object root
	MOVECL 0, q6			; store into reserved first position
	PROCID q7			; store object ref
	EEQ q6				; make sure it's saved
Program_dispatch:
	SGTC @q0, 2, q3			; test top bound
	BRNZ q3, Program_error
	SHLC q0, 3, q3			; multiply offset by two
	BREL q3			; jump to appropriate fork
	SPAWN Program_getrep, q4		; autogenerated getrep method
	BR Program_dispatch2
	MOVECL 3, q3			; filler
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME q3
	SPAWN method_Program_qsort, q4	; method qsort
	BR Program_dispatch2
	MOVECL 3, q3			; filler
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME q3
	SPAWN method_Program_main, q4	; method main
	MOVECL 3, q3			; filler
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME @q3
	CONSUME q3
Program_dispatch2:
	MAPQC q5, q1, q4		; map to new thread
	MOVE q1, q5			; send caller
	MOVE @q2, q5			; send obj root
	PROCID q5			; send obj ref "this"
	EEQ q5				; make sure it's sent
	UNMAPQ q5			; disconnect
	BR Program_dispatch		; go back to top
Program_durasive_dispatch:
	EEQ q5				; ensure previous sent
	MAPQC q5, q0, q1		; map to caller
	MOVE q4, q5			; send durasive method id
	MOVE q3, q5			; send method return spot
	EEQ q5				; ensure sent
	UNMAPQ q5			; disconnect
	BR Program_dispatch		; go back to top
Program_error:
	PRINTS "Invalid method offset (number,whom)"
	PRINTQ q0
	PRINTQ q1
	BR Program_dispatch
Program_getrep:
	MOVE q1, q3			; save caller
	MAPQC q4, q0, @q3		; map back to caller
	PROCID q4			; send method id
	MOVE q1, q2			; save obj root
	CONSUME q1			; throw away This
	MAPQ q5, q1, q3			; map to q caller spec'd
	MOVE q2, q5			; send obj root
	UNMAPQ q4			; cleanup
	EEQ q5
	UNMAPQ q5
	HALT 3, 27			; end of getrep
method_Program_qsort:
	MAPQC q5, q0, q1		; open connection back to caller's dropQ
	PROCID q5			; send method id
	MOVE q1, q2			; save obj root
	MOVE q1, q4			; save This
	MML q7, q8			; open load queue
	MMS q10, q11			; open store queue
	EEQ q5				; ensure msg sent
	MOVE q1, q3			; thread to return to
	MOVE q1, q6			; q in thread to return to
	MAPQ q5, @q6, @q3		; map back
	MOVE q1, q13			; move array to alloc'd q
	MOVE q1, q14			; move low to alloc'd q
	MOVE q1, q15			; move high to alloc'd q
block54:
	SEQ @q15, @q14, q9		; temp = high == low
	BRNZ q9, true_branch55
false_branch59:
	SUB @q15, @q14, q16		; TEMP(61) = high - low
	RANDOM q16, q17			; TEMP(62) = random numberTEMP(61)
	ADD @q14, q17, q18		; index = low + TEMP(62)
	MOVE @q13, q7			; array
	MOVE @q18, q7			;  [index]
	MOVE q8, q19			; pivot = array [index]
	MOVE @q13, q10			; array
	MOVE @q18, q10			; [index]
	MOVE @q13, q7			; array
	MOVE @q14, q7			;  [low]
	MOVE q8, q11			;  = array [low]
	MOVE @q13, q10			; array
	MOVE @q14, q10			; [low]
	MOVE @q19, q11			;  = pivot
	SUBC @q14, 1, q20		; i = low - 1
	ADDC @q15, 1, q21		; j = high + 1
	MOVECL 1, q22			; notdone = true
while_test63:
	MOVE @q22, q9			; temp = notdone
	BRNZ q9, while_body65
after_while91:
	MAPQC q12, q0, @q4		; i = this.qsort(...)
	MOVECL 1, q12
	MAPQC q12, q1, q0
	PROCID q12			; return value to this thread
	CONSUME q20
	MOVECL 20, q12
	MOVE @q13, q12			; args[0] = array
	MOVE q14, q12			; args[1] = low
	MOVE @q18, q12			; args[2] = index
	EEQ q12
	ADDC q18, 1, q23		; TEMP(93) = index + 1
	MAPQC q12, q0, @q4		; j = this.qsort(...)
	MOVECL 1, q12
	MAPQC q12, q1, q0
	PROCID q12			; return value to this thread
	CONSUME q21
	MOVECL 21, q12
	MOVE q13, q12			; args[0] = array
	MOVE q23, q12			; args[1] = TEMP(93)
	MOVE q15, q12			; args[2] = high
	EEQ q12
	ADD q20, q21, q5		; return i + j
after_if57:
	HALT 5, 17			; end of method
while_body65:
while_test67:
	MOVE q22, q9			; temp = notdone
	BRNZ q9, while_body69
after_while73:
	MOVECL 1, q22			; notdone = true
while_test75:
	MOVE q22, q9			; temp = notdone
	BRNZ q9, while_body77
after_while81:
	SLT @q20, @q21, q9		; temp = i < j
	BRNZ q9, true_branch83
false_branch87:
	MOVECL 0, q22			; notdone = false
	MOVE @q21, @q18			; index = j
after_if85:
	BR while_test63
true_branch83:
	MOVE @q13, q7			; array
	MOVE @q20, q7			;  [i]
	MOVE q8, q24			; temp = array [i]
	MOVE @q13, q10			; array
	MOVE @q20, q10			; [i]
	MOVE @q13, q7			; array
	MOVE @q21, q7			;  [j]
	MOVE q8, q11			;  = array [j]
	MOVE @q13, q10			; array
	MOVE @q21, q10			; [j]
	MOVE q24, q11			;  = temp
	MOVECL 1, q22			; notdone = true
	BR after_if85
while_body77:
	ADDC q20, 1, q20		; i = i + 1
	MOVE @q13, q7			; array
	MOVE @q20, q7			;  [i]
	MOVE q8, q25			; TEMP(79) = array [i]
	SLT q25, @q19, q22		; notdone = TEMP(79) < pivot
	BR while_test75
while_body69:
	SUBC q21, 1, q21		; j = j - 1
	MOVE @q13, q7			; array
	MOVE @q21, q7			;  [j]
	MOVE q8, q26			; TEMP(71) = array [j]
	SGT q26, @q19, q22		; notdone = TEMP(71) > pivot
	BR while_test67
true_branch55:
	SUB q15, q14, q5		; return high - low
	BR after_if57
method_Program_main:
	MAPQC q5, q0, q1		; open connection back to caller's dropQ
	PROCID q5			; send method id
	MOVE q1, q2			; save obj root
	MOVE q1, q4			; save This
	MML q7, q8			; open load queue
	MMS q10, q11			; open store queue
	EEQ q5				; ensure msg sent
	MOVE q1, q3			; thread to return to
	MOVE q1, q6			; q in thread to return to
	MAPQ q5, @q6, @q3		; map back
block96:
	MOVECL 100, q13			; size = 100
	ALLOCATE @q13, q14		; array = new int[size]
	MOVECL 0, q15			; x = 0
while_test97:
	SLT @q15, @q13, q9		; temp = x < size
	BRNZ q9, while_body99
after_while103:
	PRINTS "Sorting..."		; print string
	ADDC @q13, -1, q16		; TEMP(105) = size + -1
	MAPQC q12, q0, @q4		; TEMP(106) = this.qsort(...)
	MOVECL 1, q12
	MAPQC q12, q1, q0
	PROCID q12			; return value to this thread
	MOVECL 17, q12
	MOVE @q14, q12			; args[0] = array
	MOVECL 0, q12			; args[1] = 0
	MOVE q16, q12			; args[2] = TEMP(105)
	EEQ q12
	PRINTQNNL q17			; print variable: TEMP(106)
	MOVECL 0, @q15			; x = 0
while_test107:
	SLT @q15, @q13, q9		; temp = x < size
	BRNZ q9, while_body109
after_while113:
	HALT 5, 17			; end of method
while_body109:
	MOVE @q14, q7			; array
	MOVE @q15, q7			;  [x]
	MOVE q8, q18			; TEMP(111) = array [x]
	PRINTQNNL q18			; print variable: TEMP(111)
	PRINTS " "			; print string
	ADDC q15, 1, q15		; x = x + 1
	BR while_test107
while_body99:
	MOVE @q14, q10			; array
	MOVE @q15, q10			; [x]
	RANDOM @q13, q11		;  = random numbersize
	MOVE @q14, q7			; array
	MOVE @q15, q7			;  [x]
	MOVE q8, q19			; TEMP(101) = array [x]
	PRINTQNNL q19			; print variable: TEMP(101)
	PRINTS " "			; print string
	ADDC q15, 1, q15		; x = x + 1
	BR while_test97

