#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 *, char *);
int sprintf(char *, char *, ...);
void print_subsets_aux(char *buff, size_t buff_i, size_t n, int set[n],
                       size_t set_i) {
  if (set_i == n) {
    sprintf(buff + buff_i, "};");
    printf("Subset: %s\n", buff);
    return;
  }
  print_subsets_aux(buff, buff_i, n, set, set_i + 1);
  int written = sprintf(buff + buff_i, "%d ", set[set_i]);
  print_subsets_aux(buff, buff_i + written, n, set, set_i + 1);
}


x86 assembly (clang, -O0):
<print_subsets_aux>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
mov    -0x28(%rbp),%rax
cmp    -0x18(%rbp),%rax
jne    1185 <print_subsets_aux+0x55>
mov    -0x8(%rbp),%rdi
add    -0x10(%rbp),%rdi
lea    0xe97(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
jmp    11ea <print_subsets_aux+0xba>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
add    $0x1,%r8
call   1040 <print_subsets_aux@plt>
mov    -0x8(%rbp),%rdi
add    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rax
mov    -0x28(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xe53(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
movslq -0x2c(%rbp),%rax
add    %rax,%rsi
mov    -0x18(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x28(%rbp),%r8
add    $0x1,%r8
call   1040 <print_subsets_aux@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_subsets_aux>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r13
mov    %rdi,%r14
cmp    %rdx,%r8
jne    114b <print_subsets_aux+0x1b>
mov    %r13,%rax
jmp    11a5 <print_subsets_aux+0x75>
mov    %r8,%rbx
mov    %rcx,%r15
mov    %rdx,%rbp
mov    %rdx,%r12
neg    %r12
add    $0x1,%rbx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %rbx,%r8
call   1040 <print_subsets_aux@plt>
lea    (%r14,%r13,1),%rdi
mov    -0x4(%r15,%rbx,4),%edx
lea    0xe8b(%rip),%rsi
xor    %eax,%eax
call   1050 <sprintf@plt>
cltq
add    %r13,%rax
lea    (%r12,%rbx,1),%rcx
add    $0x1,%rcx
add    $0x1,%rbx
mov    %rax,%r13
cmp    $0x1,%rcx
jne    1160 <print_subsets_aux+0x30>
movb   $0x0,0x2(%r14,%rax,1)
movw   $0x3b7d,(%r14,%rax,1)
lea    0xe4a(%rip),%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"};\00"
@.str.1 = [12 x i8] c"Subset: %s\0A\00"
@.str.2 = [4 x i8] c"%d \00"
define void @print_subsets_aux(i8* %0, i64 %1, i64 %2, i32* %3, i64 %4) {
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32*
%10 = alloca i64
%11 = alloca i32
store i8* %0, i8** %6
store i64 %1, i64* %7
store i64 %2, i64* %8
store i32* %3, i32** %9
store i64 %4, i64* %10
%12 = load i64, i64* %8
%13 = load i64, i64* %10
%14 = load i64, i64* %8
%15 = icmp eq i64 %13, %14
br i1 %15, label %16, label %23
16: ; preds = %5
%17 = load i8*, i8** %6
%18 = load i64, i64* %7
%19 = getelementptr inbounds i8, i8* %17, i64 %18
%20 = call i32 (i8*, i8*, ...) @sprintf(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%21 = load i8*, i8** %6
%22 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %21)
br label %47
23: ; preds = %5
%24 = load i8*, i8** %6
%25 = load i64, i64* %7
%26 = load i64, i64* %8
%27 = load i32*, i32** %9
%28 = load i64, i64* %10
%29 = add i64 %28, 1
%30 = load i8*, i8** %6
%31 = load i64, i64* %7
%32 = getelementptr inbounds i8, i8* %30, i64 %31
%33 = load i32*, i32** %9
%34 = load i64, i64* %10
%35 = getelementptr inbounds i32, i32* %33, i64 %34
%36 = load i32, i32* %35
%37 = call i32 (i8*, i8*, ...) @sprintf(i8* %32, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %36)
store i32 %37, i32* %11
%38 = load i8*, i8** %6
%39 = load i64, i64* %7
%40 = load i32, i32* %11
%41 = sext i32 %40 to i64
%42 = add i64 %39, %41
%43 = load i64, i64* %8
%44 = load i32*, i32** %9
%45 = load i64, i64* %10
%46 = add i64 %45, 1
br label %47
47: ; preds = %23, %16
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"};\00"
@.str.1 = [12 x i8] c"Subset: %s\0A\00"
@.str.2 = [4 x i8] c"%d \00"
define void @print_subsets_aux(i8* %0, i64 %1, i64 %2, i32* %3, i64 %4) {
%6 = icmp eq i64 %4, %2
br i1 %6, label %7, label %11
7: ; preds = %11, %5
%8 = phi i64 [ %1, %5 ], [ %20, %11 ]
%9 = getelementptr inbounds i8, i8* %0, i64 %8
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 1 dereferenceable(3) %9, i8* align 1 dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 3, i1 false)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
11: ; preds = %5, %11
%12 = phi i64 [ %14, %11 ], [ %4, %5 ]
%13 = phi i64 [ %20, %11 ], [ %1, %5 ]
%14 = add i64 %12, 1
tail call void @print_subsets_aux(i8* %0, i64 %13, i64 %2, i32* %3, i64 %14)
%15 = getelementptr inbounds i8, i8* %0, i64 %13
%16 = getelementptr inbounds i32, i32* %3, i64 %12
%17 = load i32, i32* %16
%18 = tail call i32 (i8*, i8*, ...) @sprintf(i8* dereferenceable(1) %15, i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = sext i32 %18 to i64
%20 = add i64 %13, %19
%21 = icmp eq i64 %14, %2
br i1 %21, label %7, label %11
}