@array = global [110 x i32] zeroinitializer @n = global i32 0 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 @init(i32 %arg.n) { entry: %t1 = alloca i32 %t0 = alloca i32 store i32 %arg.n, i32* %t0 store i32 1, i32* %t1 br label %while.cond.1 while.cond.1: %t2 = load i32, i32* %t1 %t3 = load i32, i32* %t0 %t4 = load i32, i32* %t0 %t5 = mul i32 %t3, %t4 %t6 = add i32 %t5, 1 %t7 = icmp sle i32 %t2, %t6 %t8 = zext i1 %t7 to i32 %t9 = icmp ne i32 %t8, 0 br i1 %t9, label %while.body.2, label %while.end.3 while.body.2: %t10 = load i32, i32* %t1 %t11 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t10 store i32 -1, i32* %t11 %t12 = load i32, i32* %t1 %t13 = add i32 %t12, 1 store i32 %t13, i32* %t1 br label %while.cond.1 while.end.3: ret void } define i32 @findfa(i32 %arg.a) { entry: %t14 = alloca i32 store i32 %arg.a, i32* %t14 %t15 = load i32, i32* %t14 %t16 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t15 %t17 = load i32, i32* %t16 %t18 = load i32, i32* %t14 %t19 = icmp eq i32 %t17, %t18 %t20 = zext i1 %t19 to i32 %t21 = icmp ne i32 %t20, 0 br i1 %t21, label %if.then.4, label %if.else.5 if.then.4: %t22 = load i32, i32* %t14 ret i32 %t22 if.else.5: %t23 = load i32, i32* %t14 %t24 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t23 %t25 = load i32, i32* %t14 %t26 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t25 %t27 = load i32, i32* %t26 %t28 = call i32 @findfa(i32 %t27) store i32 %t28, i32* %t24 %t29 = load i32, i32* %t14 %t30 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t29 %t31 = load i32, i32* %t30 ret i32 %t31 if.end.6: ret i32 0 } define void @mmerge(i32 %arg.a, i32 %arg.b) { entry: %t34 = alloca i32 %t37 = alloca i32 %t32 = alloca i32 store i32 %arg.a, i32* %t32 %t33 = alloca i32 store i32 %arg.b, i32* %t33 %t35 = load i32, i32* %t32 %t36 = call i32 @findfa(i32 %t35) store i32 %t36, i32* %t34 %t38 = load i32, i32* %t33 %t39 = call i32 @findfa(i32 %t38) store i32 %t39, i32* %t37 %t40 = load i32, i32* %t34 %t41 = load i32, i32* %t37 %t42 = icmp ne i32 %t40, %t41 %t43 = zext i1 %t42 to i32 %t44 = icmp ne i32 %t43, 0 br i1 %t44, label %if.then.7, label %if.end.8 if.then.7: %t45 = load i32, i32* %t34 %t46 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t45 %t47 = load i32, i32* %t37 store i32 %t47, i32* %t46 br label %if.end.8 if.end.8: ret void } define i32 @main() { entry: %t48 = alloca i32 %t49 = alloca i32 %t50 = alloca i32 %t51 = alloca i32 %t56 = alloca i32 %t57 = alloca i32 %t60 = alloca i32 %t76 = alloca i32 %t187 = alloca i32 store i32 0, i32* %t48 store i32 0, i32* %t49 store i32 0, i32* %t50 store i32 0, i32* %t51 store i32 1, i32* %t48 br label %while.cond.9 while.cond.9: %t52 = load i32, i32* %t48 %t53 = icmp ne i32 %t52, 0 br i1 %t53, label %while.body.10, label %while.end.11 while.body.10: %t54 = load i32, i32* %t48 %t55 = sub i32 %t54, 1 store i32 %t55, i32* %t48 store i32 4, i32* @n store i32 10, i32* %t49 store i32 0, i32* %t56 store i32 0, i32* %t57 %t58 = load i32, i32* @n call void @init(i32 %t58) %t61 = load i32, i32* @n %t62 = load i32, i32* @n %t63 = mul i32 %t61, %t62 %t64 = add i32 %t63, 1 store i32 %t64, i32* %t60 br label %while.cond.12 while.end.11: ret i32 0 while.cond.12: %t65 = load i32, i32* %t56 %t66 = load i32, i32* %t49 %t67 = icmp slt i32 %t65, %t66 %t68 = zext i1 %t67 to i32 %t69 = icmp ne i32 %t68, 0 br i1 %t69, label %while.body.13, label %while.end.14 while.body.13: %t70 = call i32 @getint() store i32 %t70, i32* %t50 %t71 = call i32 @getint() store i32 %t71, i32* %t51 %t72 = load i32, i32* %t57 %t73 = icmp eq i32 %t72, 0 %t74 = zext i1 %t73 to i32 %t75 = icmp ne i32 %t74, 0 br i1 %t75, label %if.then.15, label %if.end.16 while.end.14: %t195 = load i32, i32* %t57 %t196 = icmp eq i32 %t195, 0 %t197 = zext i1 %t196 to i32 %t198 = icmp ne i32 %t197, 0 br i1 %t198, label %if.then.37, label %if.end.38 if.then.15: %t77 = load i32, i32* @n %t78 = load i32, i32* %t50 %t79 = sub i32 %t78, 1 %t80 = mul i32 %t77, %t79 %t81 = load i32, i32* %t51 %t82 = add i32 %t80, %t81 store i32 %t82, i32* %t76 %t83 = load i32, i32* %t76 %t84 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t83 %t85 = load i32, i32* %t76 store i32 %t85, i32* %t84 %t86 = load i32, i32* %t50 %t87 = icmp eq i32 %t86, 1 %t88 = zext i1 %t87 to i32 %t89 = icmp ne i32 %t88, 0 br i1 %t89, label %if.then.17, label %if.end.18 if.end.16: %t193 = load i32, i32* %t56 %t194 = add i32 %t193, 1 store i32 %t194, i32* %t56 br label %while.cond.12 if.then.17: %t90 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 0 store i32 0, i32* %t90 %t91 = load i32, i32* %t76 call void @mmerge(i32 %t91, i32 0) br label %if.end.18 if.end.18: %t93 = load i32, i32* %t50 %t94 = load i32, i32* @n %t95 = icmp eq i32 %t93, %t94 %t96 = zext i1 %t95 to i32 %t97 = icmp ne i32 %t96, 0 br i1 %t97, label %if.then.19, label %if.end.20 if.then.19: %t98 = load i32, i32* %t60 %t99 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t98 %t100 = load i32, i32* %t60 store i32 %t100, i32* %t99 %t101 = load i32, i32* %t76 %t102 = load i32, i32* %t60 call void @mmerge(i32 %t101, i32 %t102) br label %if.end.20 if.end.20: %t104 = load i32, i32* %t51 %t105 = load i32, i32* @n %t106 = icmp slt i32 %t104, %t105 %t107 = zext i1 %t106 to i32 %t108 = icmp ne i32 %t107, 0 br i1 %t108, label %land.rhs.23, label %if.end.22 if.then.21: %t116 = load i32, i32* %t76 %t117 = load i32, i32* %t76 %t118 = add i32 %t117, 1 call void @mmerge(i32 %t116, i32 %t118) br label %if.end.22 if.end.22: %t120 = load i32, i32* %t51 %t121 = icmp sgt i32 %t120, 1 %t122 = zext i1 %t121 to i32 %t123 = icmp ne i32 %t122, 0 br i1 %t123, label %land.rhs.26, label %if.end.25 land.rhs.23: %t109 = load i32, i32* %t76 %t110 = add i32 %t109, 1 %t111 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t110 %t112 = load i32, i32* %t111 %t113 = icmp ne i32 %t112, -1 %t114 = zext i1 %t113 to i32 %t115 = icmp ne i32 %t114, 0 br i1 %t115, label %if.then.21, label %if.end.22 if.then.24: %t131 = load i32, i32* %t76 %t132 = load i32, i32* %t76 %t133 = sub i32 %t132, 1 call void @mmerge(i32 %t131, i32 %t133) br label %if.end.25 if.end.25: %t135 = load i32, i32* %t50 %t136 = load i32, i32* @n %t137 = icmp slt i32 %t135, %t136 %t138 = zext i1 %t137 to i32 %t139 = icmp ne i32 %t138, 0 br i1 %t139, label %land.rhs.29, label %if.end.28 land.rhs.26: %t124 = load i32, i32* %t76 %t125 = sub i32 %t124, 1 %t126 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t125 %t127 = load i32, i32* %t126 %t128 = icmp ne i32 %t127, -1 %t129 = zext i1 %t128 to i32 %t130 = icmp ne i32 %t129, 0 br i1 %t130, label %if.then.24, label %if.end.25 if.then.27: %t148 = load i32, i32* %t76 %t149 = load i32, i32* %t76 %t150 = load i32, i32* @n %t151 = add i32 %t149, %t150 call void @mmerge(i32 %t148, i32 %t151) br label %if.end.28 if.end.28: %t153 = load i32, i32* %t50 %t154 = icmp sgt i32 %t153, 1 %t155 = zext i1 %t154 to i32 %t156 = icmp ne i32 %t155, 0 br i1 %t156, label %land.rhs.32, label %if.end.31 land.rhs.29: %t140 = load i32, i32* %t76 %t141 = load i32, i32* @n %t142 = add i32 %t140, %t141 %t143 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t142 %t144 = load i32, i32* %t143 %t145 = icmp ne i32 %t144, -1 %t146 = zext i1 %t145 to i32 %t147 = icmp ne i32 %t146, 0 br i1 %t147, label %if.then.27, label %if.end.28 if.then.30: %t165 = load i32, i32* %t76 %t166 = load i32, i32* %t76 %t167 = load i32, i32* @n %t168 = sub i32 %t166, %t167 call void @mmerge(i32 %t165, i32 %t168) br label %if.end.31 if.end.31: %t170 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 0 %t171 = load i32, i32* %t170 %t172 = icmp ne i32 %t171, -1 %t173 = zext i1 %t172 to i32 %t174 = icmp ne i32 %t173, 0 br i1 %t174, label %land.rhs.36, label %if.end.34 land.rhs.32: %t157 = load i32, i32* %t76 %t158 = load i32, i32* @n %t159 = sub i32 %t157, %t158 %t160 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t159 %t161 = load i32, i32* %t160 %t162 = icmp ne i32 %t161, -1 %t163 = zext i1 %t162 to i32 %t164 = icmp ne i32 %t163, 0 br i1 %t164, label %if.then.30, label %if.end.31 if.then.33: store i32 1, i32* %t57 %t188 = load i32, i32* %t56 %t189 = add i32 %t188, 1 store i32 %t189, i32* %t187 %t190 = load i32, i32* %t187 call void @putint(i32 %t190) call void @putch(i32 10) br label %if.end.34 if.end.34: br label %if.end.16 land.rhs.35: %t181 = call i32 @findfa(i32 0) %t182 = load i32, i32* %t60 %t183 = call i32 @findfa(i32 %t182) %t184 = icmp eq i32 %t181, %t183 %t185 = zext i1 %t184 to i32 %t186 = icmp ne i32 %t185, 0 br i1 %t186, label %if.then.33, label %if.end.34 land.rhs.36: %t175 = load i32, i32* %t60 %t176 = getelementptr inbounds [110 x i32], [110 x i32]* @array, i32 0, i32 %t175 %t177 = load i32, i32* %t176 %t178 = icmp ne i32 %t177, -1 %t179 = zext i1 %t178 to i32 %t180 = icmp ne i32 %t179, 0 br i1 %t180, label %land.rhs.35, label %if.end.34 if.then.37: call void @putint(i32 -1) call void @putch(i32 10) br label %if.end.38 if.end.38: br label %while.cond.9 }