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

/* Variables and functions */
int add_command_list(char *, char *);
char *strchr(char *, 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[sizeof(option) - 1 - 1] = 0;
  };
  option[sizeof(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++;
  {
    strncpy(value, p1, sizeof(value));
    value[sizeof(value) - 1] = 0;
  };
  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>
movb   $0x0,-0x1e(%rbp)
movb   $0x0,-0x1c(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
mov    $0x9,%esi
call   1050 <strchr@plt>
mov    %rax,-0x90(%rbp)
mov    -0x88(%rbp),%rax
cmp    -0x90(%rbp),%rax
jbe    11b3 <add_command_list_brcommand_sub+0x83>
cmpq   $0x0,-0x90(%rbp)
je     11b3 <add_command_list_brcommand_sub+0x83>
mov    -0x90(%rbp),%rax
mov    %rax,-0x88(%rbp)
cmpq   $0x0,-0x88(%rbp)
jne    11cd <add_command_list_brcommand_sub+0x9d>
movl   $0x0,-0x4(%rbp)
jmp    1276 <add_command_list_brcommand_sub+0x146>
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     121a <add_command_list_brcommand_sub+0xea>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
sete   %al
mov    %al,-0x101(%rbp)
mov    -0x101(%rbp),%al
test   $0x1,%al
jne    122d <add_command_list_brcommand_sub+0xfd>
jmp    1244 <add_command_list_brcommand_sub+0x114>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
jmp    11e9 <add_command_list_brcommand_sub+0xb9>
lea    -0x100(%rbp),%rdi
mov    -0x88(%rbp),%rsi
mov    $0x64,%edx
call   1030 <strncpy@plt>
movb   $0x0,-0x9d(%rbp)
lea    -0x80(%rbp),%rdi
lea    -0x100(%rbp),%rsi
call   1040 <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>
movb   $0x0,0x62(%rsp)
movb   $0x0,0x64(%rsp)
mov    %r14,%rdi
mov    $0x20,%esi
call   1050 <strchr@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x9,%esi
call   1050 <strchr@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmovne %rax,%rsi
cmp    %rax,%rbx
cmovbe %rbx,%rsi
test   %rsi,%rsi
je     11c6 <add_command_list_brcommand_sub+0x96>
movb   $0x0,(%rsi)
nopl   (%rax)
add    $0x1,%rsi
movzbl (%rsi),%eax
cmp    $0x20,%al
je     1190 <add_command_list_brcommand_sub+0x60>
cmp    $0x9,%al
je     1190 <add_command_list_brcommand_sub+0x60>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x64,%edx
call   1030 <strncpy@plt>
movb   $0x0,0xd3(%rsp)
mov    %rsp,%rdi
mov    %rbx,%rsi
call   1040 <add_command_list@plt>
jmp    11c8 <add_command_list_brcommand_sub+0x98>
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 98
store i8 0, i8* %11
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 100
store i8 0, i8* %12
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%14 = call i8* @strchr(i8* %13, i8 signext 32)
store i8* %14, i8** %5
%15 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%16 = call i8* @strchr(i8* %15, i8 signext 9)
store i8* %16, i8** %6
%17 = load i8*, i8** %5
%18 = load i8*, i8** %6
%19 = icmp ugt i8* %17, %18
br i1 %19, label %20, label %25
20: ; preds = %1
%21 = load i8*, i8** %6
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i8*, i8** %6
store i8* %24, i8** %5
br label %25
25: ; preds = %23, %20, %1
%26 = load i8*, i8** %5
%27 = icmp eq i8* %26, null
br i1 %27, label %28, label %29
28: ; preds = %25
store i32 0, i32* %2
br label %56
29: ; preds = %25
%30 = load i8*, i8** %5
store i8 0, i8* %30
%31 = load i8*, i8** %5
%32 = getelementptr inbounds i8, i8* %31, i32 1
store i8* %32, i8** %5
br label %33
33: ; preds = %45, %29
%34 = load i8*, i8** %5
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp eq i32 %36, 32
br i1 %37, label %43, label %38
38: ; preds = %33
%39 = load i8*, i8** %5
%40 = load i8, i8* %39
%41 = sext i8 %40 to i32
%42 = icmp eq i32 %41, 9
br label %43
43: ; preds = %38, %33
%44 = phi i1 [ true, %33 ], [ %42, %38 ]
br i1 %44, label %45, label %48
45: ; preds = %43
%46 = load i8*, i8** %5
%47 = getelementptr inbounds i8, i8* %46, i32 1
store i8* %47, i8** %5
br label %33
48: ; preds = %43
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%50 = load i8*, i8** %5
%51 = call i32 @strncpy(i8* %49, i8* %50, i32 100)
%52 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 99
store i8 0, i8* %52
%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 = %48, %28
%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 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 98
store i8 0, i8* %7
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 100
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 %26, 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 @strncpy(i8* %5, i8* %19, i32 100)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 99
store i8 0, i8* %24
%25 = call i32 @add_command_list(i8* %4, i8* %5)
br label %26
26: ; preds = %1, %22
%27 = phi i32 [ %25, %22 ], [ 0, %1 ]
ret i32 %27
}