#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 binomial(int, int);
double pow(double, int);
double binomial_prefactor(int s, int ia, int ib, double xpa, double xpb) {
  int t;
  double sum = 0.;
  for (t = 0; t < s + 1; t++)
    if ((s - ia <= t) && (t <= ib))
      sum += binomial(ia, s - t) * binomial(ib, t) * pow(xpa, ia - s + t) *
             pow(xpb, ib - t);
  return sum;
}


x86 assembly (clang, -O0):
<binomial_prefactor>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
movsd  %xmm0,-0x18(%rbp)
movsd  %xmm1,-0x20(%rbp)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x30(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x4(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1206 <binomial_prefactor+0xe6>
mov    -0x4(%rbp),%eax
sub    -0x8(%rbp),%eax
cmp    -0x24(%rbp),%eax
jg     11f3 <binomial_prefactor+0xd3>
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jg     11f3 <binomial_prefactor+0xd3>
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
sub    -0x24(%rbp),%esi
call   1030 <binomial@plt>
movsd  %xmm0,-0x48(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x24(%rbp),%esi
call   1030 <binomial@plt>
movaps %xmm0,%xmm1
movsd  -0x48(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x40(%rbp)
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%edi
sub    -0x4(%rbp),%edi
add    -0x24(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x40(%rbp),%xmm0
mulsd  %xmm1,%xmm0
movsd  %xmm0,-0x38(%rbp)
movsd  -0x20(%rbp),%xmm0
mov    -0xc(%rbp),%edi
sub    -0x24(%rbp),%edi
call   1040 <pow@plt>
movaps %xmm0,%xmm2
movsd  -0x38(%rbp),%xmm0
movsd  -0x30(%rbp),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
movsd  %xmm0,-0x30(%rbp)
jmp    11f8 <binomial_prefactor+0xd8>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    114a <binomial_prefactor+0x2a>
movsd  -0x30(%rbp),%xmm0
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<binomial_prefactor>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
movsd  %xmm1,0x20(%rsp)
movsd  %xmm0,0x18(%rsp)
test   %edi,%edi
js     11fe <binomial_prefactor+0xde>
mov    %edx,%r15d
mov    %esi,%r14d
mov    %edi,%r12d
mov    %edi,%r13d
sub    %esi,%r13d
mov    %esi,%eax
sub    %edi,%eax
mov    %rax,0x10(%rsp)
xor    %ebx,%ebx
xorpd  %xmm0,%xmm0
mov    %edx,%ebp
jmp    1180 <binomial_prefactor+0x60>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
add    $0xffffffff,%ebp
add    $0xffffffff,%r12d
jae    1202 <binomial_prefactor+0xe2>
cmp    %ebx,%r13d
jg     1170 <binomial_prefactor+0x50>
cmp    %r15d,%ebx
jg     1170 <binomial_prefactor+0x50>
mov    %r14d,%edi
mov    %r12d,%esi
movsd  %xmm0,0x8(%rsp)
call   1030 <binomial@plt>
movsd  %xmm0,(%rsp)
mov    %r15d,%edi
mov    %ebx,%esi
call   1030 <binomial@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
mov    0x10(%rsp),%rax
lea    (%rax,%rbx,1),%edi
movsd  0x18(%rsp),%xmm0
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  %xmm0,(%rsp)
movsd  0x20(%rsp),%xmm0
mov    %ebp,%edi
call   1040 <pow@plt>
mulsd  (%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
addsd  %xmm0,%xmm1
movsd  %xmm1,0x8(%rsp)
movsd  0x8(%rsp),%xmm0
jmp    1170 <binomial_prefactor+0x50>
xorpd  %xmm0,%xmm0
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define double @binomial_prefactor(i32 %0, i32 %1, i32 %2, double %3, double %4) {
%6 = icmp slt i32 %0, 0
br i1 %6, label %31, label %7
7: ; preds = %5
%8 = sub nsw i32 %0, %1
%9 = sub i32 %1, %0
br label %10
10: ; preds = %7, %27
%11 = phi double [ 0.000000e+00, %7 ], [ %28, %27 ]
%12 = phi i32 [ 0, %7 ], [ %29, %27 ]
%13 = icmp sgt i32 %8, %12
%14 = icmp sgt i32 %12, %2
%15 = or i1 %13, %14
br i1 %15, label %27, label %16
16: ; preds = %10
%17 = sub nsw i32 %0, %12
%18 = tail call double @binomial(i32 %1, i32 %17)
%19 = tail call double @binomial(i32 %2, i32 %12)
%20 = fmul double %18, %19
%21 = add nsw i32 %9, %12
%22 = tail call double @pow(double %3, i32 %21)
%23 = fmul double %20, %22
%24 = sub nsw i32 %2, %12
%25 = tail call double @pow(double %4, i32 %24)
%26 = tail call double @llvm.fmuladd.f64(double %23, double %25, double %11)
br label %27
27: ; preds = %10, %16
%28 = phi double [ %26, %16 ], [ %11, %10 ]
%29 = add nuw i32 %12, 1
%30 = icmp eq i32 %12, %0
br i1 %30, label %31, label %10
31: ; preds = %27, %5
%32 = phi double [ 0.000000e+00, %5 ], [ %28, %27 ]
ret double %32
}