#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 *);
int /*<<< orphan*/ isatty(int /*<<< orphan*/);
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, "-") || !isatty(0)) {
    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   10e0 <calloc@plt>
mov    %rax,-0x1028(%rbp)
movl   $0x1,-0x102c(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10e0 <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    0xd31(%rip),%rsi
call   10f0 <strcmp@plt>
cmp    $0x0,%eax
je     12ed <script_main+0xad>
xor    %edi,%edi
call   1080 <isatty@plt>
cmp    $0x0,%eax
jne    1304 <script_main+0xc4>
xor    %edi,%edi
lea    0xd0c(%rip),%rsi
call   1120 <fdopen@plt>
mov    %rax,-0x18(%rbp)
jmp    137f <script_main+0x13f>
mov    -0x20(%rbp),%rdi
lea    0xcf3(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    137a <script_main+0x13a>
mov    0x2cb6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x104c(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,-0x1048(%rbp)
mov    0x2c94(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
mov    -0x104c(%rbp),%edi
mov    -0x1048(%rbp),%rdx
mov    %rax,%rcx
lea    0xca2(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    0x2c60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1868 <script_main+0x628>
jmp    137f <script_main+0x13f>
jmp    1384 <script_main+0x144>
lea    -0x1020(%rbp),%rdi
mov    -0x18(%rbp),%rdx
mov    $0x1000,%esi
call   10d0 <fgets@plt>
cmp    $0x0,%rax
je     1826 <script_main+0x5e6>
lea    -0x1020(%rbp),%rax
mov    %rax,-0x1040(%rbp)
movq   $0x0,-0x1038(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xc54(%rip),%rsi
call   10b0 <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     140b <script_main+0x1cb>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x23,%eax
jne    1410 <script_main+0x1d0>
jmp    1384 <script_main+0x144>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1058(%rbp)
mov    -0x1040(%rbp),%rdi
call   10a0 <strlen@plt>
mov    %eax,%ecx
mov    -0x1058(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    1473 <script_main+0x233>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1060(%rbp)
mov    -0x1040(%rbp),%rdi
call   10a0 <strlen@plt>
mov    %eax,%ecx
mov    -0x1060(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movb   $0x0,(%rax,%rcx,1)
jmp    1478 <script_main+0x238>
mov    -0x1040(%rbp),%rdi
call   10a0 <strlen@plt>
cmp    $0x0,%eax
je     1821 <script_main+0x5e1>
movq   $0x0,-0x1038(%rbp)
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x22,%eax
jne    14f1 <script_main+0x2b1>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1068(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xb48(%rip),%rsi
call   10c0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1068(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    157e <script_main+0x33e>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x27,%eax
jne    154a <script_main+0x30a>
mov    -0x1040(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x1040(%rbp)
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1070(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xaf1(%rip),%rsi
call   10c0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1070(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    1579 <script_main+0x339>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1078(%rbp)
mov    -0x1040(%rbp),%rdi
lea    0xab8(%rip),%rsi
call   10c0 <strcspn@plt>
mov    %rax,%rcx
mov    -0x1078(%rbp),%rax
movb   $0x0,(%rax,%rcx,1)
jmp    157e <script_main+0x33e>
mov    -0x1040(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x24,%eax
jne    16c2 <script_main+0x482>
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     1661 <script_main+0x421>
mov    -0x1040(%rbp),%rdi
call   1140 <atoi@plt>
add    $0x1,%eax
mov    %eax,-0x1030(%rbp)
mov    -0x1030(%rbp),%eax
cmp    -0x8(%rbp),%eax
jl     1646 <script_main+0x406>
mov    0x29f9(%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    0xa53(%rip),%r9
lea    0xa43(%rip),%rax
cmp    $0x2,%esi
cmove  %rax,%r9
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
lea    0x9fa(%rip),%rsi
mov    %eax,(%rsp)
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    0x2994(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1868 <script_main+0x628>
mov    -0x10(%rbp),%rax
movslq -0x1030(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x1038(%rbp)
jmp    16bd <script_main+0x47d>
mov    -0x1040(%rbp),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x1038(%rbp)
cmpq   $0x0,-0x1038(%rbp)
jne    16b8 <script_main+0x478>
mov    0x2957(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x1040(%rbp),%rcx
lea    0x9cd(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    0x2922(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    1868 <script_main+0x628>
jmp    16bd <script_main+0x47d>
jmp    16d0 <script_main+0x490>
mov    -0x1040(%rbp),%rax
mov    %rax,-0x1038(%rbp)
cmpq   $0x0,-0x1038(%rbp)
je     17ce <script_main+0x58e>
mov    -0x1028(%rbp),%rdi
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1110 <realloc@plt>
mov    %rax,-0x1028(%rbp)
cmpq   $0x0,-0x1028(%rbp)
jne    1744 <script_main+0x504>
mov    0x28c9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rcx
lea    0x96f(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    0x2893(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    -0x1038(%rbp),%rdi
call   10a0 <strlen@plt>
mov    %eax,%edi
add    $0x1,%edi
mov    $0x1,%esi
call   10e0 <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   10a0 <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   10a0 <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    0x81d(%rip),%rsi
call   10b0 <strspn@plt>
mov    %eax,%ecx
mov    -0x1040(%rbp),%rax
movslq %ecx,%rcx
add    %rcx,%rax
mov    %rax,-0x1040(%rbp)
jmp    1478 <script_main+0x238>
jmp    1384 <script_main+0x144>
mov    -0x18(%rbp),%rdi
call   1090 <fclose@plt>
mov    -0x1028(%rbp),%rdi
mov    -0x102c(%rbp),%eax
add    $0x1,%eax
cltq
shl    $0x3,%rax
mov    %eax,%esi
call   1110 <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   10e0 <calloc@plt>
mov    %rax,%rbp
mov    (%rbx),%rdi
call   10a0 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
mov    %rax,0x0(%rbp)
mov    %rbx,0x10(%rsp)
mov    (%rbx),%rsi
mov    %rax,%rdi
call   1070 <strcpy@plt>
lea    0xd62(%rip),%rsi
mov    %r14,%rdi
call   10f0 <strcmp@plt>
test   %eax,%eax
je     12f4 <script_main+0xb4>
xor    %edi,%edi
call   1080 <isatty@plt>
test   %eax,%eax
je     12f4 <script_main+0xb4>
lea    0xd46(%rip),%rsi
mov    %r14,%rdi
call   1130 <fopen@plt>
test   %rax,%rax
jne    1302 <script_main+0xc2>
mov    0x2d10(%rip),%rax
mov    (%rax),%ebp
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
call   1160 <strerror@plt>
lea    0xd1d(%rip),%rsi
mov    %ebp,%edi
mov    %r14,%rdx
mov    %rax,%rcx
jmp    1588 <script_main+0x348>
lea    0xd07(%rip),%rsi
xor    %edi,%edi
call   1120 <fdopen@plt>
lea    0x20(%rsp),%rdi
mov    $0x1000,%esi
mov    %rax,0x18(%rsp)
mov    %rax,%rdx
call   10d0 <fgets@plt>
mov    $0x1,%r12d
test   %rax,%rax
je     14ff <script_main+0x2bf>
lea    0x20(%rsp),%rbx
jmp    1350 <script_main+0x110>
nop
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1000,%esi
mov    0x18(%rsp),%rdx
call   10d0 <fgets@plt>
test   %rax,%rax
je     14ff <script_main+0x2bf>
mov    %rbx,%rdi
lea    0xcc4(%rip),%rsi
call   10b0 <strspn@plt>
cltq
mov    0x20(%rsp,%rax,1),%cl
cmp    $0xa,%cl
je     1330 <script_main+0xf0>
cmp    $0x23,%cl
je     1330 <script_main+0xf0>
lea    (%rsp,%rax,1),%r14
add    $0x20,%r14
mov    %r14,%rdi
call   10a0 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r14,1)
jne    1439 <script_main+0x1f9>
mov    %r14,%rdi
call   10a0 <strlen@plt>
cltq
movb   $0x0,-0x1(%rax,%r14,1)
jmp    1439 <script_main+0x1f9>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%r15
lea    0x8(,%r12,8),%esi
mov    %rbp,%rdi
call   1110 <realloc@plt>
test   %rax,%rax
je     15aa <script_main+0x36a>
mov    %rax,%rbp
lea    0x1(%r12),%r13d
mov    %r15,%rdi
call   10a0 <strlen@plt>
lea    0x1(%rax),%edi
mov    $0x1,%esi
call   10e0 <calloc@plt>
mov    %rax,%rbx
movslq %r12d,%rax
mov    %rbx,0x0(%rbp,%rax,8)
mov    %r15,%rdi
call   10a0 <strlen@plt>
lea    0x1(%rax),%edx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <strncpy@plt>
mov    %r13d,%r12d
mov    %r14,%rdi
call   10a0 <strlen@plt>
cltq
lea    (%rax,%r14,1),%rbx
lea    (%rax,%r14,1),%rdi
add    $0x1,%rdi
lea    0xbf4(%rip),%rsi
call   10b0 <strspn@plt>
cltq
lea    (%rax,%rbx,1),%r14
add    $0x1,%r14
mov    %r14,%rdi
call   10a0 <strlen@plt>
test   %eax,%eax
je     1330 <script_main+0xf0>
movzbl (%r14),%eax
cmp    $0x27,%al
je     1470 <script_main+0x230>
cmp    $0x22,%al
jne    1490 <script_main+0x250>
lea    0x1(%r14),%rbx
mov    %rbx,%rdi
lea    0xbbe(%rip),%rsi
jmp    147e <script_main+0x23e>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0x1(%r14),%rbx
mov    %rbx,%rdi
lea    0xba5(%rip),%rsi
call   10c0 <strcspn@plt>
add    %r14,%rax
add    $0x1,%rax
mov    %rbx,%r14
jmp    14a2 <script_main+0x262>
nop
mov    %r14,%rdi
lea    0xb84(%rip),%rsi
call   10c0 <strcspn@plt>
add    %r14,%rax
movb   $0x0,(%rax)
cmpb   $0x24,(%r14)
jne    13b0 <script_main+0x170>
movsbl 0x1(%r14),%edi
add    $0x1,%r14
call   1060 <isdigit@plt>
mov    %r14,%rdi
test   %rax,%rax
je     14ed <script_main+0x2ad>
call   1140 <atoi@plt>
lea    0x1(%rax),%esi
cmp    0xc(%rsp),%esi
jge    1526 <script_main+0x2e6>
movslq %esi,%rax
mov    0x10(%rsp),%rcx
mov    (%rcx,%rax,8),%r15
test   %r15,%r15
jne    13b3 <script_main+0x173>
jmp    140d <script_main+0x1cd>
call   1030 <getenv@plt>
test   %rax,%rax
je     156d <script_main+0x32d>
mov    %rax,%r15
jmp    13b3 <script_main+0x173>
mov    0x18(%rsp),%rdi
call   1090 <fclose@plt>
lea    0x8(,%r12,8),%esi
mov    %rbp,%rdi
call   1110 <realloc@plt>
mov    %r12d,%edi
mov    %rax,%rsi
call   1040 <args_main@plt>
jmp    1598 <script_main+0x358>
mov    0x2ab3(%rip),%rcx
mov    (%rcx),%edi
mov    0x10(%rsp),%rcx
mov    (%rcx),%rdx
mov    0x8(%rcx),%rcx
cmp    $0x2,%esi
lea    0xb15(%rip),%rsi
lea    0xb17(%rip),%r9
cmove  %rsi,%r9
mov    0xc(%rsp),%esi
add    $0xfffffffe,%esi
mov    %esi,(%rsp)
lea    0xac4(%rip),%rsi
mov    %eax,%r8d
xor    %eax,%eax
call   1100 <fprintf@plt>
jmp    158f <script_main+0x34f>
mov    0x2a6c(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
lea    0xae8(%rip),%rsi
mov    %r14,%rcx
xor    %eax,%eax
call   1100 <fprintf@plt>
mov    0x2a3a(%rip),%rax
mov    (%rax),%eax
add    $0x1028,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2a2f(%rip),%rax
mov    (%rax),%edi
mov    0x10(%rsp),%rax
mov    (%rax),%rdx
mov    0x8(%rax),%rcx
lea    0xad8(%rip),%rsi
xor    %eax,%eax
call   1100 <fprintf@plt>
mov    0x29fc(%rip),%rax
mov    (%rax),%edi
call   1150 <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 %38, label %41
38: ; preds = %2
%39 = call i32 @isatty(i32 0)
%40 = icmp ne i32 %39, 0
br i1 %40, label %43, label %41
41: ; preds = %38, %2
%42 = call i32* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %42, i32** %6
br label %56
43: ; preds = %38
%44 = load i8*, i8** %7
%45 = call i32* @fopen(i8* %44, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %45, i32** %6
%46 = load i32*, i32** %6
%47 = icmp eq i32* %46, null
br i1 %47, label %48, label %55
48: ; preds = %43
%49 = load i32, i32* @stderr
%50 = load i8*, i8** %7
%51 = load i32, i32* @errno
%52 = call i8* @strerror(i32 %51)
%53 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %49, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %50, i8* %52)
%54 = load i32, i32* @EXIT_FAILURE
store i32 %54, i32* %3
br label %269
55: ; preds = %43
br label %56
56: ; preds = %55, %41
br label %57
57: ; preds = %255, %80, %56
%58 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
%59 = load i32*, i32** %6
%60 = call i32* @fgets(i8* %58, i32 4096, i32* %59)
%61 = icmp ne i32* %60, null
br i1 %61, label %62, label %256
62: ; preds = %57
%63 = getelementptr inbounds [4096 x i8], [4096 x i8]* %8, i64 0, i64 0
store i8* %63, i8** %13
store i8* null, i8** %12
%64 = load i8*, i8** %13
%65 = call i32 @strspn(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%66 = load i8*, i8** %13
%67 = sext i32 %65 to i64
%68 = getelementptr inbounds i8, i8* %66, i64 %67
store i8* %68, i8** %13
%69 = load i8*, i8** %13
%70 = getelementptr inbounds i8, i8* %69, i64 0
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 10
br i1 %73, label %80, label %74
74: ; preds = %62
%75 = load i8*, i8** %13
%76 = getelementptr inbounds i8, i8* %75, i64 0
%77 = load i8, i8* %76
%78 = sext i8 %77 to i32
%79 = icmp eq i32 %78, 35
br i1 %79, label %80, label %81
80: ; preds = %74, %62
br label %57
81: ; preds = %74
%82 = load i8*, i8** %13
%83 = load i8*, i8** %13
%84 = call i32 @strlen(i8* %83)
%85 = sub nsw i32 %84, 1
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds i8, i8* %82, i64 %86
%88 = load i8, i8* %87
%89 = sext i8 %88 to i32
%90 = icmp eq i32 %89, 10
br i1 %90, label %91, label %98
91: ; preds = %81
%92 = load i8*, i8** %13
%93 = load i8*, i8** %13
%94 = call i32 @strlen(i8* %93)
%95 = sub nsw i32 %94, 1
%96 = sext i32 %95 to i64
%97 = getelementptr inbounds i8, i8* %92, i64 %96
store i8 0, i8* %97
br label %98
98: ; preds = %91, %81
br label %99
99: ; preds = %243, %98
%100 = load i8*, i8** %13
%101 = call i32 @strlen(i8* %100)
%102 = icmp ne i32 %101, 0
br i1 %102, label %103, label %255
103: ; preds = %99
store i8* null, i8** %12
%104 = load i8*, i8** %13
%105 = getelementptr inbounds i8, i8* %104, i64 0
%106 = load i8, i8* %105
%107 = sext i8 %106 to i32
%108 = icmp eq i32 %107, 34
br i1 %108, label %109, label %116
109: ; preds = %103
%110 = load i8*, i8** %13
%111 = getelementptr inbounds i8, i8* %110, i32 1
store i8* %111, i8** %13
%112 = load i8*, i8** %13
%113 = load i8*, i8** %13
%114 = call i64 @strcspn(i8* %113, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%115 = getelementptr inbounds i8, i8* %112, i64 %114
store i8 0, i8* %115
br label %135
116: ; preds = %103
%117 = load i8*, i8** %13
%118 = getelementptr inbounds i8, i8* %117, i64 0
%119 = load i8, i8* %118
%120 = sext i8 %119 to i32
%121 = icmp eq i32 %120, 39
br i1 %121, label %122, label %129
122: ; preds = %116
%123 = load i8*, i8** %13
%124 = getelementptr inbounds i8, i8* %123, i32 1
store i8* %124, i8** %13
%125 = load i8*, i8** %13
%126 = load i8*, i8** %13
%127 = call i64 @strcspn(i8* %126, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%128 = getelementptr inbounds i8, i8* %125, i64 %127
store i8 0, i8* %128
br label %134
129: ; preds = %116
%130 = load i8*, i8** %13
%131 = load i8*, i8** %13
%132 = call i64 @strcspn(i8* %131, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%133 = getelementptr inbounds i8, i8* %130, i64 %132
store i8 0, i8* %133
br label %134
134: ; preds = %129, %122
br label %135
135: ; preds = %134, %109
%136 = load i8*, i8** %13
%137 = getelementptr inbounds i8, i8* %136, i64 0
%138 = load i8, i8* %137
%139 = sext i8 %138 to i32
%140 = icmp eq i32 %139, 36
br i1 %140, label %141, label %195
141: ; preds = %135
%142 = load i8*, i8** %13
%143 = getelementptr inbounds i8, i8* %142, i32 1
store i8* %143, i8** %13
%144 = load i8*, i8** %13
%145 = getelementptr inbounds i8, i8* %144, i64 0
%146 = load i8, i8* %145
%147 = call i64 @isdigit(i8 signext %146)
%148 = icmp ne i64 %147, 0
br i1 %148, label %149, label %180
149: ; preds = %141
%150 = load i8*, i8** %13
%151 = call i32 @atoi(i8* %150)
%152 = add nsw i32 %151, 1
store i32 %152, i32* %11
%153 = load i32, i32* %11
%154 = load i32, i32* %4
%155 = icmp sge i32 %153, %154
br i1 %155, label %156, label %174
156: ; preds = %149
%157 = load i32, i32* @stderr
%158 = load i8**, i8*** %5
%159 = getelementptr inbounds i8*, i8** %158, i64 0
%160 = load i8*, i8** %159
%161 = load i8**, i8*** %5
%162 = getelementptr inbounds i8*, i8** %161, i64 1
%163 = load i8*, i8** %162
%164 = load i32, i32* %11
%165 = sub nsw i32 %164, 1
%166 = load i32, i32* %11
%167 = icmp eq i32 %166, 2
%168 = zext i1 %167 to i64
%169 = select i1 %167, 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)
%170 = load i32, i32* %4
%171 = sub nsw i32 %170, 2
%172 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %157, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %160, i8* %163, i32 %165, i8* %169, i32 %171)
%173 = load i32, i32* @EXIT_FAILURE
store i32 %173, i32* %3
br label %269
174: ; preds = %149
%175 = load i8**, i8*** %5
%176 = load i32, i32* %11
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds i8*, i8** %175, i64 %177
%179 = load i8*, i8** %178
store i8* %179, i8** %12
br label %194
180: ; preds = %141
%181 = load i8*, i8** %13
%182 = call i8* @getenv(i8* %181)
store i8* %182, i8** %12
%183 = load i8*, i8** %12
%184 = icmp eq i8* %183, null
br i1 %184, label %185, label %193
185: ; preds = %180
%186 = load i32, i32* @stderr
%187 = load i8**, i8*** %5
%188 = getelementptr inbounds i8*, i8** %187, i64 0
%189 = load i8*, i8** %188
%190 = load i8*, i8** %13
%191 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %186, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %189, i8* %190)
%192 = load i32, i32* @EXIT_FAILURE
store i32 %192, i32* %3
br label %269
193: ; preds = %180
br label %194
194: ; preds = %193, %174
br label %197
195: ; preds = %135
%196 = load i8*, i8** %13
store i8* %196, i8** %12
br label %197
197: ; preds = %195, %194
%198 = load i8*, i8** %12
%199 = icmp ne i8* %198, null
br i1 %199, label %200, label %243
200: ; preds = %197
%201 = load i8**, i8*** %9
%202 = load i32, i32* %10
%203 = add nsw i32 %202, 1
%204 = sext i32 %203 to i64
%205 = mul i64 %204, 8
%206 = trunc i64 %205 to i32
%207 = call i8** @realloc(i8** %201, i32 %206)
store i8** %207, i8*** %9
%208 = load i8**, i8*** %9
%209 = icmp eq i8** %208, null
br i1 %209, label %210, label %221
210: ; preds = %200
%211 = load i32, i32* @stderr
%212 = load i8**, i8*** %5
%213 = getelementptr inbounds i8*, i8** %212, i64 0
%214 = load i8*, i8** %213
%215 = load i8**, i8*** %5
%216 = getelementptr inbounds i8*, i8** %215, i64 1
%217 = load i8*, i8** %216
%218 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %211, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0), i8* %214, i8* %217)
%219 = load i32, i32* @EXIT_FAILURE
%220 = call i32 @exit(i32 %219)
unreachable
221: ; preds = %200
%222 = load i8*, i8** %12
%223 = call i32 @strlen(i8* %222)
%224 = add nsw i32 %223, 1
%225 = call i64 @calloc(i32 %224, i32 1)
%226 = inttoptr i64 %225 to i8*
%227 = load i8**, i8*** %9
%228 = load i32, i32* %10
%229 = sext i32 %228 to i64
%230 = getelementptr inbounds i8*, i8** %227, i64 %229
store i8* %226, i8** %230
%231 = load i8**, i8*** %9
%232 = load i32, i32* %10
%233 = sext i32 %232 to i64
%234 = getelementptr inbounds i8*, i8** %231, i64 %233
%235 = load i8*, i8** %234
%236 = load i8*, i8** %12
%237 = load i8*, i8** %12
%238 = call i32 @strlen(i8* %237)
%239 = add nsw i32 %238, 1
%240 = call i32 @strncpy(i8* %235, i8* %236, i32 %239)
%241 = load i32, i32* %10
%242 = add nsw i32 %241, 1
store i32 %242, i32* %10
br label %243
243: ; preds = %221, %197
%244 = load i8*, i8** %13
%245 = call i32 @strlen(i8* %244)
%246 = add nsw i32 %245, 1
%247 = load i8*, i8** %13
%248 = sext i32 %246 to i64
%249 = getelementptr inbounds i8, i8* %247, i64 %248
store i8* %249, i8** %13
%250 = load i8*, i8** %13
%251 = call i32 @strspn(i8* %250, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%252 = load i8*, i8** %13
%253 = sext i32 %251 to i64
%254 = getelementptr inbounds i8, i8* %252, i64 %253
store i8* %254, i8** %13
br label %99
255: ; preds = %99
br label %57
256: ; preds = %57
%257 = load i32*, i32** %6
%258 = call i32 @fclose(i32* %257)
%259 = load i8**, i8*** %9
%260 = load i32, i32* %10
%261 = add nsw i32 %260, 1
%262 = sext i32 %261 to i64
%263 = mul i64 %262, 8
%264 = trunc i64 %263 to i32
%265 = call i8** @realloc(i8** %259, i32 %264)
store i8** %265, i8*** %9
%266 = load i32, i32* %10
%267 = load i8**, i8*** %9
%268 = call i32 @args_main(i32 %266, i8** %267)
store i32 %268, i32* %3
br label %269
269: ; preds = %256, %185, %156, %48
%270 = load i32, i32* %3
ret i32 %270
}

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 %21, label %18
18: ; preds = %2
%19 = tail call i32 @isatty(i32 0)
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %18, %2
%22 = tail call i32* @fdopen(i32 0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %32
23: ; preds = %18
%24 = tail call i32* @fopen(i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32* %24, null
br i1 %25, label %26, label %32
26: ; preds = %23
%27 = load i32, i32* @stderr
%28 = load i32, i32* @errno
%29 = tail call i8* @strerror(i32 %28)
%30 = tail call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %27, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %5, i8* %29)
%31 = load i32, i32* @EXIT_FAILURE
br label %160
32: ; preds = %23, %21
%33 = phi i32* [ %24, %23 ], [ %22, %21 ]
%34 = call i32* @fgets(i8* %6, i32 4096, i32* %33)
%35 = icmp eq i32* %34, null
br i1 %35, label %152, label %36
36: ; preds = %32, %147
%37 = phi i32 [ %149, %147 ], [ 1, %32 ]
%38 = phi i8** [ %148, %147 ], [ %8, %32 ]
%39 = call i32 @strspn(i8* %6, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 %40
%42 = load i8, i8* %41
switch i8 %42, label %43 [
i8 10, label %147
i8 35, label %147
]
43: ; preds = %36
%44 = call i32 @strlen(i8* %41)
%45 = add nsw i32 %44, -1
%46 = sext i32 %45 to i64
%47 = getelementptr inbounds i8, i8* %41, i64 %46
%48 = load i8, i8* %47
%49 = icmp eq i8 %48, 10
br i1 %49, label %50, label %55
50: ; preds = %43
%51 = call i32 @strlen(i8* %41)
%52 = add nsw i32 %51, -1
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %41, i64 %53
store i8 0, i8* %54
br label %55
55: ; preds = %50, %43
%56 = call i32 @strlen(i8* %41)
%57 = icmp eq i32 %56, 0
br i1 %57, label %147, label %58
58: ; preds = %55, %134
%59 = phi i8* [ %144, %134 ], [ %41, %55 ]
%60 = phi i32 [ %137, %134 ], [ %37, %55 ]
%61 = phi i8** [ %136, %134 ], [ %38, %55 ]
%62 = load i8, i8* %59
switch i8 %62, label %71 [
i8 34, label %63
i8 39, label %67
]
63: ; preds = %58
%64 = getelementptr inbounds i8, i8* %59, i64 1
%65 = call i64 @strcspn(i8* %64, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.4, i64 0, i64 0))
%66 = getelementptr inbounds i8, i8* %64, i64 %65
br label %74
67: ; preds = %58
%68 = getelementptr inbounds i8, i8* %59, i64 1
%69 = call i64 @strcspn(i8* %68, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%70 = getelementptr inbounds i8, i8* %68, i64 %69
br label %74
71: ; preds = %58
%72 = call i64 @strcspn(i8* %59, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%73 = getelementptr inbounds i8, i8* %59, i64 %72
br label %74
74: ; preds = %67, %71, %63
%75 = phi i8* [ %70, %67 ], [ %73, %71 ], [ %66, %63 ]
%76 = phi i8* [ %68, %67 ], [ %59, %71 ], [ %64, %63 ]
store i8 0, i8* %75
%77 = load i8, i8* %76
%78 = icmp eq i8 %77, 36
br i1 %78, label %79, label %110
79: ; preds = %74
%80 = getelementptr inbounds i8, i8* %76, i64 1
%81 = load i8, i8* %80
%82 = call i64 @isdigit(i8 signext %81)
%83 = icmp eq i64 %82, 0
br i1 %83, label %97, label %84
84: ; preds = %79
%85 = call i32 @atoi(i8* %80)
%86 = add nsw i32 %85, 1
%87 = icmp slt i32 %86, %0
br i1 %87, label %105, label %88
88: ; preds = %84
%89 = load i32, i32* @stderr
%90 = load i8*, i8** %1
%91 = load i8*, i8** %4
%92 = icmp eq i32 %86, 2
%93 = select i1 %92, 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)
%94 = add nsw i32 %0, -2
%95 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.6, i64 0, i64 0), i8* %90, i8* %91, i32 %85, i8* %93, i32 %94)
%96 = load i32, i32* @EXIT_FAILURE
br label %160
97: ; preds = %79
%98 = call i8* @getenv(i8* %80)
%99 = icmp eq i8* %98, null
br i1 %99, label %100, label %110
100: ; preds = %97
%101 = load i32, i32* @stderr
%102 = load i8*, i8** %1
%103 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %101, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.9, i64 0, i64 0), i8* %102, i8* %80)
%104 = load i32, i32* @EXIT_FAILURE
br label %160
105: ; preds = %84
%106 = sext i32 %86 to i64
%107 = getelementptr inbounds i8*, i8** %1, i64 %106
%108 = load i8*, i8** %107
%109 = icmp eq i8* %108, null
br i1 %109, label %134, label %110
110: ; preds = %74, %97, %105
%111 = phi i8* [ %80, %105 ], [ %76, %74 ], [ %80, %97 ]
%112 = phi i8* [ %108, %105 ], [ %76, %74 ], [ %98, %97 ]
%113 = add nsw i32 %60, 1
%114 = shl i32 %113, 3
%115 = call i8** @realloc(i8** %61, i32 %114)
%116 = icmp eq i8** %115, null
br i1 %116, label %117, label %124
117: ; preds = %110
%118 = load i32, i32* @stderr
%119 = load i8*, i8** %1
%120 = load i8*, i8** %4
%121 = call i32 (i32, i8*, i8*, i8*, ...) @fprintf(i32 %118, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.10, i64 0, i64 0), i8* %119, i8* %120)
%122 = load i32, i32* @EXIT_FAILURE
%123 = call i32 @exit(i32 %122)
unreachable
124: ; preds = %110
%125 = call i32 @strlen(i8* %112)
%126 = add nsw i32 %125, 1
%127 = call i64 @calloc(i32 %126, i32 1)
%128 = inttoptr i64 %127 to i8*
%129 = sext i32 %60 to i64
%130 = getelementptr inbounds i8*, i8** %115, i64 %129
store i8* %128, i8** %130
%131 = call i32 @strlen(i8* %112)
%132 = add nsw i32 %131, 1
%133 = call i32 @strncpy(i8* %128, i8* %112, i32 %132)
br label %134
134: ; preds = %124, %105
%135 = phi i8* [ %111, %124 ], [ %80, %105 ]
%136 = phi i8** [ %115, %124 ], [ %61, %105 ]
%137 = phi i32 [ %113, %124 ], [ %60, %105 ]
%138 = call i32 @strlen(i8* %135)
%139 = add nsw i32 %138, 1
%140 = sext i32 %139 to i64
%141 = getelementptr inbounds i8, i8* %135, i64 %140
%142 = call i32 @strspn(i8* %141, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%143 = sext i32 %142 to i64
%144 = getelementptr inbounds i8, i8* %141, i64 %143
%145 = call i32 @strlen(i8* %144)
%146 = icmp eq i32 %145, 0
br i1 %146, label %147, label %58
147: ; preds = %134, %55, %36, %36
%148 = phi i8** [ %38, %36 ], [ %38, %36 ], [ %38, %55 ], [ %136, %134 ]
%149 = phi i32 [ %37, %36 ], [ %37, %36 ], [ %37, %55 ], [ %137, %134 ]
%150 = call i32* @fgets(i8* %6, i32 4096, i32* %33)
%151 = icmp eq i32* %150, null
br i1 %151, label %152, label %36
152: ; preds = %147, %32
%153 = phi i8** [ %8, %32 ], [ %148, %147 ]
%154 = phi i32 [ 1, %32 ], [ %149, %147 ]
%155 = call i32 @fclose(i32* %33)
%156 = shl i32 %154, 3
%157 = add i32 %156, 8
%158 = call i8** @realloc(i8** %153, i32 %157)
%159 = call i32 @args_main(i32 %154, i8** %158)
br label %160
160: ; preds = %100, %88, %152, %26
%161 = phi i32 [ %31, %26 ], [ %159, %152 ], [ %104, %100 ], [ %96, %88 ]
ret i32 %161
}