summaryrefslogtreecommitdiff
path: root/vaporize/tests/QuickSort.names.vaporm
diff options
context:
space:
mode:
Diffstat (limited to 'vaporize/tests/QuickSort.names.vaporm')
-rw-r--r--vaporize/tests/QuickSort.names.vaporm439
1 files changed, 439 insertions, 0 deletions
diff --git a/vaporize/tests/QuickSort.names.vaporm b/vaporize/tests/QuickSort.names.vaporm
new file mode 100644
index 0000000..0029cf0
--- /dev/null
+++ b/vaporize/tests/QuickSort.names.vaporm
@@ -0,0 +1,439 @@
+const vmt_QS
+ :QS.Start
+ :QS.Sort
+ :QS.Print
+ :QS.Init
+
+func Main [in 0, out 0, local 0]
+ $t0{t.0} = HeapAllocZ(12)
+ [$t0{t.0}] = :vmt_QS
+ if $t0{t.0} goto :null1
+ Error("null pointer")
+null1:
+ $t1{t.1} = [$t0{t.0}]
+ $t1{t.1} = [$t1{t.1}]
+ $a0 = $t0{t.0}
+ $a1 = 10
+ call $t1{t.1}
+ $t1{t.2} = $v0
+ PrintIntS($t1{t.2})
+ ret
+
+func QS.Start [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ $t1{t.0} = [$s0{this}]
+ $t1{t.0} = [$t1{t.0}+12]
+ $a0 = $s0{this}
+ $a1 = $t0{sz}
+ call $t1{t.0}
+ $t1{t.1} = [$s0{this}]
+ $t1{t.1} = [$t1{t.1}+8]
+ $a0 = $s0{this}
+ call $t1{t.1}
+ PrintIntS(9999)
+ $t1{t.2} = [$s0{this}+8]
+ $t1{aux01} = Sub($t1{t.2} 1)
+ $t0{t.3} = [$s0{this}]
+ $t0{t.3} = [$t0{t.3}+4]
+ $a0 = $s0{this}
+ $a1 = 0
+ $a2 = $t1{aux01}
+ call $t0{t.3}
+ $t0{t.4} = [$s0{this}]
+ $t0{t.4} = [$t0{t.4}+8]
+ $a0 = $s0{this}
+ call $t0{t.4}
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func QS.Sort [in 0, out 0, local 3]
+ local[0] = $s0
+ local[1] = $s1
+ local[2] = $s2
+ $s0{this} = $a0
+ $t0{left} = $a1
+ $s1{right} = $a2
+ $t1{t} = 0
+ $t2{t.0} = LtS($t0{left} $s1{right})
+ if0 $t2{t.0} goto :if1_else
+ $t2{t.1} = [$s0{this}+4]
+ if $t2{t.1} goto :null2
+ Error("null pointer")
+null2:
+ $t3{t.2} = [$t2{t.1}]
+ $t3{t.2} = Lt($s1{right} $t3{t.2})
+ if $t3{t.2} goto :bounds1
+ Error("array index out of bounds")
+bounds1:
+ $t3{t.2} = MulS($s1{right} 4)
+ $t3{t.2} = Add($t3{t.2} $t2{t.1})
+ $t3{v} = [$t3{t.2}+4]
+ $s2{i} = Sub($t0{left} 1)
+ $t2{j} = $s1{right}
+ $t4{cont01} = 1
+while1_top:
+ if0 $t4{cont01} goto :while1_end
+ $t5{cont02} = 1
+while2_top:
+ if0 $t5{cont02} goto :while2_end
+ $s2{i} = Add($s2{i} 1)
+ $t6{t.3} = [$s0{this}+4]
+ if $t6{t.3} goto :null3
+ Error("null pointer")
+null3:
+ $t7{t.4} = [$t6{t.3}]
+ $t7{t.4} = Lt($s2{i} $t7{t.4})
+ if $t7{t.4} goto :bounds2
+ Error("array index out of bounds")
+bounds2:
+ $t7{t.4} = MulS($s2{i} 4)
+ $t7{t.4} = Add($t7{t.4} $t6{t.3})
+ $t7{aux03} = [$t7{t.4}+4]
+ $t6{t.5} = LtS($t7{aux03} $t3{v})
+ $t6{t.6} = Sub(1 $t6{t.5})
+ if0 $t6{t.6} goto :if2_else
+ $t5{cont02} = 0
+ goto :if2_end
+if2_else:
+ $t5{cont02} = 1
+if2_end:
+ goto :while2_top
+while2_end:
+ $t5{cont02} = 1
+while3_top:
+ if0 $t5{cont02} goto :while3_end
+ $t2{j} = Sub($t2{j} 1)
+ $t6{t.7} = [$s0{this}+4]
+ if $t6{t.7} goto :null4
+ Error("null pointer")
+null4:
+ $t8{t.8} = [$t6{t.7}]
+ $t8{t.8} = Lt($t2{j} $t8{t.8})
+ if $t8{t.8} goto :bounds3
+ Error("array index out of bounds")
+bounds3:
+ $t8{t.8} = MulS($t2{j} 4)
+ $t8{t.8} = Add($t8{t.8} $t6{t.7})
+ $t7{aux03} = [$t8{t.8}+4]
+ $t7{t.9} = LtS($t3{v} $t7{aux03})
+ $t7{t.10} = Sub(1 $t7{t.9})
+ if0 $t7{t.10} goto :if3_else
+ $t5{cont02} = 0
+ goto :if3_end
+if3_else:
+ $t5{cont02} = 1
+if3_end:
+ goto :while3_top
+while3_end:
+ $t5{t.11} = [$s0{this}+4]
+ if $t5{t.11} goto :null5
+ Error("null pointer")
+null5:
+ $t7{t.12} = [$t5{t.11}]
+ $t7{t.12} = Lt($s2{i} $t7{t.12})
+ if $t7{t.12} goto :bounds4
+ Error("array index out of bounds")
+bounds4:
+ $t7{t.12} = MulS($s2{i} 4)
+ $t7{t.12} = Add($t7{t.12} $t5{t.11})
+ $t1{t} = [$t7{t.12}+4]
+ $t7{t.13} = [$s0{this}+4]
+ if $t7{t.13} goto :null6
+ Error("null pointer")
+null6:
+ $t5{t.14} = [$t7{t.13}]
+ $t5{t.14} = Lt($s2{i} $t5{t.14})
+ if $t5{t.14} goto :bounds5
+ Error("array index out of bounds")
+bounds5:
+ $t5{t.14} = MulS($s2{i} 4)
+ $t5{t.14} = Add($t5{t.14} $t7{t.13})
+ $t7{t.15} = [$s0{this}+4]
+ if $t7{t.15} goto :null7
+ Error("null pointer")
+null7:
+ $t8{t.16} = [$t7{t.15}]
+ $t8{t.16} = Lt($t2{j} $t8{t.16})
+ if $t8{t.16} goto :bounds6
+ Error("array index out of bounds")
+bounds6:
+ $t8{t.16} = MulS($t2{j} 4)
+ $t8{t.16} = Add($t8{t.16} $t7{t.15})
+ $t8{t.17} = [$t8{t.16}+4]
+ [$t5{t.14}+4] = $t8{t.17}
+ $t8{t.18} = [$s0{this}+4]
+ if $t8{t.18} goto :null8
+ Error("null pointer")
+null8:
+ $t5{t.19} = [$t8{t.18}]
+ $t5{t.19} = Lt($t2{j} $t5{t.19})
+ if $t5{t.19} goto :bounds7
+ Error("array index out of bounds")
+bounds7:
+ $t5{t.19} = MulS($t2{j} 4)
+ $t5{t.19} = Add($t5{t.19} $t8{t.18})
+ [$t5{t.19}+4] = $t1{t}
+ $t5{t.20} = Add($s2{i} 1)
+ $t5{t.21} = LtS($t2{j} $t5{t.20})
+ if0 $t5{t.21} goto :if4_else
+ $t4{cont01} = 0
+ goto :if4_end
+if4_else:
+ $t4{cont01} = 1
+if4_end:
+ goto :while1_top
+while1_end:
+ $t4{t.22} = [$s0{this}+4]
+ if $t4{t.22} goto :null9
+ Error("null pointer")
+null9:
+ $t3{t.23} = [$t4{t.22}]
+ $t3{t.23} = Lt($t2{j} $t3{t.23})
+ if $t3{t.23} goto :bounds8
+ Error("array index out of bounds")
+bounds8:
+ $t3{t.23} = MulS($t2{j} 4)
+ $t3{t.23} = Add($t3{t.23} $t4{t.22})
+ $t4{t.24} = [$s0{this}+4]
+ if $t4{t.24} goto :null10
+ Error("null pointer")
+null10:
+ $t2{t.25} = [$t4{t.24}]
+ $t2{t.25} = Lt($s2{i} $t2{t.25})
+ if $t2{t.25} goto :bounds9
+ Error("array index out of bounds")
+bounds9:
+ $t2{t.25} = MulS($s2{i} 4)
+ $t2{t.25} = Add($t2{t.25} $t4{t.24})
+ $t2{t.26} = [$t2{t.25}+4]
+ [$t3{t.23}+4] = $t2{t.26}
+ $t2{t.27} = [$s0{this}+4]
+ if $t2{t.27} goto :null11
+ Error("null pointer")
+null11:
+ $t3{t.28} = [$t2{t.27}]
+ $t3{t.28} = Lt($s2{i} $t3{t.28})
+ if $t3{t.28} goto :bounds10
+ Error("array index out of bounds")
+bounds10:
+ $t3{t.28} = MulS($s2{i} 4)
+ $t3{t.28} = Add($t3{t.28} $t2{t.27})
+ $t2{t.29} = [$s0{this}+4]
+ if $t2{t.29} goto :null12
+ Error("null pointer")
+null12:
+ $t4{t.30} = [$t2{t.29}]
+ $t4{t.30} = Lt($s1{right} $t4{t.30})
+ if $t4{t.30} goto :bounds11
+ Error("array index out of bounds")
+bounds11:
+ $t4{t.30} = MulS($s1{right} 4)
+ $t4{t.30} = Add($t4{t.30} $t2{t.29})
+ $t4{t.31} = [$t4{t.30}+4]
+ [$t3{t.28}+4] = $t4{t.31}
+ $t4{t.32} = [$s0{this}+4]
+ if $t4{t.32} goto :null13
+ Error("null pointer")
+null13:
+ $t3{t.33} = [$t4{t.32}]
+ $t3{t.33} = Lt($s1{right} $t3{t.33})
+ if $t3{t.33} goto :bounds12
+ Error("array index out of bounds")
+bounds12:
+ $t3{t.33} = MulS($s1{right} 4)
+ $t3{t.33} = Add($t3{t.33} $t4{t.32})
+ [$t3{t.33}+4] = $t1{t}
+ $t3{t.34} = [$s0{this}]
+ $t3{t.34} = [$t3{t.34}+4]
+ $t1{t.35} = Sub($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t0{left}
+ $a2 = $t1{t.35}
+ call $t3{t.34}
+ $t1{t.36} = [$s0{this}]
+ $t1{t.36} = [$t1{t.36}+4]
+ $t3{t.37} = Add($s2{i} 1)
+ $a0 = $s0{this}
+ $a1 = $t3{t.37}
+ $a2 = $s1{right}
+ call $t1{t.36}
+ goto :if1_end
+if1_else:
+if1_end:
+ $v0 = 0
+ $s0 = local[0]
+ $s1 = local[1]
+ $s2 = local[2]
+ ret
+
+func QS.Print [in 0, out 0, local 0]
+ $t0{this} = $a0
+ $t1{j} = 0
+while4_top:
+ $t2{t.0} = [$t0{this}+8]
+ $t2{t.1} = LtS($t1{j} $t2{t.0})
+ if0 $t2{t.1} goto :while4_end
+ $t2{t.2} = [$t0{this}+4]
+ if $t2{t.2} goto :null14
+ Error("null pointer")
+null14:
+ $t3{t.3} = [$t2{t.2}]
+ $t3{t.3} = Lt($t1{j} $t3{t.3})
+ if $t3{t.3} goto :bounds13
+ Error("array index out of bounds")
+bounds13:
+ $t3{t.3} = MulS($t1{j} 4)
+ $t3{t.3} = Add($t3{t.3} $t2{t.2})
+ $t3{t.4} = [$t3{t.3}+4]
+ PrintIntS($t3{t.4})
+ $t1{j} = Add($t1{j} 1)
+ goto :while4_top
+while4_end:
+ $v0 = 0
+ ret
+
+func QS.Init [in 0, out 0, local 1]
+ local[0] = $s0
+ $s0{this} = $a0
+ $t0{sz} = $a1
+ [$s0{this}+8] = $t0{sz}
+ $a0 = $t0{sz}
+ call :AllocArray
+ $t0{t.0} = $v0
+ [$s0{this}+4] = $t0{t.0}
+ $t0{t.1} = [$s0{this}+4]
+ if $t0{t.1} goto :null15
+ Error("null pointer")
+null15:
+ $t1{t.2} = [$t0{t.1}]
+ $t1{t.2} = Lt(0 $t1{t.2})
+ if $t1{t.2} goto :bounds14
+ Error("array index out of bounds")
+bounds14:
+ $t1{t.2} = MulS(0 4)
+ $t1{t.2} = Add($t1{t.2} $t0{t.1})
+ [$t1{t.2}+4] = 20
+ $t1{t.3} = [$s0{this}+4]
+ if $t1{t.3} goto :null16
+ Error("null pointer")
+null16:
+ $t0{t.4} = [$t1{t.3}]
+ $t0{t.4} = Lt(1 $t0{t.4})
+ if $t0{t.4} goto :bounds15
+ Error("array index out of bounds")
+bounds15:
+ $t0{t.4} = MulS(1 4)
+ $t0{t.4} = Add($t0{t.4} $t1{t.3})
+ [$t0{t.4}+4] = 7
+ $t0{t.5} = [$s0{this}+4]
+ if $t0{t.5} goto :null17
+ Error("null pointer")
+null17:
+ $t1{t.6} = [$t0{t.5}]
+ $t1{t.6} = Lt(2 $t1{t.6})
+ if $t1{t.6} goto :bounds16
+ Error("array index out of bounds")
+bounds16:
+ $t1{t.6} = MulS(2 4)
+ $t1{t.6} = Add($t1{t.6} $t0{t.5})
+ [$t1{t.6}+4] = 12
+ $t1{t.7} = [$s0{this}+4]
+ if $t1{t.7} goto :null18
+ Error("null pointer")
+null18:
+ $t0{t.8} = [$t1{t.7}]
+ $t0{t.8} = Lt(3 $t0{t.8})
+ if $t0{t.8} goto :bounds17
+ Error("array index out of bounds")
+bounds17:
+ $t0{t.8} = MulS(3 4)
+ $t0{t.8} = Add($t0{t.8} $t1{t.7})
+ [$t0{t.8}+4] = 18
+ $t0{t.9} = [$s0{this}+4]
+ if $t0{t.9} goto :null19
+ Error("null pointer")
+null19:
+ $t1{t.10} = [$t0{t.9}]
+ $t1{t.10} = Lt(4 $t1{t.10})
+ if $t1{t.10} goto :bounds18
+ Error("array index out of bounds")
+bounds18:
+ $t1{t.10} = MulS(4 4)
+ $t1{t.10} = Add($t1{t.10} $t0{t.9})
+ [$t1{t.10}+4] = 2
+ $t1{t.11} = [$s0{this}+4]
+ if $t1{t.11} goto :null20
+ Error("null pointer")
+null20:
+ $t0{t.12} = [$t1{t.11}]
+ $t0{t.12} = Lt(5 $t0{t.12})
+ if $t0{t.12} goto :bounds19
+ Error("array index out of bounds")
+bounds19:
+ $t0{t.12} = MulS(5 4)
+ $t0{t.12} = Add($t0{t.12} $t1{t.11})
+ [$t0{t.12}+4] = 11
+ $t0{t.13} = [$s0{this}+4]
+ if $t0{t.13} goto :null21
+ Error("null pointer")
+null21:
+ $t1{t.14} = [$t0{t.13}]
+ $t1{t.14} = Lt(6 $t1{t.14})
+ if $t1{t.14} goto :bounds20
+ Error("array index out of bounds")
+bounds20:
+ $t1{t.14} = MulS(6 4)
+ $t1{t.14} = Add($t1{t.14} $t0{t.13})
+ [$t1{t.14}+4] = 6
+ $t1{t.15} = [$s0{this}+4]
+ if $t1{t.15} goto :null22
+ Error("null pointer")
+null22:
+ $t0{t.16} = [$t1{t.15}]
+ $t0{t.16} = Lt(7 $t0{t.16})
+ if $t0{t.16} goto :bounds21
+ Error("array index out of bounds")
+bounds21:
+ $t0{t.16} = MulS(7 4)
+ $t0{t.16} = Add($t0{t.16} $t1{t.15})
+ [$t0{t.16}+4] = 9
+ $t0{t.17} = [$s0{this}+4]
+ if $t0{t.17} goto :null23
+ Error("null pointer")
+null23:
+ $t1{t.18} = [$t0{t.17}]
+ $t1{t.18} = Lt(8 $t1{t.18})
+ if $t1{t.18} goto :bounds22
+ Error("array index out of bounds")
+bounds22:
+ $t1{t.18} = MulS(8 4)
+ $t1{t.18} = Add($t1{t.18} $t0{t.17})
+ [$t1{t.18}+4] = 19
+ $t1{t.19} = [$s0{this}+4]
+ if $t1{t.19} goto :null24
+ Error("null pointer")
+null24:
+ $t0{t.20} = [$t1{t.19}]
+ $t0{t.20} = Lt(9 $t0{t.20})
+ if $t0{t.20} goto :bounds23
+ Error("array index out of bounds")
+bounds23:
+ $t0{t.20} = MulS(9 4)
+ $t0{t.20} = Add($t0{t.20} $t1{t.19})
+ [$t0{t.20}+4] = 5
+ $v0 = 0
+ $s0 = local[0]
+ ret
+
+func AllocArray [in 0, out 0, local 0]
+ $t0{size} = $a0
+ $t1{bytes} = MulS($t0{size} 4)
+ $t1{bytes} = Add($t1{bytes} 4)
+ $t1{v} = HeapAllocZ($t1{bytes})
+ [$t1{v}] = $t0{size}
+ $v0 = $t1{v}
+ ret
+