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.

71 lines
1.8 KiB

@k = 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 i32 @main() {
entry:
store i32 3389, i32* @k
%t0 = load i32, i32* @k
%t1 = icmp slt i32 %t0, 10000
%t2 = icmp ne i32 %t1, 0
br i1 %t2, label %if.then.1, label %if.end.2
if.then.1:
%t3 = load i32, i32* @k
%t4 = add i32 %t3, 1
store i32 %t4, i32* @k
%t5 = alloca i32
store i32 112, i32* %t5
br label %while.cond.3
if.end.2:
%t27 = load i32, i32* @k
ret i32 %t27
while.cond.3:
%t6 = load i32, i32* %t5
%t7 = icmp sgt i32 %t6, 10
%t8 = icmp ne i32 %t7, 0
br i1 %t8, label %while.body.4, label %while.end.5
while.body.4:
%t9 = load i32, i32* %t5
%t10 = sub i32 %t9, 88
store i32 %t10, i32* %t5
%t11 = load i32, i32* %t5
%t12 = icmp slt i32 %t11, 1000
%t13 = icmp ne i32 %t12, 0
br i1 %t13, label %if.then.6, label %if.end.7
while.end.5:
%t25 = load i32, i32* %t5
call void @putint(i32 %t25)
br label %if.end.2
if.then.6:
%t14 = alloca i32
store i32 9, i32* %t14
%t15 = alloca i32
store i32 11, i32* %t15
store i32 10, i32* %t14
%t16 = load i32, i32* %t5
%t17 = load i32, i32* %t14
%t18 = sub i32 %t16, %t17
store i32 %t18, i32* %t5
%t19 = alloca i32
store i32 11, i32* %t19
%t20 = load i32, i32* %t5
%t21 = load i32, i32* %t19
%t22 = add i32 %t20, %t21
%t23 = load i32, i32* %t15
%t24 = add i32 %t22, %t23
store i32 %t24, i32* %t5
br label %if.end.7
if.end.7:
br label %while.cond.3
}