#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 */
double CalculateTimeDiff(double);
int /*<<< orphan*/ assert(int);
double BruteForceTempo(double start, double end) {
  double ctr = 0.0, temp = 0.0;
  double candidate = 0.0;
  double candidate_accuracy = 0.0;
  (assert((start > 0) && (end > 0)));
  (assert(start <= end));
  for (ctr = start; ctr <= end; ctr += 0.01) {
    temp = CalculateTimeDiff(ctr);
    if ((candidate < 1.0) || (temp < candidate_accuracy)) {
      candidate = ctr;
      candidate_accuracy = temp;
    }
  }
  return candidate;
}


x86 assembly (clang, -O0):
<BruteForceTempo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x28(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x31(%rbp)
jbe    117b <BruteForceTempo+0x5b>
movsd  -0x10(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
seta   %al
mov    %al,-0x31(%rbp)
mov    -0x31(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
setae  %al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm1
movsd  -0x10(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jb     1227 <BruteForceTempo+0x107>
movsd  -0x18(%rbp),%xmm0
call   1040 <CalculateTimeDiff@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  0xe28(%rip),%xmm0
ucomisd -0x28(%rbp),%xmm0
ja     11f7 <BruteForceTempo+0xd7>
movsd  -0x20(%rbp),%xmm1
movsd  -0x30(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    120b <BruteForceTempo+0xeb>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    1210 <BruteForceTempo+0xf0>
movsd  0xdf0(%rip),%xmm0
addsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
jmp    11ad <BruteForceTempo+0x8d>
movsd  -0x28(%rbp),%xmm0
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BruteForceTempo>:
sub    $0x28,%rsp
movsd  %xmm1,0x10(%rsp)
movsd  %xmm0,0x8(%rsp)
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
seta   %al
ucomisd %xmm2,%xmm1
seta   %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
xor    %edi,%edi
movsd  0x10(%rsp),%xmm0
ucomisd 0x8(%rsp),%xmm0
setae  %dil
call   1030 <assert@plt>
xorpd  %xmm3,%xmm3
movsd  0x8(%rsp),%xmm2
movsd  0x10(%rsp),%xmm0
ucomisd %xmm2,%xmm0
jae    1182 <BruteForceTempo+0x62>
movapd %xmm3,%xmm0
add    $0x28,%rsp
ret
xorpd  %xmm0,%xmm0
xorpd  %xmm1,%xmm1
jmp    11a8 <BruteForceTempo+0x88>
nopl   0x0(%rax)
addsd  0xe70(%rip),%xmm2
movsd  0x10(%rsp),%xmm1
ucomisd %xmm2,%xmm1
movapd %xmm3,%xmm1
jb     1179 <BruteForceTempo+0x59>
movsd  %xmm1,0x18(%rsp)
movsd  %xmm0,0x20(%rsp)
movsd  %xmm2,0x8(%rsp)
movapd %xmm2,%xmm0
call   1040 <CalculateTimeDiff@plt>
movsd  0x18(%rsp),%xmm4
movsd  0x8(%rsp),%xmm2
movsd  0xe29(%rip),%xmm1
ucomisd %xmm4,%xmm1
movsd  0x20(%rsp),%xmm1
seta   %al
ucomisd %xmm0,%xmm1
seta   %cl
or     %al,%cl
movapd %xmm2,%xmm3
jne    1190 <BruteForceTempo+0x70>
movapd %xmm4,%xmm3
movapd %xmm1,%xmm0
jmp    1190 <BruteForceTempo+0x70>

LLVM IR (-O0):
define double @BruteForceTempo(double %0, double %1) {
%3 = alloca double
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
%8 = alloca double
store double %0, double* %3
store double %1, double* %4
store double 0.000000e+00, double* %5
store double 0.000000e+00, double* %6
store double 0.000000e+00, double* %7
store double 0.000000e+00, double* %8
%9 = load double, double* %3
%10 = fcmp ogt double %9, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load double, double* %4
%13 = fcmp ogt double %12, 0.000000e+00
br label %14
14: ; preds = %11, %2
%15 = phi i1 [ false, %2 ], [ %13, %11 ]
%16 = zext i1 %15 to i32
%17 = call i32 @assert(i32 %16)
%18 = load double, double* %3
%19 = load double, double* %4
%20 = fcmp ole double %18, %19
%21 = zext i1 %20 to i32
%22 = call i32 @assert(i32 %21)
%23 = load double, double* %3
store double %23, double* %5
br label %24
24: ; preds = %41, %14
%25 = load double, double* %5
%26 = load double, double* %4
%27 = fcmp ole double %25, %26
br i1 %27, label %28, label %44
28: ; preds = %24
%29 = load double, double* %5
%30 = call double @CalculateTimeDiff(double %29)
store double %30, double* %6
%31 = load double, double* %7
%32 = fcmp olt double %31, 1.000000e+00
br i1 %32, label %37, label %33
33: ; preds = %28
%34 = load double, double* %6
%35 = load double, double* %8
%36 = fcmp olt double %34, %35
br i1 %36, label %37, label %40
37: ; preds = %33, %28
%38 = load double, double* %5
store double %38, double* %7
%39 = load double, double* %6
store double %39, double* %8
br label %40
40: ; preds = %37, %33
br label %41
41: ; preds = %40
%42 = load double, double* %5
%43 = fadd double %42, 1.000000e-02
store double %43, double* %5
br label %24
44: ; preds = %24
%45 = load double, double* %7
ret double %45
}

LLVM IR (-O2):
define double @BruteForceTempo(double %0, double %1) {
%3 = fcmp ogt double %0, 0.000000e+00
%4 = fcmp ogt double %1, 0.000000e+00
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = fcmp ole double %0, %1
%9 = zext i1 %8 to i32
%10 = tail call i32 @assert(i32 %9)
%11 = fcmp ugt double %0, %1
br i1 %11, label %24, label %12
12: ; preds = %2, %12
%13 = phi double [ %21, %12 ], [ 0.000000e+00, %2 ]
%14 = phi double [ %20, %12 ], [ 0.000000e+00, %2 ]
%15 = phi double [ %22, %12 ], [ %0, %2 ]
%16 = tail call double @CalculateTimeDiff(double %15)
%17 = fcmp olt double %14, 1.000000e+00
%18 = fcmp olt double %16, %13
%19 = select i1 %17, i1 true, i1 %18
%20 = select i1 %19, double %15, double %14
%21 = select i1 %19, double %16, double %13
%22 = fadd double %15, 1.000000e-02
%23 = fcmp ugt double %22, %1
br i1 %23, label %24, label %12
24: ; preds = %12, %2
%25 = phi double [ 0.000000e+00, %2 ], [ %20, %12 ]
ret double %25
}