#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 CombinationSimpleR(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 = CombinationSimpleR(pos + 1, val, sol, n, k, i + 1, count);
  }
  return (count);
}


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

x86 assembly (clang, -O2):
<CombinationSimpleR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r8,%r14
mov    %rcx,0x10(%rsp)
mov    %rdx,%r15
mov    0x60(%rsp),%r12
cmp    %r8,%rdi
jae    11c9 <CombinationSimpleR+0x99>
mov    %r9,%rbx
cmp    0x10(%rsp),%r9
jae    1205 <CombinationSimpleR+0xd5>
mov    %rsi,%r13
lea    0x1(%rdi),%rax
mov    %rax,0x20(%rsp)
mov    0x10(%rsp),%rax
neg    %rax
mov    %rax,0x18(%rsp)
add    $0x1,%rbx
xchg   %ax,%ax
mov    -0x4(%r13,%rbx,4),%eax
mov    %eax,(%r15,%rdi,4)
mov    %r12,(%rsp)
mov    %rdi,%rbp
mov    0x20(%rsp),%rdi
mov    %r13,%rsi
mov    %r15,%rdx
mov    0x10(%rsp),%rcx
mov    %r14,%r8
mov    %rbx,%r9
call   1040 <CombinationSimpleR@plt>
mov    %rbp,%rdi
mov    %rax,%r12
mov    0x18(%rsp),%rax
add    %rbx,%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
jne    1180 <CombinationSimpleR+0x50>
jmp    1205 <CombinationSimpleR+0xd5>
test   %r14,%r14
je     11f7 <CombinationSimpleR+0xc7>
lea    0xe2b(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
mov    (%r15,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    11e0 <CombinationSimpleR+0xb0>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x1,%r12
mov    %r12,%rax
add    $0x28,%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 @CombinationSimpleR(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 %67
38: ; preds = %7
%39 = load i64, i64* %14
store i64 %39, i64* %16
br label %40
40: ; preds = %62, %38
%41 = load i64, i64* %16
%42 = load i64, i64* %12
%43 = icmp ult i64 %41, %42
br i1 %43, label %44, label %65
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* %16
%59 = add i64 %58, 1
%60 = load i64, i64* %15
%61 = call i64 @CombinationSimpleR(i64 %53, i32* %54, i32* %55, i64 %56, i64 %57, i64 %59, i64 %60)
store i64 %61, i64* %15
br label %62
62: ; preds = %44
%63 = load i64, i64* %16
%64 = add i64 %63, 1
store i64 %64, i64* %16
br label %40
65: ; preds = %40
%66 = load i64, i64* %15
store i64 %66, i64* %8
br label %67
67: ; preds = %65, %34
%68 = load i64, i64* %8
ret i64 %68
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
define i64 @CombinationSimpleR(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 ], [ %31, %26 ]
%28 = phi i64 [ %6, %13 ], [ %32, %26 ]
%29 = getelementptr inbounds i32, i32* %1, i64 %27
%30 = load i32, i32* %29
store i32 %30, i32* %14
%31 = add nuw i64 %27, 1
%32 = tail call i64 @CombinationSimpleR(i64 %15, i32* %1, i32* %2, i64 %3, i64 %4, i64 %31, i64 %28)
%33 = icmp eq i64 %31, %3
br i1 %33, label %34, label %26
34: ; preds = %26, %11, %23
%35 = phi i64 [ %25, %23 ], [ %6, %11 ], [ %32, %26 ]
ret i64 %35
}