#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 */
int /*<<< orphan*/ assert(int);
int pow1pm1(double const, double);
double mse_pfdr_deltaapprox(const double lambda, const double gamma,
                            const unsigned int a, const unsigned int b,
                            const unsigned int c, const unsigned int d,
                            const unsigned int m) {
  assert(lambda >= 0. && lambda <= 1.);
  assert(gamma >= 0. && gamma <= 1.);
  assert(a >= 0);
  assert(b >= 0);
  assert(c >= 0);
  assert(d >= 0);
  assert(a + b + c + d == m);
  const double apb = a + b;
  const double apb_sqr = apb * apb;
  const double bmc = b - c;
  const double apc = a + c;
  const double Klambda = -1. / ((1. - lambda) * pow1pm1(-gamma, (double)m));
  return Klambda * Klambda / (apb_sqr * apb_sqr) *
         (a * bmc * bmc + b * apc * apc + c * apb_sqr);
}


x86 assembly (clang, -O0):
<mse_pfdr_deltaapprox>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
mov    %esi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
mov    %ecx,-0x20(%rbp)
mov    %r8d,-0x24(%rbp)
movsd  -0x8(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x51(%rbp)
jb     116c <mse_pfdr_deltaapprox+0x4c>
movsd  0xe9f(%rip),%xmm0
ucomisd -0x8(%rbp),%xmm0
setae  %al
mov    %al,-0x51(%rbp)
mov    -0x51(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1030 <assert@plt>
movsd  -0x10(%rbp),%xmm0
xor    %eax,%eax
xorps  %xmm1,%xmm1
ucomisd %xmm1,%xmm0
mov    %al,-0x52(%rbp)
jb     11a3 <mse_pfdr_deltaapprox+0x83>
movsd  0xe68(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
setae  %al
mov    %al,-0x52(%rbp)
mov    -0x52(%rbp),%al
movzbl %al,%edi
and    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
mov    %edi,-0x64(%rbp)
call   1030 <assert@plt>
mov    -0x64(%rbp),%edi
call   1030 <assert@plt>
mov    -0x64(%rbp),%edi
call   1030 <assert@plt>
mov    -0x64(%rbp),%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    %ecx,%eax
mov    -0x1c(%rbp),%ecx
add    %ecx,%eax
mov    -0x20(%rbp),%ecx
add    %ecx,%eax
mov    -0x24(%rbp),%ecx
sub    %ecx,%eax
sete   %al
movzbl %al,%edi
call   1030 <assert@plt>
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x30(%rbp)
movsd  -0x30(%rbp),%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    %ecx,%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x1c(%rbp),%ecx
add    %ecx,%eax
cvtsi2sd %rax,%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x8(%rbp),%xmm1
movsd  0xdb7(%rip),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x60(%rbp)
movaps 0xdb7(%rip),%xmm1
movsd  -0x10(%rbp),%xmm0
pxor   %xmm1,%xmm0
mov    -0x24(%rbp),%eax
cvtsi2sd %rax,%xmm1
call   1040 <pow1pm1@plt>
movsd  -0x60(%rbp),%xmm1
cvtsi2sd %eax,%xmm0
mulsd  %xmm0,%xmm1
movsd  0xd84(%rip),%xmm0
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm0,%xmm0
movsd  -0x38(%rbp),%xmm1
mulsd  %xmm1,%xmm1
divsd  %xmm1,%xmm0
mov    -0x14(%rbp),%eax
cvtsi2sd %rax,%xmm2
movsd  -0x40(%rbp),%xmm3
mulsd  %xmm3,%xmm2
mov    -0x18(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  -0x48(%rbp),%xmm4
mulsd  %xmm4,%xmm1
mulsd  %xmm4,%xmm1
mulsd  %xmm3,%xmm2
addsd  %xmm1,%xmm2
mov    -0x1c(%rbp),%eax
cvtsi2sd %rax,%xmm1
movsd  -0x38(%rbp),%xmm3
mulsd  %xmm3,%xmm1
addsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mse_pfdr_deltaapprox>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
movsd  %xmm0,0x28(%rsp)
xorpd  %xmm2,%xmm2
ucomisd %xmm2,%xmm0
setae  %al
movsd  0xeb9(%rip),%xmm2
movsd  %xmm2,0x8(%rsp)
ucomisd %xmm0,%xmm2
mov    %r8d,%r12d
mov    %ecx,%ebp
mov    %edx,%r13d
mov    %esi,%r14d
mov    %edi,%r15d
movaps %xmm1,0x30(%rsp)
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
movapd 0x30(%rsp),%xmm1
ucomisd 0xe91(%rip),%xmm1
setae  %al
movsd  0xe76(%rip),%xmm0
ucomisd %xmm1,%xmm0
setae  %cl
and    %al,%cl
movzbl %cl,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
mov    $0x1,%edi
call   1030 <assert@plt>
lea    (%r14,%r15,1),%ebx
add    %ebx,%ebp
add    %r13d,%ebp
xor    %edi,%edi
cmp    %r12d,%ebp
sete   %dil
call   1030 <assert@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %rbx,%xmm0
mulsd  %xmm0,%xmm0
movsd  %xmm0,0x10(%rsp)
mov    %r14d,%eax
sub    %r13d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x20(%rsp)
lea    (%r15,%r13,1),%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
movsd  %xmm0,0x18(%rsp)
movaps 0x30(%rsp),%xmm2
xorps  0xe02(%rip),%xmm2
movsd  0x8(%rsp),%xmm0
subsd  0x28(%rsp),%xmm0
movsd  %xmm0,0x8(%rsp)
mov    %r12d,%eax
xorps  %xmm1,%xmm1
cvtsi2sd %rax,%xmm1
movaps %xmm2,%xmm0
call   1040 <pow1pm1@plt>
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
mulsd  0x8(%rsp),%xmm0
movsd  0xdb0(%rip),%xmm1
divsd  %xmm0,%xmm1
mulsd  %xmm1,%xmm1
movsd  0x10(%rsp),%xmm4
movapd %xmm4,%xmm0
mulsd  %xmm4,%xmm0
divsd  %xmm0,%xmm1
mov    %r15d,%eax
xorps  %xmm2,%xmm2
cvtsi2sd %rax,%xmm2
movsd  0x20(%rsp),%xmm0
mulsd  %xmm0,%xmm2
mov    %r14d,%eax
cvtsi2sd %rax,%xmm3
movsd  0x18(%rsp),%xmm5
mulsd  %xmm5,%xmm3
mulsd  %xmm5,%xmm3
mulsd  %xmm0,%xmm2
mov    %r13d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %rax,%xmm0
addsd  %xmm3,%xmm2
mulsd  %xmm4,%xmm0
addsd  %xmm2,%xmm0
mulsd  %xmm1,%xmm0
add    $0x48,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @mse_pfdr_deltaapprox(double %0, double %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca double
%9 = alloca double
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca double
%16 = alloca double
%17 = alloca double
%18 = alloca double
%19 = alloca double
store double %0, double* %8
store double %1, double* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%20 = load double, double* %8
%21 = fcmp oge double %20, 0.000000e+00
br i1 %21, label %22, label %25
22: ; preds = %7
%23 = load double, double* %8
%24 = fcmp ole double %23, 1.000000e+00
br label %25
25: ; preds = %22, %7
%26 = phi i1 [ false, %7 ], [ %24, %22 ]
%27 = zext i1 %26 to i32
%28 = call i32 @assert(i32 %27)
%29 = load double, double* %9
%30 = fcmp oge double %29, 0.000000e+00
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load double, double* %9
%33 = fcmp ole double %32, 1.000000e+00
br label %34
34: ; preds = %31, %25
%35 = phi i1 [ false, %25 ], [ %33, %31 ]
%36 = zext i1 %35 to i32
%37 = call i32 @assert(i32 %36)
%38 = load i32, i32* %10
%39 = icmp uge i32 %38, 0
%40 = zext i1 %39 to i32
%41 = call i32 @assert(i32 %40)
%42 = load i32, i32* %11
%43 = icmp uge i32 %42, 0
%44 = zext i1 %43 to i32
%45 = call i32 @assert(i32 %44)
%46 = load i32, i32* %12
%47 = icmp uge i32 %46, 0
%48 = zext i1 %47 to i32
%49 = call i32 @assert(i32 %48)
%50 = load i32, i32* %13
%51 = icmp uge i32 %50, 0
%52 = zext i1 %51 to i32
%53 = call i32 @assert(i32 %52)
%54 = load i32, i32* %10
%55 = load i32, i32* %11
%56 = add i32 %54, %55
%57 = load i32, i32* %12
%58 = add i32 %56, %57
%59 = load i32, i32* %13
%60 = add i32 %58, %59
%61 = load i32, i32* %14
%62 = icmp eq i32 %60, %61
%63 = zext i1 %62 to i32
%64 = call i32 @assert(i32 %63)
%65 = load i32, i32* %10
%66 = load i32, i32* %11
%67 = add i32 %65, %66
%68 = uitofp i32 %67 to double
store double %68, double* %15
%69 = load double, double* %15
%70 = load double, double* %15
%71 = fmul double %69, %70
store double %71, double* %16
%72 = load i32, i32* %11
%73 = load i32, i32* %12
%74 = sub i32 %72, %73
%75 = uitofp i32 %74 to double
store double %75, double* %17
%76 = load i32, i32* %10
%77 = load i32, i32* %12
%78 = add i32 %76, %77
%79 = uitofp i32 %78 to double
store double %79, double* %18
%80 = load double, double* %8
%81 = fsub double 1.000000e+00, %80
%82 = load double, double* %9
%83 = fneg double %82
%84 = load i32, i32* %14
%85 = uitofp i32 %84 to double
%86 = call i32 @pow1pm1(double %83, double %85)
%87 = sitofp i32 %86 to double
%88 = fmul double %81, %87
%89 = fdiv double -1.000000e+00, %88
store double %89, double* %19
%90 = load double, double* %19
%91 = load double, double* %19
%92 = fmul double %90, %91
%93 = load double, double* %16
%94 = load double, double* %16
%95 = fmul double %93, %94
%96 = fdiv double %92, %95
%97 = load i32, i32* %10
%98 = uitofp i32 %97 to double
%99 = load double, double* %17
%100 = fmul double %98, %99
%101 = load double, double* %17
%102 = load i32, i32* %11
%103 = uitofp i32 %102 to double
%104 = load double, double* %18
%105 = fmul double %103, %104
%106 = load double, double* %18
%107 = fmul double %105, %106
%108 = call double @llvm.fmuladd.f64(double %100, double %101, double %107)
%109 = load i32, i32* %12
%110 = uitofp i32 %109 to double
%111 = load double, double* %16
%112 = call double @llvm.fmuladd.f64(double %110, double %111, double %108)
%113 = fmul double %96, %112
ret double %113
}

LLVM IR (-O2):
define double @mse_pfdr_deltaapprox(double %0, double %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = fcmp oge double %0, 0.000000e+00
%9 = fcmp ole double %0, 1.000000e+00
%10 = and i1 %8, %9
%11 = zext i1 %10 to i32
%12 = tail call i32 @assert(i32 %11)
%13 = fcmp oge double %1, 0.000000e+00
%14 = fcmp ole double %1, 1.000000e+00
%15 = and i1 %13, %14
%16 = zext i1 %15 to i32
%17 = tail call i32 @assert(i32 %16)
%18 = tail call i32 @assert(i32 1)
%19 = tail call i32 @assert(i32 1)
%20 = tail call i32 @assert(i32 1)
%21 = tail call i32 @assert(i32 1)
%22 = add i32 %3, %2
%23 = add i32 %22, %4
%24 = add i32 %23, %5
%25 = icmp eq i32 %24, %6
%26 = zext i1 %25 to i32
%27 = tail call i32 @assert(i32 %26)
%28 = uitofp i32 %22 to double
%29 = fmul double %28, %28
%30 = sub i32 %3, %4
%31 = uitofp i32 %30 to double
%32 = add i32 %4, %2
%33 = uitofp i32 %32 to double
%34 = fsub double 1.000000e+00, %0
%35 = fneg double %1
%36 = uitofp i32 %6 to double
%37 = tail call i32 @pow1pm1(double %35, double %36)
%38 = sitofp i32 %37 to double
%39 = fmul double %34, %38
%40 = fdiv double -1.000000e+00, %39
%41 = fmul double %40, %40
%42 = fmul double %29, %29
%43 = fdiv double %41, %42
%44 = uitofp i32 %2 to double
%45 = fmul double %44, %31
%46 = uitofp i32 %3 to double
%47 = fmul double %46, %33
%48 = fmul double %47, %33
%49 = tail call double @llvm.fmuladd.f64(double %45, double %31, double %48)
%50 = uitofp i32 %4 to double
%51 = tail call double @llvm.fmuladd.f64(double %50, double %29, double %49)
%52 = fmul double %51, %43
ret double %52
}