#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int dup2(int, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ execlp(char *, char *, char *, char *, char *,
                          int /*<<< orphan*/ *);
int /*<<< orphan*/ *fdopen(int, char *);
int /*<<< orphan*/ fflush(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/ *);
int fork();
scalar_t__ fprintf(int /*<<< orphan*/ *, char *, char *);
int pipe(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ *stderr;
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ *stdout;
int strlen(char *);
int /*<<< orphan*/ strncmp(char *, char *, int);
char *strtok(char *, char const *);
int main() {
  int pfd_a[2];
  int pfd_b[2];
  char gnugo_line[128], client_line[128];
  int length = 0;
  int verbose = 1;
  FILE *to_gnugo_stream, *from_gnugo_stream;
  if (pipe(pfd_a) == -1)
    error("can't open pipe a");
  if (pipe(pfd_b) == -1)
    error("can't open pipe b");
  switch (fork()) {
  case -1:
    error("fork failed (try chopsticks)");
  case 0:
    if (dup2(pfd_a[0], 0) == -1)
      error("dup pfd_a[0] failed");
    if (dup2(pfd_b[1], 1) == -1)
      error("dup pfd_b[1] failed");
    execlp("gnugo", "gnugo", "--mode", "gtp", "--quiet", NULL);
    error("execlp failed");
  }
  to_gnugo_stream = fdopen(pfd_a[1], "w");
  from_gnugo_stream = fdopen(pfd_b[0], "r");
  while (1) {
    int length = 0;
    if (!fgets(client_line, 128, stdin) || !strncmp(client_line, "quit", 4)) {
      if (verbose)
        fprintf(stderr, "%s", "quit\n");
      if (fprintf(to_gnugo_stream, "%s", "quit\n") < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      return 1;
    }
    if (!strncmp(client_line, "genmove_black", 13)) {
      char *token;
      const char delimiters[] = " \t\r\n";
      float value1, value2;
      if (verbose)
        fprintf(stderr, "%s", "top_moves_black\n");
      if (fprintf(to_gnugo_stream, "%s", "top_moves_black\n") < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      if (!fgets(gnugo_line, 128, from_gnugo_stream))
        error("can't get response");
      ;
      token = strtok(gnugo_line, delimiters);
      token = strtok(NULL, delimiters);
      if (verbose)
        fprintf(stderr, "%s", "black ");
      if (fprintf(to_gnugo_stream, "%s", "black ") < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      if (verbose)
        fprintf(stderr, "%s", token);
      if (fprintf(to_gnugo_stream, "%s", token) < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      if (verbose)
        fprintf(stderr, "%s", "\n");
      if (fprintf(to_gnugo_stream, "%s", "\n") < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      if (!fgets(gnugo_line, 128, from_gnugo_stream))
        error("can't get response");
      ;
      while (length != 1) {
        if (!fgets(gnugo_line, 128, from_gnugo_stream))
          error("can't get response");
        ;
        length = strlen(gnugo_line);
        printf(gnugo_line);
        fflush(stdout);
      }
    } else {
      if (verbose)
        fprintf(stderr, "%s", client_line);
      if (fprintf(to_gnugo_stream, "%s", client_line) < 0)
        error("can't write command in to_gnugo_stream");
      fflush(to_gnugo_stream);
      ;
      while (length != 1) {
        if (!fgets(gnugo_line, 128, from_gnugo_stream))
          error("can't get response");
        ;
        length = strlen(gnugo_line);
        printf(gnugo_line);
        fflush(stdout);
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x160,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x124(%rbp)
movl   $0x1,-0x128(%rbp)
lea    -0xc(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1214 <main+0x44>
lea    0xdf1(%rip),%rdi
call   10c0 <error@plt>
lea    -0x14(%rbp),%rdi
call   1070 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1232 <main+0x62>
lea    0xde5(%rip),%rdi
call   10c0 <error@plt>
xor    %eax,%eax
call   10f0 <fork@plt>
mov    %eax,%ecx
mov    %ecx,-0x15c(%rbp)
sub    $0xffffffff,%eax
je     1262 <main+0x92>
jmp    124f <main+0x7f>
mov    -0x15c(%rbp),%eax
test   %eax,%eax
je     126e <main+0x9e>
jmp    12e4 <main+0x114>
lea    0xdbb(%rip),%rdi
call   10c0 <error@plt>
mov    -0xc(%rbp),%edi
xor    %esi,%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    128d <main+0xbd>
lea    0xdb9(%rip),%rdi
call   10c0 <error@plt>
mov    -0x10(%rbp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    12af <main+0xdf>
lea    0xdab(%rip),%rdi
call   10c0 <error@plt>
lea    0xdb3(%rip),%rsi
lea    0xdb2(%rip),%rdx
lea    0xdb2(%rip),%rcx
lea    0xdaf(%rip),%r8
xor    %eax,%eax
mov    %eax,%r9d
mov    %rsi,%rdi
call   10e0 <execlp@plt>
lea    0xda3(%rip),%rdi
call   10c0 <error@plt>
mov    -0x8(%rbp),%edi
lea    0xda2(%rip),%rsi
call   10b0 <fdopen@plt>
mov    %rax,-0x130(%rbp)
mov    -0x14(%rbp),%edi
lea    0xd8e(%rip),%rsi
call   10b0 <fdopen@plt>
mov    %rax,-0x138(%rbp)
movl   $0x0,-0x13c(%rbp)
lea    -0x120(%rbp),%rdi
mov    0x2cc0(%rip),%rax
mov    (%rax),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
je     135f <main+0x18f>
lea    -0x120(%rbp),%rdi
lea    0xd48(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    13d3 <main+0x203>
cmpl   $0x0,-0x128(%rbp)
je     1389 <main+0x1b9>
mov    0x2c65(%rip),%rax
mov    (%rax),%rdi
lea    0xd1c(%rip),%rsi
lea    0xd18(%rip),%rdx
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
lea    0xd02(%rip),%rsi
lea    0xcfe(%rip),%rdx
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    13b9 <main+0x1e9>
lea    0xcee(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
mov    $0x1,%eax
add    $0x160,%rsp
pop    %rbp
ret
lea    -0x120(%rbp),%rdi
lea    0xce8(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncmp@plt>
cmp    $0x0,%eax
jne    16a5 <main+0x4d5>
mov    0xcdd(%rip),%eax
mov    %eax,-0x14d(%rbp)
mov    0xcd5(%rip),%al
mov    %al,-0x149(%rbp)
cmpl   $0x0,-0x128(%rbp)
je     1436 <main+0x266>
mov    0x2bb8(%rip),%rax
mov    (%rax),%rdi
lea    0xc6f(%rip),%rsi
lea    0xcab(%rip),%rdx
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
lea    0xc55(%rip),%rsi
lea    0xc91(%rip),%rdx
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    1466 <main+0x296>
lea    0xc41(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    149f <main+0x2cf>
lea    0xc53(%rip),%rdi
call   10c0 <error@plt>
lea    -0xa0(%rbp),%rdi
lea    -0x14d(%rbp),%rsi
call   10d0 <strtok@plt>
mov    %rax,-0x148(%rbp)
lea    -0x14d(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edi
call   10d0 <strtok@plt>
mov    %rax,-0x148(%rbp)
cmpl   $0x0,-0x128(%rbp)
je     14fa <main+0x32a>
mov    0x2af4(%rip),%rax
mov    (%rax),%rdi
lea    0xbab(%rip),%rsi
lea    0xc0b(%rip),%rdx
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
lea    0xb91(%rip),%rsi
lea    0xbf1(%rip),%rdx
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    152a <main+0x35a>
lea    0xb7d(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
cmpl   $0x0,-0x128(%rbp)
je     1560 <main+0x390>
mov    0x2a8e(%rip),%rax
mov    (%rax),%rdi
mov    -0x148(%rbp),%rdx
lea    0xb3e(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
mov    -0x148(%rbp),%rdx
lea    0xb24(%rip),%rsi
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    1590 <main+0x3c0>
lea    0xb17(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
cmpl   $0x0,-0x128(%rbp)
je     15c6 <main+0x3f6>
mov    0x2a28(%rip),%rax
mov    (%rax),%rdi
lea    0xadf(%rip),%rsi
lea    0xb19(%rip),%rdx
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
lea    0xac5(%rip),%rsi
lea    0xaff(%rip),%rdx
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    15f6 <main+0x426>
lea    0xab1(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    162f <main+0x45f>
lea    0xac3(%rip),%rdi
call   10c0 <error@plt>
jmp    1634 <main+0x464>
cmpl   $0x1,-0x13c(%rbp)
je     16a0 <main+0x4d0>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    166e <main+0x49e>
lea    0xa84(%rip),%rdi
call   10c0 <error@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x13c(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <printf@plt>
mov    0x293d(%rip),%rax
mov    (%rax),%rdi
call   10a0 <fflush@plt>
jmp    1634 <main+0x464>
jmp    177c <main+0x5ac>
cmpl   $0x0,-0x128(%rbp)
je     16cf <main+0x4ff>
mov    0x291f(%rip),%rax
mov    (%rax),%rdi
lea    -0x120(%rbp),%rdx
lea    0x9cf(%rip),%rsi
call   1090 <fprintf@plt>
mov    -0x130(%rbp),%rdi
lea    -0x120(%rbp),%rdx
lea    0x9b5(%rip),%rsi
call   1090 <fprintf@plt>
cmp    $0x0,%rax
jge    16ff <main+0x52f>
lea    0x9a8(%rip),%rdi
call   10c0 <error@plt>
mov    -0x130(%rbp),%rdi
call   10a0 <fflush@plt>
cmpl   $0x1,-0x13c(%rbp)
je     1777 <main+0x5a7>
lea    -0xa0(%rbp),%rdi
mov    -0x138(%rbp),%rdx
mov    $0x80,%esi
call   1080 <fgets@plt>
cmp    $0x0,%eax
jne    1745 <main+0x575>
lea    0x9ad(%rip),%rdi
call   10c0 <error@plt>
lea    -0xa0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x13c(%rbp)
lea    -0xa0(%rbp),%rdi
call   1060 <printf@plt>
mov    0x2866(%rip),%rax
mov    (%rax),%rdi
call   10a0 <fflush@plt>
jmp    170b <main+0x53b>
jmp    177c <main+0x5ac>
jmp    1310 <main+0x140>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
lea    0x18(%rsp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    122c <main+0x2c>
lea    0xdd9(%rip),%rdi
call   10e0 <error@plt>
lea    0x10(%rsp),%rdi
call   1080 <pipe@plt>
cmp    $0xffffffff,%eax
jne    1247 <main+0x47>
lea    0xdd0(%rip),%rdi
call   10e0 <error@plt>
xor    %eax,%eax
call   1120 <fork@plt>
test   %eax,%eax
je     1263 <main+0x63>
cmp    $0xffffffff,%eax
jne    12d1 <main+0xd1>
lea    0xdc6(%rip),%rdi
call   10e0 <error@plt>
mov    0x18(%rsp),%edi
xor    %esi,%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    127f <main+0x7f>
lea    0xdc7(%rip),%rdi
call   10e0 <error@plt>
mov    0x14(%rsp),%edi
mov    $0x1,%esi
call   1050 <dup2@plt>
cmp    $0xffffffff,%eax
jne    129e <main+0x9e>
lea    0xdbc(%rip),%rdi
call   10e0 <error@plt>
lea    0xdc4(%rip),%rdi
lea    0xdc3(%rip),%rdx
lea    0xdc3(%rip),%rcx
lea    0xdc0(%rip),%r8
mov    %rdi,%rsi
xor    %r9d,%r9d
call   1110 <execlp@plt>
lea    0xdb6(%rip),%rdi
call   10e0 <error@plt>
mov    0x1c(%rsp),%edi
lea    0xdb4(%rip),%rsi
call   10d0 <fdopen@plt>
mov    %rax,%r14
mov    0x10(%rsp),%edi
lea    0xda3(%rip),%rsi
call   10d0 <fdopen@plt>
mov    %rax,%rbx
mov    0x2cea(%rip),%rax
mov    (%rax),%rdx
lea    0x20(%rsp),%rdi
mov    $0x80,%esi
call   10a0 <fgets@plt>
test   %eax,%eax
je     1612 <main+0x412>
lea    0x20(%rsp),%rbp
lea    0xa0(%rsp),%r13
lea    0xdc1(%rip),%r15
mov    0x2c9d(%rip),%r12
jmp    1364 <main+0x164>
cs nopw 0x0(%rax,%rax,1)
nop
mov    0x2ca1(%rip),%rax
mov    (%rax),%rdx
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x80,%esi
call   10a0 <fgets@plt>
test   %eax,%eax
je     1612 <main+0x412>
mov    %rbp,%rdi
lea    0xd26(%rip),%rsi
mov    $0x4,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1612 <main+0x412>
mov    %rbp,%rdi
lea    0xd3f(%rip),%rsi
mov    $0xd,%edx
call   1030 <strncmp@plt>
test   %eax,%eax
je     1430 <main+0x230>
mov    0x2c35(%rip),%rax
mov    (%rax),%rsi
mov    %rbp,%rdi
call   1070 <fputs@plt>
mov    %r14,%rdi
lea    0xce1(%rip),%rsi
mov    %rbp,%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
jns    13d1 <main+0x1d1>
lea    0xcd6(%rip),%rdi
call   10e0 <error@plt>
mov    %r14,%rdi
call   10c0 <fflush@plt>
jmp    1404 <main+0x204>
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1060 <printf@plt>
mov    (%r12),%rdi
call   10c0 <fflush@plt>
cmp    $0x1,%ebp
je     1340 <main+0x140>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %eax,%eax
jne    13e0 <main+0x1e0>
mov    %r15,%rdi
call   10e0 <error@plt>
jmp    13e0 <main+0x1e0>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0x0,0xc(%rsp)
movl   $0xa0d0920,0x8(%rsp)
0a
mov    0x2b94(%rip),%rax
mov    (%rax),%rcx
mov    $0x10,%esi
mov    $0x1,%edx
lea    0xc84(%rip),%rbp
mov    %rbp,%rdi
call   1100 <fwrite@plt>
mov    %r14,%rdi
lea    0xc2f(%rip),%rsi
mov    %rbp,%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
jns    1483 <main+0x283>
lea    0xc24(%rip),%rdi
call   10e0 <error@plt>
mov    %r14,%rdi
call   10c0 <fflush@plt>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %eax,%eax
mov    %r14,%r15
jne    14ae <main+0x2ae>
lea    0xc44(%rip),%rdi
call   10e0 <error@plt>
mov    %r13,%rdi
lea    0x8(%rsp),%rbp
mov    %rbp,%rsi
call   10f0 <strtok@plt>
xor    %edi,%edi
mov    %rbp,%rsi
call   10f0 <strtok@plt>
mov    %rax,%rbp
mov    0x2b06(%rip),%rax
mov    (%rax),%rcx
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xc1a(%rip),%r14
mov    %r14,%rdi
call   1100 <fwrite@plt>
mov    %r15,%rdi
lea    0xba1(%rip),%rsi
mov    %r14,%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
jns    1511 <main+0x311>
lea    0xb96(%rip),%rdi
call   10e0 <error@plt>
mov    %r15,%rdi
call   10c0 <fflush@plt>
mov    0x2ab8(%rip),%rax
mov    (%rax),%rsi
mov    %rbp,%rdi
call   1070 <fputs@plt>
mov    %r15,%rdi
lea    0xb64(%rip),%rsi
mov    %rbp,%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
mov    %r15,%r14
jns    1551 <main+0x351>
lea    0xb56(%rip),%rdi
call   10e0 <error@plt>
mov    %r14,%rdi
call   10c0 <fflush@plt>
mov    0x2a78(%rip),%rax
mov    (%rax),%rsi
mov    $0xa,%edi
call   1090 <fputc@plt>
mov    %r14,%rdi
lea    0xb22(%rip),%rsi
lea    0xb5c(%rip),%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
lea    0xb60(%rip),%r15
jns    159b <main+0x39b>
lea    0xb0c(%rip),%rdi
call   10e0 <error@plt>
mov    %r14,%rdi
call   10c0 <fflush@plt>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %eax,%eax
jne    15f4 <main+0x3f4>
mov    %r15,%rdi
call   10e0 <error@plt>
jmp    15f4 <main+0x3f4>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r13,%rdi
call   1040 <strlen@plt>
mov    %eax,%ebp
mov    %r13,%rdi
call   1060 <printf@plt>
mov    (%r12),%rdi
call   10c0 <fflush@plt>
cmp    $0x1,%ebp
je     1340 <main+0x140>
mov    %r13,%rdi
mov    $0x80,%esi
mov    %rbx,%rdx
call   10a0 <fgets@plt>
test   %eax,%eax
jne    15d0 <main+0x3d0>
mov    %r15,%rdi
call   10e0 <error@plt>
jmp    15d0 <main+0x3d0>
mov    0x29bf(%rip),%rax
mov    (%rax),%rcx
lea    0xa79(%rip),%rbx
mov    $0x5,%esi
mov    $0x1,%edx
mov    %rbx,%rdi
call   1100 <fwrite@plt>
lea    0xa5d(%rip),%rsi
mov    %r14,%rdi
mov    %rbx,%rdx
call   10b0 <fprintf@plt>
test   %rax,%rax
jns    1658 <main+0x458>
lea    0xa4f(%rip),%rdi
call   10e0 <error@plt>
mov    %r14,%rdi
call   10c0 <fflush@plt>
mov    $0x1,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"can't open pipe a\00"
@.str.1 = [18 x i8] c"can't open pipe b\00"
@.str.2 = [29 x i8] c"fork failed (try chopsticks)\00"
@.str.3 = [20 x i8] c"dup pfd_a[0] failed\00"
@.str.4 = [20 x i8] c"dup pfd_b[1] failed\00"
@.str.5 = [6 x i8] c"gnugo\00"
@.str.6 = [7 x i8] c"--mode\00"
@.str.7 = [4 x i8] c"gtp\00"
@.str.8 = [8 x i8] c"--quiet\00"
@.str.9 = [14 x i8] c"execlp failed\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [2 x i8] c"r\00"
@stdin = global i32* null
@.str.12 = [5 x i8] c"quit\00"
@stderr = global i32* null
@.str.13 = [3 x i8] c"%s\00"
@.str.14 = [6 x i8] c"quit\0A\00"
@.str.15 = [39 x i8] c"can't write command in to_gnugo_stream\00"
@.str.16 = [14 x i8] c"genmove_black\00"
@__const.main.delimiters = [5 x i8] c" \09\0D\0A\00"
@.str.17 = [17 x i8] c"top_moves_black\0A\00"
@.str.18 = [19 x i8] c"can't get response\00"
@.str.19 = [7 x i8] c"black \00"
@.str.20 = [2 x i8] c"\0A\00"
@stdout = global i32* null
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca [2 x i32]
%4 = alloca [128 x i8]
%5 = alloca [128 x i8]
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i8*
%12 = alloca [5 x i8]
%13 = alloca float
%14 = alloca float
store i32 0, i32* %1
store i32 0, i32* %6
store i32 1, i32* %7
%15 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%16 = call i32 @pipe(i32* %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %20
18: ; preds = %0
%19 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %20
20: ; preds = %18, %0
%21 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%22 = call i32 @pipe(i32* %21)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %26
24: ; preds = %20
%25 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %26
26: ; preds = %24, %20
%27 = call i32 (...) @fork()
switch i32 %27, label %47 [
i32 -1, label %28
i32 0, label %30
]
28: ; preds = %26
%29 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %30
30: ; preds = %26, %28
%31 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%32 = load i32, i32* %31
%33 = call i32 @dup2(i32 %32, i32 0)
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %37
35: ; preds = %30
%36 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %37
37: ; preds = %35, %30
%38 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 1
%39 = load i32, i32* %38
%40 = call i32 @dup2(i32 %39, i32 1)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %44
42: ; preds = %37
%43 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %44
44: ; preds = %42, %37
%45 = call i32 @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32* null)
%46 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
br label %47
47: ; preds = %44, %26
%48 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%49 = load i32, i32* %48
%50 = call i32* @fdopen(i32 %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
store i32* %50, i32** %8
%51 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%52 = load i32, i32* %51
%53 = call i32* @fdopen(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %53, i32** %9
br label %54
54: ; preds = %47, %214
store i32 0, i32* %10
%55 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%56 = load i32*, i32** @stdin
%57 = call i32 @fgets(i8* %55, i32 128, i32* %56)
%58 = icmp ne i32 %57, 0
br i1 %58, label %59, label %63
59: ; preds = %54
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%61 = call i32 @strncmp(i8* %60, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 4)
%62 = icmp ne i32 %61, 0
br i1 %62, label %78, label %63
63: ; preds = %59, %54
%64 = load i32, i32* %7
%65 = icmp ne i32 %64, 0
br i1 %65, label %66, label %69
66: ; preds = %63
%67 = load i32*, i32** @stderr
%68 = call i64 @fprintf(i32* %67, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
br label %69
69: ; preds = %66, %63
%70 = load i32*, i32** %8
%71 = call i64 @fprintf(i32* %70, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %69
%74 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %75
75: ; preds = %73, %69
%76 = load i32*, i32** %8
%77 = call i32 @fflush(i32* %76)
ret i32 1
78: ; preds = %59
%79 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%80 = call i32 @strncmp(i8* %79, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0), i32 13)
%81 = icmp ne i32 %80, 0
br i1 %81, label %179, label %82
82: ; preds = %78
%83 = bitcast [5 x i8]* %12 to i8*
%84 = load i32, i32* %7
%85 = icmp ne i32 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %82
%87 = load i32*, i32** @stderr
%88 = call i64 @fprintf(i32* %87, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
br label %89
89: ; preds = %86, %82
%90 = load i32*, i32** %8
%91 = call i64 @fprintf(i32* %90, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %89
%94 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %95
95: ; preds = %93, %89
%96 = load i32*, i32** %8
%97 = call i32 @fflush(i32* %96)
%98 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%99 = load i32*, i32** %9
%100 = call i32 @fgets(i8* %98, i32 128, i32* %99)
%101 = icmp ne i32 %100, 0
br i1 %101, label %104, label %102
102: ; preds = %95
%103 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %104
104: ; preds = %102, %95
%105 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%106 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%107 = call i8* @strtok(i8* %105, i8* %106)
store i8* %107, i8** %11
%108 = getelementptr inbounds [5 x i8], [5 x i8]* %12, i64 0, i64 0
%109 = call i8* @strtok(i8* null, i8* %108)
store i8* %109, i8** %11
%110 = load i32, i32* %7
%111 = icmp ne i32 %110, 0
br i1 %111, label %112, label %115
112: ; preds = %104
%113 = load i32*, i32** @stderr
%114 = call i64 @fprintf(i32* %113, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
br label %115
115: ; preds = %112, %104
%116 = load i32*, i32** %8
%117 = call i64 @fprintf(i32* %116, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
%118 = icmp slt i64 %117, 0
br i1 %118, label %119, label %121
119: ; preds = %115
%120 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %121
121: ; preds = %119, %115
%122 = load i32*, i32** %8
%123 = call i32 @fflush(i32* %122)
%124 = load i32, i32* %7
%125 = icmp ne i32 %124, 0
br i1 %125, label %126, label %130
126: ; preds = %121
%127 = load i32*, i32** @stderr
%128 = load i8*, i8** %11
%129 = call i64 @fprintf(i32* %127, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %128)
br label %130
130: ; preds = %126, %121
%131 = load i32*, i32** %8
%132 = load i8*, i8** %11
%133 = call i64 @fprintf(i32* %131, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %132)
%134 = icmp slt i64 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %130
%136 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %137
137: ; preds = %135, %130
%138 = load i32*, i32** %8
%139 = call i32 @fflush(i32* %138)
%140 = load i32, i32* %7
%141 = icmp ne i32 %140, 0
br i1 %141, label %142, label %145
142: ; preds = %137
%143 = load i32*, i32** @stderr
%144 = call i64 @fprintf(i32* %143, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
br label %145
145: ; preds = %142, %137
%146 = load i32*, i32** %8
%147 = call i64 @fprintf(i32* %146, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
%148 = icmp slt i64 %147, 0
br i1 %148, label %149, label %151
149: ; preds = %145
%150 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %151
151: ; preds = %149, %145
%152 = load i32*, i32** %8
%153 = call i32 @fflush(i32* %152)
%154 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%155 = load i32*, i32** %9
%156 = call i32 @fgets(i8* %154, i32 128, i32* %155)
%157 = icmp ne i32 %156, 0
br i1 %157, label %160, label %158
158: ; preds = %151
%159 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %160
160: ; preds = %158, %151
br label %161
161: ; preds = %171, %160
%162 = load i32, i32* %10
%163 = icmp ne i32 %162, 1
br i1 %163, label %164, label %178
164: ; preds = %161
%165 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%166 = load i32*, i32** %9
%167 = call i32 @fgets(i8* %165, i32 128, i32* %166)
%168 = icmp ne i32 %167, 0
br i1 %168, label %171, label %169
169: ; preds = %164
%170 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %171
171: ; preds = %169, %164
%172 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%173 = call i32 @strlen(i8* %172)
store i32 %173, i32* %10
%174 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%175 = call i32 @printf(i8* %174)
%176 = load i32*, i32** @stdout
%177 = call i32 @fflush(i32* %176)
br label %161
178: ; preds = %161
br label %214
179: ; preds = %78
%180 = load i32, i32* %7
%181 = icmp ne i32 %180, 0
br i1 %181, label %182, label %186
182: ; preds = %179
%183 = load i32*, i32** @stderr
%184 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%185 = call i64 @fprintf(i32* %183, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %184)
br label %186
186: ; preds = %182, %179
%187 = load i32*, i32** %8
%188 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%189 = call i64 @fprintf(i32* %187, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %188)
%190 = icmp slt i64 %189, 0
br i1 %190, label %191, label %193
191: ; preds = %186
%192 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %193
193: ; preds = %191, %186
%194 = load i32*, i32** %8
%195 = call i32 @fflush(i32* %194)
br label %196
196: ; preds = %206, %193
%197 = load i32, i32* %10
%198 = icmp ne i32 %197, 1
br i1 %198, label %199, label %213
199: ; preds = %196
%200 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%201 = load i32*, i32** %9
%202 = call i32 @fgets(i8* %200, i32 128, i32* %201)
%203 = icmp ne i32 %202, 0
br i1 %203, label %206, label %204
204: ; preds = %199
%205 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %206
206: ; preds = %204, %199
%207 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%208 = call i32 @strlen(i8* %207)
store i32 %208, i32* %10
%209 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%210 = call i32 @printf(i8* %209)
%211 = load i32*, i32** @stdout
%212 = call i32 @fflush(i32* %211)
br label %196
213: ; preds = %196
br label %214
214: ; preds = %213, %178
br label %54
}

LLVM IR (-O2):
@.str = [18 x i8] c"can't open pipe a\00"
@.str.1 = [18 x i8] c"can't open pipe b\00"
@.str.2 = [29 x i8] c"fork failed (try chopsticks)\00"
@.str.3 = [20 x i8] c"dup pfd_a[0] failed\00"
@.str.4 = [20 x i8] c"dup pfd_b[1] failed\00"
@.str.5 = [6 x i8] c"gnugo\00"
@.str.6 = [7 x i8] c"--mode\00"
@.str.7 = [4 x i8] c"gtp\00"
@.str.8 = [8 x i8] c"--quiet\00"
@.str.9 = [14 x i8] c"execlp failed\00"
@.str.10 = [2 x i8] c"w\00"
@.str.11 = [2 x i8] c"r\00"
@stdin = global i32* null
@.str.12 = [5 x i8] c"quit\00"
@stderr = global i32* null
@.str.13 = [3 x i8] c"%s\00"
@.str.14 = [6 x i8] c"quit\0A\00"
@.str.15 = [39 x i8] c"can't write command in to_gnugo_stream\00"
@.str.16 = [14 x i8] c"genmove_black\00"
@__const.main.delimiters = [5 x i8] c" \09\0D\0A\00"
@.str.17 = [17 x i8] c"top_moves_black\0A\00"
@.str.18 = [19 x i8] c"can't get response\00"
@.str.19 = [7 x i8] c"black \00"
@.str.20 = [2 x i8] c"\0A\00"
@stdout = global i32* null
define i32 @main() {
%1 = alloca [2 x i32]
%2 = alloca [2 x i32]
%3 = alloca [128 x i8]
%4 = alloca [128 x i8]
%5 = alloca [5 x i8]
%6 = bitcast [2 x i32]* %1 to i8*
%7 = bitcast [2 x i32]* %2 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%11 = call i32 @pipe(i32* %10)
%12 = icmp eq i32 %11, -1
br i1 %12, label %13, label %15
13: ; preds = %0
%14 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
br label %15
15: ; preds = %13, %0
%16 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%17 = call i32 @pipe(i32* %16)
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @error(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
br label %21
21: ; preds = %19, %15
%22 = call i32 (...) @fork()
switch i32 %22, label %41 [
i32 -1, label %23
i32 0, label %25
]
23: ; preds = %21
%24 = call i32 @error(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0))
br label %25
25: ; preds = %21, %23
%26 = load i32, i32* %10
%27 = call i32 @dup2(i32 %26, i32 0)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
br label %31
31: ; preds = %29, %25
%32 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%33 = load i32, i32* %32
%34 = call i32 @dup2(i32 %33, i32 1)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i32 @error(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.4, i64 0, i64 0))
br label %38
38: ; preds = %36, %31
%39 = call i32 @execlp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32* null)
%40 = call i32 @error(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
br label %41
41: ; preds = %38, %21
%42 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%43 = load i32, i32* %42
%44 = call i32* @fdopen(i32 %43, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.10, i64 0, i64 0))
%45 = load i32, i32* %16
%46 = call i32* @fdopen(i32 %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%47 = load i32*, i32** @stdin
%48 = call i32 @fgets(i8* %9, i32 128, i32* %47)
%49 = icmp eq i32 %48, 0
br i1 %49, label %55, label %50
50: ; preds = %41
%51 = getelementptr inbounds [5 x i8], [5 x i8]* %5, i64 0, i64 0
br label %52
52: ; preds = %50, %142
%53 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.12, i64 0, i64 0), i32 4)
%54 = icmp eq i32 %53, 0
br i1 %54, label %55, label %62
55: ; preds = %52, %142, %41
%56 = load i32*, i32** @stderr
%57 = call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i64 5, i64 1, i32* %56)
%58 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0))
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %146
60: ; preds = %55
%61 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %146
62: ; preds = %52
%63 = call i32 @strncmp(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.16, i64 0, i64 0), i32 13)
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %122
65: ; preds = %62
%66 = load i32*, i32** @stderr
%67 = call i64 @fwrite(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0), i64 16, i64 1, i32* %66)
%68 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.17, i64 0, i64 0))
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %72
70: ; preds = %65
%71 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %72
72: ; preds = %70, %65
%73 = call i32 @fflush(i32* %44)
%74 = call i32 @fgets(i8* %8, i32 128, i32* %46)
%75 = icmp eq i32 %74, 0
br i1 %75, label %76, label %78
76: ; preds = %72
%77 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %78
78: ; preds = %76, %72
%79 = call i8* @strtok(i8* %8, i8* %51)
%80 = call i8* @strtok(i8* null, i8* %51)
%81 = load i32*, i32** @stderr
%82 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0), i64 6, i64 1, i32* %81)
%83 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.19, i64 0, i64 0))
%84 = icmp slt i64 %83, 0
br i1 %84, label %85, label %87
85: ; preds = %78
%86 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %87
87: ; preds = %85, %78
%88 = call i32 @fflush(i32* %44)
%89 = load i32*, i32** @stderr
%90 = call i32 @fputs(i8* %80, i32* %89)
%91 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %80)
%92 = icmp slt i64 %91, 0
br i1 %92, label %93, label %95
93: ; preds = %87
%94 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %95
95: ; preds = %93, %87
%96 = call i32 @fflush(i32* %44)
%97 = load i32*, i32** @stderr
%98 = call i32 @fputc(i32 10, i32* %97)
%99 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.20, i64 0, i64 0))
%100 = icmp slt i64 %99, 0
br i1 %100, label %101, label %103
101: ; preds = %95
%102 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %103
103: ; preds = %101, %95
%104 = call i32 @fflush(i32* %44)
%105 = call i32 @fgets(i8* %8, i32 128, i32* %46)
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %109
107: ; preds = %103
%108 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %109
109: ; preds = %107, %103
br label %110
110: ; preds = %109, %115
%111 = call i32 @fgets(i8* %8, i32 128, i32* %46)
%112 = icmp eq i32 %111, 0
br i1 %112, label %113, label %115
113: ; preds = %110
%114 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %115
115: ; preds = %113, %110
%116 = call i32 @strlen(i8* %8)
%117 = call i32 @printf(i8* %8)
%118 = load i32*, i32** @stdout
%119 = call i32 @fflush(i32* %118)
%120 = icmp eq i32 %116, 1
br i1 %120, label %121, label %110
121: ; preds = %115
br label %142
122: ; preds = %62
%123 = load i32*, i32** @stderr
%124 = call i32 @fputs(i8* %9, i32* %123)
%125 = call i64 @fprintf(i32* %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.13, i64 0, i64 0), i8* %9)
%126 = icmp slt i64 %125, 0
br i1 %126, label %127, label %129
127: ; preds = %122
%128 = call i32 @error(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0))
br label %129
129: ; preds = %127, %122
%130 = call i32 @fflush(i32* %44)
br label %131
131: ; preds = %129, %136
%132 = call i32 @fgets(i8* %8, i32 128, i32* %46)
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %131
%135 = call i32 @error(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.18, i64 0, i64 0))
br label %136
136: ; preds = %134, %131
%137 = call i32 @strlen(i8* %8)
%138 = call i32 @printf(i8* %8)
%139 = load i32*, i32** @stdout
%140 = call i32 @fflush(i32* %139)
%141 = icmp eq i32 %137, 1
br i1 %141, label %142, label %131
142: ; preds = %136, %121
%143 = load i32*, i32** @stdin
%144 = call i32 @fgets(i8* %9, i32 128, i32* %143)
%145 = icmp eq i32 %144, 0
br i1 %145, label %55, label %52
146: ; preds = %55, %60
%147 = call i32 @fflush(i32* %44)
ret i32 1
}