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


x86 assembly (clang, -O0):
<partition>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
jne    115e <partition+0x2e>
movq   $0x0,-0x8(%rbp)
jmp    11f3 <partition+0xc3>
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x30(%rbp)
movslq -0x24(%rbp),%rax
shl    $0x3,%rax
mov    %eax,%edi
call   1050 <malloc@plt>
mov    %rax,-0x38(%rbp)
movl   $0xffffffff,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x48(%rbp),%rdi
mov    %eax,%esi
mov    -0x38(%rbp),%rcx
mov    -0x3c(%rbp),%r8d
mov    -0x18(%rbp),%r10
mov    -0x20(%rbp),%rax
xor    %edx,%edx
lea    -0x30(%rbp),%r9
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <traverse@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<partition>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmpb   $0x0,(%rdi)
je     11a9 <partition+0x79>
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <strlen@plt>
mov    %eax,%ebp
movl   $0x0,(%r15)
mov    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,(%r14)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,(%rsp)
shl    $0x3,%ebp
mov    %ebp,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rsp,%r9
mov    %rbx,%rdi
mov    %eax,%esi
xor    %edx,%edx
mov    %rbp,%rcx
mov    $0xffffffff,%r8d
push   %r15
push   %r14
call   1040 <traverse@plt>
add    $0x10,%rsp
mov    (%rsp),%rax
jmp    11ab <partition+0x7b>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

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

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