#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 */
long find_ncr(int, int);
long find_npr(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
main() {
  int n, r;
  long ncr, npr;
  printf("Enter the value of n and r\n");
  scanf("%d%d", &n, &r);
  ncr = find_ncr(n, r);
  npr = find_npr(n, r);
  printf("%dC%d = %ld\n", n, r, ncr);
  printf("%dP%d = %ld\n", n, r, npr);
  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   1040 <printf@plt>
lea    0xeb8(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1060 <scanf@plt>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1030 <find_ncr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
call   1050 <find_npr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x18(%rbp),%rcx
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x20(%rbp),%rcx
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe99(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1070 <scanf@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <find_ncr@plt>
mov    %rax,%rbx
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1060 <find_npr@plt>
mov    %rax,%r14
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe65(%rip),%rdi
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    0xe5a(%rip),%rdi
mov    %r14,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [28 x i8] c"Enter the value of n and r\0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [13 x i8] c"%dC%d = %ld\0A\00"
@.str.3 = [13 x i8] c"%dP%d = %ld\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i64
%5 = alloca i64
store i32 0, i32* %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = call i64 @find_ncr(i32 %8, i32 %9)
store i64 %10, i64* %4
%11 = load i32, i32* %2
%12 = load i32, i32* %3
%13 = call i64 @find_npr(i32 %11, i32 %12)
store i64 %13, i64* %5
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = load i64, i64* %4
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %14, i32 %15, i64 %16)
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = load i64, i64* %5
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %18, i32 %19, i64 %20)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [13 x i8] c"%dC%d = %ld\0A\00"
@.str.3 = [13 x i8] c"%dP%d = %ld\0A\00"
@str = [27 x i8] c"Enter the value of n and r\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 ([27 x i8], [27 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = call i64 @find_ncr(i32 %7, i32 %8)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = call i64 @find_npr(i32 %10, i32 %11)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32 %13, i32 %14, i64 %9)
%16 = load i32, i32* %1
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32 %16, i32 %17, i64 %12)
ret i32 0
}