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.

48 lines
1.2 KiB

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
store i32 0, i32* %t0
store i32 0, i32* %t1
store i32 56, i32* %t0
store i32 4, i32* %t1
%t2 = load i32, i32* %t0
%t3 = sub i32 %t2, -4
%t4 = load i32, i32* %t1
%t5 = add i32 %t3, %t4
store i32 %t5, i32* %t0
%t6 = load i32, i32* %t0
%t7 = icmp eq i32 %t6, 0
%t8 = zext i1 %t7 to i32
%t9 = icmp eq i32 %t8, 0
%t10 = zext i1 %t9 to i32
%t11 = icmp eq i32 %t10, 0
%t12 = zext i1 %t11 to i32
%t13 = sub i32 0, %t12
%t14 = icmp ne i32 %t13, 0
br i1 %t14, label %if.then.1, label %if.else.2
if.then.1:
store i32 -1, i32* %t0
br label %if.end.3
if.else.2:
%t15 = load i32, i32* %t1
store i32 %t15, i32* %t0
br label %if.end.3
if.end.3:
%t16 = load i32, i32* %t0
call void @putint(i32 %t16)
ret i32 0
}