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

/* Variables and functions */
int execute(char *, char **);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int file_to_stdin(char **, char *);
int get_num_args(char *);
int pipe_of_wish(char **, char **);
int stderr_to_file_append(char **, char *);
int stderr_to_file_overwrite(char **, char *);
int stderr_to_stdout(char **);
int /*<<< orphan*/ stdin;
int stdout_to_file_append(char **, char *);
int stdout_to_file_overwrite(char **, char *);
int stdout_to_stderr(char **);
int /*<<< orphan*/ strcmp(char *, char *);
char *strsep(char **, char *);
int get_and_run_userin() {
  char buff[256];
  fgets(buff, sizeof(buff), stdin);
  char *ptr_to_buff = buff;
  char *line = strsep(&ptr_to_buff, "\n");
  if (!(*line)) {
    return 0;
  }
  int num_commands = 1;
  int i;
  for (i = 0; line[i]; i++) {
    if (line[i] == ';')
      num_commands++;
  }
  char *commands[num_commands];
  for (i = 0; i < num_commands; i++) {
    commands[i] = strsep(&line, ";");
  }
  int retval;
  int counter;
  for (counter = 0; counter < num_commands; counter++) {
    if (!(commands[counter][0])) {
      retval = 0;
      continue;
    }
    int num_args = get_num_args(commands[counter]);
    char *args[num_args + 1];
    for (i = 0; i < num_args; i++) {
      args[i] = strsep(&commands[counter], " ");
      if (!args[i][0])
        i--;
    }
    if (!args[num_args - 1][0])
      args[num_args - 1] = NULL;
    args[num_args] = NULL;
    char *command[num_args];
    int j;
    int redirected = 0;
    for (i = 0; i < num_args; i++) {
      if (!strcmp(args[i], ">")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = stdout_to_file_overwrite(command, args[num_args - 1]);
        redirected = 1;
      } else if (!strcmp(args[i], ">>")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = stdout_to_file_append(command, args[num_args - 1]);
        redirected = 1;
      } else if (!strcmp(args[i], "2>")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = stderr_to_file_overwrite(command, args[num_args - 1]);
        redirected = 1;
      } else if (!strcmp(args[i], "2>>")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = stderr_to_file_append(command, args[num_args - 1]);
        redirected = 1;
      } else if (!strcmp(args[i], "2>1")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = stderr_to_stdout(command);
        redirected = 1;
      } else if (!strcmp(args[i], "&>")) {
        retval = stdout_to_stderr(command);
        redirected = 1;
      } else if (!strcmp(args[i], "<")) {
        for (j = 0; j < i; j++) {
          command[j] = args[j];
        }
        command[i] = NULL;
        retval = file_to_stdin(command, args[num_args - 1]);
        redirected = 1;
      } else if (!strcmp(args[i], "|")) {
        char *command1[i + 1];
        char *command2[num_args - i + 1];
        for (j = 0; j < i; j++) {
          command1[j] = args[j];
        }
        command1[i] = NULL;
        for (j = i + 1; j <= num_args; j++) {
          command2[j - i - 1] = args[j];
        }
        retval = pipe_of_wish(command1, command2);
        redirected = 1;
      }
    }
    if (!redirected)
      retval = execute(args[0], args);
  }
  return retval;
}


x86 assembly (clang, -O0):
<get_and_run_userin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1b0,%rsp
lea    -0x110(%rbp),%rdi
mov    0x2dff(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   1060 <fgets@plt>
lea    -0x110(%rbp),%rax
mov    %rax,-0x118(%rbp)
lea    -0x118(%rbp),%rdi
lea    0xdef(%rip),%rsi
call   10a0 <strsep@plt>
mov    %rax,-0x120(%rbp)
mov    -0x120(%rbp),%rax
cmpb   $0x0,(%rax)
jne    1239 <get_and_run_userin+0x69>
movl   $0x0,-0x4(%rbp)
jmp    1bd2 <get_and_run_userin+0xa02>
movl   $0x1,-0x124(%rbp)
movl   $0x0,-0x128(%rbp)
mov    -0x120(%rbp),%rax
movslq -0x128(%rbp),%rcx
cmpb   $0x0,(%rax,%rcx,1)
je     12a8 <get_and_run_userin+0xd8>
mov    -0x120(%rbp),%rax
movslq -0x128(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    128f <get_and_run_userin+0xbf>
mov    -0x124(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x124(%rbp)
jmp    1294 <get_and_run_userin+0xc4>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    124d <get_and_run_userin+0x7d>
mov    -0x124(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x130(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x188(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x138(%rbp)
movl   $0x0,-0x128(%rbp)
mov    -0x128(%rbp),%eax
cmp    -0x124(%rbp),%eax
jge    1333 <get_and_run_userin+0x163>
lea    -0x120(%rbp),%rdi
lea    0xcfd(%rip),%rsi
call   10a0 <strsep@plt>
mov    %rax,%rdx
mov    -0x188(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    12e5 <get_and_run_userin+0x115>
movl   $0x0,-0x140(%rbp)
mov    -0x140(%rbp),%eax
cmp    -0x124(%rbp),%eax
jge    1bbf <get_and_run_userin+0x9ef>
mov    -0x188(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpb   $0x0,(%rax)
jne    1379 <get_and_run_userin+0x1a9>
movl   $0x0,-0x13c(%rbp)
jmp    1bab <get_and_run_userin+0x9db>
mov    -0x188(%rbp),%rax
movslq -0x140(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   10b0 <get_num_args@plt>
mov    %eax,-0x144(%rbp)
mov    -0x144(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x150(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x190(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x158(%rbp)
movl   $0x0,-0x128(%rbp)
mov    -0x128(%rbp),%eax
cmp    -0x144(%rbp),%eax
jge    145a <get_and_run_userin+0x28a>
mov    -0x188(%rbp),%rdi
movslq -0x140(%rbp),%rax
shl    $0x3,%rax
add    %rax,%rdi
lea    0xc00(%rip),%rsi
call   10a0 <strsep@plt>
mov    %rax,%rdx
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
cmpb   $0x0,(%rax)
jne    1441 <get_and_run_userin+0x271>
mov    -0x128(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x128(%rbp)
jmp    1446 <get_and_run_userin+0x276>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    13d6 <get_and_run_userin+0x206>
mov    -0x190(%rbp),%rax
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
cmpb   $0x0,(%rax)
jne    1495 <get_and_run_userin+0x2c5>
mov    -0x190(%rbp),%rax
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x190(%rbp),%rax
movslq -0x144(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x144(%rbp),%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x198(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x160(%rbp)
movl   $0x0,-0x168(%rbp)
movl   $0x0,-0x128(%rbp)
mov    -0x128(%rbp),%eax
cmp    -0x144(%rbp),%eax
jge    1b7f <get_and_run_userin+0x9af>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xaff(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    15bc <get_and_run_userin+0x3ec>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    1575 <get_and_run_userin+0x3a5>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    152b <get_and_run_userin+0x35b>
mov    -0x198(%rbp),%rdi
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rdi,%rcx,8)
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   10c0 <stdout_to_file_overwrite@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b66 <get_and_run_userin+0x996>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xa35(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    167e <get_and_run_userin+0x4ae>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    1637 <get_and_run_userin+0x467>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    15ed <get_and_run_userin+0x41d>
mov    -0x198(%rbp),%rdi
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rdi,%rcx,8)
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1090 <stdout_to_file_append@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b61 <get_and_run_userin+0x991>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x96f(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1740 <get_and_run_userin+0x570>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    16f9 <get_and_run_userin+0x529>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    16af <get_and_run_userin+0x4df>
mov    -0x198(%rbp),%rdi
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rdi,%rcx,8)
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1040 <stderr_to_file_overwrite@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b5c <get_and_run_userin+0x98c>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x8b0(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1802 <get_and_run_userin+0x632>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    17bb <get_and_run_userin+0x5eb>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1771 <get_and_run_userin+0x5a1>
mov    -0x198(%rbp),%rdi
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rdi,%rcx,8)
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1070 <stderr_to_file_append@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b57 <get_and_run_userin+0x987>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x7f2(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    18ad <get_and_run_userin+0x6dd>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    187d <get_and_run_userin+0x6ad>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1833 <get_and_run_userin+0x663>
mov    -0x198(%rbp),%rdi
movslq -0x128(%rbp),%rax
movq   $0x0,(%rdi,%rax,8)
call   10f0 <stderr_to_stdout@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b52 <get_and_run_userin+0x982>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x74b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    18f5 <get_and_run_userin+0x725>
mov    -0x198(%rbp),%rdi
call   10d0 <stdout_to_stderr@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b4d <get_and_run_userin+0x97d>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x706(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    19b7 <get_and_run_userin+0x7e7>
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    1970 <get_and_run_userin+0x7a0>
mov    -0x198(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1926 <get_and_run_userin+0x756>
mov    -0x198(%rbp),%rdi
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rdi,%rcx,8)
mov    -0x144(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <file_to_stdin@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
jmp    1b48 <get_and_run_userin+0x978>
mov    -0x190(%rbp),%rax
movslq -0x128(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0x646(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%eax
jne    1b43 <get_and_run_userin+0x973>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %rsp,%rcx
mov    %rcx,-0x170(%rbp)
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a8(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x178(%rbp)
mov    -0x144(%rbp),%eax
mov    -0x128(%rbp),%ecx
sub    %ecx,%eax
add    $0x1,%eax
lea    0xf(,%rax,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x1a0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x180(%rbp)
movl   $0x0,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x128(%rbp),%eax
jge    1a9c <get_and_run_userin+0x8cc>
mov    -0x1a8(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
movslq -0x164(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1a52 <get_and_run_userin+0x882>
mov    -0x1a8(%rbp),%rax
movslq -0x128(%rbp),%rcx
movq   $0x0,(%rax,%rcx,8)
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
mov    -0x164(%rbp),%eax
cmp    -0x144(%rbp),%eax
jg     1b16 <get_and_run_userin+0x946>
mov    -0x1a0(%rbp),%rax
mov    -0x190(%rbp),%rcx
movslq -0x164(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
mov    -0x164(%rbp),%ecx
sub    -0x128(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x164(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x164(%rbp)
jmp    1ac1 <get_and_run_userin+0x8f1>
mov    -0x1a0(%rbp),%rsi
mov    -0x1a8(%rbp),%rdi
call   10e0 <pipe_of_wish@plt>
mov    %eax,-0x13c(%rbp)
movl   $0x1,-0x168(%rbp)
mov    -0x170(%rbp),%rax
mov    %rax,%rsp
jmp    1b48 <get_and_run_userin+0x978>
jmp    1b4d <get_and_run_userin+0x97d>
jmp    1b52 <get_and_run_userin+0x982>
jmp    1b57 <get_and_run_userin+0x987>
jmp    1b5c <get_and_run_userin+0x98c>
jmp    1b61 <get_and_run_userin+0x991>
jmp    1b66 <get_and_run_userin+0x996>
jmp    1b6b <get_and_run_userin+0x99b>
mov    -0x128(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x128(%rbp)
jmp    14e8 <get_and_run_userin+0x318>
cmpl   $0x0,-0x168(%rbp)
jne    1ba1 <get_and_run_userin+0x9d1>
mov    -0x190(%rbp),%rsi
mov    (%rsi),%rdi
call   1050 <execute@plt>
mov    %eax,-0x13c(%rbp)
mov    -0x150(%rbp),%rax
mov    %rax,%rsp
mov    -0x140(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x140(%rbp)
jmp    133d <get_and_run_userin+0x16d>
mov    -0x13c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x130(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_and_run_userin>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x178,%rsp
mov    0x2ded(%rip),%rax
mov    (%rax),%edx
lea    -0x1a0(%rbp),%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1060 <fgets@plt>
mov    %rbx,-0x98(%rbp)
lea    0xde1(%rip),%rsi
lea    -0x98(%rbp),%rdi
call   10b0 <strsep@plt>
mov    %rax,-0x90(%rbp)
mov    (%rax),%cl
test   %cl,%cl
je     16f1 <get_and_run_userin+0x511>
add    $0x1,%rax
mov    $0x1,%r12d
jmp    125b <get_and_run_userin+0x7b>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r12d
movzbl (%rax),%ecx
add    $0x1,%rax
cmp    $0x3b,%cl
je     1250 <get_and_run_userin+0x70>
test   %cl,%cl
jne    1254 <get_and_run_userin+0x74>
mov    %rsp,%rcx
mov    %r12d,%r13d
mov    %rsp,%rdx
lea    0xf(,%r13,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,-0x50(%rbp)
mov    %rdx,%rsp
test   %r12d,%r12d
mov    %rcx,-0x70(%rbp)
jle    16f5 <get_and_run_userin+0x515>
xor    %ebx,%ebx
lea    -0x90(%rbp),%r15
mov    -0x50(%rbp),%r14
nopl   (%rax)
mov    %r15,%rdi
lea    0xd58(%rip),%rsi
call   10b0 <strsep@plt>
mov    %rax,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    %rbx,%r13
jne    12a0 <get_and_run_userin+0xc0>
test   %r12d,%r12d
jle    16f5 <get_and_run_userin+0x515>
mov    %r13,-0x78(%rbp)
xor    %edx,%edx
lea    0xd32(%rip),%r13
mov    -0x50(%rbp),%rbx
jmp    1315 <get_and_run_userin+0x135>
nopl   0x0(%rax,%rax,1)
mov    (%r12),%rdi
mov    %r12,%rsi
call   1050 <execute@plt>
mov    %eax,-0x30(%rbp)
mov    -0x80(%rbp),%rsp
mov    -0x30(%rbp),%eax
mov    -0x50(%rbp),%rbx
mov    -0x60(%rbp),%rdx
lea    0xcff(%rip),%r13
add    $0x1,%rdx
mov    %eax,%ecx
cmp    -0x78(%rbp),%rdx
je     16f5 <get_and_run_userin+0x515>
mov    (%rbx,%rdx,8),%rdi
cmpb   $0x0,(%rdi)
mov    $0x0,%eax
je     1305 <get_and_run_userin+0x125>
mov    %rdx,-0x60(%rbp)
mov    %ecx,-0x30(%rbp)
call   10c0 <get_num_args@plt>
mov    %eax,%r15d
mov    %rsp,-0x80(%rbp)
lea    0x1(%r15),%eax
mov    %rsp,%r12
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
test   %r15d,%r15d
jle    1380 <get_and_run_userin+0x1a0>
mov    -0x60(%rbp),%rax
lea    (%rbx,%rax,8),%r14
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r14,%rdi
mov    %r13,%rsi
call   10b0 <strsep@plt>
movslq %ebx,%rbx
mov    %rax,(%r12,%rbx,8)
cmpb   $0x1,(%rax)
sbb    $0x0,%ebx
add    $0x1,%ebx
cmp    %r15d,%ebx
jl     1360 <get_and_run_userin+0x180>
lea    -0x1(%r15),%r14d
movslq %r14d,%rax
mov    %rax,-0x48(%rbp)
mov    (%r12,%rax,8),%rax
cmpb   $0x0,(%rax)
jne    13a0 <get_and_run_userin+0x1c0>
mov    -0x48(%rbp),%rax
movq   $0x0,(%r12,%rax,8)
movslq %r15d,%rax
movq   $0x0,(%r12,%rax,8)
mov    %r15d,%ecx
mov    %rsp,%rdx
lea    0xf(,%rcx,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rdx
mov    %rdx,%rsp
test   %r15d,%r15d
jle    12e0 <get_and_run_userin+0x100>
mov    %rdx,-0x40(%rbp)
lea    0x8(%r12),%rax
mov    %rax,-0x68(%rbp)
shl    $0x3,%rcx
xor    %r15d,%r15d
mov    $0x1,%r13d
xor    %eax,%eax
mov    %rcx,-0x88(%rbp)
mov    %r12,-0x38(%rbp)
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %eax,-0x58(%rbp)
mov    -0x68(%rbp),%rax
mov    -0x8(%rax,%r15,1),%rbx
mov    %rbx,%rdi
lea    0xbfc(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1560 <get_and_run_userin+0x380>
mov    %rbx,%rdi
lea    0xbdd(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     15a0 <get_and_run_userin+0x3c0>
mov    %rbx,%rdi
lea    0xbc2(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     15d8 <get_and_run_userin+0x3f8>
mov    %rbx,%rdi
lea    0xbae(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1610 <get_and_run_userin+0x430>
mov    %rbx,%rdi
lea    0xb9b(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1648 <get_and_run_userin+0x468>
mov    %rbx,%rdi
lea    0xb88(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     1675 <get_and_run_userin+0x495>
mov    %rbx,%rdi
lea    0xb74(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
je     168c <get_and_run_userin+0x4ac>
mov    %rbx,%rdi
lea    0xb5f(%rip),%rsi
call   1080 <strcmp@plt>
test   %eax,%eax
mov    -0x38(%rbp),%r12
mov    -0x58(%rbp),%eax
jne    16c8 <get_and_run_userin+0x4e8>
mov    %rsp,-0x58(%rbp)
mov    -0x68(%rbp),%rax
lea    (%rax,%r15,1),%rsi
mov    %rsp,%r12
lea    0xf(,%r13,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
lea    0x2(%r14),%eax
mov    %rsp,%rbx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
test   %r15,%r15
je     1521 <get_and_run_userin+0x341>
mov    %r12,%rdi
mov    %rsi,-0x30(%rbp)
mov    -0x38(%rbp),%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
mov    -0x30(%rbp),%rsi
mov    %r14d,%eax
lea    0x8(,%rax,8),%rdx
movq   $0x0,(%r12,%r15,1)
mov    %rbx,%rdi
call   1090 <memcpy@plt>
mov    %r12,%rdi
mov    %rbx,%rsi
call   10f0 <pipe_of_wish@plt>
mov    %eax,-0x30(%rbp)
mov    $0x1,%eax
mov    -0x58(%rbp),%rsp
jmp    1686 <get_and_run_userin+0x4a6>
nopl   0x0(%rax,%rax,1)
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     157b <get_and_run_userin+0x39b>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    -0x48(%rbp),%rax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   10d0 <stdout_to_file_overwrite@plt>
jmp    16c0 <get_and_run_userin+0x4e0>
nopl   0x0(%rax,%rax,1)
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     15bb <get_and_run_userin+0x3db>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    -0x48(%rbp),%rax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   10a0 <stdout_to_file_append@plt>
jmp    16c0 <get_and_run_userin+0x4e0>
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     15f3 <get_and_run_userin+0x413>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    -0x48(%rbp),%rax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   1040 <stderr_to_file_overwrite@plt>
jmp    16c0 <get_and_run_userin+0x4e0>
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     162b <get_and_run_userin+0x44b>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    -0x48(%rbp),%rax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   1070 <stderr_to_file_append@plt>
jmp    16c0 <get_and_run_userin+0x4e0>
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     1663 <get_and_run_userin+0x483>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    %rbx,%rdi
call   1100 <stderr_to_stdout@plt>
jmp    16c0 <get_and_run_userin+0x4e0>
mov    -0x40(%rbp),%rdi
call   10e0 <stdout_to_stderr@plt>
mov    %eax,-0x30(%rbp)
mov    $0x1,%eax
mov    -0x38(%rbp),%r12
jmp    16c8 <get_and_run_userin+0x4e8>
test   %r15,%r15
mov    -0x38(%rbp),%r12
mov    -0x40(%rbp),%rbx
je     16a7 <get_and_run_userin+0x4c7>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %r15,%rdx
call   1090 <memcpy@plt>
movq   $0x0,(%rbx,%r15,1)
mov    -0x48(%rbp),%rax
mov    (%r12,%rax,8),%rsi
mov    %rbx,%rdi
call   1030 <file_to_stdin@plt>
nop
mov    %eax,-0x30(%rbp)
mov    $0x1,%eax
add    $0xffffffff,%r14d
add    $0x8,%r15
add    $0x1,%r13
mov    -0x88(%rbp),%rcx
cmp    %r15,%rcx
jne    1400 <get_and_run_userin+0x220>
test   %eax,%eax
jne    12ef <get_and_run_userin+0x10f>
jmp    12e0 <get_and_run_userin+0x100>
xor    %eax,%eax
jmp    16f9 <get_and_run_userin+0x519>
mov    -0x70(%rbp),%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c">\00"
@.str.4 = [3 x i8] c">>\00"
@.str.5 = [3 x i8] c"2>\00"
@.str.6 = [4 x i8] c"2>>\00"
@.str.7 = [4 x i8] c"2>1\00"
@.str.8 = [3 x i8] c"&>\00"
@.str.9 = [2 x i8] c"<\00"
@.str.10 = [2 x i8] c"|\00"
define i32 @get_and_run_userin() {
%1 = alloca i32
%2 = alloca [256 x i8]
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca i8*
%18 = alloca i64
%19 = alloca i64
%20 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
%21 = load i32, i32* @stdin
%22 = call i32 @fgets(i8* %20, i32 256, i32 %21)
%23 = getelementptr inbounds [256 x i8], [256 x i8]* %2, i64 0, i64 0
store i8* %23, i8** %3
%24 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %24, i8** %4
%25 = load i8*, i8** %4
%26 = load i8, i8* %25
%27 = icmp ne i8 %26, 0
br i1 %27, label %29, label %28
28: ; preds = %0
store i32 0, i32* %1
br label %434
29: ; preds = %0
store i32 1, i32* %5
store i32 0, i32* %6
br label %30
30: ; preds = %49, %29
%31 = load i8*, i8** %4
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = load i8, i8* %34
%36 = icmp ne i8 %35, 0
br i1 %36, label %37, label %52
37: ; preds = %30
%38 = load i8*, i8** %4
%39 = load i32, i32* %6
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %38, i64 %40
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp eq i32 %43, 59
br i1 %44, label %45, label %48
45: ; preds = %37
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 1
store i32 %47, i32* %5
br label %48
48: ; preds = %45, %37
br label %49
49: ; preds = %48
%50 = load i32, i32* %6
%51 = add nsw i32 %50, 1
store i32 %51, i32* %6
br label %30
52: ; preds = %30
%53 = load i32, i32* %5
%54 = zext i32 %53 to i64
%55 = call i8* @llvm.stacksave()
store i8* %55, i8** %7
%56 = alloca i8*, i64 %54
store i64 %54, i64* %8
store i32 0, i32* %6
br label %57
57: ; preds = %66, %52
%58 = load i32, i32* %6
%59 = load i32, i32* %5
%60 = icmp slt i32 %58, %59
br i1 %60, label %61, label %69
61: ; preds = %57
%62 = call i8* @strsep(i8** %4, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%63 = load i32, i32* %6
%64 = sext i32 %63 to i64
%65 = getelementptr inbounds i8*, i8** %56, i64 %64
store i8* %62, i8** %65
br label %66
66: ; preds = %61
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
br label %57
69: ; preds = %57
store i32 0, i32* %10
br label %70
70: ; preds = %428, %69
%71 = load i32, i32* %10
%72 = load i32, i32* %5
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %431
74: ; preds = %70
%75 = load i32, i32* %10
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i8*, i8** %56, i64 %76
%78 = load i8*, i8** %77
%79 = getelementptr inbounds i8, i8* %78, i64 0
%80 = load i8, i8* %79
%81 = icmp ne i8 %80, 0
br i1 %81, label %83, label %82
82: ; preds = %74
store i32 0, i32* %9
br label %428
83: ; preds = %74
%84 = load i32, i32* %10
%85 = sext i32 %84 to i64
%86 = getelementptr inbounds i8*, i8** %56, i64 %85
%87 = load i8*, i8** %86
%88 = call i32 @get_num_args(i8* %87)
store i32 %88, i32* %11
%89 = load i32, i32* %11
%90 = add nsw i32 %89, 1
%91 = zext i32 %90 to i64
%92 = call i8* @llvm.stacksave()
store i8* %92, i8** %12
%93 = alloca i8*, i64 %91
store i64 %91, i64* %13
store i32 0, i32* %6
br label %94
94: ; preds = %117, %83
%95 = load i32, i32* %6
%96 = load i32, i32* %11
%97 = icmp slt i32 %95, %96
br i1 %97, label %98, label %120
98: ; preds = %94
%99 = load i32, i32* %10
%100 = sext i32 %99 to i64
%101 = getelementptr inbounds i8*, i8** %56, i64 %100
%102 = call i8* @strsep(i8** %101, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%103 = load i32, i32* %6
%104 = sext i32 %103 to i64
%105 = getelementptr inbounds i8*, i8** %93, i64 %104
store i8* %102, i8** %105
%106 = load i32, i32* %6
%107 = sext i32 %106 to i64
%108 = getelementptr inbounds i8*, i8** %93, i64 %107
%109 = load i8*, i8** %108
%110 = getelementptr inbounds i8, i8* %109, i64 0
%111 = load i8, i8* %110
%112 = icmp ne i8 %111, 0
br i1 %112, label %116, label %113
113: ; preds = %98
%114 = load i32, i32* %6
%115 = add nsw i32 %114, -1
store i32 %115, i32* %6
br label %116
116: ; preds = %113, %98
br label %117
117: ; preds = %116
%118 = load i32, i32* %6
%119 = add nsw i32 %118, 1
store i32 %119, i32* %6
br label %94
120: ; preds = %94
%121 = load i32, i32* %11
%122 = sub nsw i32 %121, 1
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds i8*, i8** %93, i64 %123
%125 = load i8*, i8** %124
%126 = getelementptr inbounds i8, i8* %125, i64 0
%127 = load i8, i8* %126
%128 = icmp ne i8 %127, 0
br i1 %128, label %134, label %129
129: ; preds = %120
%130 = load i32, i32* %11
%131 = sub nsw i32 %130, 1
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds i8*, i8** %93, i64 %132
store i8* null, i8** %133
br label %134
134: ; preds = %129, %120
%135 = load i32, i32* %11
%136 = sext i32 %135 to i64
%137 = getelementptr inbounds i8*, i8** %93, i64 %136
store i8* null, i8** %137
%138 = load i32, i32* %11
%139 = zext i32 %138 to i64
%140 = alloca i8*, i64 %139
store i64 %139, i64* %14
store i32 0, i32* %16
store i32 0, i32* %6
br label %141
141: ; preds = %416, %134
%142 = load i32, i32* %6
%143 = load i32, i32* %11
%144 = icmp slt i32 %142, %143
br i1 %144, label %145, label %419
145: ; preds = %141
%146 = load i32, i32* %6
%147 = sext i32 %146 to i64
%148 = getelementptr inbounds i8*, i8** %93, i64 %147
%149 = load i8*, i8** %148
%150 = call i32 @strcmp(i8* %149, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%151 = icmp ne i32 %150, 0
br i1 %151, label %178, label %152
152: ; preds = %145
store i32 0, i32* %15
br label %153
153: ; preds = %165, %152
%154 = load i32, i32* %15
%155 = load i32, i32* %6
%156 = icmp slt i32 %154, %155
br i1 %156, label %157, label %168
157: ; preds = %153
%158 = load i32, i32* %15
%159 = sext i32 %158 to i64
%160 = getelementptr inbounds i8*, i8** %93, i64 %159
%161 = load i8*, i8** %160
%162 = load i32, i32* %15
%163 = sext i32 %162 to i64
%164 = getelementptr inbounds i8*, i8** %140, i64 %163
store i8* %161, i8** %164
br label %165
165: ; preds = %157
%166 = load i32, i32* %15
%167 = add nsw i32 %166, 1
store i32 %167, i32* %15
br label %153
168: ; preds = %153
%169 = load i32, i32* %6
%170 = sext i32 %169 to i64
%171 = getelementptr inbounds i8*, i8** %140, i64 %170
store i8* null, i8** %171
%172 = load i32, i32* %11
%173 = sub nsw i32 %172, 1
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8*, i8** %93, i64 %174
%176 = load i8*, i8** %175
%177 = call i32 @stdout_to_file_overwrite(i8** %140, i8* %176)
store i32 %177, i32* %9
store i32 1, i32* %16
br label %415
178: ; preds = %145
%179 = load i32, i32* %6
%180 = sext i32 %179 to i64
%181 = getelementptr inbounds i8*, i8** %93, i64 %180
%182 = load i8*, i8** %181
%183 = call i32 @strcmp(i8* %182, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%184 = icmp ne i32 %183, 0
br i1 %184, label %211, label %185
185: ; preds = %178
store i32 0, i32* %15
br label %186
186: ; preds = %198, %185
%187 = load i32, i32* %15
%188 = load i32, i32* %6
%189 = icmp slt i32 %187, %188
br i1 %189, label %190, label %201
190: ; preds = %186
%191 = load i32, i32* %15
%192 = sext i32 %191 to i64
%193 = getelementptr inbounds i8*, i8** %93, i64 %192
%194 = load i8*, i8** %193
%195 = load i32, i32* %15
%196 = sext i32 %195 to i64
%197 = getelementptr inbounds i8*, i8** %140, i64 %196
store i8* %194, i8** %197
br label %198
198: ; preds = %190
%199 = load i32, i32* %15
%200 = add nsw i32 %199, 1
store i32 %200, i32* %15
br label %186
201: ; preds = %186
%202 = load i32, i32* %6
%203 = sext i32 %202 to i64
%204 = getelementptr inbounds i8*, i8** %140, i64 %203
store i8* null, i8** %204
%205 = load i32, i32* %11
%206 = sub nsw i32 %205, 1
%207 = sext i32 %206 to i64
%208 = getelementptr inbounds i8*, i8** %93, i64 %207
%209 = load i8*, i8** %208
%210 = call i32 @stdout_to_file_append(i8** %140, i8* %209)
store i32 %210, i32* %9
store i32 1, i32* %16
br label %414
211: ; preds = %178
%212 = load i32, i32* %6
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds i8*, i8** %93, i64 %213
%215 = load i8*, i8** %214
%216 = call i32 @strcmp(i8* %215, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%217 = icmp ne i32 %216, 0
br i1 %217, label %244, label %218
218: ; preds = %211
store i32 0, i32* %15
br label %219
219: ; preds = %231, %218
%220 = load i32, i32* %15
%221 = load i32, i32* %6
%222 = icmp slt i32 %220, %221
br i1 %222, label %223, label %234
223: ; preds = %219
%224 = load i32, i32* %15
%225 = sext i32 %224 to i64
%226 = getelementptr inbounds i8*, i8** %93, i64 %225
%227 = load i8*, i8** %226
%228 = load i32, i32* %15
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8*, i8** %140, i64 %229
store i8* %227, i8** %230
br label %231
231: ; preds = %223
%232 = load i32, i32* %15
%233 = add nsw i32 %232, 1
store i32 %233, i32* %15
br label %219
234: ; preds = %219
%235 = load i32, i32* %6
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds i8*, i8** %140, i64 %236
store i8* null, i8** %237
%238 = load i32, i32* %11
%239 = sub nsw i32 %238, 1
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds i8*, i8** %93, i64 %240
%242 = load i8*, i8** %241
%243 = call i32 @stderr_to_file_overwrite(i8** %140, i8* %242)
store i32 %243, i32* %9
store i32 1, i32* %16
br label %413
244: ; preds = %211
%245 = load i32, i32* %6
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds i8*, i8** %93, i64 %246
%248 = load i8*, i8** %247
%249 = call i32 @strcmp(i8* %248, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%250 = icmp ne i32 %249, 0
br i1 %250, label %277, label %251
251: ; preds = %244
store i32 0, i32* %15
br label %252
252: ; preds = %264, %251
%253 = load i32, i32* %15
%254 = load i32, i32* %6
%255 = icmp slt i32 %253, %254
br i1 %255, label %256, label %267
256: ; preds = %252
%257 = load i32, i32* %15
%258 = sext i32 %257 to i64
%259 = getelementptr inbounds i8*, i8** %93, i64 %258
%260 = load i8*, i8** %259
%261 = load i32, i32* %15
%262 = sext i32 %261 to i64
%263 = getelementptr inbounds i8*, i8** %140, i64 %262
store i8* %260, i8** %263
br label %264
264: ; preds = %256
%265 = load i32, i32* %15
%266 = add nsw i32 %265, 1
store i32 %266, i32* %15
br label %252
267: ; preds = %252
%268 = load i32, i32* %6
%269 = sext i32 %268 to i64
%270 = getelementptr inbounds i8*, i8** %140, i64 %269
store i8* null, i8** %270
%271 = load i32, i32* %11
%272 = sub nsw i32 %271, 1
%273 = sext i32 %272 to i64
%274 = getelementptr inbounds i8*, i8** %93, i64 %273
%275 = load i8*, i8** %274
%276 = call i32 @stderr_to_file_append(i8** %140, i8* %275)
store i32 %276, i32* %9
store i32 1, i32* %16
br label %412
277: ; preds = %244
%278 = load i32, i32* %6
%279 = sext i32 %278 to i64
%280 = getelementptr inbounds i8*, i8** %93, i64 %279
%281 = load i8*, i8** %280
%282 = call i32 @strcmp(i8* %281, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%283 = icmp ne i32 %282, 0
br i1 %283, label %305, label %284
284: ; preds = %277
store i32 0, i32* %15
br label %285
285: ; preds = %297, %284
%286 = load i32, i32* %15
%287 = load i32, i32* %6
%288 = icmp slt i32 %286, %287
br i1 %288, label %289, label %300
289: ; preds = %285
%290 = load i32, i32* %15
%291 = sext i32 %290 to i64
%292 = getelementptr inbounds i8*, i8** %93, i64 %291
%293 = load i8*, i8** %292
%294 = load i32, i32* %15
%295 = sext i32 %294 to i64
%296 = getelementptr inbounds i8*, i8** %140, i64 %295
store i8* %293, i8** %296
br label %297
297: ; preds = %289
%298 = load i32, i32* %15
%299 = add nsw i32 %298, 1
store i32 %299, i32* %15
br label %285
300: ; preds = %285
%301 = load i32, i32* %6
%302 = sext i32 %301 to i64
%303 = getelementptr inbounds i8*, i8** %140, i64 %302
store i8* null, i8** %303
%304 = call i32 @stderr_to_stdout(i8** %140)
store i32 %304, i32* %9
store i32 1, i32* %16
br label %411
305: ; preds = %277
%306 = load i32, i32* %6
%307 = sext i32 %306 to i64
%308 = getelementptr inbounds i8*, i8** %93, i64 %307
%309 = load i8*, i8** %308
%310 = call i32 @strcmp(i8* %309, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%311 = icmp ne i32 %310, 0
br i1 %311, label %314, label %312
312: ; preds = %305
%313 = call i32 @stdout_to_stderr(i8** %140)
store i32 %313, i32* %9
store i32 1, i32* %16
br label %410
314: ; preds = %305
%315 = load i32, i32* %6
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds i8*, i8** %93, i64 %316
%318 = load i8*, i8** %317
%319 = call i32 @strcmp(i8* %318, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%320 = icmp ne i32 %319, 0
br i1 %320, label %347, label %321
321: ; preds = %314
store i32 0, i32* %15
br label %322
322: ; preds = %334, %321
%323 = load i32, i32* %15
%324 = load i32, i32* %6
%325 = icmp slt i32 %323, %324
br i1 %325, label %326, label %337
326: ; preds = %322
%327 = load i32, i32* %15
%328 = sext i32 %327 to i64
%329 = getelementptr inbounds i8*, i8** %93, i64 %328
%330 = load i8*, i8** %329
%331 = load i32, i32* %15
%332 = sext i32 %331 to i64
%333 = getelementptr inbounds i8*, i8** %140, i64 %332
store i8* %330, i8** %333
br label %334
334: ; preds = %326
%335 = load i32, i32* %15
%336 = add nsw i32 %335, 1
store i32 %336, i32* %15
br label %322
337: ; preds = %322
%338 = load i32, i32* %6
%339 = sext i32 %338 to i64
%340 = getelementptr inbounds i8*, i8** %140, i64 %339
store i8* null, i8** %340
%341 = load i32, i32* %11
%342 = sub nsw i32 %341, 1
%343 = sext i32 %342 to i64
%344 = getelementptr inbounds i8*, i8** %93, i64 %343
%345 = load i8*, i8** %344
%346 = call i32 @file_to_stdin(i8** %140, i8* %345)
store i32 %346, i32* %9
store i32 1, i32* %16
br label %409
347: ; preds = %314
%348 = load i32, i32* %6
%349 = sext i32 %348 to i64
%350 = getelementptr inbounds i8*, i8** %93, i64 %349
%351 = load i8*, i8** %350
%352 = call i32 @strcmp(i8* %351, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%353 = icmp ne i32 %352, 0
br i1 %353, label %408, label %354
354: ; preds = %347
%355 = load i32, i32* %6
%356 = add nsw i32 %355, 1
%357 = zext i32 %356 to i64
%358 = call i8* @llvm.stacksave()
store i8* %358, i8** %17
%359 = alloca i8*, i64 %357
store i64 %357, i64* %18
%360 = load i32, i32* %11
%361 = load i32, i32* %6
%362 = sub nsw i32 %360, %361
%363 = add nsw i32 %362, 1
%364 = zext i32 %363 to i64
%365 = alloca i8*, i64 %364
store i64 %364, i64* %19
store i32 0, i32* %15
br label %366
366: ; preds = %378, %354
%367 = load i32, i32* %15
%368 = load i32, i32* %6
%369 = icmp slt i32 %367, %368
br i1 %369, label %370, label %381
370: ; preds = %366
%371 = load i32, i32* %15
%372 = sext i32 %371 to i64
%373 = getelementptr inbounds i8*, i8** %93, i64 %372
%374 = load i8*, i8** %373
%375 = load i32, i32* %15
%376 = sext i32 %375 to i64
%377 = getelementptr inbounds i8*, i8** %359, i64 %376
store i8* %374, i8** %377
br label %378
378: ; preds = %370
%379 = load i32, i32* %15
%380 = add nsw i32 %379, 1
store i32 %380, i32* %15
br label %366
381: ; preds = %366
%382 = load i32, i32* %6
%383 = sext i32 %382 to i64
%384 = getelementptr inbounds i8*, i8** %359, i64 %383
store i8* null, i8** %384
%385 = load i32, i32* %6
%386 = add nsw i32 %385, 1
store i32 %386, i32* %15
br label %387
387: ; preds = %402, %381
%388 = load i32, i32* %15
%389 = load i32, i32* %11
%390 = icmp sle i32 %388, %389
br i1 %390, label %391, label %405
391: ; preds = %387
%392 = load i32, i32* %15
%393 = sext i32 %392 to i64
%394 = getelementptr inbounds i8*, i8** %93, i64 %393
%395 = load i8*, i8** %394
%396 = load i32, i32* %15
%397 = load i32, i32* %6
%398 = sub nsw i32 %396, %397
%399 = sub nsw i32 %398, 1
%400 = sext i32 %399 to i64
%401 = getelementptr inbounds i8*, i8** %365, i64 %400
store i8* %395, i8** %401
br label %402
402: ; preds = %391
%403 = load i32, i32* %15
%404 = add nsw i32 %403, 1
store i32 %404, i32* %15
br label %387
405: ; preds = %387
%406 = call i32 @pipe_of_wish(i8** %359, i8** %365)
store i32 %406, i32* %9
store i32 1, i32* %16
%407 = load i8*, i8** %17
br label %408
408: ; preds = %405, %347
br label %409
409: ; preds = %408, %337
br label %410
410: ; preds = %409, %312
br label %411
411: ; preds = %410, %300
br label %412
412: ; preds = %411, %267
br label %413
413: ; preds = %412, %234
br label %414
414: ; preds = %413, %201
br label %415
415: ; preds = %414, %168
br label %416
416: ; preds = %415
%417 = load i32, i32* %6
%418 = add nsw i32 %417, 1
store i32 %418, i32* %6
br label %141
419: ; preds = %141
%420 = load i32, i32* %16
%421 = icmp ne i32 %420, 0
br i1 %421, label %426, label %422
422: ; preds = %419
%423 = getelementptr inbounds i8*, i8** %93, i64 0
%424 = load i8*, i8** %423
%425 = call i32 @execute(i8* %424, i8** %93)
store i32 %425, i32* %9
br label %426
426: ; preds = %422, %419
%427 = load i8*, i8** %12
br label %428
428: ; preds = %426, %82
%429 = load i32, i32* %10
%430 = add nsw i32 %429, 1
store i32 %430, i32* %10
br label %70
431: ; preds = %70
%432 = load i32, i32* %9
store i32 %432, i32* %1
%433 = load i8*, i8** %7
br label %434
434: ; preds = %431, %28
%435 = load i32, i32* %1
ret i32 %435
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [2 x i8] c"\0A\00"
@.str.1 = [2 x i8] c";\00"
@.str.2 = [2 x i8] c" \00"
@.str.3 = [2 x i8] c">\00"
@.str.4 = [3 x i8] c">>\00"
@.str.5 = [3 x i8] c"2>\00"
@.str.6 = [4 x i8] c"2>>\00"
@.str.7 = [4 x i8] c"2>1\00"
@.str.8 = [3 x i8] c"&>\00"
@.str.9 = [2 x i8] c"<\00"
@.str.10 = [2 x i8] c"|\00"
define i32 @get_and_run_userin() {
%1 = alloca [256 x i8]
%2 = alloca i8*
%3 = alloca i8*
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %1, i64 0, i64 0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 256, i32 %5)
%7 = bitcast i8** %2 to i8*
store i8* %4, i8** %2
%8 = bitcast i8** %3 to i8*
%9 = call i8* @strsep(i8** %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i8* %9, i8** %3
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %187, label %12
12: ; preds = %0, %18
%13 = phi i8 [ %22, %18 ], [ %10, %0 ]
%14 = phi i64 [ %20, %18 ], [ 0, %0 ]
%15 = phi i32 [ %19, %18 ], [ 1, %0 ]
switch i8 %13, label %18 [
i8 0, label %23
i8 59, label %16
]
16: ; preds = %12
%17 = add nsw i32 %15, 1
br label %18
18: ; preds = %12, %16
%19 = phi i32 [ %17, %16 ], [ %15, %12 ]
%20 = add nuw i64 %14, 1
%21 = getelementptr inbounds i8, i8* %9, i64 %20
%22 = load i8, i8* %21
br label %12
23: ; preds = %12
%24 = zext i32 %15 to i64
%25 = call i8* @llvm.stacksave()
%26 = alloca i8*, i64 %24
%27 = icmp sgt i32 %15, 0
br i1 %27, label %29, label %185
28: ; preds = %29
br i1 %27, label %35, label %185
29: ; preds = %23, %29
%30 = phi i64 [ %33, %29 ], [ 0, %23 ]
%31 = call i8* @strsep(i8** %3, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%32 = getelementptr inbounds i8*, i8** %26, i64 %30
store i8* %31, i8** %32
%33 = add nuw nsw i64 %30, 1
%34 = icmp eq i64 %33, %24
br i1 %34, label %28, label %29
35: ; preds = %28, %181
%36 = phi i64 [ %183, %181 ], [ 0, %28 ]
%37 = phi i32 [ %182, %181 ], [ undef, %28 ]
%38 = getelementptr inbounds i8*, i8** %26, i64 %36
%39 = load i8*, i8** %38
%40 = load i8, i8* %39
%41 = icmp eq i8 %40, 0
br i1 %41, label %181, label %42
42: ; preds = %35
%43 = call i32 @get_num_args(i8* %39)
%44 = add i32 %43, 1
%45 = zext i32 %44 to i64
%46 = call i8* @llvm.stacksave()
%47 = alloca i8*, i64 %45
%48 = bitcast i8** %47 to i8*
%49 = icmp sgt i32 %43, 0
br i1 %49, label %50, label %61
50: ; preds = %42, %50
%51 = phi i32 [ %59, %50 ], [ 0, %42 ]
%52 = call i8* @strsep(i8** %38, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%53 = sext i32 %51 to i64
%54 = getelementptr inbounds i8*, i8** %47, i64 %53
store i8* %52, i8** %54
%55 = load i8, i8* %52
%56 = icmp eq i8 %55, 0
%57 = sext i1 %56 to i32
%58 = add nsw i32 %51, 1
%59 = add nsw i32 %58, %57
%60 = icmp slt i32 %59, %43
br i1 %60, label %50, label %61
61: ; preds = %50, %42
%62 = add i32 %43, -1
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %47, i64 %63
%65 = load i8*, i8** %64
%66 = load i8, i8* %65
%67 = icmp eq i8 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %61
store i8* null, i8** %64
br label %69
69: ; preds = %68, %61
%70 = sext i32 %43 to i64
%71 = getelementptr inbounds i8*, i8** %47, i64 %70
store i8* null, i8** %71
%72 = zext i32 %43 to i64
%73 = alloca i8*, i64 %72
%74 = bitcast i8** %73 to i8*
br i1 %49, label %75, label %176
75: ; preds = %69, %170
%76 = phi i64 [ %80, %170 ], [ 0, %69 ]
%77 = phi i32 [ %172, %170 ], [ 0, %69 ]
%78 = phi i32 [ %171, %170 ], [ %37, %69 ]
%79 = shl nuw nsw i64 %76, 3
%80 = add nuw nsw i64 %76, 1
%81 = getelementptr i8*, i8** %47, i64 %80
%82 = bitcast i8** %81 to i8*
%83 = trunc i64 %76 to i32
%84 = sub i32 %62, %83
%85 = zext i32 %84 to i64
%86 = shl nuw nsw i64 %85, 3
%87 = add nuw nsw i64 %86, 8
%88 = getelementptr inbounds i8*, i8** %47, i64 %76
%89 = load i8*, i8** %88
%90 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %99
92: ; preds = %75
%93 = icmp eq i64 %76, 0
br i1 %93, label %95, label %94
94: ; preds = %92
br label %95
95: ; preds = %94, %92
%96 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %96
%97 = load i8*, i8** %64
%98 = call i32 @stdout_to_file_overwrite(i8** %73, i8* %97)
br label %170
99: ; preds = %75
%100 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%101 = icmp eq i32 %100, 0
br i1 %101, label %102, label %109
102: ; preds = %99
%103 = icmp eq i64 %76, 0
br i1 %103, label %105, label %104
104: ; preds = %102
br label %105
105: ; preds = %104, %102
%106 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %106
%107 = load i8*, i8** %64
%108 = call i32 @stdout_to_file_append(i8** %73, i8* %107)
br label %170
109: ; preds = %99
%110 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%111 = icmp eq i32 %110, 0
br i1 %111, label %112, label %119
112: ; preds = %109
%113 = icmp eq i64 %76, 0
br i1 %113, label %115, label %114
114: ; preds = %112
br label %115
115: ; preds = %114, %112
%116 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %116
%117 = load i8*, i8** %64
%118 = call i32 @stderr_to_file_overwrite(i8** %73, i8* %117)
br label %170
119: ; preds = %109
%120 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%121 = icmp eq i32 %120, 0
br i1 %121, label %122, label %129
122: ; preds = %119
%123 = icmp eq i64 %76, 0
br i1 %123, label %125, label %124
124: ; preds = %122
br label %125
125: ; preds = %124, %122
%126 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %126
%127 = load i8*, i8** %64
%128 = call i32 @stderr_to_file_append(i8** %73, i8* %127)
br label %170
129: ; preds = %119
%130 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0))
%131 = icmp eq i32 %130, 0
br i1 %131, label %132, label %138
132: ; preds = %129
%133 = icmp eq i64 %76, 0
br i1 %133, label %135, label %134
134: ; preds = %132
br label %135
135: ; preds = %134, %132
%136 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %136
%137 = call i32 @stderr_to_stdout(i8** %73)
br label %170
138: ; preds = %129
%139 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.8, i64 0, i64 0))
%140 = icmp eq i32 %139, 0
br i1 %140, label %141, label %143
141: ; preds = %138
%142 = call i32 @stdout_to_stderr(i8** %73)
br label %170
143: ; preds = %138
%144 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.9, i64 0, i64 0))
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %153
146: ; preds = %143
%147 = icmp eq i64 %76, 0
br i1 %147, label %149, label %148
148: ; preds = %146
br label %149
149: ; preds = %148, %146
%150 = getelementptr inbounds i8*, i8** %73, i64 %76
store i8* null, i8** %150
%151 = load i8*, i8** %64
%152 = call i32 @file_to_stdin(i8** %73, i8* %151)
br label %170
153: ; preds = %143
%154 = call i32 @strcmp(i8* dereferenceable(1) %89, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%155 = icmp eq i32 %154, 0
br i1 %155, label %156, label %170
156: ; preds = %153
%157 = call i8* @llvm.stacksave()
%158 = alloca i8*, i64 %80
%159 = trunc i64 %76 to i32
%160 = sub i32 %44, %159
%161 = zext i32 %160 to i64
%162 = alloca i8*, i64 %161
%163 = bitcast i8** %162 to i8*
%164 = icmp eq i64 %76, 0
br i1 %164, label %167, label %165
165: ; preds = %156
%166 = bitcast i8** %158 to i8*
br label %167
167: ; preds = %165, %156
%168 = getelementptr inbounds i8*, i8** %158, i64 %76
store i8* null, i8** %168
%169 = call i32 @pipe_of_wish(i8** %158, i8** %162)
br label %170
170: ; preds = %95, %115, %135, %149, %167, %153, %141, %125, %105
%171 = phi i32 [ %78, %153 ], [ %169, %167 ], [ %152, %149 ], [ %142, %141 ], [ %137, %135 ], [ %128, %125 ], [ %118, %115 ], [ %108, %105 ], [ %98, %95 ]
%172 = phi i32 [ %77, %153 ], [ 1, %167 ], [ 1, %149 ], [ 1, %141 ], [ 1, %135 ], [ 1, %125 ], [ 1, %115 ], [ 1, %105 ], [ 1, %95 ]
%173 = icmp eq i64 %80, %72
br i1 %173, label %174, label %75
174: ; preds = %170
%175 = icmp eq i32 %172, 0
br i1 %175, label %176, label %179
176: ; preds = %69, %174
%177 = load i8*, i8** %47
%178 = call i32 @execute(i8* %177, i8** %47)
br label %179
179: ; preds = %176, %174
%180 = phi i32 [ %171, %174 ], [ %178, %176 ]
br label %181
181: ; preds = %35, %179
%182 = phi i32 [ %180, %179 ], [ 0, %35 ]
%183 = add nuw nsw i64 %36, 1
%184 = icmp eq i64 %183, %24
br i1 %184, label %185, label %35
185: ; preds = %181, %23, %28
%186 = phi i32 [ undef, %28 ], [ undef, %23 ], [ %182, %181 ]
br label %187
187: ; preds = %0, %185
%188 = phi i32 [ %186, %185 ], [ 0, %0 ]
ret i32 %188
}