#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 dbico(int, int);
float fpower(float, int);
float binopdf(int n, int k, float p) {
  float q;
  double coef;
  float binop;
  float pk;
  int j;
  float qnk;
  if (p == 0) {
    binop = 0;
  } else {
    j = n - k;
    q = 1 - p;
    pk = fpower(p, k);
    qnk = fpower(q, j);
    coef = dbico(n, k);
    binop = coef * pk * qnk;
  }
  return binop;
}


x86 assembly (clang, -O0):
<binopdf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1157 <binopdf+0x37>
jp     1157 <binopdf+0x37>
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    11ce <binopdf+0xae>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
movss  0xe98(%rip),%xmm0
subss  -0xc(%rbp),%xmm0
movss  %xmm0,-0x10(%rbp)
movss  -0xc(%rbp),%xmm0
mov    -0x8(%rbp),%edi
call   1040 <fpower@plt>
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
mov    -0x24(%rbp),%edi
call   1040 <fpower@plt>
movss  %xmm0,-0x28(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <dbico@plt>
movsd  %xmm0,-0x18(%rbp)
movsd  -0x18(%rbp),%xmm0
movss  -0x20(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binopdf>:
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    112e <binopdf+0xe>
jp     112e <binopdf+0xe>
movaps %xmm1,%xmm0
ret
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %esi,%ebx
mov    %edi,%r14d
mov    %edi,%ebp
sub    %esi,%ebp
movss  0xeb9(%rip),%xmm1
subss  %xmm0,%xmm1
movss  %xmm1,0x8(%rsp)
mov    %esi,%edi
call   1040 <fpower@plt>
movss  %xmm0,0xc(%rsp)
movss  0x8(%rsp),%xmm0
mov    %ebp,%edi
call   1040 <fpower@plt>
movss  %xmm0,0x8(%rsp)
mov    %r14d,%edi
mov    %ebx,%esi
call   1030 <dbico@plt>
movss  0xc(%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
mulsd  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mulsd  %xmm1,%xmm0
xorps  %xmm1,%xmm1
cvtsd2ss %xmm0,%xmm1
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
movaps %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @binopdf(i32 %0, i32 %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca float
%8 = alloca double
%9 = alloca float
%10 = alloca float
%11 = alloca i32
%12 = alloca float
store i32 %0, i32* %4
store i32 %1, i32* %5
store float %2, float* %6
%13 = load float, float* %6
%14 = fcmp oeq float %13, 0.000000e+00
br i1 %14, label %15, label %16
15: ; preds = %3
store float 0.000000e+00, float* %9
br label %39
16: ; preds = %3
%17 = load i32, i32* %4
%18 = load i32, i32* %5
%19 = sub nsw i32 %17, %18
store i32 %19, i32* %11
%20 = load float, float* %6
%21 = fsub float 1.000000e+00, %20
store float %21, float* %7
%22 = load float, float* %6
%23 = load i32, i32* %5
%24 = call float @fpower(float %22, i32 %23)
store float %24, float* %10
%25 = load float, float* %7
%26 = load i32, i32* %11
%27 = call float @fpower(float %25, i32 %26)
store float %27, float* %12
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = call double @dbico(i32 %28, i32 %29)
store double %30, double* %8
%31 = load double, double* %8
%32 = load float, float* %10
%33 = fpext float %32 to double
%34 = fmul double %31, %33
%35 = load float, float* %12
%36 = fpext float %35 to double
%37 = fmul double %34, %36
%38 = fptrunc double %37 to float
store float %38, float* %9
br label %39
39: ; preds = %16, %15
%40 = load float, float* %9
ret float %40
}

LLVM IR (-O2):
define float @binopdf(i32 %0, i32 %1, float %2) {
%4 = fcmp oeq float %2, 0.000000e+00
br i1 %4, label %16, label %5
5: ; preds = %3
%6 = sub nsw i32 %0, %1
%7 = fsub float 1.000000e+00, %2
%8 = tail call float @fpower(float %2, i32 %1)
%9 = tail call float @fpower(float %7, i32 %6)
%10 = tail call double @dbico(i32 %0, i32 %1)
%11 = fpext float %8 to double
%12 = fmul double %10, %11
%13 = fpext float %9 to double
%14 = fmul double %12, %13
%15 = fptrunc double %14 to float
br label %16
16: ; preds = %3, %5
%17 = phi float [ %15, %5 ], [ 0.000000e+00, %3 ]
ret float %17
}