#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 M_PI;
int /*<<< orphan*/ cos(double);
double exp(double);
double fmin(double, double);
double pow(int /*<<< orphan*/, double);
double sqrt(int);
double err_bound(int N, double K, double d, double alpha, double beta) {
  double mu = fmin(alpha, beta);
  double pdm = sqrt(M_PI * d * mu);
  double sqn = sqrt(N);
  double val = 1.0;
  val += 2.0 / (pdm * (1 - exp(-2 * pdm)) * pow(cos(d), (alpha + beta) * 0.5));
  val *= 2.0 * K / pdm;
  return val * sqn * exp(-pdm * sqn);
}


x86 assembly (clang, -O0):
<err_bound>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  %xmm3,-0x28(%rbp)
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm2
movaps %xmm2,%xmm4
movaps %xmm3,%xmm0
cmpunordsd %xmm0,%xmm0
movaps %xmm0,%xmm1
pand   %xmm4,%xmm1
minsd  %xmm3,%xmm2
pandn  %xmm2,%xmm0
por    %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    0x2e55(%rip),%rax
movsd  (%rax),%xmm0
mulsd  -0x18(%rbp),%xmm0
mulsd  -0x30(%rbp),%xmm0
cvttsd2si %xmm0,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x38(%rbp)
mov    -0x4(%rbp),%edi
call   1060 <sqrt@plt>
movsd  %xmm0,-0x40(%rbp)
movsd  0xe4c(%rip),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x38(%rbp),%xmm0
movsd  %xmm0,-0x60(%rbp)
movsd  0xe3d(%rip),%xmm0
mulsd  -0x38(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm2
movsd  -0x60(%rbp),%xmm0
movsd  0xe1b(%rip),%xmm1
subsd  %xmm2,%xmm1
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
movsd  -0x18(%rbp),%xmm0
call   1040 <cos@plt>
mov    %eax,%edi
movsd  -0x20(%rbp),%xmm0
addsd  -0x28(%rbp),%xmm0
movsd  0xde8(%rip),%xmm1
mulsd  %xmm1,%xmm0
call   1050 <pow@plt>
movsd  -0x58(%rbp),%xmm1
mulsd  %xmm0,%xmm1
movsd  0xdc6(%rip),%xmm0
divsd  %xmm1,%xmm0
addsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  0xdb0(%rip),%xmm0
mulsd  -0x10(%rbp),%xmm0
divsd  -0x38(%rbp),%xmm0
mulsd  -0x48(%rbp),%xmm0
movsd  %xmm0,-0x48(%rbp)
movsd  -0x48(%rbp),%xmm0
mulsd  -0x40(%rbp),%xmm0
movsd  %xmm0,-0x50(%rbp)
movsd  -0x38(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
mulsd  -0x40(%rbp),%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x50(%rbp),%xmm0
mulsd  %xmm1,%xmm0
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<err_bound>:
push   %rbx
sub    $0x50,%rsp
movapd %xmm3,0x40(%rsp)
movsd  %xmm2,0x30(%rsp)
movsd  %xmm1,0x28(%rsp)
movaps %xmm0,(%rsp)
mov    %edi,%ebx
movapd %xmm2,%xmm0
cmpunordsd %xmm2,%xmm0
movapd %xmm0,%xmm5
andpd  %xmm3,%xmm5
movapd %xmm3,%xmm4
minsd  %xmm2,%xmm4
andnpd %xmm4,%xmm0
orpd   %xmm5,%xmm0
mov    0x2e63(%rip),%rax
movsd  (%rax),%xmm2
mulsd  %xmm1,%xmm2
mulsd  %xmm0,%xmm2
cvttsd2si %xmm2,%edi
call   1060 <sqrt@plt>
movapd %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1060 <sqrt@plt>
movsd  %xmm0,0x38(%rsp)
movsd  0xe4b(%rip),%xmm0
mulsd  0x10(%rsp),%xmm0
call   1030 <exp@plt>
movsd  0xe40(%rip),%xmm1
subsd  %xmm0,%xmm1
mulsd  0x10(%rsp),%xmm1
movsd  %xmm1,0x20(%rsp)
movsd  0x28(%rsp),%xmm0
call   1040 <cos@plt>
movsd  0x30(%rsp),%xmm0
addsd  0x40(%rsp),%xmm0
mulsd  0xe19(%rip),%xmm0
mov    %eax,%edi
call   1050 <pow@plt>
mulsd  0x20(%rsp),%xmm0
movapd (%rsp),%xmm2
addsd  %xmm2,%xmm2
shufpd $0x2,0xe0a(%rip),%xmm2
movapd 0x10(%rsp),%xmm3
movapd %xmm3,%xmm1
unpcklpd %xmm0,%xmm1
divpd  %xmm1,%xmm2
movapd %xmm2,%xmm0
unpckhpd %xmm2,%xmm0
addsd  0xdd0(%rip),%xmm0
mulsd  %xmm2,%xmm0
movsd  0x38(%rsp),%xmm1
mulsd  %xmm1,%xmm0
movapd %xmm0,(%rsp)
movapd %xmm3,%xmm0
xorpd  0xdd9(%rip),%xmm0
mulsd  %xmm1,%xmm0
call   1030 <exp@plt>
mulsd  (%rsp),%xmm0
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@M_PI = global double 0.000000e+00
define double @err_bound(i32 %0, double %1, double %2, double %3, double %4) {
%6 = alloca i32
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
%13 = alloca double
%14 = alloca double
store i32 %0, i32* %6
store double %1, double* %7
store double %2, double* %8
store double %3, double* %9
store double %4, double* %10
%15 = load double, double* %9
%16 = load double, double* %10
%17 = call double @llvm.minnum.f64(double %15, double %16)
store double %17, double* %11
%18 = load double, double* @M_PI
%19 = load double, double* %8
%20 = fmul double %18, %19
%21 = load double, double* %11
%22 = fmul double %20, %21
%23 = fptosi double %22 to i32
%24 = call double @sqrt(i32 %23)
store double %24, double* %12
%25 = load i32, i32* %6
%26 = call double @sqrt(i32 %25)
store double %26, double* %13
store double 1.000000e+00, double* %14
%27 = load double, double* %12
%28 = load double, double* %12
%29 = fmul double -2.000000e+00, %28
%30 = call double @exp(double %29)
%31 = fsub double 1.000000e+00, %30
%32 = fmul double %27, %31
%33 = load double, double* %8
%34 = call i32 @cos(double %33)
%35 = load double, double* %9
%36 = load double, double* %10
%37 = fadd double %35, %36
%38 = fmul double %37, 5.000000e-01
%39 = call double @pow(i32 %34, double %38)
%40 = fmul double %32, %39
%41 = fdiv double 2.000000e+00, %40
%42 = load double, double* %14
%43 = fadd double %42, %41
store double %43, double* %14
%44 = load double, double* %7
%45 = fmul double 2.000000e+00, %44
%46 = load double, double* %12
%47 = fdiv double %45, %46
%48 = load double, double* %14
%49 = fmul double %48, %47
store double %49, double* %14
%50 = load double, double* %14
%51 = load double, double* %13
%52 = fmul double %50, %51
%53 = load double, double* %12
%54 = fneg double %53
%55 = load double, double* %13
%56 = fmul double %54, %55
%57 = call double @exp(double %56)
%58 = fmul double %52, %57
ret double %58
}

LLVM IR (-O2):
@M_PI = global double 0.000000e+00
define double @err_bound(i32 %0, double %1, double %2, double %3, double %4) {
%6 = tail call double @llvm.minnum.f64(double %3, double %4)
%7 = load double, double* @M_PI
%8 = fmul double %7, %2
%9 = fmul double %6, %8
%10 = fptosi double %9 to i32
%11 = tail call double @sqrt(i32 %10)
%12 = tail call double @sqrt(i32 %0)
%13 = fmul double %11, -2.000000e+00
%14 = tail call double @exp(double %13)
%15 = fsub double 1.000000e+00, %14
%16 = fmul double %11, %15
%17 = tail call i32 @cos(double %2)
%18 = fadd double %3, %4
%19 = fmul double %18, 5.000000e-01
%20 = tail call double @pow(i32 %17, double %19)
%21 = fmul double %16, %20
%22 = fmul double %1, 2.000000e+00
%23 = insertelement <2 x double> <double poison, double 2.000000e+00>, double %22, i64 0
%24 = insertelement <2 x double> poison, double %11, i64 0
%25 = insertelement <2 x double> %24, double %21, i64 1
%26 = fdiv <2 x double> %23, %25
%27 = extractelement <2 x double> %26, i64 1
%28 = fadd double %27, 1.000000e+00
%29 = extractelement <2 x double> %26, i64 0
%30 = fmul double %29, %28
%31 = fmul double %12, %30
%32 = fneg double %11
%33 = fmul double %12, %32
%34 = tail call double @exp(double %33)
%35 = fmul double %34, %31
ret double %35
}