forked from NUDT-compiler/nudt-compiler-cpp
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.
252 lines
7.5 KiB
252 lines
7.5 KiB
@x = global [216000000 x i32] zeroinitializer
|
|
@y = global [216000000 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 @main() {
|
|
entry:
|
|
%t0 = alloca i32
|
|
%t1 = alloca i32
|
|
%t2 = alloca i32
|
|
%t3 = alloca i32
|
|
%t4 = alloca i32
|
|
store i32 0, i32* %t0
|
|
store i32 0, i32* %t1
|
|
store i32 0, i32* %t2
|
|
store i32 0, i32* %t3
|
|
store i32 0, i32* %t4
|
|
%t5 = call i32 @getint()
|
|
store i32 %t5, i32* %t4
|
|
%t6 = call i32 @getint()
|
|
store i32 %t6, i32* %t3
|
|
call void @starttime()
|
|
store i32 0, i32* %t0
|
|
store i32 0, i32* %t1
|
|
store i32 0, i32* %t2
|
|
br label %while.cond.1
|
|
while.cond.1:
|
|
%t8 = load i32, i32* %t0
|
|
%t9 = load i32, i32* %t4
|
|
%t10 = icmp slt i32 %t8, %t9
|
|
%t11 = zext i1 %t10 to i32
|
|
%t12 = icmp ne i32 %t11, 0
|
|
br i1 %t12, label %while.body.2, label %while.end.3
|
|
while.body.2:
|
|
store i32 0, i32* %t1
|
|
store i32 0, i32* %t2
|
|
br label %while.cond.4
|
|
while.end.3:
|
|
store i32 1, i32* %t0
|
|
store i32 1, i32* %t1
|
|
store i32 1, i32* %t2
|
|
br label %while.cond.10
|
|
while.cond.4:
|
|
%t13 = load i32, i32* %t1
|
|
%t14 = load i32, i32* %t4
|
|
%t15 = icmp slt i32 %t13, %t14
|
|
%t16 = zext i1 %t15 to i32
|
|
%t17 = icmp ne i32 %t16, 0
|
|
br i1 %t17, label %while.body.5, label %while.end.6
|
|
while.body.5:
|
|
store i32 0, i32* %t2
|
|
br label %while.cond.7
|
|
while.end.6:
|
|
%t43 = load i32, i32* %t0
|
|
%t44 = add i32 %t43, 1
|
|
store i32 %t44, i32* %t0
|
|
br label %while.cond.1
|
|
while.cond.7:
|
|
%t18 = load i32, i32* %t2
|
|
%t19 = load i32, i32* %t4
|
|
%t20 = icmp slt i32 %t18, %t19
|
|
%t21 = zext i1 %t20 to i32
|
|
%t22 = icmp ne i32 %t21, 0
|
|
br i1 %t22, label %while.body.8, label %while.end.9
|
|
while.body.8:
|
|
%t23 = load i32, i32* %t0
|
|
%t24 = load i32, i32* %t1
|
|
%t25 = load i32, i32* %t2
|
|
%t26 = mul i32 %t23, 360000
|
|
%t27 = mul i32 %t24, 600
|
|
%t28 = add i32 %t26, %t27
|
|
%t29 = add i32 %t28, %t25
|
|
%t30 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t29
|
|
store i32 1, i32* %t30
|
|
%t31 = load i32, i32* %t0
|
|
%t32 = load i32, i32* %t1
|
|
%t33 = load i32, i32* %t2
|
|
%t34 = mul i32 %t31, 360000
|
|
%t35 = mul i32 %t32, 600
|
|
%t36 = add i32 %t34, %t35
|
|
%t37 = add i32 %t36, %t33
|
|
%t38 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @y, i32 0, i32 %t37
|
|
store i32 0, i32* %t38
|
|
%t39 = load i32, i32* %t2
|
|
%t40 = add i32 %t39, 1
|
|
store i32 %t40, i32* %t2
|
|
br label %while.cond.7
|
|
while.end.9:
|
|
%t41 = load i32, i32* %t1
|
|
%t42 = add i32 %t41, 1
|
|
store i32 %t42, i32* %t1
|
|
br label %while.cond.4
|
|
while.cond.10:
|
|
%t45 = load i32, i32* %t0
|
|
%t46 = load i32, i32* %t4
|
|
%t47 = sub i32 %t46, 1
|
|
%t48 = icmp slt i32 %t45, %t47
|
|
%t49 = zext i1 %t48 to i32
|
|
%t50 = icmp ne i32 %t49, 0
|
|
br i1 %t50, label %while.body.11, label %while.end.12
|
|
while.body.11:
|
|
store i32 1, i32* %t1
|
|
store i32 1, i32* %t2
|
|
br label %while.cond.13
|
|
while.end.12:
|
|
call void @stoptime()
|
|
%t145 = load i32, i32* %t4
|
|
%t146 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 0
|
|
call void @putarray(i32 %t145, i32* %t146)
|
|
%t148 = load i32, i32* %t4
|
|
%t149 = load i32, i32* %t4
|
|
%t150 = sdiv i32 %t149, 2
|
|
%t151 = load i32, i32* %t4
|
|
%t152 = sdiv i32 %t151, 2
|
|
%t153 = mul i32 %t150, 360000
|
|
%t154 = mul i32 %t152, 600
|
|
%t155 = add i32 %t153, %t154
|
|
%t156 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t155
|
|
call void @putarray(i32 %t148, i32* %t156)
|
|
%t158 = load i32, i32* %t4
|
|
%t159 = load i32, i32* %t0
|
|
%t160 = sub i32 %t159, 1
|
|
%t161 = load i32, i32* %t1
|
|
%t162 = sub i32 %t161, 1
|
|
%t163 = mul i32 %t160, 360000
|
|
%t164 = mul i32 %t162, 600
|
|
%t165 = add i32 %t163, %t164
|
|
%t166 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t165
|
|
call void @putarray(i32 %t158, i32* %t166)
|
|
ret i32 0
|
|
while.cond.13:
|
|
%t51 = load i32, i32* %t1
|
|
%t52 = load i32, i32* %t4
|
|
%t53 = sub i32 %t52, 1
|
|
%t54 = icmp slt i32 %t51, %t53
|
|
%t55 = zext i1 %t54 to i32
|
|
%t56 = icmp ne i32 %t55, 0
|
|
br i1 %t56, label %while.body.14, label %while.end.15
|
|
while.body.14:
|
|
store i32 1, i32* %t2
|
|
br label %while.cond.16
|
|
while.end.15:
|
|
%t142 = load i32, i32* %t0
|
|
%t143 = add i32 %t142, 1
|
|
store i32 %t143, i32* %t0
|
|
br label %while.cond.10
|
|
while.cond.16:
|
|
%t57 = load i32, i32* %t2
|
|
%t58 = load i32, i32* %t4
|
|
%t59 = sub i32 %t58, 1
|
|
%t60 = icmp slt i32 %t57, %t59
|
|
%t61 = zext i1 %t60 to i32
|
|
%t62 = icmp ne i32 %t61, 0
|
|
br i1 %t62, label %while.body.17, label %while.end.18
|
|
while.body.17:
|
|
%t63 = load i32, i32* %t0
|
|
%t64 = load i32, i32* %t1
|
|
%t65 = load i32, i32* %t2
|
|
%t66 = mul i32 %t63, 360000
|
|
%t67 = mul i32 %t64, 600
|
|
%t68 = add i32 %t66, %t67
|
|
%t69 = add i32 %t68, %t65
|
|
%t70 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t69
|
|
%t71 = load i32, i32* %t0
|
|
%t72 = sub i32 %t71, 1
|
|
%t73 = load i32, i32* %t1
|
|
%t74 = load i32, i32* %t2
|
|
%t75 = mul i32 %t72, 360000
|
|
%t76 = mul i32 %t73, 600
|
|
%t77 = add i32 %t75, %t76
|
|
%t78 = add i32 %t77, %t74
|
|
%t79 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t78
|
|
%t80 = load i32, i32* %t79
|
|
%t81 = load i32, i32* %t0
|
|
%t82 = add i32 %t81, 1
|
|
%t83 = load i32, i32* %t1
|
|
%t84 = load i32, i32* %t2
|
|
%t85 = mul i32 %t82, 360000
|
|
%t86 = mul i32 %t83, 600
|
|
%t87 = add i32 %t85, %t86
|
|
%t88 = add i32 %t87, %t84
|
|
%t89 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t88
|
|
%t90 = load i32, i32* %t89
|
|
%t91 = add i32 %t80, %t90
|
|
%t92 = load i32, i32* %t0
|
|
%t93 = load i32, i32* %t1
|
|
%t94 = sub i32 %t93, 1
|
|
%t95 = load i32, i32* %t2
|
|
%t96 = mul i32 %t92, 360000
|
|
%t97 = mul i32 %t94, 600
|
|
%t98 = add i32 %t96, %t97
|
|
%t99 = add i32 %t98, %t95
|
|
%t100 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t99
|
|
%t101 = load i32, i32* %t100
|
|
%t102 = add i32 %t91, %t101
|
|
%t103 = load i32, i32* %t0
|
|
%t104 = load i32, i32* %t1
|
|
%t105 = add i32 %t104, 1
|
|
%t106 = load i32, i32* %t2
|
|
%t107 = mul i32 %t103, 360000
|
|
%t108 = mul i32 %t105, 600
|
|
%t109 = add i32 %t107, %t108
|
|
%t110 = add i32 %t109, %t106
|
|
%t111 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t110
|
|
%t112 = load i32, i32* %t111
|
|
%t113 = add i32 %t102, %t112
|
|
%t114 = load i32, i32* %t0
|
|
%t115 = load i32, i32* %t1
|
|
%t116 = load i32, i32* %t2
|
|
%t117 = sub i32 %t116, 1
|
|
%t118 = mul i32 %t114, 360000
|
|
%t119 = mul i32 %t115, 600
|
|
%t120 = add i32 %t118, %t119
|
|
%t121 = add i32 %t120, %t117
|
|
%t122 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t121
|
|
%t123 = load i32, i32* %t122
|
|
%t124 = add i32 %t113, %t123
|
|
%t125 = load i32, i32* %t0
|
|
%t126 = load i32, i32* %t1
|
|
%t127 = load i32, i32* %t2
|
|
%t128 = add i32 %t127, 1
|
|
%t129 = mul i32 %t125, 360000
|
|
%t130 = mul i32 %t126, 600
|
|
%t131 = add i32 %t129, %t130
|
|
%t132 = add i32 %t131, %t128
|
|
%t133 = getelementptr inbounds [216000000 x i32], [216000000 x i32]* @x, i32 0, i32 %t132
|
|
%t134 = load i32, i32* %t133
|
|
%t135 = add i32 %t124, %t134
|
|
%t136 = load i32, i32* %t3
|
|
%t137 = sdiv i32 %t135, %t136
|
|
store i32 %t137, i32* %t70
|
|
%t138 = load i32, i32* %t2
|
|
%t139 = add i32 %t138, 1
|
|
store i32 %t139, i32* %t2
|
|
br label %while.cond.16
|
|
while.end.18:
|
|
%t140 = load i32, i32* %t1
|
|
%t141 = add i32 %t140, 1
|
|
store i32 %t141, i32* %t1
|
|
br label %while.cond.13
|
|
}
|