#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 */
long double combination_eff(int, int);
long double powl(int, int);
long double proba_more_than(int n, int k, long double proba) {
  long double result = 0.0;
  while (k <= n) {
    result +=
        combination_eff(k, n) * powl(proba, k) * powl((1 - proba), (n - k));
    k++;
  }
  return result;
}


x86 assembly (clang, -O0):
<proba_more_than>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x10(%rbp)
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
fstpt  -0x20(%rbp)
fldz
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     11cf <proba_more_than+0xaf>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <combination_eff@plt>
fstpt  -0x58(%rbp)
fldt   -0x20(%rbp)
fnstcw -0x3a(%rbp)
movzwl -0x3a(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x3c(%rbp)
fldcw  -0x3c(%rbp)
fistpl -0x38(%rbp)
fldcw  -0x3a(%rbp)
mov    -0x38(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <powl@plt>
fldt   -0x58(%rbp)
fmulp  %st,%st(1)
fstpt  -0x4c(%rbp)
fldt   -0x20(%rbp)
fld1
fsubp  %st,%st(1)
fnstcw -0x3e(%rbp)
movzwl -0x3e(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x40(%rbp)
fldcw  -0x40(%rbp)
fistpl -0x34(%rbp)
fldcw  -0x3e(%rbp)
mov    -0x34(%rbp),%edi
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%eax
sub    %eax,%esi
call   1030 <powl@plt>
fldt   -0x4c(%rbp)
fldt   -0x30(%rbp)
fxch   %st(1)
fmulp  %st,%st(2)
faddp  %st,%st(1)
fstpt  -0x30(%rbp)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1139 <proba_more_than+0x19>
fldt   -0x30(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proba_more_than>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x30,%rsp
fldt   0x60(%rsp)
fldz
cmp    %edi,%esi
jg     11ea <proba_more_than+0xca>
mov    %esi,%ebx
mov    %edi,%r14d
fstp   %st(0)
fnstcw 0xa(%rsp)
movzwl 0xa(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0xe(%rsp)
fldcw  0xe(%rsp)
fistl  0x10(%rsp)
fldcw  0xa(%rsp)
mov    0x10(%rsp),%r15d
fld1
fsubp  %st,%st(1)
fnstcw 0x8(%rsp)
movzwl 0x8(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0xc(%rsp)
fldcw  0xc(%rsp)
fistpl 0x14(%rsp)
fldcw  0x8(%rsp)
mov    0x14(%rsp),%r12d
mov    %edi,%ebp
sub    %esi,%ebp
fldz
fldz
fxch   %st(1)
nopw   0x0(%rax,%rax,1)
fstp   %st(1)
fstpt  0x24(%rsp)
mov    %ebx,%edi
mov    %r14d,%esi
call   1040 <combination_eff@plt>
fstpt  0x18(%rsp)
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <powl@plt>
fldt   0x18(%rsp)
fmulp  %st,%st(1)
fstpt  0x18(%rsp)
mov    %r12d,%edi
mov    %ebp,%esi
call   1030 <powl@plt>
fldt   0x24(%rsp)
fldt   0x18(%rsp)
fmulp  %st,%st(2)
faddp  %st,%st(1)
add    $0x1,%ebx
add    $0xffffffff,%ebp
fldz
fxch   %st(1)
jb     11a0 <proba_more_than+0x80>
fstp   %st(1)
add    $0x30,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @proba_more_than(i32 %0, i32 %1, x86_fp80 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca x86_fp80
%7 = alloca x86_fp80
store i32 %0, i32* %4
store i32 %1, i32* %5
store x86_fp80 %2, x86_fp80* %6
store x86_fp80 0xK00000000000000000000, x86_fp80* %7
br label %8
8: ; preds = %12, %3
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load i32, i32* %5
%14 = load i32, i32* %4
%15 = call x86_fp80 @combination_eff(i32 %13, i32 %14)
%16 = load x86_fp80, x86_fp80* %6
%17 = fptosi x86_fp80 %16 to i32
%18 = load i32, i32* %5
%19 = call x86_fp80 @powl(i32 %17, i32 %18)
%20 = fmul x86_fp80 %15, %19
%21 = load x86_fp80, x86_fp80* %6
%22 = fsub x86_fp80 0xK3FFF8000000000000000, %21
%23 = fptosi x86_fp80 %22 to i32
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = sub nsw i32 %24, %25
%27 = call x86_fp80 @powl(i32 %23, i32 %26)
%28 = load x86_fp80, x86_fp80* %7
%29 = call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %20, x86_fp80 %27, x86_fp80 %28)
store x86_fp80 %29, x86_fp80* %7
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 1
store i32 %31, i32* %5
br label %8
32: ; preds = %8
%33 = load x86_fp80, x86_fp80* %7
ret x86_fp80 %33
}

LLVM IR (-O2):
define x86_fp80 @proba_more_than(i32 %0, i32 %1, x86_fp80 %2) {
%4 = icmp sgt i32 %1, %0
br i1 %4, label %20, label %5
5: ; preds = %3
%6 = fptosi x86_fp80 %2 to i32
%7 = fsub x86_fp80 0xK3FFF8000000000000000, %2
%8 = fptosi x86_fp80 %7 to i32
br label %9
9: ; preds = %5, %9
%10 = phi x86_fp80 [ 0xK00000000000000000000, %5 ], [ %17, %9 ]
%11 = phi i32 [ %1, %5 ], [ %18, %9 ]
%12 = tail call x86_fp80 @combination_eff(i32 %11, i32 %0)
%13 = tail call x86_fp80 @powl(i32 %6, i32 %11)
%14 = fmul x86_fp80 %12, %13
%15 = sub nsw i32 %0, %11
%16 = tail call x86_fp80 @powl(i32 %8, i32 %15)
%17 = tail call x86_fp80 @llvm.fmuladd.f80(x86_fp80 %14, x86_fp80 %16, x86_fp80 %10)
%18 = add i32 %11, 1
%19 = icmp eq i32 %11, %0
br i1 %19, label %20, label %9
20: ; preds = %9, %3
%21 = phi x86_fp80 [ 0xK00000000000000000000, %3 ], [ %17, %9 ]
ret x86_fp80 %21
}