#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*/ fprintf(int /*<<< orphan*/ *, char *, double, double, double,
                           double);
double ourDuration(double, double *);
double stdDuration(double, double *);
void testCase(double tmp, double *worstSpeed, double *indexSpeed,
              double *worstError, double *indexError, FILE *fp) {
  double ourResult;
  double ourSpeed = ourDuration(tmp, &ourResult);
  double stdResult;
  double stdSpeed = stdDuration(tmp, &stdResult);
  if (ourSpeed - stdSpeed > *worstSpeed) {
    *worstSpeed = ourSpeed - stdSpeed;
    *indexSpeed = tmp;
  }
  double currError = 1 - (ourResult / stdResult);
  if (currError > *worstError) {
    *worstError = currError;
    *indexError = tmp;
  }
  fprintf(fp, "%.17g,%e,%e,%e,", tmp, ourResult, stdResult, currError);
}


x86 assembly (clang, -O0):
<testCase>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x38(%rbp),%rdi
call   1030 <ourDuration@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  -0x8(%rbp),%xmm0
lea    -0x48(%rbp),%rdi
call   1050 <stdDuration@plt>
movsd  %xmm0,-0x50(%rbp)
movsd  -0x40(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    11ae <testCase+0x7e>
movsd  -0x40(%rbp),%xmm0
subsd  -0x50(%rbp),%xmm0
mov    -0x10(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x18(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x38(%rbp),%xmm1
divsd  -0x48(%rbp),%xmm1
movsd  0xe40(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
ucomisd (%rax),%xmm0
jbe    11f6 <testCase+0xc6>
movsd  -0x58(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
mov    -0x30(%rbp),%rdi
movsd  -0x8(%rbp),%xmm0
movsd  -0x38(%rbp),%xmm1
movsd  -0x48(%rbp),%xmm2
movsd  -0x58(%rbp),%xmm3
lea    0xdf3(%rip),%rsi
call   1040 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testCase>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %r8,%r15
mov    %rcx,%r14
mov    %rdx,%r13
mov    %rsi,%r12
mov    %rdi,%rbx
movsd  %xmm0,(%rsp)
lea    0x18(%rsp),%rdi
call   1030 <ourDuration@plt>
movsd  %xmm0,0x8(%rsp)
lea    0x10(%rsp),%rdi
movsd  (%rsp),%xmm0
call   1050 <stdDuration@plt>
movsd  (%rsp),%xmm4
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
ucomisd (%rbx),%xmm1
jbe    1193 <testCase+0x63>
movapd %xmm1,%xmm0
movsd  %xmm1,(%rbx)
movsd  %xmm4,(%r12)
movsd  0x18(%rsp),%xmm1
movsd  0x10(%rsp),%xmm2
movapd %xmm1,%xmm0
divsd  %xmm2,%xmm0
movsd  0xe51(%rip),%xmm3
subsd  %xmm0,%xmm3
ucomisd 0x0(%r13),%xmm3
jbe    11c6 <testCase+0x96>
movsd  %xmm3,0x0(%r13)
movsd  %xmm4,(%r14)
lea    0xe3b(%rip),%rsi
mov    %r15,%rdi
movaps %xmm4,%xmm0
call   1040 <fprintf@plt>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [16 x i8] c"%.17g,%e,%e,%e,\00"
define void @testCase(double %0, double* %1, double* %2, double* %3, double* %4, i32* %5) {
%7 = alloca double
%8 = alloca double*
%9 = alloca double*
%10 = alloca double*
%11 = alloca double*
%12 = alloca i32*
%13 = alloca double
%14 = alloca double
%15 = alloca double
%16 = alloca double
%17 = alloca double
store double %0, double* %7
store double* %1, double** %8
store double* %2, double** %9
store double* %3, double** %10
store double* %4, double** %11
store i32* %5, i32** %12
%18 = load double, double* %7
%19 = call double @ourDuration(double %18, double* %13)
store double %19, double* %14
%20 = load double, double* %7
%21 = call double @stdDuration(double %20, double* %15)
store double %21, double* %16
%22 = load double, double* %14
%23 = load double, double* %16
%24 = fsub double %22, %23
%25 = load double*, double** %8
%26 = load double, double* %25
%27 = fcmp ogt double %24, %26
br i1 %27, label %28, label %35
28: ; preds = %6
%29 = load double, double* %14
%30 = load double, double* %16
%31 = fsub double %29, %30
%32 = load double*, double** %8
store double %31, double* %32
%33 = load double, double* %7
%34 = load double*, double** %9
store double %33, double* %34
br label %35
35: ; preds = %28, %6
%36 = load double, double* %13
%37 = load double, double* %15
%38 = fdiv double %36, %37
%39 = fsub double 1.000000e+00, %38
store double %39, double* %17
%40 = load double, double* %17
%41 = load double*, double** %10
%42 = load double, double* %41
%43 = fcmp ogt double %40, %42
br i1 %43, label %44, label %49
44: ; preds = %35
%45 = load double, double* %17
%46 = load double*, double** %10
store double %45, double* %46
%47 = load double, double* %7
%48 = load double*, double** %11
store double %47, double* %48
br label %49
49: ; preds = %44, %35
%50 = load i32*, i32** %12
%51 = load double, double* %7
%52 = load double, double* %13
%53 = load double, double* %15
%54 = load double, double* %17
%55 = call i32 @fprintf(i32* %50, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %51, double %52, double %53, double %54)
ret void
}

LLVM IR (-O2):
@.str = [16 x i8] c"%.17g,%e,%e,%e,\00"
define void @testCase(double %0, double* nocapture %1, double* nocapture writeonly %2, double* nocapture %3, double* nocapture writeonly %4, i32* nocapture %5) {
%7 = alloca double
%8 = alloca double
%9 = bitcast double* %7 to i8*
%10 = call double @ourDuration(double %0, double* %7)
%11 = bitcast double* %8 to i8*
%12 = call double @stdDuration(double %0, double* %8)
%13 = fsub double %10, %12
%14 = load double, double* %1
%15 = fcmp ogt double %13, %14
br i1 %15, label %16, label %17
16: ; preds = %6
store double %13, double* %1
store double %0, double* %2
br label %17
17: ; preds = %16, %6
%18 = load double, double* %7
%19 = load double, double* %8
%20 = fdiv double %18, %19
%21 = fsub double 1.000000e+00, %20
%22 = load double, double* %3
%23 = fcmp ogt double %21, %22
br i1 %23, label %24, label %25
24: ; preds = %17
store double %21, double* %3
store double %0, double* %4
br label %25
25: ; preds = %24, %17
%26 = call i32 @fprintf(i32* %5, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), double %0, double %18, double %19, double %21)
ret void
}