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