#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 stat {
  scalar_t__ st_size;
};
struct TYPE_2__ {
  void *s_addr;
};
struct sockaddr_in {
  void *sin_port;
  TYPE_1__ sin_addr;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef size_t ssize_t;
typedef int /*<<< orphan*/ servaddr;
typedef int /*<<< orphan*/ pid_t;
typedef scalar_t__ off_t;
typedef int /*<<< orphan*/ dataaddr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
void *AF_INET;
scalar_t__ EOF;
int /*<<< orphan*/ INADDR_ANY;
int O_CREAT;
int /*<<< orphan*/ O_RDONLY;
int O_WRONLY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ S_IREAD;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int cria_socket();
int /*<<< orphan*/ envia_mensagem(char *, int);
int /*<<< orphan*/ exit(int);
char fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fork();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
scalar_t__ fputs(char *, int /*<<< orphan*/);
int getpid();
int getsockname(int, struct sockaddr *, int *);
void *htonl(int /*<<< orphan*/);
void *htons(int /*<<< orphan*/);
char *inet_ntoa(TYPE_1__);
int listen(int, int);
int /*<<< orphan*/ mensagem_exit();
scalar_t__ ntohs(void *);
int open(char *, int, ...);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
void *read(int, char *, int);
int retorna_funcao(char *);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, ...);
int /*<<< orphan*/ stat(char *, struct stat *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
int strlen(char *);
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char **argv) {
  int listenfd, connfd;
  struct sockaddr_in servaddr;
  pid_t childpid;
  char recvline[4096 + 1];
  ssize_t n;
  char usuario[4096], senha[4096], mensagem[4096];
  int comando;
  int datafd, data_transfer_fd;
  struct sockaddr_in dataaddr;
  char *buffer;
  int a, b, c, d;
  int x, y;
  int porta;
  FILE *fp;
  int data_len;
  char ch;
  char dados[4096];
  int topo;
  char data_buffer[4096 + 10];
  char endereco_arquivo[4096];
  off_t tamanho_arquivo;
  struct stat st;
  int arquivo_fd;
  int leu_bytes;
  char tipo = 'A';
  if (argc != 2) {
    fprintf(stderr, "Uso: %s <Porta>\n", argv[0]);
    fprintf(stderr, "Vai rodar um servidor de echo na porta <Porta> TCP\n");
    mensagem_exit();
    exit(1);
  }
  if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket :(\n");
    mensagem_exit();
    exit(2);
  }
  bzero(&servaddr, sizeof(servaddr));
  servaddr.sin_family = AF_INET;
  servaddr.sin_addr.s_addr = htonl(INADDR_ANY);
  servaddr.sin_port = htons(atoi(argv[1]));
  if (bind(listenfd, (struct sockaddr *)&servaddr, sizeof(servaddr)) == -1) {
    perror("bind :(\n");
    mensagem_exit();
    exit(3);
  }
  if (listen(listenfd, 1) == -1) {
    perror("listen :(\n");
    mensagem_exit();
    exit(4);
  }
  printf("[Servidor no ar. Aguardando conexoes na porta %s]\n", argv[1]);
  printf("[Para finalizar, pressione CTRL+c ou rode um kill ou killall]\n");
  for (;;) {
    if ((connfd = accept(listenfd, (struct sockaddr *)NULL, NULL)) == -1) {
      perror("accept :(\n");
      mensagem_exit();
      exit(5);
    }
    if ((childpid = fork()) == 0) {
      printf("[Uma conexao aberta] (pid: %d)\n", getpid());
      close(listenfd);
      envia_mensagem("220 Bem vindo ao servidor FTP.\r\n", connfd);
      while ((n = read(connfd, recvline, 4096)) > 0) {
        recvline[n] = 0;
        printf("[Cliente conectado no processo filho %d enviou:] ", getpid());
        if ((fputs(recvline, stdout)) == EOF) {
          perror("fputs :( \n");
          mensagem_exit();
          exit(6);
        } else {
          comando = retorna_funcao(recvline);
          switch (comando) {
          case (1):
            sscanf(recvline, "%*s %s", usuario);
            sprintf(mensagem, "331 Password required for %s\r\n", usuario);
            envia_mensagem(mensagem, connfd);
            break;
          case (2):
            sscanf(recvline, "%*s %s", senha);
            sprintf(mensagem, "230 User %s logged in\r\n", usuario);
            envia_mensagem(mensagem, connfd);
            break;
          case (4):
            envia_mensagem("215 UNIX Type: L8\r\n", connfd);
            break;
          case (5):
            datafd = cria_socket();
            bzero(&dataaddr, sizeof(dataaddr));
            dataaddr.sin_family = AF_INET;
            dataaddr.sin_addr.s_addr = htonl(INADDR_ANY);
            dataaddr.sin_port = htons(0);
            if (bind(datafd, (struct sockaddr *)&dataaddr, sizeof(dataaddr)) ==
                -1) {
              perror("datafd bind :(\n");
              mensagem_exit();
              exit(3);
            }
            data_len = sizeof(dataaddr);
            if (getsockname(datafd, (struct sockaddr *)&dataaddr, &data_len) ==
                -1) {
              perror("datafd getsockname :(\n");
              mensagem_exit();
              exit(3);
            }
            if (listen(datafd, 1) == 1) {
              perror("listen :(\n");
              mensagem_exit();
              exit(4);
            }
            buffer = inet_ntoa(servaddr.sin_addr);
            sscanf(buffer, "%d.%d.%d.%d ", &a, &b, &c, &d);
            porta = (int)ntohs(dataaddr.sin_port);
            x = porta / 256;
            y = porta % 256;
            sprintf(mensagem,
                    "227 Entering Passive Mode (%d,%d,%d,%d,%d,%d).\r\n", a, b,
                    c, d, x, y);
            envia_mensagem(mensagem, connfd);
            if ((data_transfer_fd =
                     accept(datafd, (struct sockaddr *)NULL, NULL)) == -1) {
              perror("accept :(\n");
              mensagem_exit();
              exit(5);
            }
            close(datafd);
            break;
          case (6):
            envia_mensagem(
                "150 Opening ASCII mode data connection for file list\r\n",
                connfd);
            fp = popen("ls -l", "r");
            dados[0] = 0;
            topo = 0;
            while ((ch = fgetc(fp)) != EOF) {
              if (ch == '\n') {
                dados[topo] = '\r';
                dados[++topo] = 0;
              }
              dados[topo] = ch;
              dados[++topo] = 0;
            }
            write(data_transfer_fd, dados, strlen(dados));
            close(data_transfer_fd);
            pclose(fp);
            envia_mensagem("226 Transfer complete\r\n", connfd);
            break;
          case (8):
            sscanf(recvline, "%*s %c", &tipo);
            sprintf(mensagem, "200 Type set to %c\r\n", tipo);
            envia_mensagem(mensagem, connfd);
            break;
          case (7):
            sscanf(recvline, "%*s %s", endereco_arquivo);
            if ((arquivo_fd = open(endereco_arquivo, O_RDONLY, S_IREAD)) < 0) {
              sprintf(mensagem,
                      "550 %s: Arquivo ou diretório não encontrado\r\n",
                      endereco_arquivo);
              envia_mensagem(mensagem, connfd);
            } else {
              stat(endereco_arquivo, &st);
              tamanho_arquivo = st.st_size;
              if (tipo == 'I') {
                sprintf(mensagem,
                        "150 Opening BINARY mode data connection for %s (%d "
                        "bytes)\r\n",
                        endereco_arquivo, (int)tamanho_arquivo);
                envia_mensagem(mensagem, connfd);
              }
              while ((leu_bytes = read(arquivo_fd, data_buffer, 4096)) > 0) {
                write(data_transfer_fd, data_buffer, leu_bytes);
              }
              close(arquivo_fd);
              close(data_transfer_fd);
              envia_mensagem("226 Transfer complete\r\n", connfd);
            }
            break;
          case (9):
            sscanf(recvline, "%*s %s", endereco_arquivo);
            if ((arquivo_fd = open(endereco_arquivo, O_WRONLY | O_CREAT)) < 0) {
              sprintf(mensagem, "550 %s: Não foi possível criar o arquivo.\r\n",
                      endereco_arquivo);
              envia_mensagem(mensagem, connfd);
            } else {
              if (tipo == 'I') {
                sprintf(mensagem,
                        "150 Opening BINARY mode data connection for %s\r\n",
                        endereco_arquivo);
                envia_mensagem(mensagem, connfd);
              }
              while ((leu_bytes = read(data_transfer_fd, data_buffer, 4096)) >
                     0) {
                write(arquivo_fd, data_buffer, leu_bytes);
              }
              close(arquivo_fd);
              close(data_transfer_fd);
              envia_mensagem("226 Transfer complete\r\n", connfd);
            }
            break;
          case (3):
            envia_mensagem("221 Goodbye\r\n", connfd);
            mensagem_exit();
            exit(0);
            break;
          default:
            break;
          }
        }
      }
      printf("[Uma conexao fechada]\n");
      mensagem_exit();
      exit(0);
    }
    close(connfd);
  }
  mensagem_exit();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x7110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x41,-0x70d9(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1380 <main+0x70>
mov    0x2c77(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xcd3(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    0x2c59(%rip),%rax
mov    (%rax),%edi
lea    0xccd(%rip),%rsi
mov    $0x0,%al
call   1100 <fprintf@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x1,%edi
call   1210 <exit@plt>
mov    0x2c59(%rip),%rax
mov    (%rax),%rdi
mov    0x2c1f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1230 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    13c3 <main+0xb3>
lea    0xcbc(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x2,%edi
call   1210 <exit@plt>
lea    -0x30(%rbp),%rdi
mov    $0x18,%esi
call   11c0 <bzero@plt>
mov    0x2c08(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
mov    0x2bea(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   11f0 <atoi@plt>
mov    %eax,%edi
call   1070 <htons@plt>
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x18,%edx
call   1180 <bind@plt>
cmp    $0xffffffff,%eax
jne    1440 <main+0x130>
lea    0xda9(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x3,%edi
call   1210 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x1,%esi
call   1130 <listen@plt>
cmp    $0xffffffff,%eax
jne    1473 <main+0x163>
lea    0xc17(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x4,%edi
call   1210 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    0xc22(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   11d0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
jne    14cf <main+0x1bf>
lea    0xc38(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x5,%edi
call   1210 <exit@plt>
mov    $0x0,%al
call   1220 <fork@plt>
mov    %eax,-0x34(%rbp)
cmp    $0x0,%eax
jne    1cf4 <main+0x9e4>
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xc0a(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    -0x14(%rbp),%edi
call   10e0 <close@plt>
mov    -0x18(%rbp),%esi
lea    0xc11(%rip),%rdi
call   10c0 <envia_mensagem@plt>
mov    -0x18(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    $0x1000,%edx
call   10f0 <read@plt>
mov    %rax,-0x1048(%rbp)
cmp    $0x0,%rax
jbe    1cd8 <main+0x9c8>
mov    -0x1048(%rbp),%rax
movb   $0x0,-0x1040(%rbp,%rax,1)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    %eax,%esi
lea    0xbe9(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
lea    -0x1040(%rbp),%rdi
mov    0x2a3f(%rip),%rax
mov    (%rax),%esi
call   10a0 <fputs@plt>
mov    0x2a51(%rip),%rcx
cmp    (%rcx),%rax
jne    159d <main+0x28d>
lea    0xbe8(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x6,%edi
call   1210 <exit@plt>
lea    -0x1040(%rbp),%rdi
call   1160 <retorna_funcao@plt>
mov    %eax,-0x4054(%rbp)
mov    -0x4054(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x70e8(%rbp)
sub    $0x8,%eax
ja     1cc9 <main+0x9b9>
mov    -0x70e8(%rbp),%rax
lea    0xa28(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    -0x1040(%rbp),%rdi
lea    -0x2050(%rbp),%rdx
lea    0xb84(%rip),%rsi
mov    $0x0,%al
call   1140 <sscanf@plt>
lea    -0x4050(%rbp),%rdi
lea    -0x2050(%rbp),%rdx
lea    0xb6f(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
lea    -0x1040(%rbp),%rdi
lea    -0x3050(%rbp),%rdx
lea    0xb38(%rip),%rsi
mov    $0x0,%al
call   1140 <sscanf@plt>
lea    -0x4050(%rbp),%rdi
lea    -0x2050(%rbp),%rdx
lea    0xb42(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
mov    -0x18(%rbp),%esi
lea    0xb35(%rip),%rdi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
mov    $0x0,%al
call   1150 <cria_socket@plt>
mov    %eax,-0x4058(%rbp)
lea    -0x4078(%rbp),%rdi
mov    $0x18,%esi
call   11c0 <bzero@plt>
mov    0x292e(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x4068(%rbp)
mov    0x290d(%rip),%rax
mov    (%rax),%edi
call   10b0 <htonl@plt>
mov    %rax,-0x4070(%rbp)
xor    %edi,%edi
call   1070 <htons@plt>
mov    %rax,-0x4078(%rbp)
mov    -0x4058(%rbp),%edi
lea    -0x4078(%rbp),%rsi
mov    $0x18,%edx
call   1180 <bind@plt>
cmp    $0xffffffff,%eax
jne    171c <main+0x40c>
lea    0xac6(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x3,%edi
call   1210 <exit@plt>
movl   $0x18,-0x40ac(%rbp)
mov    -0x4058(%rbp),%edi
lea    -0x4078(%rbp),%rsi
lea    -0x40ac(%rbp),%rdx
call   11e0 <getsockname@plt>
cmp    $0xffffffff,%eax
jne    1765 <main+0x455>
lea    0xa8d(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x3,%edi
call   1210 <exit@plt>
mov    -0x4058(%rbp),%edi
mov    $0x1,%esi
call   1130 <listen@plt>
cmp    $0x1,%eax
jne    179b <main+0x48b>
lea    0x8ef(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x4,%edi
call   1210 <exit@plt>
mov    -0x28(%rbp),%rdi
call   1050 <inet_ntoa@plt>
mov    %rax,-0x4080(%rbp)
mov    -0x4080(%rbp),%rdi
lea    0xa3a(%rip),%rsi
lea    -0x4084(%rbp),%rdx
lea    -0x4088(%rbp),%rcx
lea    -0x408c(%rbp),%r8
lea    -0x4090(%rbp),%r9
mov    $0x0,%al
call   1140 <sscanf@plt>
mov    -0x4078(%rbp),%rdi
call   1170 <ntohs@plt>
mov    %eax,-0x409c(%rbp)
mov    -0x409c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %eax,-0x4094(%rbp)
mov    -0x409c(%rbp),%eax
mov    $0x100,%ecx
cltd
idiv   %ecx
mov    %edx,-0x4098(%rbp)
lea    -0x4050(%rbp),%rdi
mov    -0x4084(%rbp),%edx
mov    -0x4088(%rbp),%ecx
mov    -0x408c(%rbp),%r8d
mov    -0x4090(%rbp),%r9d
mov    -0x4094(%rbp),%r10d
mov    -0x4098(%rbp),%eax
lea    0x9b5(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
mov    -0x4058(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   11d0 <accept@plt>
mov    %eax,-0x405c(%rbp)
cmp    $0xffffffff,%eax
jne    18a7 <main+0x597>
lea    0x860(%rip),%rdi
call   11b0 <perror@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
mov    $0x5,%edi
call   1210 <exit@plt>
mov    -0x4058(%rbp),%edi
call   10e0 <close@plt>
jmp    1cce <main+0x9be>
mov    -0x18(%rbp),%esi
lea    0x970(%rip),%rdi
call   10c0 <envia_mensagem@plt>
lea    0x99b(%rip),%rdi
lea    0x99a(%rip),%rsi
call   11a0 <popen@plt>
mov    %rax,-0x40a8(%rbp)
movb   $0x0,-0x50b0(%rbp)
movl   $0x0,-0x50b4(%rbp)
mov    -0x40a8(%rbp),%rdi
call   10d0 <fgetc@plt>
mov    %al,-0x40ad(%rbp)
movsbq %al,%rax
mov    0x26ba(%rip),%rcx
cmp    (%rcx),%rax
je     1981 <main+0x671>
movsbl -0x40ad(%rbp),%eax
cmp    $0xa,%eax
jne    194f <main+0x63f>
movslq -0x50b4(%rbp),%rax
movb   $0xd,-0x50b0(%rbp,%rax,1)
0d
mov    -0x50b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50b4(%rbp)
cltq
movb   $0x0,-0x50b0(%rbp,%rax,1)
mov    -0x40ad(%rbp),%cl
movslq -0x50b4(%rbp),%rax
mov    %cl,-0x50b0(%rbp,%rax,1)
mov    -0x50b4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x50b4(%rbp)
cltq
movb   $0x0,-0x50b0(%rbp,%rax,1)
jmp    18f1 <main+0x5e1>
mov    -0x405c(%rbp),%eax
mov    %eax,-0x70f4(%rbp)
lea    -0x50b0(%rbp),%rax
mov    %rax,-0x70f0(%rbp)
lea    -0x50b0(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x70f4(%rbp),%edi
mov    -0x70f0(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
mov    -0x405c(%rbp),%edi
call   10e0 <close@plt>
mov    -0x40a8(%rbp),%rdi
call   1090 <pclose@plt>
mov    -0x18(%rbp),%esi
lea    0x894(%rip),%rdi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
lea    -0x1040(%rbp),%rdi
lea    0x894(%rip),%rsi
lea    -0x70d9(%rbp),%rdx
mov    $0x0,%al
call   1140 <sscanf@plt>
lea    -0x4050(%rbp),%rdi
movsbl -0x70d9(%rbp),%edx
lea    0x878(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
lea    -0x1040(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
lea    0x733(%rip),%rsi
mov    $0x0,%al
call   1140 <sscanf@plt>
lea    -0x70c0(%rbp),%rdi
mov    0x257c(%rip),%rax
mov    (%rax),%esi
mov    0x253b(%rip),%rax
mov    (%rax),%edx
mov    $0x0,%al
call   1190 <open@plt>
mov    %eax,-0x70d4(%rbp)
cmp    $0x0,%eax
jge    1aad <main+0x79d>
lea    -0x4050(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
lea    0x812(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1b7f <main+0x86f>
lea    -0x70c0(%rbp),%rdi
lea    -0x70d0(%rbp),%rsi
call   1110 <stat@plt>
mov    -0x70d0(%rbp),%rax
mov    %rax,-0x70c8(%rbp)
movsbl -0x70d9(%rbp),%eax
cmp    $0x49,%eax
jne    1b12 <main+0x802>
lea    -0x4050(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
mov    -0x70c8(%rbp),%rax
mov    %eax,%ecx
lea    0x7d8(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1b17 <main+0x807>
mov    -0x70d4(%rbp),%edi
lea    -0x60c0(%rbp),%rsi
mov    $0x1000,%edx
call   10f0 <read@plt>
mov    %eax,-0x70d8(%rbp)
cmp    $0x0,%eax
jle    1b5a <main+0x84a>
mov    -0x405c(%rbp),%edi
lea    -0x60c0(%rbp),%rsi
mov    -0x70d8(%rbp),%edx
call   1030 <write@plt>
jmp    1b17 <main+0x807>
mov    -0x70d4(%rbp),%edi
call   10e0 <close@plt>
mov    -0x405c(%rbp),%edi
call   10e0 <close@plt>
mov    -0x18(%rbp),%esi
lea    0x6f6(%rip),%rdi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
lea    -0x1040(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
lea    0x5e1(%rip),%rsi
mov    $0x0,%al
call   1140 <sscanf@plt>
lea    -0x70c0(%rbp),%rdi
mov    0x23e2(%rip),%rax
mov    (%rax),%esi
mov    0x2441(%rip),%rax
or     (%rax),%esi
mov    $0x0,%al
call   1190 <open@plt>
mov    %eax,-0x70d4(%rbp)
cmp    $0x0,%eax
jge    1bff <main+0x8ef>
lea    -0x4050(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
lea    0x72c(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1ca7 <main+0x997>
movsbl -0x70d9(%rbp),%eax
cmp    $0x49,%eax
jne    1c3a <main+0x92a>
lea    -0x4050(%rbp),%rdi
lea    -0x70c0(%rbp),%rdx
lea    0x71a(%rip),%rsi
mov    $0x0,%al
call   1200 <sprintf@plt>
lea    -0x4050(%rbp),%rdi
mov    -0x18(%rbp),%esi
call   10c0 <envia_mensagem@plt>
jmp    1c3f <main+0x92f>
mov    -0x405c(%rbp),%edi
lea    -0x60c0(%rbp),%rsi
mov    $0x1000,%edx
call   10f0 <read@plt>
mov    %eax,-0x70d8(%rbp)
cmp    $0x0,%eax
jle    1c82 <main+0x972>
mov    -0x70d4(%rbp),%edi
lea    -0x60c0(%rbp),%rsi
mov    -0x70d8(%rbp),%edx
call   1030 <write@plt>
jmp    1c3f <main+0x92f>
mov    -0x70d4(%rbp),%edi
call   10e0 <close@plt>
mov    -0x405c(%rbp),%edi
call   10e0 <close@plt>
mov    -0x18(%rbp),%esi
lea    0x5ce(%rip),%rdi
call   10c0 <envia_mensagem@plt>
jmp    1cce <main+0x9be>
mov    -0x18(%rbp),%esi
lea    0x6b9(%rip),%rdi
call   10c0 <envia_mensagem@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
xor    %edi,%edi
call   1210 <exit@plt>
jmp    1cce <main+0x9be>
jmp    1cd3 <main+0x9c3>
jmp    1510 <main+0x200>
lea    0x69e(%rip),%rdi
mov    $0x0,%al
call   1080 <printf@plt>
mov    $0x0,%al
call   1120 <mensagem_exit@plt>
xor    %edi,%edi
call   1210 <exit@plt>
mov    -0x18(%rbp),%edi
call   10e0 <close@plt>
jmp    1497 <main+0x187>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x7078,%rsp
mov    %rsi,%rbx
movb   $0x41,0x3(%rsp)
cmp    $0x2,%edi
jne    137a <main+0x5a>
mov    0x2c9b(%rip),%r15
mov    (%r15),%rdi
mov    0x2c61(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1240 <socket@plt>
cmp    $0xffffffff,%eax
jne    13b7 <main+0x97>
lea    0xd05(%rip),%rdi
call   11c0 <perror@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x2,%edi
call   1220 <exit@plt>
mov    0x2c37(%rip),%rbp
mov    0x0(%rbp),%edi
mov    (%rbx),%rdx
lea    0xc96(%rip),%rsi
xor    %eax,%eax
call   1110 <fprintf@plt>
mov    0x0(%rbp),%edi
lea    0xc96(%rip),%rsi
xor    %eax,%eax
call   1110 <fprintf@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x1,%edi
call   1220 <exit@plt>
mov    %eax,%ebp
lea    0x38(%rsp),%r14
mov    %r14,%rdi
mov    $0x18,%esi
call   11d0 <bzero@plt>
mov    (%r15),%rax
mov    %rax,0x48(%rsp)
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   10c0 <htonl@plt>
mov    %rax,0x40(%rsp)
mov    0x8(%rbx),%rdi
call   1200 <atoi@plt>
mov    %eax,%edi
call   1080 <htons@plt>
mov    %rax,0x38(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x18,%edx
call   1190 <bind@plt>
cmp    $0xffffffff,%eax
jne    142c <main+0x10c>
lea    0xd7e(%rip),%rdi
call   11c0 <perror@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x3,%edi
call   1220 <exit@plt>
mov    %ebp,%edi
mov    $0x1,%esi
call   1140 <listen@plt>
cmp    $0xffffffff,%eax
jne    145a <main+0x13a>
lea    0xc30(%rip),%rdi
call   11c0 <perror@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x4,%edi
call   1220 <exit@plt>
mov    0x8(%rbx),%rsi
lea    0xc1a(%rip),%rdi
xor    %eax,%eax
call   1090 <printf@plt>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11e0 <accept@plt>
cmp    $0xffffffff,%eax
je     14b4 <main+0x194>
mov    %eax,%ebx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1230 <fork@plt>
test   %eax,%eax
je     14d1 <main+0x1b1>
mov    %ebx,%edi
call   10f0 <close@plt>
mov    %ebp,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11e0 <accept@plt>
mov    %eax,%ebx
cmp    $0xffffffff,%eax
jne    1490 <main+0x170>
lea    0xbf7(%rip),%rdi
call   11c0 <perror@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x5,%edi
call   1220 <exit@plt>
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xbde(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %ebp,%edi
call   10f0 <close@plt>
lea    0xbe7(%rip),%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
lea    0x4060(%rsp),%rsi
mov    %ebx,%edi
mov    $0x1000,%edx
call   1100 <read@plt>
test   %rax,%rax
jne    1530 <main+0x210>
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
xor    %edi,%edi
call   1220 <exit@plt>
mov    0x2a71(%rip),%rbp
lea    0x4060(%rsp),%r15
lea    0x3060(%rsp),%r12
lea    0x1050(%rsp),%r14
jmp    15b2 <main+0x292>
mov    %r15,%rdi
lea    0xbe0(%rip),%rsi
lea    0x6070(%rsp),%rdx
xor    %eax,%eax
call   1150 <sscanf@plt>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
lea    0xbe8(%rip),%rsi
lea    0x5070(%rsp),%rdx
xor    %eax,%eax
call   1210 <sprintf@plt>
mov    %r14,%rdi
lea    0x1050(%rsp),%r14
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0x1000,%edx
call   1100 <read@plt>
test   %rax,%rax
je     1516 <main+0x1f6>
movb   $0x0,0x4060(%rsp,%rax,1)
xor    %eax,%eax
call   1050 <getpid@plt>
lea    0xb36(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x0(%rbp),%esi
mov    %r15,%rdi
call   10b0 <fputs@plt>
mov    0x29e5(%rip),%rcx
cmp    (%rcx),%rax
je     1a81 <main+0x761>
mov    %r15,%rdi
call   1170 <retorna_funcao@plt>
add    $0xffffffff,%eax
cmp    $0x8,%eax
ja     159a <main+0x27a>
lea    0x9fd(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    %r15,%rdi
lea    0xb25(%rip),%rsi
mov    %r15,%r14
lea    0x5070(%rsp),%r15
mov    %r15,%rdx
xor    %eax,%eax
call   1150 <sscanf@plt>
lea    0x50(%rsp),%r12
mov    %r12,%rdi
lea    0xb08(%rip),%rsi
mov    %r15,%rdx
mov    %r14,%r15
lea    0x1050(%rsp),%r14
xor    %eax,%eax
call   1210 <sprintf@plt>
mov    %r12,%rdi
lea    0x3060(%rsp),%r12
jmp    1593 <main+0x273>
lea    0xb13(%rip),%rdi
jmp    1593 <main+0x273>
xor    %eax,%eax
call   1160 <cria_socket@plt>
mov    %eax,%r14d
lea    0x20(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x18,%esi
call   11d0 <bzero@plt>
mov    0x2952(%rip),%rax
mov    (%rax),%rax
mov    %rax,0x30(%rsp)
mov    0x2933(%rip),%rax
mov    (%rax),%edi
call   10c0 <htonl@plt>
mov    %rax,0x28(%rsp)
xor    %edi,%edi
call   1080 <htons@plt>
mov    %rax,0x20(%rsp)
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x18,%edx
call   1190 <bind@plt>
cmp    $0xffffffff,%eax
je     1ab1 <main+0x791>
movl   $0x18,0x4(%rsp)
mov    %r14d,%edi
mov    %rbp,%rsi
lea    0x4(%rsp),%rdx
call   11f0 <getsockname@plt>
cmp    $0xffffffff,%eax
je     1abd <main+0x79d>
mov    %r14d,%edi
mov    $0x1,%esi
call   1140 <listen@plt>
cmp    $0x1,%eax
je     143d <main+0x11d>
mov    0x40(%rsp),%rdi
call   1060 <inet_ntoa@plt>
mov    %rax,%rdi
lea    0xa9b(%rip),%rsi
lea    0x14(%rsp),%rdx
lea    0x10(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
xor    %eax,%eax
call   1150 <sscanf@plt>
mov    0x20(%rsp),%rdi
call   1180 <ntohs@plt>
mov    %rax,%rbp
lea    0xff(%rax),%r10d
test   %ebp,%ebp
cmovns %ebp,%r10d
mov    %r10d,%eax
and    $0xffffff00,%eax
sub    %eax,%ebp
sar    $0x8,%r10d
mov    0x14(%rsp),%edx
mov    0x10(%rsp),%ecx
mov    0xc(%rsp),%r8d
mov    0x8(%rsp),%r9d
lea    0x50(%rsp),%r12
mov    %r12,%rdi
lea    0xa44(%rip),%rsi
xor    %eax,%eax
push   %rbp
push   %r10
call   1210 <sprintf@plt>
add    $0x10,%rsp
mov    %r12,%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
mov    %r14d,%edi
xor    %esi,%esi
xor    %edx,%edx
call   11e0 <accept@plt>
cmp    $0xffffffff,%eax
je     14b4 <main+0x194>
mov    %eax,%r13d
mov    %r14d,%edi
call   10f0 <close@plt>
mov    0x27ec(%rip),%rbp
lea    0x3060(%rsp),%r12
jmp    1853 <main+0x533>
lea    0xa22(%rip),%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
lea    0xa4b(%rip),%rdi
lea    0xa4a(%rip),%rsi
call   11b0 <popen@plt>
mov    %rax,%r14
movb   $0x0,0x2060(%rsp)
mov    %rax,%rdi
call   10e0 <fgetc@plt>
movsbq %al,%rcx
mov    0x27c0(%rip),%rdx
cmp    %rcx,(%rdx)
jne    19eb <main+0x6cb>
lea    0x2060(%rsp),%rbp
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r13d,%edi
call   10f0 <close@plt>
mov    %r14,%rdi
call   10a0 <pclose@plt>
lea    0x9ec(%rip),%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
mov    0x2755(%rip),%rbp
lea    0x1050(%rsp),%r14
jmp    159a <main+0x27a>
mov    %r15,%rdi
lea    0x8d1(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1150 <sscanf@plt>
mov    0x275d(%rip),%rax
mov    (%rax),%esi
mov    0x271c(%rip),%rax
mov    (%rax),%edx
mov    %r12,%rdi
xor    %eax,%eax
call   11a0 <open@plt>
test   %eax,%eax
js     1a41 <main+0x721>
mov    %eax,%ebp
mov    %r12,%rdi
lea    0x18(%rsp),%rsi
call   1120 <stat@plt>
cmpb   $0x49,0x3(%rsp)
jne    18ed <main+0x5cd>
mov    0x18(%rsp),%ecx
lea    0x50(%rsp),%r14
mov    %r14,%rdi
lea    0x9d4(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1210 <sprintf@plt>
mov    %r14,%rdi
lea    0x1050(%rsp),%r14
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
jmp    18ed <main+0x5cd>
nop
mov    %r13d,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x1000,%edx
call   1100 <read@plt>
test   %eax,%eax
jg     18e0 <main+0x5c0>
jmp    19d0 <main+0x6b0>
mov    %r15,%rdi
lea    0x93a(%rip),%rsi
lea    0x3(%rsp),%rdx
xor    %eax,%eax
call   1150 <sscanf@plt>
movsbl 0x3(%rsp),%edx
lea    0x50(%rsp),%r14
mov    %r14,%rdi
lea    0x921(%rip),%rsi
xor    %eax,%eax
call   1210 <sprintf@plt>
jmp    1588 <main+0x268>
mov    %r15,%rdi
lea    0x7f6(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1150 <sscanf@plt>
mov    0x26a2(%rip),%rax
mov    (%rax),%esi
mov    0x2631(%rip),%rax
or     (%rax),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   11a0 <open@plt>
test   %eax,%eax
js     1a52 <main+0x732>
mov    %eax,%ebp
cmpb   $0x49,0x3(%rsp)
jne    19bc <main+0x69c>
lea    0x50(%rsp),%r14
mov    %r14,%rdi
lea    0x974(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1210 <sprintf@plt>
mov    %r14,%rdi
lea    0x1050(%rsp),%r14
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
jmp    19bc <main+0x69c>
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %r14,%rsi
mov    %eax,%edx
call   1040 <write@plt>
mov    %r13d,%edi
mov    %r14,%rsi
mov    $0x1000,%edx
call   1100 <read@plt>
test   %eax,%eax
jg     19b0 <main+0x690>
mov    %ebp,%edi
call   10f0 <close@plt>
mov    %r13d,%edi
call   10f0 <close@plt>
lea    0x84b(%rip),%rdi
jmp    1a6e <main+0x74e>
xor    %ebp,%ebp
jmp    1a22 <main+0x702>
nop
mov    %al,0x2060(%rsp,%rcx,1)
movslq %ebp,%rbp
movb   $0x0,0x2061(%rsp,%rbp,1)
add    $0x1,%rbp
mov    %r14,%rdi
call   10e0 <fgetc@plt>
movsbq %al,%rcx
mov    0x25af(%rip),%rdx
cmp    %rcx,(%rdx)
je     1811 <main+0x4f1>
movslq %ebp,%rcx
cmp    $0xa,%al
jne    19f0 <main+0x6d0>
movb   $0xd,0x2060(%rsp,%rcx,1)
0d
movb   $0x0,0x2061(%rsp,%rcx,1)
add    $0x1,%rcx
mov    %ecx,%ebp
jmp    19f0 <main+0x6d0>
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
lea    0x815(%rip),%rsi
jmp    1a61 <main+0x741>
lea    0x50(%rsp),%rbp
mov    %rbp,%rdi
lea    0x870(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
call   1210 <sprintf@plt>
mov    %rbp,%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
mov    0x252c(%rip),%rbp
jmp    159a <main+0x27a>
lea    0x6a8(%rip),%rdi
call   11c0 <perror@plt>
xor    %eax,%eax
call   1130 <mensagem_exit@plt>
mov    $0x6,%edi
call   1220 <exit@plt>
lea    0x88b(%rip),%rdi
mov    %ebx,%esi
call   10d0 <envia_mensagem@plt>
jmp    1522 <main+0x202>
lea    0x6d5(%rip),%rdi
jmp    1416 <main+0xf6>
lea    0x6d9(%rip),%rdi
jmp    1416 <main+0xf6>

LLVM IR (-O0):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.stat = type { i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [17 x i8] c"Uso: %s <Porta>\0A\00"
@.str.1 = [52 x i8] c"Vai rodar um servidor de echo na porta <Porta> TCP\0A\00"
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@.str.2 = [11 x i8] c"socket :(\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [9 x i8] c"bind :(\0A\00"
@.str.4 = [11 x i8] c"listen :(\0A\00"
@.str.5 = [51 x i8] c"[Servidor no ar. Aguardando conexoes na porta %s]\0A\00"
@.str.6 = [63 x i8] c"[Para finalizar, pressione CTRL+c ou rode um kill ou killall]\0A\00"
@.str.7 = [11 x i8] c"accept :(\0A\00"
@.str.8 = [32 x i8] c"[Uma conexao aberta] (pid: %d)\0A\00"
@.str.9 = [33 x i8] c"220 Bem vindo ao servidor FTP.\0D\0A\00"
@.str.10 = [50 x i8] c"[Cliente conectado no processo filho %d enviou:] \00"
@stdout = global i32 0
@EOF = global i64 0
@.str.11 = [11 x i8] c"fputs :( \0A\00"
@.str.12 = [7 x i8] c"%*s %s\00"
@.str.13 = [31 x i8] c"331 Password required for %s\0D\0A\00"
@.str.14 = [24 x i8] c"230 User %s logged in\0D\0A\00"
@.str.15 = [20 x i8] c"215 UNIX Type: L8\0D\0A\00"
@.str.16 = [16 x i8] c"datafd bind :(\0A\00"
@.str.17 = [23 x i8] c"datafd getsockname :(\0A\00"
@.str.18 = [13 x i8] c"%d.%d.%d.%d \00"
@.str.19 = [49 x i8] c"227 Entering Passive Mode (%d,%d,%d,%d,%d,%d).\0D\0A\00"
@.str.20 = [55 x i8] c"150 Opening ASCII mode data connection for file list\0D\0A\00"
@.str.21 = [6 x i8] c"ls -l\00"
@.str.22 = [2 x i8] c"r\00"
@.str.23 = [24 x i8] c"226 Transfer complete\0D\0A\00"
@.str.24 = [7 x i8] c"%*s %c\00"
@.str.25 = [21 x i8] c"200 Type set to %c\0D\0A\00"
@O_RDONLY = global i32 0
@S_IREAD = global i32 0
@.str.26 = [48 x i8] c"550 %s: Arquivo ou diret\C3\B3rio n\C3\A3o encontrado\0D\0A\00"
@.str.27 = [60 x i8] c"150 Opening BINARY mode data connection for %s (%d bytes)\0D\0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.28 = [46 x i8] c"550 %s: N\C3\A3o foi poss\C3\ADvel criar o arquivo.\0D\0A\00"
@.str.29 = [49 x i8] c"150 Opening BINARY mode data connection for %s\0D\0A\00"
@.str.30 = [14 x i8] c"221 Goodbye\0D\0A\00"
@.str.31 = [23 x i8] c"[Uma conexao fechada]\0A\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 %struct.sockaddr_in
%9 = alloca i32
%10 = alloca [4097 x i8]
%11 = alloca i64
%12 = alloca [4096 x i8]
%13 = alloca [4096 x i8]
%14 = alloca [4096 x i8]
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca %struct.sockaddr_in
%19 = alloca i8*
%20 = alloca i32
%21 = alloca i32
%22 = alloca i32
%23 = alloca i32
%24 = alloca i32
%25 = alloca i32
%26 = alloca i32
%27 = alloca i32*
%28 = alloca i32
%29 = alloca i8
%30 = alloca [4096 x i8]
%31 = alloca i32
%32 = alloca [4106 x i8]
%33 = alloca [4096 x i8]
%34 = alloca i64
%35 = alloca %struct.stat
%36 = alloca i32
%37 = alloca i32
%38 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 65, i8* %38
%39 = load i32, i32* %4
%40 = icmp ne i32 %39, 2
br i1 %40, label %41, label %51
41: ; preds = %2
%42 = load i32, i32* @stderr
%43 = load i8**, i8*** %5
%44 = getelementptr inbounds i8*, i8** %43, i64 0
%45 = load i8*, i8** %44
%46 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %45)
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%49 = call i32 (...) @mensagem_exit()
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %2
%52 = load i8*, i8** @AF_INET
%53 = load i32, i32* @SOCK_STREAM
%54 = call i32 @socket(i8* %52, i32 %53, i32 0)
store i32 %54, i32* %6
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%58 = call i32 (...) @mensagem_exit()
%59 = call i32 @exit(i32 2)
unreachable
60: ; preds = %51
%61 = call i32 @bzero(%struct.sockaddr_in* %8, i32 24)
%62 = load i8*, i8** @AF_INET
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i8* %62, i8** %63
%64 = load i32, i32* @INADDR_ANY
%65 = call i8* @htonl(i32 %64)
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%67 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %66, i32 0, i32 0
store i8* %65, i8** %67
%68 = load i8**, i8*** %5
%69 = getelementptr inbounds i8*, i8** %68, i64 1
%70 = load i8*, i8** %69
%71 = call i32 @atoi(i8* %70)
%72 = call i8* @htons(i32 %71)
%73 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i8* %72, i8** %73
%74 = load i32, i32* %6
%75 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%76 = call i32 @bind(i32 %74, %struct.sockaddr* %75, i32 24)
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %82
78: ; preds = %60
%79 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%80 = call i32 (...) @mensagem_exit()
%81 = call i32 @exit(i32 3)
unreachable
82: ; preds = %60
%83 = load i32, i32* %6
%84 = call i32 @listen(i32 %83, i32 1)
%85 = icmp eq i32 %84, -1
br i1 %85, label %86, label %90
86: ; preds = %82
%87 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%88 = call i32 (...) @mensagem_exit()
%89 = call i32 @exit(i32 4)
unreachable
90: ; preds = %82
%91 = load i8**, i8*** %5
%92 = getelementptr inbounds i8*, i8** %91, i64 1
%93 = load i8*, i8** %92
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i8* %93)
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.6, i64 0, i64 0))
br label %96
96: ; preds = %400, %90
%97 = load i32, i32* %6
%98 = call i32 @accept(i32 %97, %struct.sockaddr* null, i32* null)
store i32 %98, i32* %7
%99 = icmp eq i32 %98, -1
br i1 %99, label %100, label %104
100: ; preds = %96
%101 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%102 = call i32 (...) @mensagem_exit()
%103 = call i32 @exit(i32 5)
unreachable
104: ; preds = %96
%105 = call i32 (...) @fork()
store i32 %105, i32* %9
%106 = icmp eq i32 %105, 0
br i1 %106, label %107, label %400
107: ; preds = %104
%108 = call i32 (...) @getpid()
%109 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %108)
%110 = load i32, i32* %6
%111 = call i32 @close(i32 %110)
%112 = load i32, i32* %7
%113 = call i32 @envia_mensagem(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %112)
br label %114
114: ; preds = %395, %107
%115 = load i32, i32* %7
%116 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%117 = call i8* @read(i32 %115, i8* %116, i32 4096)
%118 = ptrtoint i8* %117 to i64
store i64 %118, i64* %11
%119 = icmp ugt i64 %118, 0
br i1 %119, label %120, label %396
120: ; preds = %114
%121 = load i64, i64* %11
%122 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 %121
store i8 0, i8* %122
%123 = call i32 (...) @getpid()
%124 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.10, i64 0, i64 0), i32 %123)
%125 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%126 = load i32, i32* @stdout
%127 = call i64 @fputs(i8* %125, i32 %126)
%128 = load i64, i64* @EOF
%129 = icmp eq i64 %127, %128
br i1 %129, label %130, label %134
130: ; preds = %120
%131 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%132 = call i32 (...) @mensagem_exit()
%133 = call i32 @exit(i32 6)
unreachable
134: ; preds = %120
%135 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%136 = call i32 @retorna_funcao(i8* %135)
store i32 %136, i32* %15
%137 = load i32, i32* %15
switch i32 %137, label %393 [
i32 1, label %138
i32 2, label %148
i32 4, label %158
i32 5, label %161
i32 6, label %233
i32 8, label %277
i32 7, label %287
i32 9, label %340
i32 3, label %388
]
138: ; preds = %134
%139 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%140 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%141 = call i32 (i8*, i8*, ...) @sscanf(i8* %139, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %140)
%142 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%143 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%144 = call i32 (i8*, i8*, ...) @sprintf(i8* %142, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i8* %143)
%145 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%146 = load i32, i32* %7
%147 = call i32 @envia_mensagem(i8* %145, i32 %146)
br label %394
148: ; preds = %134
%149 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%150 = getelementptr inbounds [4096 x i8], [4096 x i8]* %13, i64 0, i64 0
%151 = call i32 (i8*, i8*, ...) @sscanf(i8* %149, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %150)
%152 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%153 = getelementptr inbounds [4096 x i8], [4096 x i8]* %12, i64 0, i64 0
%154 = call i32 (i8*, i8*, ...) @sprintf(i8* %152, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i8* %153)
%155 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%156 = load i32, i32* %7
%157 = call i32 @envia_mensagem(i8* %155, i32 %156)
br label %394
158: ; preds = %134
%159 = load i32, i32* %7
%160 = call i32 @envia_mensagem(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 %159)
br label %394
161: ; preds = %134
%162 = call i32 (...) @cria_socket()
store i32 %162, i32* %16
%163 = call i32 @bzero(%struct.sockaddr_in* %18, i32 24)
%164 = load i8*, i8** @AF_INET
%165 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 2
store i8* %164, i8** %165
%166 = load i32, i32* @INADDR_ANY
%167 = call i8* @htonl(i32 %166)
%168 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 1
%169 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %168, i32 0, i32 0
store i8* %167, i8** %169
%170 = call i8* @htons(i32 0)
%171 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 0
store i8* %170, i8** %171
%172 = load i32, i32* %16
%173 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%174 = call i32 @bind(i32 %172, %struct.sockaddr* %173, i32 24)
%175 = icmp eq i32 %174, -1
br i1 %175, label %176, label %180
176: ; preds = %161
%177 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%178 = call i32 (...) @mensagem_exit()
%179 = call i32 @exit(i32 3)
unreachable
180: ; preds = %161
store i32 24, i32* %28
%181 = load i32, i32* %16
%182 = bitcast %struct.sockaddr_in* %18 to %struct.sockaddr*
%183 = call i32 @getsockname(i32 %181, %struct.sockaddr* %182, i32* %28)
%184 = icmp eq i32 %183, -1
br i1 %184, label %185, label %189
185: ; preds = %180
%186 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0))
%187 = call i32 (...) @mensagem_exit()
%188 = call i32 @exit(i32 3)
unreachable
189: ; preds = %180
%190 = load i32, i32* %16
%191 = call i32 @listen(i32 %190, i32 1)
%192 = icmp eq i32 %191, 1
br i1 %192, label %193, label %197
193: ; preds = %189
%194 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%195 = call i32 (...) @mensagem_exit()
%196 = call i32 @exit(i32 4)
unreachable
197: ; preds = %189
%198 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%199 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %198, i32 0, i32 0
%200 = load i8*, i8** %199
%201 = call i8* @inet_ntoa(i8* %200)
store i8* %201, i8** %19
%202 = load i8*, i8** %19
%203 = call i32 (i8*, i8*, ...) @sscanf(i8* %202, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i32* %20, i32* %21, i32* %22, i32* %23)
%204 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %18, i32 0, i32 0
%205 = load i8*, i8** %204
%206 = call i64 @ntohs(i8* %205)
%207 = trunc i64 %206 to i32
store i32 %207, i32* %26
%208 = load i32, i32* %26
%209 = sdiv i32 %208, 256
store i32 %209, i32* %24
%210 = load i32, i32* %26
%211 = srem i32 %210, 256
store i32 %211, i32* %25
%212 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%213 = load i32, i32* %20
%214 = load i32, i32* %21
%215 = load i32, i32* %22
%216 = load i32, i32* %23
%217 = load i32, i32* %24
%218 = load i32, i32* %25
%219 = call i32 (i8*, i8*, ...) @sprintf(i8* %212, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.19, i64 0, i64 0), i32 %213, i32 %214, i32 %215, i32 %216, i32 %217, i32 %218)
%220 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%221 = load i32, i32* %7
%222 = call i32 @envia_mensagem(i8* %220, i32 %221)
%223 = load i32, i32* %16
%224 = call i32 @accept(i32 %223, %struct.sockaddr* null, i32* null)
store i32 %224, i32* %17
%225 = icmp eq i32 %224, -1
br i1 %225, label %226, label %230
226: ; preds = %197
%227 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%228 = call i32 (...) @mensagem_exit()
%229 = call i32 @exit(i32 5)
unreachable
230: ; preds = %197
%231 = load i32, i32* %16
%232 = call i32 @close(i32 %231)
br label %394
233: ; preds = %134
%234 = load i32, i32* %7
%235 = call i32 @envia_mensagem(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.20, i64 0, i64 0), i32 %234)
%236 = call i32* @popen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
store i32* %236, i32** %27
%237 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 0
store i8 0, i8* %237
store i32 0, i32* %31
br label %238
238: ; preds = %256, %233
%239 = load i32*, i32** %27
%240 = call signext i8 @fgetc(i32* %239)
store i8 %240, i8* %29
%241 = sext i8 %240 to i64
%242 = load i64, i64* @EOF
%243 = icmp ne i64 %241, %242
br i1 %243, label %244, label %265
244: ; preds = %238
%245 = load i8, i8* %29
%246 = sext i8 %245 to i32
%247 = icmp eq i32 %246, 10
br i1 %247, label %248, label %256
248: ; preds = %244
%249 = load i32, i32* %31
%250 = sext i32 %249 to i64
%251 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 %250
store i8 13, i8* %251
%252 = load i32, i32* %31
%253 = add nsw i32 %252, 1
store i32 %253, i32* %31
%254 = sext i32 %253 to i64
%255 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 %254
store i8 0, i8* %255
br label %256
256: ; preds = %248, %244
%257 = load i8, i8* %29
%258 = load i32, i32* %31
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 %259
store i8 %257, i8* %260
%261 = load i32, i32* %31
%262 = add nsw i32 %261, 1
store i32 %262, i32* %31
%263 = sext i32 %262 to i64
%264 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 %263
store i8 0, i8* %264
br label %238
265: ; preds = %238
%266 = load i32, i32* %17
%267 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 0
%268 = getelementptr inbounds [4096 x i8], [4096 x i8]* %30, i64 0, i64 0
%269 = call i32 @strlen(i8* %268)
%270 = call i32 @write(i32 %266, i8* %267, i32 %269)
%271 = load i32, i32* %17
%272 = call i32 @close(i32 %271)
%273 = load i32*, i32** %27
%274 = call i32 @pclose(i32* %273)
%275 = load i32, i32* %7
%276 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %275)
br label %394
277: ; preds = %134
%278 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%279 = call i32 (i8*, i8*, ...) @sscanf(i8* %278, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i8* %38)
%280 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%281 = load i8, i8* %38
%282 = sext i8 %281 to i32
%283 = call i32 (i8*, i8*, ...) @sprintf(i8* %280, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), i32 %282)
%284 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%285 = load i32, i32* %7
%286 = call i32 @envia_mensagem(i8* %284, i32 %285)
br label %394
287: ; preds = %134
%288 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%289 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%290 = call i32 (i8*, i8*, ...) @sscanf(i8* %288, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %289)
%291 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%292 = load i32, i32* @O_RDONLY
%293 = load i32, i32* @S_IREAD
%294 = call i32 (i8*, i32, ...) @open(i8* %291, i32 %292, i32 %293)
store i32 %294, i32* %36
%295 = icmp slt i32 %294, 0
br i1 %295, label %296, label %303
296: ; preds = %287
%297 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%298 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%299 = call i32 (i8*, i8*, ...) @sprintf(i8* %297, i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.26, i64 0, i64 0), i8* %298)
%300 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%301 = load i32, i32* %7
%302 = call i32 @envia_mensagem(i8* %300, i32 %301)
br label %339
303: ; preds = %287
%304 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%305 = call i32 @stat(i8* %304, %struct.stat* %35)
%306 = getelementptr inbounds %struct.stat, %struct.stat* %35, i32 0, i32 0
%307 = load i64, i64* %306
store i64 %307, i64* %34
%308 = load i8, i8* %38
%309 = sext i8 %308 to i32
%310 = icmp eq i32 %309, 73
br i1 %310, label %311, label %320
311: ; preds = %303
%312 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%313 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%314 = load i64, i64* %34
%315 = trunc i64 %314 to i32
%316 = call i32 (i8*, i8*, ...) @sprintf(i8* %312, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.27, i64 0, i64 0), i8* %313, i32 %315)
%317 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%318 = load i32, i32* %7
%319 = call i32 @envia_mensagem(i8* %317, i32 %318)
br label %320
320: ; preds = %311, %303
br label %321
321: ; preds = %327, %320
%322 = load i32, i32* %36
%323 = getelementptr inbounds [4106 x i8], [4106 x i8]* %32, i64 0, i64 0
%324 = call i8* @read(i32 %322, i8* %323, i32 4096)
%325 = ptrtoint i8* %324 to i32
store i32 %325, i32* %37
%326 = icmp sgt i32 %325, 0
br i1 %326, label %327, label %332
327: ; preds = %321
%328 = load i32, i32* %17
%329 = getelementptr inbounds [4106 x i8], [4106 x i8]* %32, i64 0, i64 0
%330 = load i32, i32* %37
%331 = call i32 @write(i32 %328, i8* %329, i32 %330)
br label %321
332: ; preds = %321
%333 = load i32, i32* %36
%334 = call i32 @close(i32 %333)
%335 = load i32, i32* %17
%336 = call i32 @close(i32 %335)
%337 = load i32, i32* %7
%338 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %337)
br label %339
339: ; preds = %332, %296
br label %394
340: ; preds = %134
%341 = getelementptr inbounds [4097 x i8], [4097 x i8]* %10, i64 0, i64 0
%342 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%343 = call i32 (i8*, i8*, ...) @sscanf(i8* %341, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %342)
%344 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%345 = load i32, i32* @O_WRONLY
%346 = load i32, i32* @O_CREAT
%347 = or i32 %345, %346
%348 = call i32 (i8*, i32, ...) @open(i8* %344, i32 %347)
store i32 %348, i32* %36
%349 = icmp slt i32 %348, 0
br i1 %349, label %350, label %357
350: ; preds = %340
%351 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%352 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%353 = call i32 (i8*, i8*, ...) @sprintf(i8* %351, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.28, i64 0, i64 0), i8* %352)
%354 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%355 = load i32, i32* %7
%356 = call i32 @envia_mensagem(i8* %354, i32 %355)
br label %387
357: ; preds = %340
%358 = load i8, i8* %38
%359 = sext i8 %358 to i32
%360 = icmp eq i32 %359, 73
br i1 %360, label %361, label %368
361: ; preds = %357
%362 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%363 = getelementptr inbounds [4096 x i8], [4096 x i8]* %33, i64 0, i64 0
%364 = call i32 (i8*, i8*, ...) @sprintf(i8* %362, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.29, i64 0, i64 0), i8* %363)
%365 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%366 = load i32, i32* %7
%367 = call i32 @envia_mensagem(i8* %365, i32 %366)
br label %368
368: ; preds = %361, %357
br label %369
369: ; preds = %375, %368
%370 = load i32, i32* %17
%371 = getelementptr inbounds [4106 x i8], [4106 x i8]* %32, i64 0, i64 0
%372 = call i8* @read(i32 %370, i8* %371, i32 4096)
%373 = ptrtoint i8* %372 to i32
store i32 %373, i32* %37
%374 = icmp sgt i32 %373, 0
br i1 %374, label %375, label %380
375: ; preds = %369
%376 = load i32, i32* %36
%377 = getelementptr inbounds [4106 x i8], [4106 x i8]* %32, i64 0, i64 0
%378 = load i32, i32* %37
%379 = call i32 @write(i32 %376, i8* %377, i32 %378)
br label %369
380: ; preds = %369
%381 = load i32, i32* %36
%382 = call i32 @close(i32 %381)
%383 = load i32, i32* %17
%384 = call i32 @close(i32 %383)
%385 = load i32, i32* %7
%386 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %385)
br label %387
387: ; preds = %380, %350
br label %394
388: ; preds = %134
%389 = load i32, i32* %7
%390 = call i32 @envia_mensagem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.30, i64 0, i64 0), i32 %389)
%391 = call i32 (...) @mensagem_exit()
%392 = call i32 @exit(i32 0)
unreachable
393: ; preds = %134
br label %394
394: ; preds = %393, %387, %339, %277, %265, %230, %158, %148, %138
br label %395
395: ; preds = %394
br label %114
396: ; preds = %114
%397 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.31, i64 0, i64 0))
%398 = call i32 (...) @mensagem_exit()
%399 = call i32 @exit(i32 0)
unreachable
400: ; preds = %104
%401 = load i32, i32* %7
%402 = call i32 @close(i32 %401)
br label %96
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8*, %struct.TYPE_2__, i8* }
%struct.TYPE_2__ = type { i8* }
%struct.stat = type { i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [17 x i8] c"Uso: %s <Porta>\0A\00"
@.str.1 = [52 x i8] c"Vai rodar um servidor de echo na porta <Porta> TCP\0A\00"
@AF_INET = global i8* null
@SOCK_STREAM = global i32 0
@.str.2 = [11 x i8] c"socket :(\0A\00"
@INADDR_ANY = global i32 0
@.str.3 = [9 x i8] c"bind :(\0A\00"
@.str.4 = [11 x i8] c"listen :(\0A\00"
@.str.5 = [51 x i8] c"[Servidor no ar. Aguardando conexoes na porta %s]\0A\00"
@.str.7 = [11 x i8] c"accept :(\0A\00"
@.str.8 = [32 x i8] c"[Uma conexao aberta] (pid: %d)\0A\00"
@.str.9 = [33 x i8] c"220 Bem vindo ao servidor FTP.\0D\0A\00"
@.str.10 = [50 x i8] c"[Cliente conectado no processo filho %d enviou:] \00"
@stdout = global i32 0
@EOF = global i64 0
@.str.11 = [11 x i8] c"fputs :( \0A\00"
@.str.12 = [7 x i8] c"%*s %s\00"
@.str.13 = [31 x i8] c"331 Password required for %s\0D\0A\00"
@.str.14 = [24 x i8] c"230 User %s logged in\0D\0A\00"
@.str.15 = [20 x i8] c"215 UNIX Type: L8\0D\0A\00"
@.str.16 = [16 x i8] c"datafd bind :(\0A\00"
@.str.17 = [23 x i8] c"datafd getsockname :(\0A\00"
@.str.18 = [13 x i8] c"%d.%d.%d.%d \00"
@.str.19 = [49 x i8] c"227 Entering Passive Mode (%d,%d,%d,%d,%d,%d).\0D\0A\00"
@.str.20 = [55 x i8] c"150 Opening ASCII mode data connection for file list\0D\0A\00"
@.str.21 = [6 x i8] c"ls -l\00"
@.str.22 = [2 x i8] c"r\00"
@.str.23 = [24 x i8] c"226 Transfer complete\0D\0A\00"
@.str.24 = [7 x i8] c"%*s %c\00"
@.str.25 = [21 x i8] c"200 Type set to %c\0D\0A\00"
@O_RDONLY = global i32 0
@S_IREAD = global i32 0
@.str.26 = [48 x i8] c"550 %s: Arquivo ou diret\C3\B3rio n\C3\A3o encontrado\0D\0A\00"
@.str.27 = [60 x i8] c"150 Opening BINARY mode data connection for %s (%d bytes)\0D\0A\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@.str.28 = [46 x i8] c"550 %s: N\C3\A3o foi poss\C3\ADvel criar o arquivo.\0D\0A\00"
@.str.29 = [49 x i8] c"150 Opening BINARY mode data connection for %s\0D\0A\00"
@.str.30 = [14 x i8] c"221 Goodbye\0D\0A\00"
@str = [62 x i8] c"[Para finalizar, pressione CTRL+c ou rode um kill ou killall]\00"
@str.32 = [22 x i8] c"[Uma conexao fechada]\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [4097 x i8]
%5 = alloca [4096 x i8]
%6 = alloca [4096 x i8]
%7 = alloca [4096 x i8]
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca [4096 x i8]
%15 = alloca [4106 x i8]
%16 = alloca [4096 x i8]
%17 = alloca %struct.stat
%18 = alloca i8
%19 = bitcast %struct.sockaddr_in* %3 to i8*
%20 = getelementptr inbounds [4097 x i8], [4097 x i8]* %4, i64 0, i64 0
%21 = getelementptr inbounds [4096 x i8], [4096 x i8]* %5, i64 0, i64 0
%22 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %7, i64 0, i64 0
%24 = bitcast %struct.sockaddr_in* %8 to i8*
%25 = bitcast i32* %9 to i8*
%26 = bitcast i32* %10 to i8*
%27 = bitcast i32* %11 to i8*
%28 = bitcast i32* %12 to i8*
%29 = bitcast i32* %13 to i8*
%30 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 0
%31 = getelementptr inbounds [4106 x i8], [4106 x i8]* %15, i64 0, i64 0
%32 = getelementptr inbounds [4096 x i8], [4096 x i8]* %16, i64 0, i64 0
%33 = bitcast %struct.stat* %17 to i8*
store i8 65, i8* %18
%34 = icmp eq i32 %0, 2
br i1 %34, label %43, label %35
35: ; preds = %2
%36 = load i32, i32* @stderr
%37 = load i8*, i8** %1
%38 = tail call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %37)
%39 = load i32, i32* @stderr
%40 = tail call i32 (i32, i8*, ...) @fprintf(i32 %39, i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.1, i64 0, i64 0))
%41 = tail call i32 (...) @mensagem_exit()
%42 = tail call i32 @exit(i32 1)
unreachable
43: ; preds = %2
%44 = load i8*, i8** @AF_INET
%45 = load i32, i32* @SOCK_STREAM
%46 = tail call i32 @socket(i8* %44, i32 %45, i32 0)
%47 = icmp eq i32 %46, -1
br i1 %47, label %48, label %52
48: ; preds = %43
%49 = tail call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%50 = tail call i32 (...) @mensagem_exit()
%51 = tail call i32 @exit(i32 2)
unreachable
52: ; preds = %43
%53 = call i32 @bzero(%struct.sockaddr_in* %3, i32 24)
%54 = load i8*, i8** @AF_INET
%55 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i8* %54, i8** %55
%56 = load i32, i32* @INADDR_ANY
%57 = tail call i8* @htonl(i32 %56)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i8* %57, i8** %58
%59 = getelementptr inbounds i8*, i8** %1, i64 1
%60 = load i8*, i8** %59
%61 = tail call i32 @atoi(i8* %60)
%62 = tail call i8* @htons(i32 %61)
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i8* %62, i8** %63
%64 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%65 = call i32 @bind(i32 %46, %struct.sockaddr* %64, i32 24)
%66 = icmp eq i32 %65, -1
br i1 %66, label %67, label %71
67: ; preds = %52
%68 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%69 = call i32 (...) @mensagem_exit()
%70 = call i32 @exit(i32 3)
unreachable
71: ; preds = %52
%72 = call i32 @listen(i32 %46, i32 1)
%73 = icmp eq i32 %72, -1
br i1 %73, label %74, label %78
74: ; preds = %71
%75 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%76 = call i32 (...) @mensagem_exit()
%77 = call i32 @exit(i32 4)
unreachable
78: ; preds = %71
%79 = load i8*, i8** %59
%80 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.5, i64 0, i64 0), i8* %79)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([62 x i8], [62 x i8]* @str, i64 0, i64 0))
%82 = call i32 @accept(i32 %46, %struct.sockaddr* null, i32* null)
%83 = icmp eq i32 %82, -1
br i1 %83, label %84, label %88
84: ; preds = %300, %78
%85 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%86 = call i32 (...) @mensagem_exit()
%87 = call i32 @exit(i32 5)
unreachable
88: ; preds = %78, %300
%89 = phi i32 [ %302, %300 ], [ %82, %78 ]
%90 = call i32 (...) @fork()
%91 = icmp eq i32 %90, 0
br i1 %91, label %92, label %300
92: ; preds = %88
%93 = call i32 (...) @getpid()
%94 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.8, i64 0, i64 0), i32 %93)
%95 = call i32 @close(i32 %46)
%96 = call i32 @envia_mensagem(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %89)
%97 = call i8* @read(i32 %89, i8* %20, i32 4096)
%98 = icmp eq i8* %97, null
br i1 %98, label %296, label %99
99: ; preds = %92
%100 = getelementptr inbounds %struct.stat, %struct.stat* %17, i64 0, i32 0
%101 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 2
%102 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 1, i32 0
%103 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i64 0, i32 0
%104 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
br label %105
105: ; preds = %99, %292
%106 = phi i8* [ %97, %99 ], [ %294, %292 ]
%107 = phi i32 [ undef, %99 ], [ %293, %292 ]
%108 = ptrtoint i8* %106 to i64
%109 = getelementptr inbounds [4097 x i8], [4097 x i8]* %4, i64 0, i64 %108
store i8 0, i8* %109
%110 = call i32 (...) @getpid()
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.10, i64 0, i64 0), i32 %110)
%112 = load i32, i32* @stdout
%113 = call i64 @fputs(i8* %20, i32 %112)
%114 = load i64, i64* @EOF
%115 = icmp eq i64 %113, %114
br i1 %115, label %116, label %120
116: ; preds = %105
%117 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.11, i64 0, i64 0))
%118 = call i32 (...) @mensagem_exit()
%119 = call i32 @exit(i32 6)
unreachable
120: ; preds = %105
%121 = call i32 @retorna_funcao(i8* %20)
switch i32 %121, label %292 [
i32 1, label %122
i32 2, label %126
i32 4, label %130
i32 5, label %132
i32 6, label %182
i32 8, label %216
i32 7, label %222
i32 9, label %256
i32 3, label %288
]
122: ; preds = %120
%123 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %21)
%124 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.13, i64 0, i64 0), i8* %21)
%125 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %292
126: ; preds = %120
%127 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %22)
%128 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.14, i64 0, i64 0), i8* %21)
%129 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %292
130: ; preds = %120
%131 = call i32 @envia_mensagem(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.15, i64 0, i64 0), i32 %89)
br label %292
132: ; preds = %120
%133 = call i32 (...) @cria_socket()
%134 = call i32 @bzero(%struct.sockaddr_in* %8, i32 24)
%135 = load i8*, i8** @AF_INET
store i8* %135, i8** %101
%136 = load i32, i32* @INADDR_ANY
%137 = call i8* @htonl(i32 %136)
store i8* %137, i8** %102
%138 = call i8* @htons(i32 0)
store i8* %138, i8** %103
%139 = call i32 @bind(i32 %133, %struct.sockaddr* %104, i32 24)
%140 = icmp eq i32 %139, -1
br i1 %140, label %141, label %145
141: ; preds = %132
%142 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.16, i64 0, i64 0))
%143 = call i32 (...) @mensagem_exit()
%144 = call i32 @exit(i32 3)
unreachable
145: ; preds = %132
store i32 24, i32* %13
%146 = call i32 @getsockname(i32 %133, %struct.sockaddr* %104, i32* %13)
%147 = icmp eq i32 %146, -1
br i1 %147, label %148, label %152
148: ; preds = %145
%149 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.17, i64 0, i64 0))
%150 = call i32 (...) @mensagem_exit()
%151 = call i32 @exit(i32 3)
unreachable
152: ; preds = %145
%153 = call i32 @listen(i32 %133, i32 1)
%154 = icmp eq i32 %153, 1
br i1 %154, label %155, label %159
155: ; preds = %152
%156 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
%157 = call i32 (...) @mensagem_exit()
%158 = call i32 @exit(i32 4)
unreachable
159: ; preds = %152
%160 = load i8*, i8** %58
%161 = call i8* @inet_ntoa(i8* %160)
%162 = call i32 (i8*, i8*, ...) @sscanf(i8* %161, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.18, i64 0, i64 0), i32* %9, i32* %10, i32* %11, i32* %12)
%163 = load i8*, i8** %103
%164 = call i64 @ntohs(i8* %163)
%165 = trunc i64 %164 to i32
%166 = sdiv i32 %165, 256
%167 = srem i32 %165, 256
%168 = load i32, i32* %9
%169 = load i32, i32* %10
%170 = load i32, i32* %11
%171 = load i32, i32* %12
%172 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.19, i64 0, i64 0), i32 %168, i32 %169, i32 %170, i32 %171, i32 %166, i32 %167)
%173 = call i32 @envia_mensagem(i8* %23, i32 %89)
%174 = call i32 @accept(i32 %133, %struct.sockaddr* null, i32* null)
%175 = icmp eq i32 %174, -1
br i1 %175, label %176, label %180
176: ; preds = %159
%177 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0))
%178 = call i32 (...) @mensagem_exit()
%179 = call i32 @exit(i32 5)
unreachable
180: ; preds = %159
%181 = call i32 @close(i32 %133)
br label %292
182: ; preds = %120
%183 = call i32 @envia_mensagem(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.20, i64 0, i64 0), i32 %89)
%184 = call i32* @popen(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.21, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0))
store i8 0, i8* %30
%185 = call signext i8 @fgetc(i32* %184)
%186 = sext i8 %185 to i64
%187 = load i64, i64* @EOF
%188 = icmp eq i64 %187, %186
br i1 %188, label %210, label %189
189: ; preds = %182, %199
%190 = phi i8 [ %206, %199 ], [ %185, %182 ]
%191 = phi i32 [ %203, %199 ], [ 0, %182 ]
%192 = icmp eq i8 %190, 10
%193 = sext i32 %191 to i64
br i1 %192, label %194, label %199
194: ; preds = %189
%195 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 %193
store i8 13, i8* %195
%196 = add nsw i32 %191, 1
%197 = sext i32 %196 to i64
%198 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 %197
store i8 0, i8* %198
br label %199
199: ; preds = %189, %194
%200 = phi i64 [ %197, %194 ], [ %193, %189 ]
%201 = phi i32 [ %196, %194 ], [ %191, %189 ]
%202 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 %200
store i8 %190, i8* %202
%203 = add nsw i32 %201, 1
%204 = sext i32 %203 to i64
%205 = getelementptr inbounds [4096 x i8], [4096 x i8]* %14, i64 0, i64 %204
store i8 0, i8* %205
%206 = call signext i8 @fgetc(i32* %184)
%207 = sext i8 %206 to i64
%208 = load i64, i64* @EOF
%209 = icmp eq i64 %208, %207
br i1 %209, label %210, label %189
210: ; preds = %199, %182
%211 = call i32 @strlen(i8* %30)
%212 = call i32 @write(i32 %107, i8* %30, i32 %211)
%213 = call i32 @close(i32 %107)
%214 = call i32 @pclose(i32* %184)
%215 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %89)
br label %292
216: ; preds = %120
%217 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.24, i64 0, i64 0), i8* %18)
%218 = load i8, i8* %18
%219 = sext i8 %218 to i32
%220 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.25, i64 0, i64 0), i32 %219)
%221 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %292
222: ; preds = %120
%223 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %32)
%224 = load i32, i32* @O_RDONLY
%225 = load i32, i32* @S_IREAD
%226 = call i32 (i8*, i32, ...) @open(i8* %32, i32 %224, i32 %225)
%227 = icmp slt i32 %226, 0
br i1 %227, label %228, label %231
228: ; preds = %222
%229 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.26, i64 0, i64 0), i8* %32)
%230 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %292
231: ; preds = %222
%232 = call i32 @stat(i8* %32, %struct.stat* %17)
%233 = load i8, i8* %18
%234 = icmp eq i8 %233, 73
br i1 %234, label %235, label %240
235: ; preds = %231
%236 = load i64, i64* %100
%237 = trunc i64 %236 to i32
%238 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.27, i64 0, i64 0), i8* %32, i32 %237)
%239 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %240
240: ; preds = %235, %231
%241 = call i8* @read(i32 %226, i8* %31, i32 4096)
%242 = ptrtoint i8* %241 to i64
%243 = trunc i64 %242 to i32
%244 = icmp sgt i32 %243, 0
br i1 %244, label %245, label %252
245: ; preds = %240, %245
%246 = phi i32 [ %250, %245 ], [ %243, %240 ]
%247 = call i32 @write(i32 %107, i8* %31, i32 %246)
%248 = call i8* @read(i32 %226, i8* %31, i32 4096)
%249 = ptrtoint i8* %248 to i64
%250 = trunc i64 %249 to i32
%251 = icmp sgt i32 %250, 0
br i1 %251, label %245, label %252
252: ; preds = %245, %240
%253 = call i32 @close(i32 %226)
%254 = call i32 @close(i32 %107)
%255 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %89)
br label %292
256: ; preds = %120
%257 = call i32 (i8*, i8*, ...) @sscanf(i8* %20, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.12, i64 0, i64 0), i8* %32)
%258 = load i32, i32* @O_WRONLY
%259 = load i32, i32* @O_CREAT
%260 = or i32 %259, %258
%261 = call i32 (i8*, i32, ...) @open(i8* %32, i32 %260)
%262 = icmp slt i32 %261, 0
br i1 %262, label %263, label %266
263: ; preds = %256
%264 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @.str.28, i64 0, i64 0), i8* %32)
%265 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %292
266: ; preds = %256
%267 = load i8, i8* %18
%268 = icmp eq i8 %267, 73
br i1 %268, label %269, label %272
269: ; preds = %266
%270 = call i32 (i8*, i8*, ...) @sprintf(i8* %23, i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @.str.29, i64 0, i64 0), i8* %32)
%271 = call i32 @envia_mensagem(i8* %23, i32 %89)
br label %272
272: ; preds = %269, %266
%273 = call i8* @read(i32 %107, i8* %31, i32 4096)
%274 = ptrtoint i8* %273 to i64
%275 = trunc i64 %274 to i32
%276 = icmp sgt i32 %275, 0
br i1 %276, label %277, label %284
277: ; preds = %272, %277
%278 = phi i32 [ %282, %277 ], [ %275, %272 ]
%279 = call i32 @write(i32 %261, i8* %31, i32 %278)
%280 = call i8* @read(i32 %107, i8* %31, i32 4096)
%281 = ptrtoint i8* %280 to i64
%282 = trunc i64 %281 to i32
%283 = icmp sgt i32 %282, 0
br i1 %283, label %277, label %284
284: ; preds = %277, %272
%285 = call i32 @close(i32 %261)
%286 = call i32 @close(i32 %107)
%287 = call i32 @envia_mensagem(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.23, i64 0, i64 0), i32 %89)
br label %292
288: ; preds = %120
%289 = call i32 @envia_mensagem(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.30, i64 0, i64 0), i32 %89)
%290 = call i32 (...) @mensagem_exit()
%291 = call i32 @exit(i32 0)
unreachable
292: ; preds = %122, %126, %130, %180, %210, %216, %252, %228, %284, %263, %120
%293 = phi i32 [ %107, %120 ], [ %107, %263 ], [ %107, %284 ], [ %107, %228 ], [ %107, %252 ], [ %107, %216 ], [ %107, %210 ], [ %174, %180 ], [ %107, %130 ], [ %107, %126 ], [ %107, %122 ]
%294 = call i8* @read(i32 %89, i8* %20, i32 4096)
%295 = icmp eq i8* %294, null
br i1 %295, label %296, label %105
296: ; preds = %292, %92
%297 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.32, i64 0, i64 0))
%298 = call i32 (...) @mensagem_exit()
%299 = call i32 @exit(i32 0)
unreachable
300: ; preds = %88
%301 = call i32 @close(i32 %89)
%302 = call i32 @accept(i32 %46, %struct.sockaddr* null, i32* null)
%303 = icmp eq i32 %302, -1
br i1 %303, label %84, label %88
}