#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 */
scalar_t__ PowerSetCombinationSimpleR(int /*<<< orphan*/, int *, int *, size_t,
                                      size_t, int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(size_t);
int /*<<< orphan*/ printf(char *);
size_t PowerSetCombinationSimple(int *val, size_t k) {
  size_t count = 0, n;
  int *sol = (int *)malloc(k * sizeof(int));
  printf("{ }\n");
  count++;
  for (n = 1; n <= k; n++)
    count += PowerSetCombinationSimpleR(0, val, sol, n, k, 0);
  free(sol);
  return (count);
}


x86 assembly (clang, -O0):
<PowerSetCombinationSimple>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
shl    $0x2,%rdi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
lea    0xe90(%rip),%rdi
call   1050 <printf@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
ja     11cb <PowerSetCombinationSimple+0x8b>
mov    -0x8(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x10(%rbp),%r8
xor    %r9d,%r9d
mov    %r9d,%edi
call   1040 <PowerSetCombinationSimpleR@plt>
add    -0x18(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1189 <PowerSetCombinationSimple+0x49>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PowerSetCombinationSimple>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rsi,%r12
mov    %rdi,%r15
lea    0x0(,%rsi,4),%rdi
call   1060 <malloc@plt>
mov    %rax,%r14
lea    0xe9a(%rip),%rdi
call   1050 <puts@plt>
mov    $0x1,%r13d
test   %r12,%r12
je     11a2 <PowerSetCombinationSimple+0x62>
mov    $0x1,%ebx
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%rcx
mov    %r12,%r8
xor    %r9d,%r9d
call   1040 <PowerSetCombinationSimpleR@plt>
add    %rax,%r13
add    $0x1,%rbx
cmp    %r12,%rbx
jbe    1180 <PowerSetCombinationSimple+0x40>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r13,%rax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [5 x i8] c"{ }\0A\00"
define i64 @PowerSetCombinationSimple(i32* %0, i64 %1) {
%3 = alloca i32*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
%7 = alloca i32*
store i32* %0, i32** %3
store i64 %1, i64* %4
store i64 0, i64* %5
%8 = load i64, i64* %4
%9 = mul i64 %8, 4
%10 = call i64 @malloc(i64 %9)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %7
%12 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%13 = load i64, i64* %5
%14 = add i64 %13, 1
store i64 %14, i64* %5
store i64 1, i64* %6
br label %15
15: ; preds = %27, %2
%16 = load i64, i64* %6
%17 = load i64, i64* %4
%18 = icmp ule i64 %16, %17
br i1 %18, label %19, label %30
19: ; preds = %15
%20 = load i32*, i32** %3
%21 = load i32*, i32** %7
%22 = load i64, i64* %6
%23 = load i64, i64* %4
%24 = call i64 @PowerSetCombinationSimpleR(i32 0, i32* %20, i32* %21, i64 %22, i64 %23, i32 0)
%25 = load i64, i64* %5
%26 = add i64 %25, %24
store i64 %26, i64* %5
br label %27
27: ; preds = %19
%28 = load i64, i64* %6
%29 = add i64 %28, 1
store i64 %29, i64* %6
br label %15
30: ; preds = %15
%31 = load i32*, i32** %7
%32 = call i32 @free(i32* %31)
%33 = load i64, i64* %5
ret i64 %33
}

LLVM IR (-O2):
@str = [4 x i8] c"{ }\00"
define i64 @PowerSetCombinationSimple(i32* %0, i64 %1) {
%3 = shl i64 %1, 2
%4 = tail call i64 @malloc(i64 %3)
%5 = inttoptr i64 %4 to i32*
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @str, i64 0, i64 0))
%7 = icmp eq i64 %1, 0
br i1 %7, label %15, label %8
8: ; preds = %2, %8
%9 = phi i64 [ %12, %8 ], [ 1, %2 ]
%10 = phi i64 [ %13, %8 ], [ 1, %2 ]
%11 = tail call i64 @PowerSetCombinationSimpleR(i32 0, i32* %0, i32* %5, i64 %10, i64 %1, i32 0)
%12 = add i64 %11, %9
%13 = add i64 %10, 1
%14 = icmp ugt i64 %13, %1
br i1 %14, label %15, label %8
15: ; preds = %8, %2
%16 = phi i64 [ 1, %2 ], [ %12, %8 ]
%17 = tail call i32 @free(i32* %5)
ret i64 %16
}