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.

80 lines
2.0 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:
%t5 = alloca i32
%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
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 = zext i1 %t16 to i32
%t18 = icmp ne i32 %t17, 0
br i1 %t18, label %if.then.1, label %lor.rhs.4
if.then.1:
store i32 1, i32* %t5
br label %if.end.2
if.end.2:
%t41 = load i32, i32* %t5
ret i32 %t41
lor.rhs.3:
%t30 = load i32, i32* @a
%t31 = load i32, i32* @b
%t32 = add i32 %t30, %t31
%t33 = load i32, i32* @c
%t34 = add i32 %t32, %t33
%t35 = load i32, i32* @d
%t36 = load i32, i32* @e
%t37 = add i32 %t35, %t36
%t38 = icmp eq i32 %t34, %t37
%t39 = zext i1 %t38 to i32
%t40 = icmp ne i32 %t39, 0
br i1 %t40, label %if.then.1, label %if.end.2
lor.rhs.4:
%t19 = load i32, i32* @a
%t20 = load i32, i32* @b
%t21 = mul i32 %t19, %t20
%t22 = load i32, i32* @c
%t23 = sdiv i32 %t21, %t22
%t24 = load i32, i32* @e
%t25 = load i32, i32* @d
%t26 = add i32 %t24, %t25
%t27 = icmp eq i32 %t23, %t26
%t28 = zext i1 %t27 to i32
%t29 = icmp ne i32 %t28, 0
br i1 %t29, label %if.then.1, label %lor.rhs.3
}