#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*/ exit(int /*<<< orphan*/);
int fnFactorial(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int iN, iR, iNCR;
  printf("\nEnter the value of n\n");
  scanf("%d", &iN);
  printf("\nEnter the value of r\n");
  scanf("%d", &iR);
  if (iN < iR) {
    printf("\nnCr does not exist\n");
    exit(0);
  }
  iNCR = (fnFactorial(iN) / (fnFactorial(iR) * fnFactorial(iN - iR)));
  printf("\nFor n = %d and r = %d, %dC%d = %d\n", iN, iR, iN, iR, iNCR);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeb3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe95(%rip),%rdi
lea    -0xc(%rbp),%rsi
call   1050 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ac <main+0x6c>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %edi,%edi
call   1060 <exit@plt>
mov    -0x8(%rbp),%edi
call   1040 <fnFactorial@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <fnFactorial@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
sub    -0xc(%rbp),%edi
call   1040 <fnFactorial@plt>
mov    -0x18(%rbp),%ecx
mov    %eax,%edx
mov    -0x14(%rbp),%eax
imul   %edx,%ecx
cltd
idiv   %ecx
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x10(%rbp),%r9d
lea    0xe50(%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   %rbx
push   %rax
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9a(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
lea    0xec3(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1060 <scanf@plt>
mov    0x4(%rsp),%edi
cmp    (%rsp),%edi
jl     11e0 <main+0x90>
call   1050 <fnFactorial@plt>
mov    %eax,%ebx
mov    (%rsp),%edi
call   1050 <fnFactorial@plt>
mov    %eax,%ebp
mov    0x4(%rsp),%edi
sub    (%rsp),%edi
call   1050 <fnFactorial@plt>
mov    %eax,%ecx
imul   %ebp,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    0x4(%rsp),%ecx
mov    (%rsp),%edx
lea    0xe3b(%rip),%rdi
mov    %ecx,%esi
mov    %edx,%r8d
mov    %eax,%r9d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe6c(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [23 x i8] c"\0AEnter the value of n\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [23 x i8] c"\0AEnter the value of r\0A\00"
@.str.3 = [21 x i8] c"\0AnCr does not exist\0A\00"
@.str.4 = [36 x i8] c"\0AFor n = %d and r = %d, %dC%d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %0
%16 = load i32, i32* %2
%17 = call i32 @fnFactorial(i32 %16)
%18 = load i32, i32* %3
%19 = call i32 @fnFactorial(i32 %18)
%20 = load i32, i32* %2
%21 = load i32, i32* %3
%22 = sub nsw i32 %20, %21
%23 = call i32 @fnFactorial(i32 %22)
%24 = mul nsw i32 %19, %23
%25 = sdiv i32 %17, %24
store i32 %25, i32* %4
%26 = load i32, i32* %2
%27 = load i32, i32* %3
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %26, i32 %27, i32 %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.4 = [36 x i8] c"\0AFor n = %d and r = %d, %dC%d = %d\0A\00"
@str = [22 x i8] c"\0AEnter the value of n\00"
@str.5 = [22 x i8] c"\0AEnter the value of r\00"
@str.6 = [20 x i8] c"\0AnCr does not exist\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 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.5, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = load i32, i32* %1
%10 = load i32, i32* %2
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %15
12: ; preds = %0
%13 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.6, i64 0, i64 0))
%14 = call i32 @exit(i32 0)
unreachable
15: ; preds = %0
%16 = call i32 @fnFactorial(i32 %9)
%17 = load i32, i32* %2
%18 = call i32 @fnFactorial(i32 %17)
%19 = load i32, i32* %1
%20 = load i32, i32* %2
%21 = sub nsw i32 %19, %20
%22 = call i32 @fnFactorial(i32 %21)
%23 = mul nsw i32 %22, %18
%24 = sdiv i32 %16, %23
%25 = load i32, i32* %1
%26 = load i32, i32* %2
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.4, i64 0, i64 0), i32 %25, i32 %26, i32 %25, i32 %26, i32 %24)
ret i32 0
}