#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*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
void checkResult(int success, double e) {
  if (!success) {
    fprintf(stderr, "\n\n*** Test failed\n");
    exit(-1);
  }
  if (e != -1) {
    fprintf(stderr, "OK (%g ulp)\n", e);
  } else {
    fprintf(stderr, "OK\n");
  }
}


x86 assembly (clang, -O0):
<checkResult>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    115b <checkResult+0x3b>
mov    0x2e9f(%rip),%rax
mov    (%rax),%edi
lea    0xebe(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>
movsd  -0x10(%rbp),%xmm0
movsd  0xe98(%rip),%xmm1
ucomisd %xmm1,%xmm0
jne    117d <checkResult+0x5d>
jp     117d <checkResult+0x5d>
jmp    119e <checkResult+0x7e>
mov    0x2e5c(%rip),%rax
mov    (%rax),%edi
movsd  -0x10(%rbp),%xmm0
lea    0xe89(%rip),%rsi
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    11b5 <checkResult+0x95>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkResult>:
push   %rax
test   %edi,%edi
je     1158 <checkResult+0x38>
ucomisd 0xed3(%rip),%xmm0
mov    0x2eac(%rip),%rax
mov    (%rax),%edi
jne    113a <checkResult+0x1a>
jnp    1149 <checkResult+0x29>
lea    0xeda(%rip),%rsi
mov    $0x1,%al
pop    %rcx
jmp    1030 <fprintf@plt>
lea    0xed8(%rip),%rsi
xor    %eax,%eax
pop    %rcx
jmp    1030 <fprintf@plt>
mov    0x2e81(%rip),%rax
mov    (%rax),%edi
lea    0xea0(%rip),%rsi
xor    %eax,%eax
call   1030 <fprintf@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [19 x i8] c"\0A\0A*** Test failed\0A\00"
@.str.1 = [13 x i8] c"OK (%g ulp)\0A\00"
@.str.2 = [4 x i8] c"OK\0A\00"
define void @checkResult(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%5 = load i32, i32* %3
%6 = icmp ne i32 %5, 0
br i1 %6, label %11, label %7
7: ; preds = %2
%8 = load i32, i32* @stderr
%9 = call i32 (i32, i8*, ...) @fprintf(i32 %8, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @exit(i32 -1)
unreachable
11: ; preds = %2
%12 = load double, double* %4
%13 = fcmp une double %12, -1.000000e+00
br i1 %13, label %14, label %18
14: ; preds = %11
%15 = load i32, i32* @stderr
%16 = load double, double* %4
%17 = call i32 (i32, i8*, ...) @fprintf(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %16)
br label %21
18: ; preds = %11
%19 = load i32, i32* @stderr
%20 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %18, %14
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [19 x i8] c"\0A\0A*** Test failed\0A\00"
@.str.1 = [13 x i8] c"OK (%g ulp)\0A\00"
@.str.2 = [4 x i8] c"OK\0A\00"
define void @checkResult(i32 %0, double %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 (i32, i8*, ...) @fprintf(i32 %5, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 -1)
unreachable
8: ; preds = %2
%9 = fcmp une double %1, -1.000000e+00
%10 = load i32, i32* @stderr
br i1 %9, label %11, label %13
11: ; preds = %8
%12 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), double %1)
br label %15
13: ; preds = %8
%14 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret void
}