#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 cephes_lgam(int);
double exp(double);
int log(double);
double Pr(int u, double eta) {
  int l;
  double sum, p;
  if (u == 0)
    p = exp(-eta);
  else {
    sum = 0.0;
    for (l = 1; l <= u; l++)
      sum += exp(-eta - u * log(2) + l * log(eta) - cephes_lgam(l + 1) +
                 cephes_lgam(u) - cephes_lgam(l) - cephes_lgam(u - l + 1));
    p = sum;
  }
  return p;
}


x86 assembly (clang, -O0):
<Pr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
mov    %edi,-0x4(%rbp)
movsd  %xmm0,-0x10(%rbp)
cmpl   $0x0,-0x4(%rbp)
jne    1175 <Pr+0x45>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1040 <exp@plt>
movsd  %xmm0,-0x28(%rbp)
jmp    1297 <Pr+0x167>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x20(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     128d <Pr+0x15d>
movsd  -0x10(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
movsd  %xmm0,-0x68(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x5c(%rbp)
movsd  0xe41(%rip),%xmm0
call   1050 <log@plt>
movsd  -0x68(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x5c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x58(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x4c(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1050 <log@plt>
movsd  -0x58(%rbp),%xmm0
mov    %eax,%ecx
mov    -0x4c(%rbp),%eax
imul   %ecx,%eax
cvtsi2sd %eax,%xmm1
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x48(%rbp)
mov    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <cephes_lgam@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
mov    -0x4(%rbp),%edi
call   1030 <cephes_lgam@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <cephes_lgam@plt>
movaps %xmm0,%xmm1
movsd  -0x38(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x14(%rbp),%edi
add    $0x1,%edi
call   1030 <cephes_lgam@plt>
movaps %xmm0,%xmm1
movsd  -0x30(%rbp),%xmm0
subsd  %xmm1,%xmm0
call   1040 <exp@plt>
addsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x20(%rbp)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1184 <Pr+0x54>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x28(%rbp)
movsd  -0x28(%rbp),%xmm0
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Pr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x38,%rsp
test   %edi,%edi
je     122d <Pr+0xfd>
jle    1243 <Pr+0x113>
mov    %edi,%r14d
movapd 0xead(%rip),%xmm1
xorpd  %xmm0,%xmm1
movapd %xmm1,0x20(%rsp)
mov    $0x1,%ebx
xorpd  %xmm1,%xmm1
mov    %edi,%ebp
movapd %xmm0,0x10(%rsp)
xchg   %ax,%ax
movsd  %xmm1,0x8(%rsp)
movsd  0xe92(%rip),%xmm0
call   1050 <log@plt>
imul   %r14d,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
movapd 0x20(%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
movaps 0x10(%rsp),%xmm0
call   1050 <log@plt>
imul   %ebx,%eax
xorps  %xmm0,%xmm0
cvtsi2sd %eax,%xmm0
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
lea    0x1(%rbx),%r15d
mov    %r15d,%edi
call   1030 <cephes_lgam@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %r14d,%edi
call   1030 <cephes_lgam@plt>
addsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    %ebx,%edi
call   1030 <cephes_lgam@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movsd  %xmm1,(%rsp)
mov    %ebp,%edi
call   1030 <cephes_lgam@plt>
movsd  (%rsp),%xmm1
subsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
call   1040 <exp@plt>
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
mov    %r15d,%ebx
add    $0xffffffff,%ebp
jne    1170 <Pr+0x40>
jmp    1247 <Pr+0x117>
xorps  0xdcc(%rip),%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <exp@plt>
xorpd  %xmm1,%xmm1
movapd %xmm1,%xmm0
add    $0x38,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define double @Pr(i32 %0, double %1) {
%3 = alloca i32
%4 = alloca double
%5 = alloca i32
%6 = alloca double
%7 = alloca double
store i32 %0, i32* %3
store double %1, double* %4
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load double, double* %4
%12 = fneg double %11
%13 = call double @exp(double %12)
store double %13, double* %7
br label %57
14: ; preds = %2
store double 0.000000e+00, double* %6
store i32 1, i32* %5
br label %15
15: ; preds = %52, %14
%16 = load i32, i32* %5
%17 = load i32, i32* %3
%18 = icmp sle i32 %16, %17
br i1 %18, label %19, label %55
19: ; preds = %15
%20 = load double, double* %4
%21 = fneg double %20
%22 = load i32, i32* %3
%23 = call i32 @log(double 2.000000e+00)
%24 = mul nsw i32 %22, %23
%25 = sitofp i32 %24 to double
%26 = fsub double %21, %25
%27 = load i32, i32* %5
%28 = load double, double* %4
%29 = call i32 @log(double %28)
%30 = mul nsw i32 %27, %29
%31 = sitofp i32 %30 to double
%32 = fadd double %26, %31
%33 = load i32, i32* %5
%34 = add nsw i32 %33, 1
%35 = call double @cephes_lgam(i32 %34)
%36 = fsub double %32, %35
%37 = load i32, i32* %3
%38 = call double @cephes_lgam(i32 %37)
%39 = fadd double %36, %38
%40 = load i32, i32* %5
%41 = call double @cephes_lgam(i32 %40)
%42 = fsub double %39, %41
%43 = load i32, i32* %3
%44 = load i32, i32* %5
%45 = sub nsw i32 %43, %44
%46 = add nsw i32 %45, 1
%47 = call double @cephes_lgam(i32 %46)
%48 = fsub double %42, %47
%49 = call double @exp(double %48)
%50 = load double, double* %6
%51 = fadd double %50, %49
store double %51, double* %6
br label %52
52: ; preds = %19
%53 = load i32, i32* %5
%54 = add nsw i32 %53, 1
store i32 %54, i32* %5
br label %15
55: ; preds = %15
%56 = load double, double* %6
store double %56, double* %7
br label %57
57: ; preds = %55, %10
%58 = load double, double* %7
ret double %58
}

LLVM IR (-O2):
define double @Pr(i32 %0, double %1) {
%3 = icmp eq i32 %0, 0
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = icmp slt i32 %0, 1
br i1 %5, label %36, label %6
6: ; preds = %4
%7 = fneg double %1
%8 = add nuw i32 %0, 1
br label %12
9: ; preds = %2
%10 = fneg double %1
%11 = tail call double @exp(double %10)
br label %36
12: ; preds = %6, %12
%13 = phi double [ 0.000000e+00, %6 ], [ %34, %12 ]
%14 = phi i32 [ 1, %6 ], [ %23, %12 ]
%15 = tail call i32 @log(double 2.000000e+00)
%16 = mul nsw i32 %15, %0
%17 = sitofp i32 %16 to double
%18 = fsub double %7, %17
%19 = tail call i32 @log(double %1)
%20 = mul nsw i32 %19, %14
%21 = sitofp i32 %20 to double
%22 = fadd double %18, %21
%23 = add nuw i32 %14, 1
%24 = tail call double @cephes_lgam(i32 %23)
%25 = fsub double %22, %24
%26 = tail call double @cephes_lgam(i32 %0)
%27 = fadd double %26, %25
%28 = tail call double @cephes_lgam(i32 %14)
%29 = fsub double %27, %28
%30 = sub i32 %8, %14
%31 = tail call double @cephes_lgam(i32 %30)
%32 = fsub double %29, %31
%33 = tail call double @exp(double %32)
%34 = fadd double %13, %33
%35 = icmp eq i32 %14, %0
br i1 %35, label %36, label %12
36: ; preds = %12, %4, %9
%37 = phi double [ %11, %9 ], [ 0.000000e+00, %4 ], [ %34, %12 ]
ret double %37
}