// File: 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
subq $0x220, %rsp            # imm = 0x220
movq %rdi, -0x1f8(%rbp)
movq %rdi, -0x10(%rbp)
callq 0x34d0
cmpq $0x0, %rax
jne 0x614a
movb $0x1, -0x1(%rbp)
jmp 0x646b
movb $0x0, -0x11(%rbp)
movb $0x0, -0x12(%rbp)
movb $0x0, -0x13(%rbp)
movl $0x10, %edi
movl $0x8, %esi
callq 0xb6f0
movq -0x1f8(%rbp), %rsi
movl %eax, %edx
leaq -0x1a0(%rbp), %rdi
callq 0x3510
leaq -0x1b8(%rbp), %rdi
callq 0xb710
leaq -0x1d8(%rbp), %rdi
callq 0x3450
leaq -0x1a0(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0x33e0
movq %rax, -0x200(%rbp)
jmp 0x61ae
movq -0x200(%rbp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
addq %rax, %rdi
callq 0x33d0
movb %al, -0x201(%rbp)
jmp 0x61cc
movb -0x201(%rbp), %al
testb $0x1, %al
jne 0x61d8
jmp 0x622a
leaq -0x1b8(%rbp), %rdi
leaq -0x1d8(%rbp), %rsi
callq 0xb730
jmp 0x61ed
jmp 0x6192
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x1e0(%rbp)
movl %eax, -0x1e4(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x31e0
leaq -0x1b8(%rbp), %rdi
callq 0xb620
leaq -0x1a0(%rbp), %rdi
callq 0x3230
jmp 0x6479
xorl %eax, %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xde17(%rip), %rsi      # 0x1405b
callq 0xb390
movb %al, -0x202(%rbp)
jmp 0x6251
movb -0x202(%rbp), %al
testb $0x1, %al
jne 0x625d
jmp 0x6270
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e8(%rbp)
jmp 0x6447
movl $0x0, -0x1ec(%rbp)
movl -0x1ec(%rbp), %eax
movq %rax, -0x210(%rbp)
leaq -0x1b8(%rbp), %rdi
callq 0xb7a0
movq %rax, %rcx
movq -0x210(%rbp), %rax
cmpq %rcx, %rax
jae 0x6439
movl -0x1ec(%rbp), %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xdd99(%rip), %rsi      # 0x1405d
callq 0xb390
movb %al, -0x211(%rbp)
jmp 0x62d1
movb -0x211(%rbp), %al
testb $0x1, %al
jne 0x62dd
jmp 0x6301
testb $0x1, -0x11(%rbp)
jne 0x62e9
movb $0x1, -0x11(%rbp)
jmp 0x62fc
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e8(%rbp)
jmp 0x6447
jmp 0x6423
movl -0x1ec(%rbp), %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xdd45(%rip), %rsi      # 0x14064
callq 0xb390
movb %al, -0x212(%rbp)
jmp 0x632c
movb -0x212(%rbp), %al
testb $0x1, %al
jne 0x636f
jmp 0x6338
movl -0x1ec(%rbp), %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xdd0d(%rip), %rsi      # 0x14063
callq 0xb390
movb %al, -0x213(%rbp)
jmp 0x6363
movb -0x213(%rbp), %al
testb $0x1, %al
jne 0x636f
jmp 0x6393
testb $0x1, -0x12(%rbp)
jne 0x637b
movb $0x1, -0x12(%rbp)
jmp 0x638e
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e8(%rbp)
jmp 0x6447
jmp 0x6421
movl -0x1ec(%rbp), %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xdcae(%rip), %rsi      # 0x1405f
callq 0xb390
movb %al, -0x214(%rbp)
jmp 0x63be
movb -0x214(%rbp), %al
testb $0x1, %al
jne 0x6401
jmp 0x63ca
movl -0x1ec(%rbp), %eax
movl %eax, %esi
leaq -0x1b8(%rbp), %rdi
callq 0xb4b0
movq %rax, %rdi
leaq 0xdc7a(%rip), %rsi      # 0x14062
callq 0xb390
movb %al, -0x215(%rbp)
jmp 0x63f5
movb -0x215(%rbp), %al
testb $0x1, %al
jne 0x6401
jmp 0x641f
testb $0x1, -0x13(%rbp)
jne 0x640d
movb $0x1, -0x13(%rbp)
jmp 0x641d
movb $0x0, -0x1(%rbp)
movl $0x1, -0x1e8(%rbp)
jmp 0x6447
jmp 0x641f
jmp 0x6421
jmp 0x6423
jmp 0x6425
movl -0x1ec(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x1ec(%rbp)
jmp 0x627a
movb $0x1, -0x1(%rbp)
movl $0x1, -0x1e8(%rbp)
leaq -0x1d8(%rbp), %rdi
callq 0x31e0
leaq -0x1b8(%rbp), %rdi
callq 0xb620
leaq -0x1a0(%rbp), %rdi
callq 0x3230
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x220, %rsp            # imm = 0x220
popq %rbp
retq
movq -0x1e0(%rbp), %rdi
callq 0x3580
nopw %cs:(%rax,%rax)