#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ search(int *, int, int /*<<< orphan*/, int *, int, int **,
                          int *, int ***);
int /*<<< orphan*/ sort(int *, int /*<<< orphan*/, int);
int **subsetsWithDup(int *nums, int size, int **columnSizes, int *returnSize) {
  sort(nums, 0, size - 1);
  *columnSizes = (int *)malloc(sizeof(int));
  int **table = (int **)malloc(sizeof(int *));
  int *stack = (int *)malloc(sizeof(int) * size);
  int top = -1;
  search(nums, size, 0, stack, top, columnSizes, returnSize, &table);
  return table;
}


x86 assembly (clang, -O0):
<subsetsWithDup>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1030 <sort@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movslq -0xc(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x30(%rbp),%rcx
mov    -0x34(%rbp),%r8d
mov    -0x18(%rbp),%r9
mov    -0x20(%rbp),%r10
xor    %edx,%edx
lea    -0x28(%rbp),%rax
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <search@plt>
mov    -0x28(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<subsetsWithDup>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r15
mov    %esi,%ebx
mov    %rdi,%r12
lea    -0x1(%rbx),%edx
xor    %esi,%esi
call   1030 <sort@plt>
mov    $0x4,%edi
call   1050 <malloc@plt>
mov    %rax,(%r15)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
lea    0x0(,%rbx,4),%edi
call   1050 <malloc@plt>
mov    %rsp,%r10
mov    %r12,%rdi
mov    %ebx,%esi
xor    %edx,%edx
mov    %rax,%rcx
mov    $0xffffffff,%r8d
mov    %r15,%r9
push   %r10
push   %r14
call   1040 <search@plt>
add    $0x10,%rsp
mov    (%rsp),%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

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