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.

88 lines
2.3 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
%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
store i32 5, i32* %t0
store i32 5, i32* %t1
store i32 1, i32* %t2
store i32 -2, i32* %t3
store i32 2, i32* %t4
%t5 = load i32, i32* %t3
%t6 = sdiv i32 %t5, 2
%t7 = icmp slt i32 %t6, 0
%t8 = zext i1 %t7 to i32
%t9 = icmp ne i32 %t8, 0
br i1 %t9, label %if.then.1, label %lor.rhs.3
if.then.1:
%t22 = load i32, i32* %t4
call void @putint(i32 %t22)
br label %if.end.2
if.end.2:
%t24 = load i32, i32* %t3
%t25 = srem i32 %t24, 2
%t26 = add i32 %t25, 67
%t27 = icmp slt i32 %t26, 0
%t28 = zext i1 %t27 to i32
%t29 = icmp ne i32 %t28, 0
br i1 %t29, label %if.then.5, label %lor.rhs.7
lor.rhs.3:
%t10 = load i32, i32* %t0
%t11 = load i32, i32* %t1
%t12 = sub i32 %t10, %t11
%t13 = icmp ne i32 %t12, 0
%t14 = zext i1 %t13 to i32
%t15 = icmp ne i32 %t14, 0
br i1 %t15, label %land.rhs.4, label %if.end.2
land.rhs.4:
%t16 = load i32, i32* %t2
%t17 = add i32 %t16, 3
%t18 = srem i32 %t17, 2
%t19 = icmp ne i32 %t18, 0
%t20 = zext i1 %t19 to i32
%t21 = icmp ne i32 %t20, 0
br i1 %t21, label %if.then.1, label %if.end.2
if.then.5:
store i32 4, i32* %t4
%t42 = load i32, i32* %t4
call void @putint(i32 %t42)
br label %if.end.6
if.end.6:
ret i32 0
lor.rhs.7:
%t30 = load i32, i32* %t0
%t31 = load i32, i32* %t1
%t32 = sub i32 %t30, %t31
%t33 = icmp ne i32 %t32, 0
%t34 = zext i1 %t33 to i32
%t35 = icmp ne i32 %t34, 0
br i1 %t35, label %land.rhs.8, label %if.end.6
land.rhs.8:
%t36 = load i32, i32* %t2
%t37 = add i32 %t36, 2
%t38 = srem i32 %t37, 2
%t39 = icmp ne i32 %t38, 0
%t40 = zext i1 %t39 to i32
%t41 = icmp ne i32 %t40, 0
br i1 %t41, label %if.then.5, label %if.end.6
}