int main() {
  char **tokens = tokenize("1,w,n,c,w,n,c,h,w,2,3,4", ",", 10);
  char **it;
  for (it = tokens; it && *it; ++it) {
    printf("%s\n", *it);
    free(*it);
  }
  free(tokens);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xecb(%rip),%rsi
mov    $0xa,%edx
mov    $0x0,%al
call   1050 <tokenize@plt>
cltq
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x18(%rbp)
mov    %al,-0x19(%rbp)
je     1185 <main+0x55>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
setne  %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    1195 <main+0x65>
jmp    11c7 <main+0x97>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x18(%rbp)
jmp    1167 <main+0x37>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
lea    0xec5(%rip),%rdi
lea    0xed6(%rip),%rsi
mov    $0xa,%edx
xor    %eax,%eax
call   1050 <tokenize@plt>
movslq %eax,%r14
test   %r14d,%r14d
je     118a <main+0x5a>
mov    (%r14),%rdi
test   %rdi,%rdi
je     118a <main+0x5a>
lea    0x8(%r14),%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
call   1040 <puts@plt>
mov    -0x8(%rbx),%rdi
call   1030 <free@plt>
mov    (%rbx),%rdi
add    $0x8,%rbx
test   %rdi,%rdi
jne    1170 <main+0x40>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [24 x i8] c"1,w,n,c,w,n,c,h,w,2,3,4\00"
@.str.1 = [2 x i8] c",\00"
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8**
%3 = alloca i8**
store i32 0, i32* %1
%4 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @tokenize to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 10)
%5 = sext i32 %4 to i64
%6 = inttoptr i64 %5 to i8**
store i8** %6, i8*** %2
%7 = load i8**, i8*** %2
store i8** %7, i8*** %3
br label %8
8: ; preds = %23, %0
%9 = load i8**, i8*** %3
%10 = icmp ne i8** %9, null
br i1 %10, label %11, label %15
11: ; preds = %8
%12 = load i8**, i8*** %3
%13 = load i8*, i8** %12
%14 = icmp ne i8* %13, null
br label %15
15: ; preds = %11, %8
%16 = phi i1 [ false, %8 ], [ %14, %11 ]
br i1 %16, label %17, label %26
17: ; preds = %15
%18 = load i8**, i8*** %3
%19 = load i8*, i8** %18
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %19)
%21 = load i8**, i8*** %3
%22 = load i8*, i8** %21
br label %23
23: ; preds = %17
%24 = load i8**, i8*** %3
%25 = getelementptr inbounds i8*, i8** %24, i32 1
store i8** %25, i8*** %3
br label %8
26: ; preds = %15
%27 = load i8**, i8*** %2
%28 = bitcast i8** %27 to i8*
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"1,w,n,c,w,n,c,h,w,2,3,4\00"
@.str.1 = [2 x i8] c",\00"
define i32 @main() {
%1 = tail call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @tokenize to i32 (i8*, i8*, i32, ...)*)(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i32 10)
%2 = sext i32 %1 to i64
%3 = icmp eq i32 %1, 0
br i1 %3, label %16, label %4
4: ; preds = %0
%5 = inttoptr i64 %2 to i8**
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %16, label %8
8: ; preds = %4, %8
%9 = phi i8* [ %14, %8 ], [ %6, %4 ]
%10 = phi i8** [ %13, %8 ], [ %5, %4 ]
%11 = tail call i32 @puts(i8* %9)
%12 = load i8*, i8** %10
tail call void @free(i8* %12)
%13 = getelementptr inbounds i8*, i8** %10, i64 1
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %8
16: ; preds = %8, %4, %0
%17 = inttoptr i64 %2 to i8*
tail call void @free(i8* %17)
ret i32 0
}