You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

272 lines
7.9 KiB

declare i32 @getint()
declare float @getfloat()
declare i32 @getarray(i32* %arg.a)
declare i32 @getfarray(float* %arg.a)
declare i32 @getch()
declare void @putint(i32 %arg.x)
declare void @putfloat(float %arg.x)
declare void @putarray(i32 %arg.n, i32* %arg.a)
declare void @putfarray(i32 %arg.n, float* %arg.a)
declare void @putch(i32 %arg.x)
declare void @starttime()
declare void @stoptime()
define i32 @func1(i32 %arg.x, i32 %arg.y, i32 %arg.z) {
entry:
%t0 = alloca i32
store i32 %arg.x, i32* %t0
%t1 = alloca i32
store i32 %arg.y, i32* %t1
%t2 = alloca i32
store i32 %arg.z, i32* %t2
%t3 = load i32, i32* %t2
%t4 = icmp eq i32 %t3, 0
%t5 = zext i1 %t4 to i32
%t6 = icmp ne i32 %t5, 0
br i1 %t6, label %if.then.1, label %if.else.2
if.then.1:
%t7 = load i32, i32* %t0
%t8 = load i32, i32* %t1
%t9 = mul i32 %t7, %t8
ret i32 %t9
if.else.2:
%t10 = load i32, i32* %t0
%t11 = load i32, i32* %t1
%t12 = load i32, i32* %t2
%t13 = sub i32 %t11, %t12
%t14 = call i32 @func1(i32 %t10, i32 %t13, i32 0)
ret i32 %t14
if.end.3:
ret i32 0
}
define i32 @func2(i32 %arg.x, i32 %arg.y) {
entry:
%t15 = alloca i32
store i32 %arg.x, i32* %t15
%t16 = alloca i32
store i32 %arg.y, i32* %t16
%t17 = load i32, i32* %t16
%t18 = icmp ne i32 %t17, 0
br i1 %t18, label %if.then.4, label %if.else.5
if.then.4:
%t19 = load i32, i32* %t15
%t20 = load i32, i32* %t16
%t21 = srem i32 %t19, %t20
%t22 = call i32 @func2(i32 %t21, i32 0)
ret i32 %t22
if.else.5:
%t23 = load i32, i32* %t15
ret i32 %t23
if.end.6:
ret i32 0
}
define i32 @func3(i32 %arg.x, i32 %arg.y) {
entry:
%t24 = alloca i32
store i32 %arg.x, i32* %t24
%t25 = alloca i32
store i32 %arg.y, i32* %t25
%t26 = load i32, i32* %t25
%t27 = icmp eq i32 %t26, 0
%t28 = zext i1 %t27 to i32
%t29 = icmp ne i32 %t28, 0
br i1 %t29, label %if.then.7, label %if.else.8
if.then.7:
%t30 = load i32, i32* %t24
%t31 = add i32 %t30, 1
ret i32 %t31
if.else.8:
%t32 = load i32, i32* %t24
%t33 = load i32, i32* %t25
%t34 = add i32 %t32, %t33
%t35 = call i32 @func3(i32 %t34, i32 0)
ret i32 %t35
if.end.9:
ret i32 0
}
define i32 @func4(i32 %arg.x, i32 %arg.y, i32 %arg.z) {
entry:
%t36 = alloca i32
store i32 %arg.x, i32* %t36
%t37 = alloca i32
store i32 %arg.y, i32* %t37
%t38 = alloca i32
store i32 %arg.z, i32* %t38
%t39 = load i32, i32* %t36
%t40 = icmp ne i32 %t39, 0
br i1 %t40, label %if.then.10, label %if.else.11
if.then.10:
%t41 = load i32, i32* %t37
ret i32 %t41
if.else.11:
%t42 = load i32, i32* %t38
ret i32 %t42
if.end.12:
ret i32 0
}
define i32 @func5(i32 %arg.x) {
entry:
%t43 = alloca i32
store i32 %arg.x, i32* %t43
%t44 = load i32, i32* %t43
%t45 = sub i32 0, %t44
ret i32 %t45
}
define i32 @func6(i32 %arg.x, i32 %arg.y) {
entry:
%t46 = alloca i32
store i32 %arg.x, i32* %t46
%t47 = alloca i32
store i32 %arg.y, i32* %t47
%t48 = load i32, i32* %t46
%t49 = icmp ne i32 %t48, 0
br i1 %t49, label %land.rhs.16, label %if.else.14
if.then.13:
ret i32 1
if.else.14:
ret i32 0
if.end.15:
ret i32 0
land.rhs.16:
%t50 = load i32, i32* %t47
%t51 = icmp ne i32 %t50, 0
br i1 %t51, label %if.then.13, label %if.else.14
}
define i32 @func7(i32 %arg.x) {
entry:
%t52 = alloca i32
store i32 %arg.x, i32* %t52
%t53 = load i32, i32* %t52
%t54 = icmp eq i32 %t53, 0
%t55 = zext i1 %t54 to i32
%t56 = icmp ne i32 %t55, 0
br i1 %t56, label %if.then.17, label %if.else.18
if.then.17:
ret i32 1
if.else.18:
ret i32 0
if.end.19:
ret i32 0
}
define i32 @main() {
entry:
%t57 = alloca i32
%t59 = alloca i32
%t61 = alloca i32
%t63 = alloca i32
%t65 = alloca i32, i32 10
%t66 = alloca i32
%t76 = alloca i32
%t58 = call i32 @getint()
store i32 %t58, i32* %t57
%t60 = call i32 @getint()
store i32 %t60, i32* %t59
%t62 = call i32 @getint()
store i32 %t62, i32* %t61
%t64 = call i32 @getint()
store i32 %t64, i32* %t63
store i32 0, i32* %t66
br label %while.cond.20
while.cond.20:
%t67 = load i32, i32* %t66
%t68 = icmp slt i32 %t67, 10
%t69 = zext i1 %t68 to i32
%t70 = icmp ne i32 %t69, 0
br i1 %t70, label %while.body.21, label %while.end.22
while.body.21:
%t71 = load i32, i32* %t66
%t72 = getelementptr inbounds i32, i32* %t65, i32 %t71
%t73 = call i32 @getint()
store i32 %t73, i32* %t72
%t74 = load i32, i32* %t66
%t75 = add i32 %t74, 1
store i32 %t75, i32* %t66
br label %while.cond.20
while.end.22:
%t77 = load i32, i32* %t57
%t78 = call i32 @func7(i32 %t77)
%t79 = load i32, i32* %t59
%t80 = call i32 @func5(i32 %t79)
%t81 = call i32 @func6(i32 %t78, i32 %t80)
%t82 = load i32, i32* %t61
%t83 = call i32 @func2(i32 %t81, i32 %t82)
%t84 = load i32, i32* %t63
%t85 = call i32 @func3(i32 %t83, i32 %t84)
%t86 = call i32 @func5(i32 %t85)
%t87 = getelementptr inbounds i32, i32* %t65, i32 0
%t88 = load i32, i32* %t87
%t89 = getelementptr inbounds i32, i32* %t65, i32 1
%t90 = load i32, i32* %t89
%t91 = call i32 @func5(i32 %t90)
%t92 = getelementptr inbounds i32, i32* %t65, i32 2
%t93 = load i32, i32* %t92
%t94 = getelementptr inbounds i32, i32* %t65, i32 3
%t95 = load i32, i32* %t94
%t96 = call i32 @func7(i32 %t95)
%t97 = call i32 @func6(i32 %t93, i32 %t96)
%t98 = getelementptr inbounds i32, i32* %t65, i32 4
%t99 = load i32, i32* %t98
%t100 = getelementptr inbounds i32, i32* %t65, i32 5
%t101 = load i32, i32* %t100
%t102 = call i32 @func7(i32 %t101)
%t103 = call i32 @func2(i32 %t99, i32 %t102)
%t104 = call i32 @func4(i32 %t91, i32 %t97, i32 %t103)
%t105 = getelementptr inbounds i32, i32* %t65, i32 6
%t106 = load i32, i32* %t105
%t107 = call i32 @func3(i32 %t104, i32 %t106)
%t108 = getelementptr inbounds i32, i32* %t65, i32 7
%t109 = load i32, i32* %t108
%t110 = call i32 @func2(i32 %t107, i32 %t109)
%t111 = getelementptr inbounds i32, i32* %t65, i32 8
%t112 = load i32, i32* %t111
%t113 = getelementptr inbounds i32, i32* %t65, i32 9
%t114 = load i32, i32* %t113
%t115 = call i32 @func7(i32 %t114)
%t116 = call i32 @func3(i32 %t112, i32 %t115)
%t117 = load i32, i32* %t57
%t118 = call i32 @func1(i32 %t110, i32 %t116, i32 %t117)
%t119 = call i32 @func4(i32 %t86, i32 %t88, i32 %t118)
%t120 = load i32, i32* %t59
%t121 = load i32, i32* %t61
%t122 = call i32 @func7(i32 %t121)
%t123 = load i32, i32* %t63
%t124 = call i32 @func3(i32 %t122, i32 %t123)
%t125 = call i32 @func2(i32 %t120, i32 %t124)
%t126 = call i32 @func3(i32 %t119, i32 %t125)
%t127 = getelementptr inbounds i32, i32* %t65, i32 0
%t128 = load i32, i32* %t127
%t129 = getelementptr inbounds i32, i32* %t65, i32 1
%t130 = load i32, i32* %t129
%t131 = call i32 @func1(i32 %t126, i32 %t128, i32 %t130)
%t132 = getelementptr inbounds i32, i32* %t65, i32 2
%t133 = load i32, i32* %t132
%t134 = call i32 @func2(i32 %t131, i32 %t133)
%t135 = getelementptr inbounds i32, i32* %t65, i32 3
%t136 = load i32, i32* %t135
%t137 = getelementptr inbounds i32, i32* %t65, i32 4
%t138 = load i32, i32* %t137
%t139 = getelementptr inbounds i32, i32* %t65, i32 5
%t140 = load i32, i32* %t139
%t141 = call i32 @func5(i32 %t140)
%t142 = call i32 @func3(i32 %t138, i32 %t141)
%t143 = getelementptr inbounds i32, i32* %t65, i32 6
%t144 = load i32, i32* %t143
%t145 = call i32 @func5(i32 %t144)
%t146 = call i32 @func2(i32 %t142, i32 %t145)
%t147 = getelementptr inbounds i32, i32* %t65, i32 7
%t148 = load i32, i32* %t147
%t149 = getelementptr inbounds i32, i32* %t65, i32 8
%t150 = load i32, i32* %t149
%t151 = call i32 @func7(i32 %t150)
%t152 = call i32 @func1(i32 %t146, i32 %t148, i32 %t151)
%t153 = getelementptr inbounds i32, i32* %t65, i32 9
%t154 = load i32, i32* %t153
%t155 = call i32 @func5(i32 %t154)
%t156 = call i32 @func2(i32 %t152, i32 %t155)
%t157 = load i32, i32* %t57
%t158 = call i32 @func3(i32 %t156, i32 %t157)
%t159 = call i32 @func1(i32 %t134, i32 %t136, i32 %t158)
store i32 %t159, i32* %t76
%t160 = load i32, i32* %t76
ret i32 %t160
}