#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 */
struct manpaths {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ manpath_add(struct manpaths *, char *, int);
char *strtok(char *, char *);
void manpath_parseline(struct manpaths *dirs, char *path, int complain) {
  char *dir;
  if (NULL == path)
    return;
  for (dir = strtok(path, ":"); dir; dir = strtok(NULL, ":"))
    manpath_add(dirs, dir, complain);
}


x86 assembly (clang, -O0):
<manpath_parseline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1144 <manpath_parseline+0x24>
jmp    118c <manpath_parseline+0x6c>
mov    -0x10(%rbp),%rdi
lea    0xeb1(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
je     118c <manpath_parseline+0x6c>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
call   1030 <manpath_add@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe82(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x20(%rbp)
jmp    1158 <manpath_parseline+0x38>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manpath_parseline>:
push   %rbp
push   %r14
push   %rbx
test   %rsi,%rsi
je     116c <manpath_parseline+0x4c>
mov    %edx,%ebp
mov    %rdi,%rbx
lea    0xecb(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     116c <manpath_parseline+0x4c>
lea    0xeb4(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    %rax,%rsi
mov    %ebp,%edx
call   1030 <manpath_add@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1150 <manpath_parseline+0x30>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.manpaths = type { i32 }
@.str = [2 x i8] c":\00"
define void @manpath_parseline(%struct.manpaths* %0, i8* %1, i32 %2) {
%4 = alloca %struct.manpaths*
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
store %struct.manpaths* %0, %struct.manpaths** %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = load i8*, i8** %5
%9 = icmp eq i8* null, %8
br i1 %9, label %10, label %11
10: ; preds = %3
br label %24
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %13, i8** %7
br label %14
14: ; preds = %22, %11
%15 = load i8*, i8** %7
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %24
17: ; preds = %14
%18 = load %struct.manpaths*, %struct.manpaths** %4
%19 = load i8*, i8** %7
%20 = load i32, i32* %6
%21 = call i32 @manpath_add(%struct.manpaths* %18, i8* %19, i32 %20)
br label %22
22: ; preds = %17
%23 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %23, i8** %7
br label %14
24: ; preds = %10, %14
ret void
}

LLVM IR (-O2):
%struct.manpaths = type { i32 }
@.str = [2 x i8] c":\00"
define void @manpath_parseline(%struct.manpaths* %0, i8* %1, i32 %2) {
%4 = icmp eq i8* %1, null
br i1 %4, label %13, label %5
5: ; preds = %3
%6 = tail call i8* @strtok(i8* %1, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %5, %8
%9 = phi i8* [ %11, %8 ], [ %6, %5 ]
%10 = tail call i32 @manpath_add(%struct.manpaths* %0, i8* %9, i32 %2)
%11 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %8
13: ; preds = %8, %5, %3
ret void
}