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


x86 assembly (clang, -O0):
<proba_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
fldt   0x10(%rbp)
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
fstpt  -0x20(%rbp)
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)
fmulp  %st,%st(1)
fstpt  -0x30(%rbp)
fldt   -0x30(%rbp)
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<proba_n>:
push   %rbp
push   %rbx
sub    $0x28,%rsp
mov    %esi,%ebp
mov    %edi,%ebx
fldt   0x40(%rsp)
fstpt  0x1c(%rsp)
mov    %esi,%edi
mov    %ebx,%esi
call   1040 <combination_eff@plt>
fnstcw 0x2(%rsp)
movzwl 0x2(%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x6(%rsp)
fldcw  0x6(%rsp)
fldt   0x1c(%rsp)
fistpl 0x8(%rsp)
fldcw  0x2(%rsp)
fstpt  0x10(%rsp)
mov    0x8(%rsp),%edi
mov    %ebp,%esi
call   1030 <powl@plt>
fldt   0x10(%rsp)
fmulp  %st,%st(1)
fstpt  0x10(%rsp)
fld1
fldt   0x1c(%rsp)
fsubrp %st,%st(1)
fnstcw (%rsp)
movzwl (%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x4(%rsp)
fldcw  0x4(%rsp)
fistpl 0xc(%rsp)
fldcw  (%rsp)
mov    0xc(%rsp),%edi
sub    %ebp,%ebx
mov    %ebx,%esi
call   1030 <powl@plt>
fldt   0x10(%rsp)
fmulp  %st,%st(1)
add    $0x28,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define x86_fp80 @proba_n(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
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = call x86_fp80 @combination_eff(i32 %8, i32 %9)
%11 = load x86_fp80, x86_fp80* %6
%12 = fptosi x86_fp80 %11 to i32
%13 = load i32, i32* %5
%14 = call x86_fp80 @powl(i32 %12, i32 %13)
%15 = fmul x86_fp80 %10, %14
%16 = load x86_fp80, x86_fp80* %6
%17 = fsub x86_fp80 0xK3FFF8000000000000000, %16
%18 = fptosi x86_fp80 %17 to i32
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = sub i32 %19, %20
%22 = call x86_fp80 @powl(i32 %18, i32 %21)
%23 = fmul x86_fp80 %15, %22
store x86_fp80 %23, x86_fp80* %7
%24 = load x86_fp80, x86_fp80* %7
ret x86_fp80 %24
}

LLVM IR (-O2):
define x86_fp80 @proba_n(i32 %0, i32 %1, x86_fp80 %2) {
%4 = tail call x86_fp80 @combination_eff(i32 %1, i32 %0)
%5 = fptosi x86_fp80 %2 to i32
%6 = tail call x86_fp80 @powl(i32 %5, i32 %1)
%7 = fmul x86_fp80 %4, %6
%8 = fsub x86_fp80 0xK3FFF8000000000000000, %2
%9 = fptosi x86_fp80 %8 to i32
%10 = sub i32 %0, %1
%11 = tail call x86_fp80 @powl(i32 %9, i32 %10)
%12 = fmul x86_fp80 %7, %11
ret x86_fp80 %12
}