#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 *, ...);
void subset_r(const int *S, int n, int k, int *t, int index, int s) {
  int i = 0;
  if (index == k) {
    for (i = 0; i < k; i++)
      printf("%d ", t[i]);
    printf("\n");
  } else {
    for (i = s; i < n; i++) {
      t[index] = S[i];
      subset_r(S, n, k, t, index + 1, i + 1);
    }
  }
}


x86 assembly (clang, -O0):
<subset_r>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    119e <subset_r+0x7e>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    118b <subset_r+0x6b>
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe8a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1158 <subset_r+0x38>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    11fc <subset_r+0xdc>
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11f7 <subset_r+0xd7>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x24(%rbp),%r9d
add    $0x1,%r9d
call   1030 <subset_r@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11a4 <subset_r+0x84>
jmp    11fc <subset_r+0xdc>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subset_r>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8d,%r14d
mov    %rcx,%rbx
mov    %esi,0x4(%rsp)
cmp    %edx,%r8d
jne    118e <subset_r+0x5e>
test   %r14d,%r14d
jle    1176 <subset_r+0x46>
mov    %r14d,%r15d
lea    0xea4(%rip),%r14
xor    %ebp,%ebp
xchg   %ax,%ax
mov    (%rbx,%rbp,4),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
jne    1160 <subset_r+0x30>
mov    $0xa,%edi
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <putchar@plt>
mov    %r9d,%ebp
cmp    0x4(%rsp),%r9d
jge    11f3 <subset_r+0xc3>
mov    %edx,%r15d
mov    %rdi,%r13
movslq %r14d,%rax
mov    %rax,0x10(%rsp)
add    $0x1,%r14d
movslq %ebp,%r12
movslq 0x4(%rsp),%rax
mov    %rax,0x8(%rsp)
add    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13,%r12,4),%eax
mov    0x10(%rsp),%rcx
mov    %eax,(%rbx,%rcx,4)
add    $0x1,%r12
mov    %r13,%rdi
mov    0x4(%rsp),%esi
mov    %r15d,%edx
mov    %rbx,%rcx
mov    %r14d,%r8d
mov    %ebp,%r9d
call   1030 <subset_r@plt>
add    $0x1,%ebp
cmp    %r12,0x8(%rsp)
jne    11c0 <subset_r+0x90>
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 void @subset_r(i32* %0, i32 %1, i32 %2, i32* %3, i32 %4, i32 %5) {
%7 = alloca i32*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32* %0, i32** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 %5, i32* %12
store i32 0, i32* %13
%14 = load i32, i32* %11
%15 = load i32, i32* %9
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %34
17: ; preds = %6
store i32 0, i32* %13
br label %18
18: ; preds = %29, %17
%19 = load i32, i32* %13
%20 = load i32, i32* %9
%21 = icmp slt i32 %19, %20
br i1 %21, label %22, label %32
22: ; preds = %18
%23 = load i32*, i32** %10
%24 = load i32, i32* %13
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, 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 = %22
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %18
32: ; preds = %18
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %62
34: ; preds = %6
%35 = load i32, i32* %12
store i32 %35, i32* %13
br label %36
36: ; preds = %58, %34
%37 = load i32, i32* %13
%38 = load i32, i32* %8
%39 = icmp slt i32 %37, %38
br i1 %39, label %40, label %61
40: ; preds = %36
%41 = load i32*, i32** %7
%42 = load i32, i32* %13
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i32, i32* %41, i64 %43
%45 = load i32, i32* %44
%46 = load i32*, i32** %10
%47 = load i32, i32* %11
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds i32, i32* %46, i64 %48
store i32 %45, i32* %49
%50 = load i32*, i32** %7
%51 = load i32, i32* %8
%52 = load i32, i32* %9
%53 = load i32*, i32** %10
%54 = load i32, i32* %11
%55 = add nsw i32 %54, 1
%56 = load i32, i32* %13
%57 = add nsw i32 %56, 1
br label %58
58: ; preds = %40
%59 = load i32, i32* %13
%60 = add nsw i32 %59, 1
store i32 %60, i32* %13
br label %36
61: ; preds = %36
br label %62
62: ; preds = %61, %32
ret void
}

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