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
- L10:
- br L9
- L9:
- br L6
- L6:
- br i1 1, label L8, label L5
- L8:
- %m.u1 = load i64, i64* %l
- %m.u2 = load i64, i64* @k
- %m.u3 = mul i64 %m.u1, %m.u2
- store i64 %m.u3, i64* %f
- br L6
- L5:
- br L4
- L4:
- %m.u4 = load i64, i64* %f
- ret i64 %m.u4
- }
- define i64 @main()
- {
- %a = alloca i64
- %b = alloca i64
- %h = alloca i64
- %i = alloca i64
- %j = alloca i64
- L27:
- br L26
- L26:
- br L25
- L25:
- %m.u5 = load i64, i64* @k
- %m.u6 = icmp sgt i64 %m.u5, 0
- br i1 %m.u6, label L17, label L24
- L17:
- ret i64 0
- L15:
- %m.u7 = add i64 1, 1
- store i64 %m.u7, i64* %a
- br L13
- L13:
- ret i64 0
- L24:
- br L23
- L23:
- br i1 0, label L20, label L22
- L20:
- %m.u8 = load i64, i64* @k
- ret i64 %m.u8
- L18:
- br L15
- L22:
- %m.u9 = and i64 1, 0
- ret i64 %m.u9
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement