diff options
Diffstat (limited to 'output/BinaryTree.vapor')
-rw-r--r-- | output/BinaryTree.vapor | 764 |
1 files changed, 764 insertions, 0 deletions
diff --git a/output/BinaryTree.vapor b/output/BinaryTree.vapor new file mode 100644 index 0000000..60719bf --- /dev/null +++ b/output/BinaryTree.vapor @@ -0,0 +1,764 @@ +func Main() + t.3 = HeapAllocZ(4) + [t.3+0] = :functable_BT + t.4 = t.3 + t.5 = [t.4+0] + t.6 = [t.5+0] + t.2 = call t.6(t.4 ) + t.7 = t.2 + PrintIntS(t.7) + ret + +const functable_BT + :BT_Start + +func BT_Start(this ) + t.2 = HeapAllocZ(104) + [t.2+0] = :functable_Tree + t.1 = t.2 + t.1 = t.1 + t.5 = [t.1+0] + t.6 = [t.5+0] + t.7 = 16 + t.4 = call t.6(t.1 t.7) + t.3 = t.4 + t.1 = t.1 + t.9 = [t.1+0] + t.10 = [t.9+72] + t.8 = call t.10(t.1 ) + t.3 = t.8 + t.11 = 100000000 + PrintIntS(t.11) + t.1 = t.1 + t.13 = [t.1+0] + t.14 = [t.13+48] + t.15 = 8 + t.12 = call t.14(t.1 t.15) + t.3 = t.12 + t.1 = t.1 + t.17 = [t.1+0] + t.18 = [t.17+72] + t.16 = call t.18(t.1 ) + t.3 = t.16 + t.1 = t.1 + t.20 = [t.1+0] + t.21 = [t.20+48] + t.22 = 24 + t.19 = call t.21(t.1 t.22) + t.3 = t.19 + t.1 = t.1 + t.24 = [t.1+0] + t.25 = [t.24+48] + t.26 = 4 + t.23 = call t.25(t.1 t.26) + t.3 = t.23 + t.1 = t.1 + t.28 = [t.1+0] + t.29 = [t.28+48] + t.30 = 12 + t.27 = call t.29(t.1 t.30) + t.3 = t.27 + t.1 = t.1 + t.32 = [t.1+0] + t.33 = [t.32+48] + t.34 = 20 + t.31 = call t.33(t.1 t.34) + t.3 = t.31 + t.1 = t.1 + t.36 = [t.1+0] + t.37 = [t.36+48] + t.38 = 28 + t.35 = call t.37(t.1 t.38) + t.3 = t.35 + t.1 = t.1 + t.40 = [t.1+0] + t.41 = [t.40+48] + t.42 = 14 + t.39 = call t.41(t.1 t.42) + t.3 = t.39 + t.1 = t.1 + t.44 = [t.1+0] + t.45 = [t.44+72] + t.43 = call t.45(t.1 ) + t.3 = t.43 + t.1 = t.1 + t.47 = [t.1+0] + t.48 = [t.47+68] + t.49 = 24 + t.46 = call t.48(t.1 t.49) + t.50 = t.46 + PrintIntS(t.50) + t.1 = t.1 + t.52 = [t.1+0] + t.53 = [t.52+68] + t.54 = 12 + t.51 = call t.53(t.1 t.54) + t.55 = t.51 + PrintIntS(t.55) + t.1 = t.1 + t.57 = [t.1+0] + t.58 = [t.57+68] + t.59 = 16 + t.56 = call t.58(t.1 t.59) + t.60 = t.56 + PrintIntS(t.60) + t.1 = t.1 + t.62 = [t.1+0] + t.63 = [t.62+68] + t.64 = 50 + t.61 = call t.63(t.1 t.64) + t.65 = t.61 + PrintIntS(t.65) + t.1 = t.1 + t.67 = [t.1+0] + t.68 = [t.67+68] + t.69 = 12 + t.66 = call t.68(t.1 t.69) + t.70 = t.66 + PrintIntS(t.70) + t.1 = t.1 + t.72 = [t.1+0] + t.73 = [t.72+52] + t.74 = 12 + t.71 = call t.73(t.1 t.74) + t.3 = t.71 + t.1 = t.1 + t.76 = [t.1+0] + t.77 = [t.76+72] + t.75 = call t.77(t.1 ) + t.3 = t.75 + t.1 = t.1 + t.79 = [t.1+0] + t.80 = [t.79+68] + t.81 = 12 + t.78 = call t.80(t.1 t.81) + t.82 = t.78 + PrintIntS(t.82) + t.83 = 0 + ret t.83 + +const functable_Tree + :Tree_Init + :Tree_SetRight + :Tree_SetLeft + :Tree_GetRight + :Tree_GetLeft + :Tree_GetKey + :Tree_SetKey + :Tree_GetHas_Right + :Tree_GetHas_Left + :Tree_SetHas_Left + :Tree_SetHas_Right + :Tree_Compare + :Tree_Insert + :Tree_Delete + :Tree_Remove + :Tree_RemoveRight + :Tree_RemoveLeft + :Tree_Search + :Tree_Print + :Tree_RecPrint + +func Tree_Init(this t.0 ) + [this+88] = t.0 + [this+92] = 0 + [this+96] = 0 + t.1 = 1 + ret t.1 + +func Tree_SetRight(this t.0 ) + [this+84] = t.0 + t.1 = 1 + ret t.1 + +func Tree_SetLeft(this t.0 ) + [this+80] = t.0 + t.1 = 1 + ret t.1 + +func Tree_GetRight(this ) + t.0 = [this+84] + ret t.0 + +func Tree_GetLeft(this ) + t.0 = [this+80] + ret t.0 + +func Tree_GetKey(this ) + t.0 = [this+88] + ret t.0 + +func Tree_SetKey(this t.0 ) + [this+88] = t.0 + t.1 = 1 + ret t.1 + +func Tree_GetHas_Right(this ) + t.0 = [this+96] + ret t.0 + +func Tree_GetHas_Left(this ) + t.0 = [this+92] + ret t.0 + +func Tree_SetHas_Left(this t.0 ) + [this+92] = t.0 + t.1 = 1 + ret t.1 + +func Tree_SetHas_Right(this t.0 ) + [this+96] = t.0 + t.1 = 1 + ret t.1 + +func Tree_Compare(this t.0 t.1 ) + t.2 = 0 + t.5 = t.1 + t.6 = 1 + t.4 = Add(t.5 t.6) + t.3 = t.4 + t.8 = t.0 + t.9 = t.1 + t.7 = LtS(t.8 t.9) + t.10 = t.7 + if0 t.10 goto :if100_else +if100_body: + t.2 = 0 + goto :if100_end +if100_else: + t.13 = t.0 + t.14 = t.3 + t.12 = LtS(t.13 t.14) + t.11 = Eq(t.12 0) + t.15 = t.11 + if0 t.15 goto :if104_else +if104_body: + t.2 = 0 + goto :if104_end +if104_else: + t.2 = 1 +if104_end: +if100_end: + t.16 = t.2 + ret t.16 + +func Tree_Insert(this t.0 ) + t.3 = HeapAllocZ(104) + [t.3+0] = :functable_Tree + t.2 = t.3 + t.2 = t.2 + t.6 = [t.2+0] + t.7 = [t.6+0] + t.8 = t.0 + t.5 = call t.7(t.2 t.8) + t.4 = t.5 + t.9 = this + t.10 = 1 +while115_test: + t.11 = t.10 + if0 t.11 goto :while115_end +while115_body: + t.9 = t.9 + t.14 = [t.9+0] + t.15 = [t.14+20] + t.13 = call t.15(t.9 ) + t.12 = t.13 + t.17 = t.0 + t.18 = t.12 + t.16 = LtS(t.17 t.18) + t.19 = t.16 + if0 t.19 goto :if120_else +if120_body: + t.9 = t.9 + t.21 = [t.9+0] + t.22 = [t.21+32] + t.20 = call t.22(t.9 ) + t.23 = t.20 + if0 t.23 goto :if124_else +if124_body: + t.9 = t.9 + t.25 = [t.9+0] + t.26 = [t.25+16] + t.24 = call t.26(t.9 ) + t.9 = t.24 + goto :if124_end +if124_else: + t.10 = 0 + t.9 = t.9 + t.28 = [t.9+0] + t.29 = [t.28+36] + t.30 = 1 + t.27 = call t.29(t.9 t.30) + t.4 = t.27 + t.9 = t.9 + t.32 = [t.9+0] + t.33 = [t.32+8] + t.34 = t.2 + t.31 = call t.33(t.9 t.34) + t.4 = t.31 +if124_end: + goto :if120_end +if120_else: + t.9 = t.9 + t.36 = [t.9+0] + t.37 = [t.36+28] + t.35 = call t.37(t.9 ) + t.38 = t.35 + if0 t.38 goto :if139_else +if139_body: + t.9 = t.9 + t.40 = [t.9+0] + t.41 = [t.40+12] + t.39 = call t.41(t.9 ) + t.9 = t.39 + goto :if139_end +if139_else: + t.10 = 0 + t.9 = t.9 + t.43 = [t.9+0] + t.44 = [t.43+40] + t.45 = 1 + t.42 = call t.44(t.9 t.45) + t.4 = t.42 + t.9 = t.9 + t.47 = [t.9+0] + t.48 = [t.47+4] + t.49 = t.2 + t.46 = call t.48(t.9 t.49) + t.4 = t.46 +if139_end: +if120_end: + goto :while115_test +while115_end: + t.50 = 1 + ret t.50 + +func Tree_Delete(this t.0 ) + t.2 = this + t.3 = this + t.4 = 1 + t.5 = 0 + t.6 = 1 +while155_test: + t.7 = t.4 + if0 t.7 goto :while155_end +while155_body: + t.2 = t.2 + t.10 = [t.2+0] + t.11 = [t.10+20] + t.9 = call t.11(t.2 ) + t.8 = t.9 + t.13 = t.0 + t.14 = t.8 + t.12 = LtS(t.13 t.14) + t.15 = t.12 + if0 t.15 goto :if160_else +if160_body: + t.2 = t.2 + t.17 = [t.2+0] + t.18 = [t.17+32] + t.16 = call t.18(t.2 ) + t.19 = t.16 + if0 t.19 goto :if164_else +if164_body: + t.3 = t.2 + t.2 = t.2 + t.21 = [t.2+0] + t.22 = [t.21+16] + t.20 = call t.22(t.2 ) + t.2 = t.20 + goto :if164_end +if164_else: + t.4 = 0 +if164_end: + goto :if160_end +if160_else: + t.24 = t.8 + t.25 = t.0 + t.23 = LtS(t.24 t.25) + t.26 = t.23 + if0 t.26 goto :if171_else +if171_body: + t.2 = t.2 + t.28 = [t.2+0] + t.29 = [t.28+28] + t.27 = call t.29(t.2 ) + t.30 = t.27 + if0 t.30 goto :if175_else +if175_body: + t.3 = t.2 + t.2 = t.2 + t.32 = [t.2+0] + t.33 = [t.32+12] + t.31 = call t.33(t.2 ) + t.2 = t.31 + goto :if175_end +if175_else: + t.4 = 0 +if175_end: + goto :if171_end +if171_else: + t.34 = t.6 + if0 t.34 goto :if182_else +if182_body: + t.2 = t.2 + t.38 = [t.2+0] + t.39 = [t.38+28] + t.37 = call t.39(t.2 ) + t.36 = Eq(t.37 0) + t.40 = t.36 + t.2 = t.2 + t.43 = [t.2+0] + t.44 = [t.43+32] + t.42 = call t.44(t.2 ) + t.41 = Eq(t.42 0) + t.45 = t.41 + t.46 = Eq(1 t.40) + t.47 = Eq(1 t.45) + t.35 = Eq(t.46 t.47) + t.48 = t.35 + if0 t.48 goto :if183_else +if183_body: + t.49 = 1 + goto :if183_end +if183_else: + t.51 = [this] + t.52 = t.3 + t.53 = t.2 + t.51 = [t.51+56] + t.50 = call t.51(this t.52 t.53) + t.49 = t.50 +if183_end: + goto :if182_end +if182_else: + t.55 = [this] + t.56 = t.3 + t.57 = t.2 + t.55 = [t.55+56] + t.54 = call t.55(this t.56 t.57) + t.49 = t.54 +if182_end: + t.5 = 1 + t.4 = 0 +if171_end: +if160_end: + t.6 = 0 + goto :while155_test +while155_end: + t.58 = t.5 + ret t.58 + +func Tree_Remove(this t.0 t.1 ) + t.1 = t.1 + t.3 = [t.1+0] + t.4 = [t.3+32] + t.2 = call t.4(t.1 ) + t.5 = t.2 + if0 t.5 goto :if206_else +if206_body: + t.8 = [this] + t.9 = t.0 + t.10 = t.1 + t.8 = [t.8+64] + t.7 = call t.8(this t.9 t.10) + t.6 = t.7 + goto :if206_end +if206_else: + t.1 = t.1 + t.12 = [t.1+0] + t.13 = [t.12+28] + t.11 = call t.13(t.1 ) + t.14 = t.11 + if0 t.14 goto :if214_else +if214_body: + t.16 = [this] + t.17 = t.0 + t.18 = t.1 + t.16 = [t.16+60] + t.15 = call t.16(this t.17 t.18) + t.6 = t.15 + goto :if214_end +if214_else: + t.1 = t.1 + t.21 = [t.1+0] + t.22 = [t.21+20] + t.20 = call t.22(t.1 ) + t.19 = t.20 + t.0 = t.0 + t.26 = [t.0+0] + t.27 = [t.26+16] + t.25 = call t.27(t.0 ) + t.28 = t.25 + t.29 = [t.28+0] + t.30 = [t.29+20] + t.24 = call t.30(t.28 ) + t.23 = t.24 + t.32 = [this] + t.33 = t.19 + t.34 = t.23 + t.32 = [t.32+44] + t.31 = call t.32(this t.33 t.34) + t.35 = t.31 + if0 t.35 goto :if232_else +if232_body: + t.0 = t.0 + t.37 = [t.0+0] + t.38 = [t.37+8] + t.39 = [this+100] + t.36 = call t.38(t.0 t.39) + t.6 = t.36 + t.0 = t.0 + t.41 = [t.0+0] + t.42 = [t.41+36] + t.43 = 0 + t.40 = call t.42(t.0 t.43) + t.6 = t.40 + goto :if232_end +if232_else: + t.0 = t.0 + t.45 = [t.0+0] + t.46 = [t.45+4] + t.47 = [this+100] + t.44 = call t.46(t.0 t.47) + t.6 = t.44 + t.0 = t.0 + t.49 = [t.0+0] + t.50 = [t.49+40] + t.51 = 0 + t.48 = call t.50(t.0 t.51) + t.6 = t.48 +if232_end: +if214_end: +if206_end: + t.52 = 1 + ret t.52 + +func Tree_RemoveRight(this t.0 t.1 ) +while254_test: + t.1 = t.1 + t.3 = [t.1+0] + t.4 = [t.3+28] + t.2 = call t.4(t.1 ) + t.5 = t.2 + if0 t.5 goto :while254_end +while254_body: + t.1 = t.1 + t.8 = [t.1+0] + t.9 = [t.8+24] + t.1 = t.1 + t.12 = [t.1+0] + t.13 = [t.12+12] + t.11 = call t.13(t.1 ) + t.14 = t.11 + t.15 = [t.14+0] + t.16 = [t.15+20] + t.10 = call t.16(t.14 ) + t.17 = t.10 + t.7 = call t.9(t.1 t.17) + t.6 = t.7 + t.0 = t.1 + t.1 = t.1 + t.19 = [t.1+0] + t.20 = [t.19+12] + t.18 = call t.20(t.1 ) + t.1 = t.18 + goto :while254_test +while254_end: + t.0 = t.0 + t.22 = [t.0+0] + t.23 = [t.22+4] + t.24 = [this+100] + t.21 = call t.23(t.0 t.24) + t.6 = t.21 + t.0 = t.0 + t.26 = [t.0+0] + t.27 = [t.26+40] + t.28 = 0 + t.25 = call t.27(t.0 t.28) + t.6 = t.25 + t.29 = 1 + ret t.29 + +func Tree_RemoveLeft(this t.0 t.1 ) +while282_test: + t.1 = t.1 + t.3 = [t.1+0] + t.4 = [t.3+32] + t.2 = call t.4(t.1 ) + t.5 = t.2 + if0 t.5 goto :while282_end +while282_body: + t.1 = t.1 + t.8 = [t.1+0] + t.9 = [t.8+24] + t.1 = t.1 + t.12 = [t.1+0] + t.13 = [t.12+16] + t.11 = call t.13(t.1 ) + t.14 = t.11 + t.15 = [t.14+0] + t.16 = [t.15+20] + t.10 = call t.16(t.14 ) + t.17 = t.10 + t.7 = call t.9(t.1 t.17) + t.6 = t.7 + t.0 = t.1 + t.1 = t.1 + t.19 = [t.1+0] + t.20 = [t.19+16] + t.18 = call t.20(t.1 ) + t.1 = t.18 + goto :while282_test +while282_end: + t.0 = t.0 + t.22 = [t.0+0] + t.23 = [t.22+8] + t.24 = [this+100] + t.21 = call t.23(t.0 t.24) + t.6 = t.21 + t.0 = t.0 + t.26 = [t.0+0] + t.27 = [t.26+36] + t.28 = 0 + t.25 = call t.27(t.0 t.28) + t.6 = t.25 + t.29 = 1 + ret t.29 + +func Tree_Search(this t.0 ) + t.2 = this + t.3 = 1 + t.4 = 0 +while310_test: + t.5 = t.3 + if0 t.5 goto :while310_end +while310_body: + t.2 = t.2 + t.8 = [t.2+0] + t.9 = [t.8+20] + t.7 = call t.9(t.2 ) + t.6 = t.7 + t.11 = t.0 + t.12 = t.6 + t.10 = LtS(t.11 t.12) + t.13 = t.10 + if0 t.13 goto :if315_else +if315_body: + t.2 = t.2 + t.15 = [t.2+0] + t.16 = [t.15+32] + t.14 = call t.16(t.2 ) + t.17 = t.14 + if0 t.17 goto :if319_else +if319_body: + t.2 = t.2 + t.19 = [t.2+0] + t.20 = [t.19+16] + t.18 = call t.20(t.2 ) + t.2 = t.18 + goto :if319_end +if319_else: + t.3 = 0 +if319_end: + goto :if315_end +if315_else: + t.22 = t.6 + t.23 = t.0 + t.21 = LtS(t.22 t.23) + t.24 = t.21 + if0 t.24 goto :if326_else +if326_body: + t.2 = t.2 + t.26 = [t.2+0] + t.27 = [t.26+28] + t.25 = call t.27(t.2 ) + t.28 = t.25 + if0 t.28 goto :if330_else +if330_body: + t.2 = t.2 + t.30 = [t.2+0] + t.31 = [t.30+12] + t.29 = call t.31(t.2 ) + t.2 = t.29 + goto :if330_end +if330_else: + t.3 = 0 +if330_end: + goto :if326_end +if326_else: + t.4 = 1 + t.3 = 0 +if326_end: +if315_end: + goto :while310_test +while310_end: + t.32 = t.4 + ret t.32 + +func Tree_Print(this ) + t.1 = this + t.4 = [this] + t.5 = t.1 + t.4 = [t.4+76] + t.3 = call t.4(this t.5) + t.2 = t.3 + t.6 = 1 + ret t.6 + +func Tree_RecPrint(this t.0 ) + t.0 = t.0 + t.2 = [t.0+0] + t.3 = [t.2+32] + t.1 = call t.3(t.0 ) + t.4 = t.1 + if0 t.4 goto :if342_else +if342_body: + t.7 = [this] + t.0 = t.0 + t.9 = [t.0+0] + t.10 = [t.9+16] + t.8 = call t.10(t.0 ) + t.11 = t.8 + t.7 = [t.7+76] + t.6 = call t.7(this t.11) + t.5 = t.6 + goto :if342_end +if342_else: + t.5 = 1 +if342_end: + t.0 = t.0 + t.13 = [t.0+0] + t.14 = [t.13+20] + t.12 = call t.14(t.0 ) + t.15 = t.12 + PrintIntS(t.15) + t.0 = t.0 + t.17 = [t.0+0] + t.18 = [t.17+28] + t.16 = call t.18(t.0 ) + t.19 = t.16 + if0 t.19 goto :if356_else +if356_body: + t.21 = [this] + t.0 = t.0 + t.23 = [t.0+0] + t.24 = [t.23+12] + t.22 = call t.24(t.0 ) + t.25 = t.22 + t.21 = [t.21+76] + t.20 = call t.21(this t.25) + t.5 = t.20 + goto :if356_end +if356_else: + t.5 = 1 +if356_end: + t.26 = 1 + ret t.26 + +func AllocArray(size) + bytes = MulS(size 4) + bytes = Add(bytes 4) + v = HeapAllocZ(bytes) + [v] = size + ret v + |