#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 */
int /*<<< orphan*/ add_file_to_process(char *);
int /*<<< orphan*/ parse_cmdline_arg(char *);
char *strtok(char *, char *);
void parse_option(char *option) {
  char *ptr;
  if (option != NULL) {
    ptr = strtok(option, " \t\r\n");
    while (ptr != NULL) {
      if (ptr[0] == '-') {
        parse_cmdline_arg(ptr);
      } else {
        add_file_to_process(ptr);
      }
      ptr = strtok(NULL, " \r\n");
    }
  }
}


x86 assembly (clang, -O0):
<parse_option>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11ab <parse_option+0x7b>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     11a6 <parse_option+0x76>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1184 <parse_option+0x54>
mov    -0x10(%rbp),%rdi
call   1040 <parse_cmdline_arg@plt>
jmp    118d <parse_option+0x5d>
mov    -0x10(%rbp),%rdi
call   1030 <add_file_to_process@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xe6d(%rip),%rsi
call   1050 <strtok@plt>
mov    %rax,-0x10(%rbp)
jmp    115b <parse_option+0x2b>
jmp    11ab <parse_option+0x7b>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_option>:
push   %rbx
test   %rdi,%rdi
je     1176 <parse_option+0x46>
lea    0xec3(%rip),%rsi
call   1050 <strtok@plt>
test   %rax,%rax
je     1176 <parse_option+0x46>
lea    0xeb7(%rip),%rbx
jmp    1167 <parse_option+0x37>
mov    %rax,%rdi
call   1030 <add_file_to_process@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   1050 <strtok@plt>
test   %rax,%rax
je     1176 <parse_option+0x46>
cmpb   $0x2d,(%rax)
jne    1150 <parse_option+0x20>
mov    %rax,%rdi
call   1040 <parse_cmdline_arg@plt>
jmp    1158 <parse_option+0x28>
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [5 x i8] c" \09\0D\0A\00"
@.str.1 = [4 x i8] c" \0D\0A\00"
define void @parse_option(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %17, label %3
3: ; preds = %1
%4 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i8* %4, null
br i1 %5, label %17, label %6
6: ; preds = %3, %14
%7 = phi i8* [ %15, %14 ], [ %4, %3 ]
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = tail call i32 @parse_cmdline_arg(i8* %7)
br label %14
12: ; preds = %6
%13 = tail call i32 @add_file_to_process(i8* %7)
br label %14
14: ; preds = %12, %10
%15 = tail call i8* @strtok(i8* null, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %6
17: ; preds = %14, %3, %1
ret void
}