#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 *,
                       int /*<<< orphan*/, int **, int *, int *);
void *malloc(int);
int **combinationSum(int *candidates, int candidatesSize, int target,
                     int *returnSize, int **returnColumnSizes) {
  int cap = 200;
  int *stack = malloc(cap * sizeof(int));
  int **results = malloc(cap * sizeof(int *));
  *returnColumnSizes = malloc(cap * sizeof(int));
  *returnSize = 0;
  dfs(candidates, candidatesSize, 0, target, stack, 0, results, returnSize,
      *returnColumnSizes);
  return results;
}


x86 assembly (clang, -O0):
<combinationSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
movl   $0xc8,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x3,%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    -0x10(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x38(%rbp),%r11
mov    -0x18(%rbp),%r10
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
xor    %r9d,%r9d
mov    %r9d,%edx
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1040 <dfs@plt>
mov    -0x38(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combinationSum>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8,%r14
mov    %rcx,%rbx
mov    %edx,0x4(%rsp)
mov    %esi,%r12d
mov    %rdi,%r13
mov    $0x320,%edi
call   1030 <malloc@plt>
mov    %rax,%rbp
mov    $0x640,%edi
call   1030 <malloc@plt>
mov    %rax,%r15
mov    $0x320,%edi
call   1030 <malloc@plt>
mov    %rax,(%r14)
movl   $0x0,(%rbx)
sub    $0x8,%rsp
mov    %r13,%rdi
mov    %r12d,%esi
xor    %edx,%edx
mov    0xc(%rsp),%ecx
mov    %rbp,%r8
xor    %r9d,%r9d
push   %rax
push   %rbx
push   %r15
call   1040 <dfs@plt>
add    $0x20,%rsp
mov    %r15,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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