#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int RAND_MAX;
int /*<<< orphan*/ *createFile(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
double nextafter(double, int);
int /*<<< orphan*/ printf(char *, double, double);
scalar_t__ rand();
int /*<<< orphan*/ testCase(double, double *, double *, double *, double *,
                            int /*<<< orphan*/ *);
int main() {
  double worstSpeed = 0, indexSpeed, worstError = 0, indexError, tmp;
  FILE *fp;
  fp = createFile("Quick_Test_Both_");
  fprintf(fp, "Test Var,Our Output,Std Output,The Deviation Was,");
  fprintf(fp, "Our Output (in ms),Std Output (in ms),We Took X Ms Longer\n");
  for (double i = -711; i < 711; i += 0.25) {
    tmp = i;
    testCase(tmp, &worstSpeed, &indexSpeed, &worstError, &indexError, fp);
    tmp = nextafter(i, 712);
    testCase(tmp, &worstSpeed, &indexSpeed, &worstError, &indexError, fp);
    tmp = nextafter(i, -712);
    testCase(tmp, &worstSpeed, &indexSpeed, &worstError, &indexError, fp);
  }
  for (int i = 0; i < 1500; i++) {
    tmp = (double)rand() / (double)(RAND_MAX / 712);
    testCase(tmp, &worstSpeed, &indexSpeed, &worstError, &indexError, fp);
  }
  for (int i = 0; i < 1500; i++) {
    tmp = (double)rand() / (double)(RAND_MAX / 712);
    tmp = -tmp;
    testCase(tmp, &worstSpeed, &indexSpeed, &worstError, &indexError, fp);
  }
  fclose(fp);
  printf("Worst error is %e at %e\n", worstError, indexError);
  printf("Worst speed is %e at %e\n", worstSpeed, indexSpeed);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
lea    0xe82(%rip),%rdi
call   1050 <createFile@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xe7f(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xea1(%rip),%rsi
call   1060 <fprintf@plt>
movsd  0xe39(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe34(%rip),%xmm0
ucomisd -0x40(%rbp),%xmm0
jbe    1282 <main+0x112>
movsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%r8
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <testCase@plt>
movsd  -0x40(%rbp),%xmm0
mov    $0x2c8,%edi
call   1080 <nextafter@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%r8
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <testCase@plt>
movsd  -0x40(%rbp),%xmm0
mov    $0xfffffd38,%edi
call   1080 <nextafter@plt>
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%r8
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <testCase@plt>
movsd  0xd9d(%rip),%xmm0
addsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x40(%rbp)
jmp    11cc <main+0x5c>
movl   $0x0,-0x44(%rbp)
cmpl   $0x5dc,-0x44(%rbp)
jge    12ec <main+0x17c>
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2d3f(%rip),%rax
mov    (%rax),%eax
mov    $0x2c8,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%r8
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <testCase@plt>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    1289 <main+0x119>
movl   $0x0,-0x48(%rbp)
cmpl   $0x5dc,-0x48(%rbp)
jge    1377 <main+0x207>
mov    $0x0,%al
call   1090 <rand@plt>
cvtsi2sd %rax,%xmm0
mov    0x2cd5(%rip),%rax
mov    (%rax),%eax
mov    $0x2c8,%ecx
cltd
idiv   %ecx
cvtsi2sd %eax,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mov    -0x38(%rbp),%r8
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x20(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1070 <testCase@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    12f3 <main+0x183>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xd05(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xd08(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movq   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
lea    0xe99(%rip),%rdi
call   1050 <createFile@plt>
mov    %rax,%rbx
lea    0xe9b(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1080 <fwrite@plt>
lea    0xeb4(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1080 <fwrite@plt>
movsd  0xe27(%rip),%xmm0
lea    0x10(%rsp),%r14
lea    0x20(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
nopl   (%rax)
movsd  %xmm0,(%rsp)
movsd  (%rsp),%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
movsd  (%rsp),%xmm0
mov    $0x2c8,%edi
call   1070 <nextafter@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
movsd  (%rsp),%xmm0
mov    $0xfffffd38,%edi
call   1070 <nextafter@plt>
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
movsd  (%rsp),%xmm0
addsd  0xda7(%rip),%xmm0
movsd  0xda7(%rip),%xmm1
ucomisd %xmm0,%xmm1
ja     11f0 <main+0x80>
mov    $0x5dc,%r14d
mov    0x2d6c(%rip),%rbp
lea    0x20(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movslq 0x0(%rbp),%rax
imul   $0xffffffffb81702e1,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x9,%ecx
add    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
divsd  %xmm1,%xmm0
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
add    $0xffffffff,%r14d
jne    1290 <main+0x120>
mov    $0x5dc,%r14d
lea    0x20(%rsp),%r15
lea    0x8(%rsp),%r12
lea    0x18(%rsp),%r13
cs nopw 0x0(%rax,%rax,1)
xor    %eax,%eax
call   1090 <rand@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
xorpd  0xd09(%rip),%xmm0
movslq 0x0(%rbp),%rax
imul   $0xffffffffb81702e1,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%eax
shr    $0x1f,%eax
sar    $0x9,%ecx
add    %eax,%ecx
xorps  %xmm1,%xmm1
cvtsi2sd %ecx,%xmm1
divsd  %xmm1,%xmm0
lea    0x10(%rsp),%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
add    $0xffffffff,%r14d
jne    1300 <main+0x190>
mov    %rbx,%rdi
call   1030 <fclose@plt>
movsd  0x8(%rsp),%xmm0
movsd  0x18(%rsp),%xmm1
lea    0xd3a(%rip),%rdi
call   1040 <printf@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
lea    0xd3b(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"Quick_Test_Both_\00"
@.str.1 = [50 x i8] c"Test Var,Our Output,Std Output,The Deviation Was,\00"
@.str.2 = [59 x i8] c"Our Output (in ms),Std Output (in ms),We Took X Ms Longer\0A\00"
@RAND_MAX = global i32 0
@.str.3 = [25 x i8] c"Worst error is %e at %e\0A\00"
@.str.4 = [25 x i8] c"Worst speed is %e at %e\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca i32*
%8 = alloca double
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %4
%11 = call i32* @createFile(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = call i32 @fprintf(i32* %12, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%14 = load i32*, i32** %7
%15 = call i32 @fprintf(i32* %14, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
store double -7.110000e+02, double* %8
br label %16
16: ; preds = %34, %0
%17 = load double, double* %8
%18 = fcmp olt double %17, 7.110000e+02
br i1 %18, label %19, label %37
19: ; preds = %16
%20 = load double, double* %8
store double %20, double* %6
%21 = load double, double* %6
%22 = load i32*, i32** %7
%23 = call i32 @testCase(double %21, double* %2, double* %3, double* %4, double* %5, i32* %22)
%24 = load double, double* %8
%25 = call double @nextafter(double %24, i32 712)
store double %25, double* %6
%26 = load double, double* %6
%27 = load i32*, i32** %7
%28 = call i32 @testCase(double %26, double* %2, double* %3, double* %4, double* %5, i32* %27)
%29 = load double, double* %8
%30 = call double @nextafter(double %29, i32 -712)
store double %30, double* %6
%31 = load double, double* %6
%32 = load i32*, i32** %7
%33 = call i32 @testCase(double %31, double* %2, double* %3, double* %4, double* %5, i32* %32)
br label %34
34: ; preds = %19
%35 = load double, double* %8
%36 = fadd double %35, 2.500000e-01
store double %36, double* %8
br label %16
37: ; preds = %16
store i32 0, i32* %9
br label %38
38: ; preds = %51, %37
%39 = load i32, i32* %9
%40 = icmp slt i32 %39, 1500
br i1 %40, label %41, label %54
41: ; preds = %38
%42 = call i64 (...) @rand()
%43 = sitofp i64 %42 to double
%44 = load i32, i32* @RAND_MAX
%45 = sdiv i32 %44, 712
%46 = sitofp i32 %45 to double
%47 = fdiv double %43, %46
store double %47, double* %6
%48 = load double, double* %6
%49 = load i32*, i32** %7
%50 = call i32 @testCase(double %48, double* %2, double* %3, double* %4, double* %5, i32* %49)
br label %51
51: ; preds = %41
%52 = load i32, i32* %9
%53 = add nsw i32 %52, 1
store i32 %53, i32* %9
br label %38
54: ; preds = %38
store i32 0, i32* %10
br label %55
55: ; preds = %70, %54
%56 = load i32, i32* %10
%57 = icmp slt i32 %56, 1500
br i1 %57, label %58, label %73
58: ; preds = %55
%59 = call i64 (...) @rand()
%60 = sitofp i64 %59 to double
%61 = load i32, i32* @RAND_MAX
%62 = sdiv i32 %61, 712
%63 = sitofp i32 %62 to double
%64 = fdiv double %60, %63
store double %64, double* %6
%65 = load double, double* %6
%66 = fneg double %65
store double %66, double* %6
%67 = load double, double* %6
%68 = load i32*, i32** %7
%69 = call i32 @testCase(double %67, double* %2, double* %3, double* %4, double* %5, i32* %68)
br label %70
70: ; preds = %58
%71 = load i32, i32* %10
%72 = add nsw i32 %71, 1
store i32 %72, i32* %10
br label %55
73: ; preds = %55
%74 = load i32*, i32** %7
%75 = call i32 @fclose(i32* %74)
%76 = load double, double* %4
%77 = load double, double* %5
%78 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %76, double %77)
%79 = load double, double* %2
%80 = load double, double* %3
%81 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %79, double %80)
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
@.str = [17 x i8] c"Quick_Test_Both_\00"
@.str.1 = [50 x i8] c"Test Var,Our Output,Std Output,The Deviation Was,\00"
@.str.2 = [59 x i8] c"Our Output (in ms),Std Output (in ms),We Took X Ms Longer\0A\00"
@RAND_MAX = global i32 0
@.str.3 = [25 x i8] c"Worst error is %e at %e\0A\00"
@.str.4 = [25 x i8] c"Worst speed is %e at %e\0A\00"
define i32 @main() {
%1 = alloca double
%2 = alloca double
%3 = alloca double
%4 = alloca double
%5 = bitcast double* %1 to i8*
store double 0.000000e+00, double* %1
%6 = bitcast double* %2 to i8*
%7 = bitcast double* %3 to i8*
store double 0.000000e+00, double* %3
%8 = bitcast double* %4 to i8*
%9 = tail call i32* @createFile(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0), i64 49, i64 1, i32* %9)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0), i64 58, i64 1, i32* %9)
br label %12
12: ; preds = %0, %12
%13 = phi double [ -7.110000e+02, %0 ], [ %19, %12 ]
%14 = call i32 @testCase(double %13, double* %1, double* %2, double* %3, double* %4, i32* %9)
%15 = call double @nextafter(double %13, i32 712)
%16 = call i32 @testCase(double %15, double* %1, double* %2, double* %3, double* %4, i32* %9)
%17 = call double @nextafter(double %13, i32 -712)
%18 = call i32 @testCase(double %17, double* %1, double* %2, double* %3, double* %4, i32* %9)
%19 = fadd double %13, 2.500000e-01
%20 = fcmp olt double %19, 7.110000e+02
br i1 %20, label %12, label %21
21: ; preds = %12, %21
%22 = phi i32 [ %30, %21 ], [ 0, %12 ]
%23 = call i64 (...) @rand()
%24 = sitofp i64 %23 to double
%25 = load i32, i32* @RAND_MAX
%26 = sdiv i32 %25, 712
%27 = sitofp i32 %26 to double
%28 = fdiv double %24, %27
%29 = call i32 @testCase(double %28, double* %1, double* %2, double* %3, double* %4, i32* %9)
%30 = add nuw nsw i32 %22, 1
%31 = icmp eq i32 %30, 1500
br i1 %31, label %40, label %21
32: ; preds = %40
%33 = call i32 @fclose(i32* %9)
%34 = load double, double* %3
%35 = load double, double* %4
%36 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %34, double %35)
%37 = load double, double* %1
%38 = load double, double* %2
%39 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %37, double %38)
ret i32 0
40: ; preds = %21, %40
%41 = phi i32 [ %50, %40 ], [ 0, %21 ]
%42 = call i64 (...) @rand()
%43 = sitofp i64 %42 to double
%44 = load i32, i32* @RAND_MAX
%45 = sdiv i32 %44, 712
%46 = sitofp i32 %45 to double
%47 = fneg double %43
%48 = fdiv double %47, %46
%49 = call i32 @testCase(double %48, double* %1, double* %2, double* %3, double* %4, i32* %9)
%50 = add nuw nsw i32 %41, 1
%51 = icmp eq i32 %50, 1500
br i1 %51, label %32, label %40
}