#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, int *, int /*<<< orphan*/, int **, int *,
                       int *);
void *malloc(int);
int **combine(int n, int k, int *returnSize, int **returnColumnSizes) {
  int capacity = 10000;
  int **results = malloc(capacity * sizeof(int *));
  int *stack = malloc(k * sizeof(int));
  *returnColumnSizes = malloc(capacity * sizeof(int));
  dfs(n, k, 1, stack, 0, results, returnSize, *returnColumnSizes);
  return results;
}


x86 assembly (clang, -O0):
<combine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x2710,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x1c(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    -0x28(%rbp),%r9
mov    -0x10(%rbp),%r10
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    $0x1,%edx
xor    %r8d,%r8d
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <dfs@plt>
mov    -0x28(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
define i32** @combine(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 10000, 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* %5
%32 = load i32, i32* %6
%33 = load i32*, i32** %11
%34 = load i32**, i32*** %10
%35 = load i32*, i32** %7
%36 = load i32**, i32*** %8
%37 = load i32*, i32** %36
%38 = call i32 @dfs(i32 %31, i32 %32, i32 1, i32* %33, i32 0, i32** %34, i32* %35, i32* %37)
%39 = load i32**, i32*** %10
ret i32** %39
}

LLVM IR (-O2):
define i32** @combine(i32 %0, i32 %1, i32* %2, i32** nocapture writeonly %3) {
%5 = tail call dereferenceable_or_null(80000) i8* @malloc(i32 80000)
%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(40000) i8* @malloc(i32 40000)
%11 = bitcast i8* %10 to i32*
%12 = bitcast i32** %3 to i8**
store i8* %10, i8** %12
%13 = tail call i32 @dfs(i32 %0, i32 %1, i32 1, i32* %9, i32 0, i32** %6, i32* %2, i32* %11)
ret i32** %6
}