@n = global i32 0 @m = global i32 0 @maxn = global i32 1005 @maxm = global i32 5005 @to = global [5005 x i32] zeroinitializer @next = global [5005 x i32] zeroinitializer @head = global [1005 x i32] zeroinitializer @cnt = global i32 0 @vis = global [1005 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 @quick_read() { entry: %t0 = alloca i32 %t2 = alloca i32 %t3 = alloca i32 %t1 = call i32 @getch() store i32 %t1, i32* %t0 store i32 0, i32* %t2 store i32 0, i32* %t3 br label %while.cond.1 while.cond.1: %t4 = load i32, i32* %t0 %t5 = icmp slt i32 %t4, 48 %t6 = zext i1 %t5 to i32 %t7 = icmp ne i32 %t6, 0 br i1 %t7, label %while.body.2, label %lor.rhs.4 while.body.2: %t12 = load i32, i32* %t0 %t13 = icmp eq i32 %t12, 45 %t14 = zext i1 %t13 to i32 %t15 = icmp ne i32 %t14, 0 br i1 %t15, label %if.then.5, label %if.end.6 while.end.3: br label %while.cond.7 lor.rhs.4: %t8 = load i32, i32* %t0 %t9 = icmp sgt i32 %t8, 57 %t10 = zext i1 %t9 to i32 %t11 = icmp ne i32 %t10, 0 br i1 %t11, label %while.body.2, label %while.end.3 if.then.5: store i32 1, i32* %t3 br label %if.end.6 if.end.6: %t16 = call i32 @getch() store i32 %t16, i32* %t0 br label %while.cond.1 while.cond.7: %t17 = load i32, i32* %t0 %t18 = icmp sge i32 %t17, 48 %t19 = zext i1 %t18 to i32 %t20 = icmp ne i32 %t19, 0 br i1 %t20, label %land.rhs.10, label %while.end.9 while.body.8: %t25 = load i32, i32* %t2 %t26 = mul i32 %t25, 10 %t27 = load i32, i32* %t0 %t28 = add i32 %t26, %t27 %t29 = sub i32 %t28, 48 store i32 %t29, i32* %t2 %t30 = call i32 @getch() store i32 %t30, i32* %t0 br label %while.cond.7 while.end.9: %t31 = load i32, i32* %t3 %t32 = icmp ne i32 %t31, 0 br i1 %t32, label %if.then.11, label %if.else.12 land.rhs.10: %t21 = load i32, i32* %t0 %t22 = icmp sle i32 %t21, 57 %t23 = zext i1 %t22 to i32 %t24 = icmp ne i32 %t23, 0 br i1 %t24, label %while.body.8, label %while.end.9 if.then.11: %t33 = load i32, i32* %t2 %t34 = sub i32 0, %t33 ret i32 %t34 if.else.12: %t35 = load i32, i32* %t2 ret i32 %t35 if.end.13: ret i32 0 } define void @add_edge(i32 %arg.from, i32 %arg.To) { entry: %t36 = alloca i32 store i32 %arg.from, i32* %t36 %t37 = alloca i32 store i32 %arg.To, i32* %t37 %t38 = load i32, i32* @cnt %t39 = getelementptr inbounds [5005 x i32], [5005 x i32]* @to, i32 0, i32 %t38 %t40 = load i32, i32* %t37 store i32 %t40, i32* %t39 %t41 = load i32, i32* @cnt %t42 = getelementptr inbounds [5005 x i32], [5005 x i32]* @next, i32 0, i32 %t41 %t43 = load i32, i32* %t36 %t44 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t43 %t45 = load i32, i32* %t44 store i32 %t45, i32* %t42 %t46 = load i32, i32* %t36 %t47 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t46 %t48 = load i32, i32* @cnt store i32 %t48, i32* %t47 %t49 = load i32, i32* @cnt %t50 = add i32 %t49, 1 store i32 %t50, i32* @cnt %t51 = load i32, i32* @cnt %t52 = getelementptr inbounds [5005 x i32], [5005 x i32]* @to, i32 0, i32 %t51 %t53 = load i32, i32* %t36 store i32 %t53, i32* %t52 %t54 = load i32, i32* @cnt %t55 = getelementptr inbounds [5005 x i32], [5005 x i32]* @next, i32 0, i32 %t54 %t56 = load i32, i32* %t37 %t57 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t56 %t58 = load i32, i32* %t57 store i32 %t58, i32* %t55 %t59 = load i32, i32* %t37 %t60 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t59 %t61 = load i32, i32* @cnt store i32 %t61, i32* %t60 %t62 = load i32, i32* @cnt %t63 = add i32 %t62, 1 store i32 %t63, i32* @cnt ret void } define void @init() { entry: %t64 = alloca i32 store i32 0, i32* %t64 br label %while.cond.14 while.cond.14: %t65 = load i32, i32* %t64 %t66 = icmp slt i32 %t65, 1005 %t67 = zext i1 %t66 to i32 %t68 = icmp ne i32 %t67, 0 br i1 %t68, label %while.body.15, label %while.end.16 while.body.15: %t69 = load i32, i32* %t64 %t70 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t69 store i32 -1, i32* %t70 %t71 = load i32, i32* %t64 %t72 = add i32 %t71, 1 store i32 %t72, i32* %t64 br label %while.cond.14 while.end.16: ret void } define void @clear() { entry: %t73 = alloca i32 store i32 1, i32* %t73 br label %while.cond.17 while.cond.17: %t74 = load i32, i32* %t73 %t75 = load i32, i32* @n %t76 = icmp sle i32 %t74, %t75 %t77 = zext i1 %t76 to i32 %t78 = icmp ne i32 %t77, 0 br i1 %t78, label %while.body.18, label %while.end.19 while.body.18: %t79 = load i32, i32* %t73 %t80 = getelementptr inbounds [1005 x i32], [1005 x i32]* @vis, i32 0, i32 %t79 store i32 0, i32* %t80 %t81 = load i32, i32* %t73 %t82 = add i32 %t81, 1 store i32 %t82, i32* %t73 br label %while.cond.17 while.end.19: ret void } define i32 @same(i32 %arg.x, i32 %arg.tar) { entry: %t92 = alloca i32 %t100 = alloca i32 %t83 = alloca i32 store i32 %arg.x, i32* %t83 %t84 = alloca i32 store i32 %arg.tar, i32* %t84 %t85 = load i32, i32* %t83 %t86 = getelementptr inbounds [1005 x i32], [1005 x i32]* @vis, i32 0, i32 %t85 store i32 1, i32* %t86 %t87 = load i32, i32* %t83 %t88 = load i32, i32* %t84 %t89 = icmp eq i32 %t87, %t88 %t90 = zext i1 %t89 to i32 %t91 = icmp ne i32 %t90, 0 br i1 %t91, label %if.then.20, label %if.end.21 if.then.20: ret i32 1 if.end.21: %t93 = load i32, i32* %t83 %t94 = getelementptr inbounds [1005 x i32], [1005 x i32]* @head, i32 0, i32 %t93 %t95 = load i32, i32* %t94 store i32 %t95, i32* %t92 br label %while.cond.22 while.cond.22: %t96 = load i32, i32* %t92 %t97 = icmp ne i32 %t96, -1 %t98 = zext i1 %t97 to i32 %t99 = icmp ne i32 %t98, 0 br i1 %t99, label %while.body.23, label %while.end.24 while.body.23: %t101 = load i32, i32* %t92 %t102 = getelementptr inbounds [5005 x i32], [5005 x i32]* @to, i32 0, i32 %t101 %t103 = load i32, i32* %t102 store i32 %t103, i32* %t100 %t104 = load i32, i32* %t100 %t105 = getelementptr inbounds [1005 x i32], [1005 x i32]* @vis, i32 0, i32 %t104 %t106 = load i32, i32* %t105 %t107 = icmp eq i32 %t106, 0 %t108 = zext i1 %t107 to i32 %t109 = icmp ne i32 %t108, 0 br i1 %t109, label %land.rhs.27, label %if.end.26 while.end.24: ret i32 0 if.then.25: ret i32 1 if.end.26: %t114 = load i32, i32* %t92 %t115 = getelementptr inbounds [5005 x i32], [5005 x i32]* @next, i32 0, i32 %t114 %t116 = load i32, i32* %t115 store i32 %t116, i32* %t92 br label %while.cond.22 land.rhs.27: %t110 = load i32, i32* %t100 %t111 = load i32, i32* %t84 %t112 = call i32 @same(i32 %t110, i32 %t111) %t113 = icmp ne i32 %t112, 0 br i1 %t113, label %if.then.25, label %if.end.26 } define i32 @main() { entry: %t122 = alloca i32 %t137 = alloca i32 %t139 = alloca i32 %t147 = alloca i32 %t149 = alloca i32 %t117 = call i32 @quick_read() store i32 %t117, i32* @n %t118 = call i32 @quick_read() store i32 %t118, i32* @m call void @init() br label %while.cond.28 while.cond.28: %t120 = load i32, i32* @m %t121 = icmp ne i32 %t120, 0 br i1 %t121, label %while.body.29, label %while.end.30 while.body.29: %t123 = call i32 @getch() store i32 %t123, i32* %t122 br label %while.cond.31 while.end.30: ret i32 0 while.cond.31: %t124 = load i32, i32* %t122 %t125 = icmp ne i32 %t124, 81 %t126 = zext i1 %t125 to i32 %t127 = icmp ne i32 %t126, 0 br i1 %t127, label %land.rhs.34, label %while.end.33 while.body.32: %t132 = call i32 @getch() store i32 %t132, i32* %t122 br label %while.cond.31 while.end.33: %t133 = load i32, i32* %t122 %t134 = icmp eq i32 %t133, 81 %t135 = zext i1 %t134 to i32 %t136 = icmp ne i32 %t135, 0 br i1 %t136, label %if.then.35, label %if.else.36 land.rhs.34: %t128 = load i32, i32* %t122 %t129 = icmp ne i32 %t128, 85 %t130 = zext i1 %t129 to i32 %t131 = icmp ne i32 %t130, 0 br i1 %t131, label %while.body.32, label %while.end.33 if.then.35: %t138 = call i32 @quick_read() store i32 %t138, i32* %t137 %t140 = call i32 @quick_read() store i32 %t140, i32* %t139 call void @clear() %t142 = load i32, i32* %t137 %t143 = load i32, i32* %t139 %t144 = call i32 @same(i32 %t142, i32 %t143) call void @putint(i32 %t144) call void @putch(i32 10) br label %if.end.37 if.else.36: %t148 = call i32 @quick_read() store i32 %t148, i32* %t147 %t150 = call i32 @quick_read() store i32 %t150, i32* %t149 %t151 = load i32, i32* %t147 %t152 = load i32, i32* %t149 call void @add_edge(i32 %t151, i32 %t152) br label %if.end.37 if.end.37: %t154 = load i32, i32* @m %t155 = sub i32 %t154, 1 store i32 %t155, i32* @m br label %while.cond.28 }