#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*/ process_cmd(char *);
char *strtok_r(char *, char const *, char **);
void process_cmd_line(char *cmd_line) {
  static const char *delim = ";";
  char *saveptr = NULL;
  char *next_tok;
  if ((next_tok = strtok_r(cmd_line, delim, &saveptr)) == NULL) {
    return;
  }
  process_cmd(next_tok);
  while ((next_tok = strtok_r(NULL, delim, &saveptr)) != NULL) {
    process_cmd(next_tok);
  }
}


x86 assembly (clang, -O0):
<process_cmd_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2ef1(%rip),%rsi
lea    -0x10(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
jne    115b <process_cmd_line+0x3b>
jmp    1194 <process_cmd_line+0x74>
mov    -0x18(%rbp),%rdi
call   1040 <process_cmd@plt>
mov    0x2ec5(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edi
lea    -0x10(%rbp),%rdx
call   1030 <strtok_r@plt>
mov    %rax,-0x18(%rbp)
cmp    $0x0,%rax
je     1194 <process_cmd_line+0x74>
mov    -0x18(%rbp),%rdi
call   1040 <process_cmd@plt>
jmp    1164 <process_cmd_line+0x44>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_cmd_line>:
push   %r14
push   %rbx
push   %rax
movq   $0x0,(%rsp)
lea    0xecd(%rip),%rsi
mov    %rsp,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
je     118a <process_cmd_line+0x6a>
mov    %rax,%rdi
call   1040 <process_cmd@plt>
lea    0xeb1(%rip),%rsi
mov    %rsp,%rdx
xor    %edi,%edi
call   1030 <strtok_r@plt>
test   %rax,%rax
je     118a <process_cmd_line+0x6a>
lea    0xe9b(%rip),%r14
mov    %rsp,%rbx
nopl   0x0(%rax,%rax,1)
mov    %rax,%rdi
call   1040 <process_cmd@plt>
xor    %edi,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1030 <strtok_r@plt>
test   %rax,%rax
jne    1170 <process_cmd_line+0x50>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c";\00"
define void @process_cmd_line(i8* %0) {
%2 = alloca i8*
%3 = bitcast i8** %2 to i8*
store i8* null, i8** %2
%4 = call i8* @strtok_r(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2)
%5 = icmp eq i8* %4, null
br i1 %5, label %15, label %6
6: ; preds = %1
%7 = call i32 @process_cmd(i8* %4)
%8 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2)
%9 = icmp eq i8* %8, null
br i1 %9, label %15, label %10
10: ; preds = %6, %10
%11 = phi i8* [ %13, %10 ], [ %8, %6 ]
%12 = call i32 @process_cmd(i8* %11)
%13 = call i8* @strtok_r(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2)
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %10
15: ; preds = %10, %6, %1
ret void
}