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.

139 lines
3.5 KiB

@mod = global i32 998244853
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 @min(i32 %arg.a, i32 %arg.b) {
entry:
%t0 = alloca i32
store i32 %arg.a, i32* %t0
%t1 = alloca i32
store i32 %arg.b, i32* %t1
%t2 = load i32, i32* %t0
%t3 = load i32, i32* %t1
%t4 = icmp slt i32 %t2, %t3
%t5 = zext i1 %t4 to i32
%t6 = icmp ne i32 %t5, 0
br i1 %t6, label %if.then.1, label %if.else.2
if.then.1:
%t7 = load i32, i32* %t0
ret i32 %t7
if.else.2:
%t8 = load i32, i32* %t1
ret i32 %t8
if.end.3:
ret i32 0
}
define i32 @f(i32 %arg.x) {
entry:
%t10 = alloca i32
%t15 = alloca i32
%t20 = alloca i32
%t9 = alloca i32
store i32 %arg.x, i32* %t9
%t11 = load i32, i32* %t9
%t12 = load i32, i32* %t9
%t13 = sub i32 2147483647, %t12
%t14 = call i32 @min(i32 %t11, i32 %t13)
store i32 %t14, i32* %t10
%t16 = load i32, i32* %t10
%t17 = load i32, i32* %t10
%t18 = sub i32 1073741823, %t17
%t19 = call i32 @min(i32 %t16, i32 %t18)
store i32 %t19, i32* %t15
%t21 = load i32, i32* %t15
%t22 = load i32, i32* %t15
%t23 = sub i32 536870912, %t22
%t24 = call i32 @min(i32 %t21, i32 %t23)
store i32 %t24, i32* %t20
%t25 = load i32, i32* %t20
%t26 = load i32, i32* %t20
%t27 = mul i32 %t26, 3
%t28 = sdiv i32 %t27, 1000
%t29 = mul i32 %t28, 1001
%t30 = add i32 %t25, %t29
%t31 = srem i32 %t30, 19491001
ret i32 %t31
}
define i32 @loop_test(i32 %arg.s, i32 %arg.t, i32 %arg.d) {
entry:
%t35 = alloca i32
%t36 = alloca i32
%t32 = alloca i32
store i32 %arg.s, i32* %t32
%t33 = alloca i32
store i32 %arg.t, i32* %t33
%t34 = alloca i32
store i32 %arg.d, i32* %t34
store i32 0, i32* %t35
%t37 = load i32, i32* %t32
store i32 %t37, i32* %t36
br label %while.cond.4
while.cond.4:
%t38 = load i32, i32* %t36
%t39 = load i32, i32* %t33
%t40 = icmp slt i32 %t38, %t39
%t41 = zext i1 %t40 to i32
%t42 = icmp ne i32 %t41, 0
br i1 %t42, label %while.body.5, label %while.end.6
while.body.5:
%t43 = load i32, i32* %t35
%t44 = load i32, i32* %t36
%t45 = call i32 @f(i32 %t44)
%t46 = add i32 %t43, %t45
%t47 = srem i32 %t46, 998244853
store i32 %t47, i32* %t35
%t48 = load i32, i32* %t36
%t49 = load i32, i32* %t34
%t50 = add i32 %t48, %t49
store i32 %t50, i32* %t36
br label %while.cond.4
while.end.6:
%t51 = load i32, i32* %t35
ret i32 %t51
}
define i32 @main() {
entry:
%t52 = alloca i32
%t57 = alloca i32
%t59 = alloca i32
%t61 = alloca i32
%t53 = call i32 @getint()
store i32 %t53, i32* %t52
call void @starttime()
br label %while.cond.7
while.cond.7:
%t55 = load i32, i32* %t52
%t56 = icmp ne i32 %t55, 0
br i1 %t56, label %while.body.8, label %while.end.9
while.body.8:
%t58 = call i32 @getint()
store i32 %t58, i32* %t57
%t60 = call i32 @getint()
store i32 %t60, i32* %t59
%t62 = call i32 @getint()
store i32 %t62, i32* %t61
%t63 = load i32, i32* %t57
%t64 = load i32, i32* %t59
%t65 = load i32, i32* %t61
%t66 = call i32 @loop_test(i32 %t63, i32 %t64, i32 %t65)
call void @putint(i32 %t66)
call void @putch(i32 10)
%t69 = load i32, i32* %t52
%t70 = sub i32 %t69, 1
store i32 %t70, i32* %t52
br label %while.cond.7
while.end.9:
call void @stoptime()
ret i32 0
}