#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 size_t ssize_t;
typedef int pid_t;
typedef int /*<<< orphan*/ go2;
typedef int /*<<< orphan*/ go;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ _exit(int /*<<< orphan*/);
int /*<<< orphan*/ assert(int);
int /*<<< orphan*/ err(int, char *, ...);
int errno;
int /*<<< orphan*/ errx(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int fork();
scalar_t__ memcmp(char *, char *, size_t);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, ...);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *, size_t, int);
int /*<<< orphan*/ warnx(char *, int);
int write(int, ...);
int main(void) {
  char buffer[65535], buffer2[65535], go[] = "go", go2[] = "go2";
  int desc[2], ipc_coord[2];
  size_t i;
  ssize_t total;
  int buggy, error;
  pid_t new_pid;
  buggy = 0;
  total = 0;
  error = pipe(desc);
  if (error == -1)
    err(1, "Couldn't allocate data pipe");
  error = pipe(ipc_coord);
  if (error == -1)
    err(1, "Couldn't allocate IPC coordination pipe");
  buffer[0] = 'A';
  for (i = 1; i < (int)sizeof(buffer); i++) {
    buffer[i] = buffer[i - 1] + 1;
    if (buffer[i] > 'Z')
      buffer[i] = 'A';
  }
  new_pid = fork();
  assert(new_pid != -1);
  if (new_pid == 0) {
    do {
      int _error = errno;
      warnx("%d: waiting for synchronization", 101);
      if (read(ipc_coord[0], &go, sizeof(go)) != sizeof(go))
        err(1, "failed to synchronize (%s)", (0 == 0 ? "parent" : "child"));
      errno = _error;
    } while (0);
    for (i = 0; i < 8; i++)
      do {
        ssize_t _size;
        if ((_size = write(desc[1], &buffer[total], 4096)) != 4096)
          warn("short write; wrote %zd, expected %d", _size, 4096);
        total += _size;
      } while (0);
    do {
      int _error = errno;
      warnx("%d: sending synchronization", 105);
      if (write(ipc_coord[0], &go2, sizeof(go2)) != sizeof(go2))
        err(1, "failed to synchronize (%s)", (0 == 0 ? "child" : "parent"));
      errno = _error;
    } while (0);
    do {
      int _error = errno;
      warnx("%d: waiting for synchronization", 106);
      if (read(ipc_coord[0], &go, sizeof(go)) != sizeof(go))
        err(1, "failed to synchronize (%s)", (0 == 0 ? "parent" : "child"));
      errno = _error;
    } while (0);
    for (i = 0; i < 2; i++)
      do {
        ssize_t _size;
        if ((_size = write(desc[1], &buffer[total], 4096)) != 4096)
          warn("short write; wrote %zd, expected %d", _size, 4096);
        total += _size;
      } while (0);
    do {
      int _error = errno;
      warnx("%d: sending synchronization", 111);
      if (write(ipc_coord[0], &go2, sizeof(go2)) != sizeof(go2))
        err(1, "failed to synchronize (%s)", (0 == 0 ? "child" : "parent"));
      errno = _error;
    } while (0);
    _exit(0);
  }
  do {
    int _error = errno;
    warnx("%d: sending synchronization", 116);
    if (write(ipc_coord[1], &go, sizeof(go)) != sizeof(go))
      err(1, "failed to synchronize (%s)", (1 == 0 ? "child" : "parent"));
    errno = _error;
  } while (0);
  do {
    int _error = errno;
    warnx("%d: waiting for synchronization", 117);
    if (read(ipc_coord[1], &go2, sizeof(go2)) != sizeof(go2))
      err(1, "failed to synchronize (%s)", (1 == 0 ? "parent" : "child"));
    errno = _error;
  } while (0);
  error = read(desc[0], &buffer2, 8 * 4096);
  total += error;
  printf("Read %d bytes\n", error);
  do {
    int _error = errno;
    warnx("%d: sending synchronization", 123);
    if (write(ipc_coord[1], &go, sizeof(go)) != sizeof(go))
      err(1, "failed to synchronize (%s)", (1 == 0 ? "child" : "parent"));
    errno = _error;
  } while (0);
  do {
    int _error = errno;
    warnx("%d: waiting for synchronization", 124);
    if (read(ipc_coord[1], &go2, sizeof(go2)) != sizeof(go2))
      err(1, "failed to synchronize (%s)", (1 == 0 ? "parent" : "child"));
    errno = _error;
  } while (0);
  error = read(desc[0], &buffer2[total], 2 * 4096);
  total += error;
  printf("Read %d bytes, done\n", error);
  if (memcmp(buffer, buffer2, total) != 0) {
    for (i = 0; i < (size_t)total; i++) {
      if (buffer[i] != buffer2[i]) {
        buggy = 1;
        printf("Location %zu input: %hhx "
               "output: %hhx\n",
               i, buffer[i], buffer2[i]);
      }
    }
  }
  waitpid(new_pid, NULL, 0);
  if ((buggy == 1) || (total != 10 * 4096))
    errx(1, "FAILED");
  else
    printf("SUCCESS\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20080,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe07(%rip),%ax
mov    %ax,-0x20013(%rbp)
mov    0xdfc(%rip),%al
mov    %al,-0x20011(%rbp)
mov    0xdf1(%rip),%eax
mov    %eax,-0x20017(%rbp)
movl   $0x0,-0x2003c(%rbp)
movq   $0x0,-0x20038(%rbp)
lea    -0x20020(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0x20040(%rbp)
cmpl   $0xffffffff,-0x20040(%rbp)
jne    125f <main+0x7f>
mov    $0x1,%edi
lea    0xdaf(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
lea    -0x20028(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0x20040(%rbp)
cmpl   $0xffffffff,-0x20040(%rbp)
jne    1291 <main+0xb1>
mov    $0x1,%edi
lea    0xd99(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
movb   $0x41,-0x10010(%rbp)
movq   $0x1,-0x20030(%rbp)
cmpq   $0xffff,-0x20030(%rbp)
jae    131d <main+0x13d>
mov    -0x20030(%rbp),%rax
sub    $0x1,%rax
movsbl -0x10010(%rbp,%rax,1),%eax
ff
add    $0x1,%eax
mov    %al,%cl
mov    -0x20030(%rbp),%rax
mov    %cl,-0x10010(%rbp,%rax,1)
mov    -0x20030(%rbp),%rax
movsbl -0x10010(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jle    1301 <main+0x121>
mov    -0x20030(%rbp),%rax
movb   $0x41,-0x10010(%rbp,%rax,1)
jmp    1306 <main+0x126>
mov    -0x20030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20030(%rbp)
jmp    12a3 <main+0xc3>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x20044(%rbp)
cmpl   $0xffffffff,-0x20044(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
cmpl   $0x0,-0x20044(%rbp)
jne    1656 <main+0x476>
jmp    1350 <main+0x170>
mov    0x2c89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20048(%rbp)
lea    0xce5(%rip),%rdi
mov    $0x65,%esi
call   1080 <warnx@plt>
mov    -0x20028(%rbp),%edi
lea    -0x20013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x3,%rax
je     13af <main+0x1cf>
mov    $0x1,%edi
lea    0xcca(%rip),%rsi
lea    0xcde(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20048(%rbp),%ecx
mov    0x2c24(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x20030(%rbp)
cmpq   $0x8,-0x20030(%rbp)
08
jae    145a <main+0x27a>
jmp    13dc <main+0x1fc>
mov    -0x2001c(%rbp),%edi
lea    -0x10010(%rbp),%rsi
add    -0x20038(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
mov    %rax,-0x20050(%rbp)
cmp    $0x1000,%rax
je     1429 <main+0x249>
mov    -0x20050(%rbp),%rsi
lea    0xc6e(%rip),%rdi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    -0x20050(%rbp),%rax
add    -0x20038(%rbp),%rax
mov    %rax,-0x20038(%rbp)
jmp    1443 <main+0x263>
mov    -0x20030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20030(%rbp)
jmp    13c9 <main+0x1e9>
jmp    145f <main+0x27f>
mov    0x2b7a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20054(%rbp)
lea    0xc3c(%rip),%rdi
mov    $0x69,%esi
call   1080 <warnx@plt>
mov    -0x20028(%rbp),%edi
lea    -0x20017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
je     14be <main+0x2de>
mov    $0x1,%edi
lea    0xbbb(%rip),%rsi
lea    0xc16(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20054(%rbp),%ecx
mov    0x2b15(%rip),%rax
mov    %ecx,(%rax)
jmp    14d2 <main+0x2f2>
mov    0x2b07(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20058(%rbp)
lea    0xb63(%rip),%rdi
mov    $0x6a,%esi
call   1080 <warnx@plt>
mov    -0x20028(%rbp),%edi
lea    -0x20013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x3,%rax
je     1531 <main+0x351>
mov    $0x1,%edi
lea    0xb48(%rip),%rsi
lea    0xb5c(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20058(%rbp),%ecx
mov    0x2aa2(%rip),%rax
mov    %ecx,(%rax)
movq   $0x0,-0x20030(%rbp)
cmpq   $0x2,-0x20030(%rbp)
02
jae    15dc <main+0x3fc>
jmp    155e <main+0x37e>
mov    -0x2001c(%rbp),%edi
lea    -0x10010(%rbp),%rsi
add    -0x20038(%rbp),%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
mov    %rax,-0x20060(%rbp)
cmp    $0x1000,%rax
je     15ab <main+0x3cb>
mov    -0x20060(%rbp),%rsi
lea    0xaec(%rip),%rdi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    -0x20060(%rbp),%rax
add    -0x20038(%rbp),%rax
mov    %rax,-0x20038(%rbp)
jmp    15c5 <main+0x3e5>
mov    -0x20030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20030(%rbp)
jmp    154b <main+0x36b>
jmp    15e1 <main+0x401>
mov    0x29f8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20064(%rbp)
lea    0xaba(%rip),%rdi
mov    $0x6f,%esi
call   1080 <warnx@plt>
mov    -0x20028(%rbp),%edi
lea    -0x20017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
je     1640 <main+0x460>
mov    $0x1,%edi
lea    0xa39(%rip),%rsi
lea    0xa94(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20064(%rbp),%ecx
mov    0x2993(%rip),%rax
mov    %ecx,(%rax)
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    165b <main+0x47b>
mov    0x297e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20068(%rbp)
lea    0xa40(%rip),%rdi
mov    $0x74,%esi
call   1080 <warnx@plt>
mov    -0x20024(%rbp),%edi
lea    -0x20013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x3,%rax
je     16ba <main+0x4da>
mov    $0x1,%edi
lea    0x9bf(%rip),%rsi
lea    0x9d3(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20068(%rbp),%ecx
mov    0x2919(%rip),%rax
mov    %ecx,(%rax)
jmp    16ce <main+0x4ee>
mov    0x290b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2006c(%rbp)
lea    0x967(%rip),%rdi
mov    $0x75,%esi
call   1080 <warnx@plt>
mov    -0x20024(%rbp),%edi
lea    -0x20017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x4,%rax
je     172d <main+0x54d>
mov    $0x1,%edi
lea    0x94c(%rip),%rsi
lea    0x9a7(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x2006c(%rbp),%ecx
mov    0x28a6(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20020(%rbp),%edi
lea    -0x20010(%rbp),%rsi
mov    $0x8000,%edx
mov    $0x0,%al
call   10a0 <read@plt>
mov    %eax,-0x20040(%rbp)
movslq -0x20040(%rbp),%rax
add    -0x20038(%rbp),%rax
mov    %rax,-0x20038(%rbp)
mov    -0x20040(%rbp),%esi
lea    0x956(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2855(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20070(%rbp)
lea    0x917(%rip),%rdi
mov    $0x7b,%esi
call   1080 <warnx@plt>
mov    -0x20024(%rbp),%edi
lea    -0x20013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x3,%rax
je     17e3 <main+0x603>
mov    $0x1,%edi
lea    0x896(%rip),%rsi
lea    0x8aa(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20070(%rbp),%ecx
mov    0x27f0(%rip),%rax
mov    %ecx,(%rax)
jmp    17f7 <main+0x617>
mov    0x27e2(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20074(%rbp)
lea    0x83e(%rip),%rdi
mov    $0x7c,%esi
call   1080 <warnx@plt>
mov    -0x20024(%rbp),%edi
lea    -0x20017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x4,%rax
je     1856 <main+0x676>
mov    $0x1,%edi
lea    0x823(%rip),%rsi
lea    0x87e(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x20074(%rbp),%ecx
mov    0x277d(%rip),%rax
mov    %ecx,(%rax)
mov    -0x20020(%rbp),%edi
lea    -0x20010(%rbp),%rsi
add    -0x20038(%rbp),%rsi
mov    $0x2000,%edx
mov    $0x0,%al
call   10a0 <read@plt>
mov    %eax,-0x20040(%rbp)
movslq -0x20040(%rbp),%rax
add    -0x20038(%rbp),%rax
mov    %rax,-0x20038(%rbp)
mov    -0x20040(%rbp),%esi
lea    0x835(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x10010(%rbp),%rdi
lea    -0x20010(%rbp),%rsi
mov    -0x20038(%rbp),%rdx
call   10b0 <memcmp@plt>
cmp    $0x0,%rax
je     197b <main+0x79b>
movq   $0x0,-0x20030(%rbp)
mov    -0x20030(%rbp),%rax
cmp    -0x20038(%rbp),%rax
jae    1976 <main+0x796>
mov    -0x20030(%rbp),%rax
movsbl -0x10010(%rbp,%rax,1),%eax
ff
mov    -0x20030(%rbp),%rcx
movsbl -0x20010(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     195a <main+0x77a>
movl   $0x1,-0x2003c(%rbp)
mov    -0x20030(%rbp),%rsi
mov    -0x20030(%rbp),%rax
movsbl -0x10010(%rbp,%rax,1),%edx
ff
mov    -0x20030(%rbp),%rax
movsbl -0x20010(%rbp,%rax,1),%ecx
ff
lea    0x7a4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    195f <main+0x77f>
mov    -0x20030(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20030(%rbp)
jmp    18e3 <main+0x703>
jmp    197b <main+0x79b>
mov    -0x20044(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10e0 <waitpid@plt>
cmpl   $0x1,-0x2003c(%rbp)
je     19aa <main+0x7ca>
cmpq   $0xa000,-0x20038(%rbp)
je     19c0 <main+0x7e0>
mov    $0x1,%edi
lea    0x768(%rip),%rsi
call   1060 <errx@plt>
jmp    19ce <main+0x7ee>
lea    0x75e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x20020,%rsp
movb   $0x0,0xa(%rsp)
movw   $0x6f67,0x8(%rsp)
movl   $0x326f67,0x14(%rsp)
lea    0xc(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1235 <main+0x45>
lea    0xdda(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
lea    0x18(%rsp),%rdi
call   10a0 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1257 <main+0x67>
lea    0xdd4(%rip),%rsi
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
movb   $0x41,0x20(%rsp)
mov    $0x41,%dl
mov    $0x2,%eax
mov    $0x41,%ecx
nopl   0x0(%rax,%rax,1)
add    $0x1,%dl
cmp    $0x5b,%dl
movzbl %dl,%edx
cmovge %ecx,%edx
mov    %dl,0x1f(%rsp,%rax,1)
add    $0x1,%dl
cmp    $0x5b,%dl
movzbl %dl,%edx
cmovge %ecx,%edx
mov    %dl,0x20(%rsp,%rax,1)
add    $0x2,%rax
cmp    $0x10000,%rax
jne    1270 <main+0x80>
xor    %eax,%eax
call   1110 <fork@plt>
mov    %eax,%r14d
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   10d0 <assert@plt>
mov    0x2d25(%rip),%r15
mov    (%r15),%ebx
test   %r14d,%r14d
jne    162b <main+0x43b>
lea    0xd79(%rip),%rdi
mov    $0x65,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x3,%eax
je     130c <main+0x11c>
lea    0xd6e(%rip),%rsi
lea    0xd82(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
mov    0x10(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbx
cmp    $0x1000,%ebx
je     1343 <main+0x153>
lea    0xd53(%rip),%rdi
mov    %rbx,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     137a <main+0x18a>
lea    0xd1c(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     13b4 <main+0x1c4>
lea    0xce2(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     13ee <main+0x1fe>
lea    0xca8(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     1428 <main+0x238>
lea    0xc6e(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     1462 <main+0x272>
lea    0xc34(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     149c <main+0x2ac>
lea    0xbfa(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     14d6 <main+0x2e6>
lea    0xbc0(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    (%r15),%r14d
lea    0xbcd(%rip),%rdi
mov    $0x69,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x4,%eax
je     151e <main+0x32e>
lea    0xb5c(%rip),%rsi
lea    0xbb7(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
add    %rbp,%rbx
mov    %r14d,(%r15)
lea    0xb1c(%rip),%rdi
mov    $0x6a,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x3,%eax
je     1569 <main+0x379>
lea    0xb11(%rip),%rsi
lea    0xb25(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %r14d,(%r15)
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
movslq %eax,%rbp
cmp    $0x1000,%ebp
je     15a3 <main+0x3b3>
lea    0xaf3(%rip),%rdi
mov    %rbp,%rsi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %rbp,%rbx
mov    0x10(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x1000,%eax
je     15d9 <main+0x3e9>
movslq %eax,%rsi
lea    0xaba(%rip),%rdi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    (%r15),%ebx
lea    0xaca(%rip),%rdi
mov    $0x6f,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x4,%eax
je     1621 <main+0x431>
lea    0xa59(%rip),%rsi
lea    0xab4(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
xor    %edi,%edi
call   1030 <_exit@plt>
lea    0xa7b(%rip),%rdi
mov    $0x74,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x3,%eax
je     1670 <main+0x480>
lea    0xa0a(%rip),%rsi
lea    0xa1e(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
lea    0x9cd(%rip),%rdi
mov    $0x75,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x4,%eax
je     16b8 <main+0x4c8>
lea    0x9c2(%rip),%rsi
lea    0xa1d(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
mov    0xc(%rsp),%edi
lea    0x10020(%rsp),%rsi
mov    $0x8000,%edx
xor    %eax,%eax
call   10b0 <read@plt>
mov    %eax,%ebx
lea    0x9f3(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%r15),%ebp
lea    0x9be(%rip),%rdi
mov    $0x7b,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
lea    0x8(%rsp),%rsi
mov    $0x3,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x3,%eax
je     172d <main+0x53d>
lea    0x94d(%rip),%rsi
lea    0x961(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
movslq %ebx,%rbx
mov    %ebp,(%r15)
lea    0x90d(%rip),%rdi
mov    $0x7c,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
xor    %r12d,%r12d
lea    0x14(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x4,%eax
je     177b <main+0x58b>
lea    0x8ff(%rip),%rsi
lea    0x95a(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebp,(%r15)
mov    0xc(%rsp),%edi
lea    (%rsp,%rbx,1),%rsi
add    $0x10020,%rsi
mov    $0x2000,%edx
xor    %eax,%eax
call   10b0 <read@plt>
movslq %eax,%rsi
add    %rsi,%rbx
lea    0x938(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x20(%rsp),%rdi
lea    0x10020(%rsp),%rsi
mov    %rbx,%rdx
call   10c0 <memcmp@plt>
test   %rax,%rax
je     180f <main+0x61f>
test   %rbx,%rbx
je     180f <main+0x61f>
lea    0x920(%rip),%r15
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    17e9 <main+0x5f9>
nopw   0x0(%rax,%rax,1)
add    $0x1,%rbp
cmp    %rbp,%rbx
je     180f <main+0x61f>
movsbl 0x20(%rsp,%rbp,1),%edx
movsbl 0x10020(%rsp,%rbp,1),%ecx
cmp    %cl,%dl
je     17e0 <main+0x5f0>
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r12d
jmp    17e0 <main+0x5f0>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <waitpid@plt>
cmp    $0x1,%r12d
je     183d <main+0x64d>
cmp    $0xa000,%rbx
jne    183d <main+0x64d>
lea    0x8f0(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1100 <exit@plt>
lea    0x8d6(%rip),%rsi
mov    $0x1,%edi
call   1070 <errx@plt>
xor    %edi,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@__const.main.go = [3 x i8] c"go\00"
@__const.main.go2 = [4 x i8] c"go2\00"
@.str = [28 x i8] c"Couldn't allocate data pipe\00"
@.str.1 = [40 x i8] c"Couldn't allocate IPC coordination pipe\00"
@errno = global i32 0
@.str.2 = [32 x i8] c"%d: waiting for synchronization\00"
@.str.3 = [27 x i8] c"failed to synchronize (%s)\00"
@.str.4 = [7 x i8] c"parent\00"
@.str.5 = [36 x i8] c"short write; wrote %zd, expected %d\00"
@.str.6 = [28 x i8] c"%d: sending synchronization\00"
@.str.7 = [6 x i8] c"child\00"
@.str.8 = [15 x i8] c"Read %d bytes\0A\00"
@.str.9 = [21 x i8] c"Read %d bytes, done\0A\00"
@.str.10 = [39 x i8] c"Location %zu input: %hhx output: %hhx\0A\00"
@.str.11 = [7 x i8] c"FAILED\00"
@.str.12 = [9 x i8] c"SUCCESS\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [65535 x i8]
%3 = alloca [65535 x i8]
%4 = alloca [3 x i8]
%5 = alloca [4 x i8]
%6 = alloca [2 x i32]
%7 = alloca [2 x i32]
%8 = alloca i64
%9 = alloca i64
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i32
%16 = alloca i32
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
store i32 0, i32* %1
%23 = bitcast [3 x i8]* %4 to i8*
%24 = bitcast [4 x i8]* %5 to i8*
store i32 0, i32* %10
store i64 0, i64* %9
%25 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%26 = call i32 @pipe(i32* %25)
store i32 %26, i32* %11
%27 = load i32, i32* %11
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %0
%30 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %31
31: ; preds = %29, %0
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%33 = call i32 @pipe(i32* %32)
store i32 %33, i32* %11
%34 = load i32, i32* %11
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
%39 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 0
store i8 65, i8* %39
store i64 1, i64* %8
br label %40
40: ; preds = %62, %38
%41 = load i64, i64* %8
%42 = icmp ult i64 %41, 65535
br i1 %42, label %43, label %65
43: ; preds = %40
%44 = load i64, i64* %8
%45 = sub i64 %44, 1
%46 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %45
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = add nsw i32 %48, 1
%50 = trunc i32 %49 to i8
%51 = load i64, i64* %8
%52 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %51
store i8 %50, i8* %52
%53 = load i64, i64* %8
%54 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp sgt i32 %56, 90
br i1 %57, label %58, label %61
58: ; preds = %43
%59 = load i64, i64* %8
%60 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %59
store i8 65, i8* %60
br label %61
61: ; preds = %58, %43
br label %62
62: ; preds = %61
%63 = load i64, i64* %8
%64 = add i64 %63, 1
store i64 %64, i64* %8
br label %40
65: ; preds = %40
%66 = call i32 (...) @fork()
store i32 %66, i32* %12
%67 = load i32, i32* %12
%68 = icmp ne i32 %67, -1
%69 = zext i1 %68 to i32
%70 = call i32 @assert(i32 %69)
%71 = load i32, i32* %12
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %175
73: ; preds = %65
br label %74
74: ; preds = %73
%75 = load i32, i32* @errno
store i32 %75, i32* %13
%76 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 101)
%77 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%78 = load i32, i32* %77
%79 = call i32 (i32, ...) @read(i32 %78, [3 x i8]* %4, i64 3)
%80 = sext i32 %79 to i64
%81 = icmp ne i64 %80, 3
br i1 %81, label %82, label %84
82: ; preds = %74
%83 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %84
84: ; preds = %82, %74
%85 = load i32, i32* %13
store i32 %85, i32* @errno
br label %86
86: ; preds = %84
store i64 0, i64* %8
br label %87
87: ; preds = %107, %86
%88 = load i64, i64* %8
%89 = icmp ult i64 %88, 8
br i1 %89, label %90, label %110
90: ; preds = %87
br label %91
91: ; preds = %90
%92 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%93 = load i32, i32* %92
%94 = load i64, i64* %9
%95 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %94
%96 = call i32 (i32, ...) @write(i32 %93, i8* %95, i32 4096)
%97 = sext i32 %96 to i64
store i64 %97, i64* %14
%98 = icmp ne i64 %97, 4096
br i1 %98, label %99, label %102
99: ; preds = %91
%100 = load i64, i64* %14
%101 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %100, i32 4096)
br label %102
102: ; preds = %99, %91
%103 = load i64, i64* %14
%104 = load i64, i64* %9
%105 = add i64 %104, %103
store i64 %105, i64* %9
br label %106
106: ; preds = %102
br label %107
107: ; preds = %106
%108 = load i64, i64* %8
%109 = add i64 %108, 1
store i64 %109, i64* %8
br label %87
110: ; preds = %87
br label %111
111: ; preds = %110
%112 = load i32, i32* @errno
store i32 %112, i32* %15
%113 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 105)
%114 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%115 = load i32, i32* %114
%116 = call i32 (i32, ...) @write(i32 %115, [4 x i8]* %5, i64 4)
%117 = sext i32 %116 to i64
%118 = icmp ne i64 %117, 4
br i1 %118, label %119, label %121
119: ; preds = %111
%120 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %121
121: ; preds = %119, %111
%122 = load i32, i32* %15
store i32 %122, i32* @errno
br label %123
123: ; preds = %121
br label %124
124: ; preds = %123
%125 = load i32, i32* @errno
store i32 %125, i32* %16
%126 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 106)
%127 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%128 = load i32, i32* %127
%129 = call i32 (i32, ...) @read(i32 %128, [3 x i8]* %4, i64 3)
%130 = sext i32 %129 to i64
%131 = icmp ne i64 %130, 3
br i1 %131, label %132, label %134
132: ; preds = %124
%133 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %134
134: ; preds = %132, %124
%135 = load i32, i32* %16
store i32 %135, i32* @errno
br label %136
136: ; preds = %134
store i64 0, i64* %8
br label %137
137: ; preds = %157, %136
%138 = load i64, i64* %8
%139 = icmp ult i64 %138, 2
br i1 %139, label %140, label %160
140: ; preds = %137
br label %141
141: ; preds = %140
%142 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%143 = load i32, i32* %142
%144 = load i64, i64* %9
%145 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %144
%146 = call i32 (i32, ...) @write(i32 %143, i8* %145, i32 4096)
%147 = sext i32 %146 to i64
store i64 %147, i64* %17
%148 = icmp ne i64 %147, 4096
br i1 %148, label %149, label %152
149: ; preds = %141
%150 = load i64, i64* %17
%151 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %150, i32 4096)
br label %152
152: ; preds = %149, %141
%153 = load i64, i64* %17
%154 = load i64, i64* %9
%155 = add i64 %154, %153
store i64 %155, i64* %9
br label %156
156: ; preds = %152
br label %157
157: ; preds = %156
%158 = load i64, i64* %8
%159 = add i64 %158, 1
store i64 %159, i64* %8
br label %137
160: ; preds = %137
br label %161
161: ; preds = %160
%162 = load i32, i32* @errno
store i32 %162, i32* %18
%163 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 111)
%164 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 0
%165 = load i32, i32* %164
%166 = call i32 (i32, ...) @write(i32 %165, [4 x i8]* %5, i64 4)
%167 = sext i32 %166 to i64
%168 = icmp ne i64 %167, 4
br i1 %168, label %169, label %171
169: ; preds = %161
%170 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %171
171: ; preds = %169, %161
%172 = load i32, i32* %18
store i32 %172, i32* @errno
br label %173
173: ; preds = %171
%174 = call i32 @_exit(i32 0)
unreachable
175: ; preds = %65
br label %176
176: ; preds = %175
%177 = load i32, i32* @errno
store i32 %177, i32* %19
%178 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 116)
%179 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%180 = load i32, i32* %179
%181 = call i32 (i32, ...) @write(i32 %180, [3 x i8]* %4, i64 3)
%182 = sext i32 %181 to i64
%183 = icmp ne i64 %182, 3
br i1 %183, label %184, label %186
184: ; preds = %176
%185 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %186
186: ; preds = %184, %176
%187 = load i32, i32* %19
store i32 %187, i32* @errno
br label %188
188: ; preds = %186
br label %189
189: ; preds = %188
%190 = load i32, i32* @errno
store i32 %190, i32* %20
%191 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 117)
%192 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%193 = load i32, i32* %192
%194 = call i32 (i32, ...) @read(i32 %193, [4 x i8]* %5, i64 4)
%195 = sext i32 %194 to i64
%196 = icmp ne i64 %195, 4
br i1 %196, label %197, label %199
197: ; preds = %189
%198 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %199
199: ; preds = %197, %189
%200 = load i32, i32* %20
store i32 %200, i32* @errno
br label %201
201: ; preds = %199
%202 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%203 = load i32, i32* %202
%204 = call i32 (i32, ...) @read(i32 %203, [65535 x i8]* %3, i32 32768)
store i32 %204, i32* %11
%205 = load i32, i32* %11
%206 = sext i32 %205 to i64
%207 = load i64, i64* %9
%208 = add i64 %207, %206
store i64 %208, i64* %9
%209 = load i32, i32* %11
%210 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %209)
br label %211
211: ; preds = %201
%212 = load i32, i32* @errno
store i32 %212, i32* %21
%213 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 123)
%214 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%215 = load i32, i32* %214
%216 = call i32 (i32, ...) @write(i32 %215, [3 x i8]* %4, i64 3)
%217 = sext i32 %216 to i64
%218 = icmp ne i64 %217, 3
br i1 %218, label %219, label %221
219: ; preds = %211
%220 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %221
221: ; preds = %219, %211
%222 = load i32, i32* %21
store i32 %222, i32* @errno
br label %223
223: ; preds = %221
br label %224
224: ; preds = %223
%225 = load i32, i32* @errno
store i32 %225, i32* %22
%226 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 124)
%227 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%228 = load i32, i32* %227
%229 = call i32 (i32, ...) @read(i32 %228, [4 x i8]* %5, i64 4)
%230 = sext i32 %229 to i64
%231 = icmp ne i64 %230, 4
br i1 %231, label %232, label %234
232: ; preds = %224
%233 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %234
234: ; preds = %232, %224
%235 = load i32, i32* %22
store i32 %235, i32* @errno
br label %236
236: ; preds = %234
%237 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%238 = load i32, i32* %237
%239 = load i64, i64* %9
%240 = getelementptr inbounds [65535 x i8], [65535 x i8]* %3, i64 0, i64 %239
%241 = call i32 (i32, ...) @read(i32 %238, i8* %240, i32 8192)
store i32 %241, i32* %11
%242 = load i32, i32* %11
%243 = sext i32 %242 to i64
%244 = load i64, i64* %9
%245 = add i64 %244, %243
store i64 %245, i64* %9
%246 = load i32, i32* %11
%247 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %246)
%248 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 0
%249 = getelementptr inbounds [65535 x i8], [65535 x i8]* %3, i64 0, i64 0
%250 = load i64, i64* %9
%251 = call i64 @memcmp(i8* %248, i8* %249, i64 %250)
%252 = icmp ne i64 %251, 0
br i1 %252, label %253, label %284
253: ; preds = %236
store i64 0, i64* %8
br label %254
254: ; preds = %280, %253
%255 = load i64, i64* %8
%256 = load i64, i64* %9
%257 = icmp ult i64 %255, %256
br i1 %257, label %258, label %283
258: ; preds = %254
%259 = load i64, i64* %8
%260 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %259
%261 = load i8, i8* %260
%262 = sext i8 %261 to i32
%263 = load i64, i64* %8
%264 = getelementptr inbounds [65535 x i8], [65535 x i8]* %3, i64 0, i64 %263
%265 = load i8, i8* %264
%266 = sext i8 %265 to i32
%267 = icmp ne i32 %262, %266
br i1 %267, label %268, label %279
268: ; preds = %258
store i32 1, i32* %10
%269 = load i64, i64* %8
%270 = load i64, i64* %8
%271 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %270
%272 = load i8, i8* %271
%273 = sext i8 %272 to i32
%274 = load i64, i64* %8
%275 = getelementptr inbounds [65535 x i8], [65535 x i8]* %3, i64 0, i64 %274
%276 = load i8, i8* %275
%277 = sext i8 %276 to i32
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i64 %269, i32 %273, i32 %277)
br label %279
279: ; preds = %268, %258
br label %280
280: ; preds = %279
%281 = load i64, i64* %8
%282 = add i64 %281, 1
store i64 %282, i64* %8
br label %254
283: ; preds = %254
br label %284
284: ; preds = %283, %236
%285 = load i32, i32* %12
%286 = call i32 @waitpid(i32 %285, i32* null, i32 0)
%287 = load i32, i32* %10
%288 = icmp eq i32 %287, 1
br i1 %288, label %292, label %289
289: ; preds = %284
%290 = load i64, i64* %9
%291 = icmp ne i64 %290, 40960
br i1 %291, label %292, label %294
292: ; preds = %289, %284
%293 = call i32 @errx(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %296
294: ; preds = %289
%295 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0))
br label %296
296: ; preds = %294, %292
%297 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@__const.main.go = [3 x i8] c"go\00"
@.str = [28 x i8] c"Couldn't allocate data pipe\00"
@.str.1 = [40 x i8] c"Couldn't allocate IPC coordination pipe\00"
@errno = global i32 0
@.str.2 = [32 x i8] c"%d: waiting for synchronization\00"
@.str.3 = [27 x i8] c"failed to synchronize (%s)\00"
@.str.4 = [7 x i8] c"parent\00"
@.str.5 = [36 x i8] c"short write; wrote %zd, expected %d\00"
@.str.6 = [28 x i8] c"%d: sending synchronization\00"
@.str.7 = [6 x i8] c"child\00"
@.str.8 = [15 x i8] c"Read %d bytes\0A\00"
@.str.9 = [21 x i8] c"Read %d bytes, done\0A\00"
@.str.10 = [39 x i8] c"Location %zu input: %hhx output: %hhx\0A\00"
@.str.11 = [7 x i8] c"FAILED\00"
@str = [8 x i8] c"SUCCESS\00"
define i32 @main() {
%1 = alloca [65535 x i8]
%2 = alloca [65535 x i8]
%3 = alloca [3 x i8]
%4 = alloca i32
%5 = alloca [2 x i32]
%6 = alloca [2 x i32]
%7 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [3 x i8], [3 x i8]* %3, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
store i32 3305319, i32* %4
%11 = bitcast [2 x i32]* %5 to i8*
%12 = bitcast [2 x i32]* %6 to i8*
%13 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 0
%14 = call i32 @pipe(i32* %13)
%15 = icmp eq i32 %14, -1
br i1 %15, label %16, label %18
16: ; preds = %0
%17 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
br label %18
18: ; preds = %16, %0
%19 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 0
%20 = call i32 @pipe(i32* %19)
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %24
22: ; preds = %18
%23 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0))
br label %24
24: ; preds = %22, %18
store i8 65, i8* %7
br label %25
25: ; preds = %25, %24
%26 = phi i8 [ 65, %24 ], [ %36, %25 ]
%27 = phi i64 [ 1, %24 ], [ %37, %25 ]
%28 = add i8 %26, 1
%29 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %27
%30 = icmp sgt i8 %28, 90
%31 = select i1 %30, i8 65, i8 %28
store i8 %31, i8* %29
%32 = add nuw nsw i64 %27, 1
%33 = add i8 %31, 1
%34 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %32
%35 = icmp sgt i8 %33, 90
%36 = select i1 %35, i8 65, i8 %33
store i8 %36, i8* %34
%37 = add nuw nsw i64 %27, 2
%38 = icmp eq i64 %37, 65535
br i1 %38, label %39, label %25
39: ; preds = %25
%40 = call i32 (...) @fork()
%41 = icmp ne i32 %40, -1
%42 = zext i1 %41 to i32
%43 = call i32 @assert(i32 %42)
%44 = icmp eq i32 %40, 0
%45 = load i32, i32* @errno
br i1 %44, label %46, label %166
46: ; preds = %39
%47 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 101)
%48 = load i32, i32* %19
%49 = call i32 (i32, ...) @read(i32 %48, [3 x i8]* %3, i64 3)
%50 = icmp eq i32 %49, 3
br i1 %50, label %53, label %51
51: ; preds = %46
%52 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %53
53: ; preds = %51, %46
store i32 %45, i32* @errno
%54 = getelementptr inbounds [2 x i32], [2 x i32]* %5, i64 0, i64 1
%55 = load i32, i32* %54
%56 = call i32 (i32, ...) @write(i32 %55, i8* %7, i32 4096)
%57 = sext i32 %56 to i64
%58 = icmp eq i32 %56, 4096
br i1 %58, label %61, label %59
59: ; preds = %53
%60 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %57, i32 4096)
br label %61
61: ; preds = %59, %53
%62 = load i32, i32* %54
%63 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %57
%64 = call i32 (i32, ...) @write(i32 %62, i8* %63, i32 4096)
%65 = sext i32 %64 to i64
%66 = icmp eq i32 %64, 4096
br i1 %66, label %69, label %67
67: ; preds = %61
%68 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %65, i32 4096)
br label %69
69: ; preds = %67, %61
%70 = add nsw i64 %57, %65
%71 = load i32, i32* %54
%72 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %70
%73 = call i32 (i32, ...) @write(i32 %71, i8* %72, i32 4096)
%74 = sext i32 %73 to i64
%75 = icmp eq i32 %73, 4096
br i1 %75, label %78, label %76
76: ; preds = %69
%77 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %74, i32 4096)
br label %78
78: ; preds = %76, %69
%79 = add nsw i64 %70, %74
%80 = load i32, i32* %54
%81 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %79
%82 = call i32 (i32, ...) @write(i32 %80, i8* %81, i32 4096)
%83 = sext i32 %82 to i64
%84 = icmp eq i32 %82, 4096
br i1 %84, label %87, label %85
85: ; preds = %78
%86 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %83, i32 4096)
br label %87
87: ; preds = %85, %78
%88 = add nsw i64 %79, %83
%89 = load i32, i32* %54
%90 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %88
%91 = call i32 (i32, ...) @write(i32 %89, i8* %90, i32 4096)
%92 = sext i32 %91 to i64
%93 = icmp eq i32 %91, 4096
br i1 %93, label %96, label %94
94: ; preds = %87
%95 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %92, i32 4096)
br label %96
96: ; preds = %94, %87
%97 = add nsw i64 %88, %92
%98 = load i32, i32* %54
%99 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %97
%100 = call i32 (i32, ...) @write(i32 %98, i8* %99, i32 4096)
%101 = sext i32 %100 to i64
%102 = icmp eq i32 %100, 4096
br i1 %102, label %105, label %103
103: ; preds = %96
%104 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %101, i32 4096)
br label %105
105: ; preds = %103, %96
%106 = add nsw i64 %97, %101
%107 = load i32, i32* %54
%108 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %106
%109 = call i32 (i32, ...) @write(i32 %107, i8* %108, i32 4096)
%110 = sext i32 %109 to i64
%111 = icmp eq i32 %109, 4096
br i1 %111, label %114, label %112
112: ; preds = %105
%113 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %110, i32 4096)
br label %114
114: ; preds = %112, %105
%115 = add nsw i64 %106, %110
%116 = load i32, i32* %54
%117 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %115
%118 = call i32 (i32, ...) @write(i32 %116, i8* %117, i32 4096)
%119 = sext i32 %118 to i64
%120 = icmp eq i32 %118, 4096
br i1 %120, label %123, label %121
121: ; preds = %114
%122 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %119, i32 4096)
br label %123
123: ; preds = %121, %114
%124 = add nsw i64 %115, %119
%125 = load i32, i32* @errno
%126 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 105)
%127 = load i32, i32* %19
%128 = call i32 (i32, ...) @write(i32 %127, i32* %4, i64 4)
%129 = icmp eq i32 %128, 4
br i1 %129, label %132, label %130
130: ; preds = %123
%131 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %132
132: ; preds = %130, %123
store i32 %125, i32* @errno
%133 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 106)
%134 = load i32, i32* %19
%135 = call i32 (i32, ...) @read(i32 %134, [3 x i8]* %3, i64 3)
%136 = icmp eq i32 %135, 3
br i1 %136, label %139, label %137
137: ; preds = %132
%138 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %139
139: ; preds = %137, %132
store i32 %125, i32* @errno
%140 = load i32, i32* %54
%141 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %124
%142 = call i32 (i32, ...) @write(i32 %140, i8* %141, i32 4096)
%143 = sext i32 %142 to i64
%144 = icmp eq i32 %142, 4096
br i1 %144, label %147, label %145
145: ; preds = %139
%146 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %143, i32 4096)
br label %147
147: ; preds = %145, %139
%148 = add nsw i64 %124, %143
%149 = load i32, i32* %54
%150 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %148
%151 = call i32 (i32, ...) @write(i32 %149, i8* %150, i32 4096)
%152 = icmp eq i32 %151, 4096
br i1 %152, label %156, label %153
153: ; preds = %147
%154 = sext i32 %151 to i64
%155 = call i32 @warn(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i64 %154, i32 4096)
br label %156
156: ; preds = %153, %147
%157 = load i32, i32* @errno
%158 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 111)
%159 = load i32, i32* %19
%160 = call i32 (i32, ...) @write(i32 %159, i32* %4, i64 4)
%161 = icmp eq i32 %160, 4
br i1 %161, label %164, label %162
162: ; preds = %156
%163 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %164
164: ; preds = %162, %156
store i32 %157, i32* @errno
%165 = call i32 @_exit(i32 0)
unreachable
166: ; preds = %39
%167 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 116)
%168 = getelementptr inbounds [2 x i32], [2 x i32]* %6, i64 0, i64 1
%169 = load i32, i32* %168
%170 = call i32 (i32, ...) @write(i32 %169, [3 x i8]* %3, i64 3)
%171 = icmp eq i32 %170, 3
br i1 %171, label %174, label %172
172: ; preds = %166
%173 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %174
174: ; preds = %172, %166
store i32 %45, i32* @errno
%175 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 117)
%176 = load i32, i32* %168
%177 = call i32 (i32, ...) @read(i32 %176, i32* %4, i64 4)
%178 = icmp eq i32 %177, 4
br i1 %178, label %181, label %179
179: ; preds = %174
%180 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %181
181: ; preds = %179, %174
store i32 %45, i32* @errno
%182 = load i32, i32* %13
%183 = call i32 (i32, ...) @read(i32 %182, [65535 x i8]* %2, i32 32768)
%184 = sext i32 %183 to i64
%185 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0), i32 %183)
%186 = load i32, i32* @errno
%187 = call i32 @warnx(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 123)
%188 = load i32, i32* %168
%189 = call i32 (i32, ...) @write(i32 %188, [3 x i8]* %3, i64 3)
%190 = icmp eq i32 %189, 3
br i1 %190, label %193, label %191
191: ; preds = %181
%192 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %193
193: ; preds = %191, %181
store i32 %186, i32* @errno
%194 = call i32 @warnx(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32 124)
%195 = load i32, i32* %168
%196 = call i32 (i32, ...) @read(i32 %195, i32* %4, i64 4)
%197 = icmp eq i32 %196, 4
br i1 %197, label %200, label %198
198: ; preds = %193
%199 = call i32 (i32, i8*, ...) @err(i32 1, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.7, i64 0, i64 0))
br label %200
200: ; preds = %198, %193
store i32 %186, i32* @errno
%201 = load i32, i32* %13
%202 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %184
%203 = call i32 (i32, ...) @read(i32 %201, i8* %202, i32 8192)
%204 = sext i32 %203 to i64
%205 = add nsw i64 %204, %184
%206 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %203)
%207 = call i64 @memcmp(i8* %7, i8* %8, i64 %205)
%208 = icmp ne i64 %207, 0
%209 = icmp ne i64 %205, 0
%210 = select i1 %208, i1 %209, i1 false
br i1 %210, label %211, label %227
211: ; preds = %200, %223
%212 = phi i64 [ %225, %223 ], [ 0, %200 ]
%213 = phi i32 [ %224, %223 ], [ 0, %200 ]
%214 = getelementptr inbounds [65535 x i8], [65535 x i8]* %1, i64 0, i64 %212
%215 = load i8, i8* %214
%216 = getelementptr inbounds [65535 x i8], [65535 x i8]* %2, i64 0, i64 %212
%217 = load i8, i8* %216
%218 = icmp eq i8 %215, %217
br i1 %218, label %223, label %219
219: ; preds = %211
%220 = sext i8 %217 to i32
%221 = sext i8 %215 to i32
%222 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.10, i64 0, i64 0), i64 %212, i32 %221, i32 %220)
br label %223
223: ; preds = %211, %219
%224 = phi i32 [ 1, %219 ], [ %213, %211 ]
%225 = add nuw i64 %212, 1
%226 = icmp eq i64 %225, %205
br i1 %226, label %227, label %211
227: ; preds = %223, %200
%228 = phi i32 [ 0, %200 ], [ %224, %223 ]
%229 = call i32 @waitpid(i32 %40, i32* null, i32 0)
%230 = icmp eq i32 %228, 1
%231 = icmp ne i64 %205, 40960
%232 = select i1 %230, i1 true, i1 %231
br i1 %232, label %233, label %235
233: ; preds = %227
%234 = call i32 @errx(i32 1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.11, i64 0, i64 0))
br label %237
235: ; preds = %227
%236 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str, i64 0, i64 0))
br label %237
237: ; preds = %235, %233
%238 = call i32 @exit(i32 0)
unreachable
}