#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 *);
char *strtok(char *, char *);
void manpath_parseline(struct manpaths *dirs, char *path) {
  char *dir;
  if (NULL == path)
    return;
  for (dir = strtok(path, ":"); dir; dir = strtok(NULL, ":"))
    manpath_add(dirs, dir);
}


x86 assembly (clang, -O0):
<manpath_parseline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
xor    %eax,%eax
cmp    -0x10(%rbp),%rax
jne    1141 <manpath_parseline+0x21>
jmp    1186 <manpath_parseline+0x66>
mov    -0x10(%rbp),%rdi
lea    0xeb4(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     1186 <manpath_parseline+0x66>
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <manpath_add@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe88(%rip),%rsi
call   1040 <strtok@plt>
mov    %rax,-0x18(%rbp)
jmp    1155 <manpath_parseline+0x35>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<manpath_parseline>:
push   %r14
push   %rbx
push   %rax
test   %rsi,%rsi
je     116a <manpath_parseline+0x4a>
mov    %rdi,%rbx
lea    0xecd(%rip),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
je     116a <manpath_parseline+0x4a>
lea    0xeb6(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %rax,%rsi
call   1030 <manpath_add@plt>
xor    %edi,%edi
mov    %r14,%rsi
call   1040 <strtok@plt>
test   %rax,%rax
jne    1150 <manpath_parseline+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

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