// File: ThePhage[P]horse_tornado/fast.cpp
// Function: (anonymous namespace)::command_output(std::vector<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
string command_output(const vector<string>& cmd) {
  int fd[2];
  if (pipe(fd) < 0)
    die("Pipe failed");
  const pid_t pid = fork();
  if (pid) { // Parent
    close(fd[1]);
    string results;
    char buffer[1024+1];
    for (;;) {
      ssize_t n = read(fd[0],buffer,sizeof(buffer)-1);
      if (n == 0)
        break;
      else if (n < 0)
        die(string("command_output: read failed: ")+strerror(errno));
      buffer[n] = 0;
      results += buffer;
    }
    close(fd[0]);
    int status;
    waitpid(pid,&status,0);
    if (!WIFEXITED(status) || WEXITSTATUS(status))
      exit(1);
    return results;
  } else { // Child
    if (dup2(fd[1],1) < 0)
      die("dup2 failed");
    exec(cmd);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x510, %rsp            # imm = 0x510
movq %rdi, -0x4e8(%rbp)
movq %rdi, %rax
movq %rax, -0x4e0(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
leaq -0x18(%rbp), %rdi
callq 0x7800
cmpl $0x0, %eax
jge 0xf717
leaq -0x39(%rbp), %rdi
movq %rdi, -0x4f0(%rbp)
callq 0x79e0
movq -0x4f0(%rbp), %rdx
leaq 0x19d09(%rip), %rsi     # 0x293d9
leaq -0x38(%rbp), %rdi
callq 0x11520
jmp 0xf6db
leaq -0x38(%rbp), %rdi
callq 0x87f0
jmp 0xf6e6
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf709
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x38(%rbp), %rdi
callq 0x7380
leaq -0x39(%rbp), %rdi
callq 0x7680
jmp 0xf982
callq 0x7180
movl %eax, -0x50(%rbp)
cmpl $0x0, -0x50(%rbp)
je 0xf8f6
movl -0x14(%rbp), %edi
callq 0x7ae0
movq -0x4e8(%rbp), %rdi
movb $0x0, -0x51(%rbp)
callq 0x7820
movl -0x18(%rbp), %edi
leaq -0x460(%rbp), %rsi
movl $0x400, %edx            # imm = 0x400
callq 0x7860
movq %rax, -0x4f8(%rbp)
jmp 0xf75e
movq -0x4f8(%rbp), %rax
movq %rax, -0x468(%rbp)
cmpq $0x0, -0x468(%rbp)
jne 0xf78c
jmp 0xf877
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf8e5
cmpq $0x0, -0x468(%rbp)
jge 0xf84c
leaq -0x4a9(%rbp), %rdi
movq %rdi, -0x500(%rbp)
callq 0x79e0
movq -0x500(%rbp), %rdx
leaq 0x19c2a(%rip), %rsi     # 0x293e5
leaq -0x4a8(%rbp), %rdi
callq 0x11520
jmp 0xf7c9
callq 0x7080
movl (%rax), %edi
callq 0x71e0
movq %rax, %rdx
leaq -0x488(%rbp), %rdi
leaq -0x4a8(%rbp), %rsi
callq 0x114d0
jmp 0xf7ed
leaq -0x488(%rbp), %rdi
callq 0x87f0
jmp 0xf7fb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf83b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf82f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x488(%rbp), %rdi
callq 0x7380
leaq -0x4a8(%rbp), %rdi
callq 0x7380
leaq -0x4a9(%rbp), %rdi
callq 0x7680
jmp 0xf8e5
jmp 0xf84e
movq -0x4e8(%rbp), %rdi
movq -0x468(%rbp), %rax
movb $0x0, -0x460(%rbp,%rax)
leaq -0x460(%rbp), %rsi
callq 0x75b0
jmp 0xf872
jmp 0xf741
movl -0x18(%rbp), %edi
callq 0x7ae0
jmp 0xf881
movl -0x50(%rbp), %edi
leaq -0x4b0(%rbp), %rsi
xorl %edx, %edx
callq 0x74f0
jmp 0xf894
movl -0x4b0(%rbp), %eax
andl $0x7f, %eax
cmpl $0x0, %eax
jne 0xf8b5
movl -0x4b0(%rbp), %eax
andl $0xff00, %eax           # imm = 0xFF00
sarl $0x8, %eax
cmpl $0x0, %eax
je 0xf8bf
movl $0x1, %edi
callq 0x7750
movb $0x1, -0x51(%rbp)
testb $0x1, -0x51(%rbp)
jne 0xf8d5
movq -0x4e8(%rbp), %rdi
callq 0x7380
movq -0x4e0(%rbp), %rax
addq $0x510, %rsp            # imm = 0x510
popq %rbp
retq
movq -0x4e8(%rbp), %rdi
callq 0x7380
jmp 0xf982
movl -0x14(%rbp), %edi
movl $0x1, %esi
callq 0x7590
cmpl $0x0, %eax
jge 0xf979
leaq -0x4d1(%rbp), %rdi
movq %rdi, -0x508(%rbp)
callq 0x79e0
movq -0x508(%rbp), %rdx
leaq 0x19ada(%rip), %rsi     # 0x29403
leaq -0x4d0(%rbp), %rdi
callq 0x11520
jmp 0xf937
leaq -0x4d0(%rbp), %rdi
callq 0x87f0
jmp 0xf945
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
jmp 0xf96b
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x48(%rbp)
movl %eax, -0x4c(%rbp)
leaq -0x4d0(%rbp), %rdi
callq 0x7380
leaq -0x4d1(%rbp), %rdi
callq 0x7680
jmp 0xf982
movq -0x10(%rbp), %rdi
callq 0xf990
movq -0x48(%rbp), %rdi
callq 0x79d0
nopl (%rax,%rax)