Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- ; MINI ENVIRONMENT
- declare i8* @malloc(i64)
- declare void @free(i8*)
- declare i32 @printf(i8*, ...)
- declare i32 @scanf(i8*, ...)
- @.println = private unnamed_addr constant [5 x i8] c"%ld\0A\00", align 1
- @.print = private unnamed_addr constant [5 x i8] c"%ld \00", align 1
- @.read = private unnamed_addr constant [4 x i8] c"%ld\00", align 1
- @.read_scratch = common global i64 0, align 8
- ; PROGRAM STRUCTS
- %struct.A = type {i64, i64, i64, %struct.A*}
- %struct.B = type {%struct.A*}
- ; PROGRAM GLOBALS
- @i = common global i64 0, align 8
- @j = common global i64 0, align 8
- @k = common global i64 0, align 8
- @b = common global %struct.B* null, align 8
- @bb = common global %struct.B* null, align 8
- @bbb = common global %struct.B* null, align 8
- @bob = common global i64 0, align 8
- ; FUNCTION DEFINITIONS
- define %struct.A* @f(i64 %i, %struct.B* %j)
- {
- %f = alloca i64
- %l = alloca i64
- L12:
- br L11
- L11:
- %m.u1 = mul i64 999, -1
- store i64 %m.u1, i64* %l
- br L6
- L6:
- %m.u2 = load i64, i64* %l
- %m.u3 = icmp sgt i64 %m.u2, 101
- %m.u4 = xor i64 %m.u3, 1
- br i1 %m.u4, label L9, label L5
- L9:
- %m.u5 = load i64, i64* %l
- %m.u6 = load i64, i64* @k
- %m.u7 = mul i64 %m.u5, %m.u6
- store i64 %m.u7, i64* %f
- %m.u8 = load i64, i64* %l
- %m.u9 = add i64 %m.u8, 2
- store i64 %m.u9, i64* %l
- br L6
- L5:
- br L4
- L4:
- %m.u10 = load i64, i64* %f
- ret i64 %m.u10
- }
- define i64 @main()
- {
- %a = alloca i64
- %b = alloca i64
- %h = alloca i64
- %i = alloca i64
- %j = alloca i64
- L29:
- br L28
- L28:
- br L27
- L27:
- %m.u11 = load i64, i64* @k
- %m.u12 = icmp sgt i64 %m.u11, 0
- br i1 %m.u12, label L19, label L26
- L19:
- ret i64 0
- L17:
- %m.u13 = add i64 1, 1
- store i64 %m.u13, i64* %a
- br L15
- L15:
- ret i64 0
- L26:
- br L25
- L25:
- br i1 0, label L22, label L24
- L22:
- %m.u14 = load i64, i64* @k
- ret i64 %m.u14
- L20:
- br L17
- L24:
- %m.u15 = and i64 1, 0
- ret i64 %m.u15
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement