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


x86 assembly (clang, -O0):
<PowerSetCombinationSimpleR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%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)
movq   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rax
cmp    -0x28(%rbp),%rax
jne    11bf <PowerSetCombinationSimpleR+0x9f>
lea    0xea3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x28(%rbp),%rax
jae    11a4 <PowerSetCombinationSimpleR+0x84>
mov    -0x20(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    116c <PowerSetCombinationSimpleR+0x4c>
lea    0xe5c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movq   $0x1,-0x8(%rbp)
jmp    1231 <PowerSetCombinationSimpleR+0x111>
mov    -0x38(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x48(%rbp),%rax
cmp    -0x30(%rbp),%rax
jae    1229 <PowerSetCombinationSimpleR+0x109>
mov    -0x18(%rbp),%rax
mov    -0x48(%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    -0x48(%rbp),%r9
add    $0x1,%r9
call   1030 <PowerSetCombinationSimpleR@plt>
add    -0x40(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x48(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x48(%rbp)
jmp    11c7 <PowerSetCombinationSimpleR+0xa7>
mov    -0x40(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PowerSetCombinationSimpleR>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %r8,(%rsp)
mov    %rdx,%r15
mov    %rdi,%r14
cmp    %rcx,%rdi
jne    119b <PowerSetCombinationSimpleR+0x6b>
lea    0xeac(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %r14,%r14
je     1187 <PowerSetCombinationSimpleR+0x57>
lea    0xe9c(%rip),%rbx
xor    %ebp,%ebp
nopl   0x0(%rax)
mov    (%r15,%rbp,4),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r14
jne    1170 <PowerSetCombinationSimpleR+0x40>
lea    0xe79(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r12d
jmp    1210 <PowerSetCombinationSimpleR+0xe0>
mov    %r9,%rbx
cmp    (%rsp),%r9
jae    120d <PowerSetCombinationSimpleR+0xdd>
mov    %rcx,%r13
mov    %rsi,%rbp
lea    0x1(%r14),%rax
mov    %rax,0x10(%rsp)
mov    (%rsp),%rax
neg    %rax
mov    %rax,0x8(%rsp)
add    $0x1,%rbx
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
mov    -0x4(%rbp,%rbx,4),%eax
mov    %eax,(%r15,%r14,4)
mov    0x10(%rsp),%rdi
mov    %rbp,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
mov    (%rsp),%r8
mov    %rbx,%r9
call   1030 <PowerSetCombinationSimpleR@plt>
add    %rax,%r12
mov    0x8(%rsp),%rax
add    %rbx,%rax
add    $0x1,%rax
add    $0x1,%rbx
cmp    $0x1,%rax
jne    11d0 <PowerSetCombinationSimpleR+0xa0>
jmp    1210 <PowerSetCombinationSimpleR+0xe0>
xor    %r12d,%r12d
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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