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.

77 lines
1.9 KiB

@a = global i32 0
@b = global i32 0
@c = global i32 0
@d = global i32 0
@e = 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:
%t0 = call i32 @getint()
store i32 %t0, i32* @a
%t1 = call i32 @getint()
store i32 %t1, i32* @b
%t2 = call i32 @getint()
store i32 %t2, i32* @c
%t3 = call i32 @getint()
store i32 %t3, i32* @d
%t4 = call i32 @getint()
store i32 %t4, i32* @e
%t5 = alloca i32
store i32 0, i32* %t5
%t6 = load i32, i32* @a
%t7 = load i32, i32* @b
%t8 = load i32, i32* @c
%t9 = mul i32 %t7, %t8
%t10 = sub i32 %t6, %t9
%t11 = load i32, i32* @d
%t12 = load i32, i32* @a
%t13 = load i32, i32* @c
%t14 = sdiv i32 %t12, %t13
%t15 = sub i32 %t11, %t14
%t16 = icmp ne i32 %t10, %t15
%t17 = icmp ne i32 %t16, 0
br i1 %t17, label %if.then.1, label %lor.rhs.4
if.then.1:
store i32 1, i32* %t5
br label %if.end.2
if.end.2:
%t38 = load i32, i32* %t5
ret i32 %t38
lor.rhs.3:
%t28 = load i32, i32* @a
%t29 = load i32, i32* @b
%t30 = add i32 %t28, %t29
%t31 = load i32, i32* @c
%t32 = add i32 %t30, %t31
%t33 = load i32, i32* @d
%t34 = load i32, i32* @e
%t35 = add i32 %t33, %t34
%t36 = icmp eq i32 %t32, %t35
%t37 = icmp ne i32 %t36, 0
br i1 %t37, label %if.then.1, label %if.end.2
lor.rhs.4:
%t18 = load i32, i32* @a
%t19 = load i32, i32* @b
%t20 = mul i32 %t18, %t19
%t21 = load i32, i32* @c
%t22 = sdiv i32 %t20, %t21
%t23 = load i32, i32* @e
%t24 = load i32, i32* @d
%t25 = add i32 %t23, %t24
%t26 = icmp eq i32 %t22, %t25
%t27 = icmp ne i32 %t26, 0
br i1 %t27, label %if.then.1, label %lor.rhs.3
}