#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 /*<<< orphan*/ *createFile(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ printf(char *, double, double);
int /*<<< orphan*/ testCase(double, double *, double *, double *, double *,
                            int /*<<< orphan*/ *);
int main() {
  double worstSpeed = 0, indexSpeed, worstError = 0, indexError, tmp;
  FILE *fp;
  fp = createFile("Increment_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");
  double j = 0.001;
  for (double i = -710; i <= 710; i += j) {
    testCase(i, &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    0xea2(%rip),%rdi
call   1050 <createFile@plt>
mov    %rax,-0x38(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xea3(%rip),%rsi
call   1060 <fprintf@plt>
mov    -0x38(%rbp),%rdi
lea    0xec5(%rip),%rsi
call   1060 <fprintf@plt>
movsd  0xe61(%rip),%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  0xe4c(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xe4f(%rip),%xmm0
ucomisd -0x48(%rbp),%xmm0
jb     11fe <main+0xae>
movsd  -0x48(%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
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
jmp    11b9 <main+0x69>
mov    -0x38(%rbp),%rdi
call   1030 <fclose@plt>
movsd  -0x20(%rbp),%xmm0
movsd  -0x28(%rbp),%xmm1
lea    0xe82(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
movsd  -0x18(%rbp),%xmm1
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x30,%rsp
movq   $0x0,0x18(%rsp)
movq   $0x0,0x10(%rsp)
lea    0xea2(%rip),%rdi
call   1050 <createFile@plt>
mov    %rax,%rbx
lea    0xea8(%rip),%rdi
mov    $0x31,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1070 <fwrite@plt>
lea    0xec1(%rip),%rdi
mov    $0x3a,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1070 <fwrite@plt>
movsd  0xe48(%rip),%xmm0
lea    0x18(%rsp),%r14
lea    0x28(%rsp),%r15
lea    0x10(%rsp),%r12
lea    0x20(%rsp),%r13
nopl   0x0(%rax)
movsd  %xmm0,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
mov    %r14,%rdi
mov    %r15,%rsi
mov    %r12,%rdx
mov    %r13,%rcx
mov    %rbx,%r8
call   1060 <testCase@plt>
movsd  0x8(%rsp),%xmm0
addsd  0xe0a(%rip),%xmm0
movsd  0xe0a(%rip),%xmm1
ucomisd %xmm0,%xmm1
jae    11d0 <main+0x80>
mov    %rbx,%rdi
call   1030 <fclose@plt>
movsd  0x10(%rsp),%xmm0
movsd  0x20(%rsp),%xmm1
lea    0xe73(%rip),%rdi
call   1040 <printf@plt>
movsd  0x18(%rsp),%xmm0
movsd  0x28(%rsp),%xmm1
lea    0xe74(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Increment_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"
@.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 double
store i32 0, i32* %1
store double 0.000000e+00, double* %2
store double 0.000000e+00, double* %4
%10 = call i32* @createFile(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32* %10, i32** %7
%11 = load i32*, i32** %7
%12 = call i32 @fprintf(i32* %11, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%13 = load i32*, i32** %7
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.2, i64 0, i64 0))
store double 1.000000e-03, double* %8
store double -7.100000e+02, double* %9
br label %15
15: ; preds = %22, %0
%16 = load double, double* %9
%17 = fcmp ole double %16, 7.100000e+02
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load double, double* %9
%20 = load i32*, i32** %7
%21 = call i32 @testCase(double %19, double* %2, double* %3, double* %4, double* %5, i32* %20)
br label %22
22: ; preds = %18
%23 = load double, double* %8
%24 = load double, double* %9
%25 = fadd double %24, %23
store double %25, double* %9
br label %15
26: ; preds = %15
%27 = load i32*, i32** %7
%28 = call i32 @fclose(i32* %27)
%29 = load double, double* %4
%30 = load double, double* %5
%31 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %29, double %30)
%32 = load double, double* %2
%33 = load double, double* %3
%34 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %32, double %33)
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [21 x i8] c"Increment_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"
@.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 ([21 x i8], [21 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 %20
12: ; preds = %20
%13 = call i32 @fclose(i32* %9)
%14 = load double, double* %3
%15 = load double, double* %4
%16 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.3, i64 0, i64 0), double %14, double %15)
%17 = load double, double* %1
%18 = load double, double* %2
%19 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), double %17, double %18)
ret i32 0
20: ; preds = %0, %20
%21 = phi double [ -7.100000e+02, %0 ], [ %23, %20 ]
%22 = call i32 @testCase(double %21, double* %1, double* %2, double* %3, double* %4, i32* %9)
%23 = fadd double %21, 1.000000e-03
%24 = fcmp ugt double %23, 7.100000e+02
br i1 %24, label %12, label %20
}