#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, int, int, char *,
                           int);
int /*<<< orphan*/ printf(char *, int, int, char *, int);
int /*<<< orphan*/ stderr;
void CHECK(int t, int st, int got, int expect, int pc, char *desc) {
  if ((got >= (((1E2 - pc) * expect) / 1E2)) &&
      (got <= (((1E2 + pc) * expect) / 1E2))) {
    printf("TEST %2d.%-2d PASS (%s: %d)\n", t, st, desc, expect);
  } else {
    fprintf(stderr, "TEST %2d.%-2d FAILED got %d (%s: %d)\n", t, st, got, desc,
            expect);
  }
}


x86 assembly (clang, -O0):
<CHECK>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
cvtsi2sdl -0xc(%rbp),%xmm0
cvtsi2sdl -0x14(%rbp),%xmm2
movsd  0xeb2(%rip),%xmm1
subsd  %xmm2,%xmm1
cvtsi2sdl -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm1
movsd  0xe9d(%rip),%xmm2
divsd  %xmm2,%xmm1
ucomisd %xmm1,%xmm0
jb     11c5 <CHECK+0xa5>
cvtsi2sdl -0xc(%rbp),%xmm1
cvtsi2sdl -0x14(%rbp),%xmm2
movsd  0xe7d(%rip),%xmm0
addsd  %xmm2,%xmm0
cvtsi2sdl -0x10(%rbp),%xmm2
mulsd  %xmm2,%xmm0
movsd  0xe68(%rip),%xmm2
divsd  %xmm2,%xmm0
ucomisd %xmm1,%xmm0
jb     11c5 <CHECK+0xa5>
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8d
lea    0xe4d(%rip),%rdi
call   1030 <printf@plt>
jmp    11ee <CHECK+0xce>
mov    0x2e14(%rip),%rax
mov    (%rax),%edi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x20(%rbp),%r9
mov    -0x10(%rbp),%eax
lea    0xe3f(%rip),%rsi
mov    %eax,(%rsp)
call   1040 <fprintf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CHECK>:
push   %rax
mov    %ecx,%eax
mov    %edx,%r10d
mov    %esi,%ecx
mov    %edi,%edx
cvtsi2sd %r10d,%xmm0
cvtsi2sd %r8d,%xmm1
movsd  0xec4(%rip),%xmm2
movapd %xmm2,%xmm4
subsd  %xmm1,%xmm4
cvtsi2sd %eax,%xmm3
mulsd  %xmm3,%xmm4
divsd  %xmm2,%xmm4
ucomisd %xmm4,%xmm0
jb     1168 <CHECK+0x48>
addsd  %xmm2,%xmm1
mulsd  %xmm3,%xmm1
divsd  %xmm2,%xmm1
ucomisd %xmm0,%xmm1
jae    1185 <CHECK+0x65>
mov    0x2e71(%rip),%rsi
mov    (%rsi),%edi
mov    %eax,(%rsp)
lea    0xeaa(%rip),%rsi
mov    %r10d,%r8d
call   1040 <fprintf@plt>
pop    %rax
ret
lea    0xe7c(%rip),%rdi
mov    %edx,%esi
mov    %ecx,%edx
mov    %r9,%rcx
mov    %eax,%r8d
pop    %rax
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [29 x i8] c"TEST %2d.%-2d PASS (%s: %d)\0A\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"TEST %2d.%-2d FAILED got %d (%s: %d)\0A\00"
define void @CHECK(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
store i32 %0, i32* %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%13 = load i32, i32* %9
%14 = sitofp i32 %13 to double
%15 = load i32, i32* %11
%16 = sitofp i32 %15 to double
%17 = fsub double 1.000000e+02, %16
%18 = load i32, i32* %10
%19 = sitofp i32 %18 to double
%20 = fmul double %17, %19
%21 = fdiv double %20, 1.000000e+02
%22 = fcmp oge double %14, %21
br i1 %22, label %23, label %40
23: ; preds = %6
%24 = load i32, i32* %9
%25 = sitofp i32 %24 to double
%26 = load i32, i32* %11
%27 = sitofp i32 %26 to double
%28 = fadd double 1.000000e+02, %27
%29 = load i32, i32* %10
%30 = sitofp i32 %29 to double
%31 = fmul double %28, %30
%32 = fdiv double %31, 1.000000e+02
%33 = fcmp ole double %25, %32
br i1 %33, label %34, label %40
34: ; preds = %23
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = load i8*, i8** %12
%38 = load i32, i32* %10
%39 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %35, i32 %36, i8* %37, i32 %38)
br label %48
40: ; preds = %23, %6
%41 = load i32, i32* @stderr
%42 = load i32, i32* %7
%43 = load i32, i32* %8
%44 = load i32, i32* %9
%45 = load i8*, i8** %12
%46 = load i32, i32* %10
%47 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43, i32 %44, i8* %45, i32 %46)
br label %48
48: ; preds = %40, %34
ret void
}

LLVM IR (-O2):
@.str = [29 x i8] c"TEST %2d.%-2d PASS (%s: %d)\0A\00"
@stderr = global i32 0
@.str.1 = [38 x i8] c"TEST %2d.%-2d FAILED got %d (%s: %d)\0A\00"
define void @CHECK(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = sitofp i32 %2 to double
%8 = sitofp i32 %4 to double
%9 = fsub double 1.000000e+02, %8
%10 = sitofp i32 %3 to double
%11 = fmul double %9, %10
%12 = fdiv double %11, 1.000000e+02
%13 = fcmp ugt double %12, %7
br i1 %13, label %21, label %14
14: ; preds = %6
%15 = fadd double %8, 1.000000e+02
%16 = fmul double %15, %10
%17 = fdiv double %16, 1.000000e+02
%18 = fcmp ult double %17, %7
br i1 %18, label %21, label %19
19: ; preds = %14
%20 = tail call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i8* %5, i32 %3)
br label %24
21: ; preds = %14, %6
%22 = load i32, i32* @stderr
%23 = tail call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i8* %5, i32 %3)
br label %24
24: ; preds = %21, %19
ret void
}