#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 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 *, int);
int pipe(int *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, ...);
int /*<<< orphan*/ waitpid(int, int /*<<< orphan*/ *, int /*<<< orphan*/);
int /*<<< orphan*/ warn(char *, int, int);
int /*<<< orphan*/ warnx(char *, int);
int write(int, ...);
int main(void) {
  char buffer[32768], buffer2[32768], go[] = "go", go2[] = "go2";
  int desc[2], ipc_coord[2];
  ssize_t error, total;
  int buggy, i;
  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 {
      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 {
      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 {
      ssize_t _size;
      if ((_size = write(desc[1], &buffer[total], 4000)) != 4000)
        warn("short write; wrote %zd, expected %d", _size, 4000);
      total += _size;
    } while (0);
    do {
      int _error = errno;
      warnx("%d: sending synchronization", 102);
      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", 104);
      if (read(ipc_coord[0], &go, sizeof(go)) != sizeof(go))
        err(1, "failed to synchronize (%s)", (0 == 0 ? "parent" : "child"));
      errno = _error;
    } while (0);
    do {
      ssize_t _size;
      if ((_size = write(desc[1], &buffer[total], 3000)) != 3000)
        warn("short write; wrote %zd, expected %d", _size, 3000);
      total += _size;
    } while (0);
    do {
      ssize_t _size;
      if ((_size = write(desc[1], &buffer[total], 3000)) != 3000)
        warn("short write; wrote %zd, expected %d", _size, 3000);
      total += _size;
    } while (0);
    do {
      int _error = errno;
      warnx("%d: sending synchronization", 107);
      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: waiting for synchronization", 112);
    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, 8192);
  total += error;
  printf("Read %zd bytes\n", error);
  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[total], 16384);
  total += error;
  printf("Read %zd bytes, done\n", error);
  if (memcmp(buffer, buffer2, total) != 0) {
    for (i = 0; i < total; i++) {
      if (buffer[i] != buffer2[i]) {
        buggy = 1;
        printf("Location %d input: %hhx output: %hhx\n", i, buffer[i],
               buffer2[i]);
      }
    }
  }
  waitpid(new_pid, NULL, 0);
  if (buggy)
    errx(1, "FAILURE");
  printf("SUCCESS\n");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10070,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xe07(%rip),%ax
mov    %ax,-0x10013(%rbp)
mov    0xdfc(%rip),%al
mov    %al,-0x10011(%rbp)
mov    0xdf1(%rip),%eax
mov    %eax,-0x10017(%rbp)
movl   $0x0,-0x10034(%rbp)
movl   $0x0,-0x10030(%rbp)
lea    -0x10020(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0x1002c(%rbp)
cmpl   $0xffffffff,-0x1002c(%rbp)
jne    125e <main+0x7e>
mov    $0x1,%edi
lea    0xdb0(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
lea    -0x10028(%rbp),%rdi
call   1090 <pipe@plt>
mov    %eax,-0x1002c(%rbp)
cmpl   $0xffffffff,-0x1002c(%rbp)
jne    1290 <main+0xb0>
mov    $0x1,%edi
lea    0xd9a(%rip),%rsi
mov    $0x0,%al
call   10d0 <err@plt>
movb   $0x41,-0x8010(%rbp)
movl   $0x1,-0x10038(%rbp)
cmpl   $0x8000,-0x10038(%rbp)
jge    1317 <main+0x137>
mov    -0x10038(%rbp),%eax
sub    $0x1,%eax
cltq
movsbl -0x8010(%rbp,%rax,1),%eax
ff
add    $0x1,%eax
mov    %al,%cl
movslq -0x10038(%rbp),%rax
mov    %cl,-0x8010(%rbp,%rax,1)
movslq -0x10038(%rbp),%rax
movsbl -0x8010(%rbp,%rax,1),%eax
ff
cmp    $0x5a,%eax
jle    12fe <main+0x11e>
movslq -0x10038(%rbp),%rax
movb   $0x41,-0x8010(%rbp,%rax,1)
41
jmp    1303 <main+0x123>
mov    -0x10038(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10038(%rbp)
jmp    12a1 <main+0xc1>
mov    $0x0,%al
call   1100 <fork@plt>
mov    %eax,-0x1003c(%rbp)
cmpl   $0xffffffff,-0x1003c(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   10c0 <assert@plt>
cmpl   $0x0,-0x1003c(%rbp)
jne    168f <main+0x4af>
jmp    134a <main+0x16a>
mov    -0x1001c(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x8010(%rbp),%rsi
add    %rax,%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x10040(%rbp)
cmp    $0x1000,%eax
je     1395 <main+0x1b5>
mov    -0x10040(%rbp),%esi
lea    0xcc0(%rip),%rdi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    -0x10040(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
jmp    13ac <main+0x1cc>
mov    -0x1001c(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x8010(%rbp),%rsi
add    %rax,%rsi
mov    $0x1000,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x10044(%rbp)
cmp    $0x1000,%eax
je     13f7 <main+0x217>
mov    -0x10044(%rbp),%esi
lea    0xc5e(%rip),%rdi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    -0x10044(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
jmp    140e <main+0x22e>
mov    -0x1001c(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x8010(%rbp),%rsi
add    %rax,%rsi
mov    $0xfa0,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x10048(%rbp)
cmp    $0xfa0,%eax
je     1459 <main+0x279>
mov    -0x10048(%rbp),%esi
lea    0xbfc(%rip),%rdi
mov    $0xfa0,%edx
call   1040 <warn@plt>
mov    -0x10048(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
jmp    1470 <main+0x290>
mov    0x2b69(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1004c(%rbp)
lea    0xbe9(%rip),%rdi
mov    $0x66,%esi
call   1080 <warnx@plt>
mov    -0x10028(%rbp),%edi
lea    -0x10017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
je     14cf <main+0x2ef>
mov    $0x1,%edi
lea    0xbca(%rip),%rsi
lea    0xbde(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x1004c(%rbp),%ecx
mov    0x2b04(%rip),%rax
mov    %ecx,(%rax)
jmp    14e3 <main+0x303>
mov    0x2af6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10050(%rbp)
lea    0xbb3(%rip),%rdi
mov    $0x68,%esi
call   1080 <warnx@plt>
mov    -0x10028(%rbp),%edi
lea    -0x10013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x3,%rax
je     1542 <main+0x362>
mov    $0x1,%edi
lea    0xb57(%rip),%rsi
lea    0xb91(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10050(%rbp),%ecx
mov    0x2a91(%rip),%rax
mov    %ecx,(%rax)
jmp    1556 <main+0x376>
mov    -0x1001c(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x8010(%rbp),%rsi
add    %rax,%rsi
mov    $0xbb8,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x10054(%rbp)
cmp    $0xbb8,%eax
je     15a1 <main+0x3c1>
mov    -0x10054(%rbp),%esi
lea    0xab4(%rip),%rdi
mov    $0xbb8,%edx
call   1040 <warn@plt>
mov    -0x10054(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
jmp    15b8 <main+0x3d8>
mov    -0x1001c(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x8010(%rbp),%rsi
add    %rax,%rsi
mov    $0xbb8,%edx
mov    $0x0,%al
call   1050 <write@plt>
mov    %eax,-0x10058(%rbp)
cmp    $0xbb8,%eax
je     1603 <main+0x423>
mov    -0x10058(%rbp),%esi
lea    0xa52(%rip),%rdi
mov    $0xbb8,%edx
call   1040 <warn@plt>
mov    -0x10058(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
jmp    161a <main+0x43a>
mov    0x29bf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x1005c(%rbp)
lea    0xa3f(%rip),%rdi
mov    $0x6b,%esi
call   1080 <warnx@plt>
mov    -0x10028(%rbp),%edi
lea    -0x10017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x4,%rax
je     1679 <main+0x499>
mov    $0x1,%edi
lea    0xa20(%rip),%rsi
lea    0xa34(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x1005c(%rbp),%ecx
mov    0x295a(%rip),%rax
mov    %ecx,(%rax)
xor    %edi,%edi
call   1030 <_exit@plt>
jmp    1694 <main+0x4b4>
mov    0x2945(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10060(%rbp)
lea    0xa02(%rip),%rdi
mov    $0x70,%esi
call   1080 <warnx@plt>
mov    -0x10024(%rbp),%edi
lea    -0x10017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x4,%rax
je     16f3 <main+0x513>
mov    $0x1,%edi
lea    0x9a6(%rip),%rsi
lea    0x9ba(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10060(%rbp),%ecx
mov    0x28e0(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10020(%rbp),%edi
lea    -0x10010(%rbp),%rsi
mov    $0x2000,%edx
mov    $0x0,%al
call   10a0 <read@plt>
mov    %eax,-0x1002c(%rbp)
mov    -0x1002c(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
mov    -0x1002c(%rbp),%esi
lea    0x993(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2892(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10064(%rbp)
lea    0x912(%rip),%rdi
mov    $0x74,%esi
call   1080 <warnx@plt>
mov    -0x10024(%rbp),%edi
lea    -0x10013(%rbp),%rsi
mov    $0x3,%edx
mov    $0x0,%al
call   1050 <write@plt>
cltq
cmp    $0x3,%rax
je     17a6 <main+0x5c6>
mov    $0x1,%edi
lea    0x8f3(%rip),%rsi
lea    0x92d(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10064(%rbp),%ecx
mov    0x282d(%rip),%rax
mov    %ecx,(%rax)
jmp    17ba <main+0x5da>
mov    0x281f(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10068(%rbp)
lea    0x8dc(%rip),%rdi
mov    $0x75,%esi
call   1080 <warnx@plt>
mov    -0x10024(%rbp),%edi
lea    -0x10017(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   10a0 <read@plt>
cltq
cmp    $0x4,%rax
je     1819 <main+0x639>
mov    $0x1,%edi
lea    0x880(%rip),%rsi
lea    0x894(%rip),%rdx
mov    $0x0,%al
call   10d0 <err@plt>
mov    -0x10068(%rbp),%ecx
mov    0x27ba(%rip),%rax
mov    %ecx,(%rax)
mov    -0x10020(%rbp),%edi
movslq -0x10030(%rbp),%rax
lea    -0x10010(%rbp),%rsi
add    %rax,%rsi
mov    $0x4000,%edx
mov    $0x0,%al
call   10a0 <read@plt>
mov    %eax,-0x1002c(%rbp)
mov    -0x1002c(%rbp),%eax
add    -0x10030(%rbp),%eax
mov    %eax,-0x10030(%rbp)
mov    -0x1002c(%rbp),%esi
lea    0x873(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x8010(%rbp),%rdi
lea    -0x10010(%rbp),%rsi
mov    -0x10030(%rbp),%edx
call   10b0 <memcmp@plt>
cmp    $0x0,%rax
je     1936 <main+0x756>
movl   $0x0,-0x10038(%rbp)
mov    -0x10038(%rbp),%eax
cmp    -0x10030(%rbp),%eax
jge    1931 <main+0x751>
movslq -0x10038(%rbp),%rax
movsbl -0x8010(%rbp,%rax,1),%eax
ff
movslq -0x10038(%rbp),%rcx
movsbl -0x10010(%rbp,%rcx,1),%ecx
ff
cmp    %ecx,%eax
je     1918 <main+0x738>
movl   $0x1,-0x10034(%rbp)
mov    -0x10038(%rbp),%esi
movslq -0x10038(%rbp),%rax
movsbl -0x8010(%rbp,%rax,1),%edx
ff
movslq -0x10038(%rbp),%rax
movsbl -0x10010(%rbp,%rax,1),%ecx
ff
lea    0x7e8(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    191d <main+0x73d>
mov    -0x10038(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10038(%rbp)
jmp    18a4 <main+0x6c4>
jmp    1936 <main+0x756>
mov    -0x1003c(%rbp),%edi
xor    %eax,%eax
mov    %eax,%esi
xor    %edx,%edx
call   10e0 <waitpid@plt>
cmpl   $0x0,-0x10034(%rbp)
je     1965 <main+0x785>
mov    $0x1,%edi
lea    0x7bf(%rip),%rsi
call   1060 <errx@plt>
lea    0x7bb(%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    $0x10020,%rsp
movb   $0x0,0xa(%rsp)
movw   $0x6f67,0x8(%rsp)
movl   $0x326f67,0xc(%rsp)
lea    0x10(%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    $0x4,%eax
jmp    1278 <main+0x88>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %dl,0x20(%rsp,%rax,1)
add    $0x4,%rax
add    $0x1,%dl
mov    $0x41,%ecx
mov    $0x41,%esi
cmp    $0x5b,%dl
jge    128d <main+0x9d>
movzbl %dl,%esi
mov    %sil,0x1d(%rsp,%rax,1)
add    $0x1,%sil
mov    $0x41,%edx
cmp    $0x5b,%sil
jge    12a5 <main+0xb5>
movzbl %sil,%edx
mov    %dl,0x1e(%rsp,%rax,1)
add    $0x1,%dl
cmp    $0x5b,%dl
jge    12b4 <main+0xc4>
movzbl %dl,%ecx
mov    %cl,0x1f(%rsp,%rax,1)
cmp    $0x8000,%rax
je     12d2 <main+0xe2>
add    $0x1,%cl
mov    $0x41,%edx
cmp    $0x5b,%cl
jge    1270 <main+0x80>
movzbl %cl,%edx
jmp    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>
test   %r14d,%r14d
jne    14f0 <main+0x300>
mov    0x14(%rsp),%edi
lea    0x20(%rsp),%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
mov    %eax,%ebx
cmp    $0x1000,%eax
je     1324 <main+0x134>
lea    0xd2f(%rip),%rdi
mov    %ebx,%esi
mov    $0x1000,%edx
call   1040 <warn@plt>
mov    0x14(%rsp),%edi
movslq %ebx,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x20,%rsi
mov    $0x1000,%edx
xor    %eax,%eax
call   1060 <write@plt>
mov    %eax,%ebp
cmp    $0x1000,%eax
je     135b <main+0x16b>
lea    0xcf8(%rip),%rdi
mov    %ebp,%esi
mov    $0x1000,%edx
call   1040 <warn@plt>
add    %ebx,%ebp
mov    0x14(%rsp),%edi
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x20,%rsi
mov    $0xfa0,%edx
xor    %eax,%eax
call   1060 <write@plt>
mov    %eax,%ebx
cmp    $0xfa0,%eax
je     1394 <main+0x1a4>
lea    0xcbf(%rip),%rdi
mov    %ebx,%esi
mov    $0xfa0,%edx
call   1040 <warn@plt>
mov    0x2c45(%rip),%r14
mov    (%r14),%r15d
lea    0xcc6(%rip),%rdi
mov    $0x66,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x4,%eax
je     13e3 <main+0x1f3>
lea    0xcb7(%rip),%rsi
lea    0xccb(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
add    %ebp,%ebx
mov    %r15d,(%r14)
lea    0xcb9(%rip),%rdi
mov    $0x68,%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     142d <main+0x23d>
lea    0xc6d(%rip),%rsi
lea    0xca7(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %r15d,(%r14)
mov    0x14(%rsp),%edi
movslq %ebx,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x20,%rsi
mov    $0xbb8,%edx
xor    %eax,%eax
call   1060 <write@plt>
mov    %eax,%ebp
cmp    $0xbb8,%eax
je     1467 <main+0x277>
lea    0xbec(%rip),%rdi
mov    %ebp,%esi
mov    $0xbb8,%edx
call   1040 <warn@plt>
add    %ebx,%ebp
mov    0x14(%rsp),%edi
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x20,%rsi
mov    $0xbb8,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0xbb8,%eax
je     149e <main+0x2ae>
lea    0xbb5(%rip),%rdi
mov    %eax,%esi
mov    $0xbb8,%edx
call   1040 <warn@plt>
mov    (%r14),%ebx
lea    0xbc3(%rip),%rdi
mov    $0x6b,%esi
call   1090 <warnx@plt>
mov    0x18(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   1060 <write@plt>
cmp    $0x4,%eax
je     14e6 <main+0x2f6>
lea    0xbb4(%rip),%rsi
lea    0xbc8(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r14)
xor    %edi,%edi
call   1030 <_exit@plt>
mov    0x2ae9(%rip),%r15
mov    (%r15),%ebx
lea    0xba7(%rip),%rdi
mov    $0x70,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x4,%eax
je     153f <main+0x34f>
lea    0xb5b(%rip),%rsi
lea    0xb6f(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
mov    0x10(%rsp),%edi
lea    0x8020(%rsp),%rsi
mov    $0x2000,%edx
xor    %eax,%eax
call   10b0 <read@plt>
mov    %eax,%ebp
lea    0xb6c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    (%r15),%ebx
lea    0xaf5(%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     15b4 <main+0x3c4>
lea    0xae6(%rip),%rsi
lea    0xb20(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
lea    0xaea(%rip),%rdi
mov    $0x75,%esi
call   1090 <warnx@plt>
mov    0x1c(%rsp),%edi
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
xor    %eax,%eax
call   10b0 <read@plt>
cmp    $0x4,%eax
je     15fc <main+0x40c>
lea    0xa9e(%rip),%rsi
lea    0xab2(%rip),%rdx
mov    $0x1,%edi
xor    %eax,%eax
call   10e0 <err@plt>
mov    %ebx,(%r15)
mov    0x10(%rsp),%edi
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x8020,%rsi
mov    $0x4000,%edx
xor    %eax,%eax
call   10b0 <read@plt>
add    %eax,%ebp
lea    0xab9(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x20(%rsp),%rdi
lea    0x8020(%rsp),%rsi
mov    %ebp,%edx
call   10c0 <memcmp@plt>
test   %rax,%rax
je     168e <main+0x49e>
test   %ebp,%ebp
jle    168e <main+0x49e>
mov    %ebp,%ebp
lea    0xaa0(%rip),%r15
xor    %ebx,%ebx
xor    %r12d,%r12d
jmp    1669 <main+0x479>
nopl   0x0(%rax)
add    $0x1,%rbx
cmp    %rbx,%rbp
je     16ad <main+0x4bd>
movsbl 0x20(%rsp,%rbx,1),%edx
movsbl 0x8020(%rsp,%rbx,1),%ecx
cmp    %cl,%dl
je     1660 <main+0x470>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0x1,%r12d
jmp    1660 <main+0x470>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <waitpid@plt>
lea    0xa82(%rip),%rdi
call   1050 <puts@plt>
xor    %edi,%edi
call   1100 <exit@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   10f0 <waitpid@plt>
test   %r12d,%r12d
je     169a <main+0x4aa>
lea    0xa56(%rip),%rsi
mov    $0x1,%edi
call   1070 <errx@plt>
jmp    169a <main+0x4aa>

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