#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 atoi(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ recvFromServer(char *);
int /*<<< orphan*/ scanf(char *, ...);
int /*<<< orphan*/ sendToServer(char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ system(char *);
int /*<<< orphan*/ tcpMain();
int /*<<< orphan*/ udpMain();
int main(int argC, char **argV) {
  int keepLooping = 1;
  int useUDP = 0;
  int opt;
  char string[124];
  char login[50], senha[12];
  char feedback[20];
  char lt;
  string[123] = '\0';
  feedback[20 - 1] = '\0';
  if (argC >= 2)
    useUDP = atoi(argV[1]);
  printf("Bem vindo ao Jogo da Velha Online.\nConectando ao servidor.\n\n");
  if (useUDP)
    udpMain();
  else
    tcpMain();
  while (keepLooping) {
    printf("Digite o número de uma das opções abaixo:\n1.Cadastrar novo "
           "login.\n2.Entrar com login existente.\n");
    scanf("%d", &opt);
    switch (opt) {
    case 1:
      printf("Digite o login: ");
      scanf("%s", login);
      printf("Digite a senha: ");
      scanf("%s", senha);
      sprintf(string, "%s %s %s", "REG", login, senha);
      sendToServer(string);
      system("clear");
      printf("Cadastrado\n");
      break;
    case 2:
      printf("Digite o login: ");
      scanf("%s", login);
      printf("Digite a senha: ");
      scanf("%s", senha);
      sprintf(string, "%s %s %s", "LIN", login, senha);
      sendToServer(string);
      recvFromServer(feedback);
      if (strcmp(feedback, "OK") == 0) {
        keepLooping = 0;
        system("clear");
        break;
      }
      system("clear");
      printf("Login inválido\n");
      break;
    default:
      system("clear");
      printf("Opção inválida\n");
      break;
    }
  }
  keepLooping = 1;
  while (keepLooping) {
    printf("Digite o número de uma das opções abaixo:\n1.Listar "
           "jogadores.\n2.Desafiar jogador.\n3.Logout\n");
    scanf("%d", &opt);
    switch (opt) {
    case 1:
      system("clear");
      printf("\n");
      sendToServer("LST");
      do {
        recvFromServer(feedback);
        if (strcmp(feedback, "ES") != 0)
          printf("%s", feedback);
      } while (strcmp(feedback, "ES") != 0);
      printf("\n");
      break;
    case 2:
      printf("Digite o login do oponente: ");
      scanf("%s", login);
      sprintf(string, "%s %s", "STR", login);
      sendToServer(string);
      keepLooping = 0;
      break;
    case 3:
      sendToServer("LOO");
      exit(0);
    default:
      system("clear");
      printf("Opção inválida\n");
      break;
    }
  }
  keepLooping = 1;
  while (keepLooping) {
    recvFromServer(feedback);
    if (strcmp(feedback, "YT") == 0) {
      printf("Sua vez.\n");
    } else if (strcmp(feedback, "OT") == 0) {
      printf("Vez do oponente.\n");
    } else if (strcmp(feedback, "WN") == 0) {
      system("clear");
      printf("Você venceu!\n");
      break;
    } else {
      system("clear");
      printf("Você perdeu!\n");
      break;
    }
    printf(
        "Digite o número de uma das opções abaixo:\n1.Desistir.\n2.Logout.\n");
    if (strcmp(feedback, "YT") == 0)
      printf("3.Jogar\n");
    scanf("%d", &opt);
    switch (opt) {
    case 1:
    case 2:
      keepLooping = 0;
      break;
    case 3:
      if (strcmp(feedback, "YT") == 0) {
        printf("Digite X ou O:");
        scanf("%c", &lt);
        printf("Digite a posição desejada:\n0|1|2\n3|4|5\n6|7|8\n");
        scanf("%d", &opt);
        sprintf(string, "%s %c %d", "PLC", lt, opt);
        sendToServer(string);
      }
      recvFromServer(feedback);
      recvFromServer(feedback);
      for (int i = 0; i < 3; i++) {
        for (int j = 0; j < 3; j++) {
          if (feedback[i * 3 + j] != '\0')
            printf("%c", feedback[i * 3 + j]);
          else
            printf(" ");
        }
        printf("\n");
      }
      break;
    default:
      system("clear");
      printf("Opção inválida\n");
      break;
    }
  }
  sendToServer("LOO");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movb   $0x0,-0x25(%rbp)
movb   $0x0,-0xed(%rbp)
cmpl   $0x2,-0x8(%rbp)
jl     11fc <main+0x4c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x18(%rbp)
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpl   $0x0,-0x18(%rbp)
je     1220 <main+0x70>
mov    $0x0,%al
call   1070 <udpMain@plt>
jmp    1227 <main+0x77>
mov    $0x0,%al
call   1030 <tcpMain@plt>
jmp    122c <main+0x7c>
cmpl   $0x0,-0x14(%rbp)
je     1421 <main+0x271>
lea    0xe00(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x111(%rbp)
call   1050 <printf@plt>
mov    -0x111(%rbp),%al
lea    0x1019(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x110(%rbp)
sub    $0x1,%eax
je     128b <main+0xdb>
jmp    1277 <main+0xc7>
mov    -0x110(%rbp),%eax
sub    $0x2,%eax
je     1326 <main+0x176>
jmp    1402 <main+0x252>
lea    0xe0f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xe22(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    0xdfd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xec(%rbp),%rsi
lea    0xdff(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xe0(%rbp),%rcx
lea    -0xec(%rbp),%r8
lea    0xdd6(%rip),%rsi
lea    0xdd8(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <sendToServer@plt>
lea    0xdc2(%rip),%rdi
call   1040 <system@plt>
lea    0xdbc(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    141c <main+0x26c>
lea    0xd74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xd87(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xec(%rbp),%rsi
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xe0(%rbp),%rcx
lea    -0xec(%rbp),%r8
lea    0xd3b(%rip),%rsi
lea    0xd53(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <sendToServer@plt>
lea    -0x100(%rbp),%rdi
call   10a0 <recvFromServer@plt>
lea    -0x100(%rbp),%rdi
lea    0xd2a(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    13e3 <main+0x233>
movl   $0x0,-0x14(%rbp)
lea    0xcf7(%rip),%rdi
call   1040 <system@plt>
jmp    141c <main+0x26c>
lea    0xce6(%rip),%rdi
call   1040 <system@plt>
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    141c <main+0x26c>
lea    0xcc7(%rip),%rdi
call   1040 <system@plt>
lea    0xce5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    122c <main+0x7c>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     15c4 <main+0x414>
lea    0xcd4(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x119(%rbp)
call   1050 <printf@plt>
mov    -0x119(%rbp),%al
lea    0xe1d(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x118(%rbp)
sub    $0x1,%eax
je     149b <main+0x2eb>
jmp    1473 <main+0x2c3>
mov    -0x118(%rbp),%eax
sub    $0x2,%eax
je     1534 <main+0x384>
jmp    1487 <main+0x2d7>
mov    -0x118(%rbp),%eax
sub    $0x3,%eax
je     1592 <main+0x3e2>
jmp    15a5 <main+0x3f5>
lea    0xc2e(%rip),%rdi
call   1040 <system@plt>
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xcb0(%rip),%rdi
call   1060 <sendToServer@plt>
lea    -0x100(%rbp),%rdi
call   10a0 <recvFromServer@plt>
lea    -0x100(%rbp),%rdi
lea    0xc95(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
je     14ff <main+0x34f>
lea    -0x100(%rbp),%rsi
lea    0xbd1(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1504 <main+0x354>
lea    -0x100(%rbp),%rdi
lea    0xc5e(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    14c1 <main+0x311>
lea    0xb13(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    15bf <main+0x40f>
lea    0xc38(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0xe0(%rbp),%rsi
lea    0xb79(%rip),%rdi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0xa0(%rbp),%rdi
lea    -0xe0(%rbp),%rcx
lea    0xb5a(%rip),%rsi
lea    0xc1d(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <sendToServer@plt>
movl   $0x0,-0x14(%rbp)
jmp    15bf <main+0x40f>
lea    0xbfb(%rip),%rdi
call   1060 <sendToServer@plt>
xor    %edi,%edi
call   10d0 <exit@plt>
lea    0xb24(%rip),%rdi
call   1040 <system@plt>
lea    0xb42(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1428 <main+0x278>
movl   $0x1,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     18b6 <main+0x706>
lea    -0x100(%rbp),%rdi
call   10a0 <recvFromServer@plt>
lea    -0x100(%rbp),%rdi
lea    0xba9(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1611 <main+0x461>
lea    0xb96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    16a1 <main+0x4f1>
lea    -0x100(%rbp),%rdi
lea    0xb86(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    1641 <main+0x491>
lea    0xb73(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    169c <main+0x4ec>
lea    -0x100(%rbp),%rdi
lea    0xb6b(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    167d <main+0x4cd>
lea    0xa6b(%rip),%rdi
call   1040 <system@plt>
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18b6 <main+0x706>
lea    0xa4c(%rip),%rdi
call   1040 <system@plt>
lea    0xb3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    18b6 <main+0x706>
jmp    16a1 <main+0x4f1>
lea    0xb33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x100(%rbp),%rdi
lea    0xadb(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    16da <main+0x52a>
lea    0xb4c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xb8f(%rip),%rdi
xor    %eax,%eax
lea    -0x1c(%rbp),%rsi
call   1090 <scanf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x120(%rbp)
add    $0xffffffff,%eax
sub    $0x2,%eax
jb     171a <main+0x56a>
jmp    1706 <main+0x556>
mov    -0x120(%rbp),%eax
sub    $0x3,%eax
je     1726 <main+0x576>
jmp    1897 <main+0x6e7>
movl   $0x0,-0x14(%rbp)
jmp    18b1 <main+0x701>
lea    -0x100(%rbp),%rdi
lea    0xa64(%rip),%rsi
call   1080 <strcmp@plt>
cmp    $0x0,%rax
jne    17b9 <main+0x609>
lea    0xade(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xadf(%rip),%rdi
lea    -0x101(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    0xacd(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xaf5(%rip),%rdi
lea    -0x1c(%rbp),%rsi
mov    $0x0,%al
call   1090 <scanf@plt>
lea    -0xa0(%rbp),%rdi
movsbl -0x101(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
lea    0xacb(%rip),%rsi
lea    0xacd(%rip),%rdx
mov    $0x0,%al
call   10c0 <sprintf@plt>
lea    -0xa0(%rbp),%rdi
call   1060 <sendToServer@plt>
lea    -0x100(%rbp),%rdi
call   10a0 <recvFromServer@plt>
lea    -0x100(%rbp),%rdi
call   10a0 <recvFromServer@plt>
movl   $0x0,-0x108(%rbp)
cmpl   $0x3,-0x108(%rbp)
jge    1892 <main+0x6e2>
movl   $0x0,-0x10c(%rbp)
cmpl   $0x3,-0x10c(%rbp)
jge    1870 <main+0x6c0>
imul   $0x3,-0x108(%rbp),%eax
add    -0x10c(%rbp),%eax
cltq
movsbl -0x100(%rbp,%rax,1),%eax
ff
cmp    $0x0,%eax
je     1849 <main+0x699>
imul   $0x3,-0x108(%rbp),%eax
add    -0x10c(%rbp),%eax
cltq
movsbl -0x100(%rbp,%rax,1),%esi
ff
lea    0x9fa(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1857 <main+0x6a7>
lea    0x871(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    185c <main+0x6ac>
mov    -0x10c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10c(%rbp)
jmp    17f2 <main+0x642>
lea    0x7c4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x108(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x108(%rbp)
jmp    17db <main+0x62b>
jmp    18b1 <main+0x701>
lea    0x832(%rip),%rdi
call   1040 <system@plt>
lea    0x850(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    15cb <main+0x41b>
lea    0x8d7(%rip),%rdi
call   1060 <sendToServer@plt>
xor    %edi,%edi
call   10d0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xf8,%rsp
movb   $0x0,0xeb(%rsp)
movb   $0x0,0x23(%rsp)
cmp    $0x1,%edi
jle    1217 <main+0x47>
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ebx
lea    0xe8b(%rip),%rdi
call   1050 <puts@plt>
test   %ebx,%ebx
je     1223 <main+0x53>
xor    %eax,%eax
call   1090 <udpMain@plt>
jmp    122a <main+0x5a>
lea    0xe72(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
call   1030 <tcpMain@plt>
lea    0xe58(%rip),%r15
lea    0x8(%rsp),%r12
lea    0xdc3(%rip),%r14
jmp    1254 <main+0x84>
nop
lea    0xde8(%rip),%rdi
call   1060 <system@plt>
mov    %r13,%rdi
call   1050 <puts@plt>
lea    0xf7f(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x2,%eax
je     1300 <main+0x130>
lea    0xfd7(%rip),%r13
cmp    $0x1,%eax
jne    1240 <main+0x70>
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd91(%rip),%r13
mov    %r13,%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xd64(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r13,%rdi
lea    0x24(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
lea    0xd4d(%rip),%rsi
lea    0xd4f(%rip),%rdx
lea    0x30(%rsp),%rcx
mov    %rbp,%r8
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <sendToServer@plt>
lea    0xf53(%rip),%r13
jmp    1240 <main+0x70>
nop
mov    %r14,%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xd17(%rip),%r14
mov    %r14,%rdi
lea    0x30(%rsp),%r13
mov    %r13,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xce7(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14,%rdi
lea    0x24(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0x70(%rsp),%rbx
mov    %rbx,%rdi
lea    0xcd0(%rip),%rsi
lea    0xcdc(%rip),%rdx
mov    %r13,%rcx
mov    %rbp,%r8
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %rbx,%rdi
call   1080 <sendToServer@plt>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   10c0 <recvFromServer@plt>
mov    %rbx,%rdi
lea    0xcb4(%rip),%rsi
call   10a0 <strcmp@plt>
mov    %r15,%rbx
mov    %r12,%r15
mov    %rax,%r12
lea    0xc95(%rip),%rdi
call   1060 <system@plt>
lea    0xe97(%rip),%r13
test   %r12,%r12
mov    %r15,%r12
lea    0xc4d(%rip),%r14
mov    %rbx,%r15
jne    124c <main+0x7c>
lea    0xcc6(%rip),%r15
lea    0x8(%rsp),%r13
lea    0xc60(%rip),%rbp
lea    0x10(%rsp),%rbx
lea    0xc65(%rip),%r12
lea    0xc46(%rip),%r14
jmp    13fa <main+0x22a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xd7b(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x1,%eax
je     1440 <main+0x270>
cmp    $0x2,%eax
je     1497 <main+0x2c7>
cmp    $0x3,%eax
je     175d <main+0x58d>
mov    %rbp,%rdi
call   1060 <system@plt>
lea    0xe1f(%rip),%rdi
call   1050 <puts@plt>
jmp    13fa <main+0x22a>
mov    %rbp,%rdi
call   1060 <system@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
lea    0xbe3(%rip),%rdi
call   1080 <sendToServer@plt>
jmp    1470 <main+0x2a0>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     13f0 <main+0x220>
mov    %rbx,%rdi
call   10c0 <recvFromServer@plt>
mov    %rbx,%rdi
mov    %r12,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     1460 <main+0x290>
mov    %r14,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
jmp    1460 <main+0x290>
lea    0xba5(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0xb7c(%rip),%rdi
lea    0x30(%rsp),%rbx
mov    %rbx,%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xb63(%rip),%rsi
lea    0xb97(%rip),%rdx
lea    0x70(%rsp),%rbp
mov    %rbp,%rdi
mov    %rbx,%rcx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %rbp,%rdi
call   1080 <sendToServer@plt>
lea    0x10(%rsp),%r13
lea    0xb79(%rip),%rbx
lea    0xc7d(%rip),%rbp
lea    0xbfc(%rip),%r12
lea    0xb85(%rip),%r15
jmp    1600 <main+0x430>
nopl   0x0(%rax)
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
je     16a8 <main+0x4d8>
mov    %r13,%rdi
call   10c0 <recvFromServer@plt>
mov    %r13,%rdi
call   10c0 <recvFromServer@plt>
mov    0x10(%rsp),%eax
test   %al,%al
mov    $0x20,%r14d
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
movzbl 0x11(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
movzbl 0x12(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movzbl 0x13(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
mov    0x14(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
movzbl 0x15(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movzbl 0x16(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
movzbl 0x17(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
mov    0x18(%rsp),%eax
test   %al,%al
cmove  %r14d,%eax
movsbl %al,%edi
call   1040 <putchar@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r13,%rdi
call   10c0 <recvFromServer@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
mov    %rbp,%rdi
test   %rax,%rax
je     163a <main+0x46a>
mov    %r13,%rdi
lea    0xa46(%rip),%rsi
call   10a0 <strcmp@plt>
lea    0xab7(%rip),%rdi
test   %rax,%rax
jne    1723 <main+0x553>
call   1050 <puts@plt>
mov    %r12,%rdi
call   1050 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <strcmp@plt>
test   %rax,%rax
jne    1663 <main+0x493>
lea    0xb0d(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
mov    0x8(%rsp),%eax
cmp    $0x3,%eax
je     1510 <main+0x340>
add    $0xffffffff,%eax
cmp    $0x2,%eax
jb     175d <main+0x58d>
lea    0x99d(%rip),%rdi
call   1060 <system@plt>
lea    0xbba(%rip),%rdi
call   1050 <puts@plt>
jmp    1600 <main+0x430>
lea    0x9c2(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
lea    0x9c3(%rip),%rdi
lea    0xf(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
lea    0xa6c(%rip),%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   10b0 <scanf@plt>
movsbl 0xf(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %r12,%r14
lea    0x70(%rsp),%r12
mov    %r12,%rdi
lea    0x983(%rip),%rsi
lea    0x985(%rip),%rdx
xor    %eax,%eax
call   10e0 <sprintf@plt>
mov    %r12,%rdi
mov    %r14,%r12
lea    0x10(%rsp),%r13
call   1080 <sendToServer@plt>
jmp    1524 <main+0x354>
lea    0x944(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10a0 <strcmp@plt>
mov    %rax,%rbx
lea    0x8f1(%rip),%rdi
call   1060 <system@plt>
test   %rbx,%rbx
lea    0x98d(%rip),%rax
lea    0x978(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
lea    0x900(%rip),%rdi
call   1080 <sendToServer@plt>
xor    %edi,%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
@.str = [61 x i8] c"Bem vindo ao Jogo da Velha Online.\0AConectando ao servidor.\0A\0A\00"
@.str.1 = [100 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Cadastrar novo login.\0A2.Entrar com login existente.\0A\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"Digite o login: \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [17 x i8] c"Digite a senha: \00"
@.str.6 = [9 x i8] c"%s %s %s\00"
@.str.7 = [4 x i8] c"REG\00"
@.str.8 = [6 x i8] c"clear\00"
@.str.9 = [12 x i8] c"Cadastrado\0A\00"
@.str.10 = [4 x i8] c"LIN\00"
@.str.11 = [3 x i8] c"OK\00"
@.str.12 = [17 x i8] c"Login inv\C3\A1lido\0A\00"
@.str.13 = [19 x i8] c"Op\C3\A7\C3\A3o inv\C3\A1lida\0A\00"
@.str.14 = [95 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Listar jogadores.\0A2.Desafiar jogador.\0A3.Logout\0A\00"
@.str.15 = [2 x i8] c"\0A\00"
@.str.16 = [4 x i8] c"LST\00"
@.str.17 = [3 x i8] c"ES\00"
@.str.18 = [29 x i8] c"Digite o login do oponente: \00"
@.str.19 = [6 x i8] c"%s %s\00"
@.str.20 = [4 x i8] c"STR\00"
@.str.21 = [4 x i8] c"LOO\00"
@.str.22 = [3 x i8] c"YT\00"
@.str.23 = [10 x i8] c"Sua vez.\0A\00"
@.str.24 = [3 x i8] c"OT\00"
@.str.25 = [18 x i8] c"Vez do oponente.\0A\00"
@.str.26 = [3 x i8] c"WN\00"
@.str.27 = [15 x i8] c"Voc\C3\AA venceu!\0A\00"
@.str.28 = [15 x i8] c"Voc\C3\AA perdeu!\0A\00"
@.str.29 = [68 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Desistir.\0A2.Logout.\0A\00"
@.str.30 = [9 x i8] c"3.Jogar\0A\00"
@.str.31 = [15 x i8] c"Digite X ou O:\00"
@.str.32 = [3 x i8] c"%c\00"
@.str.33 = [48 x i8] c"Digite a posi\C3\A7\C3\A3o desejada:\0A0|1|2\0A3|4|5\0A6|7|8\0A\00"
@.str.34 = [9 x i8] c"%s %c %d\00"
@.str.35 = [4 x i8] c"PLC\00"
@.str.36 = [2 x i8] c" \00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [124 x i8]
%10 = alloca [50 x i8]
%11 = alloca [12 x i8]
%12 = alloca [20 x i8]
%13 = alloca i8
%14 = alloca i32
%15 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 0, i32* %7
%16 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 123
store i8 0, i8* %16
%17 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 19
store i8 0, i8* %17
%18 = load i32, i32* %4
%19 = icmp sge i32 %18, 2
br i1 %19, label %20, label %25
20: ; preds = %2
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @atoi(i8* %23)
store i32 %24, i32* %7
br label %25
25: ; preds = %20, %2
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%27 = load i32, i32* %7
%28 = icmp ne i32 %27, 0
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = call i32 (...) @udpMain()
br label %33
31: ; preds = %25
%32 = call i32 (...) @tcpMain()
br label %33
33: ; preds = %31, %29
br label %34
34: ; preds = %82, %33
%35 = load i32, i32* %6
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %83
37: ; preds = %34
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([100 x i8], [100 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%40 = load i32, i32* %8
switch i32 %40, label %79 [
i32 1, label %41
i32 2, label %56
]
41: ; preds = %37
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%44 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %43)
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%46 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%47 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %46)
%48 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%49 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%50 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%51 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %48, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %49, i8* %50)
%52 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%53 = call i32 @sendToServer(i8* %52)
%54 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.9, i64 0, i64 0))
br label %82
56: ; preds = %37
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%58 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%59 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %58)
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%61 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%62 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %61)
%63 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%64 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%65 = getelementptr inbounds [12 x i8], [12 x i8]* %11, i64 0, i64 0
%66 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %63, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %64, i8* %65)
%67 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%68 = call i32 @sendToServer(i8* %67)
%69 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%70 = call i32 @recvFromServer(i8* %69)
%71 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%72 = call i64 @strcmp(i8* %71, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%73 = icmp eq i64 %72, 0
br i1 %73, label %74, label %76
74: ; preds = %56
store i32 0, i32* %6
%75 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %82
76: ; preds = %56
%77 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.12, i64 0, i64 0))
br label %82
79: ; preds = %37
%80 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %82
82: ; preds = %79, %76, %74, %41
br label %34
83: ; preds = %34
store i32 1, i32* %6
br label %84
84: ; preds = %126, %83
%85 = load i32, i32* %6
%86 = icmp ne i32 %85, 0
br i1 %86, label %87, label %127
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([95 x i8], [95 x i8]* @.str.14, i64 0, i64 0))
%89 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%90 = load i32, i32* %8
switch i32 %90, label %123 [
i32 1, label %91
i32 2, label %111
i32 3, label %120
]
91: ; preds = %87
%92 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%94 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
br label %95
95: ; preds = %105, %91
%96 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%97 = call i32 @recvFromServer(i8* %96)
%98 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%99 = call i64 @strcmp(i8* %98, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%100 = icmp ne i64 %99, 0
br i1 %100, label %101, label %104
101: ; preds = %95
%102 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %102)
br label %104
104: ; preds = %101, %95
br label %105
105: ; preds = %104
%106 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%107 = call i64 @strcmp(i8* %106, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%108 = icmp ne i64 %107, 0
br i1 %108, label %95, label %109
109: ; preds = %105
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
br label %126
111: ; preds = %87
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0))
%113 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%114 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %113)
%115 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%116 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%117 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %115, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i8* %116)
%118 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%119 = call i32 @sendToServer(i8* %118)
store i32 0, i32* %6
br label %126
120: ; preds = %87
%121 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%122 = call i32 @exit(i32 0)
unreachable
123: ; preds = %87
%124 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%125 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %126
126: ; preds = %123, %111, %109
br label %84
127: ; preds = %84
store i32 1, i32* %6
br label %128
128: ; preds = %230, %127
%129 = load i32, i32* %6
%130 = icmp ne i32 %129, 0
br i1 %130, label %131, label %231
131: ; preds = %128
%132 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%133 = call i32 @recvFromServer(i8* %132)
%134 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%135 = call i64 @strcmp(i8* %134, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%136 = icmp eq i64 %135, 0
br i1 %136, label %137, label %139
137: ; preds = %131
%138 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.23, i64 0, i64 0))
br label %156
139: ; preds = %131
%140 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%141 = call i64 @strcmp(i8* %140, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
%142 = icmp eq i64 %141, 0
br i1 %142, label %143, label %145
143: ; preds = %139
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.25, i64 0, i64 0))
br label %155
145: ; preds = %139
%146 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%147 = call i64 @strcmp(i8* %146, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0))
%148 = icmp eq i64 %147, 0
br i1 %148, label %149, label %152
149: ; preds = %145
%150 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%151 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.27, i64 0, i64 0))
br label %231
152: ; preds = %145
%153 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.28, i64 0, i64 0))
br label %231
155: ; preds = %143
br label %156
156: ; preds = %155, %137
%157 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.29, i64 0, i64 0))
%158 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%159 = call i64 @strcmp(i8* %158, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%160 = icmp eq i64 %159, 0
br i1 %160, label %161, label %163
161: ; preds = %156
%162 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.30, i64 0, i64 0))
br label %163
163: ; preds = %161, %156
%164 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%165 = load i32, i32* %8
switch i32 %165, label %227 [
i32 1, label %166
i32 2, label %166
i32 3, label %167
]
166: ; preds = %163, %163
store i32 0, i32* %6
br label %230
167: ; preds = %163
%168 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%169 = call i64 @strcmp(i8* %168, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%170 = icmp eq i64 %169, 0
br i1 %170, label %171, label %183
171: ; preds = %167
%172 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0))
%173 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %13)
%174 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.33, i64 0, i64 0))
%175 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%176 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%177 = load i8, i8* %13
%178 = sext i8 %177 to i32
%179 = load i32, i32* %8
%180 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %176, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.34, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.35, i64 0, i64 0), i32 %178, i32 %179)
%181 = getelementptr inbounds [124 x i8], [124 x i8]* %9, i64 0, i64 0
%182 = call i32 @sendToServer(i8* %181)
br label %183
183: ; preds = %171, %167
%184 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%185 = call i32 @recvFromServer(i8* %184)
%186 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 0
%187 = call i32 @recvFromServer(i8* %186)
store i32 0, i32* %14
br label %188
188: ; preds = %223, %183
%189 = load i32, i32* %14
%190 = icmp slt i32 %189, 3
br i1 %190, label %191, label %226
191: ; preds = %188
store i32 0, i32* %15
br label %192
192: ; preds = %218, %191
%193 = load i32, i32* %15
%194 = icmp slt i32 %193, 3
br i1 %194, label %195, label %221
195: ; preds = %192
%196 = load i32, i32* %14
%197 = mul nsw i32 %196, 3
%198 = load i32, i32* %15
%199 = add nsw i32 %197, %198
%200 = sext i32 %199 to i64
%201 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 %200
%202 = load i8, i8* %201
%203 = sext i8 %202 to i32
%204 = icmp ne i32 %203, 0
br i1 %204, label %205, label %215
205: ; preds = %195
%206 = load i32, i32* %14
%207 = mul nsw i32 %206, 3
%208 = load i32, i32* %15
%209 = add nsw i32 %207, %208
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds [20 x i8], [20 x i8]* %12, i64 0, i64 %210
%212 = load i8, i8* %211
%213 = sext i8 %212 to i32
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i32 %213)
br label %217
215: ; preds = %195
%216 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.36, i64 0, i64 0))
br label %217
217: ; preds = %215, %205
br label %218
218: ; preds = %217
%219 = load i32, i32* %15
%220 = add nsw i32 %219, 1
store i32 %220, i32* %15
br label %192
221: ; preds = %192
%222 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
br label %223
223: ; preds = %221
%224 = load i32, i32* %14
%225 = add nsw i32 %224, 1
store i32 %225, i32* %14
br label %188
226: ; preds = %188
br label %230
227: ; preds = %163
%228 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%229 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.13, i64 0, i64 0))
br label %230
230: ; preds = %227, %226, %166
br label %128
231: ; preds = %152, %149, %128
%232 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%233 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"Digite o login: \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [17 x i8] c"Digite a senha: \00"
@.str.6 = [9 x i8] c"%s %s %s\00"
@.str.7 = [4 x i8] c"REG\00"
@.str.8 = [6 x i8] c"clear\00"
@.str.10 = [4 x i8] c"LIN\00"
@.str.11 = [3 x i8] c"OK\00"
@.str.16 = [4 x i8] c"LST\00"
@.str.17 = [3 x i8] c"ES\00"
@.str.18 = [29 x i8] c"Digite o login do oponente: \00"
@.str.19 = [6 x i8] c"%s %s\00"
@.str.20 = [4 x i8] c"STR\00"
@.str.21 = [4 x i8] c"LOO\00"
@.str.22 = [3 x i8] c"YT\00"
@.str.24 = [3 x i8] c"OT\00"
@.str.26 = [3 x i8] c"WN\00"
@.str.31 = [15 x i8] c"Digite X ou O:\00"
@.str.32 = [3 x i8] c"%c\00"
@.str.34 = [9 x i8] c"%s %c %d\00"
@.str.35 = [4 x i8] c"PLC\00"
@str = [60 x i8] c"Bem vindo ao Jogo da Velha Online.\0AConectando ao servidor.\0A\00"
@str.37 = [14 x i8] c"Voc\C3\AA perdeu!\00"
@str.38 = [14 x i8] c"Voc\C3\AA venceu!\00"
@str.39 = [17 x i8] c"Vez do oponente.\00"
@str.40 = [67 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Desistir.\0A2.Logout.\00"
@str.41 = [47 x i8] c"Digite a posi\C3\A7\C3\A3o desejada:\0A0|1|2\0A3|4|5\0A6|7|8\00"
@str.43 = [8 x i8] c"3.Jogar\00"
@str.44 = [9 x i8] c"Sua vez.\00"
@str.45 = [94 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Listar jogadores.\0A2.Desafiar jogador.\0A3.Logout\00"
@str.47 = [99 x i8] c"Digite o n\C3\BAmero de uma das op\C3\A7\C3\B5es abaixo:\0A1.Cadastrar novo login.\0A2.Entrar com login existente.\00"
@str.48 = [16 x i8] c"Login inv\C3\A1lido\00"
@str.49 = [11 x i8] c"Cadastrado\00"
@str.50 = [18 x i8] c"Op\C3\A7\C3\A3o inv\C3\A1lida\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca [124 x i8]
%5 = alloca [50 x i8]
%6 = alloca [12 x i8]
%7 = alloca [20 x i8]
%8 = alloca i8
%9 = bitcast i32* %3 to i8*
%10 = getelementptr inbounds [124 x i8], [124 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%12 = getelementptr inbounds [12 x i8], [12 x i8]* %6, i64 0, i64 0
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [124 x i8], [124 x i8]* %4, i64 0, i64 123
store i8 0, i8* %14
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 19
store i8 0, i8* %15
%16 = icmp sgt i32 %0, 1
br i1 %16, label %19, label %17
17: ; preds = %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
br label %27
19: ; preds = %2
%20 = getelementptr inbounds i8*, i8** %1, i64 1
%21 = load i8*, i8** %20
%22 = tail call i32 @atoi(i8* %21)
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%24 = icmp eq i32 %22, 0
br i1 %24, label %27, label %25
25: ; preds = %19
%26 = tail call i32 (...) @udpMain()
br label %29
27: ; preds = %17, %19
%28 = tail call i32 (...) @tcpMain()
br label %29
29: ; preds = %27, %25
br label %30
30: ; preds = %29, %55
%31 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([99 x i8], [99 x i8]* @str.47, i64 0, i64 0))
%32 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%33 = load i32, i32* %3
switch i32 %33, label %52 [
i32 1, label %34
i32 2, label %41
]
34: ; preds = %30
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%36 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%37 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%38 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%39 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i8* %11, i8* %12)
%40 = call i32 @sendToServer(i8* %10)
br label %52
41: ; preds = %30
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%43 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%44 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.5, i64 0, i64 0))
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %12)
%46 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i8* %11, i8* %12)
%47 = call i32 @sendToServer(i8* %10)
%48 = call i32 @recvFromServer(i8* %13)
%49 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
%51 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br i1 %50, label %58, label %55
52: ; preds = %30, %34
%53 = phi i8* [ getelementptr inbounds ([11 x i8], [11 x i8]* @str.49, i64 0, i64 0), %34 ], [ getelementptr inbounds ([18 x i8], [18 x i8]* @str.50, i64 0, i64 0), %30 ]
%54 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
br label %55
55: ; preds = %52, %41
%56 = phi i8* [ getelementptr inbounds ([16 x i8], [16 x i8]* @str.48, i64 0, i64 0), %41 ], [ %53, %52 ]
%57 = call i32 @puts(i8* dereferenceable(1) %56)
br label %30
58: ; preds = %41, %83
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([94 x i8], [94 x i8]* @str.45, i64 0, i64 0))
%60 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%61 = load i32, i32* %3
switch i32 %61, label %80 [
i32 1, label %62
i32 2, label %84
i32 3, label %77
]
62: ; preds = %58
%63 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%64 = call i32 @putchar(i32 10)
%65 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.16, i64 0, i64 0))
br label %66
66: ; preds = %72, %62
%67 = call i32 @recvFromServer(i8* %13)
%68 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%69 = icmp eq i64 %68, 0
br i1 %69, label %72, label %70
70: ; preds = %66
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %13)
br label %72
72: ; preds = %66, %70
%73 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %66
75: ; preds = %72
%76 = call i32 @putchar(i32 10)
br label %83
77: ; preds = %58
%78 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%79 = call i32 @exit(i32 0)
unreachable
80: ; preds = %58
%81 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.50, i64 0, i64 0))
br label %83
83: ; preds = %80, %75
br label %58
84: ; preds = %58
%85 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.18, i64 0, i64 0))
%86 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %11)
%87 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.20, i64 0, i64 0), i8* %11)
%88 = call i32 @sendToServer(i8* %10)
%89 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 1
%90 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 2
%91 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 3
%92 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 4
%93 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 5
%94 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 6
%95 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 7
%96 = getelementptr inbounds [20 x i8], [20 x i8]* %7, i64 0, i64 8
br label %97
97: ; preds = %185, %84
%98 = call i32 @recvFromServer(i8* %13)
%99 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%100 = icmp eq i64 %99, 0
br i1 %100, label %110, label %101
101: ; preds = %97
%102 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
%103 = icmp eq i64 %102, 0
br i1 %103, label %110, label %104
104: ; preds = %101
%105 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.26, i64 0, i64 0))
%106 = icmp eq i64 %105, 0
%107 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%108 = select i1 %106, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.38, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @str.37, i64 0, i64 0)
%109 = call i32 @puts(i8* dereferenceable(1) %108)
br label %189
110: ; preds = %101, %97
%111 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @str.44, i64 0, i64 0), %97 ], [ getelementptr inbounds ([17 x i8], [17 x i8]* @str.39, i64 0, i64 0), %101 ]
%112 = call i32 @puts(i8* dereferenceable(1) %111)
%113 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.40, i64 0, i64 0))
%114 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%115 = icmp eq i64 %114, 0
br i1 %115, label %116, label %118
116: ; preds = %110
%117 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.43, i64 0, i64 0))
br label %118
118: ; preds = %116, %110
%119 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%120 = load i32, i32* %3
switch i32 %120, label %186 [
i32 1, label %189
i32 2, label %189
i32 3, label %121
]
121: ; preds = %118
%122 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.22, i64 0, i64 0))
%123 = icmp eq i64 %122, 0
br i1 %123, label %124, label %134
124: ; preds = %121
%125 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.31, i64 0, i64 0))
%126 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.32, i64 0, i64 0), i8* %8)
%127 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @str.41, i64 0, i64 0))
%128 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%129 = load i8, i8* %8
%130 = sext i8 %129 to i32
%131 = load i32, i32* %3
%132 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %10, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.34, i64 0, i64 0), i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.35, i64 0, i64 0), i32 %130, i32 %131)
%133 = call i32 @sendToServer(i8* %10)
br label %134
134: ; preds = %124, %121
%135 = call i32 @recvFromServer(i8* %13)
%136 = call i32 @recvFromServer(i8* %13)
%137 = load i8, i8* %13
%138 = icmp eq i8 %137, 0
%139 = select i1 %138, i8 32, i8 %137
%140 = sext i8 %139 to i32
%141 = call i32 @putchar(i32 %140)
%142 = load i8, i8* %89
%143 = icmp eq i8 %142, 0
%144 = select i1 %143, i8 32, i8 %142
%145 = sext i8 %144 to i32
%146 = call i32 @putchar(i32 %145)
%147 = load i8, i8* %90
%148 = icmp eq i8 %147, 0
%149 = select i1 %148, i8 32, i8 %147
%150 = sext i8 %149 to i32
%151 = call i32 @putchar(i32 %150)
%152 = call i32 @putchar(i32 10)
%153 = load i8, i8* %91
%154 = icmp eq i8 %153, 0
%155 = select i1 %154, i8 32, i8 %153
%156 = sext i8 %155 to i32
%157 = call i32 @putchar(i32 %156)
%158 = load i8, i8* %92
%159 = icmp eq i8 %158, 0
%160 = select i1 %159, i8 32, i8 %158
%161 = sext i8 %160 to i32
%162 = call i32 @putchar(i32 %161)
%163 = load i8, i8* %93
%164 = icmp eq i8 %163, 0
%165 = select i1 %164, i8 32, i8 %163
%166 = sext i8 %165 to i32
%167 = call i32 @putchar(i32 %166)
%168 = call i32 @putchar(i32 10)
%169 = load i8, i8* %94
%170 = icmp eq i8 %169, 0
%171 = select i1 %170, i8 32, i8 %169
%172 = sext i8 %171 to i32
%173 = call i32 @putchar(i32 %172)
%174 = load i8, i8* %95
%175 = icmp eq i8 %174, 0
%176 = select i1 %175, i8 32, i8 %174
%177 = sext i8 %176 to i32
%178 = call i32 @putchar(i32 %177)
%179 = load i8, i8* %96
%180 = icmp eq i8 %179, 0
%181 = select i1 %180, i8 32, i8 %179
%182 = sext i8 %181 to i32
%183 = call i32 @putchar(i32 %182)
%184 = call i32 @putchar(i32 10)
br label %185
185: ; preds = %134, %186
br label %97
186: ; preds = %118
%187 = call i32 @system(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%188 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.50, i64 0, i64 0))
br label %185
189: ; preds = %118, %118, %104
%190 = call i32 @sendToServer(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.21, i64 0, i64 0))
%191 = call i32 @exit(i32 0)
unreachable
}