#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct sockaddr_storage {
  int dummy;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  char *sin_zero;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ serverAddr;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_addr(char *);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int strlen(char *);
int main() {
  int welcomeSocket, newSocket;
  char buffer[1000];
  struct sockaddr_in serverAddr;
  struct sockaddr_storage serverStorage;
  socklen_t addr_size;
  char input[1000];
  int gamenumber = 1;
  char player_win[1000];
  char comp_win[1000];
  char tie[1000];
  welcomeSocket = socket(PF_INET, SOCK_STREAM, 0);
  serverAddr.sin_family = AF_INET;
  serverAddr.sin_port = htons(4501);
  serverAddr.sin_addr.s_addr = inet_addr("127.0.0.1");
  memset(serverAddr.sin_zero, '\0', sizeof serverAddr.sin_zero);
  bind(welcomeSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr));
  if (listen(welcomeSocket, 5) == 0)
    printf("Listening\n");
  else
    printf("Error\n");
  int read_size;
  int ties = 0;
  int player_wins = 0;
  int comp_wins = 0;
  char str_player[1000];
  char str_comp[1000];
  char str_tie[1000];
  addr_size = sizeof serverStorage;
  newSocket =
      accept(welcomeSocket, (struct sockaddr *)&serverStorage, &addr_size);
  do {
    strcat(player_win, "player 1 wins!");
    strcat(comp_win, "player 2 wins!");
    strcat(tie, "is a tie!");
    sprintf(str_player, "%d", gamenumber);
    sprintf(str_comp, "%d", gamenumber);
    sprintf(str_tie, "%d", gamenumber);
    strcat(str_player, " ");
    strcat(str_comp, " ");
    strcat(str_tie, " ");
    strcat(str_player, player_win);
    strcat(str_comp, comp_win);
    strcat(str_tie, tie);
    memset((input), 0, strlen(input));
    read_size = (recv(newSocket, input, 2000, 0));
    if (strcmp(str_player, input) == 0)
      player_wins++;
    if (strcmp(str_comp, input) == 0)
      comp_wins++;
    if (strcmp(str_tie, input) == 0)
      ties++;
    gamenumber++;
    memset((str_player), 0, strlen(str_player));
    memset((str_comp), 0, strlen(str_comp));
    memset((str_tie), 0, strlen(str_tie));
    memset((player_win), 0, strlen(player_win));
    memset((comp_win), 0, strlen(comp_win));
    memset((tie), 0, strlen(tie));
  } while (strcmp(input, "quit") != 0);
  printf("Player wins %d\n", player_wins);
  printf("Comp wins %d\n", comp_wins);
  printf("Ties %d\n", ties);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2000,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x814(%rbp)
mov    0x2ddd(%rip),%rax
mov    (%rax),%edi
mov    0x2ddc(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10f0 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    0x2dd9(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x408(%rbp)
mov    $0x1195,%edi
call   1050 <htons@plt>
mov    %eax,-0x40c(%rbp)
lea    0xdd2(%rip),%rdi
call   1080 <inet_addr@plt>
mov    %eax,-0x410(%rbp)
mov    -0x418(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
mov    -0x8(%rbp),%edi
lea    -0x418(%rbp),%rsi
mov    $0x18,%edx
call   10b0 <bind@plt>
mov    -0x8(%rbp),%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
cmp    $0x0,%rax
jne    128a <main+0xba>
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    1298 <main+0xc8>
lea    0xd84(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x0,-0x13e8(%rbp)
movl   $0x0,-0x13ec(%rbp)
movl   $0x0,-0x13f0(%rbp)
movl   $0x4,-0x424(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x420(%rbp),%rsi
lea    -0x424(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0xc(%rbp)
lea    -0xc00(%rbp),%rdi
lea    0xd35(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0xff0(%rbp),%rdi
lea    0xd31(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x13e0(%rbp),%rdi
lea    0xd2d(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x17e0(%rbp),%rdi
mov    -0x814(%rbp),%edx
lea    0xd1e(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x1bd0(%rbp),%rdi
mov    -0x814(%rbp),%edx
lea    0xd05(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x1fc0(%rbp),%rdi
mov    -0x814(%rbp),%edx
lea    0xcec(%rip),%rsi
call   10e0 <sprintf@plt>
lea    -0x17e0(%rbp),%rdi
lea    0xcdc(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1bd0(%rbp),%rdi
lea    0xcc9(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x1fc0(%rbp),%rdi
lea    0xcb6(%rip),%rsi
call   10d0 <strcat@plt>
lea    -0x17e0(%rbp),%rdi
lea    -0xc00(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x1bd0(%rbp),%rdi
lea    -0xff0(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x1fc0(%rbp),%rdi
lea    -0x13e0(%rbp),%rsi
call   10d0 <strcat@plt>
lea    -0x810(%rbp),%rax
mov    %rax,-0x1fc8(%rbp)
lea    -0x810(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1fc8(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
mov    -0xc(%rbp),%edi
lea    -0x810(%rbp),%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x13e4(%rbp)
lea    -0x17e0(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1441 <main+0x271>
mov    -0x13ec(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13ec(%rbp)
lea    -0x1bd0(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    146d <main+0x29d>
mov    -0x13f0(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13f0(%rbp)
lea    -0x1fc0(%rbp),%rdi
lea    -0x810(%rbp),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1499 <main+0x2c9>
mov    -0x13e8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x13e8(%rbp)
mov    -0x814(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x814(%rbp)
lea    -0x17e0(%rbp),%rax
mov    %rax,-0x1ff8(%rbp)
lea    -0x17e0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1ff8(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0x1bd0(%rbp),%rax
mov    %rax,-0x1ff0(%rbp)
lea    -0x1bd0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1ff0(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0x1fc0(%rbp),%rax
mov    %rax,-0x1fe8(%rbp)
lea    -0x1fc0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1fe8(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0xc00(%rbp),%rax
mov    %rax,-0x1fe0(%rbp)
lea    -0xc00(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1fe0(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0xff0(%rbp),%rax
mov    %rax,-0x1fd8(%rbp)
lea    -0xff0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1fd8(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0x13e0(%rbp),%rax
mov    %rax,-0x1fd0(%rbp)
lea    -0x13e0(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x1fd0(%rbp),%rdi
mov    %eax,%edx
xor    %esi,%esi
call   1070 <memset@plt>
lea    -0x810(%rbp),%rdi
lea    0xa97(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    12d9 <main+0x109>
mov    -0x13ec(%rbp),%esi
lea    0xa80(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x13f0(%rbp),%esi
lea    0xa7c(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x13e8(%rbp),%esi
lea    0xa76(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
xor    %eax,%eax
add    $0x2000,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1bb8,%rsp
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    0x2dd7(%rip),%rax
mov    (%rax),%esi
xor    %r15d,%r15d
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,%ebp
mov    0x2dd2(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x28(%rsp)
mov    $0x1195,%edi
call   1060 <htons@plt>
mov    %eax,0x24(%rsp)
lea    0xdcf(%rip),%rdi
call   1090 <inet_addr@plt>
mov    %eax,0x20(%rsp)
xor    %esi,%esi
mov    $0x8,%edx
call   1080 <memset@plt>
lea    0x18(%rsp),%rsi
mov    %ebp,%edi
mov    $0x18,%edx
call   10c0 <bind@plt>
mov    %ebp,%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
test   %rax,%rax
lea    0xdfc(%rip),%rax
lea    0xdef(%rip),%rdi
cmove  %rax,%rdi
call   1040 <puts@plt>
movl   $0x4,0xc(%rsp)
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %ebp,%edi
call   10d0 <accept@plt>
mov    %eax,0x4(%rsp)
mov    $0x1,%r13d
xor    %ebp,%ebp
xor    %r12d,%r12d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,0x8(%rsp)
lea    0xff0(%rsp),%rdi
lea    0xd46(%rip),%rsi
call   10e0 <strcat@plt>
lea    0xc00(%rsp),%rdi
lea    0xd41(%rip),%rsi
call   10e0 <strcat@plt>
lea    0x810(%rsp),%rdi
lea    0xd3c(%rip),%rsi
call   10e0 <strcat@plt>
lea    0x420(%rsp),%rdi
lea    0xd32(%rip),%r14
mov    %r14,%rsi
mov    %r13d,%edx
call   10f0 <sprintf@plt>
lea    0x17d0(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   10f0 <sprintf@plt>
lea    0x30(%rsp),%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   10f0 <sprintf@plt>
lea    0x420(%rsp),%r14
mov    %r14,%rdi
lea    0xcf2(%rip),%rbx
mov    %rbx,%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   10e0 <strcat@plt>
lea    0x30(%rsp),%rdi
mov    %rbx,%rsi
call   10e0 <strcat@plt>
mov    %r14,%rdi
lea    0xff0(%rsp),%rsi
call   10e0 <strcat@plt>
mov    %r15,%rdi
lea    0xc00(%rsp),%rsi
call   10e0 <strcat@plt>
lea    0x30(%rsp),%rdi
lea    0x810(%rsp),%rsi
call   10e0 <strcat@plt>
lea    0x13e0(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
mov    $0x7d0,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
cmp    $0x1,%rax
adc    $0x0,%ebp
mov    %r15,%r14
mov    %r15,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
cmp    $0x1,%rax
adc    $0x0,%r12d
lea    0x30(%rsp),%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
cmp    $0x1,%rax
mov    0x8(%rsp),%r15d
adc    $0x0,%r15d
add    $0x1,%r13d
lea    0x420(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
mov    %r14,%rdi
call   1050 <strlen@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
lea    0x30(%rsp),%rdi
mov    %rdi,%r14
call   1050 <strlen@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
lea    0xff0(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
lea    0xc00(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
lea    0x810(%rsp),%rbx
mov    %rbx,%rdi
call   1050 <strlen@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1080 <memset@plt>
lea    0x13e0(%rsp),%rdi
lea    0xb81(%rip),%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    12b0 <main+0xd0>
lea    0xb71(%rip),%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb71(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb6e(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x1bb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.1 = [11 x i8] c"Listening\0A\00"
@.str.2 = [7 x i8] c"Error\0A\00"
@.str.3 = [15 x i8] c"player 1 wins!\00"
@.str.4 = [15 x i8] c"player 2 wins!\00"
@.str.5 = [10 x i8] c"is a tie!\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [5 x i8] c"quit\00"
@.str.9 = [16 x i8] c"Player wins %d\0A\00"
@.str.10 = [14 x i8] c"Comp wins %d\0A\00"
@.str.11 = [9 x i8] c"Ties %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca %struct.sockaddr_in
%6 = alloca %struct.sockaddr_storage
%7 = alloca i32
%8 = alloca [1000 x i8]
%9 = alloca i32
%10 = alloca [1000 x i8]
%11 = alloca [1000 x i8]
%12 = alloca [1000 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca [1000 x i8]
%18 = alloca [1000 x i8]
%19 = alloca [1000 x i8]
store i32 0, i32* %1
store i32 1, i32* %9
%20 = load i32, i32* @PF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = call i32 @socket(i32 %20, i32 %21, i32 0)
store i32 %22, i32* %2
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 3
store i32 %23, i32* %24
%25 = call i32 @htons(i32 4501)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 2
store i32 %25, i32* %26
%27 = call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
store i32 %27, i32* %29
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
%31 = load i8*, i8** %30
%32 = call i32 @memset(i8* %31, i8 signext 0, i32 8)
%33 = load i32, i32* %2
%34 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%35 = call i32 @bind(i32 %33, %struct.sockaddr* %34, i32 24)
%36 = load i32, i32* %2
%37 = call i64 @listen(i32 %36, i32 5)
%38 = icmp eq i64 %37, 0
br i1 %38, label %39, label %41
39: ; preds = %0
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %43
41: ; preds = %0
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
br label %43
43: ; preds = %41, %39
store i32 0, i32* %14
store i32 0, i32* %15
store i32 0, i32* %16
store i32 4, i32* %7
%44 = load i32, i32* %2
%45 = bitcast %struct.sockaddr_storage* %6 to %struct.sockaddr*
%46 = call i32 @accept(i32 %44, %struct.sockaddr* %45, i32* %7)
store i32 %46, i32* %3
br label %47
47: ; preds = %135, %43
%48 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%49 = call i32 @strcat(i8* %48, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%50 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%51 = call i32 @strcat(i8* %50, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%52 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%53 = call i32 @strcat(i8* %52, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%54 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%55 = load i32, i32* %9
%56 = call i32 @sprintf(i8* %54, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %55)
%57 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%58 = load i32, i32* %9
%59 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %58)
%60 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%61 = load i32, i32* %9
%62 = call i32 @sprintf(i8* %60, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %61)
%63 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%64 = call i32 @strcat(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%65 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%66 = call i32 @strcat(i8* %65, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%67 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%68 = call i32 @strcat(i8* %67, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%69 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%70 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%71 = call i32 @strcat(i8* %69, i8* %70)
%72 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%73 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%74 = call i32 @strcat(i8* %72, i8* %73)
%75 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%76 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%77 = call i32 @strcat(i8* %75, i8* %76)
%78 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%79 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%80 = call i32 @strlen(i8* %79)
%81 = call i32 @memset(i8* %78, i8 signext 0, i32 %80)
%82 = load i32, i32* %3
%83 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%84 = call i32 @recv(i32 %82, i8* %83, i32 2000, i32 0)
store i32 %84, i32* %13
%85 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%86 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%87 = call i64 @strcmp(i8* %85, i8* %86)
%88 = icmp eq i64 %87, 0
br i1 %88, label %89, label %92
89: ; preds = %47
%90 = load i32, i32* %15
%91 = add nsw i32 %90, 1
store i32 %91, i32* %15
br label %92
92: ; preds = %89, %47
%93 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%94 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%95 = call i64 @strcmp(i8* %93, i8* %94)
%96 = icmp eq i64 %95, 0
br i1 %96, label %97, label %100
97: ; preds = %92
%98 = load i32, i32* %16
%99 = add nsw i32 %98, 1
store i32 %99, i32* %16
br label %100
100: ; preds = %97, %92
%101 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%102 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%103 = call i64 @strcmp(i8* %101, i8* %102)
%104 = icmp eq i64 %103, 0
br i1 %104, label %105, label %108
105: ; preds = %100
%106 = load i32, i32* %14
%107 = add nsw i32 %106, 1
store i32 %107, i32* %14
br label %108
108: ; preds = %105, %100
%109 = load i32, i32* %9
%110 = add nsw i32 %109, 1
store i32 %110, i32* %9
%111 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%112 = getelementptr inbounds [1000 x i8], [1000 x i8]* %17, i64 0, i64 0
%113 = call i32 @strlen(i8* %112)
%114 = call i32 @memset(i8* %111, i8 signext 0, i32 %113)
%115 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%116 = getelementptr inbounds [1000 x i8], [1000 x i8]* %18, i64 0, i64 0
%117 = call i32 @strlen(i8* %116)
%118 = call i32 @memset(i8* %115, i8 signext 0, i32 %117)
%119 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%120 = getelementptr inbounds [1000 x i8], [1000 x i8]* %19, i64 0, i64 0
%121 = call i32 @strlen(i8* %120)
%122 = call i32 @memset(i8* %119, i8 signext 0, i32 %121)
%123 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%124 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
%125 = call i32 @strlen(i8* %124)
%126 = call i32 @memset(i8* %123, i8 signext 0, i32 %125)
%127 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%128 = getelementptr inbounds [1000 x i8], [1000 x i8]* %11, i64 0, i64 0
%129 = call i32 @strlen(i8* %128)
%130 = call i32 @memset(i8* %127, i8 signext 0, i32 %129)
%131 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%132 = getelementptr inbounds [1000 x i8], [1000 x i8]* %12, i64 0, i64 0
%133 = call i32 @strlen(i8* %132)
%134 = call i32 @memset(i8* %131, i8 signext 0, i32 %133)
br label %135
135: ; preds = %108
%136 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%137 = call i64 @strcmp(i8* %136, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%138 = icmp ne i64 %137, 0
br i1 %138, label %47, label %139
139: ; preds = %135
%140 = load i32, i32* %15
%141 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %140)
%142 = load i32, i32* %16
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32 %142)
%144 = load i32, i32* %14
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %144)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr_storage = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@.str.3 = [15 x i8] c"player 1 wins!\00"
@.str.4 = [15 x i8] c"player 2 wins!\00"
@.str.5 = [10 x i8] c"is a tie!\00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [2 x i8] c" \00"
@.str.8 = [5 x i8] c"quit\00"
@.str.9 = [16 x i8] c"Player wins %d\0A\00"
@.str.10 = [14 x i8] c"Comp wins %d\0A\00"
@.str.11 = [9 x i8] c"Ties %d\0A\00"
@str = [6 x i8] c"Error\00"
@str.12 = [10 x i8] c"Listening\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca %struct.sockaddr_storage
%3 = alloca i32
%4 = alloca [1000 x i8]
%5 = alloca [1000 x i8]
%6 = alloca [1000 x i8]
%7 = alloca [1000 x i8]
%8 = alloca [1000 x i8]
%9 = alloca [1000 x i8]
%10 = alloca [1000 x i8]
%11 = bitcast %struct.sockaddr_in* %1 to i8*
%12 = bitcast %struct.sockaddr_storage* %2 to i8*
%13 = bitcast i32* %3 to i8*
%14 = getelementptr inbounds [1000 x i8], [1000 x i8]* %4, i64 0, i64 0
%15 = getelementptr inbounds [1000 x i8], [1000 x i8]* %5, i64 0, i64 0
%16 = getelementptr inbounds [1000 x i8], [1000 x i8]* %6, i64 0, i64 0
%17 = getelementptr inbounds [1000 x i8], [1000 x i8]* %7, i64 0, i64 0
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 3
store i32 %21, i32* %22
%23 = tail call i32 @htons(i32 4501)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %23, i32* %24
%25 = tail call i32 @inet_addr(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %25, i32* %26
%27 = tail call i32 @memset(i8* undef, i8 signext 0, i32 8)
%28 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%29 = call i32 @bind(i32 %20, %struct.sockaddr* %28, i32 24)
%30 = call i64 @listen(i32 %20, i32 5)
%31 = icmp eq i64 %30, 0
%32 = select i1 %31, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.12, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0)
%33 = call i32 @puts(i8* dereferenceable(1) %32)
%34 = getelementptr inbounds [1000 x i8], [1000 x i8]* %8, i64 0, i64 0
%35 = getelementptr inbounds [1000 x i8], [1000 x i8]* %9, i64 0, i64 0
%36 = getelementptr inbounds [1000 x i8], [1000 x i8]* %10, i64 0, i64 0
store i32 4, i32* %3
%37 = bitcast %struct.sockaddr_storage* %2 to %struct.sockaddr*
%38 = call i32 @accept(i32 %20, %struct.sockaddr* %37, i32* %3)
br label %39
39: ; preds = %39, %0
%40 = phi i32 [ 1, %0 ], [ %71, %39 ]
%41 = phi i32 [ 0, %0 ], [ %70, %39 ]
%42 = phi i32 [ 0, %0 ], [ %62, %39 ]
%43 = phi i32 [ 0, %0 ], [ %66, %39 ]
%44 = call i32 @strcat(i8* %15, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.3, i64 0, i64 0))
%45 = call i32 @strcat(i8* %16, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @strcat(i8* %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0))
%47 = call i32 @sprintf(i8* %34, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%48 = call i32 @sprintf(i8* %35, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%49 = call i32 @sprintf(i8* %36, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32 %40)
%50 = call i32 @strcat(i8* %34, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%51 = call i32 @strcat(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%52 = call i32 @strcat(i8* %36, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%53 = call i32 @strcat(i8* %34, i8* %15)
%54 = call i32 @strcat(i8* %35, i8* %16)
%55 = call i32 @strcat(i8* %36, i8* %17)
%56 = call i32 @strlen(i8* %14)
%57 = call i32 @memset(i8* %14, i8 signext 0, i32 %56)
%58 = call i32 @recv(i32 %38, i8* %14, i32 2000, i32 0)
%59 = call i64 @strcmp(i8* %34, i8* %14)
%60 = icmp eq i64 %59, 0
%61 = zext i1 %60 to i32
%62 = add nuw nsw i32 %42, %61
%63 = call i64 @strcmp(i8* %35, i8* %14)
%64 = icmp eq i64 %63, 0
%65 = zext i1 %64 to i32
%66 = add nuw nsw i32 %43, %65
%67 = call i64 @strcmp(i8* %36, i8* %14)
%68 = icmp eq i64 %67, 0
%69 = zext i1 %68 to i32
%70 = add nuw nsw i32 %41, %69
%71 = add nuw nsw i32 %40, 1
%72 = call i32 @strlen(i8* %34)
%73 = call i32 @memset(i8* %34, i8 signext 0, i32 %72)
%74 = call i32 @strlen(i8* %35)
%75 = call i32 @memset(i8* %35, i8 signext 0, i32 %74)
%76 = call i32 @strlen(i8* %36)
%77 = call i32 @memset(i8* %36, i8 signext 0, i32 %76)
%78 = call i32 @strlen(i8* %15)
%79 = call i32 @memset(i8* %15, i8 signext 0, i32 %78)
%80 = call i32 @strlen(i8* %16)
%81 = call i32 @memset(i8* %16, i8 signext 0, i32 %80)
%82 = call i32 @strlen(i8* %17)
%83 = call i32 @memset(i8* %17, i8 signext 0, i32 %82)
%84 = call i64 @strcmp(i8* %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%85 = icmp eq i64 %84, 0
br i1 %85, label %86, label %39
86: ; preds = %39
%87 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0), i32 %62)
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.10, i64 0, i64 0), i32 %66)
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.11, i64 0, i64 0), i32 %70)
ret i32 0
}