#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 pid_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_UNIX;
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ FNDELAY;
int /*<<< orphan*/ F_SETFL;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ dup2(int, int);
int /*<<< orphan*/ execl(char *, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fcntl(int, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
scalar_t__ fgets(char **, int, int /*<<< orphan*/ *);
int fork();
int /*<<< orphan*/ fwrite(char *, int /*<<< orphan*/, int,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sleep(int);
scalar_t__ socketpair(int /*<<< orphan*/, int /*<<< orphan*/,
                      int /*<<< orphan*/, int *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int /*<<< orphan*/ strlen(char *);
scalar_t__ strncmp(char *, char *, int);
int /*<<< orphan*/ wait(int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int pfd[2];
  pid_t cpid;
  int i = 0;
  FILE *fdr;
  FILE *fdw;
  char buf[8][1280];
  char snip[8][1280];
  char title[8][1280];
  int blen[8];
  int slen[8];
  int tlen[8];
  if (socketpair(AF_UNIX, SOCK_STREAM, 0, pfd) != 0) {
    printf("AGGGH:\n");
    exit(-1);
  }
  cpid = fork();
  if (cpid == -1) {
    perror("fork");
    exit(EXIT_FAILURE);
  }
  if (cpid == 0) {
    dup2(pfd[1], 1);
    dup2(pfd[0], 0);
    fcntl(1, F_SETFL, FNDELAY);
    execl("/home/d/bin/inout", "inout", NULL);
    _exit(EXIT_SUCCESS);
  } else {
    dup2(pfd[1], 0);
    dup2(pfd[0], 1);
    fcntl(1, F_SETFL, FNDELAY);
    sleep(1);
    fdr = stdin;
    fdw = stdout;
    char *p = "this is a test\nso is this\n";
    printf("Got ere\n");
    fwrite(p, strlen(p), 1, fdw);
    fflush(fdw);
    int n;
    while ((blen[i] = fgets(&buf[i], 1280, fdr) > 0) && i < 8) {
      printf("LINE: %s", buf[i]);
      i++;
      if (strncmp("END", buf[i], 3) == 0 || strncmp("TLE", buf[i], 3) == 0 ||
          strncmp("LNK", buf[i], 3) == 0 || strncmp("SNP", buf[i], 3) == 0) {
        break;
      }
    }
    while ((blen[i] = fgets(&buf[i], 1280, fdr) > 0) && i < 8) {
      if (!(strncmp("END", buf[i], 3) == 0 || strncmp("TLE", buf[i], 3) == 0 ||
            strncmp("LNK", buf[i], 3) == 0 || strncmp("SNP", buf[i], 3) == 0)) {
        break;
      }
    }
    i = 0;
    while ((slen[i] = fgets(&title[i], 1280, fdr) > 0) && i < 10) {
      printf("TLEL: %s", title[i]);
      if (strncmp("END", title[i], 3) == 0 ||
          strncmp("TLE", title[i], 3) == 0 ||
          strncmp("LNK", title[i], 3) == 0 ||
          strncmp("SNP", title[i], 3) == 0) {
        break;
      }
      i++;
    }
    while ((blen[i] = fgets(&title[i], 1280, fdr) > 0) && i < 8) {
      if (!(strncmp("END", title[i], 3) == 0 ||
            strncmp("TLE", title[i], 3) == 0 ||
            strncmp("LNK", title[i], 3) == 0 ||
            strncmp("SNP", title[i], 3) == 0)) {
        break;
      }
    }
    i = 0;
    while ((slen[i] = fgets(&snip[i], 1280, fdr) > 0) && i < 10) {
      printf("SNIP: %s", snip[i]);
      if (strncmp("END", snip[i], 3) == 0 || strncmp("TLE", snip[i], 3) == 0 ||
          strncmp("LNK", snip[i], 3) == 0 || strncmp("SNP", snip[i], 3) == 0) {
        break;
      }
      i++;
    }
    close(pfd[0]);
    wait(NULL);
    exit(EXIT_SUCCESS);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x78b0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x20(%rbp)
mov    0x2db1(%rip),%rax
mov    (%rax),%edi
mov    0x2d88(%rip),%rax
mov    (%rax),%esi
lea    -0x18(%rbp),%rcx
xor    %edx,%edx
call   10b0 <socketpair@plt>
cmp    $0x0,%rax
je     126f <main+0x5f>
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    $0x0,%al
call   1130 <fork@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    129d <main+0x8d>
lea    0xd7e(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2d2a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
cmpl   $0x0,-0x1c(%rbp)
jne    12ff <main+0xef>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1070 <dup2@plt>
mov    -0x18(%rbp),%edi
xor    %esi,%esi
call   1070 <dup2@plt>
mov    0x2d0b(%rip),%rax
mov    (%rax),%esi
mov    0x2cea(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <fcntl@plt>
lea    0xd2c(%rip),%rdi
lea    0xd31(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1100 <execl@plt>
mov    0x2cb0(%rip),%rax
mov    (%rax),%edi
call   1040 <_exit@plt>
mov    -0x14(%rbp),%edi
xor    %esi,%esi
call   1070 <dup2@plt>
mov    -0x18(%rbp),%edi
mov    $0x1,%esi
call   1070 <dup2@plt>
mov    0x2cb3(%rip),%rax
mov    (%rax),%esi
mov    0x2c92(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1050 <fcntl@plt>
mov    $0x1,%edi
call   1110 <sleep@plt>
mov    0x2c9d(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c5f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x30(%rbp)
lea    0xcc0(%rip),%rax
mov    %rax,-0x7898(%rbp)
lea    0xccd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x7898(%rbp),%rax
mov    %rax,-0x78a8(%rbp)
mov    -0x7898(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x78a8(%rbp),%rdi
mov    %eax,%esi
mov    -0x30(%rbp),%rcx
mov    $0x1,%edx
call   10f0 <fwrite@plt>
mov    -0x30(%rbp),%rdi
call   10c0 <fflush@plt>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rdi
imul   $0x500,%rax,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    $0x500,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
setg   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%edx
movslq -0x20(%rbp),%rax
mov    %edx,-0x7850(%rbp,%rax,4)
xor    %eax,%eax
test   $0x1,%cl
mov    %al,-0x78a9(%rbp)
jne    1400 <main+0x1f0>
jmp    140d <main+0x1fd>
cmpl   $0x8,-0x20(%rbp)
setl   %al
mov    %al,-0x78a9(%rbp)
mov    -0x78a9(%rbp),%al
test   $0x1,%al
jne    1420 <main+0x210>
jmp    1516 <main+0x306>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xc07(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xbe4(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     150c <main+0x2fc>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xbb8(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     150c <main+0x2fc>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xb8c(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     150c <main+0x2fc>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xb60(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1511 <main+0x301>
jmp    1516 <main+0x306>
jmp    13ae <main+0x19e>
jmp    151b <main+0x30b>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rdi
imul   $0x500,%rax,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    $0x500,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
setg   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%edx
movslq -0x20(%rbp),%rax
mov    %edx,-0x7850(%rbp,%rax,4)
xor    %eax,%eax
test   $0x1,%cl
mov    %al,-0x78aa(%rbp)
jne    156d <main+0x35d>
jmp    157a <main+0x36a>
cmpl   $0x8,-0x20(%rbp)
setl   %al
mov    %al,-0x78aa(%rbp)
mov    -0x78aa(%rbp),%al
test   $0x1,%al
jne    158d <main+0x37d>
jmp    1657 <main+0x447>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xaa3(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1652 <main+0x442>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xa77(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1652 <main+0x442>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xa4b(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1652 <main+0x442>
movslq -0x20(%rbp),%rax
lea    -0x2830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0xa1f(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1652 <main+0x442>
jmp    1657 <main+0x447>
jmp    151b <main+0x30b>
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rdi
imul   $0x500,%rax,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    $0x500,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
setg   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%edx
movslq -0x20(%rbp),%rax
mov    %edx,-0x7870(%rbp,%rax,4)
xor    %eax,%eax
test   $0x1,%cl
mov    %al,-0x78ab(%rbp)
jne    16b0 <main+0x4a0>
jmp    16bd <main+0x4ad>
cmpl   $0xa,-0x20(%rbp)
setl   %al
mov    %al,-0x78ab(%rbp)
mov    -0x78ab(%rbp),%al
test   $0x1,%al
jne    16d0 <main+0x4c0>
jmp    17c6 <main+0x5b6>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x970(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x93d(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     17b3 <main+0x5a3>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x911(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     17b3 <main+0x5a3>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x8e5(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     17b3 <main+0x5a3>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x8b9(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    17b8 <main+0x5a8>
jmp    17c6 <main+0x5b6>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    165e <main+0x44e>
jmp    17cb <main+0x5bb>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rdi
imul   $0x500,%rax,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    $0x500,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
setg   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%edx
movslq -0x20(%rbp),%rax
mov    %edx,-0x7850(%rbp,%rax,4)
xor    %eax,%eax
test   $0x1,%cl
mov    %al,-0x78ac(%rbp)
jne    181d <main+0x60d>
jmp    182a <main+0x61a>
cmpl   $0x8,-0x20(%rbp)
setl   %al
mov    %al,-0x78ac(%rbp)
mov    -0x78ac(%rbp),%al
test   $0x1,%al
jne    183d <main+0x62d>
jmp    1907 <main+0x6f7>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x7f3(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1902 <main+0x6f2>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x7c7(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1902 <main+0x6f2>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x79b(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1902 <main+0x6f2>
movslq -0x20(%rbp),%rax
lea    -0x7830(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x76f(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1902 <main+0x6f2>
jmp    1907 <main+0x6f7>
jmp    17cb <main+0x5bb>
movl   $0x0,-0x20(%rbp)
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rdi
imul   $0x500,%rax,%rax
add    %rax,%rdi
mov    -0x28(%rbp),%rdx
mov    $0x500,%esi
call   10a0 <fgets@plt>
cmp    $0x0,%rax
setg   %cl
mov    %cl,%al
and    $0x1,%al
movzbl %al,%edx
movslq -0x20(%rbp),%rax
mov    %edx,-0x7870(%rbp,%rax,4)
xor    %eax,%eax
test   $0x1,%cl
mov    %al,-0x78ad(%rbp)
jne    1960 <main+0x750>
jmp    196d <main+0x75d>
cmpl   $0xa,-0x20(%rbp)
setl   %al
mov    %al,-0x78ad(%rbp)
mov    -0x78ad(%rbp),%al
test   $0x1,%al
jne    1980 <main+0x770>
jmp    1a76 <main+0x866>
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x6c9(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x68d(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1a63 <main+0x853>
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x661(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1a63 <main+0x853>
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x635(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     1a63 <main+0x853>
movslq -0x20(%rbp),%rax
lea    -0x5030(%rbp),%rsi
imul   $0x500,%rax,%rax
add    %rax,%rsi
lea    0x609(%rip),%rdi
mov    $0x3,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
jne    1a68 <main+0x858>
jmp    1a76 <main+0x866>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    190e <main+0x6fe>
mov    -0x18(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
mov    %eax,%edi
call   1120 <wait@plt>
mov    0x251a(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7818,%rsp
mov    0x2db0(%rip),%rax
mov    (%rax),%edi
mov    0x2d87(%rip),%rax
mov    (%rax),%esi
lea    0x8(%rsp),%rcx
xor    %edx,%edx
call   10c0 <socketpair@plt>
test   %rax,%rax
jne    1282 <main+0x62>
xor    %eax,%eax
call   1140 <fork@plt>
test   %eax,%eax
je     1298 <main+0x78>
cmp    $0xffffffff,%eax
jne    12f0 <main+0xd0>
lea    0xd91(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2d45(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xddc(%rip),%rdi
call   1050 <puts@plt>
mov    $0xffffffff,%edi
call   10f0 <exit@plt>
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1080 <dup2@plt>
mov    0x8(%rsp),%edi
xor    %esi,%esi
call   1080 <dup2@plt>
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    0x2cf7(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <fcntl@plt>
lea    0xd31(%rip),%rdi
lea    0xd36(%rip),%rsi
xor    %edx,%edx
call   1110 <execl@plt>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
call   1040 <_exit@plt>
mov    0xc(%rsp),%edi
xor    %esi,%esi
call   1080 <dup2@plt>
mov    0x8(%rsp),%edi
mov    $0x1,%esi
call   1080 <dup2@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%esi
mov    0x2c9f(%rip),%rax
mov    (%rax),%edx
mov    $0x1,%edi
call   1060 <fcntl@plt>
mov    $0x1,%edi
call   1120 <sleep@plt>
mov    0x2caa(%rip),%rax
mov    (%rax),%r14
mov    0x2c70(%rip),%rax
mov    (%rax),%rbx
lea    0xd13(%rip),%rdi
call   1050 <puts@plt>
lea    0xcc1(%rip),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %rbp,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1100 <fwrite@plt>
mov    %rbx,%rdi
call   10d0 <fflush@plt>
lea    0x2810(%rsp),%rbx
lea    0xcb8(%rip),%r13
lea    0xcb5(%rip),%rbp
lea    0xcb2(%rip),%r15
xor    %ecx,%ecx
nopw   0x0(%rax,%rax,1)
mov    %rcx,%r12
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    143f <main+0x21f>
cmp    $0x7,%r12
ja     143f <main+0x21f>
lea    0xc69(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
add    $0x500,%rbx
lea    0xc5a(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     143b <main+0x21b>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     143b <main+0x21b>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     143b <main+0x21b>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
lea    0x1(%r12),%rcx
test   %rax,%rax
jne    13a0 <main+0x180>
add    $0x1,%r12
movslq %r12d,%rax
lea    (%rax,%rax,4),%rax
shl    $0x8,%rax
lea    (%rsp,%rax,1),%rbx
add    $0x2810,%rbx
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1509 <main+0x2e9>
cmp    $0x7,%r12d
jg     1509 <main+0x2e9>
lea    0xbbc(%rip),%rbp
lea    0xbb9(%rip),%r15
lea    0xbb6(%rip),%r12
lea    0xbb3(%rip),%r13
jmp    14b5 <main+0x295>
cs nopw 0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1509 <main+0x2e9>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     14a0 <main+0x280>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     14a0 <main+0x280>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     14a0 <main+0x280>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     14a0 <main+0x280>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
mov    $0x1,%bpl
test   %rax,%rax
jle    15ea <main+0x3ca>
lea    0x10(%rsp),%rbx
lea    0xb0d(%rip),%rbp
lea    0xb0a(%rip),%r15
xor    %r13d,%r13d
lea    0xb04(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xae3(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     15dc <main+0x3bc>
lea    0xace(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     15dc <main+0x3bc>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     15dc <main+0x3bc>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     15dc <main+0x3bc>
lea    0x1(%r13),%r12
add    $0x500,%rbx
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    15df <main+0x3bf>
cmp    $0x9,%r13
mov    %r12,%r13
jb     1540 <main+0x320>
jmp    15df <main+0x3bf>
mov    %r13,%r12
test   $0xfffffff8,%r12d
sete   %bpl
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1699 <main+0x479>
test   %bpl,%bpl
je     1699 <main+0x479>
lea    0xa28(%rip),%rbp
lea    0xa25(%rip),%r15
lea    0xa22(%rip),%r12
lea    0xa1f(%rip),%r13
jmp    1645 <main+0x425>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1699 <main+0x479>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1630 <main+0x410>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1630 <main+0x410>
mov    %r12,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1630 <main+0x410>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1630 <main+0x410>
lea    0x5010(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1777 <main+0x557>
lea    0x97e(%rip),%r13
lea    0x97b(%rip),%rbp
lea    0x978(%rip),%r15
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x96d(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0x943(%rip),%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1777 <main+0x557>
mov    %r13,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1777 <main+0x557>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1777 <main+0x557>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x3,%edx
call   1030 <strncmp@plt>
test   %rax,%rax
je     1777 <main+0x557>
add    $0x500,%rbx
mov    %rbx,%rdi
mov    $0x500,%esi
mov    %r14,%rdx
call   10b0 <fgets@plt>
test   %rax,%rax
jle    1777 <main+0x557>
lea    0x1(%r12),%rax
cmp    $0x8,%r12
mov    %rax,%r12
jbe    16e0 <main+0x4c0>
mov    0x8(%rsp),%edi
call   10a0 <close@plt>
xor    %edi,%edi
call   1130 <wait@plt>
mov    0x281a(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str = [8 x i8] c"AGGGH:\0A\00"
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@F_SETFL = global i32 0
@FNDELAY = global i32 0
@.str.2 = [18 x i8] c"/home/d/bin/inout\00"
@.str.3 = [6 x i8] c"inout\00"
@EXIT_SUCCESS = global i32 0
@stdin = global i32* null
@stdout = global i32* null
@.str.4 = [27 x i8] c"this is a test\0Aso is this\0A\00"
@.str.5 = [9 x i8] c"Got ere\0A\00"
@.str.6 = [9 x i8] c"LINE: %s\00"
@.str.7 = [4 x i8] c"END\00"
@.str.8 = [4 x i8] c"TLE\00"
@.str.9 = [4 x i8] c"LNK\00"
@.str.10 = [4 x i8] c"SNP\00"
@.str.11 = [9 x i8] c"TLEL: %s\00"
@.str.12 = [9 x i8] c"SNIP: %s\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [2 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32*
%11 = alloca [8 x [1280 x i8]]
%12 = alloca [8 x [1280 x i8]]
%13 = alloca [8 x [1280 x i8]]
%14 = alloca [8 x i32]
%15 = alloca [8 x i32]
%16 = alloca [8 x i32]
%17 = alloca i8*
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
%19 = load i32, i32* @AF_UNIX
%20 = load i32, i32* @SOCK_STREAM
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%22 = call i64 @socketpair(i32 %19, i32 %20, i32 0, i32* %21)
%23 = icmp ne i64 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 -1)
unreachable
27: ; preds = %2
%28 = call i32 (...) @fork()
store i32 %28, i32* %7
%29 = load i32, i32* %7
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %35
31: ; preds = %27
%32 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32, i32* @EXIT_FAILURE
%34 = call i32 @exit(i32 %33)
unreachable
35: ; preds = %27
%36 = load i32, i32* %7
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %51
38: ; preds = %35
%39 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%40 = load i32, i32* %39
%41 = call i32 @dup2(i32 %40, i32 1)
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%43 = load i32, i32* %42
%44 = call i32 @dup2(i32 %43, i32 0)
%45 = load i32, i32* @F_SETFL
%46 = load i32, i32* @FNDELAY
%47 = call i32 @fcntl(i32 1, i32 %45, i32 %46)
%48 = call i32 @execl(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null)
%49 = load i32, i32* @EXIT_SUCCESS
%50 = call i32 @_exit(i32 %49)
unreachable
51: ; preds = %35
%52 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%53 = load i32, i32* %52
%54 = call i32 @dup2(i32 %53, i32 0)
%55 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%56 = load i32, i32* %55
%57 = call i32 @dup2(i32 %56, i32 1)
%58 = load i32, i32* @F_SETFL
%59 = load i32, i32* @FNDELAY
%60 = call i32 @fcntl(i32 1, i32 %58, i32 %59)
%61 = call i32 @sleep(i32 1)
%62 = load i32*, i32** @stdin
store i32* %62, i32** %9
%63 = load i32*, i32** @stdout
store i32* %63, i32** %10
store i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i8** %17
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%65 = load i8*, i8** %17
%66 = load i8*, i8** %17
%67 = call i32 @strlen(i8* %66)
%68 = load i32*, i32** %10
%69 = call i32 @fwrite(i8* %65, i32 %67, i32 1, i32* %68)
%70 = load i32*, i32** %10
%71 = call i32 @fflush(i32* %70)
br label %72
72: ; preds = %125, %51
%73 = load i32, i32* %8
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %74
%76 = bitcast [1280 x i8]* %75 to i8**
%77 = load i32*, i32** %9
%78 = call i64 @fgets(i8** %76, i32 1280, i32* %77)
%79 = icmp sgt i64 %78, 0
%80 = zext i1 %79 to i32
%81 = load i32, i32* %8
%82 = sext i32 %81 to i64
%83 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %82
store i32 %80, i32* %83
br i1 %79, label %84, label %87
84: ; preds = %72
%85 = load i32, i32* %8
%86 = icmp slt i32 %85, 8
br label %87
87: ; preds = %84, %72
%88 = phi i1 [ false, %72 ], [ %86, %84 ]
br i1 %88, label %89, label %126
89: ; preds = %87
%90 = load i32, i32* %8
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %91
%93 = getelementptr inbounds [1280 x i8], [1280 x i8]* %92, i64 0, i64 0
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %93)
%95 = load i32, i32* %8
%96 = add nsw i32 %95, 1
store i32 %96, i32* %8
%97 = load i32, i32* %8
%98 = sext i32 %97 to i64
%99 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %98
%100 = getelementptr inbounds [1280 x i8], [1280 x i8]* %99, i64 0, i64 0
%101 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %100, i32 3)
%102 = icmp eq i64 %101, 0
br i1 %102, label %124, label %103
103: ; preds = %89
%104 = load i32, i32* %8
%105 = sext i32 %104 to i64
%106 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %105
%107 = getelementptr inbounds [1280 x i8], [1280 x i8]* %106, i64 0, i64 0
%108 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %107, i32 3)
%109 = icmp eq i64 %108, 0
br i1 %109, label %124, label %110
110: ; preds = %103
%111 = load i32, i32* %8
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %112
%114 = getelementptr inbounds [1280 x i8], [1280 x i8]* %113, i64 0, i64 0
%115 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %114, i32 3)
%116 = icmp eq i64 %115, 0
br i1 %116, label %124, label %117
117: ; preds = %110
%118 = load i32, i32* %8
%119 = sext i32 %118 to i64
%120 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %119
%121 = getelementptr inbounds [1280 x i8], [1280 x i8]* %120, i64 0, i64 0
%122 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %121, i32 3)
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %125
124: ; preds = %117, %110, %103, %89
br label %126
125: ; preds = %117
br label %72
126: ; preds = %124, %87
br label %127
127: ; preds = %173, %126
%128 = load i32, i32* %8
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %129
%131 = bitcast [1280 x i8]* %130 to i8**
%132 = load i32*, i32** %9
%133 = call i64 @fgets(i8** %131, i32 1280, i32* %132)
%134 = icmp sgt i64 %133, 0
%135 = zext i1 %134 to i32
%136 = load i32, i32* %8
%137 = sext i32 %136 to i64
%138 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %137
store i32 %135, i32* %138
br i1 %134, label %139, label %142
139: ; preds = %127
%140 = load i32, i32* %8
%141 = icmp slt i32 %140, 8
br label %142
142: ; preds = %139, %127
%143 = phi i1 [ false, %127 ], [ %141, %139 ]
br i1 %143, label %144, label %174
144: ; preds = %142
%145 = load i32, i32* %8
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %146
%148 = getelementptr inbounds [1280 x i8], [1280 x i8]* %147, i64 0, i64 0
%149 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %148, i32 3)
%150 = icmp eq i64 %149, 0
br i1 %150, label %173, label %151
151: ; preds = %144
%152 = load i32, i32* %8
%153 = sext i32 %152 to i64
%154 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %153
%155 = getelementptr inbounds [1280 x i8], [1280 x i8]* %154, i64 0, i64 0
%156 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %155, i32 3)
%157 = icmp eq i64 %156, 0
br i1 %157, label %173, label %158
158: ; preds = %151
%159 = load i32, i32* %8
%160 = sext i32 %159 to i64
%161 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %160
%162 = getelementptr inbounds [1280 x i8], [1280 x i8]* %161, i64 0, i64 0
%163 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %162, i32 3)
%164 = icmp eq i64 %163, 0
br i1 %164, label %173, label %165
165: ; preds = %158
%166 = load i32, i32* %8
%167 = sext i32 %166 to i64
%168 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %11, i64 0, i64 %167
%169 = getelementptr inbounds [1280 x i8], [1280 x i8]* %168, i64 0, i64 0
%170 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %169, i32 3)
%171 = icmp eq i64 %170, 0
br i1 %171, label %173, label %172
172: ; preds = %165
br label %174
173: ; preds = %165, %158, %151, %144
br label %127
174: ; preds = %172, %142
store i32 0, i32* %8
br label %175
175: ; preds = %226, %174
%176 = load i32, i32* %8
%177 = sext i32 %176 to i64
%178 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %177
%179 = bitcast [1280 x i8]* %178 to i8**
%180 = load i32*, i32** %9
%181 = call i64 @fgets(i8** %179, i32 1280, i32* %180)
%182 = icmp sgt i64 %181, 0
%183 = zext i1 %182 to i32
%184 = load i32, i32* %8
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 %185
store i32 %183, i32* %186
br i1 %182, label %187, label %190
187: ; preds = %175
%188 = load i32, i32* %8
%189 = icmp slt i32 %188, 10
br label %190
190: ; preds = %187, %175
%191 = phi i1 [ false, %175 ], [ %189, %187 ]
br i1 %191, label %192, label %229
192: ; preds = %190
%193 = load i32, i32* %8
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %194
%196 = getelementptr inbounds [1280 x i8], [1280 x i8]* %195, i64 0, i64 0
%197 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* %196)
%198 = load i32, i32* %8
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %199
%201 = getelementptr inbounds [1280 x i8], [1280 x i8]* %200, i64 0, i64 0
%202 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %201, i32 3)
%203 = icmp eq i64 %202, 0
br i1 %203, label %225, label %204
204: ; preds = %192
%205 = load i32, i32* %8
%206 = sext i32 %205 to i64
%207 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %206
%208 = getelementptr inbounds [1280 x i8], [1280 x i8]* %207, i64 0, i64 0
%209 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %208, i32 3)
%210 = icmp eq i64 %209, 0
br i1 %210, label %225, label %211
211: ; preds = %204
%212 = load i32, i32* %8
%213 = sext i32 %212 to i64
%214 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %213
%215 = getelementptr inbounds [1280 x i8], [1280 x i8]* %214, i64 0, i64 0
%216 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %215, i32 3)
%217 = icmp eq i64 %216, 0
br i1 %217, label %225, label %218
218: ; preds = %211
%219 = load i32, i32* %8
%220 = sext i32 %219 to i64
%221 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %220
%222 = getelementptr inbounds [1280 x i8], [1280 x i8]* %221, i64 0, i64 0
%223 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %222, i32 3)
%224 = icmp eq i64 %223, 0
br i1 %224, label %225, label %226
225: ; preds = %218, %211, %204, %192
br label %229
226: ; preds = %218
%227 = load i32, i32* %8
%228 = add nsw i32 %227, 1
store i32 %228, i32* %8
br label %175
229: ; preds = %225, %190
br label %230
230: ; preds = %276, %229
%231 = load i32, i32* %8
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %232
%234 = bitcast [1280 x i8]* %233 to i8**
%235 = load i32*, i32** %9
%236 = call i64 @fgets(i8** %234, i32 1280, i32* %235)
%237 = icmp sgt i64 %236, 0
%238 = zext i1 %237 to i32
%239 = load i32, i32* %8
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds [8 x i32], [8 x i32]* %14, i64 0, i64 %240
store i32 %238, i32* %241
br i1 %237, label %242, label %245
242: ; preds = %230
%243 = load i32, i32* %8
%244 = icmp slt i32 %243, 8
br label %245
245: ; preds = %242, %230
%246 = phi i1 [ false, %230 ], [ %244, %242 ]
br i1 %246, label %247, label %277
247: ; preds = %245
%248 = load i32, i32* %8
%249 = sext i32 %248 to i64
%250 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %249
%251 = getelementptr inbounds [1280 x i8], [1280 x i8]* %250, i64 0, i64 0
%252 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %251, i32 3)
%253 = icmp eq i64 %252, 0
br i1 %253, label %276, label %254
254: ; preds = %247
%255 = load i32, i32* %8
%256 = sext i32 %255 to i64
%257 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %256
%258 = getelementptr inbounds [1280 x i8], [1280 x i8]* %257, i64 0, i64 0
%259 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %258, i32 3)
%260 = icmp eq i64 %259, 0
br i1 %260, label %276, label %261
261: ; preds = %254
%262 = load i32, i32* %8
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %263
%265 = getelementptr inbounds [1280 x i8], [1280 x i8]* %264, i64 0, i64 0
%266 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %265, i32 3)
%267 = icmp eq i64 %266, 0
br i1 %267, label %276, label %268
268: ; preds = %261
%269 = load i32, i32* %8
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %13, i64 0, i64 %270
%272 = getelementptr inbounds [1280 x i8], [1280 x i8]* %271, i64 0, i64 0
%273 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %272, i32 3)
%274 = icmp eq i64 %273, 0
br i1 %274, label %276, label %275
275: ; preds = %268
br label %277
276: ; preds = %268, %261, %254, %247
br label %230
277: ; preds = %275, %245
store i32 0, i32* %8
br label %278
278: ; preds = %329, %277
%279 = load i32, i32* %8
%280 = sext i32 %279 to i64
%281 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %280
%282 = bitcast [1280 x i8]* %281 to i8**
%283 = load i32*, i32** %9
%284 = call i64 @fgets(i8** %282, i32 1280, i32* %283)
%285 = icmp sgt i64 %284, 0
%286 = zext i1 %285 to i32
%287 = load i32, i32* %8
%288 = sext i32 %287 to i64
%289 = getelementptr inbounds [8 x i32], [8 x i32]* %15, i64 0, i64 %288
store i32 %286, i32* %289
br i1 %285, label %290, label %293
290: ; preds = %278
%291 = load i32, i32* %8
%292 = icmp slt i32 %291, 10
br label %293
293: ; preds = %290, %278
%294 = phi i1 [ false, %278 ], [ %292, %290 ]
br i1 %294, label %295, label %332
295: ; preds = %293
%296 = load i32, i32* %8
%297 = sext i32 %296 to i64
%298 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %297
%299 = getelementptr inbounds [1280 x i8], [1280 x i8]* %298, i64 0, i64 0
%300 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %299)
%301 = load i32, i32* %8
%302 = sext i32 %301 to i64
%303 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %302
%304 = getelementptr inbounds [1280 x i8], [1280 x i8]* %303, i64 0, i64 0
%305 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %304, i32 3)
%306 = icmp eq i64 %305, 0
br i1 %306, label %328, label %307
307: ; preds = %295
%308 = load i32, i32* %8
%309 = sext i32 %308 to i64
%310 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %309
%311 = getelementptr inbounds [1280 x i8], [1280 x i8]* %310, i64 0, i64 0
%312 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %311, i32 3)
%313 = icmp eq i64 %312, 0
br i1 %313, label %328, label %314
314: ; preds = %307
%315 = load i32, i32* %8
%316 = sext i32 %315 to i64
%317 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %316
%318 = getelementptr inbounds [1280 x i8], [1280 x i8]* %317, i64 0, i64 0
%319 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %318, i32 3)
%320 = icmp eq i64 %319, 0
br i1 %320, label %328, label %321
321: ; preds = %314
%322 = load i32, i32* %8
%323 = sext i32 %322 to i64
%324 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %12, i64 0, i64 %323
%325 = getelementptr inbounds [1280 x i8], [1280 x i8]* %324, i64 0, i64 0
%326 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %325, i32 3)
%327 = icmp eq i64 %326, 0
br i1 %327, label %328, label %329
328: ; preds = %321, %314, %307, %295
br label %332
329: ; preds = %321
%330 = load i32, i32* %8
%331 = add nsw i32 %330, 1
store i32 %331, i32* %8
br label %278
332: ; preds = %328, %293
%333 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%334 = load i32, i32* %333
%335 = call i32 @close(i32 %334)
%336 = call i32 @wait(i32* null)
%337 = load i32, i32* @EXIT_SUCCESS
%338 = call i32 @exit(i32 %337)
unreachable
}

LLVM IR (-O2):
@AF_UNIX = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [5 x i8] c"fork\00"
@EXIT_FAILURE = global i32 0
@F_SETFL = global i32 0
@FNDELAY = global i32 0
@.str.2 = [18 x i8] c"/home/d/bin/inout\00"
@.str.3 = [6 x i8] c"inout\00"
@EXIT_SUCCESS = global i32 0
@stdin = global i32* null
@stdout = global i32* null
@.str.4 = [27 x i8] c"this is a test\0Aso is this\0A\00"
@.str.6 = [9 x i8] c"LINE: %s\00"
@.str.7 = [4 x i8] c"END\00"
@.str.8 = [4 x i8] c"TLE\00"
@.str.9 = [4 x i8] c"LNK\00"
@.str.10 = [4 x i8] c"SNP\00"
@.str.11 = [9 x i8] c"TLEL: %s\00"
@.str.12 = [9 x i8] c"SNIP: %s\00"
@str = [8 x i8] c"Got ere\00"
@str.13 = [7 x i8] c"AGGGH:\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [2 x i32]
%4 = alloca [8 x [1280 x i8]]
%5 = alloca [8 x [1280 x i8]]
%6 = alloca [8 x [1280 x i8]]
%7 = bitcast [2 x i32]* %3 to i8*
%8 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %4, i64 0, i64 0, i64 0
%9 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %5, i64 0, i64 0, i64 0
%10 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %6, i64 0, i64 0, i64 0
%11 = load i32, i32* @AF_UNIX
%12 = load i32, i32* @SOCK_STREAM
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%14 = call i64 @socketpair(i32 %11, i32 %12, i32 0, i32* %13)
%15 = icmp eq i64 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str.13, i64 0, i64 0))
%18 = call i32 @exit(i32 -1)
unreachable
19: ; preds = %2
%20 = call i32 (...) @fork()
switch i32 %20, label %37 [
i32 -1, label %21
i32 0, label %25
]
21: ; preds = %19
%22 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %19
%26 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%27 = load i32, i32* %26
%28 = call i32 @dup2(i32 %27, i32 1)
%29 = load i32, i32* %13
%30 = call i32 @dup2(i32 %29, i32 0)
%31 = load i32, i32* @F_SETFL
%32 = load i32, i32* @FNDELAY
%33 = call i32 @fcntl(i32 1, i32 %31, i32 %32)
%34 = call i32 @execl(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i32* null)
%35 = load i32, i32* @EXIT_SUCCESS
%36 = call i32 @_exit(i32 %35)
unreachable
37: ; preds = %19
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%39 = load i32, i32* %38
%40 = call i32 @dup2(i32 %39, i32 0)
%41 = load i32, i32* %13
%42 = call i32 @dup2(i32 %41, i32 1)
%43 = load i32, i32* @F_SETFL
%44 = load i32, i32* @FNDELAY
%45 = call i32 @fcntl(i32 1, i32 %43, i32 %44)
%46 = call i32 @sleep(i32 1)
%47 = load i32*, i32** @stdin
%48 = load i32*, i32** @stdout
%49 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
%50 = call i32 @strlen(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%51 = call i32 @fwrite(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0), i32 %50, i32 1, i32* %48)
%52 = call i32 @fflush(i32* %48)
br label %53
53: ; preds = %74, %37
%54 = phi i64 [ %64, %74 ], [ 0, %37 ]
%55 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %4, i64 0, i64 %54
%56 = bitcast [1280 x i8]* %55 to i8**
%57 = call i64 @fgets(i8** %56, i32 1280, i32* %47)
%58 = icmp sgt i64 %57, 0
%59 = icmp ult i64 %54, 8
%60 = select i1 %58, i1 %59, i1 false
br i1 %60, label %61, label %77
61: ; preds = %53
%62 = getelementptr inbounds [1280 x i8], [1280 x i8]* %55, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* %62)
%64 = add nuw nsw i64 %54, 1
%65 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %4, i64 0, i64 %64, i64 0
%66 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %65, i32 3)
%67 = icmp eq i64 %66, 0
br i1 %67, label %77, label %68
68: ; preds = %61
%69 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %65, i32 3)
%70 = icmp eq i64 %69, 0
br i1 %70, label %77, label %71
71: ; preds = %68
%72 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %65, i32 3)
%73 = icmp eq i64 %72, 0
br i1 %73, label %77, label %74
74: ; preds = %71
%75 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %65, i32 3)
%76 = icmp eq i64 %75, 0
br i1 %76, label %77, label %53
77: ; preds = %61, %68, %71, %74, %53
%78 = phi i64 [ %64, %61 ], [ %64, %68 ], [ %64, %71 ], [ %64, %74 ], [ %54, %53 ]
%79 = trunc i64 %78 to i32
%80 = shl i64 %78, 32
%81 = ashr exact i64 %80, 32
%82 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %4, i64 0, i64 %81
%83 = bitcast [1280 x i8]* %82 to i8**
%84 = call i64 @fgets(i8** %83, i32 1280, i32* %47)
%85 = icmp sgt i64 %84, 0
%86 = icmp slt i32 %79, 8
%87 = select i1 %85, i1 %86, i1 false
br i1 %87, label %88, label %105
88: ; preds = %77
%89 = getelementptr inbounds [1280 x i8], [1280 x i8]* %82, i64 0, i64 0
br label %90
90: ; preds = %88, %102
%91 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %89, i32 3)
%92 = icmp eq i64 %91, 0
br i1 %92, label %102, label %93
93: ; preds = %90
%94 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %89, i32 3)
%95 = icmp eq i64 %94, 0
br i1 %95, label %102, label %96
96: ; preds = %93
%97 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %89, i32 3)
%98 = icmp eq i64 %97, 0
br i1 %98, label %102, label %99
99: ; preds = %96
%100 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %89, i32 3)
%101 = icmp eq i64 %100, 0
br i1 %101, label %102, label %105
102: ; preds = %99, %96, %93, %90
%103 = call i64 @fgets(i8** %83, i32 1280, i32* %47)
%104 = icmp sgt i64 %103, 0
br i1 %104, label %90, label %105
105: ; preds = %102, %99, %77
%106 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %6, i64 0, i64 0
%107 = bitcast [8 x [1280 x i8]]* %6 to i8**
%108 = call i64 @fgets(i8** %107, i32 1280, i32* %47)
%109 = icmp sgt i64 %108, 0
br i1 %109, label %110, label %139
110: ; preds = %105, %126
%111 = phi i64 [ %127, %126 ], [ 0, %105 ]
%112 = phi [1280 x i8]* [ %128, %126 ], [ %106, %105 ]
%113 = getelementptr inbounds [1280 x i8], [1280 x i8]* %112, i64 0, i64 0
%114 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i8* %113)
%115 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %113, i32 3)
%116 = icmp eq i64 %115, 0
br i1 %116, label %134, label %117
117: ; preds = %110
%118 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %113, i32 3)
%119 = icmp eq i64 %118, 0
br i1 %119, label %134, label %120
120: ; preds = %117
%121 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %113, i32 3)
%122 = icmp eq i64 %121, 0
br i1 %122, label %134, label %123
123: ; preds = %120
%124 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %113, i32 3)
%125 = icmp eq i64 %124, 0
br i1 %125, label %134, label %126
126: ; preds = %123
%127 = add nuw nsw i64 %111, 1
%128 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %6, i64 0, i64 %127
%129 = bitcast [1280 x i8]* %128 to i8**
%130 = call i64 @fgets(i8** %129, i32 1280, i32* %47)
%131 = icmp sgt i64 %130, 0
%132 = icmp ult i64 %111, 9
%133 = select i1 %131, i1 %132, i1 false
br i1 %133, label %110, label %134
134: ; preds = %110, %117, %120, %123, %126
%135 = phi [1280 x i8]* [ %128, %126 ], [ %112, %123 ], [ %112, %120 ], [ %112, %117 ], [ %112, %110 ]
%136 = phi i64 [ %127, %126 ], [ %111, %123 ], [ %111, %120 ], [ %111, %117 ], [ %111, %110 ]
%137 = and i64 %136, 4294967288
%138 = icmp eq i64 %137, 0
br label %139
139: ; preds = %134, %105
%140 = phi [1280 x i8]* [ %106, %105 ], [ %135, %134 ]
%141 = phi i1 [ true, %105 ], [ %138, %134 ]
%142 = bitcast [1280 x i8]* %140 to i8**
%143 = call i64 @fgets(i8** %142, i32 1280, i32* %47)
%144 = icmp sgt i64 %143, 0
%145 = select i1 %144, i1 %141, i1 false
br i1 %145, label %146, label %163
146: ; preds = %139
%147 = getelementptr inbounds [1280 x i8], [1280 x i8]* %140, i64 0, i64 0
br label %148
148: ; preds = %146, %160
%149 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %147, i32 3)
%150 = icmp eq i64 %149, 0
br i1 %150, label %160, label %151
151: ; preds = %148
%152 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %147, i32 3)
%153 = icmp eq i64 %152, 0
br i1 %153, label %160, label %154
154: ; preds = %151
%155 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %147, i32 3)
%156 = icmp eq i64 %155, 0
br i1 %156, label %160, label %157
157: ; preds = %154
%158 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %147, i32 3)
%159 = icmp eq i64 %158, 0
br i1 %159, label %160, label %163
160: ; preds = %157, %154, %151, %148
%161 = call i64 @fgets(i8** %142, i32 1280, i32* %47)
%162 = icmp sgt i64 %161, 0
br i1 %162, label %148, label %163
163: ; preds = %160, %157, %139
%164 = bitcast [8 x [1280 x i8]]* %5 to i8**
%165 = call i64 @fgets(i8** %164, i32 1280, i32* %47)
%166 = icmp sgt i64 %165, 0
br i1 %166, label %174, label %190
167: ; preds = %186
%168 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %5, i64 0, i64 %189
%169 = bitcast [1280 x i8]* %168 to i8**
%170 = call i64 @fgets(i8** %169, i32 1280, i32* %47)
%171 = icmp sgt i64 %170, 0
%172 = icmp ult i64 %175, 9
%173 = select i1 %171, i1 %172, i1 false
br i1 %173, label %174, label %190
174: ; preds = %163, %167
%175 = phi i64 [ %189, %167 ], [ 0, %163 ]
%176 = getelementptr inbounds [8 x [1280 x i8]], [8 x [1280 x i8]]* %5, i64 0, i64 %175, i64 0
%177 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i8* %176)
%178 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %176, i32 3)
%179 = icmp eq i64 %178, 0
br i1 %179, label %190, label %180
180: ; preds = %174
%181 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i8* %176, i32 3)
%182 = icmp eq i64 %181, 0
br i1 %182, label %190, label %183
183: ; preds = %180
%184 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i8* %176, i32 3)
%185 = icmp eq i64 %184, 0
br i1 %185, label %190, label %186
186: ; preds = %183
%187 = call i64 @strncmp(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %176, i32 3)
%188 = icmp eq i64 %187, 0
%189 = add nuw nsw i64 %175, 1
br i1 %188, label %190, label %167
190: ; preds = %167, %186, %183, %180, %174, %163
%191 = load i32, i32* %13
%192 = call i32 @close(i32 %191)
%193 = call i32 @wait(i32* null)
%194 = load i32, i32* @EXIT_SUCCESS
%195 = call i32 @exit(i32 %194)
unreachable
}