#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*/ tcp_recv_move(char *, int);
int /*<<< orphan*/ tcp_send_move(char *);
int /*<<< orphan*/ timed_readline(char *);
int /*<<< orphan*/ ulog(char *, char *);
int /*<<< orphan*/ writeline(char *);
void play(int player_no) {
  if (player_no == 1) {
    while (1) {
      char move[1024];
      move[0] = '\n';
      timed_readline(move);
      ulog("Serial player move : %s", move);
      tcp_send_move(move);
      tcp_recv_move(move, 1024);
      writeline(move);
      ulog("TCP player move : %s", move);
    }
  } else {
    while (1) {
      char move[1024];
      tcp_recv_move(move, 1024);
      ulog("TCP player move : %s", move);
      writeline(move);
      move[0] = '\n';
      timed_readline(move);
      ulog("Serial player move : %s", move);
      tcp_send_move(move);
    }
  }
}


x86 assembly (clang, -O0):
<play>:
push   %rbp
mov    %rsp,%rbp
sub    $0x810,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x1,-0x4(%rbp)
jne    11d4 <play+0x84>
jmp    116d <play+0x1d>
movb   $0xa,-0x410(%rbp)
lea    -0x410(%rbp),%rdi
call   1070 <timed_readline@plt>
lea    -0x410(%rbp),%rsi
lea    0xe72(%rip),%rdi
call   1030 <ulog@plt>
lea    -0x410(%rbp),%rdi
call   1040 <tcp_send_move@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1050 <tcp_recv_move@plt>
lea    -0x410(%rbp),%rdi
call   1060 <writeline@plt>
lea    -0x410(%rbp),%rsi
lea    0xe4e(%rip),%rdi
call   1030 <ulog@plt>
jmp    116d <play+0x1d>
jmp    11d9 <play+0x89>
lea    -0x810(%rbp),%rdi
mov    $0x400,%esi
call   1050 <tcp_recv_move@plt>
lea    -0x810(%rbp),%rsi
lea    0xe20(%rip),%rdi
call   1030 <ulog@plt>
lea    -0x810(%rbp),%rdi
call   1060 <writeline@plt>
movb   $0xa,-0x810(%rbp)
lea    -0x810(%rbp),%rdi
call   1070 <timed_readline@plt>
lea    -0x810(%rbp),%rsi
lea    0xdd6(%rip),%rdi
call   1030 <ulog@plt>
lea    -0x810(%rbp),%rdi
call   1040 <tcp_send_move@plt>
jmp    11d9 <play+0x89>

x86 assembly (clang, -O2):
<play>:
push   %r15
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
cmp    $0x1,%edi
jne    11c1 <play+0x71>
lea    0xe95(%rip),%r14
lea    0xea6(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movb   $0xa,(%rsp)
mov    %rbx,%rdi
call   1070 <timed_readline@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <ulog@plt>
mov    %rbx,%rdi
call   1040 <tcp_send_move@plt>
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <tcp_recv_move@plt>
mov    %rbx,%rdi
call   1060 <writeline@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <ulog@plt>
jmp    1180 <play+0x30>
lea    0xe50(%rip),%r14
lea    0xe31(%rip),%r15
nop
mov    %rbx,%rdi
mov    $0x400,%esi
call   1050 <tcp_recv_move@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1030 <ulog@plt>
mov    %rbx,%rdi
call   1060 <writeline@plt>
movb   $0xa,(%rsp)
mov    %rbx,%rdi
call   1070 <timed_readline@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
call   1030 <ulog@plt>
mov    %rbx,%rdi
call   1040 <tcp_send_move@plt>
jmp    11d0 <play+0x80>

LLVM IR (-O0):
@.str = [24 x i8] c"Serial player move : %s\00"
@.str.1 = [21 x i8] c"TCP player move : %s\00"
define void @play(i32 %0) {
%2 = alloca i32
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 1
br i1 %6, label %7, label %22
7: ; preds = %1
br label %8
8: ; preds = %7, %8
%9 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
store i8 10, i8* %9
%10 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%11 = call i32 @timed_readline(i8* %10)
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%13 = call i32 @ulog(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%15 = call i32 @tcp_send_move(i8* %14)
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%17 = call i32 @tcp_recv_move(i8* %16, i32 1024)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%19 = call i32 @writeline(i8* %18)
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%21 = call i32 @ulog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %20)
br label %8
22: ; preds = %1
br label %23
23: ; preds = %22, %23
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%25 = call i32 @tcp_recv_move(i8* %24, i32 1024)
%26 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%27 = call i32 @ulog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %26)
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%29 = call i32 @writeline(i8* %28)
%30 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
store i8 10, i8* %30
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%32 = call i32 @timed_readline(i8* %31)
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%34 = call i32 @ulog(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %33)
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%36 = call i32 @tcp_send_move(i8* %35)
br label %23
}

LLVM IR (-O2):
@.str = [24 x i8] c"Serial player move : %s\00"
@.str.1 = [21 x i8] c"TCP player move : %s\00"
define void @play(i32 %0) {
%2 = alloca [1024 x i8]
%3 = alloca [1024 x i8]
%4 = icmp eq i32 %0, 1
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
br label %16
7: ; preds = %1
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
br label %9
9: ; preds = %7, %9
store i8 10, i8* %8
%10 = call i32 @timed_readline(i8* %8)
%11 = call i32 @ulog(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %8)
%12 = call i32 @tcp_send_move(i8* %8)
%13 = call i32 @tcp_recv_move(i8* %8, i32 1024)
%14 = call i32 @writeline(i8* %8)
%15 = call i32 @ulog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %8)
br label %9
16: ; preds = %5, %16
%17 = call i32 @tcp_recv_move(i8* %6, i32 1024)
%18 = call i32 @ulog(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%19 = call i32 @writeline(i8* %6)
store i8 10, i8* %6
%20 = call i32 @timed_readline(i8* %6)
%21 = call i32 @ulog(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %6)
%22 = call i32 @tcp_send_move(i8* %6)
br label %16
}