#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 */
struct TreeNode {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ f(struct TreeNode *, int /*<<< orphan*/, int, int ***,
                     int **, int *, int **, int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int /*<<< orphan*/);
int **pathSum(struct TreeNode *root, int sum, int **columnSizes,
              int *returnSize) {
  int **ret = (int **)malloc(0), *ns = (int *)malloc(0);
  *returnSize = 0;
  *columnSizes = (int *)malloc(0);
  if (!root)
    return ret;
  f(root, 0, sum, &ret, columnSizes, returnSize, &ns, 0);
  free(ns);
  return ret;
}


x86 assembly (clang, -O0):
<pathSum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
movl   $0x0,(%rax)
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
cmpq   $0x0,-0x10(%rbp)
jne    1190 <pathSum+0x60>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cb <pathSum+0x9b>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%r8
mov    -0x28(%rbp),%r9
xor    %esi,%esi
lea    -0x30(%rbp),%rcx
lea    -0x38(%rbp),%rax
mov    %rax,(%rsp)
movl   $0x0,0x8(%rsp)
call   1040 <f@plt>
mov    -0x38(%rbp),%rdi
call   1030 <free@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pathSum>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %esi,%r15d
mov    %rdi,%rbp
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,0x8(%rsp)
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
movl   $0x0,(%r14)
xor    %edi,%edi
call   1050 <malloc@plt>
mov    %rax,(%r12)
test   %rbp,%rbp
je     11a9 <pathSum+0x79>
mov    %rsp,%rax
lea    0x8(%rsp),%rcx
mov    %rbp,%rdi
xor    %esi,%esi
mov    %r15d,%edx
mov    %r12,%r8
mov    %r14,%r9
push   $0x0
push   %rax
call   1040 <f@plt>
add    $0x10,%rsp
mov    (%rsp),%rdi
call   1030 <free@plt>
mov    0x8(%rsp),%rbx
mov    %rbx,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.TreeNode = type { i32 }
define i32** @pathSum(%struct.TreeNode* %0, i32 %1, i32** %2, i32* %3) {
%5 = alloca i32**
%6 = alloca %struct.TreeNode*
%7 = alloca i32
%8 = alloca i32**
%9 = alloca i32*
%10 = alloca i32**
%11 = alloca i32*
store %struct.TreeNode* %0, %struct.TreeNode** %6
store i32 %1, i32* %7
store i32** %2, i32*** %8
store i32* %3, i32** %9
%12 = call i64 @malloc(i32 0)
%13 = inttoptr i64 %12 to i32**
store i32** %13, i32*** %10
%14 = call i64 @malloc(i32 0)
%15 = inttoptr i64 %14 to i32*
store i32* %15, i32** %11
%16 = load i32*, i32** %9
store i32 0, i32* %16
%17 = call i64 @malloc(i32 0)
%18 = inttoptr i64 %17 to i32*
%19 = load i32**, i32*** %8
store i32* %18, i32** %19
%20 = load %struct.TreeNode*, %struct.TreeNode** %6
%21 = icmp ne %struct.TreeNode* %20, null
br i1 %21, label %24, label %22
22: ; preds = %4
%23 = load i32**, i32*** %10
store i32** %23, i32*** %5
br label %33
24: ; preds = %4
%25 = load %struct.TreeNode*, %struct.TreeNode** %6
%26 = load i32, i32* %7
%27 = load i32**, i32*** %8
%28 = load i32*, i32** %9
%29 = call i32 @f(%struct.TreeNode* %25, i32 0, i32 %26, i32*** %10, i32** %27, i32* %28, i32** %11, i32 0)
%30 = load i32*, i32** %11
%31 = call i32 @free(i32* %30)
%32 = load i32**, i32*** %10
store i32** %32, i32*** %5
br label %33
33: ; preds = %24, %22
%34 = load i32**, i32*** %5
ret i32** %34
}

LLVM IR (-O2):
%struct.TreeNode = type { i32 }
define i32** @pathSum(%struct.TreeNode* %0, i32 %1, i32** %2, i32* %3) {
%5 = alloca i32**
%6 = alloca i32*
%7 = bitcast i32*** %5 to i8*
%8 = tail call i64 @malloc(i32 0)
%9 = inttoptr i64 %8 to i32**
store i32** %9, i32*** %5
%10 = bitcast i32** %6 to i8*
%11 = tail call i64 @malloc(i32 0)
%12 = inttoptr i64 %11 to i32*
store i32* %12, i32** %6
store i32 0, i32* %3
%13 = tail call i64 @malloc(i32 0)
%14 = inttoptr i64 %13 to i32*
store i32* %14, i32** %2
%15 = icmp eq %struct.TreeNode* %0, null
br i1 %15, label %21, label %16
16: ; preds = %4
%17 = call i32 @f(%struct.TreeNode* %0, i32 0, i32 %1, i32*** %5, i32** %2, i32* %3, i32** %6, i32 0)
%18 = load i32*, i32** %6
%19 = call i32 @free(i32* %18)
%20 = load i32**, i32*** %5
br label %21
21: ; preds = %4, %16
%22 = phi i32** [ %9, %4 ], [ %20, %16 ]
ret i32** %22
}