#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*/ combinaRepet(int, int);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, int *, int *);
main(int argc, char *argv[]) {
  int r, n;
  printf("Digite o valor de r (2 <= r <= 10) e n (1 <= n <= 5) "
         "respectivamente: \n");
  scanf("%d%d", &r, &n);
  if ((r < 2 || r > 10) || (n < 1 || n > 5)) {
    printf("Algum dos valores digitados está fora do seu respectivo intervalo "
           "válido! Digite novamente\n");
    do {
      printf("Digite o valor de r (2 <= r <= 10) e n (1 <= n <= 5) "
             "respectivamente: \n");
      scanf("%d%d", &r, &n);
    } while ((r < 2 || r > 10) || (n < 1 || n > 5));
  }
  printf("\nCombinação com repetição: \n");
  combinaRepet(r, n);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
lea    0xeef(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
cmpl   $0x2,-0x14(%rbp)
jl     118e <main+0x5e>
cmpl   $0xa,-0x14(%rbp)
jg     118e <main+0x5e>
cmpl   $0x1,-0x18(%rbp)
jl     118e <main+0x5e>
cmpl   $0x5,-0x18(%rbp)
jle    1207 <main+0xd7>
lea    0xeb8(%rip),%rdi
call   1030 <printf@plt>
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9b(%rip),%rdi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1050 <scanf@plt>
mov    $0x1,%al
cmpl   $0x2,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jl     11f7 <main+0xc7>
mov    $0x1,%al
cmpl   $0xa,-0x14(%rbp)
mov    %al,-0x19(%rbp)
jg     11f7 <main+0xc7>
mov    $0x1,%al
cmpl   $0x1,-0x18(%rbp)
mov    %al,-0x1a(%rbp)
jl     11f1 <main+0xc1>
cmpl   $0x5,-0x18(%rbp)
setg   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    119a <main+0x6a>
jmp    1207 <main+0xd7>
lea    0xe9d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <combinaRepet@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
lea    0xf43(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff7,%eax
jb     1170 <main+0x40>
mov    (%rsp),%eax
test   %eax,%eax
jle    1170 <main+0x40>
cmp    $0x6,%eax
jl     11cd <main+0x9d>
lea    0xeae(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%r14
lea    0xe76(%rip),%r15
lea    0x4(%rsp),%r12
mov    %rsp,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
add    $0xfffffff5,%eax
cmp    $0xfffffff7,%eax
jb     11a0 <main+0x70>
mov    (%rsp),%eax
add    $0xfffffffa,%eax
cmp    $0xfffffffb,%eax
jb     11a0 <main+0x70>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
mov    0x4(%rsp),%edi
mov    (%rsp),%esi
call   1040 <combinaRepet@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [72 x i8] c"Digite o valor de r (2 <= r <= 10) e n (1 <= n <= 5) respectivamente: \0A\00"
@.str.1 = [5 x i8] c"%d%d\00"
@.str.2 = [94 x i8] c"Algum dos valores digitados est\C3\A1 fora do seu respectivo intervalo v\C3\A1lido! Digite novamente\0A\00"
@.str.3 = [33 x i8] c"\0ACombina\C3\A7\C3\A3o com repeti\C3\A7\C3\A3o: \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
%10 = load i32, i32* %6
%11 = icmp slt i32 %10, 2
br i1 %11, label %21, label %12
12: ; preds = %2
%13 = load i32, i32* %6
%14 = icmp sgt i32 %13, 10
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = load i32, i32* %7
%17 = icmp slt i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = load i32, i32* %7
%20 = icmp sgt i32 %19, 5
br i1 %20, label %21, label %43
21: ; preds = %18, %15, %12, %2
%22 = call i32 @printf(i8* getelementptr inbounds ([94 x i8], [94 x i8]* @.str.2, i64 0, i64 0))
br label %23
23: ; preds = %40, %21
%24 = call i32 @printf(i8* getelementptr inbounds ([72 x i8], [72 x i8]* @.str, i64 0, i64 0))
%25 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
br label %26
26: ; preds = %23
%27 = load i32, i32* %6
%28 = icmp slt i32 %27, 2
br i1 %28, label %40, label %29
29: ; preds = %26
%30 = load i32, i32* %6
%31 = icmp sgt i32 %30, 10
br i1 %31, label %40, label %32
32: ; preds = %29
%33 = load i32, i32* %7
%34 = icmp slt i32 %33, 1
br i1 %34, label %38, label %35
35: ; preds = %32
%36 = load i32, i32* %7
%37 = icmp sgt i32 %36, 5
br label %38
38: ; preds = %35, %32
%39 = phi i1 [ true, %32 ], [ %37, %35 ]
br label %40
40: ; preds = %38, %29, %26
%41 = phi i1 [ true, %29 ], [ true, %26 ], [ %39, %38 ]
br i1 %41, label %23, label %42
42: ; preds = %40
br label %43
43: ; preds = %42, %18
%44 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32, i32* %6
%46 = load i32, i32* %7
%47 = call i32 @combinaRepet(i32 %45, i32 %46)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [5 x i8] c"%d%d\00"
@str.4 = [32 x i8] c"\0ACombina\C3\A7\C3\A3o com repeti\C3\A7\C3\A3o: \00"
@str.5 = [93 x i8] c"Algum dos valores digitados est\C3\A1 fora do seu respectivo intervalo v\C3\A1lido! Digite novamente\00"
@str.6 = [71 x i8] c"Digite o valor de r (2 <= r <= 10) e n (1 <= n <= 5) respectivamente: \00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.6, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%9 = load i32, i32* %3
%10 = add i32 %9, -11
%11 = icmp ult i32 %10, -9
%12 = load i32, i32* %4
%13 = icmp slt i32 %12, 1
%14 = select i1 %11, i1 true, i1 %13
%15 = icmp sgt i32 %12, 5
%16 = select i1 %14, i1 true, i1 %15
br i1 %16, label %17, label %30
17: ; preds = %2
%18 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([93 x i8], [93 x i8]* @str.5, i64 0, i64 0))
br label %19
19: ; preds = %29, %17
%20 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([71 x i8], [71 x i8]* @str.6, i64 0, i64 0))
%21 = call i32 @scanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%22 = load i32, i32* %3
%23 = add i32 %22, -11
%24 = icmp ult i32 %23, -9
br i1 %24, label %29, label %25
25: ; preds = %19
%26 = load i32, i32* %4
%27 = add i32 %26, -6
%28 = icmp ult i32 %27, -5
br i1 %28, label %29, label %30
29: ; preds = %25, %19
br label %19
30: ; preds = %25, %2
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.4, i64 0, i64 0))
%32 = load i32, i32* %3
%33 = load i32, i32* %4
%34 = call i32 @combinaRepet(i32 %32, i32 %33)
ret i32 0
}