#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 */
int /*<<< orphan*/ assert(int);
long long computeBinomCoef(const int n, const int k) {
  assert(0 <= k && k <= n);
  if (k == 0 || n == k) {
    return 1LL;
  }
  return computeBinomCoef(n - 1, k - 1) + computeBinomCoef(n - 1, k);
}


x86 assembly (clang, -O0):
<computeBinomCoef>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0xc(%rbp)
mov    %esi,-0x10(%rbp)
xor    %eax,%eax
xor    %ecx,%ecx
cmp    -0x10(%rbp),%ecx
mov    %al,-0x11(%rbp)
jg     114a <computeBinomCoef+0x2a>
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
setle  %al
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
cmpl   $0x0,-0x10(%rbp)
je     116d <computeBinomCoef+0x4d>
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    117a <computeBinomCoef+0x5a>
movq   $0x1,-0x8(%rbp)
jmp    11ab <computeBinomCoef+0x8b>
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
sub    $0x1,%esi
call   1030 <computeBinomCoef@plt>
mov    %rax,-0x20(%rbp)
mov    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x10(%rbp),%esi
call   1030 <computeBinomCoef@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<computeBinomCoef>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %edi,%r15d
test   %esi,%esi
setns  %al
cmp    %edi,%esi
setle  %cl
and    %al,%cl
movzbl %cl,%edi
call   1040 <assert@plt>
mov    $0x1,%ebx
test   %r14d,%r14d
je     1195 <computeBinomCoef+0x75>
cmp    %r14d,%r15d
je     1195 <computeBinomCoef+0x75>
lea    -0x1(%r14),%r12d
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
test   %r14d,%r14d
setns  %r13b
lea    -0x1(%r15),%ebp
mov    %ebp,%edi
mov    %r12d,%esi
call   1030 <computeBinomCoef@plt>
add    %rax,%rbx
cmp    %r14d,%r15d
setg   %al
and    %r13b,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    %ebp,%r15d
cmp    %ebp,%r14d
jne    1160 <computeBinomCoef+0x40>
add    $0x1,%rbx
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i64 @computeBinomCoef(i32 %0, i32 %1) {
%3 = alloca i64
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %5
%7 = icmp sle i32 0, %6
br i1 %7, label %8, label %12
8: ; preds = %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp sle i32 %9, %10
br label %12
12: ; preds = %8, %2
%13 = phi i1 [ false, %2 ], [ %11, %8 ]
%14 = zext i1 %13 to i32
%15 = call i32 @assert(i32 %14)
%16 = load i32, i32* %5
%17 = icmp eq i32 %16, 0
br i1 %17, label %22, label %18
18: ; preds = %12
%19 = load i32, i32* %4
%20 = load i32, i32* %5
%21 = icmp eq i32 %19, %20
br i1 %21, label %22, label %23
22: ; preds = %18, %12
store i64 1, i64* %3
br label %34
23: ; preds = %18
%24 = load i32, i32* %4
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %5
%27 = sub nsw i32 %26, 1
%28 = call i64 @computeBinomCoef(i32 %25, i32 %27)
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 1
%31 = load i32, i32* %5
%32 = call i64 @computeBinomCoef(i32 %30, i32 %31)
%33 = add nsw i64 %28, %32
store i64 %33, i64* %3
br label %34
34: ; preds = %23, %22
%35 = load i64, i64* %3
ret i64 %35
}

LLVM IR (-O2):
define i64 @computeBinomCoef(i32 %0, i32 %1) {
%3 = icmp sgt i32 %1, -1
%4 = icmp sle i32 %1, %0
%5 = and i1 %3, %4
%6 = zext i1 %5 to i32
%7 = tail call i32 @assert(i32 %6)
%8 = icmp eq i32 %1, 0
%9 = icmp eq i32 %0, %1
%10 = or i1 %8, %9
br i1 %10, label %26, label %11
11: ; preds = %2
%12 = add nsw i32 %1, -1
br label %13
13: ; preds = %11, %13
%14 = phi i32 [ %0, %11 ], [ %16, %13 ]
%15 = phi i64 [ 0, %11 ], [ %18, %13 ]
%16 = add nsw i32 %14, -1
%17 = tail call i64 @computeBinomCoef(i32 %16, i32 %12)
%18 = add nsw i64 %17, %15
%19 = icmp sgt i32 %14, %1
%20 = and i1 %3, %19
%21 = zext i1 %20 to i32
%22 = tail call i32 @assert(i32 %21)
%23 = icmp eq i32 %16, %1
br i1 %23, label %24, label %13
24: ; preds = %13
%25 = add i64 %18, 1
br label %26
26: ; preds = %24, %2
%27 = phi i64 [ 1, %2 ], [ %25, %24 ]
ret i64 %27
}