#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 strlen(char *);
int /*<<< orphan*/ traverse(char *, int, char *, int, char ***, int *);
char **letterCombinations(char *digits, int *returnSize) {
  if (!*digits)
    return NULL;
  char **arr = (char **)malloc(sizeof(char *));
  *returnSize = 0;
  int len = strlen(digits);
  char *stack = (char *)malloc(sizeof(char) * len);
  int top = -1;
  traverse(digits, len, stack, top, &arr, returnSize);
  return arr;
}


x86 assembly (clang, -O0):
<letterCombinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    115a <letterCombinations+0x2a>
movq   $0x0,-0x8(%rbp)
jmp    11bb <letterCombinations+0x8b>
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movl   $0xffffffff,-0x34(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x30(%rbp),%rdx
mov    -0x34(%rbp),%ecx
mov    -0x18(%rbp),%r9
lea    -0x20(%rbp),%r8
call   1040 <traverse@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<letterCombinations>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmpb   $0x0,(%rdi)
je     118b <letterCombinations+0x5b>
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,0x8(%rsp)
movl   $0x0,(%r14)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %eax,%ebp
mov    %eax,%edi
call   1050 <malloc@plt>
lea    0x8(%rsp),%r8
mov    %rbx,%rdi
mov    %ebp,%esi
mov    %rax,%rdx
mov    $0xffffffff,%ecx
mov    %r14,%r9
call   1040 <traverse@plt>
mov    0x8(%rsp),%rax
jmp    118d <letterCombinations+0x5d>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i8** @letterCombinations(i8* %0, i32* %1) {
%3 = alloca i8**
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = bitcast i8*** %3 to i8*
%8 = tail call i64 @malloc(i32 8)
%9 = inttoptr i64 %8 to i8**
store i8** %9, i8*** %3
store i32 0, i32* %1
%10 = tail call i32 @strlen(i8* %0)
%11 = tail call i64 @malloc(i32 %10)
%12 = inttoptr i64 %11 to i8*
%13 = call i32 @traverse(i8* %0, i32 %10, i8* %12, i32 -1, i8*** %3, i32* %1)
%14 = load i8**, i8*** %3
br label %15
15: ; preds = %2, %6
%16 = phi i8** [ %14, %6 ], [ null, %2 ]
ret i8** %16
}