#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 uint32_t;
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;

/* Variables and functions */
int /*<<< orphan*/ close(int);
int fnInitSocket(struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ fnRecvGameState(int);
int /*<<< orphan*/ fnSendGameState(int, int, int, struct sockaddr,
                                   int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ system(char *);
int main(int argc, char *argv[]) {
  struct sockaddr dest_addr;
  socklen_t addr_len;
  int sockfd, opt;
  uint32_t iFlag, iPlayerId;
  if ((sockfd = fnInitSocket(&dest_addr, &addr_len)) < 0)
    return 1;
  system("clear");
  printf("SUD TEST CLIENT\n");
  printf("This tool can be used to test the functionality of the sud "
         "application.\n");
  printf("For more information consult the readme.\n");
  iFlag = 0;
  iPlayerId = 0;
  while (1) {
    printf("Compose the message you want to send:\n");
    printf("\t1.\tSet FLAG_UPD\n");
    printf("\t2.\tSet FLAG_INI\n");
    printf("\t3.\tSet FLAG_ACK\n");
    printf("\t4.\tSet FLAG_REF\n");
    printf("\t5.\tReset flag\n");
    printf("\t6.\tSet iPlayerId\n");
    printf("\t7.\tSend Packet\n");
    printf("\t8.\tExit\n");
    printf("\n\tiFlag: %d\n", iFlag);
    printf("\tiPlayerId: %d\n", iPlayerId);
    printf("user:~choice$ ");
    scanf("%d", &opt);
    switch (opt) {
    case 1:
      iFlag = iFlag | 0x00000004;
      break;
    case 2:
      iFlag = iFlag | 0x00000008;
      break;
    case 3:
      iFlag = iFlag | 0x00000001;
      break;
    case 4:
      iFlag = iFlag | 0x00000002;
      break;
    case 5:
      iFlag = 0;
      break;
    case 6:
      printf("user:~iPlayerId$ ");
      scanf("%d", &iPlayerId);
      break;
    case 7:
      if (fnSendGameState(iPlayerId, iFlag, sockfd, dest_addr, addr_len)) {
        perror("Unable to send packet");
        break;
      }
      iFlag = 0;
      iPlayerId = 0;
      if (fnRecvGameState(sockfd)) {
        perror("Unable to retrieve packet");
      }
      break;
    case 8:
      close(sockfd);
      return 0;
    default:
      printf("Invalid choice.\n");
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x18(%rbp),%rdi
lea    -0x1c(%rbp),%rsi
call   1030 <fnInitSocket@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jge    11bb <main+0x3b>
movl   $0x1,-0x4(%rbp)
jmp    13e1 <main+0x261>
lea    0xe5e(%rip),%rdi
call   1040 <system@plt>
lea    0xe58(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
lea    0xea4(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x39(%rbp)
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xeb7(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xeba(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xec0(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xec3(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xec4(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xec8(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xeca(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
mov    -0x28(%rbp),%esi
lea    0xec2(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
mov    -0x2c(%rbp),%esi
lea    0xebd(%rip),%rdi
call   1050 <printf@plt>
mov    -0x39(%rbp),%al
lea    0xebe(%rip),%rdi
call   1050 <printf@plt>
lea    0xec1(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1070 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x7,%eax
ja     13ce <main+0x24e>
mov    -0x38(%rbp),%rax
lea    0xd15(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x28(%rbp),%eax
or     $0x4,%eax
mov    %eax,-0x28(%rbp)
jmp    13dc <main+0x25c>
mov    -0x28(%rbp),%eax
or     $0x8,%eax
mov    %eax,-0x28(%rbp)
jmp    13dc <main+0x25c>
mov    -0x28(%rbp),%eax
or     $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    13dc <main+0x25c>
mov    -0x28(%rbp),%eax
or     $0x2,%eax
mov    %eax,-0x28(%rbp)
jmp    13dc <main+0x25c>
movl   $0x0,-0x28(%rbp)
jmp    13dc <main+0x25c>
lea    0xe47(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe36(%rip),%rdi
lea    -0x2c(%rbp),%rsi
call   1070 <scanf@plt>
jmp    13dc <main+0x25c>
mov    -0x2c(%rbp),%edi
mov    -0x28(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%r8d
mov    -0x18(%rbp),%ecx
call   1090 <fnSendGameState@plt>
cmp    $0x0,%eax
je     138a <main+0x20a>
lea    0xe18(%rip),%rdi
call   1080 <perror@plt>
jmp    13dc <main+0x25c>
movl   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    -0x20(%rbp),%edi
call   10a0 <fnRecvGameState@plt>
cmp    $0x0,%eax
je     13b5 <main+0x235>
lea    0xdfe(%rip),%rdi
call   1080 <perror@plt>
jmp    13dc <main+0x25c>
mov    -0x20(%rbp),%edi
call   1060 <close@plt>
movl   $0x0,-0x4(%rbp)
jmp    13e1 <main+0x261>
lea    0xdf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11ff <main+0x7f>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
lea    0x14(%rsp),%rsi
call   1030 <fnInitSocket@plt>
test   %eax,%eax
js     13c6 <main+0x236>
mov    %eax,0x4(%rsp)
lea    0xe60(%rip),%rdi
call   1050 <system@plt>
lea    0xecb(%rip),%rdi
call   1040 <puts@plt>
lea    0xecf(%rip),%rdi
call   1040 <puts@plt>
lea    0xf0b(%rip),%rdi
call   1040 <puts@plt>
movl   $0x0,(%rsp)
lea    0xf21(%rip),%r14
lea    0xf40(%rip),%r15
lea    0xf4a(%rip),%rbx
lea    0xf54(%rip),%rbp
lea    0xded(%rip),%r12
jmp    122c <main+0x9c>
cs nopw 0x0(%rax,%rax,1)
nop
lea    0xe56(%rip),%rdi
call   1090 <perror@plt>
xor    %ecx,%ecx
jmp    1250 <main+0xc0>
lea    0xe1e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xe0d(%rip),%rdi
mov    %rsp,%rsi
call   1080 <scanf@plt>
mov    %r13d,%ecx
mov    %ecx,%r13d
mov    %r14,%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
call   1040 <puts@plt>
mov    %rbp,%rdi
call   1040 <puts@plt>
lea    0xef7(%rip),%rdi
call   1040 <puts@plt>
lea    0xefc(%rip),%rdi
call   1040 <puts@plt>
lea    0xeff(%rip),%rdi
call   1040 <puts@plt>
lea    0xf05(%rip),%rdi
call   1040 <puts@plt>
lea    0xf09(%rip),%rdi
call   1040 <puts@plt>
lea    0xd70(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    (%rsp),%esi
lea    0xd69(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd6b(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xd6c(%rip),%rdi
lea    0x10(%rsp),%rsi
call   1080 <scanf@plt>
mov    0x10(%rsp),%eax
add    $0xffffffff,%eax
cmp    $0x7,%eax
ja     1313 <main+0x183>
movslq (%r12,%rax,4),%rax
add    %r12,%rax
xor    %ecx,%ecx
jmp    *%rax
or     $0x4,%r13d
mov    %r13d,%ecx
jmp    1250 <main+0xc0>
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
mov    %r13d,%ecx
jmp    1250 <main+0xc0>
or     $0x8,%r13d
mov    %r13d,%ecx
jmp    1250 <main+0xc0>
or     $0x1,%r13d
mov    %r13d,%ecx
jmp    1250 <main+0xc0>
or     $0x2,%r13d
mov    %r13d,%ecx
jmp    1250 <main+0xc0>
mov    (%rsp),%edi
mov    0x14(%rsp),%r8d
mov    0x8(%rsp),%ecx
mov    %r13d,%esi
mov    0x4(%rsp),%ebx
mov    %ebx,%edx
call   10a0 <fnSendGameState@plt>
test   %eax,%eax
jne    1397 <main+0x207>
movl   $0x0,(%rsp)
mov    %ebx,%edi
call   10b0 <fnRecvGameState@plt>
mov    $0x0,%ecx
test   %eax,%eax
lea    0xdca(%rip),%rbx
lea    0xdd4(%rip),%rbp
je     1250 <main+0xc0>
jmp    1220 <main+0x90>
lea    0xcc9(%rip),%rdi
call   1090 <perror@plt>
mov    %r13d,%ecx
lea    0xda2(%rip),%rbx
lea    0xdac(%rip),%rbp
jmp    1250 <main+0xc0>
mov    0x4(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
jmp    13cb <main+0x23b>
mov    $0x1,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.sockaddr = type { i32 }
@.str = [6 x i8] c"clear\00"
@.str.1 = [17 x i8] c"SUD TEST CLIENT\0A\00"
@.str.2 = [73 x i8] c"This tool can be used to test the functionality of the sud application.\0A\00"
@.str.3 = [42 x i8] c"For more information consult the readme.\0A\00"
@.str.4 = [39 x i8] c"Compose the message you want to send:\0A\00"
@.str.5 = [18 x i8] c"\091.\09Set FLAG_UPD\0A\00"
@.str.6 = [18 x i8] c"\092.\09Set FLAG_INI\0A\00"
@.str.7 = [18 x i8] c"\093.\09Set FLAG_ACK\0A\00"
@.str.8 = [18 x i8] c"\094.\09Set FLAG_REF\0A\00"
@.str.9 = [16 x i8] c"\095.\09Reset flag\0A\00"
@.str.10 = [19 x i8] c"\096.\09Set iPlayerId\0A\00"
@.str.11 = [17 x i8] c"\097.\09Send Packet\0A\00"
@.str.12 = [10 x i8] c"\098.\09Exit\0A\00"
@.str.13 = [13 x i8] c"\0A\09iFlag: %d\0A\00"
@.str.14 = [16 x i8] c"\09iPlayerId: %d\0A\00"
@.str.15 = [15 x i8] c"user:~choice$ \00"
@.str.16 = [3 x i8] c"%d\00"
@.str.17 = [18 x i8] c"user:~iPlayerId$ \00"
@.str.18 = [22 x i8] c"Unable to send packet\00"
@.str.19 = [26 x i8] c"Unable to retrieve packet\00"
@.str.20 = [17 x i8] c"Invalid choice.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%12 = call i32 @fnInitSocket(%struct.sockaddr* %6, i32* %7)
store i32 %12, i32* %8
%13 = icmp slt i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %2
store i32 1, i32* %3
br label %77
15: ; preds = %2
%16 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %10
store i32 0, i32* %11
br label %20
20: ; preds = %15, %76
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.5, i64 0, i64 0))
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.8, i64 0, i64 0))
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.10, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.11, i64 0, i64 0))
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.12, i64 0, i64 0))
%30 = load i32, i32* %10
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %11
%33 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
%35 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %9)
%36 = load i32, i32* %9
switch i32 %36, label %74 [
i32 1, label %37
i32 2, label %40
i32 3, label %43
i32 4, label %46
i32 5, label %49
i32 6, label %50
i32 7, label %53
i32 8, label %71
]
37: ; preds = %20
%38 = load i32, i32* %10
%39 = or i32 %38, 4
store i32 %39, i32* %10
br label %76
40: ; preds = %20
%41 = load i32, i32* %10
%42 = or i32 %41, 8
store i32 %42, i32* %10
br label %76
43: ; preds = %20
%44 = load i32, i32* %10
%45 = or i32 %44, 1
store i32 %45, i32* %10
br label %76
46: ; preds = %20
%47 = load i32, i32* %10
%48 = or i32 %47, 2
store i32 %48, i32* %10
br label %76
49: ; preds = %20
store i32 0, i32* %10
br label %76
50: ; preds = %20
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
%52 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %11)
br label %76
53: ; preds = %20
%54 = load i32, i32* %11
%55 = load i32, i32* %10
%56 = load i32, i32* %8
%57 = load i32, i32* %7
%58 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %6, i32 0, i32 0
%59 = load i32, i32* %58
%60 = call i32 @fnSendGameState(i32 %54, i32 %55, i32 %56, i32 %59, i32 %57)
%61 = icmp ne i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %53
%63 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.18, i64 0, i64 0))
br label %76
64: ; preds = %53
store i32 0, i32* %10
store i32 0, i32* %11
%65 = load i32, i32* %8
%66 = call i32 @fnRecvGameState(i32 %65)
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %70
68: ; preds = %64
%69 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
br label %70
70: ; preds = %68, %64
br label %76
71: ; preds = %20
%72 = load i32, i32* %8
%73 = call i32 @close(i32 %72)
store i32 0, i32* %3
br label %77
74: ; preds = %20
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.20, i64 0, i64 0))
br label %76
76: ; preds = %74, %70, %62, %50, %49, %46, %43, %40, %37
br label %20
77: ; preds = %71, %14
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
%struct.sockaddr = type { i32 }
@.str = [6 x i8] c"clear\00"
@.str.13 = [13 x i8] c"\0A\09iFlag: %d\0A\00"
@.str.14 = [16 x i8] c"\09iPlayerId: %d\0A\00"
@.str.15 = [15 x i8] c"user:~choice$ \00"
@.str.16 = [3 x i8] c"%d\00"
@.str.17 = [18 x i8] c"user:~iPlayerId$ \00"
@.str.18 = [22 x i8] c"Unable to send packet\00"
@.str.19 = [26 x i8] c"Unable to retrieve packet\00"
@str = [16 x i8] c"SUD TEST CLIENT\00"
@str.21 = [72 x i8] c"This tool can be used to test the functionality of the sud application.\00"
@str.22 = [41 x i8] c"For more information consult the readme.\00"
@str.23 = [38 x i8] c"Compose the message you want to send:\00"
@str.24 = [17 x i8] c"\091.\09Set FLAG_UPD\00"
@str.25 = [17 x i8] c"\092.\09Set FLAG_INI\00"
@str.26 = [17 x i8] c"\093.\09Set FLAG_ACK\00"
@str.27 = [17 x i8] c"\094.\09Set FLAG_REF\00"
@str.28 = [15 x i8] c"\095.\09Reset flag\00"
@str.29 = [18 x i8] c"\096.\09Set iPlayerId\00"
@str.30 = [16 x i8] c"\097.\09Send Packet\00"
@str.31 = [9 x i8] c"\098.\09Exit\00"
@str.32 = [16 x i8] c"Invalid choice.\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = bitcast %struct.sockaddr* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = call i32 @fnInitSocket(%struct.sockaddr* %3, i32* %4)
%12 = icmp slt i32 %11, 0
br i1 %12, label %66, label %13
13: ; preds = %2
%14 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%15 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%16 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([72 x i8], [72 x i8]* @str.21, i64 0, i64 0))
%17 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([41 x i8], [41 x i8]* @str.22, i64 0, i64 0))
store i32 0, i32* %6
%18 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %3, i64 0, i32 0
br label %19
19: ; preds = %36, %13
%20 = phi i32 [ 0, %13 ], [ %37, %36 ]
%21 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.23, i64 0, i64 0))
%22 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.24, i64 0, i64 0))
%23 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.25, i64 0, i64 0))
%24 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.26, i64 0, i64 0))
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.27, i64 0, i64 0))
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.28, i64 0, i64 0))
%27 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.29, i64 0, i64 0))
%28 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.30, i64 0, i64 0))
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str.31, i64 0, i64 0))
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.13, i64 0, i64 0), i32 %20)
%31 = load i32, i32* %6
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.14, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.15, i64 0, i64 0))
%34 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %5)
%35 = load i32, i32* %5
switch i32 %35, label %64 [
i32 1, label %38
i32 2, label %40
i32 3, label %42
i32 4, label %44
i32 5, label %36
i32 6, label %46
i32 7, label %49
i32 8, label %62
]
36: ; preds = %19, %57, %60, %64, %55, %46, %44, %42, %40, %38
%37 = phi i32 [ %20, %64 ], [ %20, %55 ], [ 0, %60 ], [ 0, %57 ], [ %20, %46 ], [ %45, %44 ], [ %43, %42 ], [ %41, %40 ], [ %39, %38 ], [ 0, %19 ]
br label %19
38: ; preds = %19
%39 = or i32 %20, 4
br label %36
40: ; preds = %19
%41 = or i32 %20, 8
br label %36
42: ; preds = %19
%43 = or i32 %20, 1
br label %36
44: ; preds = %19
%45 = or i32 %20, 2
br label %36
46: ; preds = %19
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.17, i64 0, i64 0))
%48 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.16, i64 0, i64 0), i32* %6)
br label %36
49: ; preds = %19
%50 = load i32, i32* %6
%51 = load i32, i32* %4
%52 = load i32, i32* %18
%53 = call i32 @fnSendGameState(i32 %50, i32 %20, i32 %11, i32 %52, i32 %51)
%54 = icmp eq i32 %53, 0
br i1 %54, label %57, label %55
55: ; preds = %49
%56 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.18, i64 0, i64 0))
br label %36
57: ; preds = %49
store i32 0, i32* %6
%58 = call i32 @fnRecvGameState(i32 %11)
%59 = icmp eq i32 %58, 0
br i1 %59, label %36, label %60
60: ; preds = %57
%61 = call i32 @perror(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.19, i64 0, i64 0))
br label %36
62: ; preds = %19
%63 = call i32 @close(i32 %11)
br label %66
64: ; preds = %19
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.32, i64 0, i64 0))
br label %36
66: ; preds = %2, %62
%67 = phi i32 [ 0, %62 ], [ 1, %2 ]
ret i32 %67
}