#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 fabs(double);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
double est_cornu_error(double t0, double t1) {
  double t, u, est;
  if (t0 < 0 || t1 < 0) {
    t0 = -t0;
    t1 = -t1;
  }
  if (t1 < 0) {
    fprintf(stderr, "unexpected t1 sign\n");
  }
  if (t1 < t0) {
    double tmp = t0;
    t0 = t1;
    t1 = tmp;
  }
  if (fabs(t0) < 1e-9) {
    est = t1 * t1 * t1;
    est *= .017256 - .0059 - est * t1;
  } else {
    t = t1 - t0;
    t *= t;
    t *= t;
    est = t * fabs(t0 + t1 - 1.22084) / (t0 + t1);
    u = t0 + t1 + .6;
    u = u * u * u;
    est *= .014 * (.6 * u + 1);
    est += t * (t1 - t0) * .004;
  }
  return est;
}


x86 assembly (clang, -O0):
<est_cornu_error>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x8(%rbp),%xmm0
ja     113e <est_cornu_error+0x2e>
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1180 <est_cornu_error+0x70>
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    11a3 <est_cornu_error+0x93>
mov    0x2e4b(%rip),%rax
mov    (%rax),%edi
lea    0xeb2(%rip),%rsi
call   1030 <fprintf@plt>
movsd  -0x10(%rbp),%xmm1
movsd  -0x8(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    11d5 <est_cornu_error+0xc5>
movsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x30(%rbp),%xmm0
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm1
movaps 0xe5f(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xe13(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    124b <est_cornu_error+0x13b>
movsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
mulsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  %xmm1,%xmm0
movsd  0xdf8(%rip),%xmm1
addsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
jmp    1344 <est_cornu_error+0x234>
movsd  -0x10(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
mulsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
movsd  0xd99(%rip),%xmm2
subsd  %xmm2,%xmm1
movaps 0xda6(%rip),%xmm2
pand   %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x8(%rbp),%xmm1
addsd  -0x10(%rbp),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x8(%rbp),%xmm0
addsd  -0x10(%rbp),%xmm0
movsd  0xd51(%rip),%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
mulsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
movsd  -0x20(%rbp),%xmm1
movsd  0xd27(%rip),%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd23(%rip),%xmm0
addsd  %xmm0,%xmm1
movsd  0xd07(%rip),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x28(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x18(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
subsd  -0x8(%rbp),%xmm1
mulsd  %xmm1,%xmm0
movsd  -0x28(%rbp),%xmm1
movsd  0xcd1(%rip),%xmm2
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<est_cornu_error>:
sub    $0x28,%rsp
xorpd  %xmm3,%xmm3
ucomisd %xmm0,%xmm3
seta   %al
ucomisd %xmm1,%xmm3
seta   %cl
or     %al,%cl
je     113a <est_cornu_error+0x2a>
movapd 0xece(%rip),%xmm2
xorpd  %xmm2,%xmm0
xorpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm3
jbe    116b <est_cornu_error+0x5b>
mov    0x2e99(%rip),%rax
mov    (%rax),%edi
lea    0xf08(%rip),%rsi
movapd %xmm1,0x10(%rsp)
movapd %xmm0,(%rsp)
call   1030 <fprintf@plt>
movapd (%rsp),%xmm0
movapd 0x10(%rsp),%xmm1
movapd %xmm0,%xmm2
maxsd  %xmm1,%xmm2
minsd  %xmm0,%xmm1
movapd 0xe91(%rip),%xmm0
andpd  %xmm1,%xmm0
movsd  0xe95(%rip),%xmm3
ucomisd %xmm0,%xmm3
jbe    11b6 <est_cornu_error+0xa6>
movapd %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm2
movsd  0xea7(%rip),%xmm0
subsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
add    $0x28,%rsp
ret
movapd %xmm2,%xmm5
subsd  %xmm1,%xmm5
movapd %xmm5,%xmm0
mulsd  %xmm5,%xmm0
mulsd  %xmm0,%xmm0
addsd  %xmm2,%xmm1
movsd  0xe52(%rip),%xmm2
addsd  %xmm1,%xmm2
andpd  0xe2e(%rip),%xmm2
mulsd  %xmm0,%xmm2
divsd  %xmm1,%xmm2
movsd  0xe3e(%rip),%xmm3
addsd  %xmm3,%xmm1
movapd %xmm1,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm1,%xmm4
mulsd  %xmm3,%xmm4
addsd  0xe2a(%rip),%xmm4
mulsd  0xe2a(%rip),%xmm4
mulsd  %xmm2,%xmm4
mulsd  %xmm5,%xmm0
mulsd  0xe22(%rip),%xmm0
addsd  %xmm4,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [20 x i8] c"unexpected t1 sign\0A\00"
define double @est_cornu_error(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
%9 = load double, double* %3
%10 = fcmp olt double %9, 0.000000e+00
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load double, double* %4
%13 = fcmp olt double %12, 0.000000e+00
br i1 %13, label %14, label %19
14: ; preds = %11, %2
%15 = load double, double* %3
%16 = fneg double %15
store double %16, double* %3
%17 = load double, double* %4
%18 = fneg double %17
store double %18, double* %4
br label %19
19: ; preds = %14, %11
%20 = load double, double* %4
%21 = fcmp olt double %20, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %25
25: ; preds = %22, %19
%26 = load double, double* %4
%27 = load double, double* %3
%28 = fcmp olt double %26, %27
br i1 %28, label %29, label %33
29: ; preds = %25
%30 = load double, double* %3
store double %30, double* %8
%31 = load double, double* %4
store double %31, double* %3
%32 = load double, double* %8
store double %32, double* %4
br label %33
33: ; preds = %29, %25
%34 = load double, double* %3
%35 = call double @llvm.fabs.f64(double %34)
%36 = fcmp olt double %35, 1.000000e-09
br i1 %36, label %37, label %49
37: ; preds = %33
%38 = load double, double* %4
%39 = load double, double* %4
%40 = fmul double %38, %39
%41 = load double, double* %4
%42 = fmul double %40, %41
store double %42, double* %7
%43 = load double, double* %7
%44 = load double, double* %4
%45 = fneg double %43
%46 = call double @llvm.fmuladd.f64(double %45, double %44, double 0x3F8741D084E831AE)
%47 = load double, double* %7
%48 = fmul double %47, %46
store double %48, double* %7
br label %91
49: ; preds = %33
%50 = load double, double* %4
%51 = load double, double* %3
%52 = fsub double %50, %51
store double %52, double* %5
%53 = load double, double* %5
%54 = load double, double* %5
%55 = fmul double %54, %53
store double %55, double* %5
%56 = load double, double* %5
%57 = load double, double* %5
%58 = fmul double %57, %56
store double %58, double* %5
%59 = load double, double* %5
%60 = load double, double* %3
%61 = load double, double* %4
%62 = fadd double %60, %61
%63 = fsub double %62, 1.220840e+00
%64 = call double @llvm.fabs.f64(double %63)
%65 = fmul double %59, %64
%66 = load double, double* %3
%67 = load double, double* %4
%68 = fadd double %66, %67
%69 = fdiv double %65, %68
store double %69, double* %7
%70 = load double, double* %3
%71 = load double, double* %4
%72 = fadd double %70, %71
%73 = fadd double %72, 6.000000e-01
store double %73, double* %6
%74 = load double, double* %6
%75 = load double, double* %6
%76 = fmul double %74, %75
%77 = load double, double* %6
%78 = fmul double %76, %77
store double %78, double* %6
%79 = load double, double* %6
%80 = call double @llvm.fmuladd.f64(double 6.000000e-01, double %79, double 1.000000e+00)
%81 = fmul double 1.400000e-02, %80
%82 = load double, double* %7
%83 = fmul double %82, %81
store double %83, double* %7
%84 = load double, double* %5
%85 = load double, double* %4
%86 = load double, double* %3
%87 = fsub double %85, %86
%88 = fmul double %84, %87
%89 = load double, double* %7
%90 = call double @llvm.fmuladd.f64(double %88, double 4.000000e-03, double %89)
store double %90, double* %7
br label %91
91: ; preds = %49, %37
%92 = load double, double* %7
ret double %92
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [20 x i8] c"unexpected t1 sign\0A\00"
define double @est_cornu_error(double %0, double %1) {
%3 = fcmp olt double %0, 0.000000e+00
%4 = fcmp olt double %1, 0.000000e+00
%5 = or i1 %3, %4
%6 = fneg double %0
%7 = fneg double %1
%8 = select i1 %5, double %7, double %1
%9 = select i1 %5, double %6, double %0
%10 = fcmp olt double %8, 0.000000e+00
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = load i32, i32* @stderr
%13 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %11, %2
%15 = fcmp olt double %8, %9
%16 = select i1 %15, double %9, double %8
%17 = select i1 %15, double %8, double %9
%18 = tail call double @llvm.fabs.f64(double %17)
%19 = fcmp olt double %18, 1.000000e-09
br i1 %19, label %20, label %26
20: ; preds = %14
%21 = fmul double %16, %16
%22 = fmul double %16, %21
%23 = fneg double %22
%24 = tail call double @llvm.fmuladd.f64(double %23, double %16, double 0x3F8741D084E831AE)
%25 = fmul double %22, %24
br label %43
26: ; preds = %14
%27 = fsub double %16, %17
%28 = fmul double %27, %27
%29 = fmul double %28, %28
%30 = fadd double %17, %16
%31 = fadd double %30, -1.220840e+00
%32 = tail call double @llvm.fabs.f64(double %31)
%33 = fmul double %29, %32
%34 = fdiv double %33, %30
%35 = fadd double %30, 6.000000e-01
%36 = fmul double %35, %35
%37 = fmul double %35, %36
%38 = tail call double @llvm.fmuladd.f64(double %37, double 6.000000e-01, double 1.000000e+00)
%39 = fmul double %38, 1.400000e-02
%40 = fmul double %34, %39
%41 = fmul double %27, %29
%42 = tail call double @llvm.fmuladd.f64(double %41, double 4.000000e-03, double %40)
br label %43
43: ; preds = %26, %20
%44 = phi double [ %25, %20 ], [ %42, %26 ]
ret double %44
}