#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 */
char *strtok(char *, char *);
int parseString(char *inString, char *inDelimiters, char **outStrings) {
  char *token;
  token = strtok(inString, inDelimiters);
  int i = 0;
  while (token != NULL) {
    outStrings[i] = token;
    token = strtok(NULL, inDelimiters);
    i++;
  }
  return i;
}


x86 assembly (clang, -O0):
<parseString>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strtok@plt>
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x24(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     1176 <parseString+0x66>
mov    -0x20(%rbp),%rdx
mov    -0x18(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <strtok@plt>
mov    %rax,-0x20(%rbp)
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    113c <parseString+0x2c>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseString>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
call   1030 <strtok@plt>
xor    %ebx,%ebx
test   %rax,%rax
je     1147 <parseString+0x37>
nopw   0x0(%rax,%rax,1)
mov    %rax,(%r14,%rbx,8)
xor    %edi,%edi
mov    %r15,%rsi
call   1030 <strtok@plt>
add    $0x1,%rbx
test   %rax,%rax
jne    1130 <parseString+0x20>
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i32 @parseString(i8* %0, i8* %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = call i8* @strtok(i8* %9, i8* %10)
store i8* %11, i8** %7
store i32 0, i32* %8
br label %12
12: ; preds = %15, %3
%13 = load i8*, i8** %7
%14 = icmp ne i8* %13, null
br i1 %14, label %15, label %25
15: ; preds = %12
%16 = load i8*, i8** %7
%17 = load i8**, i8*** %6
%18 = load i32, i32* %8
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8*, i8** %17, i64 %19
store i8* %16, i8** %20
%21 = load i8*, i8** %5
%22 = call i8* @strtok(i8* null, i8* %21)
store i8* %22, i8** %7
%23 = load i32, i32* %8
%24 = add nsw i32 %23, 1
store i32 %24, i32* %8
br label %12
25: ; preds = %12
%26 = load i32, i32* %8
ret i32 %26
}

LLVM IR (-O2):
define i32 @parseString(i8* %0, i8* nocapture %1, i8** nocapture writeonly %2) {
%4 = tail call i8* @strtok(i8* %0, i8* %1)
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %6
6: ; preds = %3, %6
%7 = phi i64 [ %11, %6 ], [ 0, %3 ]
%8 = phi i8* [ %10, %6 ], [ %4, %3 ]
%9 = getelementptr inbounds i8*, i8** %2, i64 %7
store i8* %8, i8** %9
%10 = tail call i8* @strtok(i8* null, i8* %1)
%11 = add nuw i64 %7, 1
%12 = icmp eq i8* %10, null
br i1 %12, label %13, label %6
13: ; preds = %6
%14 = trunc i64 %11 to i32
br label %15
15: ; preds = %13, %3
%16 = phi i32 [ 0, %3 ], [ %14, %13 ]
ret i32 %16
}