#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 fat(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  int n, num, aux, aux2, k, arranjo;
  do {
    printf("entre com n: ");
    scanf("%d", &n);
    printf("entre com k: ");
    scanf("%d", &k);
  } while (n < k || n <= 0 || k < 0);
  aux = n - k;
  num = fat(n);
  aux2 = fat(aux);
  arranjo = num / aux2;
  printf("O numero de arranjos, An,k = %d\n", arranjo);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xead(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9c(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%ecx
mov    $0x1,%al
cmp    -0x18(%rbp),%ecx
mov    %al,-0x1d(%rbp)
jl     11a5 <main+0x75>
mov    $0x1,%al
cmpl   $0x0,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
jle    11a5 <main+0x75>
cmpl   $0x0,-0x18(%rbp)
setl   %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
test   $0x1,%al
jne    113f <main+0xf>
mov    -0x8(%rbp),%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%edi
call   1050 <fat@plt>
mov    %eax,-0xc(%rbp)
mov    -0x10(%rbp),%edi
call   1050 <fat@plt>
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe3c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r14
lea    0xec5(%rip),%rbx
lea    0x4(%rsp),%r15
lea    0xebc(%rip),%r12
mov    %rsp,%r13
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1040 <scanf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1040 <scanf@plt>
mov    (%rsp),%eax
test   %eax,%eax
js     1160 <main+0x30>
mov    0x4(%rsp),%edi
test   %edi,%edi
jle    1160 <main+0x30>
mov    %edi,%ebp
sub    %eax,%ebp
jl     1160 <main+0x30>
call   1050 <fat@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1050 <fat@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
lea    0xe64(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [14 x i8] c"entre com n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"entre com k: \00"
@.str.3 = [33 x i8] c"O numero de arranjos, An,k = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %1
br label %8
8: ; preds = %23, %0
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%12 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
br label %13
13: ; preds = %8
%14 = load i32, i32* %2
%15 = load i32, i32* %6
%16 = icmp slt i32 %14, %15
br i1 %16, label %23, label %17
17: ; preds = %13
%18 = load i32, i32* %2
%19 = icmp sle i32 %18, 0
br i1 %19, label %23, label %20
20: ; preds = %17
%21 = load i32, i32* %6
%22 = icmp slt i32 %21, 0
br label %23
23: ; preds = %20, %17, %13
%24 = phi i1 [ true, %17 ], [ true, %13 ], [ %22, %20 ]
br i1 %24, label %8, label %25
25: ; preds = %23
%26 = load i32, i32* %2
%27 = load i32, i32* %6
%28 = sub nsw i32 %26, %27
store i32 %28, i32* %4
%29 = load i32, i32* %2
%30 = call i32 @fat(i32 %29)
store i32 %30, i32* %3
%31 = load i32, i32* %4
%32 = call i32 @fat(i32 %31)
store i32 %32, i32* %5
%33 = load i32, i32* %3
%34 = load i32, i32* %5
%35 = sdiv i32 %33, %34
store i32 %35, i32* %7
%36 = load i32, i32* %7
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %36)
%38 = load i32, i32* %1
ret i32 %38
}

LLVM IR (-O2):
@.str = [14 x i8] c"entre com n: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [14 x i8] c"entre com k: \00"
@.str.3 = [33 x i8] c"O numero de arranjos, An,k = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
br label %5
5: ; preds = %5, %0
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = load i32, i32* %1
%11 = load i32, i32* %2
%12 = icmp slt i32 %10, %11
%13 = icmp slt i32 %10, 1
%14 = or i1 %13, %12
%15 = icmp slt i32 %11, 0
%16 = or i1 %15, %14
br i1 %16, label %5, label %17
17: ; preds = %5
%18 = sub nsw i32 %10, %11
%19 = call i32 @fat(i32 %10)
%20 = call i32 @fat(i32 %18)
%21 = sdiv i32 %19, %20
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %21)
ret i32 0
}