#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 factorial(int);
int /*<<< orphan*/ printf(char *, int, int, double);
double C(int a, int b) {
  double c;
  if (a >= 0 && b >= 0)
    c = factorial(a) / (factorial(a - b) * factorial(b));
  else
    c = 0;
  printf("%dC%d = %g\n", a, b, c);
  return c;
}


x86 assembly (clang, -O0):
<C>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
cmpl   $0x0,-0x4(%rbp)
jl     1186 <C+0x66>
cmpl   $0x0,-0x8(%rbp)
jl     1186 <C+0x66>
mov    -0x4(%rbp),%edi
call   1030 <factorial@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1030 <factorial@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <factorial@plt>
movsd  -0x20(%rbp),%xmm1
movaps %xmm0,%xmm2
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm2,%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x10(%rbp)
jmp    118e <C+0x6e>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
movsd  -0x10(%rbp),%xmm0
lea    0xe60(%rip),%rdi
call   1040 <printf@plt>
movsd  -0x10(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<C>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %esi,%ebx
mov    %edi,%ebp
mov    %esi,%eax
or     %edi,%eax
js     1169 <C+0x49>
mov    %ebp,%edi
call   1030 <factorial@plt>
movsd  %xmm0,0x8(%rsp)
mov    %ebp,%edi
sub    %ebx,%edi
call   1030 <factorial@plt>
movsd  %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1030 <factorial@plt>
mulsd  0x10(%rsp),%xmm0
movsd  0x8(%rsp),%xmm1
divsd  %xmm0,%xmm1
movapd %xmm1,%xmm0
jmp    116d <C+0x4d>
xorpd  %xmm0,%xmm0
lea    0xe8c(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
movsd  %xmm0,0x8(%rsp)
call   1040 <printf@plt>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"%dC%d = %g\0A\00"
define double @C(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca double
store i32 %0, i32* %3
store i32 %1, i32* %4
%6 = load i32, i32* %3
%7 = icmp sge i32 %6, 0
br i1 %7, label %8, label %22
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %22
11: ; preds = %8
%12 = load i32, i32* %3
%13 = call double @factorial(i32 %12)
%14 = load i32, i32* %3
%15 = load i32, i32* %4
%16 = sub nsw i32 %14, %15
%17 = call double @factorial(i32 %16)
%18 = load i32, i32* %4
%19 = call double @factorial(i32 %18)
%20 = fmul double %17, %19
%21 = fdiv double %13, %20
store double %21, double* %5
br label %23
22: ; preds = %8, %2
store double 0.000000e+00, double* %5
br label %23
23: ; preds = %22, %11
%24 = load i32, i32* %3
%25 = load i32, i32* %4
%26 = load double, double* %5
%27 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %24, i32 %25, double %26)
%28 = load double, double* %5
ret double %28
}

LLVM IR (-O2):
@.str = [12 x i8] c"%dC%d = %g\0A\00"
define double @C(i32 %0, i32 %1) {
%3 = or i32 %1, %0
%4 = icmp sgt i32 %3, -1
br i1 %4, label %5, label %12
5: ; preds = %2
%6 = tail call double @factorial(i32 %0)
%7 = sub nsw i32 %0, %1
%8 = tail call double @factorial(i32 %7)
%9 = tail call double @factorial(i32 %1)
%10 = fmul double %8, %9
%11 = fdiv double %6, %10
br label %12
12: ; preds = %2, %5
%13 = phi double [ %11, %5 ], [ 0.000000e+00, %2 ]
%14 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, double %13)
ret double %13
}