#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*/ print_array(int *, int);
void print_combinations(int arr[], int data[], int start, int end, int index,
                        int r) {
  int i;
  if (index == r)
    print_array(data, r);
  for (i = start; i <= end && end - i + 1 >= r - index; i++) {
    data[index] = arr[i];
    print_combinations(arr, data, i + 1, end, index + 1, r);
  }
}


x86 assembly (clang, -O0):
<print_combinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9d,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jne    1156 <print_combinations+0x36>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%esi
call   1030 <print_array@plt>
mov    -0x14(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%ecx
xor    %eax,%eax
cmp    -0x18(%rbp),%ecx
mov    %al,-0x25(%rbp)
jg     1184 <print_combinations+0x64>
mov    -0x18(%rbp),%eax
sub    -0x24(%rbp),%eax
add    $0x1,%eax
mov    -0x20(%rbp),%ecx
sub    -0x1c(%rbp),%ecx
cmp    %ecx,%eax
setge  %al
mov    %al,-0x25(%rbp)
mov    -0x25(%rbp),%al
test   $0x1,%al
jne    1194 <print_combinations+0x74>
jmp    11da <print_combinations+0xba>
mov    -0x8(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x24(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x20(%rbp),%r9d
call   1040 <print_combinations@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    115c <print_combinations+0x3c>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_combinations>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r9d,%r14d
mov    %r8d,%r12d
mov    %ecx,(%rsp)
mov    %edx,%ebx
mov    %rsi,%rbp
mov    %rdi,0x8(%rsp)
mov    %r9d,0x4(%rsp)
sub    %r8d,%r14d
jne    1157 <print_combinations+0x37>
mov    %rbp,%rdi
mov    0x4(%rsp),%esi
call   1030 <print_array@plt>
cmp    (%rsp),%ebx
jg     11c9 <print_combinations+0xa9>
movslq %r12d,%rax
mov    %rax,0x10(%rsp)
add    $0x1,%r12d
movslq %ebx,%rax
mov    (%rsp),%r15d
sub    %ebx,%r15d
add    $0x1,%r15d
mov    0x8(%rsp),%rcx
lea    (%rcx,%rax,4),%r13
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
cmp    %r14d,%r15d
jl     11c9 <print_combinations+0xa9>
mov    0x0(%r13),%eax
mov    0x10(%rsp),%rcx
mov    %eax,0x0(%rbp,%rcx,4)
mov    0x8(%rsp),%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
mov    (%rsp),%ecx
mov    %r12d,%r8d
mov    0x4(%rsp),%r9d
call   1040 <print_combinations@plt>
add    $0x4,%r13
add    $0x1,%ebx
add    $0xffffffff,%r15d
jne    1190 <print_combinations+0x70>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @print_combinations(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
%14 = load i32, i32* %11
%15 = load i32, i32* %12
%16 = icmp eq i32 %14, %15
br i1 %16, label %17, label %21
17: ; preds = %6
%18 = load i32*, i32** %8
%19 = load i32, i32* %12
%20 = call i32 @print_array(i32* %18, i32 %19)
br label %21
21: ; preds = %17, %6
%22 = load i32, i32* %9
store i32 %22, i32* %13
br label %23
23: ; preds = %56, %21
%24 = load i32, i32* %13
%25 = load i32, i32* %10
%26 = icmp sle i32 %24, %25
br i1 %26, label %27, label %36
27: ; preds = %23
%28 = load i32, i32* %10
%29 = load i32, i32* %13
%30 = sub nsw i32 %28, %29
%31 = add nsw i32 %30, 1
%32 = load i32, i32* %12
%33 = load i32, i32* %11
%34 = sub nsw i32 %32, %33
%35 = icmp sge i32 %31, %34
br label %36
36: ; preds = %27, %23
%37 = phi i1 [ false, %23 ], [ %35, %27 ]
br i1 %37, label %38, label %59
38: ; preds = %36
%39 = load i32*, i32** %7
%40 = load i32, i32* %13
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i32, i32* %39, i64 %41
%43 = load i32, i32* %42
%44 = load i32*, i32** %8
%45 = load i32, i32* %11
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i32, i32* %44, i64 %46
store i32 %43, i32* %47
%48 = load i32*, i32** %7
%49 = load i32*, i32** %8
%50 = load i32, i32* %13
%51 = add nsw i32 %50, 1
%52 = load i32, i32* %10
%53 = load i32, i32* %11
%54 = add nsw i32 %53, 1
%55 = load i32, i32* %12
br label %56
56: ; preds = %38
%57 = load i32, i32* %13
%58 = add nsw i32 %57, 1
store i32 %58, i32* %13
br label %23
59: ; preds = %36
ret void
}

LLVM IR (-O2):
define void @print_combinations(i32* nocapture %0, i32* %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %5, %4
br i1 %7, label %8, label %10
8: ; preds = %6
%9 = tail call i32 @print_array(i32* %1, i32 %5)
br label %10
10: ; preds = %8, %6
%11 = icmp sgt i32 %2, %3
br i1 %11, label %30, label %12
12: ; preds = %10
%13 = add i32 %3, 1
%14 = sub nsw i32 %5, %4
%15 = sext i32 %4 to i64
%16 = getelementptr inbounds i32, i32* %1, i64 %15
%17 = add nsw i32 %4, 1
%18 = sext i32 %2 to i64
br label %19
19: ; preds = %12, %24
%20 = phi i64 [ %18, %12 ], [ %27, %24 ]
%21 = trunc i64 %20 to i32
%22 = sub i32 %13, %21
%23 = icmp slt i32 %22, %14
br i1 %23, label %30, label %24
24: ; preds = %19
%25 = getelementptr inbounds i32, i32* %0, i64 %20
%26 = load i32, i32* %25
store i32 %26, i32* %16
%27 = add nsw i64 %20, 1
%28 = trunc i64 %27 to i32
tail call void @print_combinations(i32* %0, i32* %1, i32 %28, i32 %3, i32 %17, i32 %5)
%29 = icmp eq i32 %13, %28
br i1 %29, label %30, label %19
30: ; preds = %19, %24, %10
ret void
}