#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 fact(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int n, r, i;
  printf("Enter n and r: ");
  scanf("%d %d", &n, &r);
  printf("%dC%d = %d\n", n, r, fact(n) / (fact(r) * fact(n - r)));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xec1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec3(%rip),%rdi
lea    -0x4(%rbp),%rsi
lea    -0x8(%rbp),%rdx
call   1050 <scanf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
sub    -0x8(%rbp),%edi
call   1040 <fact@plt>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%esi
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    -0x10(%rbp),%edx
mov    %eax,%ecx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec4(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%ebx
mov    (%rsp),%r14d
mov    %ebx,%edi
call   1040 <fact@plt>
mov    %eax,%r15d
mov    (%rsp),%edi
call   1040 <fact@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
sub    (%rsp),%edi
call   1040 <fact@plt>
mov    %eax,%ecx
imul   %ebp,%ecx
mov    %r15d,%eax
cltd
idiv   %ecx
lea    0xe83(%rip),%rdi
mov    %ebx,%esi
mov    %r14d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [16 x i8] c"Enter n and r: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [12 x i8] c"%dC%d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%6 = load i32, i32* %1
%7 = load i32, i32* %2
%8 = load i32, i32* %1
%9 = call i32 @fact(i32 %8)
%10 = load i32, i32* %2
%11 = call i32 @fact(i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = sub nsw i32 %12, %13
%15 = call i32 @fact(i32 %14)
%16 = mul nsw i32 %11, %15
%17 = sdiv i32 %9, %16
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [16 x i8] c"Enter n and r: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [12 x i8] c"%dC%d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i32 @fact(i32 %7)
%10 = load i32, i32* %2
%11 = call i32 @fact(i32 %10)
%12 = load i32, i32* %1
%13 = load i32, i32* %2
%14 = sub nsw i32 %12, %13
%15 = call i32 @fact(i32 %14)
%16 = mul nsw i32 %15, %11
%17 = sdiv i32 %9, %16
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %17)
ret i32 0
}