#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 *,
                       int /*<<< orphan*/, int **, int *, int *);
void *malloc(int);
int **combinationSum3(int k, int n, int *returnSize, int **returnColumnSizes) {
  int i, count = 9;
  int *nums = malloc(count * sizeof(int));
  for (i = 0; i < count; i++) {
    nums[i] = i + 1;
  }
  int *solution = malloc(k * sizeof(int));
  int **results = malloc(100 * sizeof(int *));
  *returnColumnSizes = malloc(100 * sizeof(int));
  *returnSize = 0;
  dfs(nums, count, 0, n, k, solution, 0, results, returnSize,
      *returnColumnSizes);
  return results;
}


x86 assembly (clang, -O0):
<combinationSum3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x9,-0x20(%rbp)
movslq -0x20(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jge    1182 <combinationSum3+0x62>
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1157 <combinationSum3+0x37>
movslq -0x4(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x320,%edi
call   1030 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    $0x190,%edi
call   1030 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x8(%rbp),%ecx
mov    -0x4(%rbp),%r8d
mov    -0x30(%rbp),%r9
mov    -0x38(%rbp),%r11
mov    -0x10(%rbp),%r10
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
xor    %edx,%edx
movl   $0x0,(%rsp)
mov    %r11,0x8(%rsp)
mov    %r10,0x10(%rsp)
mov    %rax,0x18(%rsp)
call   1040 <dfs@plt>
mov    -0x38(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combinationSum3>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r12
mov    %esi,0x4(%rsp)
mov    %edi,%ebp
mov    $0x24,%edi
call   1030 <malloc@plt>
mov    %rax,%rbx
movaps 0xeb5(%rip),%xmm0
movups %xmm0,(%rax)
movaps 0xebb(%rip),%xmm0
movups %xmm0,0x10(%rax)
movl   $0x9,0x20(%rax)
lea    0x0(,%rbp,4),%edi
call   1030 <malloc@plt>
mov    %rax,%r13
mov    $0x320,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
mov    $0x190,%edi
call   1030 <malloc@plt>
mov    %rax,(%r15)
movl   $0x0,(%r12)
mov    %rbx,%rdi
mov    $0x9,%esi
xor    %edx,%edx
mov    0x4(%rsp),%ecx
mov    %ebp,%r8d
mov    %r13,%r9
push   %rax
push   %r12
push   %r14
push   $0x0
call   1040 <dfs@plt>
add    $0x20,%rsp
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32** @combinationSum3(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*
%12 = alloca i32*
%13 = alloca i32**
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32** %3, i32*** %8
store i32 9, i32* %10
%14 = load i32, i32* %10
%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** %11
store i32 0, i32* %9
br label %20
20: ; preds = %31, %4
%21 = load i32, i32* %9
%22 = load i32, i32* %10
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %34
24: ; preds = %20
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
%27 = load i32*, i32** %11
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
store i32 %26, i32* %30
br label %31
31: ; preds = %24
%32 = load i32, i32* %9
%33 = add nsw i32 %32, 1
store i32 %33, i32* %9
br label %20
34: ; preds = %20
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = mul i64 %36, 4
%38 = trunc i64 %37 to i32
%39 = call i8* @malloc(i32 %38)
%40 = bitcast i8* %39 to i32*
store i32* %40, i32** %12
%41 = call i8* @malloc(i32 800)
%42 = bitcast i8* %41 to i32**
store i32** %42, i32*** %13
%43 = call i8* @malloc(i32 400)
%44 = bitcast i8* %43 to i32*
%45 = load i32**, i32*** %8
store i32* %44, i32** %45
%46 = load i32*, i32** %7
store i32 0, i32* %46
%47 = load i32*, i32** %11
%48 = load i32, i32* %10
%49 = load i32, i32* %6
%50 = load i32, i32* %5
%51 = load i32*, i32** %12
%52 = load i32**, i32*** %13
%53 = load i32*, i32** %7
%54 = load i32**, i32*** %8
%55 = load i32*, i32** %54
%56 = call i32 @dfs(i32* %47, i32 %48, i32 0, i32 %49, i32 %50, i32* %51, i32 0, i32** %52, i32* %53, i32* %55)
%57 = load i32**, i32*** %13
ret i32** %57
}

LLVM IR (-O2):
define i32** @combinationSum3(i32 %0, i32 %1, i32* %2, i32** nocapture writeonly %3) {
%5 = tail call dereferenceable_or_null(36) i8* @malloc(i32 36)
%6 = bitcast i8* %5 to i32*
%7 = bitcast i8* %5 to <4 x i32>*
store <4 x i32> <i32 1, i32 2, i32 3, i32 4>, <4 x i32>* %7
%8 = getelementptr inbounds i32, i32* %6, i64 4
%9 = bitcast i32* %8 to <4 x i32>*
store <4 x i32> <i32 5, i32 6, i32 7, i32 8>, <4 x i32>* %9
%10 = getelementptr inbounds i32, i32* %6, i64 8
store i32 9, i32* %10
%11 = shl i32 %0, 2
%12 = tail call i8* @malloc(i32 %11)
%13 = bitcast i8* %12 to i32*
%14 = tail call dereferenceable_or_null(800) i8* @malloc(i32 800)
%15 = bitcast i8* %14 to i32**
%16 = tail call dereferenceable_or_null(400) i8* @malloc(i32 400)
%17 = bitcast i32** %3 to i8**
store i8* %16, i8** %17
store i32 0, i32* %2
%18 = bitcast i8* %16 to i32*
%19 = tail call i32 @dfs(i32* %6, i32 9, i32 0, i32 %1, i32 %0, i32* %13, i32 0, i32** %15, i32* %2, i32* %18)
ret i32** %15
}