#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 */
typedef int /*<<< orphan*/ option;

/* Variables and functions */
int add_command_list(char *, char *);
char *strchr(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int add_command_list_brcommand_sub(char *command) {
  char option[100], *p1, *p2;
  char value[100];
  strncpy(option, command, sizeof(option) - 1);
  option[strlen(option)] = 0;
  p1 = strchr(option, ' ');
  p2 = strchr(option, '\t');
  if (p1 > p2 && p2 != NULL)
    p1 = p2;
  if (p1 == NULL) {
    return 0;
  }
  *p1 = 0;
  p1++;
  while (*p1 == ' ' || *p1 == '\t')
    p1++;
  strcpy(value, p1);
  return add_command_list(option, value);
}


x86 assembly (clang, -O0):
<add_command_list_brcommand_sub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
mov    %rdi,-0x10(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x63,%edx
call   1030 <strncpy@plt>
lea    -0x80(%rbp),%rdi
call   1060 <strlen@plt>
movb   $0x0,-0x80(%rbp,%rax,1)
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x9,%esi
call   1070 <strchr@plt>
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0x90(%rbp),%rax
jbe    11d9 <add_command_list_brcommand_sub+0x89>
cmpq   $0x0,-0x90(%rbp)
je     11d9 <add_command_list_brcommand_sub+0x89>
mov    -0x90(%rbp),%rax
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    11f3 <add_command_list_brcommand_sub+0xa3>
movl   $0x0,-0x4(%rbp)
jmp    1290 <add_command_list_brcommand_sub+0x140>
mov    -0x88(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x20,%ecx
mov    %al,-0x101(%rbp)
je     1240 <add_command_list_brcommand_sub+0xf0>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x101(%rbp)
mov    -0x101(%rbp),%al
test   $0x1,%al
jne    1253 <add_command_list_brcommand_sub+0x103>
jmp    126a <add_command_list_brcommand_sub+0x11a>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    120f <add_command_list_brcommand_sub+0xbf>
lea    -0x100(%rbp),%rdi
mov    -0x88(%rbp),%rsi
call   1040 <strcpy@plt>
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1050 <add_command_list@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<add_command_list_brcommand_sub>:
push   %r14
push   %rbx
sub    $0xd8,%rsp
mov    %rdi,%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x63,%edx
call   1030 <strncpy@plt>
mov    %r14,%rdi
call   1060 <strlen@plt>
movb   $0x0,(%rsp,%rax,1)
mov    %r14,%rdi
mov    $0x20,%esi
call   1070 <strchr@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x9,%esi
call   1070 <strchr@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmovne %rax,%rsi
cmp    %rax,%rbx
cmovbe %rbx,%rsi
test   %rsi,%rsi
je     11d9 <add_command_list_brcommand_sub+0x89>
movb   $0x0,(%rsi)
nop
add    $0x1,%rsi
movzbl (%rsi),%eax
cmp    $0x20,%al
je     11b0 <add_command_list_brcommand_sub+0x60>
cmp    $0x9,%al
je     11b0 <add_command_list_brcommand_sub+0x60>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
call   1040 <strcpy@plt>
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1050 <add_command_list@plt>
jmp    11db <add_command_list_brcommand_sub+0x8b>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @add_command_list_brcommand_sub(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca [100 x i8]
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [100 x i8]
store i8* %0, i8** %3
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%9 = load i8*, i8** %3
%10 = call i32 @strncpy(i8* %8, i8* %9, i32 99)
%11 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%12 = call i64 @strlen(i8* %11)
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 %12
store i8 0, i8* %13
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%15 = call i8* @strchr(i8* %14, i8 signext 32)
store i8* %15, i8** %5
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%17 = call i8* @strchr(i8* %16, i8 signext 9)
store i8* %17, i8** %6
%18 = load i8*, i8** %5
%19 = load i8*, i8** %6
%20 = icmp ugt i8* %18, %19
br i1 %20, label %21, label %26
21: ; preds = %1
%22 = load i8*, i8** %6
%23 = icmp ne i8* %22, null
br i1 %23, label %24, label %26
24: ; preds = %21
%25 = load i8*, i8** %6
store i8* %25, i8** %5
br label %26
26: ; preds = %24, %21, %1
%27 = load i8*, i8** %5
%28 = icmp eq i8* %27, null
br i1 %28, label %29, label %30
29: ; preds = %26
store i32 0, i32* %2
br label %56
30: ; preds = %26
%31 = load i8*, i8** %5
store i8 0, i8* %31
%32 = load i8*, i8** %5
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %5
br label %34
34: ; preds = %46, %30
%35 = load i8*, i8** %5
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 32
br i1 %38, label %44, label %39
39: ; preds = %34
%40 = load i8*, i8** %5
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = icmp eq i32 %42, 9
br label %44
44: ; preds = %39, %34
%45 = phi i1 [ true, %34 ], [ %43, %39 ]
br i1 %45, label %46, label %49
46: ; preds = %44
%47 = load i8*, i8** %5
%48 = getelementptr inbounds i8, i8* %47, i32 1
store i8* %48, i8** %5
br label %34
49: ; preds = %44
%50 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%51 = load i8*, i8** %5
%52 = call i32 @strcpy(i8* %50, i8* %51)
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%54 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%55 = call i32 @add_command_list(i8* %53, i8* %54)
store i32 %55, i32* %2
br label %56
56: ; preds = %49, %29
%57 = load i32, i32* %2
ret i32 %57
}

LLVM IR (-O2):
define i32 @add_command_list_brcommand_sub(i8* %0) {
%2 = alloca [100 x i8]
%3 = alloca [100 x i8]
%4 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%6 = call i32 @strncpy(i8* %4, i8* %0, i32 99)
%7 = call i64 @strlen(i8* %4)
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %7
store i8 0, i8* %8
%9 = call i8* @strchr(i8* %4, i8 signext 32)
%10 = call i8* @strchr(i8* %4, i8 signext 9)
%11 = icmp ugt i8* %9, %10
%12 = icmp ne i8* %10, null
%13 = and i1 %11, %12
%14 = select i1 %13, i8* %10, i8* %9
%15 = icmp eq i8* %14, null
br i1 %15, label %25, label %16
16: ; preds = %1
store i8 0, i8* %14
br label %17
17: ; preds = %21, %16
%18 = phi i8* [ %14, %16 ], [ %19, %21 ]
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
switch i8 %20, label %22 [
i8 32, label %21
i8 9, label %21
]
21: ; preds = %17, %17
br label %17
22: ; preds = %17
%23 = call i32 @strcpy(i8* %5, i8* %19)
%24 = call i32 @add_command_list(i8* %4, i8* %5)
br label %25
25: ; preds = %1, %22
%26 = phi i32 [ %24, %22 ], [ 0, %1 ]
ret i32 %26
}