#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*/ printf(char *, ...);
size_t DispositionRipetitionR(size_t pos, int *val, int *sol, size_t n,
                              size_t k, size_t count) {
  size_t i;
  if (pos >= k) {
    for (i = 0; i < k; i++)
      printf("%d ", sol[i]);
    printf("\n");
    return (count + 1);
  }
  for (i = 0; i < n; i++) {
    sol[pos] = val[i];
    count = DispositionRipetitionR(pos + 1, val, sol, n, k, count);
  }
  return (count);
}


x86 assembly (clang, -O0):
<DispositionRipetitionR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x30(%rbp),%rax
jb     11ad <DispositionRipetitionR+0x8d>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    118e <DispositionRipetitionR+0x6e>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    1156 <DispositionRipetitionR+0x36>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1217 <DispositionRipetitionR+0xf7>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    120f <DispositionRipetitionR+0xef>
mov    -0x18(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x20(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rdi
add    $0x1,%rdi
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    -0x28(%rbp),%rcx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r9
call   1040 <DispositionRipetitionR@plt>
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11b5 <DispositionRipetitionR+0x95>
mov    -0x38(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<DispositionRipetitionR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9,%rbx
mov    %r8,%r14
mov    %rdx,%r15
cmp    %r8,%rdi
jae    11a8 <DispositionRipetitionR+0x78>
mov    %rcx,%r12
test   %rcx,%rcx
je     11e5 <DispositionRipetitionR+0xb5>
mov    %rsi,%r13
lea    0x1(%rdi),%rax
mov    %rax,0x10(%rsp)
xor    %ebp,%ebp
mov    %r14,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    0x0(%r13,%rbp,4),%eax
mov    %eax,(%r15,%rdi,4)
mov    %rdi,%r14
mov    0x10(%rsp),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    %r12,%rcx
mov    0x8(%rsp),%r8
mov    %rbx,%r9
call   1050 <DispositionRipetitionR@plt>
mov    %r14,%rdi
mov    %rax,%rbx
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1170 <DispositionRipetitionR+0x40>
jmp    11e5 <DispositionRipetitionR+0xb5>
test   %r14,%r14
je     11d7 <DispositionRipetitionR+0xa7>
lea    0xe4c(%rip),%r12
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
mov    (%r15,%rbp,4),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11c0 <DispositionRipetitionR+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%rbx
mov    %rbx,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [2 x i8] c"\0A\00"
define i64 @DispositionRipetitionR(i64 %0, i32* %1, i32* %2, i64 %3, i64 %4, i64 %5) {
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca i64
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
store i64 %0, i64* %8
store i32* %1, i32** %9
store i32* %2, i32** %10
store i64 %3, i64* %11
store i64 %4, i64* %12
store i64 %5, i64* %13
%15 = load i64, i64* %8
%16 = load i64, i64* %12
%17 = icmp uge i64 %15, %16
br i1 %17, label %18, label %36
18: ; preds = %6
store i64 0, i64* %14
br label %19
19: ; preds = %29, %18
%20 = load i64, i64* %14
%21 = load i64, i64* %12
%22 = icmp ult i64 %20, %21
br i1 %22, label %23, label %32
23: ; preds = %19
%24 = load i32*, i32** %10
%25 = load i64, i64* %14
%26 = getelementptr inbounds i32, i32* %24, i64 %25
%27 = load i32, i32* %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %23
%30 = load i64, i64* %14
%31 = add i64 %30, 1
store i64 %31, i64* %14
br label %19
32: ; preds = %19
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%34 = load i64, i64* %13
%35 = add i64 %34, 1
store i64 %35, i64* %7
br label %62
36: ; preds = %6
store i64 0, i64* %14
br label %37
37: ; preds = %57, %36
%38 = load i64, i64* %14
%39 = load i64, i64* %11
%40 = icmp ult i64 %38, %39
br i1 %40, label %41, label %60
41: ; preds = %37
%42 = load i32*, i32** %9
%43 = load i64, i64* %14
%44 = getelementptr inbounds i32, i32* %42, i64 %43
%45 = load i32, i32* %44
%46 = load i32*, i32** %10
%47 = load i64, i64* %8
%48 = getelementptr inbounds i32, i32* %46, i64 %47
store i32 %45, i32* %48
%49 = load i64, i64* %8
%50 = add i64 %49, 1
%51 = load i32*, i32** %9
%52 = load i32*, i32** %10
%53 = load i64, i64* %11
%54 = load i64, i64* %12
%55 = load i64, i64* %13
%56 = call i64 @DispositionRipetitionR(i64 %50, i32* %51, i32* %52, i64 %53, i64 %54, i64 %55)
store i64 %56, i64* %13
br label %57
57: ; preds = %41
%58 = load i64, i64* %14
%59 = add i64 %58, 1
store i64 %59, i64* %14
br label %37
60: ; preds = %37
%61 = load i64, i64* %13
store i64 %61, i64* %7
br label %62
62: ; preds = %60, %32
%63 = load i64, i64* %7
ret i64 %63
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i64 @DispositionRipetitionR(i64 %0, i32* nocapture %1, i32* nocapture %2, i64 %3, i64 %4, i64 %5) {
%7 = icmp ult i64 %0, %4
br i1 %7, label %10, label %8
8: ; preds = %6
%9 = icmp eq i64 %4, 0
br i1 %9, label %22, label %15
10: ; preds = %6
%11 = icmp eq i64 %3, 0
br i1 %11, label %33, label %12
12: ; preds = %10
%13 = getelementptr inbounds i32, i32* %2, i64 %0
%14 = add nuw i64 %0, 1
br label %25
15: ; preds = %8, %15
%16 = phi i64 [ %20, %15 ], [ 0, %8 ]
%17 = getelementptr inbounds i32, i32* %2, i64 %16
%18 = load i32, i32* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = add nuw i64 %16, 1
%21 = icmp eq i64 %20, %4
br i1 %21, label %22, label %15
22: ; preds = %15, %8
%23 = tail call i32 @putchar(i32 10)
%24 = add i64 %5, 1
br label %33
25: ; preds = %12, %25
%26 = phi i64 [ 0, %12 ], [ %31, %25 ]
%27 = phi i64 [ %5, %12 ], [ %30, %25 ]
%28 = getelementptr inbounds i32, i32* %1, i64 %26
%29 = load i32, i32* %28
store i32 %29, i32* %13
%30 = tail call i64 @DispositionRipetitionR(i64 %14, i32* %1, i32* %2, i64 %3, i64 %4, i64 %27)
%31 = add nuw i64 %26, 1
%32 = icmp eq i64 %31, %3
br i1 %32, label %33, label %25
33: ; preds = %25, %10, %22
%34 = phi i64 [ %24, %22 ], [ %5, %10 ], [ %30, %25 ]
ret i64 %34
}