#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*/ helper(int *, int, int /*<<< orphan*/, int, int *, int,
                          int ***, int **, int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int);
int **combinationSum2(int *nums, int size, int target, int **colSizes,
                      int *returnSize) {
  sort(nums, 0, size - 1);
  int **arr = (int **)malloc(sizeof(int *));
  *returnSize = 0;
  int *stack = (int *)malloc(sizeof(int) * (target / nums[0] + 1));
  int top = -1;
  helper(nums, size, 0, target, stack, top, &arr, colSizes, returnSize);
  return arr;
}


x86 assembly (clang, -O0):
<combinationSum2>:
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)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <sort@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
cltd
idivl  (%rcx)
add    $0x1,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%ecx
mov    -0x30(%rbp),%r8
mov    -0x34(%rbp),%r9d
mov    -0x18(%rbp),%r10
mov    -0x20(%rbp),%rax
xor    %edx,%edx
lea    -0x28(%rbp),%r11
mov    %r11,(%rsp)
mov    %r10,0x8(%rsp)
mov    %rax,0x10(%rsp)
call   1050 <helper@plt>
mov    -0x28(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<combinationSum2>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %r8,%r15
mov    %rcx,%r14
mov    %edx,%r12d
mov    %esi,%ebx
mov    %rdi,%rbp
lea    -0x1(%rbx),%edx
xor    %esi,%esi
call   1030 <sort@plt>
mov    $0x8,%edi
call   1040 <malloc@plt>
mov    %rax,0x8(%rsp)
movl   $0x0,(%r15)
mov    %r12d,%eax
cltd
idivl  0x0(%rbp)
lea    0x4(,%rax,4),%edi
call   1040 <malloc@plt>
sub    $0x8,%rsp
lea    0x10(%rsp),%r10
mov    %rbp,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %r12d,%ecx
mov    %rax,%r8
mov    $0xffffffff,%r9d
push   %r15
push   %r14
push   %r10
call   1050 <helper@plt>
add    $0x20,%rsp
mov    0x8(%rsp),%rax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32** @combinationSum2(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
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = sub nsw i32 %15, 1
%17 = call i32 @sort(i32* %14, i32 0, i32 %16)
%18 = call i64 @malloc(i32 8)
%19 = inttoptr i64 %18 to i32**
store i32** %19, i32*** %11
%20 = load i32*, i32** %10
store i32 0, i32* %20
%21 = load i32, i32* %8
%22 = load i32*, i32** %6
%23 = getelementptr inbounds i32, i32* %22, i64 0
%24 = load i32, i32* %23
%25 = sdiv i32 %21, %24
%26 = add nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = mul i64 4, %27
%29 = trunc i64 %28 to i32
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i32*
store i32* %31, i32** %12
store i32 -1, i32* %13
%32 = load i32*, i32** %6
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = load i32*, i32** %12
%36 = load i32, i32* %13
%37 = load i32**, i32*** %9
%38 = load i32*, i32** %10
%39 = call i32 @helper(i32* %32, i32 %33, i32 0, i32 %34, i32* %35, i32 %36, i32*** %11, i32** %37, i32* %38)
%40 = load i32**, i32*** %11
ret i32** %40
}

LLVM IR (-O2):
define i32** @combinationSum2(i32* %0, i32 %1, i32 %2, i32** %3, i32* %4) {
%6 = alloca i32**
%7 = add nsw i32 %1, -1
%8 = tail call i32 @sort(i32* %0, i32 0, i32 %7)
%9 = bitcast i32*** %6 to i8*
%10 = tail call i64 @malloc(i32 8)
%11 = inttoptr i64 %10 to i32**
store i32** %11, i32*** %6
store i32 0, i32* %4
%12 = load i32, i32* %0
%13 = sdiv i32 %2, %12
%14 = shl i32 %13, 2
%15 = add i32 %14, 4
%16 = tail call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i32*
%18 = call i32 @helper(i32* %0, i32 %1, i32 0, i32 %2, i32* %17, i32 -1, i32*** %6, i32** %3, i32* %4)
%19 = load i32**, i32*** %6
ret i32** %19
}