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.

248 lines
6.9 KiB

@N = global i32 10000
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 @long_array(i32 %arg.k) {
entry:
%t1 = alloca i32, i32 10000
%t2 = alloca i32, i32 10000
%t3 = alloca i32, i32 10000
%t4 = alloca i32
%t53 = alloca i32
%t74 = alloca i32
%t96 = alloca i32
%t0 = alloca i32
store i32 %arg.k, i32* %t0
store i32 0, i32* %t4
br label %while.cond.1
while.cond.1:
%t5 = load i32, i32* %t4
%t6 = icmp slt i32 %t5, 10000
%t7 = zext i1 %t6 to i32
%t8 = icmp ne i32 %t7, 0
br i1 %t8, label %while.body.2, label %while.end.3
while.body.2:
%t9 = load i32, i32* %t4
%t10 = getelementptr inbounds i32, i32* %t1, i32 %t9
%t11 = load i32, i32* %t4
%t12 = load i32, i32* %t4
%t13 = mul i32 %t11, %t12
%t14 = srem i32 %t13, 10
store i32 %t14, i32* %t10
%t15 = load i32, i32* %t4
%t16 = add i32 %t15, 1
store i32 %t16, i32* %t4
br label %while.cond.1
while.end.3:
store i32 0, i32* %t4
br label %while.cond.4
while.cond.4:
%t17 = load i32, i32* %t4
%t18 = icmp slt i32 %t17, 10000
%t19 = zext i1 %t18 to i32
%t20 = icmp ne i32 %t19, 0
br i1 %t20, label %while.body.5, label %while.end.6
while.body.5:
%t21 = load i32, i32* %t4
%t22 = getelementptr inbounds i32, i32* %t2, i32 %t21
%t23 = load i32, i32* %t4
%t24 = getelementptr inbounds i32, i32* %t1, i32 %t23
%t25 = load i32, i32* %t24
%t26 = load i32, i32* %t4
%t27 = getelementptr inbounds i32, i32* %t1, i32 %t26
%t28 = load i32, i32* %t27
%t29 = mul i32 %t25, %t28
%t30 = srem i32 %t29, 10
store i32 %t30, i32* %t22
%t31 = load i32, i32* %t4
%t32 = add i32 %t31, 1
store i32 %t32, i32* %t4
br label %while.cond.4
while.end.6:
store i32 0, i32* %t4
br label %while.cond.7
while.cond.7:
%t33 = load i32, i32* %t4
%t34 = icmp slt i32 %t33, 10000
%t35 = zext i1 %t34 to i32
%t36 = icmp ne i32 %t35, 0
br i1 %t36, label %while.body.8, label %while.end.9
while.body.8:
%t37 = load i32, i32* %t4
%t38 = getelementptr inbounds i32, i32* %t3, i32 %t37
%t39 = load i32, i32* %t4
%t40 = getelementptr inbounds i32, i32* %t2, i32 %t39
%t41 = load i32, i32* %t40
%t42 = load i32, i32* %t4
%t43 = getelementptr inbounds i32, i32* %t2, i32 %t42
%t44 = load i32, i32* %t43
%t45 = mul i32 %t41, %t44
%t46 = srem i32 %t45, 100
%t47 = load i32, i32* %t4
%t48 = getelementptr inbounds i32, i32* %t1, i32 %t47
%t49 = load i32, i32* %t48
%t50 = add i32 %t46, %t49
store i32 %t50, i32* %t38
%t51 = load i32, i32* %t4
%t52 = add i32 %t51, 1
store i32 %t52, i32* %t4
br label %while.cond.7
while.end.9:
store i32 0, i32* %t53
store i32 0, i32* %t4
br label %while.cond.10
while.cond.10:
%t54 = load i32, i32* %t4
%t55 = icmp slt i32 %t54, 10000
%t56 = zext i1 %t55 to i32
%t57 = icmp ne i32 %t56, 0
br i1 %t57, label %while.body.11, label %while.end.12
while.body.11:
%t58 = load i32, i32* %t4
%t59 = icmp slt i32 %t58, 10
%t60 = zext i1 %t59 to i32
%t61 = icmp ne i32 %t60, 0
br i1 %t61, label %if.then.13, label %if.else.14
while.end.12:
%t140 = load i32, i32* %t53
ret i32 %t140
if.then.13:
%t62 = load i32, i32* %t53
%t63 = load i32, i32* %t4
%t64 = getelementptr inbounds i32, i32* %t3, i32 %t63
%t65 = load i32, i32* %t64
%t66 = add i32 %t62, %t65
%t67 = srem i32 %t66, 1333
store i32 %t67, i32* %t53
%t68 = load i32, i32* %t53
call void @putint(i32 %t68)
br label %if.end.15
if.else.14:
%t70 = load i32, i32* %t4
%t71 = icmp slt i32 %t70, 20
%t72 = zext i1 %t71 to i32
%t73 = icmp ne i32 %t72, 0
br i1 %t73, label %if.then.16, label %if.else.17
if.end.15:
%t138 = load i32, i32* %t4
%t139 = add i32 %t138, 1
store i32 %t139, i32* %t4
br label %while.cond.10
if.then.16:
store i32 5000, i32* %t74
br label %while.cond.19
if.else.17:
%t92 = load i32, i32* %t4
%t93 = icmp slt i32 %t92, 30
%t94 = zext i1 %t93 to i32
%t95 = icmp ne i32 %t94, 0
br i1 %t95, label %if.then.22, label %if.else.23
if.end.18:
br label %if.end.15
while.cond.19:
%t75 = load i32, i32* %t74
%t76 = icmp slt i32 %t75, 10000
%t77 = zext i1 %t76 to i32
%t78 = icmp ne i32 %t77, 0
br i1 %t78, label %while.body.20, label %while.end.21
while.body.20:
%t79 = load i32, i32* %t53
%t80 = load i32, i32* %t4
%t81 = getelementptr inbounds i32, i32* %t3, i32 %t80
%t82 = load i32, i32* %t81
%t83 = add i32 %t79, %t82
%t84 = load i32, i32* %t74
%t85 = getelementptr inbounds i32, i32* %t1, i32 %t84
%t86 = load i32, i32* %t85
%t87 = sub i32 %t83, %t86
store i32 %t87, i32* %t53
%t88 = load i32, i32* %t74
%t89 = add i32 %t88, 1
store i32 %t89, i32* %t74
br label %while.cond.19
while.end.21:
%t90 = load i32, i32* %t53
call void @putint(i32 %t90)
br label %if.end.18
if.then.22:
store i32 5000, i32* %t96
br label %while.cond.25
if.else.23:
%t130 = load i32, i32* %t53
%t131 = load i32, i32* %t4
%t132 = getelementptr inbounds i32, i32* %t3, i32 %t131
%t133 = load i32, i32* %t132
%t134 = load i32, i32* %t0
%t135 = mul i32 %t133, %t134
%t136 = add i32 %t130, %t135
%t137 = srem i32 %t136, 99988
store i32 %t137, i32* %t53
br label %if.end.24
if.end.24:
br label %if.end.18
while.cond.25:
%t97 = load i32, i32* %t96
%t98 = icmp slt i32 %t97, 10000
%t99 = zext i1 %t98 to i32
%t100 = icmp ne i32 %t99, 0
br i1 %t100, label %while.body.26, label %while.end.27
while.body.26:
%t101 = load i32, i32* %t96
%t102 = icmp sgt i32 %t101, 2233
%t103 = zext i1 %t102 to i32
%t104 = icmp ne i32 %t103, 0
br i1 %t104, label %if.then.28, label %if.else.29
while.end.27:
%t128 = load i32, i32* %t53
call void @putint(i32 %t128)
br label %if.end.24
if.then.28:
%t105 = load i32, i32* %t53
%t106 = load i32, i32* %t4
%t107 = getelementptr inbounds i32, i32* %t2, i32 %t106
%t108 = load i32, i32* %t107
%t109 = add i32 %t105, %t108
%t110 = load i32, i32* %t96
%t111 = getelementptr inbounds i32, i32* %t1, i32 %t110
%t112 = load i32, i32* %t111
%t113 = sub i32 %t109, %t112
store i32 %t113, i32* %t53
%t114 = load i32, i32* %t96
%t115 = add i32 %t114, 1
store i32 %t115, i32* %t96
br label %if.end.30
if.else.29:
%t116 = load i32, i32* %t53
%t117 = load i32, i32* %t4
%t118 = getelementptr inbounds i32, i32* %t1, i32 %t117
%t119 = load i32, i32* %t118
%t120 = add i32 %t116, %t119
%t121 = load i32, i32* %t96
%t122 = getelementptr inbounds i32, i32* %t3, i32 %t121
%t123 = load i32, i32* %t122
%t124 = add i32 %t120, %t123
%t125 = srem i32 %t124, 13333
store i32 %t125, i32* %t53
%t126 = load i32, i32* %t96
%t127 = add i32 %t126, 2
store i32 %t127, i32* %t96
br label %if.end.30
if.end.30:
br label %while.cond.25
}
define i32 @main() {
entry:
%t141 = call i32 @long_array(i32 9)
ret i32 %t141
}