#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 CombinationRipetitionR(size_t pos, int *val, int *sol, size_t n,
                              size_t k, size_t start, 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 = start; i < n; i++) {
    sol[pos] = val[i];
    count = CombinationRipetitionR(pos + 1, val, sol, n, k, start, count);
    start++;
  }
  return (count);
}


x86 assembly (clang, -O0):
<CombinationRipetitionR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0x10(%rbp),%rax
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     11b1 <CombinationRipetitionR+0x91>
movq   $0x0,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1192 <CombinationRipetitionR+0x72>
mov    -0x20(%rbp),%rax
mov    -0x40(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    115a <CombinationRipetitionR+0x3a>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    122f <CombinationRipetitionR+0x10f>
mov    -0x38(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    1227 <CombinationRipetitionR+0x107>
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
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1040 <CombinationRipetitionR@plt>
mov    %rax,0x10(%rbp)
mov    -0x38(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x38(%rbp)
mov    -0x40(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x40(%rbp)
jmp    11b9 <CombinationRipetitionR+0x99>
mov    0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CombinationRipetitionR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdx,%r15
mov    0x50(%rsp),%r12
cmp    %r8,%rdi
jae    11ab <CombinationRipetitionR+0x7b>
mov    %r9,%rbx
mov    %rcx,%r13
cmp    %rcx,%r9
jae    11e5 <CombinationRipetitionR+0xb5>
mov    %rsi,%r14
lea    0x1(%rdi),%rax
mov    %rax,0x10(%rsp)
mov    %r8,0x8(%rsp)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,4),%eax
mov    %eax,(%r15,%rdi,4)
mov    %r12,(%rsp)
mov    %rdi,%rbp
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    0x8(%rsp),%r8
mov    %rbx,%r9
call   1050 <CombinationRipetitionR@plt>
mov    %rbp,%rdi
mov    %rax,%r12
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <CombinationRipetitionR+0x40>
jmp    11e5 <CombinationRipetitionR+0xb5>
test   %r8,%r8
je     11d7 <CombinationRipetitionR+0xa7>
mov    %r8,%rbx
lea    0xe46(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    11c0 <CombinationRipetitionR+0x90>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
mov    %r12,%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 @CombinationRipetitionR(i64 %0, i32* %1, i32* %2, i64 %3, i64 %4, i64 %5, i64 %6) {
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32*
%11 = alloca i32*
%12 = alloca i64
%13 = alloca i64
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
store i64 %0, i64* %9
store i32* %1, i32** %10
store i32* %2, i32** %11
store i64 %3, i64* %12
store i64 %4, i64* %13
store i64 %5, i64* %14
store i64 %6, i64* %15
%17 = load i64, i64* %9
%18 = load i64, i64* %13
%19 = icmp uge i64 %17, %18
br i1 %19, label %20, label %38
20: ; preds = %7
store i64 0, i64* %16
br label %21
21: ; preds = %31, %20
%22 = load i64, i64* %16
%23 = load i64, i64* %13
%24 = icmp ult i64 %22, %23
br i1 %24, label %25, label %34
25: ; preds = %21
%26 = load i32*, i32** %11
%27 = load i64, i64* %16
%28 = getelementptr inbounds i32, i32* %26, i64 %27
%29 = load i32, i32* %28
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %25
%32 = load i64, i64* %16
%33 = add i64 %32, 1
store i64 %33, i64* %16
br label %21
34: ; preds = %21
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = load i64, i64* %15
%37 = add i64 %36, 1
store i64 %37, i64* %8
br label %68
38: ; preds = %7
%39 = load i64, i64* %14
store i64 %39, i64* %16
br label %40
40: ; preds = %63, %38
%41 = load i64, i64* %16
%42 = load i64, i64* %12
%43 = icmp ult i64 %41, %42
br i1 %43, label %44, label %66
44: ; preds = %40
%45 = load i32*, i32** %10
%46 = load i64, i64* %16
%47 = getelementptr inbounds i32, i32* %45, i64 %46
%48 = load i32, i32* %47
%49 = load i32*, i32** %11
%50 = load i64, i64* %9
%51 = getelementptr inbounds i32, i32* %49, i64 %50
store i32 %48, i32* %51
%52 = load i64, i64* %9
%53 = add i64 %52, 1
%54 = load i32*, i32** %10
%55 = load i32*, i32** %11
%56 = load i64, i64* %12
%57 = load i64, i64* %13
%58 = load i64, i64* %14
%59 = load i64, i64* %15
%60 = call i64 @CombinationRipetitionR(i64 %53, i32* %54, i32* %55, i64 %56, i64 %57, i64 %58, i64 %59)
store i64 %60, i64* %15
%61 = load i64, i64* %14
%62 = add i64 %61, 1
store i64 %62, i64* %14
br label %63
63: ; preds = %44
%64 = load i64, i64* %16
%65 = add i64 %64, 1
store i64 %65, i64* %16
br label %40
66: ; preds = %40
%67 = load i64, i64* %15
store i64 %67, i64* %8
br label %68
68: ; preds = %66, %34
%69 = load i64, i64* %8
ret i64 %69
}

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