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.

612 lines
17 KiB

@arr1 = global [14400 x i32] zeroinitializer
@arr2 = global [26880 x i32] zeroinitializer
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 void @loop1(i32 %arg.x, i32 %arg.y) {
entry:
%t2 = alloca i32
%t3 = alloca i32
%t4 = alloca i32
%t5 = alloca i32
%t6 = alloca i32
%t7 = alloca i32
%t8 = alloca i32
%t0 = alloca i32
store i32 %arg.x, i32* %t0
%t1 = alloca i32
store i32 %arg.y, i32* %t1
store i32 0, i32* %t2
store i32 0, i32* %t3
store i32 0, i32* %t4
store i32 0, i32* %t5
store i32 0, i32* %t6
store i32 0, i32* %t7
store i32 0, i32* %t8
store i32 0, i32* %t2
br label %while.cond.1
while.cond.1:
%t9 = load i32, i32* %t2
%t10 = load i32, i32* %t0
%t11 = icmp slt i32 %t9, %t10
%t12 = zext i1 %t11 to i32
%t13 = icmp ne i32 %t12, 0
br i1 %t13, label %land.rhs.4, label %while.end.3
while.body.2:
store i32 0, i32* %t3
br label %while.cond.5
while.end.3:
ret void
land.rhs.4:
%t14 = load i32, i32* %t2
%t15 = load i32, i32* %t1
%t16 = icmp slt i32 %t14, %t15
%t17 = zext i1 %t16 to i32
%t18 = icmp ne i32 %t17, 0
br i1 %t18, label %while.body.2, label %while.end.3
while.cond.5:
%t19 = load i32, i32* %t3
%t20 = icmp slt i32 %t19, 2
%t21 = zext i1 %t20 to i32
%t22 = icmp ne i32 %t21, 0
br i1 %t22, label %while.body.6, label %while.end.7
while.body.6:
store i32 0, i32* %t4
br label %while.cond.8
while.end.7:
%t92 = load i32, i32* %t2
%t93 = add i32 %t92, 1
store i32 %t93, i32* %t2
br label %while.cond.1
while.cond.8:
%t23 = load i32, i32* %t4
%t24 = icmp slt i32 %t23, 3
%t25 = zext i1 %t24 to i32
%t26 = icmp ne i32 %t25, 0
br i1 %t26, label %while.body.9, label %while.end.10
while.body.9:
store i32 0, i32* %t5
br label %while.cond.11
while.end.10:
%t90 = load i32, i32* %t3
%t91 = add i32 %t90, 1
store i32 %t91, i32* %t3
br label %while.cond.5
while.cond.11:
%t27 = load i32, i32* %t5
%t28 = icmp slt i32 %t27, 4
%t29 = zext i1 %t28 to i32
%t30 = icmp ne i32 %t29, 0
br i1 %t30, label %while.body.12, label %while.end.13
while.body.12:
store i32 0, i32* %t6
br label %while.cond.14
while.end.13:
%t88 = load i32, i32* %t4
%t89 = add i32 %t88, 1
store i32 %t89, i32* %t4
br label %while.cond.8
while.cond.14:
%t31 = load i32, i32* %t6
%t32 = icmp slt i32 %t31, 5
%t33 = zext i1 %t32 to i32
%t34 = icmp ne i32 %t33, 0
br i1 %t34, label %while.body.15, label %while.end.16
while.body.15:
store i32 0, i32* %t7
br label %while.cond.17
while.end.16:
%t86 = load i32, i32* %t5
%t87 = add i32 %t86, 1
store i32 %t87, i32* %t5
br label %while.cond.11
while.cond.17:
%t35 = load i32, i32* %t7
%t36 = icmp slt i32 %t35, 6
%t37 = zext i1 %t36 to i32
%t38 = icmp ne i32 %t37, 0
br i1 %t38, label %while.body.18, label %while.end.19
while.body.18:
store i32 0, i32* %t8
br label %while.cond.20
while.end.19:
%t84 = load i32, i32* %t6
%t85 = add i32 %t84, 1
store i32 %t85, i32* %t6
br label %while.cond.14
while.cond.20:
%t39 = load i32, i32* %t8
%t40 = icmp slt i32 %t39, 2
%t41 = zext i1 %t40 to i32
%t42 = icmp ne i32 %t41, 0
br i1 %t42, label %while.body.21, label %while.end.22
while.body.21:
%t43 = load i32, i32* %t2
%t44 = load i32, i32* %t3
%t45 = load i32, i32* %t4
%t46 = load i32, i32* %t5
%t47 = load i32, i32* %t6
%t48 = load i32, i32* %t7
%t49 = load i32, i32* %t8
%t50 = mul i32 %t43, 1440
%t51 = mul i32 %t44, 720
%t52 = add i32 %t50, %t51
%t53 = mul i32 %t45, 240
%t54 = add i32 %t52, %t53
%t55 = mul i32 %t46, 60
%t56 = add i32 %t54, %t55
%t57 = mul i32 %t47, 12
%t58 = add i32 %t56, %t57
%t59 = mul i32 %t48, 2
%t60 = add i32 %t58, %t59
%t61 = add i32 %t60, %t49
%t62 = getelementptr inbounds [14400 x i32], [14400 x i32]* @arr1, i32 0, i32 %t61
%t63 = load i32, i32* %t2
%t64 = load i32, i32* %t3
%t65 = add i32 %t63, %t64
%t66 = load i32, i32* %t4
%t67 = add i32 %t65, %t66
%t68 = load i32, i32* %t5
%t69 = add i32 %t67, %t68
%t70 = load i32, i32* %t6
%t71 = add i32 %t69, %t70
%t72 = load i32, i32* %t7
%t73 = add i32 %t71, %t72
%t74 = load i32, i32* %t8
%t75 = add i32 %t73, %t74
%t76 = load i32, i32* %t0
%t77 = add i32 %t75, %t76
%t78 = load i32, i32* %t1
%t79 = add i32 %t77, %t78
store i32 %t79, i32* %t62
%t80 = load i32, i32* %t8
%t81 = add i32 %t80, 1
store i32 %t81, i32* %t8
br label %while.cond.20
while.end.22:
%t82 = load i32, i32* %t7
%t83 = add i32 %t82, 1
store i32 %t83, i32* %t7
br label %while.cond.17
}
define void @loop2() {
entry:
%t94 = alloca i32
%t95 = alloca i32
%t96 = alloca i32
%t97 = alloca i32
%t98 = alloca i32
%t99 = alloca i32
%t100 = alloca i32
store i32 0, i32* %t94
store i32 0, i32* %t95
store i32 0, i32* %t96
store i32 0, i32* %t97
store i32 0, i32* %t98
store i32 0, i32* %t99
store i32 0, i32* %t100
store i32 0, i32* %t94
br label %while.cond.23
while.cond.23:
%t101 = load i32, i32* %t94
%t102 = icmp slt i32 %t101, 10
%t103 = zext i1 %t102 to i32
%t104 = icmp ne i32 %t103, 0
br i1 %t104, label %while.body.24, label %while.end.25
while.body.24:
store i32 0, i32* %t95
br label %while.cond.26
while.end.25:
ret void
while.cond.26:
%t105 = load i32, i32* %t95
%t106 = icmp slt i32 %t105, 2
%t107 = zext i1 %t106 to i32
%t108 = icmp ne i32 %t107, 0
br i1 %t108, label %while.body.27, label %while.end.28
while.body.27:
store i32 0, i32* %t96
br label %while.cond.29
while.end.28:
%t168 = load i32, i32* %t94
%t169 = add i32 %t168, 1
store i32 %t169, i32* %t94
br label %while.cond.23
while.cond.29:
%t109 = load i32, i32* %t96
%t110 = icmp slt i32 %t109, 3
%t111 = zext i1 %t110 to i32
%t112 = icmp ne i32 %t111, 0
br i1 %t112, label %while.body.30, label %while.end.31
while.body.30:
store i32 0, i32* %t97
br label %while.cond.32
while.end.31:
%t166 = load i32, i32* %t95
%t167 = add i32 %t166, 1
store i32 %t167, i32* %t95
br label %while.cond.26
while.cond.32:
%t113 = load i32, i32* %t97
%t114 = icmp slt i32 %t113, 2
%t115 = zext i1 %t114 to i32
%t116 = icmp ne i32 %t115, 0
br i1 %t116, label %while.body.33, label %while.end.34
while.body.33:
store i32 0, i32* %t98
br label %while.cond.35
while.end.34:
%t164 = load i32, i32* %t96
%t165 = add i32 %t164, 1
store i32 %t165, i32* %t96
br label %while.cond.29
while.cond.35:
%t117 = load i32, i32* %t98
%t118 = icmp slt i32 %t117, 4
%t119 = zext i1 %t118 to i32
%t120 = icmp ne i32 %t119, 0
br i1 %t120, label %while.body.36, label %while.end.37
while.body.36:
store i32 0, i32* %t99
br label %while.cond.38
while.end.37:
%t162 = load i32, i32* %t97
%t163 = add i32 %t162, 1
store i32 %t163, i32* %t97
br label %while.cond.32
while.cond.38:
%t121 = load i32, i32* %t99
%t122 = icmp slt i32 %t121, 8
%t123 = zext i1 %t122 to i32
%t124 = icmp ne i32 %t123, 0
br i1 %t124, label %while.body.39, label %while.end.40
while.body.39:
store i32 0, i32* %t100
br label %while.cond.41
while.end.40:
%t160 = load i32, i32* %t98
%t161 = add i32 %t160, 1
store i32 %t161, i32* %t98
br label %while.cond.35
while.cond.41:
%t125 = load i32, i32* %t100
%t126 = icmp slt i32 %t125, 7
%t127 = zext i1 %t126 to i32
%t128 = icmp ne i32 %t127, 0
br i1 %t128, label %while.body.42, label %while.end.43
while.body.42:
%t129 = load i32, i32* %t94
%t130 = load i32, i32* %t95
%t131 = load i32, i32* %t96
%t132 = load i32, i32* %t97
%t133 = load i32, i32* %t98
%t134 = load i32, i32* %t99
%t135 = load i32, i32* %t100
%t136 = mul i32 %t129, 2688
%t137 = mul i32 %t130, 1344
%t138 = add i32 %t136, %t137
%t139 = mul i32 %t131, 448
%t140 = add i32 %t138, %t139
%t141 = mul i32 %t132, 224
%t142 = add i32 %t140, %t141
%t143 = mul i32 %t133, 56
%t144 = add i32 %t142, %t143
%t145 = mul i32 %t134, 7
%t146 = add i32 %t144, %t145
%t147 = add i32 %t146, %t135
%t148 = getelementptr inbounds [26880 x i32], [26880 x i32]* @arr2, i32 0, i32 %t147
%t149 = load i32, i32* %t94
%t150 = load i32, i32* %t95
%t151 = add i32 %t149, %t150
%t152 = load i32, i32* %t97
%t153 = add i32 %t151, %t152
%t154 = load i32, i32* %t100
%t155 = add i32 %t153, %t154
store i32 %t155, i32* %t148
%t156 = load i32, i32* %t100
%t157 = add i32 %t156, 1
store i32 %t157, i32* %t100
br label %while.cond.41
while.end.43:
%t158 = load i32, i32* %t99
%t159 = add i32 %t158, 1
store i32 %t159, i32* %t99
br label %while.cond.38
}
define i32 @loop3(i32 %arg.h, i32 %arg.i, i32 %arg.j, i32 %arg.k, i32 %arg.l, i32 %arg.m, i32 %arg.n) {
entry:
%t177 = alloca i32
%t178 = alloca i32
%t179 = alloca i32
%t180 = alloca i32
%t181 = alloca i32
%t182 = alloca i32
%t183 = alloca i32
%t184 = alloca i32
%t170 = alloca i32
store i32 %arg.h, i32* %t170
%t171 = alloca i32
store i32 %arg.i, i32* %t171
%t172 = alloca i32
store i32 %arg.j, i32* %t172
%t173 = alloca i32
store i32 %arg.k, i32* %t173
%t174 = alloca i32
store i32 %arg.l, i32* %t174
%t175 = alloca i32
store i32 %arg.m, i32* %t175
%t176 = alloca i32
store i32 %arg.n, i32* %t176
store i32 0, i32* %t177
store i32 0, i32* %t178
store i32 0, i32* %t179
store i32 0, i32* %t180
store i32 0, i32* %t181
store i32 0, i32* %t182
store i32 0, i32* %t183
store i32 0, i32* %t184
store i32 0, i32* %t177
br label %while.cond.44
while.cond.44:
%t185 = load i32, i32* %t177
%t186 = icmp slt i32 %t185, 10
%t187 = zext i1 %t186 to i32
%t188 = icmp ne i32 %t187, 0
br i1 %t188, label %while.body.45, label %while.end.46
while.body.45:
store i32 0, i32* %t178
br label %while.cond.47
while.end.46:
%t308 = load i32, i32* %t184
ret i32 %t308
while.cond.47:
%t189 = load i32, i32* %t178
%t190 = icmp slt i32 %t189, 100
%t191 = zext i1 %t190 to i32
%t192 = icmp ne i32 %t191, 0
br i1 %t192, label %while.body.48, label %while.end.49
while.body.48:
store i32 0, i32* %t179
br label %while.cond.50
while.end.49:
%t301 = load i32, i32* %t177
%t302 = add i32 %t301, 1
store i32 %t302, i32* %t177
%t303 = load i32, i32* %t177
%t304 = load i32, i32* %t170
%t305 = icmp sge i32 %t303, %t304
%t306 = zext i1 %t305 to i32
%t307 = icmp ne i32 %t306, 0
br i1 %t307, label %if.then.77, label %if.end.78
while.cond.50:
%t193 = load i32, i32* %t179
%t194 = icmp slt i32 %t193, 1000
%t195 = zext i1 %t194 to i32
%t196 = icmp ne i32 %t195, 0
br i1 %t196, label %while.body.51, label %while.end.52
while.body.51:
store i32 0, i32* %t180
br label %while.cond.53
while.end.52:
%t294 = load i32, i32* %t178
%t295 = add i32 %t294, 1
store i32 %t295, i32* %t178
%t296 = load i32, i32* %t178
%t297 = load i32, i32* %t171
%t298 = icmp sge i32 %t296, %t297
%t299 = zext i1 %t298 to i32
%t300 = icmp ne i32 %t299, 0
br i1 %t300, label %if.then.75, label %if.end.76
while.cond.53:
%t197 = load i32, i32* %t180
%t198 = icmp slt i32 %t197, 10000
%t199 = zext i1 %t198 to i32
%t200 = icmp ne i32 %t199, 0
br i1 %t200, label %while.body.54, label %while.end.55
while.body.54:
store i32 0, i32* %t181
br label %while.cond.56
while.end.55:
%t287 = load i32, i32* %t179
%t288 = add i32 %t287, 1
store i32 %t288, i32* %t179
%t289 = load i32, i32* %t179
%t290 = load i32, i32* %t172
%t291 = icmp sge i32 %t289, %t290
%t292 = zext i1 %t291 to i32
%t293 = icmp ne i32 %t292, 0
br i1 %t293, label %if.then.73, label %if.end.74
while.cond.56:
%t201 = load i32, i32* %t181
%t202 = icmp slt i32 %t201, 100000
%t203 = zext i1 %t202 to i32
%t204 = icmp ne i32 %t203, 0
br i1 %t204, label %while.body.57, label %while.end.58
while.body.57:
store i32 0, i32* %t182
br label %while.cond.59
while.end.58:
%t280 = load i32, i32* %t180
%t281 = add i32 %t280, 1
store i32 %t281, i32* %t180
%t282 = load i32, i32* %t180
%t283 = load i32, i32* %t173
%t284 = icmp sge i32 %t282, %t283
%t285 = zext i1 %t284 to i32
%t286 = icmp ne i32 %t285, 0
br i1 %t286, label %if.then.71, label %if.end.72
while.cond.59:
%t205 = load i32, i32* %t182
%t206 = icmp slt i32 %t205, 1000000
%t207 = zext i1 %t206 to i32
%t208 = icmp ne i32 %t207, 0
br i1 %t208, label %while.body.60, label %while.end.61
while.body.60:
store i32 0, i32* %t183
br label %while.cond.62
while.end.61:
%t273 = load i32, i32* %t181
%t274 = add i32 %t273, 1
store i32 %t274, i32* %t181
%t275 = load i32, i32* %t181
%t276 = load i32, i32* %t174
%t277 = icmp sge i32 %t275, %t276
%t278 = zext i1 %t277 to i32
%t279 = icmp ne i32 %t278, 0
br i1 %t279, label %if.then.69, label %if.end.70
while.cond.62:
%t209 = load i32, i32* %t183
%t210 = icmp slt i32 %t209, 10000000
%t211 = zext i1 %t210 to i32
%t212 = icmp ne i32 %t211, 0
br i1 %t212, label %while.body.63, label %while.end.64
while.body.63:
%t213 = load i32, i32* %t184
%t214 = srem i32 %t213, 817
%t215 = load i32, i32* %t177
%t216 = load i32, i32* %t178
%t217 = load i32, i32* %t179
%t218 = load i32, i32* %t180
%t219 = load i32, i32* %t181
%t220 = load i32, i32* %t182
%t221 = load i32, i32* %t183
%t222 = mul i32 %t215, 1440
%t223 = mul i32 %t216, 720
%t224 = add i32 %t222, %t223
%t225 = mul i32 %t217, 240
%t226 = add i32 %t224, %t225
%t227 = mul i32 %t218, 60
%t228 = add i32 %t226, %t227
%t229 = mul i32 %t219, 12
%t230 = add i32 %t228, %t229
%t231 = mul i32 %t220, 2
%t232 = add i32 %t230, %t231
%t233 = add i32 %t232, %t221
%t234 = getelementptr inbounds [14400 x i32], [14400 x i32]* @arr1, i32 0, i32 %t233
%t235 = load i32, i32* %t234
%t236 = add i32 %t214, %t235
%t237 = load i32, i32* %t177
%t238 = load i32, i32* %t178
%t239 = load i32, i32* %t179
%t240 = load i32, i32* %t180
%t241 = load i32, i32* %t181
%t242 = load i32, i32* %t182
%t243 = load i32, i32* %t183
%t244 = mul i32 %t237, 2688
%t245 = mul i32 %t238, 1344
%t246 = add i32 %t244, %t245
%t247 = mul i32 %t239, 448
%t248 = add i32 %t246, %t247
%t249 = mul i32 %t240, 224
%t250 = add i32 %t248, %t249
%t251 = mul i32 %t241, 56
%t252 = add i32 %t250, %t251
%t253 = mul i32 %t242, 7
%t254 = add i32 %t252, %t253
%t255 = add i32 %t254, %t243
%t256 = getelementptr inbounds [26880 x i32], [26880 x i32]* @arr2, i32 0, i32 %t255
%t257 = load i32, i32* %t256
%t258 = add i32 %t236, %t257
store i32 %t258, i32* %t184
%t259 = load i32, i32* %t183
%t260 = add i32 %t259, 1
store i32 %t260, i32* %t183
%t261 = load i32, i32* %t183
%t262 = load i32, i32* %t176
%t263 = icmp sge i32 %t261, %t262
%t264 = zext i1 %t263 to i32
%t265 = icmp ne i32 %t264, 0
br i1 %t265, label %if.then.65, label %if.end.66
while.end.64:
%t266 = load i32, i32* %t182
%t267 = add i32 %t266, 1
store i32 %t267, i32* %t182
%t268 = load i32, i32* %t182
%t269 = load i32, i32* %t175
%t270 = icmp sge i32 %t268, %t269
%t271 = zext i1 %t270 to i32
%t272 = icmp ne i32 %t271, 0
br i1 %t272, label %if.then.67, label %if.end.68
if.then.65:
br label %while.end.64
if.end.66:
br label %while.cond.62
if.then.67:
br label %while.end.61
if.end.68:
br label %while.cond.59
if.then.69:
br label %while.end.58
if.end.70:
br label %while.cond.56
if.then.71:
br label %while.end.55
if.end.72:
br label %while.cond.53
if.then.73:
br label %while.end.52
if.end.74:
br label %while.cond.50
if.then.75:
br label %while.end.49
if.end.76:
br label %while.cond.47
if.then.77:
br label %while.end.46
if.end.78:
br label %while.cond.44
}
define i32 @main() {
entry:
%t309 = alloca i32
%t311 = alloca i32
%t313 = alloca i32
%t315 = alloca i32
%t317 = alloca i32
%t319 = alloca i32
%t321 = alloca i32
%t323 = alloca i32
%t325 = alloca i32
%t310 = call i32 @getint()
store i32 %t310, i32* %t309
%t312 = call i32 @getint()
store i32 %t312, i32* %t311
%t314 = call i32 @getint()
store i32 %t314, i32* %t313
%t316 = call i32 @getint()
store i32 %t316, i32* %t315
%t318 = call i32 @getint()
store i32 %t318, i32* %t317
%t320 = call i32 @getint()
store i32 %t320, i32* %t319
%t322 = call i32 @getint()
store i32 %t322, i32* %t321
%t324 = call i32 @getint()
store i32 %t324, i32* %t323
%t326 = call i32 @getint()
store i32 %t326, i32* %t325
%t327 = load i32, i32* %t309
%t328 = load i32, i32* %t311
call void @loop1(i32 %t327, i32 %t328)
call void @loop2()
%t331 = load i32, i32* %t313
%t332 = load i32, i32* %t315
%t333 = load i32, i32* %t317
%t334 = load i32, i32* %t319
%t335 = load i32, i32* %t321
%t336 = load i32, i32* %t323
%t337 = load i32, i32* %t325
%t338 = call i32 @loop3(i32 %t331, i32 %t332, i32 %t333, i32 %t334, i32 %t335, i32 %t336, i32 %t337)
ret i32 %t338
}