summaryrefslogtreecommitdiff
path: root/vaporize/tests/LinkedList.opt.vapor
diff options
context:
space:
mode:
authorbd-912 <bdunahu@colostate.edu>2024-04-10 23:40:25 -0600
committerbd-912 <bdunahu@colostate.edu>2024-04-10 23:40:25 -0600
commit1080b37bbe40fe56b919d22804c159cccdca3c95 (patch)
tree8ddbb9528f575e537f925b266c8f366be6acc8b7 /vaporize/tests/LinkedList.opt.vapor
parent61a28b7f8e709d1884ccab15f0dc38ed19dfde70 (diff)
Library rename, created A4 directories
Diffstat (limited to 'vaporize/tests/LinkedList.opt.vapor')
-rw-r--r--vaporize/tests/LinkedList.opt.vapor373
1 files changed, 0 insertions, 373 deletions
diff --git a/vaporize/tests/LinkedList.opt.vapor b/vaporize/tests/LinkedList.opt.vapor
deleted file mode 100644
index aaca62c..0000000
--- a/vaporize/tests/LinkedList.opt.vapor
+++ /dev/null
@@ -1,373 +0,0 @@
-
-const empty_Element
-
-const empty_List
-
-const empty_LL
-
-
-func Main()
- t.0 = call :LL.Start(:empty_LL)
- PrintIntS(t.0)
- ret
-
-func Element.Init(this v_Age v_Salary v_Married)
- [this+0] = v_Age
- [this+4] = v_Salary
- [this+8] = v_Married
- ret 1
-
-func Element.GetAge(this)
- t.0 = [this+0]
- ret t.0
-
-func Element.GetSalary(this)
- t.0 = [this+4]
- ret t.0
-
-func Element.GetMarried(this)
- t.0 = [this+8]
- ret t.0
-
-func Element.Equal(this other)
- ret_val = 1
- if other goto :null1
- Error("null pointer")
- null1:
- aux01 = call :Element.GetAge(other)
- t.0 = [this+0]
- t.1 = call :Element.Compare(this aux01 t.0)
- if t.1 goto :if1_else
- ret_val = 0
- goto :if1_end
- if1_else:
- if other goto :null2
- Error("null pointer")
- null2:
- aux02 = call :Element.GetSalary(other)
- t.2 = [this+4]
- t.3 = call :Element.Compare(this aux02 t.2)
- if t.3 goto :if2_else
- ret_val = 0
- goto :if2_end
- if2_else:
- t.4 = [this+8]
- if0 t.4 goto :if3_else
- if other goto :null3
- Error("null pointer")
- null3:
- t.5 = call :Element.GetMarried(other)
- if t.5 goto :if4_else
- ret_val = 0
- goto :if4_end
- if4_else:
- nt = 0
- if4_end:
- goto :if3_end
- if3_else:
- if other goto :null4
- Error("null pointer")
- null4:
- t.6 = call :Element.GetMarried(other)
- if0 t.6 goto :if5_else
- ret_val = 0
- goto :if5_end
- if5_else:
- nt = 0
- if5_end:
- if3_end:
- if2_end:
- if1_end:
- ret ret_val
-
-func Element.Compare(this num1 num2)
- retval = 0
- aux02 = Add(num2 1)
- t.0 = LtS(num1 num2)
- if0 t.0 goto :if6_else
- retval = 0
- goto :if6_end
- if6_else:
- t.1 = LtS(num1 aux02)
- if t.1 goto :if7_else
- retval = 0
- goto :if7_end
- if7_else:
- retval = 1
- if7_end:
- if6_end:
- ret retval
-
-func List.Init(this)
- [this+8] = 1
- ret 1
-
-func List.InitNew(this v_elem v_next v_end)
- [this+8] = v_end
- [this+0] = v_elem
- [this+4] = v_next
- ret 1
-
-func List.Insert(this new_elem)
- aux03 = this
- aux02 = HeapAllocZ(12)
- if aux02 goto :null5
- Error("null pointer")
- null5:
- ret_val = call :List.InitNew(aux02 new_elem aux03 0)
- ret aux02
-
-func List.SetNext(this v_next)
- [this+4] = v_next
- ret 1
-
-func List.Delete(this e)
- my_head = this
- ret_val = 0
- aux04 = Sub(0 1)
- aux01 = this
- prev = this
- var_end = [this+8]
- var_elem = [this+0]
- while1_top:
- if var_end goto :ss1_else
- t.0 = Sub(1 ret_val)
- goto :ss1_end
- ss1_else:
- t.0 = 0
- ss1_end:
- if0 t.0 goto :while1_end
- if e goto :null6
- Error("null pointer")
- null6:
- t.1 = call :Element.Equal(e var_elem)
- if0 t.1 goto :if8_else
- ret_val = 1
- t.2 = LtS(aux04 0)
- if0 t.2 goto :if9_else
- if aux01 goto :null7
- Error("null pointer")
- null7:
- my_head = call :List.GetNext(aux01)
- goto :if9_end
- if9_else:
- t.3 = Sub(0 555)
- PrintIntS(t.3)
- if prev goto :null8
- Error("null pointer")
- null8:
- if aux01 goto :null9
- Error("null pointer")
- null9:
- t.4 = call :List.GetNext(aux01)
- aux05 = call :List.SetNext(prev t.4)
- t.5 = Sub(0 555)
- PrintIntS(t.5)
- if9_end:
- goto :if8_end
- if8_else:
- nt = 0
- if8_end:
- if ret_val goto :if10_else
- prev = aux01
- if aux01 goto :null10
- Error("null pointer")
- null10:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null11
- Error("null pointer")
- null11:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null12
- Error("null pointer")
- null12:
- var_elem = call :List.GetElem(aux01)
- aux04 = 1
- goto :if10_end
- if10_else:
- nt = 0
- if10_end:
- goto :while1_top
- while1_end:
- ret my_head
-
-func List.Search(this e)
- int_ret_val = 0
- aux01 = this
- var_end = [this+8]
- var_elem = [this+0]
- while2_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while2_end
- if e goto :null13
- Error("null pointer")
- null13:
- t.1 = call :Element.Equal(e var_elem)
- if0 t.1 goto :if11_else
- int_ret_val = 1
- goto :if11_end
- if11_else:
- nt = 0
- if11_end:
- if aux01 goto :null14
- Error("null pointer")
- null14:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null15
- Error("null pointer")
- null15:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null16
- Error("null pointer")
- null16:
- var_elem = call :List.GetElem(aux01)
- goto :while2_top
- while2_end:
- ret int_ret_val
-
-func List.GetEnd(this)
- t.0 = [this+8]
- ret t.0
-
-func List.GetElem(this)
- t.0 = [this+0]
- ret t.0
-
-func List.GetNext(this)
- t.0 = [this+4]
- ret t.0
-
-func List.Print(this)
- aux01 = this
- var_end = [this+8]
- var_elem = [this+0]
- while3_top:
- t.0 = Sub(1 var_end)
- if0 t.0 goto :while3_end
- if var_elem goto :null17
- Error("null pointer")
- null17:
- t.1 = call :Element.GetAge(var_elem)
- PrintIntS(t.1)
- if aux01 goto :null18
- Error("null pointer")
- null18:
- aux01 = call :List.GetNext(aux01)
- if aux01 goto :null19
- Error("null pointer")
- null19:
- var_end = call :List.GetEnd(aux01)
- if aux01 goto :null20
- Error("null pointer")
- null20:
- var_elem = call :List.GetElem(aux01)
- goto :while3_top
- while3_end:
- ret 1
-
-func LL.Start(this)
- last_elem = HeapAllocZ(12)
- if last_elem goto :null21
- Error("null pointer")
- null21:
- aux01 = call :List.Init(last_elem)
- head = last_elem
- if head goto :null22
- Error("null pointer")
- null22:
- aux01 = call :List.Init(head)
- if head goto :null23
- Error("null pointer")
- null23:
- aux01 = call :List.Print(head)
- el01 = HeapAllocZ(12)
- if el01 goto :null24
- Error("null pointer")
- null24:
- aux01 = call :Element.Init(el01 25 37000 0)
- if head goto :null25
- Error("null pointer")
- null25:
- head = call :List.Insert(head el01)
- if head goto :null26
- Error("null pointer")
- null26:
- aux01 = call :List.Print(head)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null27
- Error("null pointer")
- null27:
- aux01 = call :Element.Init(el01 39 42000 1)
- el02 = el01
- if head goto :null28
- Error("null pointer")
- null28:
- head = call :List.Insert(head el01)
- if head goto :null29
- Error("null pointer")
- null29:
- aux01 = call :List.Print(head)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null30
- Error("null pointer")
- null30:
- aux01 = call :Element.Init(el01 22 34000 0)
- if head goto :null31
- Error("null pointer")
- null31:
- head = call :List.Insert(head el01)
- if head goto :null32
- Error("null pointer")
- null32:
- aux01 = call :List.Print(head)
- el03 = HeapAllocZ(12)
- if el03 goto :null33
- Error("null pointer")
- null33:
- aux01 = call :Element.Init(el03 27 34000 0)
- if head goto :null34
- Error("null pointer")
- null34:
- t.0 = call :List.Search(head el02)
- PrintIntS(t.0)
- if head goto :null35
- Error("null pointer")
- null35:
- t.1 = call :List.Search(head el03)
- PrintIntS(t.1)
- PrintIntS(10000000)
- el01 = HeapAllocZ(12)
- if el01 goto :null36
- Error("null pointer")
- null36:
- aux01 = call :Element.Init(el01 28 35000 0)
- if head goto :null37
- Error("null pointer")
- null37:
- head = call :List.Insert(head el01)
- if head goto :null38
- Error("null pointer")
- null38:
- aux01 = call :List.Print(head)
- PrintIntS(2220000)
- if head goto :null39
- Error("null pointer")
- null39:
- head = call :List.Delete(head el02)
- if head goto :null40
- Error("null pointer")
- null40:
- aux01 = call :List.Print(head)
- PrintIntS(33300000)
- if head goto :null41
- Error("null pointer")
- null41:
- head = call :List.Delete(head el01)
- if head goto :null42
- Error("null pointer")
- null42:
- aux01 = call :List.Print(head)
- PrintIntS(44440000)
- ret 0