#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*/ dfs(int *, int, int /*<<< orphan*/, int *,
                       int /*<<< orphan*/, int **, int *, int *);
void *malloc(int);
int **subsets(int *nums, int numsSize, int *returnSize,
              int **returnColumnSizes) {
  int capacity = 5000;
  int **sets = malloc(capacity * sizeof(int *));
  int *stack = malloc(numsSize * sizeof(int));
  *returnColumnSizes = malloc(capacity * sizeof(int));
  *returnSize = 0;
  dfs(nums, numsSize, 0, stack, 0, sets, returnSize, *returnColumnSizes);
  return sets;
}


x86 assembly (clang, -O0):
<subsets>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movl   $0x1388,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x38(%rbp),%rcx
mov    -0x30(%rbp),%r9
mov    -0x18(%rbp),%r10
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
xor    %r8d,%r8d
mov    %r8d,%edx
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <dfs@plt>
mov    -0x30(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsets>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebx
mov    %rdi,%r12
mov    $0x9c40,%edi
call   1030 <malloc@plt>
mov    %rax,%r13
lea    0x0(,%rbx,4),%edi
call   1030 <malloc@plt>
mov    %rax,%rbp
mov    $0x4e20,%edi
call   1030 <malloc@plt>
mov    %rax,(%r14)
movl   $0x0,(%r15)
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %rbp,%rcx
xor    %r8d,%r8d
mov    %r13,%r9
push   %rax
push   %r15
call   1040 <dfs@plt>
add    $0x10,%rsp
mov    %r13,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32** @subsets(i32* %0, i32 %1, i32* %2, i32** %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32**
%9 = alloca i32
%10 = alloca i32**
%11 = alloca i32*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32** %3, i32*** %8
store i32 5000, i32* %9
%12 = load i32, i32* %9
%13 = sext i32 %12 to i64
%14 = mul i64 %13, 8
%15 = trunc i64 %14 to i32
%16 = call i8* @malloc(i32 %15)
%17 = bitcast i8* %16 to i32**
store i32** %17, i32*** %10
%18 = load i32, i32* %6
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = call i8* @malloc(i32 %21)
%23 = bitcast i8* %22 to i32*
store i32* %23, i32** %11
%24 = load i32, i32* %9
%25 = sext i32 %24 to i64
%26 = mul i64 %25, 4
%27 = trunc i64 %26 to i32
%28 = call i8* @malloc(i32 %27)
%29 = bitcast i8* %28 to i32*
%30 = load i32**, i32*** %8
store i32* %29, i32** %30
%31 = load i32*, i32** %7
store i32 0, i32* %31
%32 = load i32*, i32** %5
%33 = load i32, i32* %6
%34 = load i32*, i32** %11
%35 = load i32**, i32*** %10
%36 = load i32*, i32** %7
%37 = load i32**, i32*** %8
%38 = load i32*, i32** %37
%39 = call i32 @dfs(i32* %32, i32 %33, i32 0, i32* %34, i32 0, i32** %35, i32* %36, i32* %38)
%40 = load i32**, i32*** %10
ret i32** %40
}

LLVM IR (-O2):
define i32** @subsets(i32* %0, i32 %1, i32* %2, i32** nocapture writeonly %3) {
%5 = tail call dereferenceable_or_null(40000) i8* @malloc(i32 40000)
%6 = bitcast i8* %5 to i32**
%7 = shl i32 %1, 2
%8 = tail call i8* @malloc(i32 %7)
%9 = bitcast i8* %8 to i32*
%10 = tail call dereferenceable_or_null(20000) i8* @malloc(i32 20000)
%11 = bitcast i32** %3 to i8**
store i8* %10, i8** %11
store i32 0, i32* %2
%12 = bitcast i8* %10 to i32*
%13 = tail call i32 @dfs(i32* %0, i32 %1, i32 0, i32* %9, i32 0, i32** %6, i32* %2, i32* %12)
ret i32** %6
}