#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 */

/* Variables and functions */
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ EXIT_SUCCESS;
int /*<<< orphan*/ O_RDONLY;
int /*<<< orphan*/ O_WRONLY;
scalar_t__ atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
scalar_t__ malloc(int);
int open(char const *, int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int /*<<< orphan*/ sleep(int);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int write(int, char *, int);
int main() {
  const char *server_fifo = "/tmp/awzurn_server_FIFO";
  const char *my_fifo = "/tmp/awzurn_client_FIFO_1";
  int server_fd, my_fd, num_read;
  char *buffer, *buffer2;
  buffer = (char *)malloc(55 * sizeof(char));
  buffer2 = (char *)malloc(55 * sizeof(char));
  printf("Welcome to the Text Tumbler game, player 1.\nPlease wait for a "
         "response from the server.\n");
  server_fd = open(server_fifo, O_WRONLY);
  if (server_fd == -1) {
    printf("server_fd open error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf("server fifo open, attempting to open client fifo...");
  my_fd = open(my_fifo, O_RDONLY);
  if (my_fd == -1) {
    printf("my_fd open error, exiting\n");
    exit(EXIT_FAILURE);
  }
  printf(" opened!\n");
  printf("\n\n\n*********************************************\n");
  printf("*Welcome to the Text Tumble game, player 1.*\n*Please wait for a "
         "response from the server.*\n");
  printf("*********************************************\n");
  for (;;) {
    if (num_read = read(my_fd, buffer, 2) != 2) {
      perror("read error");
    }
    if ((atoi(buffer)) == 0) {
      sleep(3);
      printf("You are the pitcher! Please input a Text Tumble to throw to the "
             "other player!\n");
      fgets(buffer, 55, stdin);
      if (write(server_fd, buffer, 55) != 55) {
        perror("write error");
      }
    } else {
      printf("You are the catcher, please wait for you Text Tumble to be "
             "thrown!\n");
      read(my_fd, buffer, 55);
      printf("Here is your Text Tumble! Be Ready!\n");
      sleep(3);
      printf("%s\n", buffer);
      fgets(buffer2, 55, stdin);
      if (strcmp(buffer, buffer2) != 0) {
        printf("Sorry, you entered the incorrect text! Game Over!\n");
        if (write(server_fd, "end", 55) != 55) {
          perror("write error");
        }
        if (read(my_fd, buffer, 55) != 55) {
          perror("read error");
        }
        printf("Your Text Tumble score was: %s\n", buffer);
        int my_score, opp_score;
        my_score = atoi(buffer);
        if (read(my_fd, buffer, 55) != 55) {
          perror("read error");
        }
        printf("Your Opponent's Text Tumble score was: %s\n", buffer);
        opp_score = atoi(buffer);
        if (opp_score > my_score) {
          printf("You lose!\n");
        } else if (my_score > opp_score) {
          printf("You win!\n");
        } else {
          printf("Bad scores!");
        }
        exit(EXIT_SUCCESS);
      }
      if (write(server_fd, buffer2, 55) != 55) {
        perror("write error");
      }
    }
  }
  exit(EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xe3a(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xe47(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    $0x37,%edi
call   1080 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    $0x37,%edi
call   1080 <malloc@plt>
mov    %rax,-0x38(%rbp)
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rdi
mov    0x2dae(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    123a <main+0x8a>
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
lea    0xe69(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
call   1090 <open@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0xffffffff,-0x20(%rbp)
jne    1283 <main+0xd3>
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2d54(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe52(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x2,%edx
call   1050 <read@plt>
cmp    $0x2,%eax
setne  %al
mov    %al,%cl
and    $0x1,%cl
movzbl %cl,%ecx
mov    %ecx,-0x24(%rbp)
test   $0x1,%al
jne    12ea <main+0x13a>
jmp    12f6 <main+0x146>
lea    0xea0(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x30(%rbp),%rdi
call   10b0 <atoi@plt>
cmp    $0x0,%rax
jne    1363 <main+0x1b3>
mov    $0x3,%edi
call   10d0 <sleep@plt>
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
mov    0x2cb4(%rip),%rax
mov    (%rax),%edx
mov    $0x37,%esi
call   1060 <fgets@plt>
mov    -0x1c(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     135e <main+0x1ae>
lea    0xe92(%rip),%rdi
call   10a0 <perror@plt>
jmp    1523 <main+0x373>
lea    0xe8d(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%edi
call   10d0 <sleep@plt>
mov    -0x30(%rbp),%rsi
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x38(%rbp),%rdi
mov    0x2c29(%rip),%rax
mov    (%rax),%edx
mov    $0x37,%esi
call   1060 <fgets@plt>
mov    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%rsi
call   1070 <strcmp@plt>
cmp    $0x0,%rax
je     14f8 <main+0x348>
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%edi
lea    0xea1(%rip),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     1411 <main+0x261>
lea    0xddf(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
cmp    $0x37,%eax
je     1437 <main+0x287>
lea    0xd5f(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x30(%rbp),%rsi
lea    0xe55(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x20(%rbp),%edi
mov    -0x30(%rbp),%rsi
mov    $0x37,%edx
call   1050 <read@plt>
cmp    $0x37,%eax
je     147b <main+0x2cb>
lea    0xd1b(%rip),%rdi
call   10a0 <perror@plt>
mov    -0x30(%rbp),%rsi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x30(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x3c(%rbp),%eax
jle    14b8 <main+0x308>
lea    0xe36(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14ea <main+0x33a>
mov    -0x3c(%rbp),%eax
cmp    -0x40(%rbp),%eax
jle    14d7 <main+0x327>
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14e5 <main+0x335>
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    14ea <main+0x33a>
mov    0x2ad7(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x1c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    $0x37,%edx
call   1030 <write@plt>
cmp    $0x37,%eax
je     151e <main+0x36e>
lea    0xcd2(%rip),%rdi
call   10a0 <perror@plt>
jmp    1523 <main+0x373>
jmp    12bb <main+0x10b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x37,%edi
call   1090 <malloc@plt>
mov    %rax,%rbx
mov    $0x37,%edi
call   1090 <malloc@plt>
mov    %rax,%rbp
lea    0xeec(%rip),%rdi
call   1030 <puts@plt>
mov    0x2dc0(%rip),%rax
mov    (%rax),%esi
lea    0xdff(%rip),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
jne    1214 <main+0x54>
lea    0x10c7(%rip),%rdi
jmp    1246 <main+0x86>
mov    %eax,%r15d
lea    0xe14(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2dbc(%rip),%rax
mov    (%rax),%esi
lea    0xde3(%rip),%rdi
call   10a0 <open@plt>
cmp    $0xffffffff,%eax
jne    1259 <main+0x99>
lea    0x1079(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d7e(%rip),%rax
mov    (%rax),%edi
call   10d0 <exit@plt>
mov    %eax,%r14d
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
lea    0xeca(%rip),%rdi
call   1030 <puts@plt>
lea    0xeef(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb5(%rip),%rdi
call   1030 <puts@plt>
mov    0x2d4d(%rip),%r13
lea    0xf6e(%rip),%r12
jmp    12e0 <main+0x120>
nopl   0x0(%rax)
mov    $0x3,%edi
call   10e0 <sleep@plt>
lea    0xfc0(%rip),%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
mov    $0x37,%esi
call   1070 <fgets@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
jne    1372 <main+0x1b2>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x2,%edx
call   1060 <read@plt>
cmp    $0x2,%eax
jne    1364 <main+0x1a4>
mov    %rbx,%rdi
call   10c0 <atoi@plt>
test   %rax,%rax
je     12a0 <main+0xe0>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    $0x3,%edi
call   10e0 <sleep@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    0x0(%r13),%edx
mov    %rbp,%rdi
mov    $0x37,%esi
call   1070 <fgets@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1080 <strcmp@plt>
test   %rax,%rax
jne    1383 <main+0x1c3>
mov    %r15d,%edi
mov    %rbp,%rsi
jmp    12cd <main+0x10d>
lea    0xcfb(%rip),%rdi
call   10b0 <perror@plt>
jmp    12f5 <main+0x135>
lea    0xcf8(%rip),%rdi
call   10b0 <perror@plt>
jmp    12e0 <main+0x120>
lea    0xea2(%rip),%rdi
call   1030 <puts@plt>
lea    0xce7(%rip),%rsi
mov    %r15d,%edi
mov    $0x37,%edx
call   1040 <write@plt>
cmp    $0x37,%eax
je     13b4 <main+0x1f4>
lea    0xcc2(%rip),%rdi
call   10b0 <perror@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
je     13d5 <main+0x215>
lea    0xc96(%rip),%rdi
call   10b0 <perror@plt>
lea    0xca5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   10c0 <atoi@plt>
mov    %rax,%rbp
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x37,%edx
call   1060 <read@plt>
cmp    $0x37,%eax
je     1412 <main+0x252>
lea    0xc59(%rip),%rdi
call   10b0 <perror@plt>
lea    0xc88(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
call   10c0 <atoi@plt>
cmp    %ebp,%eax
jle    143d <main+0x27d>
lea    0xe31(%rip),%rdi
call   1030 <puts@plt>
jmp    145b <main+0x29b>
jge    144d <main+0x28d>
lea    0xe18(%rip),%rdi
call   1030 <puts@plt>
jmp    145b <main+0x29b>
lea    0xc78(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2b66(%rip),%rax
mov    (%rax),%edi
call   10d0 <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 = [89 x i8] c"Welcome to the Text Tumbler game, player 1.\0APlease wait for a response from the server.\0A\00"
@O_WRONLY = global i32 0
@.str.3 = [31 x i8] c"server_fd open error, exiting\0A\00"
@EXIT_FAILURE = global i32 0
@.str.4 = [52 x i8] c"server fifo open, attempting to open client fifo...\00"
@O_RDONLY = global i32 0
@.str.5 = [27 x i8] c"my_fd open error, exiting\0A\00"
@.str.6 = [10 x i8] c" opened!\0A\00"
@.str.7 = [50 x i8] c"\0A\0A\0A*********************************************\0A\00"
@.str.8 = [92 x i8] c"*Welcome to the Text Tumble game, player 1.*\0A*Please wait for a response from the server.*\0A\00"
@.str.9 = [47 x i8] c"*********************************************\0A\00"
@.str.10 = [11 x i8] c"read error\00"
@.str.11 = [79 x i8] c"You are the pitcher! Please input a Text Tumble to throw to the other player!\0A\00"
@stdin = global i32 0
@.str.12 = [12 x i8] c"write error\00"
@.str.13 = [68 x i8] c"You are the catcher, please wait for you Text Tumble to be thrown!\0A\00"
@.str.14 = [37 x i8] c"Here is your Text Tumble! Be Ready!\0A\00"
@.str.15 = [4 x i8] c"%s\0A\00"
@.str.16 = [51 x i8] c"Sorry, you entered the incorrect text! Game Over!\0A\00"
@.str.17 = [4 x i8] c"end\00"
@.str.18 = [32 x i8] c"Your Text Tumble score was: %s\0A\00"
@.str.19 = [43 x i8] c"Your Opponent's Text Tumble score was: %s\0A\00"
@.str.20 = [11 x i8] c"You lose!\0A\00"
@.str.21 = [10 x i8] c"You win!\0A\00"
@.str.22 = [12 x i8] c"Bad scores!\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %1
store i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8** %2
store i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i8** %3
%11 = call i64 @malloc(i32 55)
%12 = inttoptr i64 %11 to i8*
store i8* %12, i8** %7
%13 = call i64 @malloc(i32 55)
%14 = inttoptr i64 %13 to i8*
store i8* %14, i8** %8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
%16 = load i8*, i8** %2
%17 = load i32, i32* @O_WRONLY
%18 = call i32 @open(i8* %16, i32 %17)
store i32 %18, i32* %4
%19 = load i32, i32* %4
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %0
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.3, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%27 = load i8*, i8** %3
%28 = load i32, i32* @O_RDONLY
%29 = call i32 @open(i8* %27, i32 %28)
store i32 %29, i32* %5
%30 = load i32, i32* %5
%31 = icmp eq i32 %30, -1
br i1 %31, label %32, label %36
32: ; preds = %25
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.5, i64 0, i64 0))
%34 = load i32, i32* @EXIT_FAILURE
%35 = call i32 @exit(i32 %34)
unreachable
36: ; preds = %25
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0))
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.7, i64 0, i64 0))
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str.8, i64 0, i64 0))
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.9, i64 0, i64 0))
br label %41
41: ; preds = %139, %36
%42 = load i32, i32* %5
%43 = load i8*, i8** %7
%44 = call i32 @read(i32 %42, i8* %43, i32 2)
%45 = icmp ne i32 %44, 2
%46 = zext i1 %45 to i32
store i32 %46, i32* %6
br i1 %45, label %47, label %49
47: ; preds = %41
%48 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %49
49: ; preds = %47, %41
%50 = load i8*, i8** %7
%51 = call i64 @atoi(i8* %50)
%52 = icmp eq i64 %51, 0
br i1 %52, label %53, label %66
53: ; preds = %49
%54 = call i32 @sleep(i32 3)
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.11, i64 0, i64 0))
%56 = load i8*, i8** %7
%57 = load i32, i32* @stdin
%58 = call i32 @fgets(i8* %56, i32 55, i32 %57)
%59 = load i32, i32* %4
%60 = load i8*, i8** %7
%61 = call i32 @write(i32 %59, i8* %60, i32 55)
%62 = icmp ne i32 %61, 55
br i1 %62, label %63, label %65
63: ; preds = %53
%64 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %65
65: ; preds = %63, %53
br label %139
66: ; preds = %49
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.13, i64 0, i64 0))
%68 = load i32, i32* %5
%69 = load i8*, i8** %7
%70 = call i32 @read(i32 %68, i8* %69, i32 55)
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.14, i64 0, i64 0))
%72 = call i32 @sleep(i32 3)
%73 = load i8*, i8** %7
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.15, i64 0, i64 0), i8* %73)
%75 = load i8*, i8** %8
%76 = load i32, i32* @stdin
%77 = call i32 @fgets(i8* %75, i32 55, i32 %76)
%78 = load i8*, i8** %7
%79 = load i8*, i8** %8
%80 = call i64 @strcmp(i8* %78, i8* %79)
%81 = icmp ne i64 %80, 0
br i1 %81, label %82, label %131
82: ; preds = %66
%83 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.16, i64 0, i64 0))
%84 = load i32, i32* %4
%85 = call i32 @write(i32 %84, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 55)
%86 = icmp ne i32 %85, 55
br i1 %86, label %87, label %89
87: ; preds = %82
%88 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %89
89: ; preds = %87, %82
%90 = load i32, i32* %5
%91 = load i8*, i8** %7
%92 = call i32 @read(i32 %90, i8* %91, i32 55)
%93 = icmp ne i32 %92, 55
br i1 %93, label %94, label %96
94: ; preds = %89
%95 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %96
96: ; preds = %94, %89
%97 = load i8*, i8** %7
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0), i8* %97)
%99 = load i8*, i8** %7
%100 = call i64 @atoi(i8* %99)
%101 = trunc i64 %100 to i32
store i32 %101, i32* %9
%102 = load i32, i32* %5
%103 = load i8*, i8** %7
%104 = call i32 @read(i32 %102, i8* %103, i32 55)
%105 = icmp ne i32 %104, 55
br i1 %105, label %106, label %108
106: ; preds = %96
%107 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %108
108: ; preds = %106, %96
%109 = load i8*, i8** %7
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.19, i64 0, i64 0), i8* %109)
%111 = load i8*, i8** %7
%112 = call i64 @atoi(i8* %111)
%113 = trunc i64 %112 to i32
store i32 %113, i32* %10
%114 = load i32, i32* %10
%115 = load i32, i32* %9
%116 = icmp sgt i32 %114, %115
br i1 %116, label %117, label %119
117: ; preds = %108
%118 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.20, i64 0, i64 0))
br label %128
119: ; preds = %108
%120 = load i32, i32* %9
%121 = load i32, i32* %10
%122 = icmp sgt i32 %120, %121
br i1 %122, label %123, label %125
123: ; preds = %119
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.21, i64 0, i64 0))
br label %127
125: ; preds = %119
%126 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0))
br label %127
127: ; preds = %125, %123
br label %128
128: ; preds = %127, %117
%129 = load i32, i32* @EXIT_SUCCESS
%130 = call i32 @exit(i32 %129)
unreachable
131: ; preds = %66
%132 = load i32, i32* %4
%133 = load i8*, i8** %8
%134 = call i32 @write(i32 %132, i8* %133, i32 55)
%135 = icmp ne i32 %134, 55
br i1 %135, label %136, label %138
136: ; preds = %131
%137 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %138
138: ; preds = %136, %131
br label %139
139: ; preds = %138, %65
br label %41
}

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"
@O_WRONLY = global i32 0
@EXIT_FAILURE = global i32 0
@.str.4 = [52 x i8] c"server fifo open, attempting to open client fifo...\00"
@O_RDONLY = global i32 0
@.str.10 = [11 x i8] c"read error\00"
@stdin = global i32 0
@.str.12 = [12 x i8] c"write error\00"
@.str.17 = [4 x i8] c"end\00"
@.str.18 = [32 x i8] c"Your Text Tumble score was: %s\0A\00"
@.str.19 = [43 x i8] c"Your Opponent's Text Tumble score was: %s\0A\00"
@.str.22 = [12 x i8] c"Bad scores!\00"
@EXIT_SUCCESS = global i32 0
@str = [88 x i8] c"Welcome to the Text Tumbler game, player 1.\0APlease wait for a response from the server.\00"
@str.23 = [9 x i8] c" opened!\00"
@str.24 = [49 x i8] c"\0A\0A\0A*********************************************\00"
@str.25 = [91 x i8] c"*Welcome to the Text Tumble game, player 1.*\0A*Please wait for a response from the server.*\00"
@str.26 = [46 x i8] c"*********************************************\00"
@str.27 = [67 x i8] c"You are the catcher, please wait for you Text Tumble to be thrown!\00"
@str.28 = [36 x i8] c"Here is your Text Tumble! Be Ready!\00"
@str.29 = [50 x i8] c"Sorry, you entered the incorrect text! Game Over!\00"
@str.30 = [9 x i8] c"You win!\00"
@str.31 = [10 x i8] c"You lose!\00"
@str.32 = [78 x i8] c"You are the pitcher! Please input a Text Tumble to throw to the other player!\00"
@str.33 = [26 x i8] c"my_fd open error, exiting\00"
@str.34 = [30 x i8] c"server_fd open error, exiting\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 = inttoptr i64 %3 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str, i64 0, i64 0))
%6 = load i32, i32* @O_WRONLY
%7 = tail call i32 @open(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %13
9: ; preds = %0
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.34, i64 0, i64 0))
%11 = load i32, i32* @EXIT_FAILURE
%12 = tail call i32 @exit(i32 %11)
unreachable
13: ; preds = %0
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str.4, i64 0, i64 0))
%15 = load i32, i32* @O_RDONLY
%16 = tail call i32 @open(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = icmp eq i32 %16, -1
br i1 %17, label %18, label %22
18: ; preds = %13
%19 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.33, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %13
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.23, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.24, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([91 x i8], [91 x i8]* @str.25, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.26, i64 0, i64 0))
br label %27
27: ; preds = %92, %22
%28 = tail call i32 @read(i32 %16, i8* %2, i32 2)
%29 = icmp eq i32 %28, 2
br i1 %29, label %32, label %30
30: ; preds = %27
%31 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %32
32: ; preds = %30, %27
%33 = tail call i64 @atoi(i8* %2)
%34 = icmp eq i64 %33, 0
br i1 %34, label %35, label %42
35: ; preds = %32
%36 = tail call i32 @sleep(i32 3)
%37 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @str.32, i64 0, i64 0))
%38 = load i32, i32* @stdin
%39 = tail call i32 @fgets(i8* %2, i32 55, i32 %38)
%40 = tail call i32 @write(i32 %7, i8* %2, i32 55)
%41 = icmp eq i32 %40, 55
br i1 %41, label %92, label %90
42: ; preds = %32
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.27, i64 0, i64 0))
%44 = tail call i32 @read(i32 %16, i8* %2, i32 55)
%45 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.28, i64 0, i64 0))
%46 = tail call i32 @sleep(i32 3)
%47 = tail call i32 @puts(i8* dereferenceable(1) %2)
%48 = load i32, i32* @stdin
%49 = tail call i32 @fgets(i8* %4, i32 55, i32 %48)
%50 = tail call i64 @strcmp(i8* %2, i8* %4)
%51 = icmp eq i64 %50, 0
br i1 %51, label %87, label %52
52: ; preds = %42
%53 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @str.29, i64 0, i64 0))
%54 = tail call i32 @write(i32 %7, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.17, i64 0, i64 0), i32 55)
%55 = icmp eq i32 %54, 55
br i1 %55, label %58, label %56
56: ; preds = %52
%57 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %58
58: ; preds = %56, %52
%59 = tail call i32 @read(i32 %16, i8* %2, i32 55)
%60 = icmp eq i32 %59, 55
br i1 %60, label %63, label %61
61: ; preds = %58
%62 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %63
63: ; preds = %61, %58
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.18, i64 0, i64 0), i8* %2)
%65 = tail call i64 @atoi(i8* %2)
%66 = trunc i64 %65 to i32
%67 = tail call i32 @read(i32 %16, i8* %2, i32 55)
%68 = icmp eq i32 %67, 55
br i1 %68, label %71, label %69
69: ; preds = %63
%70 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.10, i64 0, i64 0))
br label %71
71: ; preds = %69, %63
%72 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str.19, i64 0, i64 0), i8* %2)
%73 = tail call i64 @atoi(i8* %2)
%74 = trunc i64 %73 to i32
%75 = icmp sgt i32 %74, %66
br i1 %75, label %76, label %78
76: ; preds = %71
%77 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.31, i64 0, i64 0))
br label %84
78: ; preds = %71
%79 = icmp sgt i32 %66, %74
br i1 %79, label %80, label %82
80: ; preds = %78
%81 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.30, i64 0, i64 0))
br label %84
82: ; preds = %78
%83 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.22, i64 0, i64 0))
br label %84
84: ; preds = %80, %82, %76
%85 = load i32, i32* @EXIT_SUCCESS
%86 = tail call i32 @exit(i32 %85)
unreachable
87: ; preds = %42
%88 = tail call i32 @write(i32 %7, i8* %4, i32 55)
%89 = icmp eq i32 %88, 55
br i1 %89, label %92, label %90
90: ; preds = %87, %35
%91 = tail call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
br label %92
92: ; preds = %90, %87, %35
br label %27
}