#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*/ printSubset(int *, int);
void backtrackSubsets(int A[], int k, int n) {
  if (k == n) {
    printSubset(A, k);
  } else {
    A[k] = 0;
    backtrackSubsets(A, k + 1, n);
    A[k] = 1;
    backtrackSubsets(A, k + 1, n);
  }
}


x86 assembly (clang, -O0):
<backtrackSubsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jne    114f <backtrackSubsets+0x2f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <printSubset@plt>
jmp    1191 <backtrackSubsets+0x71>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <backtrackSubsets@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movl   $0x1,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <backtrackSubsets@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<backtrackSubsets>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
cmp    %edx,%esi
je     1185 <backtrackSubsets+0x65>
mov    %edx,%r15d
movslq %ebx,%rax
lea    (%r14,%rax,4),%rbp
mov    %edx,%r12d
neg    %r12d
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
movl   $0x0,0x0(%rbp)
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
call   1040 <backtrackSubsets@plt>
movl   $0x1,0x0(%rbp)
add    $0x4,%rbp
lea    (%r12,%rbx,1),%eax
add    $0x1,%eax
mov    %ebx,%ecx
add    $0x1,%ecx
mov    %ecx,%ebx
cmp    $0x1,%eax
jne    1150 <backtrackSubsets+0x30>
mov    %r15d,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printSubset@plt>

LLVM IR (-O0):
define void @backtrackSubsets(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32, i32* %5
%8 = load i32, i32* %6
%9 = icmp eq i32 %7, %8
br i1 %9, label %10, label %14
10: ; preds = %3
%11 = load i32*, i32** %4
%12 = load i32, i32* %5
%13 = call i32 @printSubset(i32* %11, i32 %12)
br label %31
14: ; preds = %3
%15 = load i32*, i32** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i32, i32* %15, i64 %17
store i32 0, i32* %18
%19 = load i32*, i32** %4
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
%22 = load i32, i32* %6
%23 = load i32*, i32** %4
%24 = load i32, i32* %5
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %23, i64 %25
store i32 1, i32* %26
%27 = load i32*, i32** %4
%28 = load i32, i32* %5
%29 = add nsw i32 %28, 1
%30 = load i32, i32* %6
br label %31
31: ; preds = %14, %10
ret void
}

LLVM IR (-O2):
define void @backtrackSubsets(i32* %0, i32 %1, i32 %2) {
%4 = icmp eq i32 %1, %2
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = sext i32 %1 to i64
br label %10
7: ; preds = %10, %3
%8 = phi i32 [ %1, %3 ], [ %2, %10 ]
%9 = tail call i32 @printSubset(i32* %0, i32 %8)
ret void
10: ; preds = %5, %10
%11 = phi i64 [ %6, %5 ], [ %13, %10 ]
%12 = getelementptr inbounds i32, i32* %0, i64 %11
store i32 0, i32* %12
%13 = add nsw i64 %11, 1
%14 = trunc i64 %13 to i32
tail call void @backtrackSubsets(i32* %0, i32 %14, i32 %2)
store i32 1, i32* %12
%15 = icmp eq i32 %14, %2
br i1 %15, label %7, label %10
}