#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 */
scalar_t__ calloc(int, int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ handle_command(char *, char *, char *, char *);
int /*<<< orphan*/ handle_pipe(char *, char *, char *, char *);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ redirection_input(char *, char *);
int /*<<< orphan*/ redirection_output(char *, char *, char *);
int /*<<< orphan*/ remove_spaces(char *);
char *strchr(char *, char);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
char *strtok(char *, char *);
int parsing(char *buffer) {
  char command[20] = {'\0'};
  char argument[20] = {'\0'};
  char pipearg1[20] = {'\0'};
  char pipearg2[20] = {'\0'};
  char word1[20] = {'\0'};
  char word2[20] = {'\0'};
  char *ret;
  char *token;
  char *inptcpy;
  int inptlen;
  int check = 1;
  inptlen = strlen(buffer);
  inptcpy = (char *)calloc(inptlen + 1, sizeof(char));
  strncpy(inptcpy, buffer, inptlen);
  ret = strchr(buffer, '>');
  if (ret) {
    token = strtok(buffer, ">");
    strcpy(word1, token);
    while (token != NULL) {
      token = strtok(NULL, ">");
      if (token)
        strcpy(word2, token);
    }
    token = strtok(word1, " ");
    token = strtok(NULL, " ");
    if (token)
      strcpy(argument, token);
    remove_spaces(word1);
    remove_spaces(word2);
    if (strcmp(argument, " ") != 0)
      remove_spaces(argument);
    printf("%s %s %s\n", word1, argument, word2);
    redirection_output(word1, argument, word2);
    check = 0;
  }
  ret = strchr(buffer, '<');
  if (ret) {
    token = strtok(buffer, "<");
    strcpy(word1, token);
    token = strtok(NULL, "<");
    strcpy(word2, token);
    remove_spaces(word1);
    remove_spaces(word2);
    redirection_input(word1, word2);
    check = 0;
  }
  ret = strchr(buffer, '|');
  if (ret) {
    token = strtok(buffer, "|");
    strcpy(word1, token);
    while (token != NULL) {
      token = strtok(NULL, "|");
      if (token)
        strcpy(word2, token);
    }
    token = strtok(word1, " ");
    token = strtok(NULL, " ");
    if (token)
      strcpy(pipearg1, token);
    token = strtok(word2, " ");
    token = strtok(NULL, " ");
    if (token)
      strcpy(pipearg2, token);
    remove_spaces(word1);
    if (strcmp(pipearg1, " ") != 0)
      remove_spaces(pipearg1);
    remove_spaces(word2);
    if (strcmp(pipearg2, " ") != 0)
      remove_spaces(pipearg2);
    handle_pipe(word1, pipearg1, word2, pipearg2);
    check = 0;
  }
  strcpy(command, buffer);
  strtok(command, " ");
  token = strtok(inptcpy, " ");
  token = strtok(NULL, " ");
  if (token)
    strcpy(argument, token);
  if (check)
    handle_command(command, argument, buffer, ret);
  check = 1;
  if (inptcpy)
    free(inptcpy);
  return 1;
}


x86 assembly (clang, -O0):
<parsing>:
push   %rbp
mov    %rsp,%rbp
sub    $0xe0,%rsp
mov    %rdi,-0x8(%rbp)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0x80(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0xa0(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
lea    -0xc0(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10b0 <memset@plt>
movl   $0x1,-0xe0(%rbp)
mov    -0x8(%rbp),%rdi
call   1070 <strlen@plt>
mov    %eax,-0xdc(%rbp)
mov    -0xdc(%rbp),%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10c0 <calloc@plt>
mov    %rax,-0xd8(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xdc(%rbp),%edx
call   1040 <strncpy@plt>
mov    -0x8(%rbp),%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
je     140f <parsing+0x21f>
mov    -0x8(%rbp),%rdi
lea    0xd24(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
cmpq   $0x0,-0xd0(%rbp)
je     1346 <parsing+0x156>
xor    %eax,%eax
mov    %eax,%edi
lea    0xcec(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     1341 <parsing+0x151>
lea    -0xc0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    12fb <parsing+0x10b>
lea    -0xa0(%rbp),%rdi
lea    0xcae(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xc97(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     1395 <parsing+0x1a5>
lea    -0x40(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xc0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0x40(%rbp),%rdi
lea    0xc4a(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     13d0 <parsing+0x1e0>
lea    -0x40(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xa0(%rbp),%rsi
lea    -0x40(%rbp),%rdx
lea    -0xc0(%rbp),%rcx
lea    0xc1b(%rip),%rdi
call   10a0 <printf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x40(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
call   10e0 <redirection_output@plt>
movl   $0x0,-0xe0(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3c,%esi
call   1090 <strchr@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
je     14bb <parsing+0x2cb>
mov    -0x8(%rbp),%rdi
lea    0xbd1(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
xor    %eax,%eax
mov    %eax,%edi
lea    0xba7(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
lea    -0xc0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xc0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xc0(%rbp),%rsi
call   1080 <redirection_input@plt>
movl   $0x0,-0xe0(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x7c,%esi
call   1090 <strchr@plt>
mov    %rax,-0xc8(%rbp)
cmpq   $0x0,-0xc8(%rbp)
je     1674 <parsing+0x484>
mov    -0x8(%rbp),%rdi
lea    0xb27(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
lea    -0xa0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
cmpq   $0x0,-0xd0(%rbp)
je     1553 <parsing+0x363>
xor    %eax,%eax
mov    %eax,%edi
lea    0xaef(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     154e <parsing+0x35e>
lea    -0xc0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
jmp    1508 <parsing+0x318>
lea    -0xa0(%rbp),%rdi
lea    0xaa1(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xa8a(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     15a2 <parsing+0x3b2>
lea    -0x60(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0xc0(%rbp),%rdi
lea    0xa52(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xa3b(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     15f1 <parsing+0x401>
lea    -0x80(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0x60(%rbp),%rdi
lea    0x9fa(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     1620 <parsing+0x430>
lea    -0x60(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xc0(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0x80(%rbp),%rdi
lea    0x9cb(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
je     164f <parsing+0x45f>
lea    -0x80(%rbp),%rdi
call   1110 <remove_spaces@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x60(%rbp),%rsi
lea    -0xc0(%rbp),%rdx
lea    -0x80(%rbp),%rcx
call   1100 <handle_pipe@plt>
movl   $0x0,-0xe0(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <strcpy@plt>
lea    -0x20(%rbp),%rdi
lea    0x976(%rip),%rsi
call   10f0 <strtok@plt>
mov    -0xd8(%rbp),%rdi
lea    0x963(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0x94c(%rip),%rsi
call   10f0 <strtok@plt>
mov    %rax,-0xd0(%rbp)
cmpq   $0x0,-0xd0(%rbp)
je     16e0 <parsing+0x4f0>
lea    -0x40(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
call   1050 <strcpy@plt>
cmpl   $0x0,-0xe0(%rbp)
je     1705 <parsing+0x515>
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%rdx
mov    -0xc8(%rbp),%rcx
call   1060 <handle_command@plt>
movl   $0x1,-0xe0(%rbp)
cmpq   $0x0,-0xd8(%rbp)
je     1729 <parsing+0x539>
mov    -0xd8(%rbp),%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0xe0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parsing>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    %rdi,%r12
xorps  %xmm0,%xmm0
movaps %xmm0,0xa0(%rsp)
movl   $0x0,0xb0(%rsp)
movaps %xmm0,0x40(%rsp)
movl   $0x0,0x50(%rsp)
movaps %xmm0,0x80(%rsp)
movl   $0x0,0x90(%rsp)
movaps %xmm0,0x60(%rsp)
movl   $0x0,0x70(%rsp)
movaps %xmm0,(%rsp)
movl   $0x0,0x10(%rsp)
movaps %xmm0,0x20(%rsp)
movl   $0x0,0x30(%rsp)
call   1070 <strlen@plt>
mov    %eax,%ebx
lea    0x1(%rbx),%edi
mov    $0x1,%ebp
mov    $0x1,%esi
call   10b0 <calloc@plt>
mov    %rax,%r14
mov    %rax,%rdi
mov    %r12,%rsi
mov    %ebx,%edx
call   1040 <strncpy@plt>
mov    %r12,%rdi
mov    $0x3e,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     137c <parsing+0x19c>
lea    0xd6a(%rip),%rsi
mov    %r12,%rdi
call   10e0 <strtok@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
test   %rbx,%rbx
je     12ea <parsing+0x10a>
lea    0xd48(%rip),%rsi
xor    %edi,%edi
call   10e0 <strtok@plt>
test   %rax,%rax
je     12ea <parsing+0x10a>
lea    0x20(%rsp),%r15
lea    0xd30(%rip),%rbx
mov    %r15,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
jne    12d0 <parsing+0xf0>
lea    0xd11(%rip),%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
je     1318 <parsing+0x138>
lea    0x40(%rsp),%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
mov    %rsp,%rdi
call   1100 <remove_spaces@plt>
lea    0x20(%rsp),%rdi
call   1100 <remove_spaces@plt>
lea    0xcd1(%rip),%rsi
lea    0x40(%rsp),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     134a <parsing+0x16a>
lea    0x40(%rsp),%rdi
call   1100 <remove_spaces@plt>
lea    0xcb3(%rip),%rdi
mov    %rsp,%rbx
lea    0x40(%rsp),%r15
lea    0x20(%rsp),%r13
mov    %rbx,%rsi
mov    %r15,%rdx
mov    %r13,%rcx
call   10a0 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r13,%rdx
call   10d0 <redirection_output@plt>
xor    %ebp,%ebp
mov    %r12,%rdi
mov    $0x3c,%esi
call   1090 <strchr@plt>
test   %rax,%rax
je     13e5 <parsing+0x205>
lea    0xc79(%rip),%r15
mov    %r12,%rdi
mov    %r15,%rsi
call   10e0 <strtok@plt>
mov    %rsp,%r13
mov    %r13,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
xor    %ebp,%ebp
xor    %edi,%edi
mov    %r15,%rsi
call   10e0 <strtok@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
mov    %r13,%rdi
call   1100 <remove_spaces@plt>
mov    %rbx,%rdi
call   1100 <remove_spaces@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1080 <redirection_input@plt>
mov    %r12,%rdi
mov    $0x7c,%esi
call   1090 <strchr@plt>
mov    %rax,%r15
test   %rax,%rax
je     152f <parsing+0x34f>
lea    0xc0b(%rip),%rsi
mov    %r12,%rdi
call   10e0 <strtok@plt>
mov    %rax,%rbx
mov    %rsp,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
test   %rbx,%rbx
je     145a <parsing+0x27a>
lea    0xbe9(%rip),%rsi
xor    %edi,%edi
call   10e0 <strtok@plt>
test   %rax,%rax
je     145a <parsing+0x27a>
lea    0x20(%rsp),%r13
lea    0xbd1(%rip),%rbx
nop
mov    %r13,%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
jne    1440 <parsing+0x260>
lea    0xba1(%rip),%rbx
mov    %rsp,%rdi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
je     148b <parsing+0x2ab>
lea    0x80(%rsp),%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
lea    0xb70(%rip),%rbx
lea    0x20(%rsp),%rdi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
je     14bb <parsing+0x2db>
lea    0x60(%rsp),%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
mov    %rsp,%rdi
call   1100 <remove_spaces@plt>
lea    0xb38(%rip),%rsi
lea    0x80(%rsp),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     14e9 <parsing+0x309>
lea    0x80(%rsp),%rdi
call   1100 <remove_spaces@plt>
lea    0x20(%rsp),%rdi
call   1100 <remove_spaces@plt>
lea    0xb08(%rip),%rsi
lea    0x60(%rsp),%rdi
call   10c0 <strcmp@plt>
test   %rax,%rax
je     1513 <parsing+0x333>
lea    0x60(%rsp),%rdi
call   1100 <remove_spaces@plt>
mov    %rsp,%rdi
lea    0x80(%rsp),%rsi
lea    0x20(%rsp),%rdx
lea    0x60(%rsp),%rcx
call   10f0 <handle_pipe@plt>
xor    %ebp,%ebp
lea    0xa0(%rsp),%r13
mov    %r13,%rdi
mov    %r12,%rsi
call   1050 <strcpy@plt>
lea    0xab9(%rip),%rbx
mov    %r13,%rdi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
xor    %edi,%edi
mov    %rbx,%rsi
call   10e0 <strtok@plt>
test   %rax,%rax
je     157b <parsing+0x39b>
lea    0x40(%rsp),%rdi
mov    %rax,%rsi
call   1050 <strcpy@plt>
test   %ebp,%ebp
je     1597 <parsing+0x3b7>
lea    0xa0(%rsp),%rdi
lea    0x40(%rsp),%rsi
mov    %r12,%rdx
mov    %r15,%rcx
call   1060 <handle_command@plt>
test   %r14,%r14
je     15a4 <parsing+0x3c4>
mov    %r14,%rdi
call   1030 <free@plt>
mov    $0x1,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [2 x i8] c">\00"
@.str.1 = [2 x i8] c" \00"
@.str.2 = [10 x i8] c"%s %s %s\0A\00"
@.str.3 = [2 x i8] c"<\00"
@.str.4 = [2 x i8] c"|\00"
define i32 @parsing(i8* %0) {
%2 = alloca [20 x i8]
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [20 x i8]
%7 = alloca [20 x i8]
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = tail call i32 @strlen(i8* %0)
%15 = add nsw i32 %14, 1
%16 = tail call i64 @calloc(i32 %15, i32 1)
%17 = inttoptr i64 %16 to i8*
%18 = tail call i32 @strncpy(i8* %17, i8* %0, i32 %14)
%19 = tail call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 62)
%20 = icmp eq i8* %19, null
br i1 %20, label %49, label %21
21: ; preds = %1
%22 = tail call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%23 = call i32 @strcpy(i8* %12, i8* %22)
%24 = icmp eq i8* %22, null
br i1 %24, label %33, label %25
25: ; preds = %21
%26 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%27 = icmp eq i8* %26, null
br i1 %27, label %33, label %28
28: ; preds = %25, %28
%29 = phi i8* [ %31, %28 ], [ %26, %25 ]
%30 = call i32 @strcpy(i8* %13, i8* %29)
%31 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%32 = icmp eq i8* %31, null
br i1 %32, label %33, label %28
33: ; preds = %28, %25, %21
%34 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%35 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i8* %35, null
br i1 %36, label %39, label %37
37: ; preds = %33
%38 = call i32 @strcpy(i8* %9, i8* %35)
br label %39
39: ; preds = %37, %33
%40 = call i32 @remove_spaces(i8* %12)
%41 = call i32 @remove_spaces(i8* %13)
%42 = call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%43 = icmp eq i64 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %39
%45 = call i32 @remove_spaces(i8* %9)
br label %46
46: ; preds = %44, %39
%47 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %12, i8* %9, i8* %13)
%48 = call i32 @redirection_output(i8* %12, i8* %9, i8* %13)
br label %49
49: ; preds = %46, %1
%50 = phi i32 [ 0, %46 ], [ 1, %1 ]
%51 = call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 60)
%52 = icmp eq i8* %51, null
br i1 %52, label %61, label %53
53: ; preds = %49
%54 = call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%55 = call i32 @strcpy(i8* %12, i8* %54)
%56 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @strcpy(i8* %13, i8* %56)
%58 = call i32 @remove_spaces(i8* %12)
%59 = call i32 @remove_spaces(i8* %13)
%60 = call i32 @redirection_input(i8* %12, i8* %13)
br label %61
61: ; preds = %53, %49
%62 = phi i32 [ 0, %53 ], [ %50, %49 ]
%63 = call i8* @strchr(i8* dereferenceable(1) %0, i8 signext 124)
%64 = icmp eq i8* %63, null
br i1 %64, label %103, label %65
65: ; preds = %61
%66 = call i8* @strtok(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%67 = call i32 @strcpy(i8* %12, i8* %66)
%68 = icmp eq i8* %66, null
br i1 %68, label %77, label %69
69: ; preds = %65
%70 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%71 = icmp eq i8* %70, null
br i1 %71, label %77, label %72
72: ; preds = %69, %72
%73 = phi i8* [ %75, %72 ], [ %70, %69 ]
%74 = call i32 @strcpy(i8* %13, i8* %73)
%75 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%76 = icmp eq i8* %75, null
br i1 %76, label %77, label %72
77: ; preds = %72, %69, %65
%78 = call i8* @strtok(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%79 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%80 = icmp eq i8* %79, null
br i1 %80, label %83, label %81
81: ; preds = %77
%82 = call i32 @strcpy(i8* %10, i8* %79)
br label %83
83: ; preds = %81, %77
%84 = call i8* @strtok(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%85 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%86 = icmp eq i8* %85, null
br i1 %86, label %89, label %87
87: ; preds = %83
%88 = call i32 @strcpy(i8* %11, i8* %85)
br label %89
89: ; preds = %87, %83
%90 = call i32 @remove_spaces(i8* %12)
%91 = call i64 @strcmp(i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %95, label %93
93: ; preds = %89
%94 = call i32 @remove_spaces(i8* %10)
br label %95
95: ; preds = %93, %89
%96 = call i32 @remove_spaces(i8* %13)
%97 = call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%98 = icmp eq i64 %97, 0
br i1 %98, label %101, label %99
99: ; preds = %95
%100 = call i32 @remove_spaces(i8* %11)
br label %101
101: ; preds = %99, %95
%102 = call i32 @handle_pipe(i8* %12, i8* %10, i8* %13, i8* %11)
br label %103
103: ; preds = %101, %61
%104 = phi i32 [ 0, %101 ], [ %62, %61 ]
%105 = call i32 @strcpy(i8* %8, i8* %0)
%106 = call i8* @strtok(i8* %8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%107 = call i8* @strtok(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%108 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%109 = icmp eq i8* %108, null
br i1 %109, label %112, label %110
110: ; preds = %103
%111 = call i32 @strcpy(i8* %9, i8* %108)
br label %112
112: ; preds = %110, %103
%113 = icmp eq i32 %104, 0
br i1 %113, label %116, label %114
114: ; preds = %112
%115 = call i32 @handle_command(i8* %8, i8* %9, i8* %0, i8* %63)
br label %116
116: ; preds = %114, %112
%117 = icmp eq i64 %16, 0
br i1 %117, label %120, label %118
118: ; preds = %116
%119 = call i32 @free(i8* %17)
br label %120
120: ; preds = %118, %116
ret i32 1
}