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 @exgcd(i32 %arg.a, i32 %arg.b, i32* %arg.x, i32* %arg.y) { entry: %t9 = alloca i32 %t15 = alloca i32 %t0 = alloca i32 store i32 %arg.a, i32* %t0 %t1 = alloca i32 store i32 %arg.b, i32* %t1 %t2 = load i32, i32* %t1 %t3 = icmp eq i32 %t2, 0 %t4 = zext i1 %t3 to i32 %t5 = icmp ne i32 %t4, 0 br i1 %t5, label %if.then.1, label %if.else.2 if.then.1: %t6 = getelementptr inbounds i32, i32* %arg.x, i32 0 store i32 1, i32* %t6 %t7 = getelementptr inbounds i32, i32* %arg.y, i32 0 store i32 0, i32* %t7 %t8 = load i32, i32* %t0 ret i32 %t8 if.else.2: %t10 = load i32, i32* %t1 %t11 = load i32, i32* %t0 %t12 = load i32, i32* %t1 %t13 = srem i32 %t11, %t12 %t14 = call i32 @exgcd(i32 %t10, i32 %t13, i32* %arg.x, i32* %arg.y) store i32 %t14, i32* %t9 %t16 = getelementptr inbounds i32, i32* %arg.x, i32 0 %t17 = load i32, i32* %t16 store i32 %t17, i32* %t15 %t18 = getelementptr inbounds i32, i32* %arg.x, i32 0 %t19 = getelementptr inbounds i32, i32* %arg.y, i32 0 %t20 = load i32, i32* %t19 store i32 %t20, i32* %t18 %t21 = getelementptr inbounds i32, i32* %arg.y, i32 0 %t22 = load i32, i32* %t15 %t23 = load i32, i32* %t0 %t24 = load i32, i32* %t1 %t25 = sdiv i32 %t23, %t24 %t26 = getelementptr inbounds i32, i32* %arg.y, i32 0 %t27 = load i32, i32* %t26 %t28 = mul i32 %t25, %t27 %t29 = sub i32 %t22, %t28 store i32 %t29, i32* %t21 %t30 = load i32, i32* %t9 ret i32 %t30 if.end.3: ret i32 0 } define i32 @main() { entry: %t31 = alloca i32 %t32 = alloca i32 %t33 = alloca i32, i32 1 %t35 = alloca i32, i32 1 store i32 7, i32* %t31 store i32 15, i32* %t32 %t34 = getelementptr inbounds i32, i32* %t33, i32 0 store i32 1, i32* %t34 %t36 = getelementptr inbounds i32, i32* %t35, i32 0 store i32 1, i32* %t36 %t37 = load i32, i32* %t31 %t38 = load i32, i32* %t32 %t39 = call i32 @exgcd(i32 %t37, i32 %t38, i32* %t33, i32* %t35) %t40 = getelementptr inbounds i32, i32* %t33, i32 0 %t41 = getelementptr inbounds i32, i32* %t33, i32 0 %t42 = load i32, i32* %t41 %t43 = load i32, i32* %t32 %t44 = srem i32 %t42, %t43 %t45 = load i32, i32* %t32 %t46 = add i32 %t44, %t45 %t47 = load i32, i32* %t32 %t48 = srem i32 %t46, %t47 store i32 %t48, i32* %t40 %t49 = getelementptr inbounds i32, i32* %t33, i32 0 %t50 = load i32, i32* %t49 call void @putint(i32 %t50) ret i32 0 }