#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 dirent {
  char *d_name;
};
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int BUFSIZ;
int /*<<< orphan*/ STDIN_FILENO;
int /*<<< orphan*/ STDOUT_FILENO;
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
int /*<<< orphan*/ dup2(int, int /*<<< orphan*/);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, ...);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
scalar_t__ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
int /*<<< orphan*/ *opendir(char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
struct dirent *readdir(int /*<<< orphan*/ *);
int /*<<< orphan*/ setbuf(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ stdin;
int /*<<< orphan*/ stdout;
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
char *strtok(char *, char *);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  if (argc != 2) {
    printf("Usage: %s <outdir>\n", argv[0]);
    exit(2);
  }
  setbuf(stdout, NULL);
  char *temp_d = "./temp/";
  int readSortPipe[2];
  int sortParsePipe[2];
  if (pipe(readSortPipe) == -1) {
    fprintf(stderr, "Couldn't pipe\n");
  }
  if (pipe(sortParsePipe) == -1) {
    fprintf(stderr, "Couldn't pipe\n");
  }
  DIR *dp;
  struct dirent *ep;
  dp = opendir(temp_d);
  if (dp != NULL) {
    while ((ep = readdir(dp)) != NULL) {
      if (strcmp(ep->d_name, ".") == 0 || strcmp(ep->d_name, "..") == 0) {
        continue;
      }
      char temp[80];
      strcpy(temp, ep->d_name);
      char dired[80];
      strcpy(dired, "./temp/");
      strcat(dired, ep->d_name);
      printf("+-------------------------------\n");
      printf("|Dired: %s\n", dired);
      printf("+-------------------------------\n");
      printf("| printing file contents to pipe\n");
      if (fork() == 0) {
        dup2(readSortPipe[1], STDOUT_FILENO);
        close(readSortPipe[1]);
        close(readSortPipe[0]);
        close(sortParsePipe[1]);
        close(sortParsePipe[0]);
        execlp("cat", "cat", dired, NULL);
        fprintf(stderr, "**ERROR** cat not executed **ERROR**\n");
        exit(3);
      }
      wait(NULL);
    }
    printf("+-------------------------------\n");
    (void)closedir(dp);
  } else
    fprintf(stderr, "Couldn't open the directory");
  if (fork() == 0) {
    dup2(readSortPipe[0], STDIN_FILENO);
    dup2(sortParsePipe[1], STDOUT_FILENO);
    close(readSortPipe[1]);
    close(readSortPipe[1]);
    close(sortParsePipe[1]);
    close(sortParsePipe[0]);
    execlp("sort", "sort", "-t:", "-k1,1d", "-k2,2V", NULL);
    fprintf(stderr, "**ERROR** sort not executed **ERROR**\n");
    exit(3);
  }
  close(readSortPipe[0]);
  close(readSortPipe[1]);
  wait(NULL);
  if (fork() == 0) {
    close(sortParsePipe[1]);
    dup2(sortParsePipe[0], STDIN_FILENO);
    char buf[BUFSIZ];
    char currentWord[80];
    int firstTime = 1;
    char index_d[80];
    strcpy(index_d, argv[1]);
    strcat(index_d, "index.txt");
    FILE *indexFile = fopen(index_d, "w");
    fprintf(indexFile, "INDEX\n");
    while (fgets(buf, sizeof(buf), stdin) != NULL) {
      if (buf[strlen(buf) - 1] == '\n') {
        char str[80];
        strcpy(str, buf);
        char *word;
        word = strtok(str, ":");
        strcpy(str, buf);
        char *number;
        number = strtok(str, ":");
        number = strtok(NULL, "#");
        if (strcmp(word, currentWord) == 0) {
          if (firstTime) {
            fprintf(indexFile, "%s: %s", word, number);
            firstTime = 0;
          }
          fprintf(indexFile, ", %s", number);
        } else {
          fprintf(indexFile, "\n\n%s: %s", word, number);
          strcpy(currentWord, word);
          firstTime = 0;
        }
      }
    }
    fprintf(indexFile, "\n");
    fclose(indexFile);
    close(sortParsePipe[0]);
    exit(0);
  }
  wait(NULL);
  close(sortParsePipe[1]);
  close(sortParsePipe[0]);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x220,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1292 <main+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xd7f(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x2,%edi
call   1140 <exit@plt>
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
xor    %eax,%eax
mov    %eax,%esi
call   1070 <setbuf@plt>
lea    0xd69(%rip),%rax
mov    %rax,-0x18(%rbp)
lea    -0x20(%rbp),%rdi
call   10b0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    12d9 <main+0x89>
mov    0x2d08(%rip),%rax
mov    (%rax),%rdi
lea    0xd4a(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
lea    -0x28(%rbp),%rdi
call   10b0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1303 <main+0xb3>
mov    0x2cde(%rip),%rax
mov    (%rax),%rdi
lea    0xd20(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x18(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1498 <main+0x248>
jmp    1320 <main+0xd0>
mov    -0x30(%rbp),%rdi
call   1100 <readdir@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
je     147c <main+0x22c>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
lea    0xce7(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
je     1371 <main+0x121>
mov    -0x38(%rbp),%rax
mov    (%rax),%rdi
lea    0xcc9(%rip),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1376 <main+0x126>
jmp    1320 <main+0xd0>
lea    -0x90(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
call   1030 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
lea    0xc7d(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xe0(%rbp),%rdi
mov    -0x38(%rbp),%rax
mov    (%rax),%rsi
call   1130 <strcat@plt>
lea    0xc78(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xc85(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
lea    0xc75(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    $0x0,%al
call   1170 <fork@plt>
cmp    $0x0,%rax
jne    146e <main+0x21e>
mov    -0x1c(%rbp),%edi
mov    0x2be7(%rip),%rax
mov    (%rax),%esi
call   1080 <dup2@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x20(%rbp),%edi
call   10a0 <close@plt>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
mov    -0x28(%rbp),%edi
call   10a0 <close@plt>
lea    -0xe0(%rbp),%rdx
lea    0xc40(%rip),%rsi
xor    %eax,%eax
mov    %eax,%ecx
mov    %rsi,%rdi
mov    $0x0,%al
call   1150 <execlp@plt>
mov    0x2b7d(%rip),%rax
mov    (%rax),%rdi
lea    0xc25(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x3,%edi
call   1140 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1160 <wait@plt>
jmp    1320 <main+0xd0>
lea    0xbab(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10c0 <closedir@plt>
jmp    14b0 <main+0x260>
mov    0x2b31(%rip),%rax
mov    (%rax),%rdi
lea    0xbff(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x0,%al
call   1170 <fork@plt>
cmp    $0x0,%rax
jne    1550 <main+0x300>
mov    -0x20(%rbp),%edi
mov    0x2aed(%rip),%rax
mov    (%rax),%esi
call   1080 <dup2@plt>
mov    -0x24(%rbp),%edi
mov    0x2b14(%rip),%rax
mov    (%rax),%esi
call   1080 <dup2@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
mov    -0x28(%rbp),%edi
call   10a0 <close@plt>
lea    0xbba(%rip),%rsi
lea    0xbb8(%rip),%rdx
lea    0xbb5(%rip),%rcx
lea    0xbb5(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
mov    %rsi,%rdi
mov    $0x0,%al
call   1150 <execlp@plt>
mov    0x2a9b(%rip),%rax
mov    (%rax),%rdi
lea    0xb9c(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    $0x3,%edi
call   1140 <exit@plt>
mov    -0x20(%rbp),%edi
call   10a0 <close@plt>
mov    -0x1c(%rbp),%edi
call   10a0 <close@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1160 <wait@plt>
mov    $0x0,%al
call   1170 <fork@plt>
cmp    $0x0,%rax
jne    17e2 <main+0x592>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
mov    -0x28(%rbp),%edi
mov    0x2a2c(%rip),%rax
mov    (%rax),%esi
call   1080 <dup2@plt>
mov    0x2a2e(%rip),%rax
mov    (%rax),%eax
mov    %rax,-0x220(%rbp)
mov    %rsp,%rcx
mov    %rcx,-0xe8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x218(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xf0(%rbp)
movl   $0x1,-0x144(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xb07(%rip),%rsi
call   1130 <strcat@plt>
lea    -0x1a0(%rbp),%rdi
lea    0xafe(%rip),%rsi
call   1110 <fopen@plt>
mov    %rax,-0x1a8(%rbp)
mov    -0x1a8(%rbp),%rdi
lea    0xae6(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x218(%rbp),%rdi
mov    -0x220(%rbp),%rax
mov    %eax,%esi
mov    0x299a(%rip),%rax
mov    (%rax),%edx
call   10d0 <fgets@plt>
cmp    $0x0,%rax
je     17b2 <main+0x562>
mov    -0x218(%rbp),%rdi
call   1060 <strlen@plt>
mov    %eax,%ecx
mov    -0x218(%rbp),%rax
sub    $0x1,%ecx
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0xa,%eax
jne    17ad <main+0x55d>
mov    -0x218(%rbp),%rsi
lea    -0x200(%rbp),%rdi
call   1030 <strcpy@plt>
lea    -0x200(%rbp),%rdi
lea    0xa2b(%rip),%rsi
call   1120 <strtok@plt>
mov    -0x218(%rbp),%rsi
mov    %rax,-0x208(%rbp)
lea    -0x200(%rbp),%rdi
call   1030 <strcpy@plt>
lea    -0x200(%rbp),%rdi
lea    0x9fe(%rip),%rsi
call   1120 <strtok@plt>
mov    %rax,-0x210(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xa31(%rip),%rsi
call   1120 <strtok@plt>
mov    %rax,-0x210(%rbp)
mov    -0x208(%rbp),%rdi
lea    -0x140(%rbp),%rsi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1768 <main+0x518>
cmpl   $0x0,-0x144(%rbp)
je     1747 <main+0x4f7>
mov    -0x1a8(%rbp),%rdi
mov    -0x208(%rbp),%rdx
mov    -0x210(%rbp),%rcx
lea    0x9e8(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
movl   $0x0,-0x144(%rbp)
mov    -0x1a8(%rbp),%rdi
mov    -0x210(%rbp),%rdx
lea    0x9bb(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
jmp    17a8 <main+0x558>
mov    -0x1a8(%rbp),%rdi
mov    -0x208(%rbp),%rdx
mov    -0x210(%rbp),%rcx
lea    0x998(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
lea    -0x140(%rbp),%rdi
mov    -0x208(%rbp),%rsi
call   1030 <strcpy@plt>
movl   $0x0,-0x144(%rbp)
jmp    17ad <main+0x55d>
jmp    162f <main+0x3df>
mov    -0x1a8(%rbp),%rdi
lea    0x8e6(%rip),%rsi
mov    $0x0,%al
call   10f0 <fprintf@plt>
mov    -0x1a8(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x28(%rbp),%edi
call   10a0 <close@plt>
xor    %edi,%edi
call   1140 <exit@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1160 <wait@plt>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
mov    -0x28(%rbp),%edi
call   10a0 <close@plt>
xor    %edi,%edi
call   1140 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%r14
cmp    $0x2,%edi
jne    133f <main+0xbf>
mov    0x2d19(%rip),%rax
mov    (%rax),%edi
xor    %esi,%esi
call   1080 <setbuf@plt>
lea    -0x38(%rbp),%rdi
call   10c0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    12de <main+0x5e>
mov    0x2d0b(%rip),%rax
mov    (%rax),%rcx
lea    0xd4d(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
call   1170 <fwrite@plt>
lea    -0x30(%rbp),%rdi
call   10c0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    130c <main+0x8c>
mov    0x2cdd(%rip),%rax
mov    (%rax),%rcx
lea    0xd1f(%rip),%rdi
mov    $0xe,%esi
mov    $0x1,%edx
call   1170 <fwrite@plt>
lea    0xd01(%rip),%rdi
call   1060 <opendir@plt>
test   %rax,%rax
jne    135a <main+0xda>
mov    0x2cac(%rip),%rax
mov    (%rax),%rcx
lea    0xd36(%rip),%rdi
mov    $0x1b,%esi
mov    $0x1,%edx
call   1170 <fwrite@plt>
jmp    138a <main+0x10a>
mov    (%r14),%rsi
lea    0xcb7(%rip),%rdi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    $0x2,%edi
call   1160 <exit@plt>
mov    %rax,%rbx
mov    %r14,-0x40(%rbp)
mov    %rax,%rdi
call   1120 <readdir@plt>
test   %rax,%rax
jne    150e <main+0x28e>
lea    0xd68(%rip),%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   10d0 <closedir@plt>
mov    -0x40(%rbp),%r14
xor    %eax,%eax
call   11a0 <fork@plt>
mov    -0x38(%rbp),%edi
test   %rax,%rax
jne    142f <main+0x1af>
mov    0x2c14(%rip),%rax
mov    (%rax),%esi
call   1090 <dup2@plt>
mov    -0x2c(%rbp),%edi
mov    0x2c3b(%rip),%rax
mov    (%rax),%esi
call   1090 <dup2@plt>
mov    -0x34(%rbp),%edi
call   10b0 <close@plt>
mov    -0x34(%rbp),%edi
call   10b0 <close@plt>
mov    -0x2c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x30(%rbp),%edi
call   10b0 <close@plt>
lea    0xc9d(%rip),%rdi
lea    0xc9b(%rip),%rdx
lea    0xc98(%rip),%rcx
lea    0xc98(%rip),%r8
mov    %rdi,%rsi
xor    %r9d,%r9d
xor    %eax,%eax
call   1180 <execlp@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%rcx
lea    0xc81(%rip),%rdi
mov    $0x26,%esi
mov    $0x1,%edx
call   1170 <fwrite@plt>
mov    $0x3,%edi
call   1160 <exit@plt>
call   10b0 <close@plt>
mov    -0x34(%rbp),%edi
call   10b0 <close@plt>
xor    %edi,%edi
call   1190 <wait@plt>
xor    %eax,%eax
call   11a0 <fork@plt>
test   %rax,%rax
jne    15de <main+0x35e>
mov    -0x2c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x30(%rbp),%edi
mov    0x2b53(%rip),%rax
mov    (%rax),%esi
call   1090 <dup2@plt>
mov    0x2b55(%rip),%rax
mov    (%rax),%r13d
mov    %rsp,%r15
mov    %r13,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x8(%r14),%rsi
lea    -0xa0(%rbp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
lea    0xc1a(%rip),%rsi
mov    %r14,%rdi
call   1150 <strcat@plt>
lea    0xc15(%rip),%rsi
mov    %r14,%rdi
call   1130 <fopen@plt>
mov    %rax,%r14
lea    0xc05(%rip),%rdi
mov    $0x6,%esi
mov    $0x1,%edx
mov    %rax,%rcx
call   1170 <fwrite@plt>
mov    0x2b02(%rip),%rbx
mov    (%rbx),%edx
mov    %r15,%rdi
mov    %r13d,%esi
call   10f0 <fgets@plt>
test   %rax,%rax
jne    15fc <main+0x37c>
mov    $0xa,%edi
mov    %r14,%rsi
call   10e0 <fputc@plt>
mov    %r14,%rdi
call   1050 <fclose@plt>
jmp    15ed <main+0x36d>
mov    %rax,%r12
lea    0xb14(%rip),%r15
lea    -0xa0(%rbp),%r13
lea    0xbbb(%rip),%r14
jmp    1544 <main+0x2c4>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1120 <readdir@plt>
mov    %rax,%r12
test   %rax,%rax
je     1372 <main+0xf2>
mov    (%r12),%rdi
mov    %r15,%rsi
call   1100 <strcmp@plt>
test   %rax,%rax
je     1530 <main+0x2b0>
mov    (%r12),%rdi
lea    0xacb(%rip),%rsi
call   1100 <strcmp@plt>
test   %rax,%rax
je     1530 <main+0x2b0>
mov    (%r12),%rsi
lea    -0xf0(%rbp),%rdi
call   1030 <strcpy@plt>
mov    %r13,%rdi
lea    0xa90(%rip),%rsi
call   1030 <strcpy@plt>
mov    (%r12),%rsi
mov    %r13,%rdi
call   1150 <strcat@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xa8a(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10a0 <printf@plt>
mov    %r14,%rdi
call   1040 <puts@plt>
lea    0xb45(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   11a0 <fork@plt>
test   %rax,%rax
je     1736 <main+0x4b6>
xor    %edi,%edi
call   1190 <wait@plt>
jmp    1530 <main+0x2b0>
xor    %edi,%edi
call   1190 <wait@plt>
mov    -0x2c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x30(%rbp),%edi
call   10b0 <close@plt>
xor    %edi,%edi
call   1160 <exit@plt>
movl   $0x1,-0x40(%rbp)
lea    -0xf0(%rbp),%r12
mov    %r13,-0x50(%rbp)
mov    %r14,-0x48(%rbp)
jmp    1671 <main+0x3f1>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x48(%rbp),%rbx
mov    %rbx,%rdi
lea    0xaaa(%rip),%rsi
mov    %r14,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1110 <fprintf@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %rbx,%r14
call   1030 <strcpy@plt>
mov    -0x50(%rbp),%r13
mov    0x298c(%rip),%rbx
movl   $0x0,-0x40(%rbp)
mov    (%rbx),%edx
mov    %r15,%rdi
mov    %r13d,%esi
call   10f0 <fgets@plt>
test   %rax,%rax
je     14f4 <main+0x274>
mov    %r15,%rdi
call   1070 <strlen@plt>
cltq
cmpb   $0xa,-0x1(%rax,%r15,1)
jne    165b <main+0x3db>
lea    -0x140(%rbp),%rbx
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
lea    0x9e8(%rip),%r13
mov    %r13,%rsi
call   1140 <strtok@plt>
mov    %rax,%r14
mov    %rbx,%rdi
mov    %r15,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1140 <strtok@plt>
xor    %edi,%edi
lea    0xa08(%rip),%rsi
call   1140 <strtok@plt>
mov    %rax,%r13
mov    %r14,%rdi
mov    %r12,%rsi
call   1100 <strcmp@plt>
test   %rax,%rax
jne    1620 <main+0x3a0>
mov    %r12,%rbx
cmpl   $0x0,-0x40(%rbp)
mov    -0x48(%rbp),%r12
je     1709 <main+0x489>
mov    %r12,%rdi
lea    0x9de(%rip),%rsi
mov    %r14,%rdx
mov    %r13,%rcx
xor    %eax,%eax
call   1110 <fprintf@plt>
mov    %r12,%rdi
lea    0x9c0(%rip),%rsi
mov    %r13,%rdx
xor    %eax,%eax
call   1110 <fprintf@plt>
mov    -0x50(%rbp),%r13
mov    %r12,%r14
mov    0x28b5(%rip),%rax
mov    %rbx,%r12
mov    %rax,%rbx
jmp    1654 <main+0x3d4>
mov    -0x34(%rbp),%edi
mov    0x28b0(%rip),%rax
mov    (%rax),%esi
call   1090 <dup2@plt>
mov    -0x34(%rbp),%edi
call   10b0 <close@plt>
mov    -0x38(%rbp),%edi
call   10b0 <close@plt>
mov    -0x2c(%rbp),%edi
call   10b0 <close@plt>
mov    -0x30(%rbp),%edi
call   10b0 <close@plt>
lea    0x8cc(%rip),%rdi
lea    -0xa0(%rbp),%rdx
mov    %rdi,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1180 <execlp@plt>
mov    0x2848(%rip),%rax
mov    (%rax),%rcx
lea    0x8ac(%rip),%rdi
mov    $0x25,%esi
jmp    141b <main+0x19b>

LLVM IR (-O0):
%struct.dirent = type { i8* }
@.str = [20 x i8] c"Usage: %s <outdir>\0A\00"
@stdout = global i32 0
@.str.1 = [8 x i8] c"./temp/\00"
@stderr = global i32* null
@.str.2 = [15 x i8] c"Couldn't pipe\0A\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"..\00"
@.str.5 = [34 x i8] c"+-------------------------------\0A\00"
@.str.6 = [12 x i8] c"|Dired: %s\0A\00"
@.str.7 = [34 x i8] c"| printing file contents to pipe\0A\00"
@STDOUT_FILENO = global i32 0
@.str.8 = [4 x i8] c"cat\00"
@.str.9 = [38 x i8] c"**ERROR** cat not executed **ERROR**\0A\00"
@.str.10 = [28 x i8] c"Couldn't open the directory\00"
@STDIN_FILENO = global i32 0
@.str.11 = [5 x i8] c"sort\00"
@.str.12 = [4 x i8] c"-t:\00"
@.str.13 = [7 x i8] c"-k1,1d\00"
@.str.14 = [7 x i8] c"-k2,2V\00"
@.str.15 = [39 x i8] c"**ERROR** sort not executed **ERROR**\0A\00"
@BUFSIZ = global i32 0
@.str.16 = [10 x i8] c"index.txt\00"
@.str.17 = [2 x i8] c"w\00"
@.str.18 = [7 x i8] c"INDEX\0A\00"
@stdin = global i32 0
@.str.19 = [2 x i8] c":\00"
@.str.20 = [2 x i8] c"#\00"
@.str.21 = [7 x i8] c"%s: %s\00"
@.str.22 = [5 x i8] c", %s\00"
@.str.23 = [9 x i8] c"\0A\0A%s: %s\00"
@.str.24 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca [2 x i32]
%8 = alloca [2 x i32]
%9 = alloca i32*
%10 = alloca %struct.dirent*
%11 = alloca [80 x i8]
%12 = alloca [80 x i8]
%13 = alloca i8*
%14 = alloca i64
%15 = alloca [80 x i8]
%16 = alloca i32
%17 = alloca [80 x i8]
%18 = alloca i32*
%19 = alloca [80 x i8]
%20 = alloca i8*
%21 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%22 = load i32, i32* %4
%23 = icmp ne i32 %22, 2
br i1 %23, label %24, label %30
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 2)
unreachable
30: ; preds = %2
%31 = load i32, i32* @stdout
%32 = call i32 @setbuf(i32 %31, i32* null)
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %6
%33 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%34 = call i32 @pipe(i32* %33)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %39
36: ; preds = %30
%37 = load i32*, i32** @stderr
%38 = call i32 (i32*, i8*, ...) @fprintf(i32* %37, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %39
39: ; preds = %36, %30
%40 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%41 = call i32 @pipe(i32* %40)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %46
43: ; preds = %39
%44 = load i32*, i32** @stderr
%45 = call i32 (i32*, i8*, ...) @fprintf(i32* %44, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
br label %46
46: ; preds = %43, %39
%47 = load i8*, i8** %6
%48 = call i32* @opendir(i8* %47)
store i32* %48, i32** %9
%49 = load i32*, i32** %9
%50 = icmp ne i32* %49, null
br i1 %50, label %51, label %117
51: ; preds = %46
br label %52
52: ; preds = %111, %68, %51
%53 = load i32*, i32** %9
%54 = call %struct.dirent* @readdir(i32* %53)
store %struct.dirent* %54, %struct.dirent** %10
%55 = icmp ne %struct.dirent* %54, null
br i1 %55, label %56, label %113
56: ; preds = %52
%57 = load %struct.dirent*, %struct.dirent** %10
%58 = getelementptr inbounds %struct.dirent, %struct.dirent* %57, i32 0, i32 0
%59 = load i8*, i8** %58
%60 = call i64 @strcmp(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %68, label %62
62: ; preds = %56
%63 = load %struct.dirent*, %struct.dirent** %10
%64 = getelementptr inbounds %struct.dirent, %struct.dirent* %63, i32 0, i32 0
%65 = load i8*, i8** %64
%66 = call i64 @strcmp(i8* %65, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%67 = icmp eq i64 %66, 0
br i1 %67, label %68, label %69
68: ; preds = %62, %56
br label %52
69: ; preds = %62
%70 = getelementptr inbounds [80 x i8], [80 x i8]* %11, i64 0, i64 0
%71 = load %struct.dirent*, %struct.dirent** %10
%72 = getelementptr inbounds %struct.dirent, %struct.dirent* %71, i32 0, i32 0
%73 = load i8*, i8** %72
%74 = call i32 @strcpy(i8* %70, i8* %73)
%75 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%76 = call i32 @strcpy(i8* %75, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%77 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%78 = load %struct.dirent*, %struct.dirent** %10
%79 = getelementptr inbounds %struct.dirent, %struct.dirent* %78, i32 0, i32 0
%80 = load i8*, i8** %79
%81 = call i32 @strcat(i8* %77, i8* %80)
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%83 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %83)
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%87 = call i64 (...) @fork()
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %111
89: ; preds = %69
%90 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%91 = load i32, i32* %90
%92 = load i32, i32* @STDOUT_FILENO
%93 = call i32 @dup2(i32 %91, i32 %92)
%94 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%95 = load i32, i32* %94
%96 = call i32 @close(i32 %95)
%97 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%98 = load i32, i32* %97
%99 = call i32 @close(i32 %98)
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%101 = load i32, i32* %100
%102 = call i32 @close(i32 %101)
%103 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%104 = load i32, i32* %103
%105 = call i32 @close(i32 %104)
%106 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%107 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %106, i8* null)
%108 = load i32*, i32** @stderr
%109 = call i32 (i32*, i8*, ...) @fprintf(i32* %108, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0))
%110 = call i32 @exit(i32 3)
unreachable
111: ; preds = %69
%112 = call i32 @wait(i32* null)
br label %52
113: ; preds = %52
%114 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.5, i64 0, i64 0))
%115 = load i32*, i32** %9
%116 = call i32 @closedir(i32* %115)
br label %120
117: ; preds = %46
%118 = load i32*, i32** @stderr
%119 = call i32 (i32*, i8*, ...) @fprintf(i32* %118, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0))
br label %120
120: ; preds = %117, %113
%121 = call i64 (...) @fork()
%122 = icmp eq i64 %121, 0
br i1 %122, label %123, label %148
123: ; preds = %120
%124 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%125 = load i32, i32* %124
%126 = load i32, i32* @STDIN_FILENO
%127 = call i32 @dup2(i32 %125, i32 %126)
%128 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%129 = load i32, i32* %128
%130 = load i32, i32* @STDOUT_FILENO
%131 = call i32 @dup2(i32 %129, i32 %130)
%132 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%133 = load i32, i32* %132
%134 = call i32 @close(i32 %133)
%135 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%136 = load i32, i32* %135
%137 = call i32 @close(i32 %136)
%138 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%139 = load i32, i32* %138
%140 = call i32 @close(i32 %139)
%141 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%142 = load i32, i32* %141
%143 = call i32 @close(i32 %142)
%144 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* null)
%145 = load i32*, i32** @stderr
%146 = call i32 (i32*, i8*, ...) @fprintf(i32* %145, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
%147 = call i32 @exit(i32 3)
unreachable
148: ; preds = %120
%149 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%150 = load i32, i32* %149
%151 = call i32 @close(i32 %150)
%152 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%153 = load i32, i32* %152
%154 = call i32 @close(i32 %153)
%155 = call i32 @wait(i32* null)
%156 = call i64 (...) @fork()
%157 = icmp eq i64 %156, 0
br i1 %157, label %158, label %239
158: ; preds = %148
%159 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%160 = load i32, i32* %159
%161 = call i32 @close(i32 %160)
%162 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%163 = load i32, i32* %162
%164 = load i32, i32* @STDIN_FILENO
%165 = call i32 @dup2(i32 %163, i32 %164)
%166 = load i32, i32* @BUFSIZ
%167 = zext i32 %166 to i64
%168 = call i8* @llvm.stacksave()
store i8* %168, i8** %13
%169 = alloca i8, i64 %167
store i64 %167, i64* %14
store i32 1, i32* %16
%170 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%171 = load i8**, i8*** %5
%172 = getelementptr inbounds i8*, i8** %171, i64 1
%173 = load i8*, i8** %172
%174 = call i32 @strcpy(i8* %170, i8* %173)
%175 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%176 = call i32 @strcat(i8* %175, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
%177 = getelementptr inbounds [80 x i8], [80 x i8]* %17, i64 0, i64 0
%178 = call i32* @fopen(i8* %177, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
store i32* %178, i32** %18
%179 = load i32*, i32** %18
%180 = call i32 (i32*, i8*, ...) @fprintf(i32* %179, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0))
br label %181
181: ; preds = %229, %158
%182 = trunc i64 %167 to i32
%183 = load i32, i32* @stdin
%184 = call i32* @fgets(i8* %169, i32 %182, i32 %183)
%185 = icmp ne i32* %184, null
br i1 %185, label %186, label %230
186: ; preds = %181
%187 = call i32 @strlen(i8* %169)
%188 = sub nsw i32 %187, 1
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds i8, i8* %169, i64 %189
%191 = load i8, i8* %190
%192 = sext i8 %191 to i32
%193 = icmp eq i32 %192, 10
br i1 %193, label %194, label %229
194: ; preds = %186
%195 = getelementptr inbounds [80 x i8], [80 x i8]* %19, i64 0, i64 0
%196 = call i32 @strcpy(i8* %195, i8* %169)
%197 = getelementptr inbounds [80 x i8], [80 x i8]* %19, i64 0, i64 0
%198 = call i8* @strtok(i8* %197, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i8* %198, i8** %20
%199 = getelementptr inbounds [80 x i8], [80 x i8]* %19, i64 0, i64 0
%200 = call i32 @strcpy(i8* %199, i8* %169)
%201 = getelementptr inbounds [80 x i8], [80 x i8]* %19, i64 0, i64 0
%202 = call i8* @strtok(i8* %201, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
store i8* %202, i8** %21
%203 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
store i8* %203, i8** %21
%204 = load i8*, i8** %20
%205 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%206 = call i64 @strcmp(i8* %204, i8* %205)
%207 = icmp eq i64 %206, 0
br i1 %207, label %208, label %220
208: ; preds = %194
%209 = load i32, i32* %16
%210 = icmp ne i32 %209, 0
br i1 %210, label %211, label %216
211: ; preds = %208
%212 = load i32*, i32** %18
%213 = load i8*, i8** %20
%214 = load i8*, i8** %21
%215 = call i32 (i32*, i8*, ...) @fprintf(i32* %212, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i8* %213, i8* %214)
store i32 0, i32* %16
br label %216
216: ; preds = %211, %208
%217 = load i32*, i32** %18
%218 = load i8*, i8** %21
%219 = call i32 (i32*, i8*, ...) @fprintf(i32* %217, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0), i8* %218)
br label %228
220: ; preds = %194
%221 = load i32*, i32** %18
%222 = load i8*, i8** %20
%223 = load i8*, i8** %21
%224 = call i32 (i32*, i8*, ...) @fprintf(i32* %221, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i64 0, i64 0), i8* %222, i8* %223)
%225 = getelementptr inbounds [80 x i8], [80 x i8]* %15, i64 0, i64 0
%226 = load i8*, i8** %20
%227 = call i32 @strcpy(i8* %225, i8* %226)
store i32 0, i32* %16
br label %228
228: ; preds = %220, %216
br label %229
229: ; preds = %228, %186
br label %181
230: ; preds = %181
%231 = load i32*, i32** %18
%232 = call i32 (i32*, i8*, ...) @fprintf(i32* %231, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.24, i64 0, i64 0))
%233 = load i32*, i32** %18
%234 = call i32 @fclose(i32* %233)
%235 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%236 = load i32, i32* %235
%237 = call i32 @close(i32 %236)
%238 = call i32 @exit(i32 0)
unreachable
239: ; preds = %148
%240 = call i32 @wait(i32* null)
%241 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 1
%242 = load i32, i32* %241
%243 = call i32 @close(i32 %242)
%244 = getelementptr inbounds [2 x i32], [2 x i32]* %8, i64 0, i64 0
%245 = load i32, i32* %244
%246 = call i32 @close(i32 %245)
%247 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.dirent = type { i8* }
@.str = [20 x i8] c"Usage: %s <outdir>\0A\00"
@stdout = global i32 0
@.str.1 = [8 x i8] c"./temp/\00"
@stderr = global i32* null
@.str.2 = [15 x i8] c"Couldn't pipe\0A\00"
@.str.3 = [2 x i8] c".\00"
@.str.4 = [3 x i8] c"..\00"
@.str.6 = [12 x i8] c"|Dired: %s\0A\00"
@STDOUT_FILENO = global i32 0
@.str.8 = [4 x i8] c"cat\00"
@.str.9 = [38 x i8] c"**ERROR** cat not executed **ERROR**\0A\00"
@.str.10 = [28 x i8] c"Couldn't open the directory\00"
@STDIN_FILENO = global i32 0
@.str.11 = [5 x i8] c"sort\00"
@.str.12 = [4 x i8] c"-t:\00"
@.str.13 = [7 x i8] c"-k1,1d\00"
@.str.14 = [7 x i8] c"-k2,2V\00"
@.str.15 = [39 x i8] c"**ERROR** sort not executed **ERROR**\0A\00"
@BUFSIZ = global i32 0
@.str.16 = [10 x i8] c"index.txt\00"
@.str.17 = [2 x i8] c"w\00"
@.str.18 = [7 x i8] c"INDEX\0A\00"
@stdin = global i32 0
@.str.19 = [2 x i8] c":\00"
@.str.20 = [2 x i8] c"#\00"
@.str.21 = [7 x i8] c"%s: %s\00"
@.str.22 = [5 x i8] c", %s\00"
@.str.23 = [9 x i8] c"\0A\0A%s: %s\00"
@str.26 = [33 x i8] c"+-------------------------------\00"
@str.27 = [33 x i8] c"| printing file contents to pipe\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [2 x i32]
%4 = alloca [2 x i32]
%5 = alloca [80 x i8]
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca [80 x i8]
%9 = alloca [80 x i8]
%10 = icmp eq i32 %0, 2
br i1 %10, label %15, label %11
11: ; preds = %2
%12 = load i8*, i8** %1
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = tail call i32 @exit(i32 2)
unreachable
15: ; preds = %2
%16 = load i32, i32* @stdout
%17 = tail call i32 @setbuf(i32 %16, i32* null)
%18 = bitcast [2 x i32]* %3 to i8*
%19 = bitcast [2 x i32]* %4 to i8*
%20 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%21 = call i32 @pipe(i32* %20)
%22 = icmp eq i32 %21, -1
br i1 %22, label %23, label %26
23: ; preds = %15
%24 = load i32*, i32** @stderr
%25 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i64 14, i64 1, i32* %24)
br label %26
26: ; preds = %23, %15
%27 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 0
%28 = call i32 @pipe(i32* %27)
%29 = icmp eq i32 %28, -1
br i1 %29, label %30, label %33
30: ; preds = %26
%31 = load i32*, i32** @stderr
%32 = call i64 @fwrite(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i64 14, i64 1, i32* %31)
br label %33
33: ; preds = %30, %26
%34 = call i32* @opendir(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%35 = icmp eq i32* %34, null
br i1 %35, label %90, label %36
36: ; preds = %33
%37 = call %struct.dirent* @readdir(i32* %34)
%38 = icmp eq %struct.dirent* %37, null
br i1 %38, label %87, label %39
39: ; preds = %36
%40 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%41 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
br label %42
42: ; preds = %39, %52
%43 = phi %struct.dirent* [ %37, %39 ], [ %53, %52 ]
%44 = getelementptr inbounds %struct.dirent, %struct.dirent* %43, i64 0, i32 0
%45 = load i8*, i8** %44
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %52, label %48
48: ; preds = %42
%49 = load i8*, i8** %44
%50 = call i64 @strcmp(i8* %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
%51 = icmp eq i64 %50, 0
br i1 %51, label %52, label %55
52: ; preds = %42, %48, %85
%53 = call %struct.dirent* @readdir(i32* %34)
%54 = icmp eq %struct.dirent* %53, null
br i1 %54, label %87, label %42
55: ; preds = %48
%56 = load i8*, i8** %44
%57 = call i32 @strcpy(i8* %40, i8* %56)
%58 = call i32 @strcpy(i8* %41, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%59 = load i8*, i8** %44
%60 = call i32 @strcat(i8* %41, i8* %59)
%61 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.26, i64 0, i64 0))
%62 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.6, i64 0, i64 0), i8* %41)
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.26, i64 0, i64 0))
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.27, i64 0, i64 0))
%65 = call i64 (...) @fork()
%66 = icmp eq i64 %65, 0
br i1 %66, label %67, label %85
67: ; preds = %55
%68 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%69 = load i32, i32* %68
%70 = load i32, i32* @STDOUT_FILENO
%71 = call i32 @dup2(i32 %69, i32 %70)
%72 = load i32, i32* %68
%73 = call i32 @close(i32 %72)
%74 = load i32, i32* %20
%75 = call i32 @close(i32 %74)
%76 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%77 = load i32, i32* %76
%78 = call i32 @close(i32 %77)
%79 = load i32, i32* %27
%80 = call i32 @close(i32 %79)
%81 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %41, i8* null)
%82 = load i32*, i32** @stderr
%83 = call i64 @fwrite(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.9, i64 0, i64 0), i64 37, i64 1, i32* %82)
%84 = call i32 @exit(i32 3)
unreachable
85: ; preds = %55
%86 = call i32 @wait(i32* null)
br label %52
87: ; preds = %52, %36
%88 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.26, i64 0, i64 0))
%89 = call i32 @closedir(i32* %34)
br label %93
90: ; preds = %33
%91 = load i32*, i32** @stderr
%92 = call i64 @fwrite(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.10, i64 0, i64 0), i64 27, i64 1, i32* %91)
br label %93
93: ; preds = %90, %87
%94 = call i64 (...) @fork()
%95 = icmp eq i64 %94, 0
%96 = load i32, i32* %20
br i1 %95, label %97, label %117
97: ; preds = %93
%98 = load i32, i32* @STDIN_FILENO
%99 = call i32 @dup2(i32 %96, i32 %98)
%100 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%101 = load i32, i32* %100
%102 = load i32, i32* @STDOUT_FILENO
%103 = call i32 @dup2(i32 %101, i32 %102)
%104 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%105 = load i32, i32* %104
%106 = call i32 @close(i32 %105)
%107 = load i32, i32* %104
%108 = call i32 @close(i32 %107)
%109 = load i32, i32* %100
%110 = call i32 @close(i32 %109)
%111 = load i32, i32* %27
%112 = call i32 @close(i32 %111)
%113 = call i32 (i8*, i8*, i8*, i8*, ...) @execlp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.11, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i8* null)
%114 = load i32*, i32** @stderr
%115 = call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0), i64 38, i64 1, i32* %114)
%116 = call i32 @exit(i32 3)
unreachable
117: ; preds = %93
%118 = call i32 @close(i32 %96)
%119 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%120 = load i32, i32* %119
%121 = call i32 @close(i32 %120)
%122 = call i32 @wait(i32* null)
%123 = call i64 (...) @fork()
%124 = icmp eq i64 %123, 0
br i1 %124, label %125, label %185
125: ; preds = %117
%126 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%127 = load i32, i32* %126
%128 = call i32 @close(i32 %127)
%129 = load i32, i32* %27
%130 = load i32, i32* @STDIN_FILENO
%131 = call i32 @dup2(i32 %129, i32 %130)
%132 = load i32, i32* @BUFSIZ
%133 = zext i32 %132 to i64
%134 = alloca i8, i64 %133
%135 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%136 = getelementptr inbounds [80 x i8], [80 x i8]* %8, i64 0, i64 0
%137 = getelementptr inbounds i8*, i8** %1, i64 1
%138 = load i8*, i8** %137
%139 = call i32 @strcpy(i8* %136, i8* %138)
%140 = call i32 @strcat(i8* %136, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.16, i64 0, i64 0))
%141 = call i32* @fopen(i8* %136, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%142 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i64 6, i64 1, i32* %141)
%143 = load i32, i32* @stdin
%144 = call i32* @fgets(i8* %134, i32 %132, i32 %143)
%145 = icmp eq i32* %144, null
br i1 %145, label %179, label %146
146: ; preds = %125
%147 = getelementptr inbounds [80 x i8], [80 x i8]* %9, i64 0, i64 0
br label %148
148: ; preds = %146, %174
%149 = phi i32 [ 1, %146 ], [ %175, %174 ]
%150 = call i32 @strlen(i8* %134)
%151 = add nsw i32 %150, -1
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds i8, i8* %134, i64 %152
%154 = load i8, i8* %153
%155 = icmp eq i8 %154, 10
br i1 %155, label %156, label %174
156: ; preds = %148
%157 = call i32 @strcpy(i8* %147, i8* %134)
%158 = call i8* @strtok(i8* %147, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
%159 = call i32 @strcpy(i8* %147, i8* %134)
%160 = call i8* @strtok(i8* %147, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.19, i64 0, i64 0))
%161 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
%162 = call i64 @strcmp(i8* %158, i8* %135)
%163 = icmp eq i64 %162, 0
br i1 %163, label %164, label %170
164: ; preds = %156
%165 = icmp eq i32 %149, 0
br i1 %165, label %168, label %166
166: ; preds = %164
%167 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.21, i64 0, i64 0), i8* %158, i8* %161)
br label %168
168: ; preds = %166, %164
%169 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.22, i64 0, i64 0), i8* %161)
br label %173
170: ; preds = %156
%171 = call i32 (i32*, i8*, ...) @fprintf(i32* %141, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i64 0, i64 0), i8* %158, i8* %161)
%172 = call i32 @strcpy(i8* %135, i8* %158)
br label %173
173: ; preds = %170, %168
br label %174
174: ; preds = %173, %148
%175 = phi i32 [ 0, %173 ], [ %149, %148 ]
%176 = load i32, i32* @stdin
%177 = call i32* @fgets(i8* %134, i32 %132, i32 %176)
%178 = icmp eq i32* %177, null
br i1 %178, label %179, label %148
179: ; preds = %174, %125
%180 = call i32 @fputc(i32 10, i32* %141)
%181 = call i32 @fclose(i32* %141)
%182 = load i32, i32* %27
%183 = call i32 @close(i32 %182)
%184 = call i32 @exit(i32 0)
unreachable
185: ; preds = %117
%186 = call i32 @wait(i32* null)
%187 = getelementptr inbounds [2 x i32], [2 x i32]* %4, i64 0, i64 1
%188 = load i32, i32* %187
%189 = call i32 @close(i32 %188)
%190 = load i32, i32* %27
%191 = call i32 @close(i32 %190)
%192 = call i32 @exit(i32 0)
unreachable
}