1 ; This file contains the output from the following compiled C code:
2 ; typedef struct list {
7 ; // Iterative insert fn
8 ; void InsertIntoListTail(list **L, int Data) {
11 ; *L = (list*)malloc(sizeof(list));
16 ; // Recursive list search fn
17 ; list *FindData(list *L, int Data) {
18 ; if (L == 0) return 0;
19 ; if (L->Data == Data) return L;
20 ; return FindData(L->Next, Data);
23 ; void DoListStuff() {
25 ; InsertIntoListTail(&MyList, 100);
26 ; InsertIntoListTail(&MyList, 12);
27 ; InsertIntoListTail(&MyList, 42);
28 ; InsertIntoListTail(&MyList, 1123);
29 ; InsertIntoListTail(&MyList, 1213);
31 ; if (FindData(MyList, 75)) foundIt();
32 ; if (FindData(MyList, 42)) foundIt();
33 ; if (FindData(MyList, 700)) foundIt();
36 %list = type { %list*, int }
38 declare sbyte *"malloc"(uint)
40 ;;**********************
42 ;;**********************
44 void "InsertIntoListTail"(%list** %L, int %Data)
47 %reg116 = load %list** %L ;;<%list*>
48 %cast1004 = cast ulong 0 to %list* ;;<%list*>
49 %cond1000 = seteq %list* %reg116, %cast1004 ;;<bool>
50 br bool %cond1000, label %bb3, label %bb2
53 %reg117 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ;;<%list**>
54 %cast1010 = cast %list** %reg117 to %list*** ;;<%list***>
55 %reg118 = load %list*** %cast1010 ;;<%list**>
56 %reg109 = load %list** %reg118 ;;<%list*>
57 %cast1005 = cast ulong 0 to %list* ;;<%list*>
58 %cond1001 = setne %list* %reg109, %cast1005 ;;<bool>
59 br bool %cond1001, label %bb2, label %bb3
62 %reg119 = phi %list** [ %reg118, %bb2 ], [ %L, %bb1 ] ;;<%list**>
63 %cast1006 = cast %list** %reg119 to sbyte** ;;<sbyte**>
64 %reg111 = call sbyte* %malloc(uint 16) ;;<sbyte*>
65 store sbyte* %reg111, sbyte** %cast1006 ;;<void>
66 %reg111 = cast sbyte* %reg111 to ulong
67 %reg1002 = add ulong %reg111, 8
68 %reg1002 = cast ulong %reg1002 to sbyte* ;;<sbyte*>
69 %cast1008 = cast sbyte* %reg1002 to int* ;;<int*>
70 store int %Data, int* %cast1008 ;;<void>
71 %cast1003 = cast ulong 0 to ulong* ;;<ulong*>
72 %cast1009 = cast sbyte* %reg111 to ulong** ;;<ulong**>
73 store ulong* %cast1003, ulong** %cast1009 ;;<void>
77 %list* "FindData"(%list* %L, int %Data)
83 %reg115 = phi %list* [ %reg116, %bb6 ], [ %L, %bb1 ] ;;<%list*>
84 %cast1014 = cast ulong 0 to %list* ;;<%list*>
85 %cond1011 = setne %list* %reg115, %cast1014 ;;<bool>
86 br bool %cond1011, label %bb4, label %bb3
92 %idx = getelementptr %list* %reg115, long 0, ubyte 1 ;;<int>
93 %reg111 = load int* %idx
94 %cond1013 = setne int %reg111, %Data ;;<bool>
95 br bool %cond1013, label %bb6, label %bb5
101 %idx2 = getelementptr %list* %reg115, long 0, ubyte 0 ;;<%list*>
102 %reg116 = load %list** %idx2