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

/* Variables and functions */
int EXIT_FAILURE;
int args_main(int, char **);
int atoi(char *);
scalar_t__ calloc(int, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int /*<<< orphan*/, char *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char const *, char *,
                           ...);
char *getenv(char *);
scalar_t__ isdigit(char);
char **realloc(char **, int);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char const *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strcspn(char *, char *);
char *strerror(int /*<<< orphan*/);
int strlen(char *);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ strspn(char *, char *);
int script_main(int argc, char **argv) {
  FILE *input = NULL;
  const char *path = argv[1];
  char buffer[4096];
  char **script_argv = (char **)calloc(1, sizeof(char *));
  int script_argc = 1;
  script_argv[0] = (char *)calloc(strlen(argv[0]) + 1, sizeof(char));
  strcpy(script_argv[0], argv[0]);
  if (!strcmp(path, "-")) {
    input = fdopen(0, "r");
  } else {
    input = fopen(path, "r");
    if (input == NULL) {
      fprintf(stderr, "Failure opening '%s': %s\n", path, strerror(errno));
      return EXIT_FAILURE;
    }
  }
  int pos;
  char *token;
  while (fgets(buffer, 4096, input) != NULL) {
    char *line = buffer;
    token = NULL;
    line += strspn(line, " \t");
    if (line[0] == '\n' || line[0] == '#') {
      continue;
    }
    if (line[strlen(line) - 1] == '\n')
      line[strlen(line) - 1] = '\0';
    while (strlen(line)) {
      token = NULL;
      if (line[0] == '"') {
        line++;
        line[strcspn(line, "\"")] = '\0';
      } else if (line[0] == '\'') {
        line++;
        line[strcspn(line, "\'")] = '\0';
      } else {
        line[strcspn(line, " \t")] = '\0';
      }
      if (line[0] == '$') {
        line++;
        if (isdigit(line[0])) {
          pos = atoi(line) + 1;
          if (pos >= argc) {
            fprintf(stderr,
                    "%s: error: `%s' needs at least %d %s; only %d given\n",
                    argv[0], argv[1], pos - 1,
                    pos == 2 ? "argument" : "arguments", argc - 2);
            return EXIT_FAILURE;
          }
          token = argv[pos];
        } else {
          token = getenv(line);
          if (token == NULL) {
            fprintf(stderr, "%s: error: environment variable $%s is not set.\n",
                    argv[0], line);
            return EXIT_FAILURE;
          }
        }
      } else {
        token = line;
      }
      if (token != NULL) {
        script_argv = realloc(script_argv, (script_argc + 1) * sizeof(char *));
        if (script_argv == NULL) {
          fprintf(stderr,
                  "%s: error: failed to allocate memory while parsing `%s'.\n",
                  argv[0], argv[1]);
          exit(EXIT_FAILURE);
        }
        script_argv[script_argc] =
            (char *)calloc(strlen(token) + 1, sizeof(char));
        strncpy(script_argv[script_argc], token, strlen(token) + 1);
        script_argc++;
      }
      line += strlen(line) + 1;
      line += strspn(line, " \t");
    }
  }
  fclose(input);
  script_argv = realloc(script_argv, (script_argc + 1) * sizeof(char *));
  return args_main(script_argc, script_argv);
}


x86 assembly (clang, -O0):
<script_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1090,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    $0x1,%edi
mov    $0x8,%esi
call   10d0 <calloc@plt>
mov    %rax,-0x1028(%rbp)
movl   $0x1,-0x102c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1090 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%rcx
mov    -0x1028(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x1028(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
call   1070 <strcpy@plt>
mov    -0x20(%rbp),%rdi
lea    0xd41(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%eax
jne    12e4 <script_main+0xb4>
xor    %edi,%edi
lea    0xd2c(%rip),%rsi
call   1110 <fdopen@plt>
mov    %rax,-0x18(%rbp)
jmp    135f <script_main+0x12f>
mov    -0x20(%rbp),%rdi
lea    0xd13(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    135a <script_main+0x12a>
mov    0x2cd6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    0x2cb4(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
mov    -0x104c(%rbp),%edi
mov    -0x1048(%rbp),%rdx
mov    %rax,%rcx
lea    0xcc2(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x2c80(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1848 <script_main+0x618>
jmp    135f <script_main+0x12f>
jmp    1364 <script_main+0x134>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1000,%esi
call   10c0 <fgets@plt>
cmp    $0x0,%rax
je     1806 <script_main+0x5d6>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1040(%rbp)
movq   $0x0,-0x1038(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xc74(%rip),%rsi
call   10a0 <strspn@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0xa,%eax
je     13eb <script_main+0x1bb>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    13f0 <script_main+0x1c0>
jmp    1364 <script_main+0x134>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1058(%rbp)
mov    -0x1040(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,%ecx
mov    -0x1058(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1453 <script_main+0x223>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1060(%rbp)
mov    -0x1040(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,%ecx
mov    -0x1060(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1458 <script_main+0x228>
mov    -0x1040(%rbp),%rdi
call   1090 <strlen@plt>
cmp    $0x0,%eax
je     1801 <script_main+0x5d1>
movq   $0x0,-0x1038(%rbp)
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    14d1 <script_main+0x2a1>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1068(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xb68(%rip),%rsi
call   10b0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1068(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    155e <script_main+0x32e>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    152a <script_main+0x2fa>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1070(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xb11(%rip),%rsi
call   10b0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1070(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    1559 <script_main+0x329>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1078(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xad8(%rip),%rsi
call   10b0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1078(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    155e <script_main+0x32e>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    16a2 <script_main+0x472>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
movsbl (%rax),%edi
call   1060 <isdigit@plt>
cmp    $0x0,%rax
je     1641 <script_main+0x411>
mov    -0x1040(%rbp),%rdi
call   1130 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x1030(%rbp)
mov    -0x1030(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1626 <script_main+0x3f6>
mov    0x2a19(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x1030(%rbp),%r8d
sub    $0x1,%r8d
mov    -0x1030(%rbp),%esi
lea    0xa73(%rip),%r9
lea    0xa63(%rip),%rax
cmp    $0x2,%esi
cmove  %rax,%r9
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
lea    0xa1a(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x29b4(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1848 <script_main+0x618>
mov    -0x10(%rbp),%rax
movslq -0x1030(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x1038(%rbp)
jmp    169d <script_main+0x46d>
mov    -0x1040(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x1038(%rbp)
cmpq   $0x0,-0x1038(%rbp)
jne    1698 <script_main+0x468>
mov    0x2977(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x1040(%rbp),%rcx
lea    0x9ed(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x2942(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1848 <script_main+0x618>
jmp    169d <script_main+0x46d>
jmp    16b0 <script_main+0x480>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1038(%rbp)
cmpq   $0x0,-0x1038(%rbp)
je     17ae <script_main+0x57e>
mov    -0x1028(%rbp),%rdi
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1100 <realloc@plt>
mov    %rax,-0x1028(%rbp)
cmpq   $0x0,-0x1028(%rbp)
jne    1724 <script_main+0x4f4>
mov    0x28e9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0x98f(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    0x28b3(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
mov    -0x1038(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%rdx
mov    -0x1028(%rbp),%rax
movslq -0x102c(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x1028(%rbp),%rax
movslq -0x102c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x1088(%rbp)
mov    -0x1038(%rbp),%rax
mov    %rax,-0x1080(%rbp)
mov    -0x1038(%rbp),%rdi
call   1090 <strlen@plt>
mov    -0x1088(%rbp),%rdi
mov    -0x1080(%rbp),%rsi
mov    %eax,%edx
add    $0x1,%edx
call   1050 <strncpy@plt>
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x102c(%rbp)
mov    -0x1040(%rbp),%rdi
call   1090 <strlen@plt>
mov    %eax,%ecx
add    $0x1,%ecx
mov    -0x1040(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0x83d(%rip),%rsi
call   10a0 <strspn@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1040(%rbp)
jmp    1458 <script_main+0x228>
jmp    1364 <script_main+0x134>
mov    -0x18(%rbp),%rdi
call   1080 <fclose@plt>
mov    -0x1028(%rbp),%rdi
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1100 <realloc@plt>
mov    %rax,-0x1028(%rbp)
mov    -0x102c(%rbp),%edi
mov    -0x1028(%rbp),%rsi
call   1040 <args_main@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1090,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<script_main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1028,%rsp
mov    %rsi,%rbx
mov    %edi,0xc(%rsp)
mov    0x8(%rsi),%r14
mov    $0x1,%edi
mov    $0x8,%esi
call   10d0 <calloc@plt>
mov    %rax,%rbp
mov    (%rbx),%rdi
call   1090 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,0x0(%rbp)
mov    %rbx,0x10(%rsp)
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1070 <strcpy@plt>
lea    0xd72(%rip),%rsi
mov    %r14,%rdi
call   10e0 <strcmp@plt>
lea    0xd65(%rip),%rsi
test   %eax,%eax
je     12d9 <script_main+0xa9>
mov    %r14,%rdi
call   1120 <fopen@plt>
test   %rax,%rax
jne    12e0 <script_main+0xb0>
mov    0x2d2b(%rip),%rax
mov    (%rax),%ebp
mov    0x2d1a(%rip),%rax
mov    (%rax),%edi
call   1150 <strerror@plt>
lea    0xd38(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
jmp    1568 <script_main+0x338>
xor    %edi,%edi
call   1110 <fdopen@plt>
lea    0x20(%rsp),%rdi
mov    $0x1000,%esi
mov    %rax,0x18(%rsp)
mov    %rax,%rdx
call   10c0 <fgets@plt>
mov    $0x1,%r12d
test   %rax,%rax
je     14df <script_main+0x2af>
lea    0x20(%rsp),%rbx
jmp    1330 <script_main+0x100>
nopl   (%rax)
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    0x18(%rsp),%rdx
call   10c0 <fgets@plt>
test   %rax,%rax
je     14df <script_main+0x2af>
mov    %rbx,%rdi
lea    0xce4(%rip),%rsi
call   10a0 <strspn@plt>
cltq
mov    0x20(%rsp,%rax,1),%cl
cmp    $0xa,%cl
je     1310 <script_main+0xe0>
cmp    $0x23,%cl
je     1310 <script_main+0xe0>
lea    (%rsp,%rax,1),%r14
add    $0x20,%r14
mov    %r14,%rdi
call   1090 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r14,1)
jne    1419 <script_main+0x1e9>
mov    %r14,%rdi
call   1090 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
jmp    1419 <script_main+0x1e9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%r15
lea    0x8(,%r12,8),%esi
mov    %rbp,%rdi
call   1100 <realloc@plt>
test   %rax,%rax
je     158a <script_main+0x35a>
mov    %rax,%rbp
lea    0x1(%r12),%r13d
mov    %r15,%rdi
call   1090 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10d0 <calloc@plt>
mov    %rax,%rbx
movslq %r12d,%rax
mov    %rbx,0x0(%rbp,%rax,8)
mov    %r15,%rdi
call   1090 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strncpy@plt>
mov    %r13d,%r12d
mov    %r14,%rdi
call   1090 <strlen@plt>
cltq
lea    (%rax,%r14,1),%rbx
lea    (%rax,%r14,1),%rdi
add    $0x1,%rdi
lea    0xc14(%rip),%rsi
call   10a0 <strspn@plt>
cltq
lea    (%rax,%rbx,1),%r14
add    $0x1,%r14
mov    %r14,%rdi
call   1090 <strlen@plt>
test   %eax,%eax
je     1310 <script_main+0xe0>
movzbl (%r14),%eax
cmp    $0x27,%al
je     1450 <script_main+0x220>
cmp    $0x22,%al
jne    1470 <script_main+0x240>
lea    0x1(%r14),%rbx
mov    %rbx,%rdi
lea    0xbde(%rip),%rsi
jmp    145e <script_main+0x22e>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r14),%rbx
mov    %rbx,%rdi
lea    0xbc5(%rip),%rsi
call   10b0 <strcspn@plt>
add    %r14,%rax
add    $0x1,%rax
mov    %rbx,%r14
jmp    1482 <script_main+0x252>
nop
mov    %r14,%rdi
lea    0xba4(%rip),%rsi
call   10b0 <strcspn@plt>
add    %r14,%rax
movb   $0x0,(%rax)
cmpb   $0x24,(%r14)
jne    1390 <script_main+0x160>
movsbl 0x1(%r14),%edi
add    $0x1,%r14
call   1060 <isdigit@plt>
mov    %r14,%rdi
test   %rax,%rax
je     14cd <script_main+0x29d>
call   1130 <atoi@plt>
lea    0x1(%rax),%esi
cmp    0xc(%rsp),%esi
jge    1506 <script_main+0x2d6>
movslq %esi,%rax
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,8),%r15
test   %r15,%r15
jne    1393 <script_main+0x163>
jmp    13ed <script_main+0x1bd>
call   1030 <getenv@plt>
test   %rax,%rax
je     154d <script_main+0x31d>
mov    %rax,%r15
jmp    1393 <script_main+0x163>
mov    0x18(%rsp),%rdi
call   1080 <fclose@plt>
lea    0x8(,%r12,8),%esi
mov    %rbp,%rdi
call   1100 <realloc@plt>
mov    %r12d,%edi
mov    %rax,%rsi
call   1040 <args_main@plt>
jmp    1578 <script_main+0x348>
mov    0x2ad3(%rip),%rcx
mov    (%rcx),%edi
mov    0x10(%rsp),%rcx
mov    (%rcx),%rdx
mov    0x8(%rcx),%rcx
cmp    $0x2,%esi
lea    0xb35(%rip),%rsi
lea    0xb37(%rip),%r9
cmove  %rsi,%r9
mov    0xc(%rsp),%esi
add    $0xfffffffe,%esi
mov    %esi,(%rsp)
lea    0xae4(%rip),%rsi
mov    %eax,%r8d
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    156f <script_main+0x33f>
mov    0x2a8c(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xb08(%rip),%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    0x2a5a(%rip),%rax
mov    (%rax),%eax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a4f(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
mov    0x8(%rax),%rcx
lea    0xaf8(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    0x2a1c(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [26 x i8] c"Failure opening '%s': %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c" \09\00"
@.str.4 = [2 x i8] c"\22\00"
@.str.5 = [2 x i8] c"'\00"
@.str.6 = [53 x i8] c"%s: error: `%s' needs at least %d %s; only %d given\0A\00"
@.str.7 = [9 x i8] c"argument\00"
@.str.8 = [10 x i8] c"arguments\00"
@.str.9 = [49 x i8] c"%s: error: environment variable $%s is not set.\0A\00"
@.str.10 = [58 x i8] c"%s: error: failed to allocate memory while parsing `%s'.\0A\00"
define i32 @script_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca [4096 x i8]
%9 = alloca i8**
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i8*
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32* null, i32** %6
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
store i8* %16, i8** %7
%17 = call i64 @calloc(i32 1, i32 8)
%18 = inttoptr i64 %17 to i8**
store i8** %18, i8*** %9
store i32 1, i32* %10
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 @strlen(i8* %21)
%23 = add nsw i32 %22, 1
%24 = call i64 @calloc(i32 %23, i32 1)
%25 = inttoptr i64 %24 to i8*
%26 = load i8**, i8*** %9
%27 = getelementptr inbounds i8*, i8** %26, i64 0
store i8* %25, i8** %27
%28 = load i8**, i8*** %9
%29 = getelementptr inbounds i8*, i8** %28, i64 0
%30 = load i8*, i8** %29
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 0
%33 = load i8*, i8** %32
%34 = call i32 @strcpy(i8* %30, i8* %33)
%35 = load i8*, i8** %7
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%37 = icmp ne i32 %36, 0
br i1 %37, label %40, label %38
38: ; preds = %2
%39 = call i32* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %39, i32** %6
br label %53
40: ; preds = %2
%41 = load i8*, i8** %7
%42 = call i32* @fopen(i8* %41, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %42, i32** %6
%43 = load i32*, i32** %6
%44 = icmp eq i32* %43, null
br i1 %44, label %45, label %52
45: ; preds = %40
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %7
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %47, i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
store i32 %51, i32* %3
br label %266
52: ; preds = %40
br label %53
53: ; preds = %52, %38
br label %54
54: ; preds = %252, %77, %53
%55 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%56 = load i32*, i32** %6
%57 = call i32* @fgets(i8* %55, i32 4096, i32* %56)
%58 = icmp ne i32* %57, null
br i1 %58, label %59, label %253
59: ; preds = %54
%60 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
store i8* %60, i8** %13
store i8* null, i8** %12
%61 = load i8*, i8** %13
%62 = call i32 @strspn(i8* %61, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%63 = load i8*, i8** %13
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8, i8* %63, i64 %64
store i8* %65, i8** %13
%66 = load i8*, i8** %13
%67 = getelementptr inbounds i8, i8* %66, i64 0
%68 = load i8, i8* %67
%69 = sext i8 %68 to i32
%70 = icmp eq i32 %69, 10
br i1 %70, label %77, label %71
71: ; preds = %59
%72 = load i8*, i8** %13
%73 = getelementptr inbounds i8, i8* %72, i64 0
%74 = load i8, i8* %73
%75 = sext i8 %74 to i32
%76 = icmp eq i32 %75, 35
br i1 %76, label %77, label %78
77: ; preds = %71, %59
br label %54
78: ; preds = %71
%79 = load i8*, i8** %13
%80 = load i8*, i8** %13
%81 = call i32 @strlen(i8* %80)
%82 = sub nsw i32 %81, 1
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %79, i64 %83
%85 = load i8, i8* %84
%86 = sext i8 %85 to i32
%87 = icmp eq i32 %86, 10
br i1 %87, label %88, label %95
88: ; preds = %78
%89 = load i8*, i8** %13
%90 = load i8*, i8** %13
%91 = call i32 @strlen(i8* %90)
%92 = sub nsw i32 %91, 1
%93 = sext i32 %92 to i64
%94 = getelementptr inbounds i8, i8* %89, i64 %93
store i8 0, i8* %94
br label %95
95: ; preds = %88, %78
br label %96
96: ; preds = %240, %95
%97 = load i8*, i8** %13
%98 = call i32 @strlen(i8* %97)
%99 = icmp ne i32 %98, 0
br i1 %99, label %100, label %252
100: ; preds = %96
store i8* null, i8** %12
%101 = load i8*, i8** %13
%102 = getelementptr inbounds i8, i8* %101, i64 0
%103 = load i8, i8* %102
%104 = sext i8 %103 to i32
%105 = icmp eq i32 %104, 34
br i1 %105, label %106, label %113
106: ; preds = %100
%107 = load i8*, i8** %13
%108 = getelementptr inbounds i8, i8* %107, i32 1
store i8* %108, i8** %13
%109 = load i8*, i8** %13
%110 = load i8*, i8** %13
%111 = call i64 @strcspn(i8* %110, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%112 = getelementptr inbounds i8, i8* %109, i64 %111
store i8 0, i8* %112
br label %132
113: ; preds = %100
%114 = load i8*, i8** %13
%115 = getelementptr inbounds i8, i8* %114, i64 0
%116 = load i8, i8* %115
%117 = sext i8 %116 to i32
%118 = icmp eq i32 %117, 39
br i1 %118, label %119, label %126
119: ; preds = %113
%120 = load i8*, i8** %13
%121 = getelementptr inbounds i8, i8* %120, i32 1
store i8* %121, i8** %13
%122 = load i8*, i8** %13
%123 = load i8*, i8** %13
%124 = call i64 @strcspn(i8* %123, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%125 = getelementptr inbounds i8, i8* %122, i64 %124
store i8 0, i8* %125
br label %131
126: ; preds = %113
%127 = load i8*, i8** %13
%128 = load i8*, i8** %13
%129 = call i64 @strcspn(i8* %128, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%130 = getelementptr inbounds i8, i8* %127, i64 %129
store i8 0, i8* %130
br label %131
131: ; preds = %126, %119
br label %132
132: ; preds = %131, %106
%133 = load i8*, i8** %13
%134 = getelementptr inbounds i8, i8* %133, i64 0
%135 = load i8, i8* %134
%136 = sext i8 %135 to i32
%137 = icmp eq i32 %136, 36
br i1 %137, label %138, label %192
138: ; preds = %132
%139 = load i8*, i8** %13
%140 = getelementptr inbounds i8, i8* %139, i32 1
store i8* %140, i8** %13
%141 = load i8*, i8** %13
%142 = getelementptr inbounds i8, i8* %141, i64 0
%143 = load i8, i8* %142
%144 = call i64 @isdigit(i8 signext %143)
%145 = icmp ne i64 %144, 0
br i1 %145, label %146, label %177
146: ; preds = %138
%147 = load i8*, i8** %13
%148 = call i32 @atoi(i8* %147)
%149 = add nsw i32 %148, 1
store i32 %149, i32* %11
%150 = load i32, i32* %11
%151 = load i32, i32* %4
%152 = icmp sge i32 %150, %151
br i1 %152, label %153, label %171
153: ; preds = %146
%154 = load i32, i32* @stderr
%155 = load i8**, i8*** %5
%156 = getelementptr inbounds i8*, i8** %155, i64 0
%157 = load i8*, i8** %156
%158 = load i8**, i8*** %5
%159 = getelementptr inbounds i8*, i8** %158, i64 1
%160 = load i8*, i8** %159
%161 = load i32, i32* %11
%162 = sub nsw i32 %161, 1
%163 = load i32, i32* %11
%164 = icmp eq i32 %163, 2
%165 = zext i1 %164 to i64
%166 = select i1 %164, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0)
%167 = load i32, i32* %4
%168 = sub nsw i32 %167, 2
%169 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %154, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %157, i8* %160, i32 %162, i8* %166, i32 %168)
%170 = load i32, i32* @EXIT_FAILURE
store i32 %170, i32* %3
br label %266
171: ; preds = %146
%172 = load i8**, i8*** %5
%173 = load i32, i32* %11
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds i8*, i8** %172, i64 %174
%176 = load i8*, i8** %175
store i8* %176, i8** %12
br label %191
177: ; preds = %138
%178 = load i8*, i8** %13
%179 = call i8* @getenv(i8* %178)
store i8* %179, i8** %12
%180 = load i8*, i8** %12
%181 = icmp eq i8* %180, null
br i1 %181, label %182, label %190
182: ; preds = %177
%183 = load i32, i32* @stderr
%184 = load i8**, i8*** %5
%185 = getelementptr inbounds i8*, i8** %184, i64 0
%186 = load i8*, i8** %185
%187 = load i8*, i8** %13
%188 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %183, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %186, i8* %187)
%189 = load i32, i32* @EXIT_FAILURE
store i32 %189, i32* %3
br label %266
190: ; preds = %177
br label %191
191: ; preds = %190, %171
br label %194
192: ; preds = %132
%193 = load i8*, i8** %13
store i8* %193, i8** %12
br label %194
194: ; preds = %192, %191
%195 = load i8*, i8** %12
%196 = icmp ne i8* %195, null
br i1 %196, label %197, label %240
197: ; preds = %194
%198 = load i8**, i8*** %9
%199 = load i32, i32* %10
%200 = add nsw i32 %199, 1
%201 = sext i32 %200 to i64
%202 = mul i64 %201, 8
%203 = trunc i64 %202 to i32
%204 = call i8** @realloc(i8** %198, i32 %203)
store i8** %204, i8*** %9
%205 = load i8**, i8*** %9
%206 = icmp eq i8** %205, null
br i1 %206, label %207, label %218
207: ; preds = %197
%208 = load i32, i32* @stderr
%209 = load i8**, i8*** %5
%210 = getelementptr inbounds i8*, i8** %209, i64 0
%211 = load i8*, i8** %210
%212 = load i8**, i8*** %5
%213 = getelementptr inbounds i8*, i8** %212, i64 1
%214 = load i8*, i8** %213
%215 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %208, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0), i8* %211, i8* %214)
%216 = load i32, i32* @EXIT_FAILURE
%217 = call i32 @exit(i32 %216)
unreachable
218: ; preds = %197
%219 = load i8*, i8** %12
%220 = call i32 @strlen(i8* %219)
%221 = add nsw i32 %220, 1
%222 = call i64 @calloc(i32 %221, i32 1)
%223 = inttoptr i64 %222 to i8*
%224 = load i8**, i8*** %9
%225 = load i32, i32* %10
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds i8*, i8** %224, i64 %226
store i8* %223, i8** %227
%228 = load i8**, i8*** %9
%229 = load i32, i32* %10
%230 = sext i32 %229 to i64
%231 = getelementptr inbounds i8*, i8** %228, i64 %230
%232 = load i8*, i8** %231
%233 = load i8*, i8** %12
%234 = load i8*, i8** %12
%235 = call i32 @strlen(i8* %234)
%236 = add nsw i32 %235, 1
%237 = call i32 @strncpy(i8* %232, i8* %233, i32 %236)
%238 = load i32, i32* %10
%239 = add nsw i32 %238, 1
store i32 %239, i32* %10
br label %240
240: ; preds = %218, %194
%241 = load i8*, i8** %13
%242 = call i32 @strlen(i8* %241)
%243 = add nsw i32 %242, 1
%244 = load i8*, i8** %13
%245 = sext i32 %243 to i64
%246 = getelementptr inbounds i8, i8* %244, i64 %245
store i8* %246, i8** %13
%247 = load i8*, i8** %13
%248 = call i32 @strspn(i8* %247, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%249 = load i8*, i8** %13
%250 = sext i32 %248 to i64
%251 = getelementptr inbounds i8, i8* %249, i64 %250
store i8* %251, i8** %13
br label %96
252: ; preds = %96
br label %54
253: ; preds = %54
%254 = load i32*, i32** %6
%255 = call i32 @fclose(i32* %254)
%256 = load i8**, i8*** %9
%257 = load i32, i32* %10
%258 = add nsw i32 %257, 1
%259 = sext i32 %258 to i64
%260 = mul i64 %259, 8
%261 = trunc i64 %260 to i32
%262 = call i8** @realloc(i8** %256, i32 %261)
store i8** %262, i8*** %9
%263 = load i32, i32* %10
%264 = load i8**, i8*** %9
%265 = call i32 @args_main(i32 %263, i8** %264)
store i32 %265, i32* %3
br label %266
266: ; preds = %253, %182, %153, %45
%267 = load i32, i32* %3
ret i32 %267
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c"r\00"
@stderr = global i32 0
@.str.2 = [26 x i8] c"Failure opening '%s': %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c" \09\00"
@.str.4 = [2 x i8] c"\22\00"
@.str.5 = [2 x i8] c"'\00"
@.str.6 = [53 x i8] c"%s: error: `%s' needs at least %d %s; only %d given\0A\00"
@.str.7 = [9 x i8] c"argument\00"
@.str.8 = [10 x i8] c"arguments\00"
@.str.9 = [49 x i8] c"%s: error: environment variable $%s is not set.\0A\00"
@.str.10 = [58 x i8] c"%s: error: failed to allocate memory while parsing `%s'.\0A\00"
define i32 @script_main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds i8*, i8** %1, i64 1
%5 = load i8*, i8** %4
%6 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%7 = tail call i64 @calloc(i32 1, i32 8)
%8 = inttoptr i64 %7 to i8**
%9 = load i8*, i8** %1
%10 = tail call i32 @strlen(i8* %9)
%11 = add nsw i32 %10, 1
%12 = tail call i64 @calloc(i32 %11, i32 1)
%13 = inttoptr i64 %12 to i8*
store i8* %13, i8** %8
%14 = load i8*, i8** %1
%15 = tail call i32 @strcpy(i8* %13, i8* %14)
%16 = tail call i32 @strcmp(i8* dereferenceable(1) %5, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = tail call i32* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %29
20: ; preds = %2
%21 = tail call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%22 = icmp eq i32* %21, null
br i1 %22, label %23, label %29
23: ; preds = %20
%24 = load i32, i32* @stderr
%25 = load i32, i32* @errno
%26 = tail call i8* @strerror(i32 %25)
%27 = tail call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %24, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8* %26)
%28 = load i32, i32* @EXIT_FAILURE
br label %157
29: ; preds = %20, %18
%30 = phi i32* [ %21, %20 ], [ %19, %18 ]
%31 = call i32* @fgets(i8* %6, i32 4096, i32* %30)
%32 = icmp eq i32* %31, null
br i1 %32, label %149, label %33
33: ; preds = %29, %144
%34 = phi i32 [ %146, %144 ], [ 1, %29 ]
%35 = phi i8** [ %145, %144 ], [ %8, %29 ]
%36 = call i32 @strspn(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %37
%39 = load i8, i8* %38
switch i8 %39, label %40 [
i8 10, label %144
i8 35, label %144
]
40: ; preds = %33
%41 = call i32 @strlen(i8* %38)
%42 = add nsw i32 %41, -1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8, i8* %38, i64 %43
%45 = load i8, i8* %44
%46 = icmp eq i8 %45, 10
br i1 %46, label %47, label %52
47: ; preds = %40
%48 = call i32 @strlen(i8* %38)
%49 = add nsw i32 %48, -1
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %38, i64 %50
store i8 0, i8* %51
br label %52
52: ; preds = %47, %40
%53 = call i32 @strlen(i8* %38)
%54 = icmp eq i32 %53, 0
br i1 %54, label %144, label %55
55: ; preds = %52, %131
%56 = phi i8* [ %141, %131 ], [ %38, %52 ]
%57 = phi i32 [ %134, %131 ], [ %34, %52 ]
%58 = phi i8** [ %133, %131 ], [ %35, %52 ]
%59 = load i8, i8* %56
switch i8 %59, label %68 [
i8 34, label %60
i8 39, label %64
]
60: ; preds = %55
%61 = getelementptr inbounds i8, i8* %56, i64 1
%62 = call i64 @strcspn(i8* %61, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%63 = getelementptr inbounds i8, i8* %61, i64 %62
br label %71
64: ; preds = %55
%65 = getelementptr inbounds i8, i8* %56, i64 1
%66 = call i64 @strcspn(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%67 = getelementptr inbounds i8, i8* %65, i64 %66
br label %71
68: ; preds = %55
%69 = call i64 @strcspn(i8* %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%70 = getelementptr inbounds i8, i8* %56, i64 %69
br label %71
71: ; preds = %64, %68, %60
%72 = phi i8* [ %67, %64 ], [ %70, %68 ], [ %63, %60 ]
%73 = phi i8* [ %65, %64 ], [ %56, %68 ], [ %61, %60 ]
store i8 0, i8* %72
%74 = load i8, i8* %73
%75 = icmp eq i8 %74, 36
br i1 %75, label %76, label %107
76: ; preds = %71
%77 = getelementptr inbounds i8, i8* %73, i64 1
%78 = load i8, i8* %77
%79 = call i64 @isdigit(i8 signext %78)
%80 = icmp eq i64 %79, 0
br i1 %80, label %94, label %81
81: ; preds = %76
%82 = call i32 @atoi(i8* %77)
%83 = add nsw i32 %82, 1
%84 = icmp slt i32 %83, %0
br i1 %84, label %102, label %85
85: ; preds = %81
%86 = load i32, i32* @stderr
%87 = load i8*, i8** %1
%88 = load i8*, i8** %4
%89 = icmp eq i32 %83, 2
%90 = select i1 %89, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0)
%91 = add nsw i32 %0, -2
%92 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %86, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %87, i8* %88, i32 %82, i8* %90, i32 %91)
%93 = load i32, i32* @EXIT_FAILURE
br label %157
94: ; preds = %76
%95 = call i8* @getenv(i8* %77)
%96 = icmp eq i8* %95, null
br i1 %96, label %97, label %107
97: ; preds = %94
%98 = load i32, i32* @stderr
%99 = load i8*, i8** %1
%100 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %98, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %99, i8* %77)
%101 = load i32, i32* @EXIT_FAILURE
br label %157
102: ; preds = %81
%103 = sext i32 %83 to i64
%104 = getelementptr inbounds i8*, i8** %1, i64 %103
%105 = load i8*, i8** %104
%106 = icmp eq i8* %105, null
br i1 %106, label %131, label %107
107: ; preds = %71, %94, %102
%108 = phi i8* [ %77, %102 ], [ %73, %71 ], [ %77, %94 ]
%109 = phi i8* [ %105, %102 ], [ %73, %71 ], [ %95, %94 ]
%110 = add nsw i32 %57, 1
%111 = shl i32 %110, 3
%112 = call i8** @realloc(i8** %58, i32 %111)
%113 = icmp eq i8** %112, null
br i1 %113, label %114, label %121
114: ; preds = %107
%115 = load i32, i32* @stderr
%116 = load i8*, i8** %1
%117 = load i8*, i8** %4
%118 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %115, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0), i8* %116, i8* %117)
%119 = load i32, i32* @EXIT_FAILURE
%120 = call i32 @exit(i32 %119)
unreachable
121: ; preds = %107
%122 = call i32 @strlen(i8* %109)
%123 = add nsw i32 %122, 1
%124 = call i64 @calloc(i32 %123, i32 1)
%125 = inttoptr i64 %124 to i8*
%126 = sext i32 %57 to i64
%127 = getelementptr inbounds i8*, i8** %112, i64 %126
store i8* %125, i8** %127
%128 = call i32 @strlen(i8* %109)
%129 = add nsw i32 %128, 1
%130 = call i32 @strncpy(i8* %125, i8* %109, i32 %129)
br label %131
131: ; preds = %121, %102
%132 = phi i8* [ %108, %121 ], [ %77, %102 ]
%133 = phi i8** [ %112, %121 ], [ %58, %102 ]
%134 = phi i32 [ %110, %121 ], [ %57, %102 ]
%135 = call i32 @strlen(i8* %132)
%136 = add nsw i32 %135, 1
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds i8, i8* %132, i64 %137
%139 = call i32 @strspn(i8* %138, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %138, i64 %140
%142 = call i32 @strlen(i8* %141)
%143 = icmp eq i32 %142, 0
br i1 %143, label %144, label %55
144: ; preds = %131, %52, %33, %33
%145 = phi i8** [ %35, %33 ], [ %35, %33 ], [ %35, %52 ], [ %133, %131 ]
%146 = phi i32 [ %34, %33 ], [ %34, %33 ], [ %34, %52 ], [ %134, %131 ]
%147 = call i32* @fgets(i8* %6, i32 4096, i32* %30)
%148 = icmp eq i32* %147, null
br i1 %148, label %149, label %33
149: ; preds = %144, %29
%150 = phi i8** [ %8, %29 ], [ %145, %144 ]
%151 = phi i32 [ 1, %29 ], [ %146, %144 ]
%152 = call i32 @fclose(i32* %30)
%153 = shl i32 %151, 3
%154 = add i32 %153, 8
%155 = call i8** @realloc(i8** %150, i32 %154)
%156 = call i32 @args_main(i32 %151, i8** %155)
br label %157
157: ; preds = %97, %85, %149, %23
%158 = phi i32 [ %28, %23 ], [ %156, %149 ], [ %101, %97 ], [ %93, %85 ]
ret i32 %158
}