// File: /workspace/github_cpp_makefile_star2_O2/brandoncanaday[P]1730sh/1730sh.cpp
// Function: isValidInput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool isValidInput(string input) {
  if(input.length() == 0) return true;
  bool redirect_in_flag = false;
  bool redirect_out_flag = false;
  bool redirect_err_flag = false;
  stringstream ss(input);
  vector<string> argv;
  string arg;
  while(ss >> arg) {
    argv.push_back(arg);
  } // while
  // can not begin input with a pipe
  if(argv[0] == "|") return false;
  // only allowed to have one redirect of each kind (STDIN, STDOUT, STDERR)
  for(unsigned int i = 0; i < argv.size(); i++) {
    if(argv[i] == "<") {
      if(!redirect_in_flag) { 
	redirect_in_flag = true; 
      } else {
	return false;
      } // if/else
    } else if(argv[i] == ">" || argv[i] == ">>") {
      if(!redirect_out_flag) { 
	redirect_out_flag = true; 
      } else {
	return false;
      } // if/else
    } else if(argv[i] == "e>" || argv[i] == "e>>") {
      if(!redirect_err_flag) { 
	redirect_err_flag = true; 
      } else {
	return false;
      } // if/else
    } // if/else
  } // for  
  return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x1d8, %rsp            # imm = 0x1D8
cmpq $0x0, 0x8(%rdi)
je 0x4c6a
movq %rdi, %rsi
leaq -0x1f8(%rbp), %rbx
pushq $0x18
popq %rdx
movq %rbx, %rdi
callq 0x3430
leaq -0x50(%rbp), %r14
andq $0x0, 0x10(%r14)
leaq -0x60(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorps %xmm0, %xmm0
movaps %xmm0, (%r14)
movb $0x0, (%rax)
leaq -0x70(%rbp), %r15
movq %rbx, %rdi
movq %r15, %rsi
callq 0x3330
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x4c2d
movq %r14, %rdi
movq %r15, %rsi
callq 0x7776
jmp 0x4c07
movq -0x50(%rbp), %rdi
leaq 0x5423(%rip), %rsi      # 0xa05b
callq 0x7653
xorl %r15d, %r15d
movl $0x0, %r13d
testb %al, %al
je 0x4c82
leaq -0x70(%rbp), %rdi
callq 0x3120
leaq -0x50(%rbp), %rdi
callq 0x7726
leaq -0x1f8(%rbp), %rdi
callq 0x31e0
jmp 0x4c6d
movb $0x1, %r13b
movl %r13d, %eax
addq $0x1d8, %rsp            # imm = 0x1D8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
xorl %r14d, %r14d
movq $0x0, -0x30(%rbp)
xorl %ebx, %ebx
movl %r15d, %r15d
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rax
subq %rdi, %rax
sarq $0x5, %rax
cmpq %r15, %rax
setbe %r13b
jbe 0x4c4a
movq %r15, %r12
shlq $0x5, %r12
addq %r12, %rdi
leaq 0x53a2(%rip), %rsi      # 0xa05d
callq 0x7653
testb %al, %al
je 0x4cd0
testb $0x1, %bl
movb $0x1, %bl
je 0x4d0b
jmp 0x4c4a
movq -0x50(%rbp), %rdi
addq %r12, %rdi
leaq 0x5386(%rip), %rsi      # 0xa064
callq 0x7653
testb %al, %al
jne 0x4cfe
movq -0x50(%rbp), %rdi
addq %r12, %rdi
leaq 0x536e(%rip), %rsi      # 0xa063
callq 0x7653
testb %al, %al
je 0x4d13
testb $0x1, %r14b
movb $0x1, %r14b
jne 0x4c4a
incl %r15d
jmp 0x4c8f
movq -0x50(%rbp), %rdi
addq %r12, %rdi
leaq 0x533e(%rip), %rsi      # 0xa05f
callq 0x7653
testb %al, %al
je 0x4d3b
testb $0x1, -0x30(%rbp)
movb $0x1, %al
movq %rax, -0x30(%rbp)
je 0x4d0b
jmp 0x4c4a
addq -0x50(%rbp), %r12
movq %r12, %rdi
leaq 0x5319(%rip), %rsi      # 0xa062
callq 0x7653
testb %al, -0x30(%rbp)
jne 0x4c4a
movq -0x30(%rbp), %rcx
orb %al, %cl
movq %rcx, -0x30(%rbp)
jmp 0x4d0b
movq %rax, %rbx
leaq -0x70(%rbp), %rdi
callq 0x3120
leaq -0x50(%rbp), %rdi
callq 0x7726
leaq -0x1f8(%rbp), %rdi
callq 0x31e0
movq %rbx, %rdi
callq 0x34b0