#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 time_t;

/* Variables and functions */
scalar_t__ EEXIST;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_WRONLY;
int S_IRGRP;
int S_IROTH;
int S_IRUSR;
int S_IWGRP;
int S_IWOTH;
int S_IWUSR;
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
scalar_t__ malloc(int);
int mkfifo(char const *, int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int random_range(int /*<<< orphan*/, int);
int read(int, char *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
scalar_t__ strcmp(char *, char *);
int time(int /*<<< orphan*/ *);
int /*<<< orphan*/ umask(int /*<<< orphan*/);
int write(int, char *, int);
int main() {
  int rand = 0, start = 0, client1_score, client2_score;
  int server_fd, client_fd_1, client_fd_2, num_read;
  const char *server_fifo = "/tmp/awzurn_server_FIFO";
  const char *client_fifo_1 = "/tmp/awzurn_client_FIFO_1";
  const char *client_fifo_2 = "/tmp/awzurn_client_FIFO_2";
  char *buffer, *buffer2;
  buffer = (char *)malloc(55 * sizeof(char));
  buffer2 = (char *)malloc(55 * sizeof(char));
  time_t client1_time_start, client1_time_end, client1_final,
      client2_time_start, client2_time_end, client2_final;
  umask(0);
  if (mkfifo(server_fifo,
             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == -1 &&
      errno != EEXIST) {
    perror("server_fifo creation error, exiting\n");
    exit(EXIT_FAILURE);
  }
  if (mkfifo(client_fifo_1,
             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == -1 &&
      errno != EEXIST) {
    perror("client_fifo_1 creation error, exiting\n");
    exit(EXIT_FAILURE);
  }
  if (mkfifo(client_fifo_2,
             S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH) == -1 &&
      errno != EEXIST) {
    perror("client_fifo_2 creation error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf("attempting to open server fifo...");
  server_fd = open(server_fifo, O_RDONLY);
  if (server_fd == -1) {
    perror("server_fd open error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf(" opened!\n");
  printf("attempting to open client1 fifo...");
  client_fd_1 = open(client_fifo_1, O_WRONLY);
  if (client_fd_1 == -1) {
    perror("client_fd_1 open error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf(" opened!\n");
  printf("attempting to open client2 fifo...");
  client_fd_2 = open(client_fifo_2, O_WRONLY);
  if (client_fd_2 == -1) {
    perror("client_fd_2 open error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf(" opened!\n");
  for (;;) {
    if (start == 0) {
      int rand = random_range(0, 1);
      start = 1;
    }
    if (rand == 0) {
      if (write(client_fd_1, "0", 2) != 2) {
        perror("write error to client1");
      }
      if (write(client_fd_2, "1", 2) != 2) {
        perror("write error to client1");
      }
      client1_time_start = time(NULL);
      if ((num_read = read(server_fd, buffer, 55)) != 55) {
        perror("read error");
      }
      client1_time_end = time(NULL);
      client1_final = client1_time_end - client1_time_start;
      printf("%s\n", buffer);
      if (write(client_fd_2, buffer, 55) != 55) {
        perror("write error");
      }
      client2_time_start = time(NULL);
      if ((num_read = read(server_fd, buffer, 55)) != 55) {
        perror("read error");
      }
      client2_time_end = time(NULL);
      client2_final = client2_time_end - client2_time_start;
      if (strcmp(buffer, "end") == 0) {
        printf("Game over, player 1 is victorious!\n");
        break;
      }
    } else {
      if (write(client_fd_2, "0", 2) != 2) {
        perror("write error to client2");
      }
      if (write(client_fd_1, "1", 2) != 2) {
        perror("write error to client1");
      }
      client2_time_start = time(NULL);
      if ((num_read = read(server_fd, buffer, 55)) != 55) {
        perror("read error");
      }
      client2_time_end = time(NULL);
      client2_final = client2_time_end - client2_time_start;
      printf("%s\n", buffer);
      if (write(client_fd_1, buffer, 55) != 55) {
        perror("write error");
      }
      client1_time_start = time(NULL);
      if ((num_read = read(server_fd, buffer, 55)) != 55) {
        perror("read error");
      }
      client1_time_end = time(NULL);
      client1_final = client1_time_start - client1_time_end;
      if (strcmp(buffer, "end") == 0) {
        printf("Game over, player 2 is victorious!\n");
        break;
      }
    }
    printf("client1: %d\n", client1_final);
    printf("client2: %d\n", client2_final);
    if (client1_final < client2_final) {
      client2_score = client2_score + 10000 / client2_final;
      rand = 0;
    } else if (client1_final > client2_final) {
      client1_score = client1_score + 10000 / client1_final;
      rand = 1;
    } else {
      rand = random_range(0, 1);
    }
  }
  sprintf(buffer, "%d", client1_final);
  if (write(client_fd_1, buffer, 55) != 55) {
    perror("write error");
  }
  if (write(client_fd_2, buffer, 55) != 55) {
    perror("write error");
  }
  sprintf(buffer, "%d", client2_final);
  if (write(client_fd_2, buffer, 55) != 55) {
    perror("write error");
  }
  if (write(client_fd_1, buffer, 55) != 55) {
    perror("write error");
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xe09(%rip),%rax
mov    %rax,-0x30(%rbp)
lea    0xe16(%rip),%rax
mov    %rax,-0x38(%rbp)
lea    0xe25(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    $0x37,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x48(%rbp)
mov    $0x37,%edi
call   10b0 <malloc@plt>
mov    %rax,-0x50(%rbp)
xor    %edi,%edi
call   1080 <umask@plt>
mov    -0x30(%rbp),%rdi
mov    0x2d61(%rip),%rax
mov    (%rax),%esi
mov    0x2d90(%rip),%rax
or     (%rax),%esi
mov    0x2d67(%rip),%rax
or     (%rax),%esi
mov    0x2d86(%rip),%rax
or     (%rax),%esi
mov    0x2d4d(%rip),%rax
or     (%rax),%esi
mov    0x2d14(%rip),%rax
or     (%rax),%esi
call   1070 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    12b0 <main+0xe0>
mov    0x2d3d(%rip),%rax
mov    (%rax),%rax
mov    0x2d3b(%rip),%rcx
cmp    (%rcx),%rax
je     12b0 <main+0xe0>
lea    0xdaf(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2cff(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x38(%rbp),%rdi
mov    0x2ce5(%rip),%rax
mov    (%rax),%esi
mov    0x2d14(%rip),%rax
or     (%rax),%esi
mov    0x2ceb(%rip),%rax
or     (%rax),%esi
mov    0x2d0a(%rip),%rax
or     (%rax),%esi
mov    0x2cd1(%rip),%rax
or     (%rax),%esi
mov    0x2c98(%rip),%rax
or     (%rax),%esi
call   1070 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    132c <main+0x15c>
mov    0x2cc1(%rip),%rax
mov    (%rax),%rax
mov    0x2cbf(%rip),%rcx
cmp    (%rcx),%rax
je     132c <main+0x15c>
lea    0xd58(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c83(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
mov    -0x40(%rbp),%rdi
mov    0x2c69(%rip),%rax
mov    (%rax),%esi
mov    0x2c98(%rip),%rax
or     (%rax),%esi
mov    0x2c6f(%rip),%rax
or     (%rax),%esi
mov    0x2c8e(%rip),%rax
or     (%rax),%esi
mov    0x2c55(%rip),%rax
or     (%rax),%esi
mov    0x2c1c(%rip),%rax
or     (%rax),%esi
call   1070 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    13a8 <main+0x1d8>
mov    0x2c45(%rip),%rax
mov    (%rax),%rax
mov    0x2c43(%rip),%rcx
cmp    (%rcx),%rax
je     13a8 <main+0x1d8>
lea    0xd03(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2c07(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    0x2c27(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0xffffffff,-0x18(%rbp)
jne    13ef <main+0x21f>
lea    0xd05(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2bc0(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xd0a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd06(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2b72(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1444 <main+0x274>
lea    0xcfc(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b6b(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xcb5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xcf5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x40(%rbp),%rdi
mov    0x2b1d(%rip),%rax
mov    (%rax),%esi
call   10c0 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1499 <main+0x2c9>
lea    0xceb(%rip),%rdi
call   10d0 <perror@plt>
mov    0x2b16(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>
lea    0xc60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpl   $0x0,-0xc(%rbp)
jne    14c7 <main+0x2f7>
xor    %edi,%edi
mov    $0x1,%esi
call   1090 <random_range@plt>
mov    %eax,-0x6c(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    1621 <main+0x451>
mov    -0x1c(%rbp),%edi
lea    0xcb7(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
je     14fa <main+0x32a>
lea    0xc9f(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x20(%rbp),%edi
lea    0xb2c(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
je     1523 <main+0x353>
lea    0xc76(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x37,%eax
je     1558 <main+0x388>
lea    0xc58(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
sub    -0x54(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xc3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     15a5 <main+0x3d5>
lea    0xc1a(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x37,%eax
je     15da <main+0x40a>
lea    0xbd6(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
sub    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xbcc(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    161c <main+0x44c>
lea    0xbba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    180e <main+0x63e>
jmp    1771 <main+0x5a1>
mov    -0x20(%rbp),%edi
lea    0xb67(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
je     164a <main+0x47a>
lea    0xba9(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x1c(%rbp),%edi
lea    0x9dc(%rip),%rsi
mov    $0x2,%edx
call   1030 <write@plt>
cmp    $0x2,%eax
je     1673 <main+0x4a3>
lea    0xb26(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x60(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x37,%eax
je     16a8 <main+0x4d8>
lea    0xb08(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%eax
sub    -0x60(%rbp),%eax
mov    %eax,-0x68(%rbp)
mov    -0x48(%rbp),%rsi
lea    0xaee(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     16f5 <main+0x525>
lea    0xaca(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x54(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
mov    %eax,-0x24(%rbp)
cmp    $0x37,%eax
je     172a <main+0x55a>
lea    0xa86(%rip),%rdi
call   10d0 <perror@plt>
xor    %eax,%eax
mov    %eax,%edi
call   10a0 <time@plt>
mov    %eax,-0x58(%rbp)
mov    -0x54(%rbp),%eax
sub    -0x58(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x48(%rbp),%rdi
lea    0xa7c(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    176c <main+0x59c>
lea    0xaa5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    180e <main+0x63e>
jmp    1771 <main+0x5a1>
mov    -0x5c(%rbp),%esi
lea    0xaae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x68(%rbp),%esi
lea    0xaaa(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x5c(%rbp),%eax
cmp    -0x68(%rbp),%eax
jge    17c4 <main+0x5f4>
mov    -0x14(%rbp),%eax
mov    %eax,-0x70(%rbp)
mov    $0x2710,%eax
cltd
idivl  -0x68(%rbp)
mov    %eax,%ecx
mov    -0x70(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x14(%rbp)
movl   $0x0,-0x8(%rbp)
jmp    1809 <main+0x639>
mov    -0x5c(%rbp),%eax
cmp    -0x68(%rbp),%eax
jle    17f5 <main+0x625>
mov    -0x10(%rbp),%eax
mov    %eax,-0x74(%rbp)
mov    $0x2710,%eax
cltd
idivl  -0x5c(%rbp)
mov    %eax,%ecx
mov    -0x74(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
movl   $0x1,-0x8(%rbp)
jmp    1804 <main+0x634>
xor    %edi,%edi
mov    $0x1,%esi
call   1090 <random_range@plt>
mov    %eax,-0x8(%rbp)
jmp    1809 <main+0x639>
jmp    14a7 <main+0x2d7>
mov    -0x48(%rbp),%rdi
mov    -0x5c(%rbp),%edx
lea    0xa27(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x1c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     1847 <main+0x677>
lea    0x978(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x20(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     186d <main+0x69d>
lea    0x952(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x48(%rbp),%rdi
mov    -0x68(%rbp),%edx
lea    0x9c8(%rip),%rsi
call   10e0 <sprintf@plt>
mov    -0x20(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     18a6 <main+0x6d6>
lea    0x919(%rip),%rdi
call   10d0 <perror@plt>
mov    -0x1c(%rbp),%edi
mov    -0x48(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     18cc <main+0x6fc>
lea    0x8f3(%rip),%rdi
call   10d0 <perror@plt>
mov    0x26c5(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    $0x37,%edi
call   10c0 <malloc@plt>
mov    %rax,%r15
mov    $0x37,%edi
call   10c0 <malloc@plt>
xor    %edi,%edi
call   1090 <umask@plt>
mov    0x2d8d(%rip),%rax
mov    0x2dbe(%rip),%r13
mov    0x0(%r13),%esi
or     (%rax),%esi
mov    0x2d91(%rip),%r12
or     (%r12),%esi
mov    0x2dae(%rip),%rbx
or     (%rbx),%esi
mov    0x2d75(%rip),%rbp
or     0x0(%rbp),%esi
mov    0x2d3b(%rip),%r14
or     (%r14),%esi
lea    0xdb1(%rip),%rdi
call   1080 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    1273 <main+0x93>
mov    0x2d60(%rip),%rax
mov    (%rax),%rax
mov    0x2d5e(%rip),%rcx
cmp    (%rcx),%rax
jne    1333 <main+0x153>
mov    0x0(%r13),%esi
mov    0x2d22(%rip),%rax
or     (%rax),%esi
or     (%r12),%esi
or     (%rbx),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xd85(%rip),%rdi
call   1080 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    12b7 <main+0xd7>
mov    0x2d1c(%rip),%rax
mov    (%rax),%rax
mov    0x2d1a(%rip),%rcx
cmp    (%rcx),%rax
jne    137c <main+0x19c>
mov    0x0(%r13),%esi
mov    0x2cde(%rip),%rax
or     (%rax),%esi
or     (%r12),%esi
or     (%rbx),%esi
or     0x0(%rbp),%esi
or     (%r14),%esi
lea    0xd5b(%rip),%rdi
call   1080 <mkfifo@plt>
cmp    $0xffffffff,%eax
jne    12fb <main+0x11b>
mov    0x2cd8(%rip),%rax
mov    (%rax),%rax
mov    0x2cd6(%rip),%rcx
cmp    (%rcx),%rax
jne    1385 <main+0x1a5>
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cd8(%rip),%rax
mov    (%rax),%esi
lea    0xce7(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,0x10(%rsp)
cmp    $0xffffffff,%eax
jne    133f <main+0x15f>
lea    0xdb3(%rip),%rdi
jmp    13cd <main+0x1ed>
lea    0xd12(%rip),%rdi
jmp    13cd <main+0x1ed>
lea    0xeaa(%rip),%rdi
call   1030 <puts@plt>
lea    0xdae(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2c28(%rip),%rbx
mov    (%rbx),%esi
lea    0xcaf(%rip),%rdi
call   10d0 <open@plt>
cmp    $0xffffffff,%eax
jne    138e <main+0x1ae>
lea    0xda9(%rip),%rdi
jmp    13cd <main+0x1ed>
lea    0xcee(%rip),%rdi
jmp    13cd <main+0x1ed>
lea    0xd0c(%rip),%rdi
jmp    13cd <main+0x1ed>
mov    %eax,0x14(%rsp)
lea    0xe57(%rip),%rdi
call   1030 <puts@plt>
lea    0xd9f(%rip),%rdi
xor    %r14d,%r14d
xor    %eax,%eax
call   1050 <printf@plt>
mov    (%rbx),%esi
lea    0xc7a(%rip),%rdi
call   10d0 <open@plt>
mov    %eax,0xc(%rsp)
cmp    $0xffffffff,%eax
jne    13e0 <main+0x200>
lea    0xd9a(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2bcf(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    0xe09(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%bl
xchg   %ax,%ax
test   $0x1,%bl
je     1401 <main+0x221>
xor    %edi,%edi
mov    $0x1,%esi
call   10a0 <random_range@plt>
test   %r14d,%r14d
je     14f0 <main+0x310>
mov    0xc(%rsp),%edi
lea    0xd73(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
cmp    $0x2,%eax
jne    1624 <main+0x444>
mov    0x14(%rsp),%r14d
mov    %r14d,%edi
lea    0xbf9(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
cmp    $0x2,%eax
jne    1635 <main+0x455>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
jne    1646 <main+0x466>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r12d
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
jne    1657 <main+0x477>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r13d
mov    0x10(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
jne    1668 <main+0x488>
sub    %ebp,%r12d
xor    %edi,%edi
call   10b0 <time@plt>
sub    %eax,%r13d
mov    %r15,%rdi
lea    0xce5(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
jne    15ca <main+0x3ea>
jmp    16ce <main+0x4ee>
cs nopw 0x0(%rax,%rax,1)
mov    0x14(%rsp),%r14d
mov    %r14d,%edi
lea    0xc89(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
cmp    $0x2,%eax
jne    1679 <main+0x499>
mov    0xc(%rsp),%edi
lea    0xb13(%rip),%rsi
mov    $0x2,%edx
call   1040 <write@plt>
cmp    $0x2,%eax
jne    168a <main+0x4aa>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%ebp
mov    0x10(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
jne    169b <main+0x4bb>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r13d
mov    %r15,%rdi
call   1030 <puts@plt>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
jne    16ac <main+0x4cc>
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%ebx
mov    0x10(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
jne    16bd <main+0x4dd>
sub    %ebp,%r13d
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%r12d
sub    %ebx,%r12d
mov    %r15,%rdi
lea    0xbfc(%rip),%rsi
call   1070 <strcmp@plt>
test   %rax,%rax
je     16d7 <main+0x4f7>
xor    %ebx,%ebx
lea    0xc00(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xbfc(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x0,%r14d
cmp    %r12d,%r13d
jl     13f0 <main+0x210>
mov    $0x1,%r14d
xor    %ebx,%ebx
cmp    %r12d,%r13d
jg     13f0 <main+0x210>
xor    %ebx,%ebx
xor    %edi,%edi
mov    $0x1,%esi
call   10a0 <random_range@plt>
mov    %eax,%r14d
jmp    13f0 <main+0x210>
lea    0xb91(%rip),%rdi
call   10e0 <perror@plt>
jmp    1428 <main+0x248>
lea    0xb4e(%rip),%rdi
call   10e0 <perror@plt>
jmp    144a <main+0x26a>
lea    0xb54(%rip),%rdi
call   10e0 <perror@plt>
jmp    146d <main+0x28d>
lea    0xb4e(%rip),%rdi
call   10e0 <perror@plt>
jmp    1498 <main+0x2b8>
lea    0xb32(%rip),%rdi
call   10e0 <perror@plt>
jmp    14bc <main+0x2dc>
lea    0xb0a(%rip),%rdi
call   10e0 <perror@plt>
jmp    1512 <main+0x332>
lea    0xaf9(%rip),%rdi
call   10e0 <perror@plt>
jmp    1530 <main+0x350>
lea    0xaff(%rip),%rdi
call   10e0 <perror@plt>
jmp    1553 <main+0x373>
lea    0xaf9(%rip),%rdi
call   10e0 <perror@plt>
jmp    157f <main+0x39f>
lea    0xadd(%rip),%rdi
call   10e0 <perror@plt>
jmp    15a2 <main+0x3c2>
lea    0xb24(%rip),%rdi
jmp    16de <main+0x4fe>
lea    0xb3e(%rip),%rdi
call   1030 <puts@plt>
lea    0xb03(%rip),%rsi
mov    %r15,%rdi
mov    %r13d,%edx
call   10f0 <sprintf@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
je     1716 <main+0x536>
lea    0xa9b(%rip),%rdi
call   10e0 <perror@plt>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
je     1738 <main+0x558>
lea    0xa79(%rip),%rdi
call   10e0 <perror@plt>
lea    0xaae(%rip),%rsi
mov    %r15,%rdi
mov    %r12d,%edx
call   10f0 <sprintf@plt>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
je     176c <main+0x58c>
lea    0xa45(%rip),%rdi
call   10e0 <perror@plt>
mov    %r14d,%edi
mov    %r15,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
je     178d <main+0x5ad>
lea    0xa24(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2804(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
@.str = [24 x i8] c"/tmp/awzurn_server_FIFO\00"
@.str.1 = [26 x i8] c"/tmp/awzurn_client_FIFO_1\00"
@.str.2 = [26 x i8] c"/tmp/awzurn_client_FIFO_2\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.3 = [37 x i8] c"server_fifo creation error, exiting\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [39 x i8] c"client_fifo_1 creation error, exiting\0A\00"
@.str.5 = [39 x i8] c"client_fifo_2 creation error, exiting\0A\00"
@.str.6 = [34 x i8] c"attempting to open server fifo...\00"
@O_RDONLY = global i32 0
@.str.7 = [31 x i8] c"server_fd open error, exiting\0A\00"
@.str.8 = [10 x i8] c" opened!\0A\00"
@.str.9 = [35 x i8] c"attempting to open client1 fifo...\00"
@O_WRONLY = global i32 0
@.str.10 = [33 x i8] c"client_fd_1 open error, exiting\0A\00"
@.str.11 = [35 x i8] c"attempting to open client2 fifo...\00"
@.str.12 = [33 x i8] c"client_fd_2 open error, exiting\0A\00"
@.str.13 = [2 x i8] c"0\00"
@.str.14 = [23 x i8] c"write error to client1\00"
@.str.15 = [2 x i8] c"1\00"
@.str.16 = [11 x i8] c"read error\00"
@.str.17 = [4 x i8] c"%s\0A\00"
@.str.18 = [12 x i8] c"write error\00"
@.str.19 = [4 x i8] c"end\00"
@.str.20 = [36 x i8] c"Game over, player 1 is victorious!\0A\00"
@.str.21 = [23 x i8] c"write error to client2\00"
@.str.22 = [36 x i8] c"Game over, player 2 is victorious!\0A\00"
@.str.23 = [13 x i8] c"client1: %d\0A\00"
@.str.24 = [13 x i8] c"client2: %d\0A\00"
@.str.25 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i8*
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %10
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %11
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8** %12
%22 = call i64 @malloc(i32 55)
%23 = inttoptr i64 %22 to i8*
store i8* %23, i8** %13
%24 = call i64 @malloc(i32 55)
%25 = inttoptr i64 %24 to i8*
store i8* %25, i8** %14
%26 = call i32 @umask(i32 0)
%27 = load i8*, i8** %10
%28 = load i32, i32* @S_IRUSR
%29 = load i32, i32* @S_IWUSR
%30 = or i32 %28, %29
%31 = load i32, i32* @S_IRGRP
%32 = or i32 %30, %31
%33 = load i32, i32* @S_IWGRP
%34 = or i32 %32, %33
%35 = load i32, i32* @S_IROTH
%36 = or i32 %34, %35
%37 = load i32, i32* @S_IWOTH
%38 = or i32 %36, %37
%39 = call i32 @mkfifo(i8* %27, i32 %38)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %49
41: ; preds = %0
%42 = load i64, i64* @errno
%43 = load i64, i64* @EEXIST
%44 = icmp ne i64 %42, %43
br i1 %44, label %45, label %49
45: ; preds = %41
%46 = call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %41, %0
%50 = load i8*, i8** %11
%51 = load i32, i32* @S_IRUSR
%52 = load i32, i32* @S_IWUSR
%53 = or i32 %51, %52
%54 = load i32, i32* @S_IRGRP
%55 = or i32 %53, %54
%56 = load i32, i32* @S_IWGRP
%57 = or i32 %55, %56
%58 = load i32, i32* @S_IROTH
%59 = or i32 %57, %58
%60 = load i32, i32* @S_IWOTH
%61 = or i32 %59, %60
%62 = call i32 @mkfifo(i8* %50, i32 %61)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %72
64: ; preds = %49
%65 = load i64, i64* @errno
%66 = load i64, i64* @EEXIST
%67 = icmp ne i64 %65, %66
br i1 %67, label %68, label %72
68: ; preds = %64
%69 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%70 = load i32, i32* @EXIT_FAILURE
%71 = call i32 @exit(i32 %70)
unreachable
72: ; preds = %64, %49
%73 = load i8*, i8** %12
%74 = load i32, i32* @S_IRUSR
%75 = load i32, i32* @S_IWUSR
%76 = or i32 %74, %75
%77 = load i32, i32* @S_IRGRP
%78 = or i32 %76, %77
%79 = load i32, i32* @S_IWGRP
%80 = or i32 %78, %79
%81 = load i32, i32* @S_IROTH
%82 = or i32 %80, %81
%83 = load i32, i32* @S_IWOTH
%84 = or i32 %82, %83
%85 = call i32 @mkfifo(i8* %73, i32 %84)
%86 = icmp eq i32 %85, -1
br i1 %86, label %87, label %95
87: ; preds = %72
%88 = load i64, i64* @errno
%89 = load i64, i64* @EEXIST
%90 = icmp ne i64 %88, %89
br i1 %90, label %91, label %95
91: ; preds = %87
%92 = call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%93 = load i32, i32* @EXIT_FAILURE
%94 = call i32 @exit(i32 %93)
unreachable
95: ; preds = %87, %72
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%97 = load i8*, i8** %10
%98 = load i32, i32* @O_RDONLY
%99 = call i32 @open(i8* %97, i32 %98)
store i32 %99, i32* %6
%100 = load i32, i32* %6
%101 = icmp eq i32 %100, -1
br i1 %101, label %102, label %106
102: ; preds = %95
%103 = call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%104 = load i32, i32* @EXIT_FAILURE
%105 = call i32 @exit(i32 %104)
unreachable
106: ; preds = %95
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%108 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%109 = load i8*, i8** %11
%110 = load i32, i32* @O_WRONLY
%111 = call i32 @open(i8* %109, i32 %110)
store i32 %111, i32* %7
%112 = load i32, i32* %7
%113 = icmp eq i32 %112, -1
br i1 %113, label %114, label %118
114: ; preds = %106
%115 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%116 = load i32, i32* @EXIT_FAILURE
%117 = call i32 @exit(i32 %116)
unreachable
118: ; preds = %106
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%121 = load i8*, i8** %12
%122 = load i32, i32* @O_WRONLY
%123 = call i32 @open(i8* %121, i32 %122)
store i32 %123, i32* %8
%124 = load i32, i32* %8
%125 = icmp eq i32 %124, -1
br i1 %125, label %126, label %130
126: ; preds = %118
%127 = call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%128 = load i32, i32* @EXIT_FAILURE
%129 = call i32 @exit(i32 %128)
unreachable
130: ; preds = %118
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0))
br label %132
132: ; preds = %269, %130
%133 = load i32, i32* %3
%134 = icmp eq i32 %133, 0
br i1 %134, label %135, label %137
135: ; preds = %132
%136 = call i32 @random_range(i32 0, i32 1)
store i32 %136, i32* %21
store i32 1, i32* %3
br label %137
137: ; preds = %135, %132
%138 = load i32, i32* %2
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %192
140: ; preds = %137
%141 = load i32, i32* %7
%142 = call i32 @write(i32 %141, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 2)
%143 = icmp ne i32 %142, 2
br i1 %143, label %144, label %146
144: ; preds = %140
%145 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %146
146: ; preds = %144, %140
%147 = load i32, i32* %8
%148 = call i32 @write(i32 %147, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 2)
%149 = icmp ne i32 %148, 2
br i1 %149, label %150, label %152
150: ; preds = %146
%151 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %152
152: ; preds = %150, %146
%153 = call i32 @time(i32* null)
store i32 %153, i32* %15
%154 = load i32, i32* %6
%155 = load i8*, i8** %13
%156 = call i32 @read(i32 %154, i8* %155, i32 55)
store i32 %156, i32* %9
%157 = icmp ne i32 %156, 55
br i1 %157, label %158, label %160
158: ; preds = %152
%159 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %160
160: ; preds = %158, %152
%161 = call i32 @time(i32* null)
store i32 %161, i32* %16
%162 = load i32, i32* %16
%163 = load i32, i32* %15
%164 = sub nsw i32 %162, %163
store i32 %164, i32* %17
%165 = load i8*, i8** %13
%166 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %165)
%167 = load i32, i32* %8
%168 = load i8*, i8** %13
%169 = call i32 @write(i32 %167, i8* %168, i32 55)
%170 = icmp ne i32 %169, 55
br i1 %170, label %171, label %173
171: ; preds = %160
%172 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %173
173: ; preds = %171, %160
%174 = call i32 @time(i32* null)
store i32 %174, i32* %18
%175 = load i32, i32* %6
%176 = load i8*, i8** %13
%177 = call i32 @read(i32 %175, i8* %176, i32 55)
store i32 %177, i32* %9
%178 = icmp ne i32 %177, 55
br i1 %178, label %179, label %181
179: ; preds = %173
%180 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %181
181: ; preds = %179, %173
%182 = call i32 @time(i32* null)
store i32 %182, i32* %19
%183 = load i32, i32* %19
%184 = load i32, i32* %18
%185 = sub nsw i32 %183, %184
store i32 %185, i32* %20
%186 = load i8*, i8** %13
%187 = call i64 @strcmp(i8* %186, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%188 = icmp eq i64 %187, 0
br i1 %188, label %189, label %191
189: ; preds = %181
%190 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0))
br label %270
191: ; preds = %181
br label %244
192: ; preds = %137
%193 = load i32, i32* %8
%194 = call i32 @write(i32 %193, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 2)
%195 = icmp ne i32 %194, 2
br i1 %195, label %196, label %198
196: ; preds = %192
%197 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
br label %198
198: ; preds = %196, %192
%199 = load i32, i32* %7
%200 = call i32 @write(i32 %199, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 2)
%201 = icmp ne i32 %200, 2
br i1 %201, label %202, label %204
202: ; preds = %198
%203 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %204
204: ; preds = %202, %198
%205 = call i32 @time(i32* null)
store i32 %205, i32* %18
%206 = load i32, i32* %6
%207 = load i8*, i8** %13
%208 = call i32 @read(i32 %206, i8* %207, i32 55)
store i32 %208, i32* %9
%209 = icmp ne i32 %208, 55
br i1 %209, label %210, label %212
210: ; preds = %204
%211 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %212
212: ; preds = %210, %204
%213 = call i32 @time(i32* null)
store i32 %213, i32* %19
%214 = load i32, i32* %19
%215 = load i32, i32* %18
%216 = sub nsw i32 %214, %215
store i32 %216, i32* %20
%217 = load i8*, i8** %13
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i8* %217)
%219 = load i32, i32* %7
%220 = load i8*, i8** %13
%221 = call i32 @write(i32 %219, i8* %220, i32 55)
%222 = icmp ne i32 %221, 55
br i1 %222, label %223, label %225
223: ; preds = %212
%224 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %225
225: ; preds = %223, %212
%226 = call i32 @time(i32* null)
store i32 %226, i32* %15
%227 = load i32, i32* %6
%228 = load i8*, i8** %13
%229 = call i32 @read(i32 %227, i8* %228, i32 55)
store i32 %229, i32* %9
%230 = icmp ne i32 %229, 55
br i1 %230, label %231, label %233
231: ; preds = %225
%232 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %233
233: ; preds = %231, %225
%234 = call i32 @time(i32* null)
store i32 %234, i32* %16
%235 = load i32, i32* %15
%236 = load i32, i32* %16
%237 = sub nsw i32 %235, %236
store i32 %237, i32* %17
%238 = load i8*, i8** %13
%239 = call i64 @strcmp(i8* %238, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%240 = icmp eq i64 %239, 0
br i1 %240, label %241, label %243
241: ; preds = %233
%242 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.22, i64 0, i64 0))
br label %270
243: ; preds = %233
br label %244
244: ; preds = %243, %191
%245 = load i32, i32* %17
%246 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.23, i64 0, i64 0), i32 %245)
%247 = load i32, i32* %20
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), i32 %247)
%249 = load i32, i32* %17
%250 = load i32, i32* %20
%251 = icmp slt i32 %249, %250
br i1 %251, label %252, label %257
252: ; preds = %244
%253 = load i32, i32* %5
%254 = load i32, i32* %20
%255 = sdiv i32 10000, %254
%256 = add nsw i32 %253, %255
store i32 %256, i32* %5
store i32 0, i32* %2
br label %269
257: ; preds = %244
%258 = load i32, i32* %17
%259 = load i32, i32* %20
%260 = icmp sgt i32 %258, %259
br i1 %260, label %261, label %266
261: ; preds = %257
%262 = load i32, i32* %4
%263 = load i32, i32* %17
%264 = sdiv i32 10000, %263
%265 = add nsw i32 %262, %264
store i32 %265, i32* %4
store i32 1, i32* %2
br label %268
266: ; preds = %257
%267 = call i32 @random_range(i32 0, i32 1)
store i32 %267, i32* %2
br label %268
268: ; preds = %266, %261
br label %269
269: ; preds = %268, %252
br label %132
270: ; preds = %241, %189
%271 = load i8*, i8** %13
%272 = load i32, i32* %17
%273 = call i32 @sprintf(i8* %271, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %272)
%274 = load i32, i32* %7
%275 = load i8*, i8** %13
%276 = call i32 @write(i32 %274, i8* %275, i32 55)
%277 = icmp ne i32 %276, 55
br i1 %277, label %278, label %280
278: ; preds = %270
%279 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %280
280: ; preds = %278, %270
%281 = load i32, i32* %8
%282 = load i8*, i8** %13
%283 = call i32 @write(i32 %281, i8* %282, i32 55)
%284 = icmp ne i32 %283, 55
br i1 %284, label %285, label %287
285: ; preds = %280
%286 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %287
287: ; preds = %285, %280
%288 = load i8*, i8** %13
%289 = load i32, i32* %20
%290 = call i32 @sprintf(i8* %288, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %289)
%291 = load i32, i32* %8
%292 = load i8*, i8** %13
%293 = call i32 @write(i32 %291, i8* %292, i32 55)
%294 = icmp ne i32 %293, 55
br i1 %294, label %295, label %297
295: ; preds = %287
%296 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %297
297: ; preds = %295, %287
%298 = load i32, i32* %7
%299 = load i8*, i8** %13
%300 = call i32 @write(i32 %298, i8* %299, i32 55)
%301 = icmp ne i32 %300, 55
br i1 %301, label %302, label %304
302: ; preds = %297
%303 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %304
304: ; preds = %302, %297
%305 = load i32, i32* @EXIT_SUCCESS
%306 = call i32 @exit(i32 %305)
unreachable
}

LLVM IR (-O2):
@.str = [24 x i8] c"/tmp/awzurn_server_FIFO\00"
@.str.1 = [26 x i8] c"/tmp/awzurn_client_FIFO_1\00"
@.str.2 = [26 x i8] c"/tmp/awzurn_client_FIFO_2\00"
@S_IRUSR = global i32 0
@S_IWUSR = global i32 0
@S_IRGRP = global i32 0
@S_IWGRP = global i32 0
@S_IROTH = global i32 0
@S_IWOTH = global i32 0
@errno = global i64 0
@EEXIST = global i64 0
@.str.3 = [37 x i8] c"server_fifo creation error, exiting\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [39 x i8] c"client_fifo_1 creation error, exiting\0A\00"
@.str.5 = [39 x i8] c"client_fifo_2 creation error, exiting\0A\00"
@.str.6 = [34 x i8] c"attempting to open server fifo...\00"
@O_RDONLY = global i32 0
@.str.7 = [31 x i8] c"server_fd open error, exiting\0A\00"
@.str.9 = [35 x i8] c"attempting to open client1 fifo...\00"
@O_WRONLY = global i32 0
@.str.10 = [33 x i8] c"client_fd_1 open error, exiting\0A\00"
@.str.11 = [35 x i8] c"attempting to open client2 fifo...\00"
@.str.12 = [33 x i8] c"client_fd_2 open error, exiting\0A\00"
@.str.13 = [2 x i8] c"0\00"
@.str.14 = [23 x i8] c"write error to client1\00"
@.str.15 = [2 x i8] c"1\00"
@.str.16 = [11 x i8] c"read error\00"
@.str.18 = [12 x i8] c"write error\00"
@.str.19 = [4 x i8] c"end\00"
@.str.21 = [23 x i8] c"write error to client2\00"
@.str.23 = [13 x i8] c"client1: %d\0A\00"
@.str.24 = [13 x i8] c"client2: %d\0A\00"
@.str.25 = [3 x i8] c"%d\00"
@EXIT_SUCCESS = global i32 0
@str.27 = [9 x i8] c" opened!\00"
@str.28 = [35 x i8] c"Game over, player 2 is victorious!\00"
@str.29 = [35 x i8] c"Game over, player 1 is victorious!\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 55)
%2 = inttoptr i64 %1 to i8*
%3 = tail call i64 @malloc(i32 55)
%4 = tail call i32 @umask(i32 0)
%5 = load i32, i32* @S_IRUSR
%6 = load i32, i32* @S_IWUSR
%7 = or i32 %6, %5
%8 = load i32, i32* @S_IRGRP
%9 = or i32 %7, %8
%10 = load i32, i32* @S_IWGRP
%11 = or i32 %9, %10
%12 = load i32, i32* @S_IROTH
%13 = or i32 %11, %12
%14 = load i32, i32* @S_IWOTH
%15 = or i32 %13, %14
%16 = tail call i32 @mkfifo(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %26
18: ; preds = %0
%19 = load i64, i64* @errno
%20 = load i64, i64* @EEXIST
%21 = icmp eq i64 %19, %20
br i1 %21, label %26, label %22
22: ; preds = %18
%23 = tail call i32 @perror(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.3, i64 0, i64 0))
%24 = load i32, i32* @EXIT_FAILURE
%25 = tail call i32 @exit(i32 %24)
unreachable
26: ; preds = %18, %0
%27 = load i32, i32* @S_IRUSR
%28 = load i32, i32* @S_IWUSR
%29 = or i32 %28, %27
%30 = load i32, i32* @S_IRGRP
%31 = or i32 %29, %30
%32 = load i32, i32* @S_IWGRP
%33 = or i32 %31, %32
%34 = load i32, i32* @S_IROTH
%35 = or i32 %33, %34
%36 = load i32, i32* @S_IWOTH
%37 = or i32 %35, %36
%38 = tail call i32 @mkfifo(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %37)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %48
40: ; preds = %26
%41 = load i64, i64* @errno
%42 = load i64, i64* @EEXIST
%43 = icmp eq i64 %41, %42
br i1 %43, label %48, label %44
44: ; preds = %40
%45 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%46 = load i32, i32* @EXIT_FAILURE
%47 = tail call i32 @exit(i32 %46)
unreachable
48: ; preds = %40, %26
%49 = load i32, i32* @S_IRUSR
%50 = load i32, i32* @S_IWUSR
%51 = or i32 %50, %49
%52 = load i32, i32* @S_IRGRP
%53 = or i32 %51, %52
%54 = load i32, i32* @S_IWGRP
%55 = or i32 %53, %54
%56 = load i32, i32* @S_IROTH
%57 = or i32 %55, %56
%58 = load i32, i32* @S_IWOTH
%59 = or i32 %57, %58
%60 = tail call i32 @mkfifo(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %59)
%61 = icmp eq i32 %60, -1
br i1 %61, label %62, label %70
62: ; preds = %48
%63 = load i64, i64* @errno
%64 = load i64, i64* @EEXIST
%65 = icmp eq i64 %63, %64
br i1 %65, label %70, label %66
66: ; preds = %62
%67 = tail call i32 @perror(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.5, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
%69 = tail call i32 @exit(i32 %68)
unreachable
70: ; preds = %62, %48
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
%72 = load i32, i32* @O_RDONLY
%73 = tail call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %72)
%74 = icmp eq i32 %73, -1
br i1 %74, label %75, label %79
75: ; preds = %70
%76 = tail call i32 @perror(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.7, i64 0, i64 0))
%77 = load i32, i32* @EXIT_FAILURE
%78 = tail call i32 @exit(i32 %77)
unreachable
79: ; preds = %70
%80 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.27, i64 0, i64 0))
%81 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%82 = load i32, i32* @O_WRONLY
%83 = tail call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %82)
%84 = icmp eq i32 %83, -1
br i1 %84, label %85, label %89
85: ; preds = %79
%86 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.10, i64 0, i64 0))
%87 = load i32, i32* @EXIT_FAILURE
%88 = tail call i32 @exit(i32 %87)
unreachable
89: ; preds = %79
%90 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.27, i64 0, i64 0))
%91 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0))
%92 = load i32, i32* @O_WRONLY
%93 = tail call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %92)
%94 = icmp eq i32 %93, -1
br i1 %94, label %95, label %99
95: ; preds = %89
%96 = tail call i32 @perror(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0))
%97 = load i32, i32* @EXIT_FAILURE
%98 = tail call i32 @exit(i32 %97)
unreachable
99: ; preds = %89
%100 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.27, i64 0, i64 0))
br label %101
101: ; preds = %186, %99
%102 = phi i1 [ true, %99 ], [ false, %186 ]
%103 = phi i32 [ 0, %99 ], [ %187, %186 ]
br i1 %102, label %104, label %106
104: ; preds = %101
%105 = tail call i32 @random_range(i32 0, i32 1)
br label %106
106: ; preds = %104, %101
%107 = icmp eq i32 %103, 0
br i1 %107, label %108, label %143
108: ; preds = %106
%109 = tail call i32 @write(i32 %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 2)
%110 = icmp eq i32 %109, 2
br i1 %110, label %113, label %111
111: ; preds = %108
%112 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %113
113: ; preds = %111, %108
%114 = tail call i32 @write(i32 %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 2)
%115 = icmp eq i32 %114, 2
br i1 %115, label %118, label %116
116: ; preds = %113
%117 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %118
118: ; preds = %116, %113
%119 = tail call i32 @time(i32* null)
%120 = tail call i32 @read(i32 %73, i8* %2, i32 55)
%121 = icmp eq i32 %120, 55
br i1 %121, label %124, label %122
122: ; preds = %118
%123 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %124
124: ; preds = %122, %118
%125 = tail call i32 @time(i32* null)
%126 = sub nsw i32 %125, %119
%127 = tail call i32 @puts(i8* dereferenceable(1) %2)
%128 = tail call i32 @write(i32 %93, i8* %2, i32 55)
%129 = icmp eq i32 %128, 55
br i1 %129, label %132, label %130
130: ; preds = %124
%131 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %132
132: ; preds = %130, %124
%133 = tail call i32 @time(i32* null)
%134 = tail call i32 @read(i32 %73, i8* %2, i32 55)
%135 = icmp eq i32 %134, 55
br i1 %135, label %138, label %136
136: ; preds = %132
%137 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %138
138: ; preds = %136, %132
%139 = tail call i32 @time(i32* null)
%140 = sub nsw i32 %139, %133
%141 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%142 = icmp eq i64 %141, 0
br i1 %142, label %190, label %178
143: ; preds = %106
%144 = tail call i32 @write(i32 %93, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.13, i64 0, i64 0), i32 2)
%145 = icmp eq i32 %144, 2
br i1 %145, label %148, label %146
146: ; preds = %143
%147 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.21, i64 0, i64 0))
br label %148
148: ; preds = %146, %143
%149 = tail call i32 @write(i32 %83, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0), i32 2)
%150 = icmp eq i32 %149, 2
br i1 %150, label %153, label %151
151: ; preds = %148
%152 = tail call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.14, i64 0, i64 0))
br label %153
153: ; preds = %151, %148
%154 = tail call i32 @time(i32* null)
%155 = tail call i32 @read(i32 %73, i8* %2, i32 55)
%156 = icmp eq i32 %155, 55
br i1 %156, label %159, label %157
157: ; preds = %153
%158 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %159
159: ; preds = %157, %153
%160 = tail call i32 @time(i32* null)
%161 = sub nsw i32 %160, %154
%162 = tail call i32 @puts(i8* dereferenceable(1) %2)
%163 = tail call i32 @write(i32 %83, i8* %2, i32 55)
%164 = icmp eq i32 %163, 55
br i1 %164, label %167, label %165
165: ; preds = %159
%166 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %167
167: ; preds = %165, %159
%168 = tail call i32 @time(i32* null)
%169 = tail call i32 @read(i32 %73, i8* %2, i32 55)
%170 = icmp eq i32 %169, 55
br i1 %170, label %173, label %171
171: ; preds = %167
%172 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.16, i64 0, i64 0))
br label %173
173: ; preds = %171, %167
%174 = tail call i32 @time(i32* null)
%175 = sub nsw i32 %168, %174
%176 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.19, i64 0, i64 0))
%177 = icmp eq i64 %176, 0
br i1 %177, label %190, label %178
178: ; preds = %173, %138
%179 = phi i32 [ %126, %138 ], [ %175, %173 ]
%180 = phi i32 [ %140, %138 ], [ %161, %173 ]
%181 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.23, i64 0, i64 0), i32 %179)
%182 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.24, i64 0, i64 0), i32 %180)
%183 = icmp slt i32 %179, %180
br i1 %183, label %186, label %184
184: ; preds = %178
%185 = icmp sgt i32 %179, %180
br i1 %185, label %186, label %188
186: ; preds = %184, %178, %188
%187 = phi i32 [ 1, %184 ], [ 0, %178 ], [ %189, %188 ]
br label %101
188: ; preds = %184
%189 = tail call i32 @random_range(i32 0, i32 1)
br label %186
190: ; preds = %173, %138
%191 = phi i8* [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.29, i64 0, i64 0), %138 ], [ getelementptr inbounds ([35 x i8], [35 x i8]* @str.28, i64 0, i64 0), %173 ]
%192 = phi i32 [ %126, %138 ], [ %175, %173 ]
%193 = phi i32 [ %140, %138 ], [ %161, %173 ]
%194 = tail call i32 @puts(i8* dereferenceable(1) %191)
%195 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %192)
%196 = tail call i32 @write(i32 %83, i8* %2, i32 55)
%197 = icmp eq i32 %196, 55
br i1 %197, label %200, label %198
198: ; preds = %190
%199 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %200
200: ; preds = %198, %190
%201 = tail call i32 @write(i32 %93, i8* %2, i32 55)
%202 = icmp eq i32 %201, 55
br i1 %202, label %205, label %203
203: ; preds = %200
%204 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %205
205: ; preds = %203, %200
%206 = tail call i32 @sprintf(i8* dereferenceable(1) %2, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.25, i64 0, i64 0), i32 %193)
%207 = tail call i32 @write(i32 %93, i8* %2, i32 55)
%208 = icmp eq i32 %207, 55
br i1 %208, label %211, label %209
209: ; preds = %205
%210 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %211
211: ; preds = %209, %205
%212 = tail call i32 @write(i32 %83, i8* %2, i32 55)
%213 = icmp eq i32 %212, 55
br i1 %213, label %216, label %214
214: ; preds = %211
%215 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.18, i64 0, i64 0))
br label %216
216: ; preds = %214, %211
%217 = load i32, i32* @EXIT_SUCCESS
%218 = tail call i32 @exit(i32 %217)
unreachable
}