#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 parseline(char *cmdline, char **argv) {
  int count = 0;
  char *separator = " \n\t";
  argv[count] = strtok(cmdline, separator);
  while ((argv[count] != NULL) && (count + 1 < 20))
    argv[++count] = strtok((char *)0, separator);
  return count;
}


x86 assembly (clang, -O0):
<parseline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
lea    0xed2(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strtok@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x10(%rbp),%rcx
movslq -0x14(%rbp),%rdx
xor    %eax,%eax
cmpq   $0x0,(%rcx,%rdx,8)
mov    %al,-0x21(%rbp)
je     1175 <parseline+0x65>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
cmp    $0x14,%eax
setl   %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1185 <parseline+0x75>
jmp    11ae <parseline+0x9e>
mov    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   1030 <strtok@plt>
mov    %rax,%rdx
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0x14(%rbp)
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    114e <parseline+0x3e>
mov    -0x14(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseline>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r15
lea    0xee1(%rip),%rsi
call   1030 <strtok@plt>
mov    %rax,(%r15)
test   %rax,%rax
je     1168 <parseline+0x58>
mov    $0x1,%ebx
lea    0xec8(%rip),%r14
nopl   0x0(%rax,%rax,1)
xor    %edi,%edi
mov    %r14,%rsi
call   1030 <strtok@plt>
mov    %rax,%rcx
mov    %rax,(%r15,%rbx,8)
lea    0x1(%rbx),%rax
test   %rcx,%rcx
je     1163 <parseline+0x53>
cmp    $0x13,%rbx
mov    %rax,%rbx
jb     1140 <parseline+0x30>
add    $0xffffffff,%eax
jmp    116a <parseline+0x5a>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c" \0A\09\00"
define i32 @parseline(i8* %0, i8** %1) {
%3 = alloca i8*
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
store i8* %0, i8** %3
store i8** %1, i8*** %4
store i32 0, i32* %5
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = load i8*, i8** %3
%8 = load i8*, i8** %6
%9 = call i8* @strtok(i8* %7, i8* %8)
%10 = load i8**, i8*** %4
%11 = load i32, i32* %5
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds i8*, i8** %10, i64 %12
store i8* %9, i8** %13
br label %14
14: ; preds = %27, %2
%15 = load i8**, i8*** %4
%16 = load i32, i32* %5
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8*, i8** %15, i64 %17
%19 = load i8*, i8** %18
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %25
21: ; preds = %14
%22 = load i32, i32* %5
%23 = add nsw i32 %22, 1
%24 = icmp slt i32 %23, 20
br label %25
25: ; preds = %21, %14
%26 = phi i1 [ false, %14 ], [ %24, %21 ]
br i1 %26, label %27, label %35
27: ; preds = %25
%28 = load i8*, i8** %6
%29 = call i8* @strtok(i8* null, i8* %28)
%30 = load i8**, i8*** %4
%31 = load i32, i32* %5
%32 = add nsw i32 %31, 1
store i32 %32, i32* %5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8*, i8** %30, i64 %33
store i8* %29, i8** %34
br label %14
35: ; preds = %25
%36 = load i32, i32* %5
ret i32 %36
}

LLVM IR (-O2):
@.str = [4 x i8] c" \0A\09\00"
define i32 @parseline(i8* %0, i8** nocapture %1) {
%3 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %1
%4 = icmp eq i8* %3, null
br i1 %4, label %15, label %5
5: ; preds = %2, %5
%6 = phi i64 [ %10, %5 ], [ 1, %2 ]
%7 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds i8*, i8** %1, i64 %6
store i8* %7, i8** %8
%9 = icmp ne i8* %7, null
%10 = add nuw nsw i64 %6, 1
%11 = icmp ult i64 %6, 19
%12 = select i1 %9, i1 %11, i1 false
br i1 %12, label %5, label %13
13: ; preds = %5
%14 = trunc i64 %6 to i32
br label %15
15: ; preds = %13, %2
%16 = phi i32 [ 0, %2 ], [ %14, %13 ]
ret i32 %16
}