#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 stCountTokens(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok(char *, char *);
void stTokenize(char *inputString, char *delimiter, char ***tokenString) {
  int i;
  char tempString[strlen(inputString)];
  int count = stCountTokens(inputString, delimiter);
  char *tempPointer = NULL;
  *tokenString = (char **)malloc(sizeof(char *) * (count + 1));
  strcpy(tempString, inputString);
  tempPointer = strtok(tempString, delimiter);
  (*tokenString)[0] = (char *)malloc(sizeof(char) * (strlen(tempPointer) + 1));
  strcpy((*tokenString)[0], tempPointer);
  for (i = 1; i < count; i++) {
    tempPointer = strtok(NULL, delimiter);
    (*tokenString)[i] =
        (char *)malloc(sizeof(char) * (strlen(tempPointer) + 1));
    strcpy((*tokenString)[i], tempPointer);
  }
}


x86 assembly (clang, -O0):
<stTokenize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x48(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <stCountTokens@plt>
mov    %eax,-0x34(%rbp)
movq   $0x0,-0x40(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    -0x48(%rbp),%rdi
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x48(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <strtok@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    %rcx,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    1293 <stTokenize+0x143>
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1070 <strtok@plt>
mov    %rax,-0x40(%rbp)
mov    -0x40(%rbp),%rdi
call   1040 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   1060 <malloc@plt>
mov    %rax,%rdx
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x18(%rbp),%rax
mov    (%rax),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
mov    -0x40(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1225 <stTokenize+0xd5>
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<stTokenize>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r15
mov    %rsi,%r14
mov    %rdi,%r12
call   1040 <strlen@plt>
mov    %eax,%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
mov    %r12,%rdi
mov    %r14,%rsi
call   1050 <stCountTokens@plt>
mov    %eax,%ebx
lea    0x8(,%rbx,8),%edi
call   1060 <malloc@plt>
mov    %rax,(%r15)
mov    %r13,%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
mov    %r13,%rdi
mov    %r14,%rsi
call   1070 <strtok@plt>
mov    %rax,%r12
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    (%r15),%rcx
mov    %rax,(%rcx)
mov    (%r15),%rax
mov    (%rax),%rdi
mov    %r12,%rsi
call   1030 <strcpy@plt>
cmp    $0x2,%ebx
jl     122c <stTokenize+0xdc>
mov    %ebx,%r12d
mov    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %edi,%edi
mov    %r14,%rsi
call   1070 <strtok@plt>
mov    %rax,%r13
mov    %rax,%rdi
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1060 <malloc@plt>
mov    (%r15),%rcx
mov    %rax,(%rcx,%rbx,8)
mov    (%r15),%rax
mov    (%rax,%rbx,8),%rdi
mov    %r13,%rsi
call   1030 <strcpy@plt>
add    $0x1,%rbx
cmp    %rbx,%r12
jne    11f0 <stTokenize+0xa0>
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @stTokenize(i8* %0, i8* %1, i8*** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8***
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
%11 = alloca i8*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8*** %2, i8**** %6
%12 = load i8*, i8** %4
%13 = call i32 @strlen(i8* %12)
%14 = zext i32 %13 to i64
%15 = call i8* @llvm.stacksave()
store i8* %15, i8** %8
%16 = alloca i8, i64 %14
store i64 %14, i64* %9
%17 = load i8*, i8** %4
%18 = load i8*, i8** %5
%19 = call i32 @stCountTokens(i8* %17, i8* %18)
store i32 %19, i32* %10
store i8* null, i8** %11
%20 = load i32, i32* %10
%21 = add nsw i32 %20, 1
%22 = sext i32 %21 to i64
%23 = mul i64 8, %22
%24 = trunc i64 %23 to i32
%25 = call i64 @malloc(i32 %24)
%26 = inttoptr i64 %25 to i8**
%27 = load i8***, i8**** %6
store i8** %26, i8*** %27
%28 = load i8*, i8** %4
%29 = call i32 @strcpy(i8* %16, i8* %28)
%30 = load i8*, i8** %5
%31 = call i8* @strtok(i8* %16, i8* %30)
store i8* %31, i8** %11
%32 = load i8*, i8** %11
%33 = call i32 @strlen(i8* %32)
%34 = add nsw i32 %33, 1
%35 = sext i32 %34 to i64
%36 = mul i64 1, %35
%37 = trunc i64 %36 to i32
%38 = call i64 @malloc(i32 %37)
%39 = inttoptr i64 %38 to i8*
%40 = load i8***, i8**** %6
%41 = load i8**, i8*** %40
%42 = getelementptr inbounds i8*, i8** %41, i64 0
store i8* %39, i8** %42
%43 = load i8***, i8**** %6
%44 = load i8**, i8*** %43
%45 = getelementptr inbounds i8*, i8** %44, i64 0
%46 = load i8*, i8** %45
%47 = load i8*, i8** %11
%48 = call i32 @strcpy(i8* %46, i8* %47)
store i32 1, i32* %7
br label %49
49: ; preds = %77, %3
%50 = load i32, i32* %7
%51 = load i32, i32* %10
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %80
53: ; preds = %49
%54 = load i8*, i8** %5
%55 = call i8* @strtok(i8* null, i8* %54)
store i8* %55, i8** %11
%56 = load i8*, i8** %11
%57 = call i32 @strlen(i8* %56)
%58 = add nsw i32 %57, 1
%59 = sext i32 %58 to i64
%60 = mul i64 1, %59
%61 = trunc i64 %60 to i32
%62 = call i64 @malloc(i32 %61)
%63 = inttoptr i64 %62 to i8*
%64 = load i8***, i8**** %6
%65 = load i8**, i8*** %64
%66 = load i32, i32* %7
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
store i8* %63, i8** %68
%69 = load i8***, i8**** %6
%70 = load i8**, i8*** %69
%71 = load i32, i32* %7
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds i8*, i8** %70, i64 %72
%74 = load i8*, i8** %73
%75 = load i8*, i8** %11
%76 = call i32 @strcpy(i8* %74, i8* %75)
br label %77
77: ; preds = %53
%78 = load i32, i32* %7
%79 = add nsw i32 %78, 1
store i32 %79, i32* %7
br label %49
80: ; preds = %49
%81 = load i8*, i8** %8
ret void
}

LLVM IR (-O2):
define void @stTokenize(i8* %0, i8* %1, i8*** nocapture %2) {
%4 = tail call i32 @strlen(i8* %0)
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = tail call i32 @stCountTokens(i8* %0, i8* %1)
%8 = shl i32 %7, 3
%9 = add i32 %8, 8
%10 = tail call i64 @malloc(i32 %9)
%11 = inttoptr i64 %10 to i8**
store i8** %11, i8*** %2
%12 = call i32 @strcpy(i8* %6, i8* %0)
%13 = call i8* @strtok(i8* %6, i8* %1)
%14 = call i32 @strlen(i8* %13)
%15 = add nsw i32 %14, 1
%16 = call i64 @malloc(i32 %15)
%17 = inttoptr i64 %16 to i8*
%18 = load i8**, i8*** %2
store i8* %17, i8** %18
%19 = load i8**, i8*** %2
%20 = load i8*, i8** %19
%21 = call i32 @strcpy(i8* %20, i8* %13)
%22 = icmp sgt i32 %7, 1
br i1 %22, label %23, label %40
23: ; preds = %3
%24 = zext i32 %7 to i64
br label %25
25: ; preds = %23, %25
%26 = phi i64 [ 1, %23 ], [ %38, %25 ]
%27 = call i8* @strtok(i8* null, i8* %1)
%28 = call i32 @strlen(i8* %27)
%29 = add nsw i32 %28, 1
%30 = call i64 @malloc(i32 %29)
%31 = inttoptr i64 %30 to i8*
%32 = load i8**, i8*** %2
%33 = getelementptr inbounds i8*, i8** %32, i64 %26
store i8* %31, i8** %33
%34 = load i8**, i8*** %2
%35 = getelementptr inbounds i8*, i8** %34, i64 %26
%36 = load i8*, i8** %35
%37 = call i32 @strcpy(i8* %36, i8* %27)
%38 = add nuw nsw i64 %26, 1
%39 = icmp eq i64 %38, %24
br i1 %39, label %40, label %25
40: ; preds = %25, %3
ret void
}