#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 */

/* Variables and functions */
int close(int);
int dup2(int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ execv(char *, char **);
int /*<<< orphan*/ exit(int);
int fileno(int /*<<< orphan*/);
int fork();
char **more_commands(char **);
int pipe(int *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int /*<<< orphan*/ update_buffer(char, int);
int verify_binary(char *, char **);
int wait(int *);
bool process_regular_cmds(char **arguments, unsigned int arg_num) {
  char *full_binary_path = NULL;
  char **new_args = arguments;
  char **next_args = NULL;
  unsigned int level = 0;
  int i = 0;
  bool last_command = false;
  if (arguments == NULL)
    return false;
  int pipe_fd[2] = {-1};
  int read_fd = fileno(stdin);
  int pending_fd_list[1023] = {-1};
  do {
    next_args = more_commands(new_args);
    if (next_args == NULL)
      last_command = true;
    if (verify_binary(new_args[0], &full_binary_path) == false)
      goto error;
    if (full_binary_path != NULL) {
      if (pipe(pipe_fd) == -1) {
        printf("error: %s\n", strerror(errno));
        goto error;
      }
      int pid = fork();
      if (pid > 0) {
        int status = 0;
        if (close(pipe_fd[1]) == -1) {
          printf("error: %s\n", strerror(errno));
          goto error;
        }
        read_fd = pipe_fd[0];
        pending_fd_list[level] = read_fd;
        if (wait(&status) == -1) {
          printf("error: %s\n", strerror(errno));
          goto error;
        }
        update_buffer('\0', true);
      } else if (pid == 0) {
        if (level == 0 && !last_command) {
          if (dup2(pipe_fd[1], fileno(stdout)) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(pipe_fd[1]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(pipe_fd[0]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
        } else if (level == 0 && last_command) {
          if (close(pipe_fd[0]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(pipe_fd[1]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
        } else if (last_command) {
          if (dup2(read_fd, fileno(stdin)) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(read_fd) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(pipe_fd[1]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
        } else {
          if (dup2(read_fd, fileno(stdin)) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (dup2(pipe_fd[1], fileno(stdout)) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(read_fd) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
          if (close(pipe_fd[1]) == -1) {
            printf("error: %s\n", strerror(errno));
            goto error;
          }
        }
        execv(full_binary_path, new_args);
        printf("error: %s\n", strerror(errno));
        exit(-1);
      } else {
        printf("error: %s\n", strerror(errno));
        goto error;
      }
    } else {
      printf("error: %s\n", strerror(errno));
      goto error;
    }
    new_args = next_args;
    level++;
  } while (new_args);
  for (i = 0; i < level; i++) {
    if ((pending_fd_list[i] != -1) && close(pending_fd_list[i]) == -1) {
      printf("error: %s\n", strerror(errno));
      return false;
    }
  }
  return true;
error:
  update_buffer('\0', true);
  for (i = 0; i < level; i++) {
    if ((pending_fd_list[i] != -1) && close(pending_fd_list[i]) == -1) {
      printf("error: %s\n", strerror(errno));
      return false;
    }
  }
  return false;
}


x86 assembly (clang, -O0):
<process_regular_cmds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1070,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x28(%rbp)
movq   $0x0,-0x30(%rbp)
movl   $0x0,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1236 <process_regular_cmds+0x56>
movl   $0x0,-0x4(%rbp)
jmp    187a <process_regular_cmds+0x69a>
mov    0xdc3(%rip),%rax
mov    %rax,-0x44(%rbp)
mov    0x2da0(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    %eax,-0x48(%rbp)
lea    -0x1050(%rbp),%rdi
xor    %esi,%esi
mov    $0xffc,%edx
call   1060 <memset@plt>
movl   $0xffffffff,-0x1050(%rbp)
ff ff ff
mov    -0x28(%rbp),%rdi
call   1050 <more_commands@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    128e <process_regular_cmds+0xae>
movl   $0x1,-0x3c(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rdi
lea    -0x20(%rbp),%rsi
call   1090 <verify_binary@plt>
cmp    $0x0,%eax
jne    12ac <process_regular_cmds+0xcc>
jmp    17ed <process_regular_cmds+0x60d>
cmpq   $0x0,-0x20(%rbp)
je     1729 <process_regular_cmds+0x549>
lea    -0x44(%rbp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    12eb <process_regular_cmds+0x10b>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xd27(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x1054(%rbp)
cmpl   $0x0,-0x1054(%rbp)
jle    139d <process_regular_cmds+0x1bd>
movl   $0x0,-0x1058(%rbp)
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1342 <process_regular_cmds+0x162>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xcd0(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x44(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    -0x48(%rbp),%ecx
mov    -0x34(%rbp),%eax
mov    %ecx,-0x1050(%rbp,%rax,4)
lea    -0x1058(%rbp),%rdi
call   10e0 <wait@plt>
cmp    $0xffffffff,%eax
jne    138c <process_regular_cmds+0x1ac>
mov    0x2c67(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xc86(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
xor    %edi,%edi
mov    $0x1,%esi
call   10b0 <update_buffer@plt>
jmp    1724 <process_regular_cmds+0x544>
cmpl   $0x0,-0x1054(%rbp)
jne    1702 <process_regular_cmds+0x522>
cmpl   $0x0,-0x34(%rbp)
jne    1478 <process_regular_cmds+0x298>
cmpl   $0x0,-0x3c(%rbp)
jne    1478 <process_regular_cmds+0x298>
mov    -0x40(%rbp),%eax
mov    %eax,-0x105c(%rbp)
mov    0x2c02(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    -0x105c(%rbp),%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    140d <process_regular_cmds+0x22d>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xc05(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1440 <process_regular_cmds+0x260>
mov    0x2bb3(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xbd2(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x44(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1473 <process_regular_cmds+0x293>
mov    0x2b80(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xb9f(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
jmp    16ce <process_regular_cmds+0x4ee>
cmpl   $0x0,-0x34(%rbp)
jne    14f7 <process_regular_cmds+0x317>
cmpl   $0x0,-0x3c(%rbp)
je     14f7 <process_regular_cmds+0x317>
mov    -0x44(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    14bf <process_regular_cmds+0x2df>
mov    0x2b34(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xb53(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    14f2 <process_regular_cmds+0x312>
mov    0x2b01(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xb20(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
jmp    16c9 <process_regular_cmds+0x4e9>
cmpl   $0x0,-0x3c(%rbp)
je     15bb <process_regular_cmds+0x3db>
mov    -0x48(%rbp),%eax
mov    %eax,-0x1060(%rbp)
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    -0x1060(%rbp),%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    1550 <process_regular_cmds+0x370>
mov    0x2aa3(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xac2(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x48(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1583 <process_regular_cmds+0x3a3>
mov    0x2a70(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xa8f(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    15b6 <process_regular_cmds+0x3d6>
mov    0x2a3d(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xa5c(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
jmp    16c4 <process_regular_cmds+0x4e4>
mov    -0x48(%rbp),%eax
mov    %eax,-0x1064(%rbp)
mov    0x2a1d(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    -0x1064(%rbp),%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    160a <process_regular_cmds+0x42a>
mov    0x29e9(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0xa08(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x40(%rbp),%eax
mov    %eax,-0x1068(%rbp)
mov    0x29b6(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    -0x1068(%rbp),%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    1659 <process_regular_cmds+0x479>
mov    0x299a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x9b9(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x48(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    168c <process_regular_cmds+0x4ac>
mov    0x2967(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x986(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x40(%rbp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    16bf <process_regular_cmds+0x4df>
mov    0x2934(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x953(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
jmp    16c4 <process_regular_cmds+0x4e4>
jmp    16c9 <process_regular_cmds+0x4e9>
jmp    16ce <process_regular_cmds+0x4ee>
mov    -0x20(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   10f0 <execv@plt>
mov    0x28f6(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x915(%rip),%rdi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    0x28cf(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x8ee(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
jmp    174b <process_regular_cmds+0x56b>
mov    0x28a8(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x8c7(%rip),%rdi
call   1040 <printf@plt>
jmp    17ed <process_regular_cmds+0x60d>
mov    -0x30(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    126f <process_regular_cmds+0x8f>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    17e1 <process_regular_cmds+0x601>
movslq -0x38(%rbp),%rax
cmpl   $0xffffffff,-0x1050(%rbp,%rax,4)
ff
je     17ce <process_regular_cmds+0x5ee>
movslq -0x38(%rbp),%rax
mov    -0x1050(%rbp,%rax,4),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    17ce <process_regular_cmds+0x5ee>
mov    0x282c(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x84b(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    187a <process_regular_cmds+0x69a>
jmp    17d3 <process_regular_cmds+0x5f3>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    176e <process_regular_cmds+0x58e>
movl   $0x1,-0x4(%rbp)
jmp    187a <process_regular_cmds+0x69a>
xor    %edi,%edi
mov    $0x1,%esi
call   10b0 <update_buffer@plt>
movl   $0x0,-0x38(%rbp)
mov    -0x38(%rbp),%eax
cmp    -0x34(%rbp),%eax
jae    1873 <process_regular_cmds+0x693>
movslq -0x38(%rbp),%rax
cmpl   $0xffffffff,-0x1050(%rbp,%rax,4)
ff
je     1860 <process_regular_cmds+0x680>
movslq -0x38(%rbp),%rax
mov    -0x1050(%rbp,%rax,4),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1860 <process_regular_cmds+0x680>
mov    0x279a(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
mov    %rax,%rsi
lea    0x7b9(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    187a <process_regular_cmds+0x69a>
jmp    1865 <process_regular_cmds+0x685>
mov    -0x38(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x38(%rbp)
jmp    1800 <process_regular_cmds+0x620>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1070,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_regular_cmds>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
movq   $0x0,0x10(%rsp)
test   %rdi,%rdi
je     1399 <process_regular_cmds+0x1b9>
mov    %rdi,%r14
mov    $0xffffffff,%eax
mov    %rax,0x8(%rsp)
mov    0x2dd1(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    %eax,%ebp
lea    0x20(%rsp),%rdi
mov    $0xffc,%edx
xor    %esi,%esi
call   1060 <memset@plt>
movl   $0xffffffff,0x20(%rsp)
ff
lea    0x10(%rsp),%r15
lea    0x8(%rsp),%r12
xor    %r13d,%r13d
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%rdi
call   1050 <more_commands@plt>
mov    %rax,%rbx
mov    (%r14),%rdi
mov    %r15,%rsi
call   1090 <verify_binary@plt>
test   %eax,%eax
je     1345 <process_regular_cmds+0x165>
cmpq   $0x0,0x10(%rsp)
je     1328 <process_regular_cmds+0x148>
mov    %r12,%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
xor    %eax,%eax
call   1100 <fork@plt>
test   %eax,%eax
jle    1322 <process_regular_cmds+0x142>
movl   $0x0,0x1c(%rsp)
mov    0xc(%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
mov    0x8(%rsp),%ebp
mov    %r13d,%eax
mov    %ebp,0x20(%rsp,%rax,4)
lea    0x1c(%rsp),%rdi
call   10e0 <wait@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
xor    %edi,%edi
mov    $0x1,%esi
call   10b0 <update_buffer@plt>
add    $0x1,%r13d
mov    %rbx,%r14
test   %rbx,%rbx
jne    1250 <process_regular_cmds+0x70>
mov    $0x1,%ebx
test   %r13d,%r13d
je     139b <process_regular_cmds+0x1bb>
mov    %r13d,%r14d
xor    %ebp,%ebp
jmp    130d <process_regular_cmds+0x12d>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%r14
je     139b <process_regular_cmds+0x1bb>
mov    0x20(%rsp,%rbp,4),%edi
cmp    $0xffffffff,%edi
je     1300 <process_regular_cmds+0x120>
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1300 <process_regular_cmds+0x120>
jmp    137c <process_regular_cmds+0x19c>
je     13af <process_regular_cmds+0x1cf>
mov    0x2ca9(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xcc3(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x1,%esi
call   10b0 <update_buffer@plt>
test   %r13d,%r13d
je     139b <process_regular_cmds+0x1bb>
mov    %r13d,%ebx
xor    %ebp,%ebp
jmp    1369 <process_regular_cmds+0x189>
nop
add    $0x1,%rbp
cmp    %rbp,%rbx
je     1399 <process_regular_cmds+0x1b9>
mov    0x20(%rsp,%rbp,4),%edi
cmp    $0xffffffff,%edi
je     1360 <process_regular_cmds+0x180>
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    1360 <process_regular_cmds+0x180>
mov    0x2c55(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xc6f(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %ebx,%ebx
mov    %ebx,%eax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
test   %r13d,%r13d
jne    13ed <process_regular_cmds+0x20d>
test   %rbx,%rbx
je     13ed <process_regular_cmds+0x20d>
mov    0xc(%rsp),%ebx
mov    0x2c0c(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
je     1417 <process_regular_cmds+0x237>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
je     1417 <process_regular_cmds+0x237>
mov    0x8(%rsp),%edi
jmp    1409 <process_regular_cmds+0x229>
test   %r13d,%r13d
jne    1447 <process_regular_cmds+0x267>
test   %rbx,%rbx
jne    1447 <process_regular_cmds+0x267>
mov    0x8(%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
je     1417 <process_regular_cmds+0x237>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
jne    14b2 <process_regular_cmds+0x2d2>
mov    0x2bba(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xbd4(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x1,%esi
call   10b0 <update_buffer@plt>
jmp    139b <process_regular_cmds+0x1bb>
mov    0x2b9a(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    %ebp,%edi
mov    %eax,%esi
call   1030 <dup2@plt>
test   %rbx,%rbx
je     1487 <process_regular_cmds+0x2a7>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
mov    0xc(%rsp),%ebx
mov    0x2b59(%rip),%rax
mov    (%rax),%edi
call   10a0 <fileno@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
mov    %ebp,%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
mov    0xc(%rsp),%edi
call   1070 <close@plt>
cmp    $0xffffffff,%eax
je     1328 <process_regular_cmds+0x148>
mov    0x10(%rsp),%rdi
mov    %r14,%rsi
call   10f0 <execv@plt>
mov    0x2b12(%rip),%rax
mov    (%rax),%edi
call   10d0 <strerror@plt>
lea    0xb2c(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
@__const.process_regular_cmds.pipe_fd = [2 x i32] [i32 -1, i32 0]
@stdin = global i32 0
@.str = [11 x i8] c"error: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
define i32 @process_regular_cmds(i8** %0, i32 %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8**
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [2 x i32]
%13 = alloca i32
%14 = alloca [1023 x i32]
%15 = alloca i32
%16 = alloca i32
store i8** %0, i8*** %4
store i32 %1, i32* %5
store i8* null, i8** %6
%17 = load i8**, i8*** %4
store i8** %17, i8*** %7
store i8** null, i8*** %8
store i32 0, i32* %9
store i32 0, i32* %10
store i32 0, i32* %11
%18 = load i8**, i8*** %4
%19 = icmp eq i8** %18, null
br i1 %19, label %20, label %21
20: ; preds = %2
store i32 0, i32* %3
br label %295
21: ; preds = %2
%22 = bitcast [2 x i32]* %12 to i8*
%23 = load i32, i32* @stdin
%24 = call i32 @fileno(i32 %23)
store i32 %24, i32* %13
%25 = bitcast [1023 x i32]* %14 to i8*
%26 = bitcast i8* %25 to <{ i32, [1022 x i32] }>*
%27 = getelementptr inbounds <{ i32, [1022 x i32] }>, <{ i32, [1022 x i32] }>* %26, i32 0, i32 0
store i32 -1, i32* %27
br label %28
28: ; preds = %237, %21
%29 = load i8**, i8*** %7
%30 = call i8** @more_commands(i8** %29)
store i8** %30, i8*** %8
%31 = load i8**, i8*** %8
%32 = icmp eq i8** %31, null
br i1 %32, label %33, label %34
33: ; preds = %28
store i32 1, i32* %11
br label %34
34: ; preds = %33, %28
%35 = load i8**, i8*** %7
%36 = getelementptr inbounds i8*, i8** %35, i64 0
%37 = load i8*, i8** %36
%38 = call i32 @verify_binary(i8* %37, i8** %6)
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %41
40: ; preds = %34
br label %267
41: ; preds = %34
%42 = load i8*, i8** %6
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %229
44: ; preds = %41
%45 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%46 = call i32 @pipe(i32* %45)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %52
48: ; preds = %44
%49 = load i32, i32* @errno
%50 = call i8* @strerror(i32 %49)
%51 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %50)
br label %267
52: ; preds = %44
%53 = call i32 (...) @fork()
store i32 %53, i32* %15
%54 = load i32, i32* %15
%55 = icmp sgt i32 %54, 0
br i1 %55, label %56, label %80
56: ; preds = %52
store i32 0, i32* %16
%57 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%58 = load i32, i32* %57
%59 = call i32 @close(i32 %58)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %65
61: ; preds = %56
%62 = load i32, i32* @errno
%63 = call i8* @strerror(i32 %62)
%64 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %63)
br label %267
65: ; preds = %56
%66 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%67 = load i32, i32* %66
store i32 %67, i32* %13
%68 = load i32, i32* %13
%69 = load i32, i32* %9
%70 = zext i32 %69 to i64
%71 = getelementptr inbounds [1023 x i32], [1023 x i32]* %14, i64 0, i64 %70
store i32 %68, i32* %71
%72 = call i32 @wait(i32* %16)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %78
74: ; preds = %65
%75 = load i32, i32* @errno
%76 = call i8* @strerror(i32 %75)
%77 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %76)
br label %267
78: ; preds = %65
%79 = call i32 @update_buffer(i8 signext 0, i32 1)
br label %228
80: ; preds = %52
%81 = load i32, i32* %15
%82 = icmp eq i32 %81, 0
br i1 %82, label %83, label %224
83: ; preds = %80
%84 = load i32, i32* %9
%85 = icmp eq i32 %84, 0
br i1 %85, label %86, label %119
86: ; preds = %83
%87 = load i32, i32* %11
%88 = icmp ne i32 %87, 0
br i1 %88, label %119, label %89
89: ; preds = %86
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%91 = load i32, i32* %90
%92 = load i32, i32* @stdout
%93 = call i32 @fileno(i32 %92)
%94 = call i32 @dup2(i32 %91, i32 %93)
%95 = icmp eq i32 %94, -1
br i1 %95, label %96, label %100
96: ; preds = %89
%97 = load i32, i32* @errno
%98 = call i8* @strerror(i32 %97)
%99 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %98)
br label %267
100: ; preds = %89
%101 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%102 = load i32, i32* %101
%103 = call i32 @close(i32 %102)
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %109
105: ; preds = %100
%106 = load i32, i32* @errno
%107 = call i8* @strerror(i32 %106)
%108 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %107)
br label %267
109: ; preds = %100
%110 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%111 = load i32, i32* %110
%112 = call i32 @close(i32 %111)
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %118
114: ; preds = %109
%115 = load i32, i32* @errno
%116 = call i8* @strerror(i32 %115)
%117 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %116)
br label %267
118: ; preds = %109
br label %216
119: ; preds = %86, %83
%120 = load i32, i32* %9
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %144
122: ; preds = %119
%123 = load i32, i32* %11
%124 = icmp ne i32 %123, 0
br i1 %124, label %125, label %144
125: ; preds = %122
%126 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 0
%127 = load i32, i32* %126
%128 = call i32 @close(i32 %127)
%129 = icmp eq i32 %128, -1
br i1 %129, label %130, label %134
130: ; preds = %125
%131 = load i32, i32* @errno
%132 = call i8* @strerror(i32 %131)
%133 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %132)
br label %267
134: ; preds = %125
%135 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%136 = load i32, i32* %135
%137 = call i32 @close(i32 %136)
%138 = icmp eq i32 %137, -1
br i1 %138, label %139, label %143
139: ; preds = %134
%140 = load i32, i32* @errno
%141 = call i8* @strerror(i32 %140)
%142 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %141)
br label %267
143: ; preds = %134
br label %215
144: ; preds = %122, %119
%145 = load i32, i32* %11
%146 = icmp ne i32 %145, 0
br i1 %146, label %147, label %175
147: ; preds = %144
%148 = load i32, i32* %13
%149 = load i32, i32* @stdin
%150 = call i32 @fileno(i32 %149)
%151 = call i32 @dup2(i32 %148, i32 %150)
%152 = icmp eq i32 %151, -1
br i1 %152, label %153, label %157
153: ; preds = %147
%154 = load i32, i32* @errno
%155 = call i8* @strerror(i32 %154)
%156 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %155)
br label %267
157: ; preds = %147
%158 = load i32, i32* %13
%159 = call i32 @close(i32 %158)
%160 = icmp eq i32 %159, -1
br i1 %160, label %161, label %165
161: ; preds = %157
%162 = load i32, i32* @errno
%163 = call i8* @strerror(i32 %162)
%164 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %163)
br label %267
165: ; preds = %157
%166 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%167 = load i32, i32* %166
%168 = call i32 @close(i32 %167)
%169 = icmp eq i32 %168, -1
br i1 %169, label %170, label %174
170: ; preds = %165
%171 = load i32, i32* @errno
%172 = call i8* @strerror(i32 %171)
%173 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %172)
br label %267
174: ; preds = %165
br label %214
175: ; preds = %144
%176 = load i32, i32* %13
%177 = load i32, i32* @stdin
%178 = call i32 @fileno(i32 %177)
%179 = call i32 @dup2(i32 %176, i32 %178)
%180 = icmp eq i32 %179, -1
br i1 %180, label %181, label %185
181: ; preds = %175
%182 = load i32, i32* @errno
%183 = call i8* @strerror(i32 %182)
%184 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %183)
br label %267
185: ; preds = %175
%186 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%187 = load i32, i32* %186
%188 = load i32, i32* @stdout
%189 = call i32 @fileno(i32 %188)
%190 = call i32 @dup2(i32 %187, i32 %189)
%191 = icmp eq i32 %190, -1
br i1 %191, label %192, label %196
192: ; preds = %185
%193 = load i32, i32* @errno
%194 = call i8* @strerror(i32 %193)
%195 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %194)
br label %267
196: ; preds = %185
%197 = load i32, i32* %13
%198 = call i32 @close(i32 %197)
%199 = icmp eq i32 %198, -1
br i1 %199, label %200, label %204
200: ; preds = %196
%201 = load i32, i32* @errno
%202 = call i8* @strerror(i32 %201)
%203 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %202)
br label %267
204: ; preds = %196
%205 = getelementptr inbounds [2 x i32], [2 x i32]* %12, i64 0, i64 1
%206 = load i32, i32* %205
%207 = call i32 @close(i32 %206)
%208 = icmp eq i32 %207, -1
br i1 %208, label %209, label %213
209: ; preds = %204
%210 = load i32, i32* @errno
%211 = call i8* @strerror(i32 %210)
%212 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %211)
br label %267
213: ; preds = %204
br label %214
214: ; preds = %213, %174
br label %215
215: ; preds = %214, %143
br label %216
216: ; preds = %215, %118
%217 = load i8*, i8** %6
%218 = load i8**, i8*** %7
%219 = call i32 @execv(i8* %217, i8** %218)
%220 = load i32, i32* @errno
%221 = call i8* @strerror(i32 %220)
%222 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %221)
%223 = call i32 @exit(i32 -1)
unreachable
224: ; preds = %80
%225 = load i32, i32* @errno
%226 = call i8* @strerror(i32 %225)
%227 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %226)
br label %267
228: ; preds = %78
br label %233
229: ; preds = %41
%230 = load i32, i32* @errno
%231 = call i8* @strerror(i32 %230)
%232 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %231)
br label %267
233: ; preds = %228
%234 = load i8**, i8*** %8
store i8** %234, i8*** %7
%235 = load i32, i32* %9
%236 = add i32 %235, 1
store i32 %236, i32* %9
br label %237
237: ; preds = %233
%238 = load i8**, i8*** %7
%239 = icmp ne i8** %238, null
br i1 %239, label %28, label %240
240: ; preds = %237
store i32 0, i32* %10
br label %241
241: ; preds = %263, %240
%242 = load i32, i32* %10
%243 = load i32, i32* %9
%244 = icmp ult i32 %242, %243
br i1 %244, label %245, label %266
245: ; preds = %241
%246 = load i32, i32* %10
%247 = sext i32 %246 to i64
%248 = getelementptr inbounds [1023 x i32], [1023 x i32]* %14, i64 0, i64 %247
%249 = load i32, i32* %248
%250 = icmp ne i32 %249, -1
br i1 %250, label %251, label %262
251: ; preds = %245
%252 = load i32, i32* %10
%253 = sext i32 %252 to i64
%254 = getelementptr inbounds [1023 x i32], [1023 x i32]* %14, i64 0, i64 %253
%255 = load i32, i32* %254
%256 = call i32 @close(i32 %255)
%257 = icmp eq i32 %256, -1
br i1 %257, label %258, label %262
258: ; preds = %251
%259 = load i32, i32* @errno
%260 = call i8* @strerror(i32 %259)
%261 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %260)
store i32 0, i32* %3
br label %295
262: ; preds = %251, %245
br label %263
263: ; preds = %262
%264 = load i32, i32* %10
%265 = add nsw i32 %264, 1
store i32 %265, i32* %10
br label %241
266: ; preds = %241
store i32 1, i32* %3
br label %295
267: ; preds = %229, %224, %209, %200, %192, %181, %170, %161, %153, %139, %130, %114, %105, %96, %74, %61, %48, %40
%268 = call i32 @update_buffer(i8 signext 0, i32 1)
store i32 0, i32* %10
br label %269
269: ; preds = %291, %267
%270 = load i32, i32* %10
%271 = load i32, i32* %9
%272 = icmp ult i32 %270, %271
br i1 %272, label %273, label %294
273: ; preds = %269
%274 = load i32, i32* %10
%275 = sext i32 %274 to i64
%276 = getelementptr inbounds [1023 x i32], [1023 x i32]* %14, i64 0, i64 %275
%277 = load i32, i32* %276
%278 = icmp ne i32 %277, -1
br i1 %278, label %279, label %290
279: ; preds = %273
%280 = load i32, i32* %10
%281 = sext i32 %280 to i64
%282 = getelementptr inbounds [1023 x i32], [1023 x i32]* %14, i64 0, i64 %281
%283 = load i32, i32* %282
%284 = call i32 @close(i32 %283)
%285 = icmp eq i32 %284, -1
br i1 %285, label %286, label %290
286: ; preds = %279
%287 = load i32, i32* @errno
%288 = call i8* @strerror(i32 %287)
%289 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %288)
store i32 0, i32* %3
br label %295
290: ; preds = %279, %273
br label %291
291: ; preds = %290
%292 = load i32, i32* %10
%293 = add nsw i32 %292, 1
store i32 %293, i32* %10
br label %269
294: ; preds = %269
store i32 0, i32* %3
br label %295
295: ; preds = %294, %286, %266, %258, %20
%296 = load i32, i32* %3
ret i32 %296
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [11 x i8] c"error: %s\0A\00"
@errno = global i32 0
@stdout = global i32 0
define i32 @process_regular_cmds(i8** %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca [1023 x i32]
%6 = alloca i32
%7 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%8 = icmp eq i8** %0, null
br i1 %8, label %204, label %9
9: ; preds = %2
%10 = bitcast i64* %4 to [2 x i32]*
%11 = bitcast i64* %4 to i8*
store i64 4294967295, i64* %4
%12 = load i32, i32* @stdin
%13 = tail call i32 @fileno(i32 %12)
%14 = bitcast [1023 x i32]* %5 to i8*
%15 = getelementptr inbounds [1023 x i32], [1023 x i32]* %5, i64 0, i64 0
store i32 -1, i32* %15
%16 = bitcast i64* %4 to i32*
%17 = bitcast i32* %6 to i8*
%18 = getelementptr inbounds [2 x i32], [2 x i32]* %10, i64 0, i64 1
br label %19
19: ; preds = %155, %9
%20 = phi i8** [ %0, %9 ], [ %23, %155 ]
%21 = phi i32 [ 0, %9 ], [ %157, %155 ]
%22 = phi i32 [ %13, %9 ], [ %46, %155 ]
%23 = call i8** @more_commands(i8** %20)
%24 = icmp eq i8** %23, null
%25 = load i8*, i8** %20
%26 = call i32 @verify_binary(i8* %25, i8** %3)
%27 = icmp eq i32 %26, 0
br i1 %27, label %182, label %28
28: ; preds = %19
%29 = load i8*, i8** %3
%30 = icmp eq i8* %29, null
br i1 %30, label %151, label %31
31: ; preds = %28
%32 = call i32 @pipe(i32* %16)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %38
34: ; preds = %31
%35 = load i32, i32* @errno
%36 = call i8* @strerror(i32 %35)
%37 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %36)
br label %182
38: ; preds = %31
%39 = call i32 (...) @fork()
%40 = icmp sgt i32 %39, 0
br i1 %40, label %41, label %55
41: ; preds = %38
store i32 0, i32* %6
%42 = load i32, i32* %18
%43 = call i32 @close(i32 %42)
%44 = icmp eq i32 %43, -1
br i1 %44, label %51, label %45
45: ; preds = %41
%46 = load i32, i32* %16
%47 = zext i32 %21 to i64
%48 = getelementptr inbounds [1023 x i32], [1023 x i32]* %5, i64 0, i64 %47
store i32 %46, i32* %48
%49 = call i32 @wait(i32* %6)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %155
51: ; preds = %45, %41
%52 = load i32, i32* @errno
%53 = call i8* @strerror(i32 %52)
%54 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %53)
br label %182
55: ; preds = %38
%56 = icmp eq i32 %39, 0
br i1 %56, label %57, label %147
57: ; preds = %55
%58 = icmp ne i32 %21, 0
%59 = select i1 %58, i1 true, i1 %24
br i1 %59, label %74, label %60
60: ; preds = %57
%61 = load i32, i32* %18
%62 = load i32, i32* @stdout
%63 = call i32 @fileno(i32 %62)
%64 = call i32 @dup2(i32 %61, i32 %63)
%65 = icmp eq i32 %64, -1
br i1 %65, label %177, label %66
66: ; preds = %60
%67 = load i32, i32* %18
%68 = call i32 @close(i32 %67)
%69 = icmp eq i32 %68, -1
br i1 %69, label %177, label %70
70: ; preds = %66
%71 = load i32, i32* %16
%72 = call i32 @close(i32 %71)
%73 = icmp eq i32 %72, -1
br i1 %73, label %177, label %140
74: ; preds = %57
%75 = icmp eq i32 %21, 0
%76 = select i1 %75, i1 %24, i1 false
br i1 %76, label %77, label %85
77: ; preds = %74
%78 = load i32, i32* %16
%79 = call i32 @close(i32 %78)
%80 = icmp eq i32 %79, -1
br i1 %80, label %177, label %81
81: ; preds = %77
%82 = load i32, i32* %18
%83 = call i32 @close(i32 %82)
%84 = icmp eq i32 %83, -1
br i1 %84, label %177, label %140
85: ; preds = %74
%86 = load i32, i32* @stdin
%87 = call i32 @fileno(i32 %86)
%88 = call i32 @dup2(i32 %22, i32 %87)
%89 = icmp eq i32 %88, -1
br i1 %24, label %90, label %110
90: ; preds = %85
br i1 %89, label %91, label %95
91: ; preds = %90
%92 = load i32, i32* @errno
%93 = call i8* @strerror(i32 %92)
%94 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %93)
br label %182
95: ; preds = %90
%96 = call i32 @close(i32 %22)
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %102
98: ; preds = %95
%99 = load i32, i32* @errno
%100 = call i8* @strerror(i32 %99)
%101 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %100)
br label %182
102: ; preds = %95
%103 = load i32, i32* %18
%104 = call i32 @close(i32 %103)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %140
106: ; preds = %102
%107 = load i32, i32* @errno
%108 = call i8* @strerror(i32 %107)
%109 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %108)
br label %182
110: ; preds = %85
br i1 %89, label %111, label %115
111: ; preds = %110
%112 = load i32, i32* @errno
%113 = call i8* @strerror(i32 %112)
%114 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %113)
br label %182
115: ; preds = %110
%116 = load i32, i32* %18
%117 = load i32, i32* @stdout
%118 = call i32 @fileno(i32 %117)
%119 = call i32 @dup2(i32 %116, i32 %118)
%120 = icmp eq i32 %119, -1
br i1 %120, label %121, label %125
121: ; preds = %115
%122 = load i32, i32* @errno
%123 = call i8* @strerror(i32 %122)
%124 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %123)
br label %182
125: ; preds = %115
%126 = call i32 @close(i32 %22)
%127 = icmp eq i32 %126, -1
br i1 %127, label %128, label %132
128: ; preds = %125
%129 = load i32, i32* @errno
%130 = call i8* @strerror(i32 %129)
%131 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %130)
br label %182
132: ; preds = %125
%133 = load i32, i32* %18
%134 = call i32 @close(i32 %133)
%135 = icmp eq i32 %134, -1
br i1 %135, label %136, label %140
136: ; preds = %132
%137 = load i32, i32* @errno
%138 = call i8* @strerror(i32 %137)
%139 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %138)
br label %182
140: ; preds = %81, %132, %102, %70
%141 = load i8*, i8** %3
%142 = call i32 @execv(i8* %141, i8** %20)
%143 = load i32, i32* @errno
%144 = call i8* @strerror(i32 %143)
%145 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %144)
%146 = call i32 @exit(i32 -1)
unreachable
147: ; preds = %55
%148 = load i32, i32* @errno
%149 = call i8* @strerror(i32 %148)
%150 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %149)
br label %182
151: ; preds = %28
%152 = load i32, i32* @errno
%153 = call i8* @strerror(i32 %152)
%154 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %153)
br label %182
155: ; preds = %45
%156 = call i32 @update_buffer(i8 signext 0, i32 1)
%157 = add i32 %21, 1
br i1 %24, label %158, label %19
158: ; preds = %155
%159 = icmp eq i32 %157, 0
br i1 %159, label %202, label %160
160: ; preds = %158
%161 = zext i32 %157 to i64
br label %162
162: ; preds = %160, %174
%163 = phi i64 [ 0, %160 ], [ %175, %174 ]
%164 = getelementptr inbounds [1023 x i32], [1023 x i32]* %5, i64 0, i64 %163
%165 = load i32, i32* %164
%166 = icmp eq i32 %165, -1
br i1 %166, label %174, label %167
167: ; preds = %162
%168 = call i32 @close(i32 %165)
%169 = icmp eq i32 %168, -1
br i1 %169, label %170, label %174
170: ; preds = %167
%171 = load i32, i32* @errno
%172 = call i8* @strerror(i32 %171)
%173 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %172)
br label %202
174: ; preds = %162, %167
%175 = add nuw nsw i64 %163, 1
%176 = icmp eq i64 %175, %161
br i1 %176, label %202, label %162
177: ; preds = %81, %77, %70, %66, %60
%178 = load i32, i32* @errno
%179 = call i8* @strerror(i32 %178)
%180 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %179)
%181 = call i32 @update_buffer(i8 signext 0, i32 1)
br label %202
182: ; preds = %19, %51, %147, %136, %128, %121, %111, %106, %98, %91, %151, %34
%183 = call i32 @update_buffer(i8 signext 0, i32 1)
%184 = icmp eq i32 %21, 0
br i1 %184, label %202, label %185
185: ; preds = %182
%186 = zext i32 %21 to i64
br label %187
187: ; preds = %185, %199
%188 = phi i64 [ 0, %185 ], [ %200, %199 ]
%189 = getelementptr inbounds [1023 x i32], [1023 x i32]* %5, i64 0, i64 %188
%190 = load i32, i32* %189
%191 = icmp eq i32 %190, -1
br i1 %191, label %199, label %192
192: ; preds = %187
%193 = call i32 @close(i32 %190)
%194 = icmp eq i32 %193, -1
br i1 %194, label %195, label %199
195: ; preds = %192
%196 = load i32, i32* @errno
%197 = call i8* @strerror(i32 %196)
%198 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %197)
br label %202
199: ; preds = %187, %192
%200 = add nuw nsw i64 %188, 1
%201 = icmp eq i64 %200, %186
br i1 %201, label %202, label %187
202: ; preds = %174, %199, %177, %158, %182, %195, %170
%203 = phi i32 [ 0, %195 ], [ 0, %170 ], [ 0, %182 ], [ 1, %158 ], [ 0, %177 ], [ 0, %199 ], [ 1, %174 ]
br label %204
204: ; preds = %2, %202
%205 = phi i32 [ %203, %202 ], [ 0, %2 ]
ret i32 %205
}