#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 *malloc(int);
int /*<<< orphan*/ memcpy(int *, int *, int);
void dfs(int *nums, int size, int start, int *stack, int len, int **sets,
         int *count, int *sizes) {
  int i;
  sets[*count] = malloc(len * sizeof(int));
  memcpy(sets[*count], stack, len * sizeof(int));
  sizes[*count] = len;
  (*count)++;
  for (i = start; i < size; i++) {
    stack[len] = nums[i];
    dfs(nums, size, i + 1, stack, len + 1, sets, count, sizes);
  }
}


x86 assembly (clang, -O0):
<dfs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
mov    %r9,-0x28(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,%rdx
mov    -0x28(%rbp),%rax
mov    0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x28(%rbp),%rax
mov    0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x18(%rbp),%rsi
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edx
call   1030 <memcpy@plt>
mov    -0x1c(%rbp),%edx
mov    0x18(%rbp),%rax
mov    0x10(%rbp),%rcx
movslq (%rcx),%rcx
mov    %edx,(%rax,%rcx,4)
mov    0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    121e <dfs+0xee>
mov    -0x8(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x2c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
add    $0x1,%r8d
mov    -0x28(%rbp),%r9
mov    0x10(%rbp),%r10
mov    0x18(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1050 <dfs@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11bb <dfs+0x8b>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dfs>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
mov    %r9,%rbx
mov    %r8d,%r15d
mov    %rcx,%r13
mov    %edx,%ebp
mov    %esi,%r12d
mov    %rdi,%r14
lea    0x0(,%r15,4),%edi
mov    %edi,0x4(%rsp)
call   1040 <malloc@plt>
mov    0x60(%rsp),%rcx
movslq (%rcx),%rcx
mov    %rbx,0x20(%rsp)
mov    %rax,(%rbx,%rcx,8)
mov    %rax,%rdi
mov    %r13,%rsi
mov    0x4(%rsp),%edx
call   1030 <memcpy@plt>
mov    0x60(%rsp),%r10
mov    0x68(%rsp),%rbx
movslq (%r10),%rax
mov    %r15d,(%rbx,%rax,4)
addl   $0x1,(%r10)
mov    %r12d,0x4(%rsp)
cmp    %r12d,%ebp
jge    1214 <dfs+0xe4>
mov    %r15,%rcx
movslq %ecx,%rax
mov    %rax,0x10(%rsp)
add    $0x1,%ecx
mov    %rcx,0x18(%rsp)
movslq %ebp,%r12
movslq 0x4(%rsp),%rax
mov    %rax,0x8(%rsp)
add    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    (%r14,%r12,4),%eax
mov    0x10(%rsp),%rcx
mov    %eax,0x0(%r13,%rcx,4)
add    $0x1,%r12
mov    %r14,%rdi
mov    0x4(%rsp),%esi
mov    %ebp,%edx
mov    %r13,%rcx
mov    0x18(%rsp),%r8
mov    0x20(%rsp),%r9
push   %rbx
push   %r10
mov    %r10,%r15
call   1050 <dfs@plt>
mov    %r15,%r10
add    $0x10,%rsp
add    $0x1,%ebp
cmp    %r12,0x8(%rsp)
jne    11d0 <dfs+0xa0>
add    $0x28,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @dfs(i32* %0, i32 %1, i32 %2, i32* %3, i32 %4, i32** %5, i32* %6, i32* %7) {
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
%14 = alloca i32**
%15 = alloca i32*
%16 = alloca i32*
%17 = alloca i32
store i32* %0, i32** %9
store i32 %1, i32* %10
store i32 %2, i32* %11
store i32* %3, i32** %12
store i32 %4, i32* %13
store i32** %5, i32*** %14
store i32* %6, i32** %15
store i32* %7, i32** %16
%18 = load i32, i32* %13
%19 = sext i32 %18 to i64
%20 = mul i64 %19, 4
%21 = trunc i64 %20 to i32
%22 = call i32* @malloc(i32 %21)
%23 = load i32**, i32*** %14
%24 = load i32*, i32** %15
%25 = load i32, i32* %24
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i32*, i32** %23, i64 %26
store i32* %22, i32** %27
%28 = load i32**, i32*** %14
%29 = load i32*, i32** %15
%30 = load i32, i32* %29
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i32*, i32** %28, i64 %31
%33 = load i32*, i32** %32
%34 = load i32*, i32** %12
%35 = load i32, i32* %13
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 4
%38 = trunc i64 %37 to i32
%39 = call i32 @memcpy(i32* %33, i32* %34, i32 %38)
%40 = load i32, i32* %13
%41 = load i32*, i32** %16
%42 = load i32*, i32** %15
%43 = load i32, i32* %42
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %41, i64 %44
store i32 %40, i32* %45
%46 = load i32*, i32** %15
%47 = load i32, i32* %46
%48 = add nsw i32 %47, 1
store i32 %48, i32* %46
%49 = load i32, i32* %11
store i32 %49, i32* %17
br label %50
50: ; preds = %74, %8
%51 = load i32, i32* %17
%52 = load i32, i32* %10
%53 = icmp slt i32 %51, %52
br i1 %53, label %54, label %77
54: ; preds = %50
%55 = load i32*, i32** %9
%56 = load i32, i32* %17
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds i32, i32* %55, i64 %57
%59 = load i32, i32* %58
%60 = load i32*, i32** %12
%61 = load i32, i32* %13
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i32, i32* %60, i64 %62
store i32 %59, i32* %63
%64 = load i32*, i32** %9
%65 = load i32, i32* %10
%66 = load i32, i32* %17
%67 = add nsw i32 %66, 1
%68 = load i32*, i32** %12
%69 = load i32, i32* %13
%70 = add nsw i32 %69, 1
%71 = load i32**, i32*** %14
%72 = load i32*, i32** %15
%73 = load i32*, i32** %16
br label %74
74: ; preds = %54
%75 = load i32, i32* %17
%76 = add nsw i32 %75, 1
store i32 %76, i32* %17
br label %50
77: ; preds = %50
ret void
}

LLVM IR (-O2):
define void @dfs(i32* nocapture %0, i32 %1, i32 %2, i32* %3, i32 %4, i32** nocapture %5, i32* nocapture %6, i32* nocapture writeonly %7) {
%9 = shl i32 %4, 2
%10 = tail call i32* @malloc(i32 %9)
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i32*, i32** %5, i64 %12
store i32* %10, i32** %13
%14 = tail call i32 @memcpy(i32* %10, i32* %3, i32 %9)
%15 = load i32, i32* %6
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i32, i32* %7, i64 %16
store i32 %4, i32* %17
%18 = load i32, i32* %6
%19 = add nsw i32 %18, 1
store i32 %19, i32* %6
%20 = icmp slt i32 %2, %1
br i1 %20, label %21, label %34
21: ; preds = %8
%22 = sext i32 %4 to i64
%23 = getelementptr inbounds i32, i32* %3, i64 %22
%24 = add nsw i32 %4, 1
%25 = sext i32 %2 to i64
%26 = sext i32 %1 to i64
br label %27
27: ; preds = %21, %27
%28 = phi i64 [ %25, %21 ], [ %31, %27 ]
%29 = getelementptr inbounds i32, i32* %0, i64 %28
%30 = load i32, i32* %29
store i32 %30, i32* %23
%31 = add nsw i64 %28, 1
%32 = trunc i64 %31 to i32
tail call void @dfs(i32* %0, i32 %1, i32 %32, i32* %3, i32 %24, i32** %5, i32* %6, i32* %7)
%33 = icmp eq i64 %31, %26
br i1 %33, label %34, label %27
34: ; preds = %27, %8
ret void
}