#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 *strsep(char **, char *);
void cmdtree_stov(const char *string, int *arg_count, const char **arg_vec) {
  const char **ap;
  *arg_count = 0;
  for (ap = arg_vec; (*ap = strsep((char **)&string, " \t")) != NULL;) {
    if (**ap != '\0') {
      (*arg_count)++;
      if (++ap >= &arg_vec[32])
        break;
    }
  }
}


x86 assembly (clang, -O0):
<cmdtree_stov>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
lea    -0x8(%rbp),%rdi
lea    0xebf(%rip),%rsi
call   1030 <strsep@plt>
mov    -0x20(%rbp),%rcx
mov    %rax,(%rcx)
cmp    $0x0,%rax
je     11a4 <cmdtree_stov+0x94>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     119f <cmdtree_stov+0x8f>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rcx
add    $0x100,%rcx
cmp    %rcx,%rax
jb     119a <cmdtree_stov+0x8a>
jmp    11a4 <cmdtree_stov+0x94>
jmp    119f <cmdtree_stov+0x8f>
jmp    1136 <cmdtree_stov+0x26>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cmdtree_stov>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,0x8(%rsp)
movl   $0x0,(%rsi)
lea    0xecb(%rip),%rsi
lea    0x8(%rsp),%rdi
call   1030 <strsep@plt>
mov    %rax,0x0(%r13)
test   %rax,%rax
je     1188 <cmdtree_stov+0x78>
xor    %ebx,%ebx
lea    0xeaf(%rip),%r15
lea    0x8(%rsp),%r12
jmp    1179 <cmdtree_stov+0x69>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbx
mov    %r12,%rdi
mov    %r15,%rsi
call   1030 <strsep@plt>
mov    %rax,0x0(%r13,%rbx,8)
test   %rax,%rax
je     1188 <cmdtree_stov+0x78>
cmpb   $0x0,(%rax)
je     1164 <cmdtree_stov+0x54>
addl   $0x1,(%r14)
cmp    $0x1e,%rbx
jle    1160 <cmdtree_stov+0x50>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [3 x i8] c" \09\00"
define void @cmdtree_stov(i8* %0, i32* nocapture %1, i8** nocapture writeonly %2) {
%4 = alloca i8*
store i8* %0, i8** %4
store i32 0, i32* %1
%5 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %5, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %22, label %7
7: ; preds = %3, %17
%8 = phi i8* [ %20, %17 ], [ %5, %3 ]
%9 = phi i64 [ %18, %17 ], [ 0, %3 ]
%10 = load i8, i8* %8
%11 = icmp eq i8 %10, 0
br i1 %11, label %17, label %12
12: ; preds = %7
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = add nsw i64 %9, 1
%16 = icmp slt i64 %9, 31
br i1 %16, label %17, label %22
17: ; preds = %12, %7
%18 = phi i64 [ %15, %12 ], [ %9, %7 ]
%19 = getelementptr inbounds i8*, i8** %2, i64 %18
%20 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i8* %20, i8** %19
%21 = icmp eq i8* %20, null
br i1 %21, label %22, label %7
22: ; preds = %17, %12, %3
ret void
}