#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 */
struct cmd {
  int dummy;
};
typedef scalar_t__ error_t;

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
scalar_t__ argz_add(char **, size_t *, char *);
scalar_t__ argz_create(char *const *, char **, size_t *);
char *calloc(int, int);
int /*<<< orphan*/ comvec_add(struct cmd **, size_t *, char *, size_t, int);
int /*<<< orphan*/ comvec_create(struct cmd **, int /*<<< orphan*/);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ free(char *);
size_t malloc_usable_size(char *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, size_t);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char);
void *realloc(char *, size_t);
int /*<<< orphan*/ stderr;
int strlen(char const *);
void parse_cmd(struct cmd *comvec[], size_t *comvec_size,
               const char *cmd_line) {
  *comvec_size = 0;
  comvec_create(comvec, 0);
  char *const null[] = {NULL};
  char *argz;
  size_t argz_len;
  error_t err = argz_create(null, &argz, &argz_len);
  if (err) {
    errno = err;
    perror("parse_cmd(): argz_create() error");
    exit(EXIT_FAILURE);
  };
  char *arg = calloc(1, 1);
  size_t arg_len = 0;
  if (!arg) {
    perror("parse_cmd(): calloc() error");
    exit(EXIT_FAILURE);
  };
  bool escaped = false;
  bool quoted = false;
  char mark = 0;
  for (size_t i = 0; i < strlen(cmd_line); i++) {
    if (!escaped) {
      if (cmd_line[i] == '\\') {
        escaped = true;
        continue;
      } else if (cmd_line[i] == '\'') {
        if (mark == '\'') {
          quoted = false;
          mark = 0;
          continue;
        } else if (mark == 0) {
          quoted = true;
          mark = cmd_line[i];
          continue;
        }
      } else if (cmd_line[i] == '"') {
        if (mark == '"') {
          quoted = false;
          mark = 0;
          continue;
        } else if (mark == 0) {
          quoted = true;
          mark = cmd_line[i];
          continue;
        }
      } else if (cmd_line[i] == ' ' || cmd_line[i] == '#' ||
                 cmd_line[i] == '|' || cmd_line[i] == ';' ||
                 cmd_line[i] == '&') {
        if (mark == 0) {
          if (arg_len) {
            error_t err = argz_add(&argz, &argz_len, arg);
            if (err) {
              errno = err;
              perror("parse_cmd(): argz_add() error");
              exit(EXIT_FAILURE);
            };
            memset(arg, 0, arg_len + 1);
            arg_len = 0;
          }
          if (cmd_line[i] == '#')
            break;
          if (cmd_line[i] == '&') {
            int flags = 0;
            if (i != strlen(cmd_line) - 1 && cmd_line[i + 1] == '&') {
              flags |= (1 << (0));
              i++;
            } else {
              fprintf(stderr, "seashell: error: expected `&', "
                              "got ");
              if (i == strlen(cmd_line) - 1)
                fprintf(stderr, "end of command line\n");
              else
                fprintf(stderr, "`%c'\n", cmd_line[i + 1]);
              free(arg);
              free(argz);
              return;
            }
            comvec_add(comvec, comvec_size, argz, argz_len, flags);
            argz_create(null, &argz, &argz_len);
          }
          if (cmd_line[i] == '|') {
            int flags = 0;
            if (i != strlen(cmd_line) - 1 && cmd_line[i + 1] == '|') {
              flags |= (1 << (1));
              i++;
            } else {
              flags |= (1 << (2));
            }
            comvec_add(comvec, comvec_size, argz, argz_len, flags);
            argz_create(null, &argz, &argz_len);
          }
          if (cmd_line[i] == ';') {
            comvec_add(comvec, comvec_size, argz, argz_len, 0);
            argz_create(null, &argz, &argz_len);
          }
          continue;
        }
      }
    }
    if (malloc_usable_size(arg) < arg_len + 2) {
      void *ptr = realloc(arg, arg_len + 2);
      if (!ptr) {
        perror("parse_cmd(): realloc() error");
        exit(EXIT_FAILURE);
      };
      arg = ptr;
    }
    arg[arg_len++] = cmd_line[i];
    arg[arg_len] = '\0';
    escaped = false;
  }
  if (quoted)
    printf("parse_cmd(): expanding an unpaired quotation mark (%c) to the "
           "end of the string\n",
           mark);
  if (arg_len) {
    error_t err = argz_add(&argz, &argz_len, arg);
    if (err) {
      errno = err;
      perror("parse_cmd(): argz_add() error");
      exit(EXIT_FAILURE);
    };
  }
  comvec_add(comvec, comvec_size, argz, argz_len, 0);
  free(arg);
}


x86 assembly (clang, -O0):
<parse_cmd>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   10c0 <comvec_create@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1060 <memset@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <argz_create@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
je     1265 <parse_cmd+0x85>
mov    -0x38(%rbp),%rcx
mov    0x2d90(%rip),%rax
mov    %rcx,(%rax)
lea    0xdae(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   10a0 <calloc@plt>
mov    %rax,-0x40(%rbp)
movq   $0x0,-0x48(%rbp)
cmpq   $0x0,-0x40(%rbp)
jne    12a2 <parse_cmd+0xc2>
lea    0xd92(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2d35(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
movl   $0x0,-0x4c(%rbp)
movl   $0x0,-0x50(%rbp)
movb   $0x0,-0x51(%rbp)
movq   $0x0,-0x60(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x88(%rbp),%rax
movslq %ecx,%rcx
cmp    %rcx,%rax
jae    17b8 <parse_cmd+0x5d8>
cmpl   $0x0,-0x4c(%rbp)
jne    1717 <parse_cmd+0x537>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1310 <parse_cmd+0x130>
movl   $0x1,-0x4c(%rbp)
jmp    17a7 <parse_cmd+0x5c7>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x27,%eax
jne    1373 <parse_cmd+0x193>
movsbl -0x51(%rbp),%eax
cmp    $0x27,%eax
jne    1342 <parse_cmd+0x162>
movl   $0x0,-0x50(%rbp)
movb   $0x0,-0x51(%rbp)
jmp    17a7 <parse_cmd+0x5c7>
movsbl -0x51(%rbp),%eax
cmp    $0x0,%eax
jne    1369 <parse_cmd+0x189>
movl   $0x1,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x51(%rbp)
jmp    17a7 <parse_cmd+0x5c7>
jmp    136e <parse_cmd+0x18e>
jmp    170d <parse_cmd+0x52d>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x22,%eax
jne    13d6 <parse_cmd+0x1f6>
movsbl -0x51(%rbp),%eax
cmp    $0x22,%eax
jne    13a5 <parse_cmd+0x1c5>
movl   $0x0,-0x50(%rbp)
movb   $0x0,-0x51(%rbp)
jmp    17a7 <parse_cmd+0x5c7>
movsbl -0x51(%rbp),%eax
cmp    $0x0,%eax
jne    13cc <parse_cmd+0x1ec>
movl   $0x1,-0x50(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    %al,-0x51(%rbp)
jmp    17a7 <parse_cmd+0x5c7>
jmp    13d1 <parse_cmd+0x1f1>
jmp    1708 <parse_cmd+0x528>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x20,%eax
je     143f <parse_cmd+0x25f>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
je     143f <parse_cmd+0x25f>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
je     143f <parse_cmd+0x25f>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
je     143f <parse_cmd+0x25f>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    1703 <parse_cmd+0x523>
movsbl -0x51(%rbp),%eax
cmp    $0x0,%eax
jne    16fe <parse_cmd+0x51e>
cmpq   $0x0,-0x48(%rbp)
je     14ba <parse_cmd+0x2da>
mov    -0x40(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <argz_add@plt>
mov    %rax,-0x68(%rbp)
cmpq   $0x0,-0x68(%rbp)
je     149f <parse_cmd+0x2bf>
mov    -0x68(%rbp),%rcx
mov    0x2b56(%rip),%rax
mov    %rcx,(%rax)
lea    0xbb1(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2b38(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rdx
add    $0x1,%rdx
xor    %esi,%esi
call   1060 <memset@plt>
movq   $0x0,-0x48(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x23,%eax
jne    14d4 <parse_cmd+0x2f4>
jmp    17b8 <parse_cmd+0x5d8>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    1610 <parse_cmd+0x430>
movl   $0x0,-0x6c(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0x90(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x90(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
je     154c <parse_cmd+0x36c>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x26,%eax
jne    154c <parse_cmd+0x36c>
mov    -0x6c(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x6c(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    15e6 <parse_cmd+0x406>
mov    0x2a8d(%rip),%rax
mov    (%rax),%edi
lea    0xaff(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x60(%rbp),%rax
mov    %rax,-0x98(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0x98(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
jne    15ab <parse_cmd+0x3cb>
mov    0x2a4a(%rip),%rax
mov    (%rax),%edi
lea    0xae0(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
jmp    15cf <parse_cmd+0x3ef>
mov    0x2a2e(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%edx
lea    0xacc(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    184b <parse_cmd+0x66b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x6c(%rbp),%r8d
call   1100 <comvec_add@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <argz_create@plt>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7c,%eax
jne    16bb <parse_cmd+0x4db>
movl   $0x0,-0x70(%rbp)
mov    -0x60(%rbp),%rax
mov    %rax,-0xa0(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%ecx
mov    -0xa0(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
cmp    %rcx,%rax
je     1688 <parse_cmd+0x4a8>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x7c,%eax
jne    1688 <parse_cmd+0x4a8>
mov    -0x70(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x70(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    1691 <parse_cmd+0x4b1>
mov    -0x70(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x70(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
mov    -0x70(%rbp),%r8d
call   1100 <comvec_add@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <argz_create@plt>
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x3b,%eax
jne    16f9 <parse_cmd+0x519>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
xor    %r8d,%r8d
call   1100 <comvec_add@plt>
lea    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
lea    -0x30(%rbp),%rdx
call   1070 <argz_create@plt>
jmp    17a7 <parse_cmd+0x5c7>
jmp    1703 <parse_cmd+0x523>
jmp    1708 <parse_cmd+0x528>
jmp    170d <parse_cmd+0x52d>
jmp    1712 <parse_cmd+0x532>
jmp    1717 <parse_cmd+0x537>
mov    -0x40(%rbp),%rdi
call   1090 <malloc_usable_size@plt>
mov    -0x48(%rbp),%rcx
add    $0x2,%rcx
cmp    %rcx,%rax
jae    1773 <parse_cmd+0x593>
mov    -0x40(%rbp),%rdi
mov    -0x48(%rbp),%rsi
add    $0x2,%rsi
call   10d0 <realloc@plt>
mov    %rax,-0x78(%rbp)
cmpq   $0x0,-0x78(%rbp)
jne    176b <parse_cmd+0x58b>
lea    0x942(%rip),%rdi
call   10e0 <perror@plt>
mov    0x286c(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x78(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    -0x60(%rbp),%rcx
mov    (%rax,%rcx,1),%dl
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,-0x48(%rbp)
mov    %dl,(%rax,%rcx,1)
mov    -0x40(%rbp),%rax
mov    -0x48(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
movl   $0x0,-0x4c(%rbp)
mov    -0x60(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x60(%rbp)
jmp    12bc <parse_cmd+0xdc>
cmpl   $0x0,-0x50(%rbp)
je     17d2 <parse_cmd+0x5f2>
lea    0x8ee(%rip),%rdi
movsbl -0x51(%rbp),%esi
call   1050 <printf@plt>
cmpq   $0x0,-0x48(%rbp)
je     182a <parse_cmd+0x64a>
mov    -0x40(%rbp),%rdx
lea    -0x28(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1080 <argz_add@plt>
mov    %rax,-0x80(%rbp)
cmpq   $0x0,-0x80(%rbp)
je     1825 <parse_cmd+0x645>
mov    -0x80(%rbp),%rcx
mov    0x27d0(%rip),%rax
mov    %rcx,(%rax)
lea    0x82b(%rip),%rdi
call   10e0 <perror@plt>
mov    0x27b2(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
jmp    182a <parse_cmd+0x64a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x28(%rbp),%rdx
mov    -0x30(%rbp),%rcx
xor    %r8d,%r8d
call   1100 <comvec_add@plt>
mov    -0x40(%rbp),%rdi
call   1030 <free@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_cmd>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r12
mov    %rsi,0x28(%rsp)
movq   $0x0,(%rsi)
mov    %rdi,0x20(%rsp)
xor    %esi,%esi
call   10c0 <comvec_create@plt>
movq   $0x0,0x30(%rsp)
lea    0x30(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x10(%rsp),%rdx
call   1070 <argz_create@plt>
test   %rax,%rax
jne    15d2 <parse_cmd+0x3f2>
mov    $0x1,%edi
mov    $0x1,%esi
call   10a0 <calloc@plt>
test   %rax,%rax
je     15e5 <parse_cmd+0x405>
mov    %rax,%rbx
mov    %r12,%rdi
call   1040 <strlen@plt>
test   %eax,%eax
je     154f <parse_cmd+0x36f>
xor    %ebp,%ebp
xor    %r14d,%r14d
xor    %r13d,%r13d
xor    %r15d,%r15d
movl   $0x0,0xc(%rsp)
jmp    129b <parse_cmd+0xbb>
nop
movzbl (%r12,%r13,1),%eax
mov    %al,(%rbx,%rbp,1)
movb   $0x0,0x1(%rbx,%rbp,1)
add    $0x1,%rbp
xor    %r14d,%r14d
add    $0x1,%r13
mov    %r12,%rdi
call   1040 <strlen@plt>
cltq
cmp    %rax,%r13
jae    151c <parse_cmd+0x33c>
test   %r14d,%r14d
je     12d0 <parse_cmd+0xf0>
mov    %rbx,%rdi
call   1090 <malloc_usable_size@plt>
lea    0x2(%rbp),%rsi
cmp    %rsi,%rax
jae    1270 <parse_cmd+0x90>
mov    %rbx,%rdi
call   10d0 <realloc@plt>
mov    %rax,%rbx
test   %rax,%rax
jne    1270 <parse_cmd+0x90>
jmp    15a5 <parse_cmd+0x3c5>
cs nopw 0x0(%rax,%rax,1)
movzbl (%r12,%r13,1),%eax
lea    -0x20(%rax),%ecx
cmp    $0x1b,%cl
ja     1312 <parse_cmd+0x132>
movzbl %cl,%ecx
lea    0xd19(%rip),%rdx
movslq (%rdx,%rcx,4),%rcx
add    %rdx,%rcx
jmp    *%rcx
xor    %r14d,%r14d
cmp    $0x22,%r15b
je     14ca <parse_cmd+0x2ea>
test   %r15b,%r15b
jne    12a0 <parse_cmd+0xc0>
mov    $0x22,%r15b
movl   $0x1,0xc(%rsp)
jmp    1284 <parse_cmd+0xa4>
cmp    $0x5c,%al
je     1474 <parse_cmd+0x294>
cmp    $0x7c,%al
je     1330 <parse_cmd+0x150>
cmp    $0x26,%al
jne    12a0 <parse_cmd+0xc0>
cs nopw 0x0(%rax,%rax,1)
test   %r15b,%r15b
jne    12a0 <parse_cmd+0xc0>
test   %rbp,%rbp
lea    0x18(%rsp),%r14
je     1372 <parse_cmd+0x192>
mov    %r14,%rdi
lea    0x10(%rsp),%rsi
mov    %rbx,%rdx
call   1080 <argz_add@plt>
test   %rax,%rax
jne    15bf <parse_cmd+0x3df>
add    $0x1,%rbp
mov    %rbx,%rdi
xor    %esi,%esi
mov    %rbp,%rdx
call   1060 <memset@plt>
movzbl (%r12,%r13,1),%eax
cmp    $0x26,%al
je     13ea <parse_cmd+0x20a>
cmp    $0x23,%al
je     1517 <parse_cmd+0x337>
cmp    $0x7c,%al
je     144e <parse_cmd+0x26e>
cmp    $0x3b,%al
jne    14bd <parse_cmd+0x2dd>
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
xor    %r15d,%r15d
mov    0x20(%rsp),%rdi
mov    0x28(%rsp),%rsi
xor    %r8d,%r8d
call   1100 <comvec_add@plt>
lea    0x30(%rsp),%rdi
mov    %r14,%rsi
lea    0x10(%rsp),%rdx
call   1070 <argz_create@plt>
jmp    14c0 <parse_cmd+0x2e0>
xor    %r14d,%r14d
cmp    $0x27,%r15b
je     14ca <parse_cmd+0x2ea>
test   %r15b,%r15b
jne    12a0 <parse_cmd+0xc0>
mov    $0x27,%r15b
movl   $0x1,0xc(%rsp)
jmp    1284 <parse_cmd+0xa4>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r13
je     14da <parse_cmd+0x2fa>
cmpb   $0x26,0x1(%r12,%r13,1)
jne    14da <parse_cmd+0x2fa>
add    $0x1,%r13
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x20(%rsp),%rdi
mov    0x28(%rsp),%rsi
mov    $0x1,%r8d
call   1100 <comvec_add@plt>
lea    0x30(%rsp),%rdi
mov    %r14,%rsi
lea    0x10(%rsp),%rdx
call   1070 <argz_create@plt>
movzbl (%r12,%r13,1),%eax
cmp    $0x7c,%al
jne    1386 <parse_cmd+0x1a6>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
cmp    %rax,%r13
je     147f <parse_cmd+0x29f>
cmpb   $0x7c,0x1(%r12,%r13,1)
jne    147f <parse_cmd+0x29f>
add    $0x1,%r13
mov    $0x2,%r8d
jmp    1485 <parse_cmd+0x2a5>
mov    $0x1,%r14d
jmp    1284 <parse_cmd+0xa4>
mov    $0x4,%r8d
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x20(%rsp),%rdi
mov    0x28(%rsp),%rsi
call   1100 <comvec_add@plt>
lea    0x30(%rsp),%rdi
mov    %r14,%rsi
lea    0x10(%rsp),%rdx
call   1070 <argz_create@plt>
movzbl (%r12,%r13,1),%eax
cmp    $0x3b,%al
je     138e <parse_cmd+0x1ae>
xor    %r15d,%r15d
xor    %r14d,%r14d
xor    %ebp,%ebp
jmp    1284 <parse_cmd+0xa4>
movl   $0x0,0xc(%rsp)
xor    %r15d,%r15d
jmp    1284 <parse_cmd+0xa4>
mov    0x2aff(%rip),%rbp
mov    0x0(%rbp),%edi
lea    0xbe0(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %r12,%rdi
call   1040 <strlen@plt>
add    $0xffffffff,%eax
cltq
mov    0x0(%rbp),%edi
cmp    %rax,%r13
jne    1582 <parse_cmd+0x3a2>
lea    0xbe1(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
jmp    1596 <parse_cmd+0x3b6>
xor    %r15d,%r15d
xor    %ebp,%ebp
cmpl   $0x0,0xc(%rsp)
je     1533 <parse_cmd+0x353>
movsbl %r15b,%esi
lea    0xbf9(%rip),%rdi
call   1050 <printf@plt>
test   %rbp,%rbp
je     154f <parse_cmd+0x36f>
lea    0x18(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    %rbx,%rdx
call   1080 <argz_add@plt>
test   %rax,%rax
jne    15bf <parse_cmd+0x3df>
mov    0x18(%rsp),%rdx
mov    0x10(%rsp),%rcx
mov    0x20(%rsp),%rdi
mov    0x28(%rsp),%rsi
xor    %r8d,%r8d
call   1100 <comvec_add@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movsbl 0x1(%r13,%r12,1),%edx
lea    0xb75(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    0x18(%rsp),%rbx
jmp    156b <parse_cmd+0x38b>
lea    0xb5e(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2a18(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    0x2a12(%rip),%rcx
mov    %rax,(%rcx)
lea    0xadd(%rip),%rdi
jmp    15ac <parse_cmd+0x3cc>
mov    0x29ff(%rip),%rcx
mov    %rax,(%rcx)
lea    0xa8d(%rip),%rdi
jmp    15ac <parse_cmd+0x3cc>
lea    0xaa5(%rip),%rdi
jmp    15ac <parse_cmd+0x3cc>

LLVM IR (-O0):
%struct.cmd = type { i32 }
@errno = global i64 0
@.str = [33 x i8] c"parse_cmd(): argz_create() error\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"parse_cmd(): calloc() error\00"
@.str.2 = [30 x i8] c"parse_cmd(): argz_add() error\00"
@stderr = global i32 0
@.str.3 = [36 x i8] c"seashell: error: expected `&', got \00"
@.str.4 = [21 x i8] c"end of command line\0A\00"
@.str.5 = [6 x i8] c"`%c'\0A\00"
@.str.6 = [29 x i8] c"parse_cmd(): realloc() error\00"
@.str.7 = [81 x i8] c"parse_cmd(): expanding an unpaired quotation mark (%c) to the end of the string\0A\00"
define void @parse_cmd(%struct.cmd** %0, i64* %1, i8* %2) {
%4 = alloca %struct.cmd**
%5 = alloca i64*
%6 = alloca i8*
%7 = alloca [1 x i8*]
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i64
%11 = alloca i8*
%12 = alloca i64
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8
%16 = alloca i64
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
%21 = alloca i64
store %struct.cmd** %0, %struct.cmd*** %4
store i64* %1, i64** %5
store i8* %2, i8** %6
%22 = load i64*, i64** %5
store i64 0, i64* %22
%23 = load %struct.cmd**, %struct.cmd*** %4
%24 = call i32 @comvec_create(%struct.cmd** %23, i32 0)
%25 = bitcast [1 x i8*]* %7 to i8*
%26 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
%27 = call i64 @argz_create(i8** %26, i8** %8, i64* %9)
store i64 %27, i64* %10
%28 = load i64, i64* %10
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %35
30: ; preds = %3
%31 = load i64, i64* %10
store i64 %31, i64* @errno
%32 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %3
%36 = call i8* @calloc(i32 1, i32 1)
store i8* %36, i8** %11
store i64 0, i64* %12
%37 = load i8*, i8** %11
%38 = icmp ne i8* %37, null
br i1 %38, label %43, label %39
39: ; preds = %35
%40 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%41 = load i32, i32* @EXIT_FAILURE
%42 = call i32 @exit(i32 %41)
unreachable
43: ; preds = %35
store i32 0, i32* %13
store i32 0, i32* %14
store i8 0, i8* %15
store i64 0, i64* %16
br label %44
44: ; preds = %325, %43
%45 = load i64, i64* %16
%46 = load i8*, i8** %6
%47 = call i32 @strlen(i8* %46)
%48 = sext i32 %47 to i64
%49 = icmp ult i64 %45, %48
br i1 %49, label %50, label %328
50: ; preds = %44
%51 = load i32, i32* %13
%52 = icmp ne i32 %51, 0
br i1 %52, label %294, label %53
53: ; preds = %50
%54 = load i8*, i8** %6
%55 = load i64, i64* %16
%56 = getelementptr inbounds i8, i8* %54, i64 %55
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 92
br i1 %59, label %60, label %61
60: ; preds = %53
store i32 1, i32* %13
br label %325
61: ; preds = %53
%62 = load i8*, i8** %6
%63 = load i64, i64* %16
%64 = getelementptr inbounds i8, i8* %62, i64 %63
%65 = load i8, i8* %64
%66 = sext i8 %65 to i32
%67 = icmp eq i32 %66, 39
br i1 %67, label %68, label %84
68: ; preds = %61
%69 = load i8, i8* %15
%70 = sext i8 %69 to i32
%71 = icmp eq i32 %70, 39
br i1 %71, label %72, label %73
72: ; preds = %68
store i32 0, i32* %14
store i8 0, i8* %15
br label %325
73: ; preds = %68
%74 = load i8, i8* %15
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %82
77: ; preds = %73
store i32 1, i32* %14
%78 = load i8*, i8** %6
%79 = load i64, i64* %16
%80 = getelementptr inbounds i8, i8* %78, i64 %79
%81 = load i8, i8* %80
store i8 %81, i8* %15
br label %325
82: ; preds = %73
br label %83
83: ; preds = %82
br label %292
84: ; preds = %61
%85 = load i8*, i8** %6
%86 = load i64, i64* %16
%87 = getelementptr inbounds i8, i8* %85, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 34
br i1 %90, label %91, label %107
91: ; preds = %84
%92 = load i8, i8* %15
%93 = sext i8 %92 to i32
%94 = icmp eq i32 %93, 34
br i1 %94, label %95, label %96
95: ; preds = %91
store i32 0, i32* %14
store i8 0, i8* %15
br label %325
96: ; preds = %91
%97 = load i8, i8* %15
%98 = sext i8 %97 to i32
%99 = icmp eq i32 %98, 0
br i1 %99, label %100, label %105
100: ; preds = %96
store i32 1, i32* %14
%101 = load i8*, i8** %6
%102 = load i64, i64* %16
%103 = getelementptr inbounds i8, i8* %101, i64 %102
%104 = load i8, i8* %103
store i8 %104, i8* %15
br label %325
105: ; preds = %96
br label %106
106: ; preds = %105
br label %291
107: ; preds = %84
%108 = load i8*, i8** %6
%109 = load i64, i64* %16
%110 = getelementptr inbounds i8, i8* %108, i64 %109
%111 = load i8, i8* %110
%112 = sext i8 %111 to i32
%113 = icmp eq i32 %112, 32
br i1 %113, label %142, label %114
114: ; preds = %107
%115 = load i8*, i8** %6
%116 = load i64, i64* %16
%117 = getelementptr inbounds i8, i8* %115, i64 %116
%118 = load i8, i8* %117
%119 = sext i8 %118 to i32
%120 = icmp eq i32 %119, 35
br i1 %120, label %142, label %121
121: ; preds = %114
%122 = load i8*, i8** %6
%123 = load i64, i64* %16
%124 = getelementptr inbounds i8, i8* %122, i64 %123
%125 = load i8, i8* %124
%126 = sext i8 %125 to i32
%127 = icmp eq i32 %126, 124
br i1 %127, label %142, label %128
128: ; preds = %121
%129 = load i8*, i8** %6
%130 = load i64, i64* %16
%131 = getelementptr inbounds i8, i8* %129, i64 %130
%132 = load i8, i8* %131
%133 = sext i8 %132 to i32
%134 = icmp eq i32 %133, 59
br i1 %134, label %142, label %135
135: ; preds = %128
%136 = load i8*, i8** %6
%137 = load i64, i64* %16
%138 = getelementptr inbounds i8, i8* %136, i64 %137
%139 = load i8, i8* %138
%140 = sext i8 %139 to i32
%141 = icmp eq i32 %140, 38
br i1 %141, label %142, label %290
142: ; preds = %135, %128, %121, %114, %107
%143 = load i8, i8* %15
%144 = sext i8 %143 to i32
%145 = icmp eq i32 %144, 0
br i1 %145, label %146, label %289
146: ; preds = %142
%147 = load i64, i64* %12
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %164
149: ; preds = %146
%150 = load i8*, i8** %11
%151 = call i64 @argz_add(i8** %8, i64* %9, i8* %150)
store i64 %151, i64* %17
%152 = load i64, i64* %17
%153 = icmp ne i64 %152, 0
br i1 %153, label %154, label %159
154: ; preds = %149
%155 = load i64, i64* %17
store i64 %155, i64* @errno
%156 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%157 = load i32, i32* @EXIT_FAILURE
%158 = call i32 @exit(i32 %157)
unreachable
159: ; preds = %149
%160 = load i8*, i8** %11
%161 = load i64, i64* %12
%162 = add i64 %161, 1
%163 = call i32 @memset(i8* %160, i32 0, i64 %162)
store i64 0, i64* %12
br label %164
164: ; preds = %159, %146
%165 = load i8*, i8** %6
%166 = load i64, i64* %16
%167 = getelementptr inbounds i8, i8* %165, i64 %166
%168 = load i8, i8* %167
%169 = sext i8 %168 to i32
%170 = icmp eq i32 %169, 35
br i1 %170, label %171, label %172
171: ; preds = %164
br label %328
172: ; preds = %164
%173 = load i8*, i8** %6
%174 = load i64, i64* %16
%175 = getelementptr inbounds i8, i8* %173, i64 %174
%176 = load i8, i8* %175
%177 = sext i8 %176 to i32
%178 = icmp eq i32 %177, 38
br i1 %178, label %179, label %234
179: ; preds = %172
store i32 0, i32* %18
%180 = load i64, i64* %16
%181 = load i8*, i8** %6
%182 = call i32 @strlen(i8* %181)
%183 = sub nsw i32 %182, 1
%184 = sext i32 %183 to i64
%185 = icmp ne i64 %180, %184
br i1 %185, label %186, label %199
186: ; preds = %179
%187 = load i8*, i8** %6
%188 = load i64, i64* %16
%189 = add i64 %188, 1
%190 = getelementptr inbounds i8, i8* %187, i64 %189
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
%193 = icmp eq i32 %192, 38
br i1 %193, label %194, label %199
194: ; preds = %186
%195 = load i32, i32* %18
%196 = or i32 %195, 1
store i32 %196, i32* %18
%197 = load i64, i64* %16
%198 = add i64 %197, 1
store i64 %198, i64* %16
br label %225
199: ; preds = %186, %179
%200 = load i32, i32* @stderr
%201 = call i32 (i32, i8*, ...) @fprintf(i32 %200, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%202 = load i64, i64* %16
%203 = load i8*, i8** %6
%204 = call i32 @strlen(i8* %203)
%205 = sub nsw i32 %204, 1
%206 = sext i32 %205 to i64
%207 = icmp eq i64 %202, %206
br i1 %207, label %208, label %211
208: ; preds = %199
%209 = load i32, i32* @stderr
%210 = call i32 (i32, i8*, ...) @fprintf(i32 %209, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %220
211: ; preds = %199
%212 = load i32, i32* @stderr
%213 = load i8*, i8** %6
%214 = load i64, i64* %16
%215 = add i64 %214, 1
%216 = getelementptr inbounds i8, i8* %213, i64 %215
%217 = load i8, i8* %216
%218 = sext i8 %217 to i32
%219 = call i32 (i32, i8*, ...) @fprintf(i32 %212, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %218)
br label %220
220: ; preds = %211, %208
%221 = load i8*, i8** %11
%222 = call i32 @free(i8* %221)
%223 = load i8*, i8** %8
%224 = call i32 @free(i8* %223)
br label %356
225: ; preds = %194
%226 = load %struct.cmd**, %struct.cmd*** %4
%227 = load i64*, i64** %5
%228 = load i8*, i8** %8
%229 = load i64, i64* %9
%230 = load i32, i32* %18
%231 = call i32 @comvec_add(%struct.cmd** %226, i64* %227, i8* %228, i64 %229, i32 %230)
%232 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
%233 = call i64 @argz_create(i8** %232, i8** %8, i64* %9)
br label %234
234: ; preds = %225, %172
%235 = load i8*, i8** %6
%236 = load i64, i64* %16
%237 = getelementptr inbounds i8, i8* %235, i64 %236
%238 = load i8, i8* %237
%239 = sext i8 %238 to i32
%240 = icmp eq i32 %239, 124
br i1 %240, label %241, label %273
241: ; preds = %234
store i32 0, i32* %19
%242 = load i64, i64* %16
%243 = load i8*, i8** %6
%244 = call i32 @strlen(i8* %243)
%245 = sub nsw i32 %244, 1
%246 = sext i32 %245 to i64
%247 = icmp ne i64 %242, %246
br i1 %247, label %248, label %261
248: ; preds = %241
%249 = load i8*, i8** %6
%250 = load i64, i64* %16
%251 = add i64 %250, 1
%252 = getelementptr inbounds i8, i8* %249, i64 %251
%253 = load i8, i8* %252
%254 = sext i8 %253 to i32
%255 = icmp eq i32 %254, 124
br i1 %255, label %256, label %261
256: ; preds = %248
%257 = load i32, i32* %19
%258 = or i32 %257, 2
store i32 %258, i32* %19
%259 = load i64, i64* %16
%260 = add i64 %259, 1
store i64 %260, i64* %16
br label %264
261: ; preds = %248, %241
%262 = load i32, i32* %19
%263 = or i32 %262, 4
store i32 %263, i32* %19
br label %264
264: ; preds = %261, %256
%265 = load %struct.cmd**, %struct.cmd*** %4
%266 = load i64*, i64** %5
%267 = load i8*, i8** %8
%268 = load i64, i64* %9
%269 = load i32, i32* %19
%270 = call i32 @comvec_add(%struct.cmd** %265, i64* %266, i8* %267, i64 %268, i32 %269)
%271 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
%272 = call i64 @argz_create(i8** %271, i8** %8, i64* %9)
br label %273
273: ; preds = %264, %234
%274 = load i8*, i8** %6
%275 = load i64, i64* %16
%276 = getelementptr inbounds i8, i8* %274, i64 %275
%277 = load i8, i8* %276
%278 = sext i8 %277 to i32
%279 = icmp eq i32 %278, 59
br i1 %279, label %280, label %288
280: ; preds = %273
%281 = load %struct.cmd**, %struct.cmd*** %4
%282 = load i64*, i64** %5
%283 = load i8*, i8** %8
%284 = load i64, i64* %9
%285 = call i32 @comvec_add(%struct.cmd** %281, i64* %282, i8* %283, i64 %284, i32 0)
%286 = getelementptr inbounds [1 x i8*], [1 x i8*]* %7, i64 0, i64 0
%287 = call i64 @argz_create(i8** %286, i8** %8, i64* %9)
br label %288
288: ; preds = %280, %273
br label %325
289: ; preds = %142
br label %290
290: ; preds = %289, %135
br label %291
291: ; preds = %290, %106
br label %292
292: ; preds = %291, %83
br label %293
293: ; preds = %292
br label %294
294: ; preds = %293, %50
%295 = load i8*, i8** %11
%296 = call i64 @malloc_usable_size(i8* %295)
%297 = load i64, i64* %12
%298 = add i64 %297, 2
%299 = icmp ult i64 %296, %298
br i1 %299, label %300, label %313
300: ; preds = %294
%301 = load i8*, i8** %11
%302 = load i64, i64* %12
%303 = add i64 %302, 2
%304 = call i8* @realloc(i8* %301, i64 %303)
store i8* %304, i8** %20
%305 = load i8*, i8** %20
%306 = icmp ne i8* %305, null
br i1 %306, label %311, label %307
307: ; preds = %300
%308 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%309 = load i32, i32* @EXIT_FAILURE
%310 = call i32 @exit(i32 %309)
unreachable
311: ; preds = %300
%312 = load i8*, i8** %20
store i8* %312, i8** %11
br label %313
313: ; preds = %311, %294
%314 = load i8*, i8** %6
%315 = load i64, i64* %16
%316 = getelementptr inbounds i8, i8* %314, i64 %315
%317 = load i8, i8* %316
%318 = load i8*, i8** %11
%319 = load i64, i64* %12
%320 = add i64 %319, 1
store i64 %320, i64* %12
%321 = getelementptr inbounds i8, i8* %318, i64 %319
store i8 %317, i8* %321
%322 = load i8*, i8** %11
%323 = load i64, i64* %12
%324 = getelementptr inbounds i8, i8* %322, i64 %323
store i8 0, i8* %324
store i32 0, i32* %13
br label %325
325: ; preds = %313, %288, %100, %95, %77, %72, %60
%326 = load i64, i64* %16
%327 = add i64 %326, 1
store i64 %327, i64* %16
br label %44
328: ; preds = %171, %44
%329 = load i32, i32* %14
%330 = icmp ne i32 %329, 0
br i1 %330, label %331, label %334
331: ; preds = %328
%332 = load i8, i8* %15
%333 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.7, i64 0, i64 0), i8 signext %332)
br label %334
334: ; preds = %331, %328
%335 = load i64, i64* %12
%336 = icmp ne i64 %335, 0
br i1 %336, label %337, label %348
337: ; preds = %334
%338 = load i8*, i8** %11
%339 = call i64 @argz_add(i8** %8, i64* %9, i8* %338)
store i64 %339, i64* %21
%340 = load i64, i64* %21
%341 = icmp ne i64 %340, 0
br i1 %341, label %342, label %347
342: ; preds = %337
%343 = load i64, i64* %21
store i64 %343, i64* @errno
%344 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%345 = load i32, i32* @EXIT_FAILURE
%346 = call i32 @exit(i32 %345)
unreachable
347: ; preds = %337
br label %348
348: ; preds = %347, %334
%349 = load %struct.cmd**, %struct.cmd*** %4
%350 = load i64*, i64** %5
%351 = load i8*, i8** %8
%352 = load i64, i64* %9
%353 = call i32 @comvec_add(%struct.cmd** %349, i64* %350, i8* %351, i64 %352, i32 0)
%354 = load i8*, i8** %11
%355 = call i32 @free(i8* %354)
br label %356
356: ; preds = %348, %220
ret void
}

LLVM IR (-O2):
%struct.cmd = type { i32 }
@errno = global i64 0
@.str = [33 x i8] c"parse_cmd(): argz_create() error\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [28 x i8] c"parse_cmd(): calloc() error\00"
@.str.2 = [30 x i8] c"parse_cmd(): argz_add() error\00"
@stderr = global i32 0
@.str.3 = [36 x i8] c"seashell: error: expected `&', got \00"
@.str.4 = [21 x i8] c"end of command line\0A\00"
@.str.5 = [6 x i8] c"`%c'\0A\00"
@.str.6 = [29 x i8] c"parse_cmd(): realloc() error\00"
@.str.7 = [81 x i8] c"parse_cmd(): expanding an unpaired quotation mark (%c) to the end of the string\0A\00"
define void @parse_cmd(%struct.cmd** %0, i64* %1, i8* %2) {
%4 = alloca [1 x i8*]
%5 = alloca i8*
%6 = alloca i64
store i64 0, i64* %1
%7 = tail call i32 @comvec_create(%struct.cmd** %0, i32 0)
%8 = bitcast [1 x i8*]* %4 to i8*
%9 = bitcast [1 x i8*]* %4 to i64*
store i64 0, i64* %9
%10 = bitcast i8** %5 to i8*
%11 = bitcast i64* %6 to i8*
%12 = getelementptr inbounds [1 x i8*], [1 x i8*]* %4, i64 0, i64 0
%13 = call i64 @argz_create(i8** %12, i8** %5, i64* %6)
%14 = icmp eq i64 %13, 0
br i1 %14, label %19, label %15
15: ; preds = %3
store i64 %13, i64* @errno
%16 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* @EXIT_FAILURE
%18 = call i32 @exit(i32 %17)
unreachable
19: ; preds = %3
%20 = call dereferenceable_or_null(1) i8* @calloc(i32 1, i32 1)
%21 = icmp eq i8* %20, null
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = call i32 @strlen(i8* %2)
%24 = icmp eq i32 %23, 0
br i1 %24, label %179, label %29
25: ; preds = %19
%26 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = call i32 @exit(i32 %27)
unreachable
29: ; preds = %22, %148
%30 = phi i8* [ %154, %148 ], [ %20, %22 ]
%31 = phi i64 [ %153, %148 ], [ 0, %22 ]
%32 = phi i32 [ %152, %148 ], [ 0, %22 ]
%33 = phi i64 [ %155, %148 ], [ 0, %22 ]
%34 = phi i8 [ %150, %148 ], [ 0, %22 ]
%35 = phi i32 [ %149, %148 ], [ 0, %22 ]
%36 = icmp eq i32 %32, 0
br i1 %36, label %37, label %130
37: ; preds = %29
%38 = getelementptr inbounds i8, i8* %2, i64 %33
%39 = load i8, i8* %38
switch i8 %39, label %44 [
i8 92, label %148
i8 39, label %40
i8 34, label %42
i8 32, label %48
i8 35, label %48
i8 124, label %48
i8 59, label %48
]
40: ; preds = %37
switch i8 %34, label %130 [
i8 39, label %148
i8 0, label %41
]
41: ; preds = %40
br label %148
42: ; preds = %37
switch i8 %34, label %130 [
i8 34, label %148
i8 0, label %43
]
43: ; preds = %42
br label %148
44: ; preds = %37
%45 = icmp eq i8 %39, 38
%46 = icmp eq i8 %34, 0
%47 = select i1 %45, i1 %46, i1 false
br i1 %47, label %50, label %130
48: ; preds = %37, %37, %37, %37
%49 = icmp eq i8 %34, 0
br i1 %49, label %50, label %130
50: ; preds = %44, %48
%51 = icmp eq i64 %31, 0
br i1 %51, label %63, label %52
52: ; preds = %50
%53 = call i64 @argz_add(i8** %5, i64* %6, i8* %30)
%54 = icmp eq i64 %53, 0
br i1 %54, label %59, label %55
55: ; preds = %52
store i64 %53, i64* @errno
%56 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%57 = load i32, i32* @EXIT_FAILURE
%58 = call i32 @exit(i32 %57)
unreachable
59: ; preds = %52
%60 = add i64 %31, 1
%61 = call i32 @memset(i8* %30, i32 0, i64 %60)
%62 = load i8, i8* %38
br label %63
63: ; preds = %59, %50
%64 = phi i8 [ %62, %59 ], [ %39, %50 ]
switch i8 %64, label %97 [
i8 35, label %162
i8 38, label %65
]
65: ; preds = %63
%66 = call i32 @strlen(i8* %2)
%67 = add nsw i32 %66, -1
%68 = sext i32 %67 to i64
%69 = icmp eq i64 %33, %68
br i1 %69, label %81, label %70
70: ; preds = %65
%71 = add nuw i64 %33, 1
%72 = getelementptr inbounds i8, i8* %2, i64 %71
%73 = load i8, i8* %72
%74 = icmp eq i8 %73, 38
br i1 %74, label %75, label %81
75: ; preds = %70
%76 = load i8*, i8** %5
%77 = load i64, i64* %6
%78 = call i32 @comvec_add(%struct.cmd** %0, i64* %1, i8* %76, i64 %77, i32 1)
%79 = call i64 @argz_create(i8** %12, i8** %5, i64* %6)
%80 = load i8, i8* %72
br label %97
81: ; preds = %70, %65
%82 = load i32, i32* @stderr
%83 = call i32 (i32, i8*, ...) @fprintf(i32 %82, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.3, i64 0, i64 0))
%84 = call i32 @strlen(i8* %2)
%85 = add nsw i32 %84, -1
%86 = sext i32 %85 to i64
%87 = icmp eq i64 %33, %86
%88 = load i32, i32* @stderr
br i1 %87, label %89, label %91
89: ; preds = %81
%90 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.4, i64 0, i64 0))
br label %159
91: ; preds = %81
%92 = add nuw i64 %33, 1
%93 = getelementptr inbounds i8, i8* %2, i64 %92
%94 = load i8, i8* %93
%95 = sext i8 %94 to i32
%96 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32 %95)
br label %159
97: ; preds = %75, %63
%98 = phi i8 [ %64, %63 ], [ %80, %75 ]
%99 = phi i64 [ %33, %63 ], [ %71, %75 ]
%100 = icmp eq i8 %98, 124
br i1 %100, label %101, label %121
101: ; preds = %97
%102 = call i32 @strlen(i8* %2)
%103 = add nsw i32 %102, -1
%104 = sext i32 %103 to i64
%105 = icmp eq i64 %99, %104
br i1 %105, label %111, label %106
106: ; preds = %101
%107 = add i64 %99, 1
%108 = getelementptr inbounds i8, i8* %2, i64 %107
%109 = load i8, i8* %108
%110 = icmp eq i8 %109, 124
br i1 %110, label %112, label %111
111: ; preds = %106, %101
br label %112
112: ; preds = %106, %111
%113 = phi i64 [ %99, %111 ], [ %107, %106 ]
%114 = phi i32 [ 4, %111 ], [ 2, %106 ]
%115 = load i8*, i8** %5
%116 = load i64, i64* %6
%117 = call i32 @comvec_add(%struct.cmd** %0, i64* %1, i8* %115, i64 %116, i32 %114)
%118 = call i64 @argz_create(i8** %12, i8** %5, i64* %6)
%119 = getelementptr inbounds i8, i8* %2, i64 %113
%120 = load i8, i8* %119
br label %121
121: ; preds = %112, %97
%122 = phi i8 [ %120, %112 ], [ %98, %97 ]
%123 = phi i64 [ %113, %112 ], [ %99, %97 ]
%124 = icmp eq i8 %122, 59
br i1 %124, label %125, label %148
125: ; preds = %121
%126 = load i8*, i8** %5
%127 = load i64, i64* %6
%128 = call i32 @comvec_add(%struct.cmd** %0, i64* %1, i8* %126, i64 %127, i32 0)
%129 = call i64 @argz_create(i8** %12, i8** %5, i64* %6)
br label %148
130: ; preds = %42, %40, %48, %44, %29
%131 = call i64 @malloc_usable_size(i8* %30)
%132 = add i64 %31, 2
%133 = icmp ult i64 %131, %132
br i1 %133, label %134, label %141
134: ; preds = %130
%135 = call i8* @realloc(i8* %30, i64 %132)
%136 = icmp eq i8* %135, null
br i1 %136, label %137, label %141
137: ; preds = %134
%138 = call i32 @perror(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.6, i64 0, i64 0))
%139 = load i32, i32* @EXIT_FAILURE
%140 = call i32 @exit(i32 %139)
unreachable
141: ; preds = %134, %130
%142 = phi i8* [ %30, %130 ], [ %135, %134 ]
%143 = getelementptr inbounds i8, i8* %2, i64 %33
%144 = load i8, i8* %143
%145 = add i64 %31, 1
%146 = getelementptr inbounds i8, i8* %142, i64 %31
store i8 %144, i8* %146
%147 = getelementptr inbounds i8, i8* %142, i64 %145
store i8 0, i8* %147
br label %148
148: ; preds = %37, %42, %40, %121, %125, %141, %43, %41
%149 = phi i32 [ %35, %141 ], [ 1, %41 ], [ 1, %43 ], [ %35, %125 ], [ %35, %121 ], [ %35, %37 ], [ 0, %40 ], [ 0, %42 ]
%150 = phi i8 [ %34, %141 ], [ 39, %41 ], [ 34, %43 ], [ 0, %125 ], [ 0, %121 ], [ %34, %37 ], [ 0, %40 ], [ 0, %42 ]
%151 = phi i64 [ %33, %141 ], [ %33, %41 ], [ %33, %43 ], [ %123, %125 ], [ %123, %121 ], [ %33, %37 ], [ %33, %40 ], [ %33, %42 ]
%152 = phi i32 [ 0, %141 ], [ 0, %41 ], [ 0, %43 ], [ 0, %125 ], [ 0, %121 ], [ 1, %37 ], [ 0, %40 ], [ 0, %42 ]
%153 = phi i64 [ %145, %141 ], [ %31, %41 ], [ %31, %43 ], [ 0, %125 ], [ 0, %121 ], [ %31, %37 ], [ %31, %40 ], [ %31, %42 ]
%154 = phi i8* [ %142, %141 ], [ %30, %41 ], [ %30, %43 ], [ %30, %125 ], [ %30, %121 ], [ %30, %37 ], [ %30, %40 ], [ %30, %42 ]
%155 = add i64 %151, 1
%156 = call i32 @strlen(i8* %2)
%157 = sext i32 %156 to i64
%158 = icmp ult i64 %155, %157
br i1 %158, label %29, label %162
159: ; preds = %91, %89
%160 = call i32 @free(i8* %30)
%161 = load i8*, i8** %5
br label %184
162: ; preds = %63, %148
%163 = phi i32 [ %35, %63 ], [ %149, %148 ]
%164 = phi i8 [ 0, %63 ], [ %150, %148 ]
%165 = phi i8* [ %30, %63 ], [ %154, %148 ]
%166 = phi i64 [ 0, %63 ], [ %153, %148 ]
%167 = icmp eq i32 %163, 0
br i1 %167, label %170, label %168
168: ; preds = %162
%169 = call i32 @printf(i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str.7, i64 0, i64 0), i8 signext %164)
br label %170
170: ; preds = %168, %162
%171 = icmp eq i64 %166, 0
br i1 %171, label %179, label %172
172: ; preds = %170
%173 = call i64 @argz_add(i8** %5, i64* %6, i8* %165)
%174 = icmp eq i64 %173, 0
br i1 %174, label %179, label %175
175: ; preds = %172
store i64 %173, i64* @errno
%176 = call i32 @perror(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%177 = load i32, i32* @EXIT_FAILURE
%178 = call i32 @exit(i32 %177)
unreachable
179: ; preds = %22, %172, %170
%180 = phi i8* [ %165, %172 ], [ %165, %170 ], [ %20, %22 ]
%181 = load i8*, i8** %5
%182 = load i64, i64* %6
%183 = call i32 @comvec_add(%struct.cmd** %0, i64* %1, i8* %181, i64 %182, i32 0)
br label %184
184: ; preds = %159, %179
%185 = phi i8* [ %161, %159 ], [ %180, %179 ]
%186 = call i32 @free(i8* %185)
ret void
}