#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 TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ server;
typedef int /*<<< orphan*/ mensagem;
typedef int /*<<< orphan*/ i;
typedef int /*<<< orphan*/ buffer;
typedef int /*<<< orphan*/ FILE;
typedef int /*<<< orphan*/ DIR;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ bzero(char *, int);
scalar_t__ chdir(char *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ closedir(int /*<<< orphan*/ *);
scalar_t__ connect(int, struct sockaddr *, int);
int envia(int, ...);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ *fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ getcwd(char *, int);
int /*<<< orphan*/ htons(int /*<<< orphan*/);
int /*<<< orphan*/ inet_addr(char *);
int /*<<< orphan*/ loadbar(int, long, long, int);
int /*<<< orphan*/ *opendir(char *);
int /*<<< orphan*/ pclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *popen(char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int recebe(int, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *);
int /*<<< orphan*/ *stdin;
int /*<<< orphan*/ strcmp(char *, char *);
int /*<<< orphan*/ strlen(char *);
int main(int argc, char *argv[]) {
  char buffer[500];
  int i, sock, buff;
  long total, tamanho;
  FILE *dir;
  DIR *test;
  struct sockaddr_in server;
  char comando[10], mensagem[100];
  if (argc != 3) {
    printf("\n[FTP Client] Erro! Inicie o programa com argumentos: [ip] "
           "[porta].\n\n");
    exit(1);
  }
  sock = socket(AF_INET, SOCK_STREAM, 0);
  if (sock == -1) {
    printf("\n[FTP Client] Erro no Socket.\n\n");
    exit(1);
  }
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = inet_addr(argv[1]);
  server.sin_port = htons(atoi(argv[2]));
  if (connect(sock, (struct sockaddr *)&server, sizeof(server)) < 0) {
    printf("\n[FTP Client] Erro na conexao.\n\n");
    exit(1);
  }
  printf("\n[FTP Client] Conectado! IP: [%s] Porta: [%s]\n", argv[1], argv[2]);
  while (1) {
    printf("ftp> ");
    fgets(mensagem, 100, stdin);
    bzero(buffer, 500);
    sscanf(mensagem, "%s %[^\n]s", comando, buffer);
    if (!strcmp(comando, "get")) {
      i = 1;
      envia(sock, &i, sizeof(i));
      envia(sock, &buffer, sizeof(buffer));
      recebe(sock, &total, sizeof(long));
      if (total == -1) {
        printf("[get] Arquivo \"%s\" nao existe no servidor.\n", buffer);
      } else {
        printf("[get] Arquivo \"%s\" tem %ld bytes. Iniciando download...\n",
               buffer, total);
        if ((dir = fopen(buffer, "wb")) != NULL) {
          tamanho = 0;
          do {
            buff = recebe(sock, &buffer, sizeof(buffer));
            fwrite(buffer, buff, 1, dir);
            tamanho += buff;
            loadbar(50, tamanho, total, 0);
          } while (total > tamanho);
          pclose(dir);
          loadbar(0, 0, 0, 1);
          printf("[get] Download completo.\n");
        } else {
          printf("[get] Nao foi possivel criar o arquivo.\n");
        }
      }
    } else if (!strcmp(comando, "put")) {
      i = 2;
      if ((test = opendir(buffer)) != NULL) {
        closedir(test);
        printf("[put] Arquivo \"%s\" nao existe!\n", buffer);
      } else if ((dir = fopen(buffer, "rb")) != NULL) {
        envia(sock, &i, sizeof(i));
        envia(sock, &buffer, sizeof(buffer));
        recebe(sock, &i, sizeof(i));
        if (i == 2) {
          fseek(dir, 0, SEEK_END);
          total = ftell(dir);
          envia(sock, &total, sizeof(long));
          rewind(dir);
          printf("[put] Arquivo \"%s\" tem %ld bytes. Iniciando upload...\n",
                 buffer, total);
          tamanho = 0;
          do {
            buff = ((total - tamanho) < 450) ? (total - tamanho) : 450;
            fread(buffer, buff, 1, dir);
            buff = envia(sock, &buffer, buff);
            tamanho += buff;
            loadbar(50, tamanho, total, 0);
          } while (total > tamanho);
          loadbar(0, 0, 0, 1);
          printf("[put] Upload completo.\n");
        } else {
          printf("[put] Nao foi possivel criar o arquivo no servidor.\n");
        }
        pclose(dir);
      } else {
        printf("[put] Arquivo \"%s\" nao existe!\n", buffer);
      }
    } else if (!strcmp(comando, "ls")) {
      i = 3;
      envia(sock, &i, sizeof(i));
      envia(sock, &mensagem, sizeof(mensagem));
      printf("[ls]\n");
      recebe(sock, &buffer, sizeof(buffer));
      printf("%s", buffer);
    } else if (!strcmp(comando, "cd")) {
      i = 4;
      if (!strlen(buffer)) {
        printf("[cd] Argumentos invalidos.\n");
        continue;
      }
      envia(sock, &i, sizeof(i));
      envia(sock, &buffer, sizeof(buffer));
      recebe(sock, &buffer, sizeof(buffer));
      printf("[cd] %s\n", buffer);
    } else if (!strcmp(comando, "pwd")) {
      i = 5;
      envia(sock, &i, sizeof(i));
      recebe(sock, &buffer, sizeof(buffer));
      printf("[pwd] %s\n", buffer);
    } else if (!strcmp(comando, "!ls")) {
      printf("[!ls]\n");
      dir = popen(mensagem + 1, "r");
      while ((fgets(buffer, 500, dir)) != NULL) {
        printf("%s", buffer);
      }
      pclose(dir);
    } else if (!strcmp(comando, "!cd")) {
      if (chdir(buffer)) {
        printf("[!cd] Erro! Pasta nao encontrada.\n");
      } else {
        getcwd(buffer, 300);
        printf("[!cd] %s\n", buffer);
      }
    } else if (!strcmp(comando, "!pwd")) {
      getcwd(buffer, 450);
      printf("[!pwd] %s\n", buffer);
    } else if (!strcmp(comando, "quit")) {
      printf("[quit] Conexao fechada. Encerrando...\n\n");
      break;
    } else if (!strcmp(comando, "clear")) {
      printf("\33[H\33[2J");
    } else {
      printf("[ERRO] Comando ftp invalido.\n");
    }
  }
  close(sock);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x2d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     12fb <main+0x3b>
lea    0xd16(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    0x2cde(%rip),%rax
mov    (%rax),%edi
mov    0x2cbd(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11e0 <socket@plt>
mov    %eax,-0x218(%rbp)
cmpl   $0xffffffff,-0x218(%rbp)
jne    133f <main+0x7f>
lea    0xd18(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    0x2c9a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x248(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1120 <inet_addr@plt>
mov    %eax,-0x24c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   11a0 <atoi@plt>
mov    %eax,%edi
call   1090 <htons@plt>
mov    %eax,-0x250(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x250(%rbp),%rsi
mov    $0xc,%edx
call   11c0 <connect@plt>
cmp    $0x0,%rax
jge    13b4 <main+0xf4>
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
lea    0xcbc(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xcdd(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x2c0(%rbp),%rdi
mov    0x2bea(%rip),%rax
mov    (%rax),%rdx
mov    $0x64,%esi
call   1110 <fgets@plt>
lea    -0x210(%rbp),%rdi
mov    $0x1f4,%esi
call   1190 <bzero@plt>
lea    -0x2c0(%rbp),%rdi
lea    -0x25a(%rbp),%rdx
lea    -0x210(%rbp),%rcx
lea    0xc94(%rip),%rsi
call   1150 <sscanf@plt>
lea    -0x25a(%rbp),%rdi
lea    0xc8b(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    15db <main+0x31b>
movl   $0x1,-0x214(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x228(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
cmpq   $0xffffffffffffffff,-0x228(%rbp)
ff
jne    14c6 <main+0x206>
lea    -0x210(%rbp),%rsi
lea    0xc10(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    15d6 <main+0x316>
lea    -0x210(%rbp),%rsi
mov    -0x228(%rbp),%rdx
lea    0xc1b(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x210(%rbp),%rdi
lea    0xc3f(%rip),%rsi
call   1180 <fopen@plt>
mov    %rax,-0x238(%rbp)
cmp    $0x0,%rax
je     15c3 <main+0x303>
movq   $0x0,-0x230(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x21c(%rbp),%esi
mov    -0x238(%rbp),%rcx
mov    $0x1,%edx
call   11d0 <fwrite@plt>
movslq -0x21c(%rbp),%rax
add    -0x230(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x230(%rbp),%rsi
mov    -0x228(%rbp),%rdx
mov    $0x32,%edi
xor    %ecx,%ecx
call   1060 <loadbar@plt>
mov    -0x228(%rbp),%rax
cmp    -0x230(%rbp),%rax
jg     1511 <main+0x251>
mov    -0x238(%rbp),%rdi
call   10c0 <pclose@plt>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%ecx
mov    %rdx,%rsi
call   1060 <loadbar@plt>
lea    0xb7b(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    15d1 <main+0x311>
lea    0xb82(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    15d6 <main+0x316>
jmp    1c10 <main+0x950>
lea    -0x25a(%rbp),%rdi
lea    0xb8c(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    186d <main+0x5ad>
movl   $0x2,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
call   1050 <opendir@plt>
mov    %rax,-0x240(%rbp)
cmp    $0x0,%rax
je     1644 <main+0x384>
mov    -0x240(%rbp),%rdi
call   1100 <closedir@plt>
lea    -0x210(%rbp),%rsi
lea    0xb41(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1868 <main+0x5a8>
lea    -0x210(%rbp),%rdi
lea    0xb47(%rip),%rsi
call   1180 <fopen@plt>
mov    %rax,-0x238(%rbp)
cmp    $0x0,%rax
je     184e <main+0x58e>
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
cmpl   $0x2,-0x214(%rbp)
jne    182f <main+0x56f>
mov    -0x238(%rbp),%rdi
mov    0x291a(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1160 <fseek@plt>
mov    -0x238(%rbp),%rdi
call   1140 <ftell@plt>
mov    %rax,-0x228(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x228(%rbp),%rsi
mov    $0x8,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x238(%rbp),%rdi
call   10b0 <rewind@plt>
lea    -0x210(%rbp),%rsi
mov    -0x228(%rbp),%rdx
lea    0xa78(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
movq   $0x0,-0x230(%rbp)
mov    -0x228(%rbp),%rax
sub    -0x230(%rbp),%rax
cmp    $0x1c2,%rax
jge    176a <main+0x4aa>
mov    -0x228(%rbp),%rax
sub    -0x230(%rbp),%rax
mov    %rax,-0x2c8(%rbp)
jmp    177b <main+0x4bb>
mov    $0x1c2,%eax
mov    %rax,-0x2c8(%rbp)
jmp    177b <main+0x4bb>
mov    -0x2c8(%rbp),%rax
mov    %eax,-0x21c(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x21c(%rbp),%esi
mov    -0x238(%rbp),%rcx
mov    $0x1,%edx
call   1030 <fread@plt>
mov    -0x218(%rbp),%edi
mov    -0x21c(%rbp),%edx
lea    -0x210(%rbp),%rsi
mov    $0x0,%al
call   1040 <envia@plt>
mov    %eax,-0x21c(%rbp)
movslq -0x21c(%rbp),%rax
add    -0x230(%rbp),%rax
mov    %rax,-0x230(%rbp)
mov    -0x230(%rbp),%rsi
mov    -0x228(%rbp),%rdx
mov    $0x32,%edi
xor    %ecx,%ecx
call   1060 <loadbar@plt>
mov    -0x228(%rbp),%rax
cmp    -0x230(%rbp),%rax
jg     1736 <main+0x476>
xor    %edi,%edi
xor    %eax,%eax
mov    %eax,%edx
mov    $0x1,%ecx
mov    %rdx,%rsi
call   1060 <loadbar@plt>
lea    0x9b0(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    183d <main+0x57d>
lea    0x9b5(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x238(%rbp),%rdi
call   10c0 <pclose@plt>
jmp    1863 <main+0x5a3>
lea    -0x210(%rbp),%rsi
lea    0x91d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1868 <main+0x5a8>
jmp    1c0b <main+0x94b>
lea    -0x25a(%rbp),%rdi
lea    0x9de(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1906 <main+0x646>
movl   $0x3,-0x214(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x2c0(%rbp),%rsi
mov    $0x64,%edx
mov    $0x0,%al
call   1040 <envia@plt>
lea    0x954(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
lea    -0x210(%rbp),%rsi
lea    0x92c(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1c06 <main+0x946>
lea    -0x25a(%rbp),%rdi
lea    0x950(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    19b9 <main+0x6f9>
movl   $0x4,-0x214(%rbp)
lea    -0x210(%rbp),%rdi
call   1070 <strlen@plt>
cmp    $0x0,%eax
jne    1954 <main+0x694>
lea    0x8e1(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    13d2 <main+0x112>
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
lea    -0x210(%rbp),%rsi
lea    0x898(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1c01 <main+0x941>
lea    -0x25a(%rbp),%rdi
lea    0x8ce(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1a2b <main+0x76b>
movl   $0x5,-0x214(%rbp)
mov    -0x218(%rbp),%edi
lea    -0x214(%rbp),%rsi
mov    $0x4,%edx
mov    $0x0,%al
call   1040 <envia@plt>
mov    -0x218(%rbp),%edi
lea    -0x210(%rbp),%rsi
mov    $0x1f4,%edx
mov    $0x0,%al
call   10d0 <recebe@plt>
lea    -0x210(%rbp),%rsi
lea    0x82f(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1bfc <main+0x93c>
lea    -0x25a(%rbp),%rdi
lea    0x81f(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1ac0 <main+0x800>
lea    0x80e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x2c0(%rbp),%rdi
add    $0x1,%rdi
lea    0x86e(%rip),%rsi
call   1170 <popen@plt>
mov    %rax,-0x238(%rbp)
lea    -0x210(%rbp),%rdi
mov    -0x238(%rbp),%rdx
mov    $0x1f4,%esi
call   1110 <fgets@plt>
cmp    $0x0,%rax
je     1aaf <main+0x7ef>
lea    -0x210(%rbp),%rsi
lea    0x783(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1a73 <main+0x7b3>
mov    -0x238(%rbp),%rdi
call   10c0 <pclose@plt>
jmp    1bf7 <main+0x937>
lea    -0x25a(%rbp),%rdi
lea    0x795(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1b30 <main+0x870>
lea    -0x210(%rbp),%rdi
call   1080 <chdir@plt>
cmp    $0x0,%rax
je     1b05 <main+0x845>
lea    0x76e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1b2b <main+0x86b>
lea    -0x210(%rbp),%rdi
mov    $0x12c,%esi
call   10e0 <getcwd@plt>
lea    -0x210(%rbp),%rsi
lea    0x766(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1bf2 <main+0x932>
lea    -0x25a(%rbp),%rdi
lea    0x756(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1b77 <main+0x8b7>
lea    -0x210(%rbp),%rdi
mov    $0x1c2,%esi
call   10e0 <getcwd@plt>
lea    -0x210(%rbp),%rsi
lea    0x72e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1bed <main+0x92d>
lea    -0x25a(%rbp),%rdi
lea    0x71f(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1ba6 <main+0x8e6>
lea    0x70f(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1c15 <main+0x955>
lea    -0x25a(%rbp),%rdi
lea    0x71d(%rip),%rsi
call   1130 <strcmp@plt>
cmp    $0x0,%eax
jne    1bd5 <main+0x915>
lea    0x70e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1be3 <main+0x923>
lea    0x703(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1be8 <main+0x928>
jmp    1bed <main+0x92d>
jmp    1bf2 <main+0x932>
jmp    1bf7 <main+0x937>
jmp    1bfc <main+0x93c>
jmp    1c01 <main+0x941>
jmp    1c06 <main+0x946>
jmp    1c0b <main+0x94b>
jmp    1c10 <main+0x950>
jmp    13d2 <main+0x112>
mov    -0x218(%rbp),%edi
call   10f0 <close@plt>
xor    %eax,%eax
add    $0x2d0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x298,%rsp
cmp    $0x3,%edi
jne    195c <main+0x69c>
mov    %rsi,%rbx
mov    0x2cfc(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2cda(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11e0 <socket@plt>
cmp    $0xffffffff,%eax
je     1965 <main+0x6a5>
mov    %eax,%r13d
mov    0x0(%rbp),%eax
mov    %eax,0x28(%rsp)
mov    0x8(%rbx),%rdi
call   1130 <inet_addr@plt>
mov    %eax,0x24(%rsp)
mov    0x10(%rbx),%rdi
call   11a0 <atoi@plt>
mov    %eax,%edi
call   10a0 <htons@plt>
mov    %eax,0x20(%rsp)
lea    0x20(%rsp),%rsi
mov    %r13d,%edi
mov    $0xc,%edx
call   11c0 <connect@plt>
test   %rax,%rax
js     196e <main+0x6ae>
mov    0x8(%rbx),%rsi
mov    0x10(%rbx),%rdx
lea    0xcab(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0xccc(%rip),%r12
mov    0x2c6e(%rip),%rbx
lea    0x30(%rsp),%rbp
lea    0xa0(%rsp),%r14
lea    0xcb7(%rip),%r15
jmp    1391 <main+0xd1>
lea    0xcbc(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %r12,%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    (%rbx),%rdx
mov    %rbp,%rdi
mov    $0x64,%esi
call   1120 <fgets@plt>
mov    %r14,%rdi
mov    $0x1f4,%esi
call   1190 <bzero@plt>
mov    %rbp,%rdi
mov    %r15,%rsi
lea    0xe(%rsp),%rdx
mov    %r14,%rcx
call   1150 <sscanf@plt>
cmpl   $0x746567,0xe(%rsp)
je     14a0 <main+0x1e0>
cmpl   $0x747570,0xe(%rsp)
je     15a0 <main+0x2e0>
movzwl 0xe(%rsp),%eax
xor    $0x736c,%eax
movzbl 0x10(%rsp),%ecx
or     %ax,%cx
je     15cd <main+0x30d>
movzwl 0xe(%rsp),%eax
xor    $0x6463,%eax
movzbl 0x10(%rsp),%ecx
or     %ax,%cx
je     1625 <main+0x365>
cmpl   $0x647770,0xe(%rsp)
je     17e9 <main+0x529>
cmpl   $0x736c21,0xe(%rsp)
je     1823 <main+0x563>
cmpl   $0x646321,0xe(%rsp)
je     18d1 <main+0x611>
mov    0xe(%rsp),%eax
mov    $0x64777021,%ecx
xor    %ecx,%eax
movzbl 0x12(%rsp),%ecx
or     %eax,%ecx
je     18ef <main+0x62f>
mov    0xe(%rsp),%eax
mov    $0x74697571,%ecx
xor    %ecx,%eax
movzbl 0x12(%rsp),%ecx
or     %eax,%ecx
je     1934 <main+0x674>
mov    0xe(%rsp),%eax
mov    $0x61656c63,%ecx
xor    %ecx,%eax
movzwl 0x12(%rsp),%ecx
xor    $0x72,%ecx
or     %eax,%ecx
je     1908 <main+0x648>
lea    0xdbc(%rip),%rdi
call   1030 <puts@plt>
jmp    1391 <main+0xd1>
nopl   (%rax)
movl   $0x1,0x8(%rsp)
mov    $0x4,%edx
mov    %r13d,%edi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x8,%edx
mov    %r13d,%edi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
mov    0x18(%rsp),%rdx
cmp    $0xffffffffffffffff,%rdx
je     1380 <main+0xc0>
lea    0xb77(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %r14,%rdi
lea    0xb9c(%rip),%rsi
call   1180 <fopen@plt>
test   %rax,%rax
je     1681 <main+0x3c1>
mov    %rax,%r15
xor    %ebx,%ebx
nop
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
mov    %eax,%ebp
mov    %r14,%rdi
mov    %eax,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   11d0 <fwrite@plt>
movslq %ebp,%rax
add    %rax,%rbx
mov    0x18(%rsp),%rdx
mov    $0x32,%edi
mov    %rbx,%rsi
xor    %ecx,%ecx
call   1070 <loadbar@plt>
cmp    %rbx,0x18(%rsp)
jg     1520 <main+0x260>
mov    %r15,%rdi
call   10d0 <pclose@plt>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1070 <loadbar@plt>
lea    0xbf6(%rip),%rdi
call   1030 <puts@plt>
lea    0xa9d(%rip),%r12
mov    0x2a3f(%rip),%rbx
jmp    18c0 <main+0x600>
xchg   %ax,%ax
movl   $0x2,0x8(%rsp)
mov    %r14,%rdi
call   1060 <opendir@plt>
test   %rax,%rax
je     1692 <main+0x3d2>
mov    %rax,%rdi
call   1110 <closedir@plt>
lea    0xae7(%rip),%rdi
jmp    1387 <main+0xc7>
movl   $0x3,0x8(%rsp)
mov    $0x4,%edx
mov    %r13d,%edi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x64,%edx
mov    %r13d,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <envia@plt>
lea    0xbde(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
lea    0xae9(%rip),%rdi
jmp    1387 <main+0xc7>
movl   $0x4,0x8(%rsp)
mov    %r14,%rdi
call   1080 <strlen@plt>
test   %eax,%eax
je     189d <main+0x5dd>
mov    $0x4,%edx
mov    %r13d,%edi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
lea    0xa90(%rip),%rdi
jmp    1387 <main+0xc7>
lea    0xacc(%rip),%rdi
call   1030 <puts@plt>
jmp    18c0 <main+0x600>
mov    %r14,%rdi
lea    0xa33(%rip),%rsi
call   1180 <fopen@plt>
test   %rax,%rax
je     18ae <main+0x5ee>
mov    %rax,%r15
mov    $0x4,%edx
mov    %r13d,%edi
lea    0x8(%rsp),%rbp
mov    %rbp,%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x4,%edx
mov    %r13d,%edi
mov    %rbp,%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
cmpl   $0x2,0x8(%rsp)
lea    0xaa1(%rip),%rdi
jne    17d7 <main+0x517>
mov    0x28e7(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1160 <fseek@plt>
mov    %r15,%rdi
call   1140 <ftell@plt>
mov    %rax,0x18(%rsp)
mov    $0x8,%edx
mov    %r13d,%edi
lea    0x18(%rsp),%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    %r15,%rdi
call   10c0 <rewind@plt>
mov    0x18(%rsp),%rdx
lea    0x990(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    0x18(%rsp),%rbx
xor    %ebp,%ebp
mov    $0x1c2,%r12d
nopl   0x0(%rax)
sub    %rbp,%rbx
cmp    $0x1c2,%rbx
cmovge %r12d,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    $0x1,%edx
mov    %r15,%rcx
call   1040 <fread@plt>
mov    %r13d,%edi
mov    %r14,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1050 <envia@plt>
cltq
add    %rax,%rbp
mov    0x18(%rsp),%rdx
mov    $0x32,%edi
mov    %rbp,%rsi
xor    %ecx,%ecx
call   1070 <loadbar@plt>
mov    0x18(%rsp),%rbx
cmp    %rbp,%rbx
jg     1760 <main+0x4a0>
xor    %edi,%edi
xor    %esi,%esi
xor    %edx,%edx
mov    $0x1,%ecx
call   1070 <loadbar@plt>
lea    0xa00(%rip),%rdi
lea    0x85f(%rip),%r12
mov    0x2801(%rip),%rbx
call   1030 <puts@plt>
mov    %r15,%rdi
call   10d0 <pclose@plt>
jmp    18c0 <main+0x600>
movl   $0x5,0x8(%rsp)
mov    $0x4,%edx
mov    %r13d,%edi
lea    0x8(%rsp),%rsi
xor    %eax,%eax
call   1050 <envia@plt>
mov    $0x1f4,%edx
mov    %r13d,%edi
mov    %r14,%rsi
xor    %eax,%eax
call   10e0 <recebe@plt>
lea    0x8f7(%rip),%rdi
jmp    1387 <main+0xc7>
lea    0x9d6(%rip),%rdi
call   1030 <puts@plt>
lea    0x31(%rsp),%rdi
lea    0x90f(%rip),%rsi
call   1170 <popen@plt>
mov    %rax,%rbx
mov    %r14,%rdi
mov    $0x1f4,%esi
mov    %rax,%rdx
call   1120 <fgets@plt>
test   %rax,%rax
lea    0x8ac(%rip),%r12
je     1882 <main+0x5c2>
nop
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %r14,%rdi
mov    $0x1f4,%esi
mov    %rbx,%rdx
call   1120 <fgets@plt>
test   %rax,%rax
jne    1860 <main+0x5a0>
mov    %rbx,%rdi
call   10d0 <pclose@plt>
mov    0x2747(%rip),%rbx
lea    0x797(%rip),%r12
jmp    1391 <main+0xd1>
lea    0x941(%rip),%rdi
call   1030 <puts@plt>
jmp    1391 <main+0xd1>
lea    0x7fa(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
nop
lea    0x76e(%rip),%r15
lea    0x30(%rsp),%rbp
jmp    1391 <main+0xd1>
mov    %r14,%rdi
call   1090 <chdir@plt>
test   %rax,%rax
je     191b <main+0x65b>
lea    0x921(%rip),%rdi
call   1030 <puts@plt>
jmp    1391 <main+0xd1>
mov    %r14,%rdi
mov    $0x1c2,%esi
call   10f0 <getcwd@plt>
lea    0x833(%rip),%rdi
jmp    1387 <main+0xc7>
lea    0x83d(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
jmp    1391 <main+0xd1>
mov    %r14,%rdi
mov    $0x12c,%esi
call   10f0 <getcwd@plt>
lea    0x7f8(%rip),%rdi
jmp    1387 <main+0xc7>
lea    0x8ed(%rip),%rdi
call   1030 <puts@plt>
mov    %r13d,%edi
call   1100 <close@plt>
xor    %eax,%eax
add    $0x298,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x948(%rip),%rdi
jmp    1975 <main+0x6b5>
lea    0x920(%rip),%rdi
jmp    1975 <main+0x6b5>
lea    0x8f7(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   11b0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [70 x i8] c"\0A[FTP Client] Erro! Inicie o programa com argumentos: [ip] [porta].\0A\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [32 x i8] c"\0A[FTP Client] Erro no Socket.\0A\0A\00"
@.str.2 = [33 x i8] c"\0A[FTP Client] Erro na conexao.\0A\0A\00"
@.str.3 = [47 x i8] c"\0A[FTP Client] Conectado! IP: [%s] Porta: [%s]\0A\00"
@.str.4 = [6 x i8] c"ftp> \00"
@stdin = global i32* null
@.str.5 = [10 x i8] c"%s %[^\0A]s\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [44 x i8] c"[get] Arquivo \22%s\22 nao existe no servidor.\0A\00"
@.str.8 = [57 x i8] c"[get] Arquivo \22%s\22 tem %ld bytes. Iniciando download...\0A\00"
@.str.9 = [3 x i8] c"wb\00"
@.str.10 = [26 x i8] c"[get] Download completo.\0A\00"
@.str.11 = [41 x i8] c"[get] Nao foi possivel criar o arquivo.\0A\00"
@.str.12 = [4 x i8] c"put\00"
@.str.13 = [32 x i8] c"[put] Arquivo \22%s\22 nao existe!\0A\00"
@.str.14 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@.str.15 = [55 x i8] c"[put] Arquivo \22%s\22 tem %ld bytes. Iniciando upload...\0A\00"
@.str.16 = [24 x i8] c"[put] Upload completo.\0A\00"
@.str.17 = [53 x i8] c"[put] Nao foi possivel criar o arquivo no servidor.\0A\00"
@.str.18 = [3 x i8] c"ls\00"
@.str.19 = [6 x i8] c"[ls]\0A\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.21 = [3 x i8] c"cd\00"
@.str.22 = [28 x i8] c"[cd] Argumentos invalidos.\0A\00"
@.str.23 = [9 x i8] c"[cd] %s\0A\00"
@.str.24 = [4 x i8] c"pwd\00"
@.str.25 = [10 x i8] c"[pwd] %s\0A\00"
@.str.26 = [4 x i8] c"!ls\00"
@.str.27 = [7 x i8] c"[!ls]\0A\00"
@.str.28 = [2 x i8] c"r\00"
@.str.29 = [4 x i8] c"!cd\00"
@.str.30 = [35 x i8] c"[!cd] Erro! Pasta nao encontrada.\0A\00"
@.str.31 = [10 x i8] c"[!cd] %s\0A\00"
@.str.32 = [5 x i8] c"!pwd\00"
@.str.33 = [11 x i8] c"[!pwd] %s\0A\00"
@.str.34 = [5 x i8] c"quit\00"
@.str.35 = [40 x i8] c"[quit] Conexao fechada. Encerrando...\0A\0A\00"
@.str.36 = [6 x i8] c"clear\00"
@.str.37 = [8 x i8] c"\1B[H\1B[2J\00"
@.str.38 = [30 x i8] c"[ERRO] Comando ftp invalido.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [500 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i64
%11 = alloca i64
%12 = alloca i32*
%13 = alloca i32*
%14 = alloca %struct.sockaddr_in
%15 = alloca [10 x i8]
%16 = alloca [100 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%17 = load i32, i32* %4
%18 = icmp ne i32 %17, 3
br i1 %18, label %19, label %22
19: ; preds = %2
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
%21 = call i32 @exit(i32 1)
unreachable
22: ; preds = %2
%23 = load i32, i32* @AF_INET
%24 = load i32, i32* @SOCK_STREAM
%25 = call i32 @socket(i32 %23, i32 %24, i32 0)
store i32 %25, i32* %8
%26 = load i32, i32* %8
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %22
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %22
%32 = load i32, i32* @AF_INET
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 2
store i32 %32, i32* %33
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = call i32 @inet_addr(i8* %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 1
%39 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %38, i32 0, i32 0
store i32 %37, i32* %39
%40 = load i8**, i8*** %5
%41 = getelementptr inbounds i8*, i8** %40, i64 2
%42 = load i8*, i8** %41
%43 = call i32 @atoi(i8* %42)
%44 = call i32 @htons(i32 %43)
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %14, i32 0, i32 0
store i32 %44, i32* %45
%46 = load i32, i32* %8
%47 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%48 = call i64 @connect(i32 %46, %struct.sockaddr* %47, i32 12)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %31
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %31
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 1
%56 = load i8*, i8** %55
%57 = load i8**, i8*** %5
%58 = getelementptr inbounds i8*, i8** %57, i64 2
%59 = load i8*, i8** %58
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %56, i8* %59)
br label %61
61: ; preds = %53, %227, %317
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%63 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 0
%64 = load i32*, i32** @stdin
%65 = call i32* @fgets(i8* %63, i32 100, i32* %64)
%66 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%67 = call i32 @bzero(i8* %66, i32 500)
%68 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 0
%69 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%70 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%71 = call i32 @sscanf(i8* %68, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %69, i8* %70)
%72 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%73 = call i32 @strcmp(i8* %72, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0))
%74 = icmp ne i32 %73, 0
br i1 %74, label %122, label %75
75: ; preds = %61
store i32 1, i32* %7
%76 = load i32, i32* %8
%77 = call i32 (i32, ...) @envia(i32 %76, i32* %7, i64 4)
%78 = load i32, i32* %8
%79 = call i32 (i32, ...) @envia(i32 %78, [500 x i8]* %6, i64 500)
%80 = load i32, i32* %8
%81 = call i32 (i32, ...) @recebe(i32 %80, i64* %10, i64 8)
%82 = load i64, i64* %10
%83 = icmp eq i64 %82, -1
br i1 %83, label %84, label %87
84: ; preds = %75
%85 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %85)
br label %121
87: ; preds = %75
%88 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%89 = load i64, i64* %10
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* %88, i64 %89)
%91 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%92 = call i32* @fopen(i8* %91, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
store i32* %92, i32** %12
%93 = icmp ne i32* %92, null
br i1 %93, label %94, label %118
94: ; preds = %87
store i64 0, i64* %11
br label %95
95: ; preds = %109, %94
%96 = load i32, i32* %8
%97 = call i32 (i32, ...) @recebe(i32 %96, [500 x i8]* %6, i64 500)
store i32 %97, i32* %9
%98 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%99 = load i32, i32* %9
%100 = load i32*, i32** %12
%101 = call i32 @fwrite(i8* %98, i32 %99, i32 1, i32* %100)
%102 = load i32, i32* %9
%103 = sext i32 %102 to i64
%104 = load i64, i64* %11
%105 = add nsw i64 %104, %103
store i64 %105, i64* %11
%106 = load i64, i64* %11
%107 = load i64, i64* %10
%108 = call i32 @loadbar(i32 50, i64 %106, i64 %107, i32 0)
br label %109
109: ; preds = %95
%110 = load i64, i64* %10
%111 = load i64, i64* %11
%112 = icmp sgt i64 %110, %111
br i1 %112, label %95, label %113
113: ; preds = %109
%114 = load i32*, i32** %12
%115 = call i32 @pclose(i32* %114)
%116 = call i32 @loadbar(i32 0, i64 0, i64 0, i32 1)
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.10, i64 0, i64 0))
br label %120
118: ; preds = %87
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.11, i64 0, i64 0))
br label %120
120: ; preds = %118, %113
br label %121
121: ; preds = %120, %84
br label %317
122: ; preds = %61
%123 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%124 = call i32 @strcmp(i8* %123, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0))
%125 = icmp ne i32 %124, 0
br i1 %125, label %205, label %126
126: ; preds = %122
store i32 2, i32* %7
%127 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%128 = call i32* @opendir(i8* %127)
store i32* %128, i32** %13
%129 = icmp ne i32* %128, null
br i1 %129, label %130, label %135
130: ; preds = %126
%131 = load i32*, i32** %13
%132 = call i32 @closedir(i32* %131)
%133 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %133)
br label %204
135: ; preds = %126
%136 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%137 = call i32* @fopen(i8* %136, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
store i32* %137, i32** %12
%138 = icmp ne i32* %137, null
br i1 %138, label %139, label %200
139: ; preds = %135
%140 = load i32, i32* %8
%141 = call i32 (i32, ...) @envia(i32 %140, i32* %7, i64 4)
%142 = load i32, i32* %8
%143 = call i32 (i32, ...) @envia(i32 %142, [500 x i8]* %6, i64 500)
%144 = load i32, i32* %8
%145 = call i32 (i32, ...) @recebe(i32 %144, i32* %7, i64 4)
%146 = load i32, i32* %7
%147 = icmp eq i32 %146, 2
br i1 %147, label %148, label %195
148: ; preds = %139
%149 = load i32*, i32** %12
%150 = load i32, i32* @SEEK_END
%151 = call i32 @fseek(i32* %149, i32 0, i32 %150)
%152 = load i32*, i32** %12
%153 = call i64 @ftell(i32* %152)
store i64 %153, i64* %10
%154 = load i32, i32* %8
%155 = call i32 (i32, ...) @envia(i32 %154, i64* %10, i64 8)
%156 = load i32*, i32** %12
%157 = call i32 @rewind(i32* %156)
%158 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%159 = load i64, i64* %10
%160 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.15, i64 0, i64 0), i8* %158, i64 %159)
store i64 0, i64* %11
br label %161
161: ; preds = %188, %148
%162 = load i64, i64* %10
%163 = load i64, i64* %11
%164 = sub nsw i64 %162, %163
%165 = icmp slt i64 %164, 450
br i1 %165, label %166, label %170
166: ; preds = %161
%167 = load i64, i64* %10
%168 = load i64, i64* %11
%169 = sub nsw i64 %167, %168
br label %171
170: ; preds = %161
br label %171
171: ; preds = %170, %166
%172 = phi i64 [ %169, %166 ], [ 450, %170 ]
%173 = trunc i64 %172 to i32
store i32 %173, i32* %9
%174 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%175 = load i32, i32* %9
%176 = load i32*, i32** %12
%177 = call i32 @fread(i8* %174, i32 %175, i32 1, i32* %176)
%178 = load i32, i32* %8
%179 = load i32, i32* %9
%180 = call i32 (i32, ...) @envia(i32 %178, [500 x i8]* %6, i32 %179)
store i32 %180, i32* %9
%181 = load i32, i32* %9
%182 = sext i32 %181 to i64
%183 = load i64, i64* %11
%184 = add nsw i64 %183, %182
store i64 %184, i64* %11
%185 = load i64, i64* %11
%186 = load i64, i64* %10
%187 = call i32 @loadbar(i32 50, i64 %185, i64 %186, i32 0)
br label %188
188: ; preds = %171
%189 = load i64, i64* %10
%190 = load i64, i64* %11
%191 = icmp sgt i64 %189, %190
br i1 %191, label %161, label %192
192: ; preds = %188
%193 = call i32 @loadbar(i32 0, i64 0, i64 0, i32 1)
%194 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.16, i64 0, i64 0))
br label %197
195: ; preds = %139
%196 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.17, i64 0, i64 0))
br label %197
197: ; preds = %195, %192
%198 = load i32*, i32** %12
%199 = call i32 @pclose(i32* %198)
br label %203
200: ; preds = %135
%201 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %201)
br label %203
203: ; preds = %200, %197
br label %204
204: ; preds = %203, %130
br label %316
205: ; preds = %122
%206 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%207 = call i32 @strcmp(i8* %206, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0))
%208 = icmp ne i32 %207, 0
br i1 %208, label %219, label %209
209: ; preds = %205
store i32 3, i32* %7
%210 = load i32, i32* %8
%211 = call i32 (i32, ...) @envia(i32 %210, i32* %7, i64 4)
%212 = load i32, i32* %8
%213 = call i32 (i32, ...) @envia(i32 %212, [100 x i8]* %16, i64 100)
%214 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.19, i64 0, i64 0))
%215 = load i32, i32* %8
%216 = call i32 (i32, ...) @recebe(i32 %215, [500 x i8]* %6, i64 500)
%217 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%218 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %217)
br label %315
219: ; preds = %205
%220 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%221 = call i32 @strcmp(i8* %220, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0))
%222 = icmp ne i32 %221, 0
br i1 %222, label %238, label %223
223: ; preds = %219
store i32 4, i32* %7
%224 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%225 = call i32 @strlen(i8* %224)
%226 = icmp ne i32 %225, 0
br i1 %226, label %229, label %227
227: ; preds = %223
%228 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.22, i64 0, i64 0))
br label %61
229: ; preds = %223
%230 = load i32, i32* %8
%231 = call i32 (i32, ...) @envia(i32 %230, i32* %7, i64 4)
%232 = load i32, i32* %8
%233 = call i32 (i32, ...) @envia(i32 %232, [500 x i8]* %6, i64 500)
%234 = load i32, i32* %8
%235 = call i32 (i32, ...) @recebe(i32 %234, [500 x i8]* %6, i64 500)
%236 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%237 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i64 0, i64 0), i8* %236)
br label %314
238: ; preds = %219
%239 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%240 = call i32 @strcmp(i8* %239, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i64 0, i64 0))
%241 = icmp ne i32 %240, 0
br i1 %241, label %249, label %242
242: ; preds = %238
store i32 5, i32* %7
%243 = load i32, i32* %8
%244 = call i32 (i32, ...) @envia(i32 %243, i32* %7, i64 4)
%245 = load i32, i32* %8
%246 = call i32 (i32, ...) @recebe(i32 %245, [500 x i8]* %6, i64 500)
%247 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%248 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0), i8* %247)
br label %313
249: ; preds = %238
%250 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%251 = call i32 @strcmp(i8* %250, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0))
%252 = icmp ne i32 %251, 0
br i1 %252, label %269, label %253
253: ; preds = %249
%254 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.27, i64 0, i64 0))
%255 = getelementptr inbounds [100 x i8], [100 x i8]* %16, i64 0, i64 0
%256 = getelementptr inbounds i8, i8* %255, i64 1
%257 = call i32* @popen(i8* %256, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
store i32* %257, i32** %12
br label %258
258: ; preds = %263, %253
%259 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%260 = load i32*, i32** %12
%261 = call i32* @fgets(i8* %259, i32 500, i32* %260)
%262 = icmp ne i32* %261, null
br i1 %262, label %263, label %266
263: ; preds = %258
%264 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%265 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %264)
br label %258
266: ; preds = %258
%267 = load i32*, i32** %12
%268 = call i32 @pclose(i32* %267)
br label %312
269: ; preds = %249
%270 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%271 = call i32 @strcmp(i8* %270, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0))
%272 = icmp ne i32 %271, 0
br i1 %272, label %285, label %273
273: ; preds = %269
%274 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%275 = call i64 @chdir(i8* %274)
%276 = icmp ne i64 %275, 0
br i1 %276, label %277, label %279
277: ; preds = %273
%278 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.30, i64 0, i64 0))
br label %284
279: ; preds = %273
%280 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%281 = call i32 @getcwd(i8* %280, i32 300)
%282 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%283 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.31, i64 0, i64 0), i8* %282)
br label %284
284: ; preds = %279, %277
br label %311
285: ; preds = %269
%286 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%287 = call i32 @strcmp(i8* %286, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0))
%288 = icmp ne i32 %287, 0
br i1 %288, label %294, label %289
289: ; preds = %285
%290 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%291 = call i32 @getcwd(i8* %290, i32 450)
%292 = getelementptr inbounds [500 x i8], [500 x i8]* %6, i64 0, i64 0
%293 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.33, i64 0, i64 0), i8* %292)
br label %310
294: ; preds = %285
%295 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%296 = call i32 @strcmp(i8* %295, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i64 0, i64 0))
%297 = icmp ne i32 %296, 0
br i1 %297, label %300, label %298
298: ; preds = %294
%299 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.35, i64 0, i64 0))
br label %318
300: ; preds = %294
%301 = getelementptr inbounds [10 x i8], [10 x i8]* %15, i64 0, i64 0
%302 = call i32 @strcmp(i8* %301, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.36, i64 0, i64 0))
%303 = icmp ne i32 %302, 0
br i1 %303, label %306, label %304
304: ; preds = %300
%305 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i64 0, i64 0))
br label %308
306: ; preds = %300
%307 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.38, i64 0, i64 0))
br label %308
308: ; preds = %306, %304
br label %309
309: ; preds = %308
br label %310
310: ; preds = %309, %289
br label %311
311: ; preds = %310, %284
br label %312
312: ; preds = %311, %266
br label %313
313: ; preds = %312, %242
br label %314
314: ; preds = %313, %229
br label %315
315: ; preds = %314, %209
br label %316
316: ; preds = %315, %204
br label %317
317: ; preds = %316, %121
br label %61
318: ; preds = %298
%319 = load i32, i32* %8
%320 = call i32 @close(i32 %319)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.3 = [47 x i8] c"\0A[FTP Client] Conectado! IP: [%s] Porta: [%s]\0A\00"
@.str.4 = [6 x i8] c"ftp> \00"
@stdin = global i32* null
@.str.5 = [10 x i8] c"%s %[^\0A]s\00"
@.str.6 = [4 x i8] c"get\00"
@.str.7 = [44 x i8] c"[get] Arquivo \22%s\22 nao existe no servidor.\0A\00"
@.str.8 = [57 x i8] c"[get] Arquivo \22%s\22 tem %ld bytes. Iniciando download...\0A\00"
@.str.9 = [3 x i8] c"wb\00"
@.str.12 = [4 x i8] c"put\00"
@.str.13 = [32 x i8] c"[put] Arquivo \22%s\22 nao existe!\0A\00"
@.str.14 = [3 x i8] c"rb\00"
@SEEK_END = global i32 0
@.str.15 = [55 x i8] c"[put] Arquivo \22%s\22 tem %ld bytes. Iniciando upload...\0A\00"
@.str.18 = [3 x i8] c"ls\00"
@.str.20 = [3 x i8] c"%s\00"
@.str.21 = [3 x i8] c"cd\00"
@.str.23 = [9 x i8] c"[cd] %s\0A\00"
@.str.24 = [4 x i8] c"pwd\00"
@.str.25 = [10 x i8] c"[pwd] %s\0A\00"
@.str.26 = [4 x i8] c"!ls\00"
@.str.28 = [2 x i8] c"r\00"
@.str.29 = [4 x i8] c"!cd\00"
@.str.31 = [10 x i8] c"[!cd] %s\0A\00"
@.str.32 = [5 x i8] c"!pwd\00"
@.str.33 = [11 x i8] c"[!pwd] %s\0A\00"
@.str.34 = [5 x i8] c"quit\00"
@.str.36 = [6 x i8] c"clear\00"
@.str.37 = [8 x i8] c"\1B[H\1B[2J\00"
@str = [40 x i8] c"[get] Nao foi possivel criar o arquivo.\00"
@str.39 = [25 x i8] c"[get] Download completo.\00"
@str.40 = [52 x i8] c"[put] Nao foi possivel criar o arquivo no servidor.\00"
@str.41 = [23 x i8] c"[put] Upload completo.\00"
@str.42 = [5 x i8] c"[ls]\00"
@str.43 = [27 x i8] c"[cd] Argumentos invalidos.\00"
@str.44 = [6 x i8] c"[!ls]\00"
@str.45 = [34 x i8] c"[!cd] Erro! Pasta nao encontrada.\00"
@str.46 = [39 x i8] c"[quit] Conexao fechada. Encerrando...\0A\00"
@str.47 = [29 x i8] c"[ERRO] Comando ftp invalido.\00"
@str.48 = [32 x i8] c"\0A[FTP Client] Erro na conexao.\0A\00"
@str.49 = [31 x i8] c"\0A[FTP Client] Erro no Socket.\0A\00"
@str.50 = [69 x i8] c"\0A[FTP Client] Erro! Inicie o programa com argumentos: [ip] [porta].\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [500 x i8]
%4 = alloca i32
%5 = alloca i64
%6 = alloca %struct.sockaddr_in
%7 = alloca [10 x i8]
%8 = alloca [100 x i8]
%9 = getelementptr inbounds [500 x i8], [500 x i8]* %3, i64 0, i64 0
%10 = bitcast i32* %4 to i8*
%11 = bitcast i64* %5 to i8*
%12 = bitcast %struct.sockaddr_in* %6 to i8*
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%14 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 0
%15 = icmp eq i32 %0, 3
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str.50, i64 0, i64 0))
%18 = tail call i32 @exit(i32 1)
unreachable
19: ; preds = %2
%20 = load i32, i32* @AF_INET
%21 = load i32, i32* @SOCK_STREAM
%22 = tail call i32 @socket(i32 %20, i32 %21, i32 0)
%23 = icmp eq i32 %22, -1
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.49, i64 0, i64 0))
%26 = tail call i32 @exit(i32 1)
unreachable
27: ; preds = %19
%28 = load i32, i32* @AF_INET
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i32 %28, i32* %29
%30 = getelementptr inbounds i8*, i8** %1, i64 1
%31 = load i8*, i8** %30
%32 = tail call i32 @inet_addr(i8* %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1, i32 0
store i32 %32, i32* %33
%34 = getelementptr inbounds i8*, i8** %1, i64 2
%35 = load i8*, i8** %34
%36 = tail call i32 @atoi(i8* %35)
%37 = tail call i32 @htons(i32 %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
store i32 %37, i32* %38
%39 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%40 = call i64 @connect(i32 %22, %struct.sockaddr* %39, i32 12)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %27
%43 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str.48, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %27
%46 = load i8*, i8** %30
%47 = load i8*, i8** %34
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.3, i64 0, i64 0), i8* %46, i8* %47)
%49 = getelementptr inbounds [100 x i8], [100 x i8]* %8, i64 0, i64 1
br label %50
50: ; preds = %84, %45
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0))
%52 = load i32*, i32** @stdin
%53 = call i32* @fgets(i8* %14, i32 100, i32* %52)
%54 = call i32 @bzero(i8* %9, i32 500)
%55 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %13, i8* %9)
%56 = call i32 @bcmp(i8* dereferenceable(4) %13, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.6, i64 0, i64 0), i64 4)
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %87
58: ; preds = %50
store i32 1, i32* %4
%59 = call i32 (i32, ...) @envia(i32 %22, i32* %4, i64 4)
%60 = call i32 (i32, ...) @envia(i32 %22, [500 x i8]* %3, i64 500)
%61 = call i32 (i32, ...) @recebe(i32 %22, i64* %5, i64 8)
%62 = load i64, i64* %5
%63 = icmp eq i64 %62, -1
br i1 %63, label %64, label %66
64: ; preds = %58
%65 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8* %9)
br label %84
66: ; preds = %58
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([57 x i8], [57 x i8]* @.str.8, i64 0, i64 0), i8* %9, i64 %62)
%68 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.9, i64 0, i64 0))
%69 = icmp eq i32* %68, null
br i1 %69, label %85, label %70
70: ; preds = %66, %70
%71 = phi i64 [ %75, %70 ], [ 0, %66 ]
%72 = call i32 (i32, ...) @recebe(i32 %22, [500 x i8]* %3, i64 500)
%73 = call i32 @fwrite(i8* %9, i32 %72, i32 1, i32* %68)
%74 = sext i32 %72 to i64
%75 = add nsw i64 %71, %74
%76 = load i64, i64* %5
%77 = call i32 @loadbar(i32 50, i64 %75, i64 %76, i32 0)
%78 = load i64, i64* %5
%79 = icmp sgt i64 %78, %75
br i1 %79, label %70, label %80
80: ; preds = %70
%81 = call i32 @pclose(i32* %68)
%82 = call i32 @loadbar(i32 0, i64 0, i64 0, i32 1)
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.39, i64 0, i64 0))
br label %84
84: ; preds = %80, %85, %64, %140, %162, %188, %186, %208, %206, %194, %178, %154, %93, %135, %131, %152
br label %50
85: ; preds = %66
%86 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
br label %84
87: ; preds = %50
%88 = call i32 @bcmp(i8* dereferenceable(4) %13, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.12, i64 0, i64 0), i64 4)
%89 = icmp eq i32 %88, 0
br i1 %89, label %90, label %137
90: ; preds = %87
store i32 2, i32* %4
%91 = call i32* @opendir(i8* %9)
%92 = icmp eq i32* %91, null
br i1 %92, label %96, label %93
93: ; preds = %90
%94 = call i32 @closedir(i32* %91)
%95 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %9)
br label %84
96: ; preds = %90
%97 = call i32* @fopen(i8* %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.14, i64 0, i64 0))
%98 = icmp eq i32* %97, null
br i1 %98, label %135, label %99
99: ; preds = %96
%100 = call i32 (i32, ...) @envia(i32 %22, i32* %4, i64 4)
%101 = call i32 (i32, ...) @envia(i32 %22, [500 x i8]* %3, i64 500)
%102 = call i32 (i32, ...) @recebe(i32 %22, i32* %4, i64 4)
%103 = load i32, i32* %4
%104 = icmp eq i32 %103, 2
br i1 %104, label %105, label %131
105: ; preds = %99
%106 = load i32, i32* @SEEK_END
%107 = call i32 @fseek(i32* %97, i32 0, i32 %106)
%108 = call i64 @ftell(i32* %97)
store i64 %108, i64* %5
%109 = call i32 (i32, ...) @envia(i32 %22, i64* %5, i64 8)
%110 = call i32 @rewind(i32* %97)
%111 = load i64, i64* %5
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.15, i64 0, i64 0), i8* %9, i64 %111)
%113 = load i64, i64* %5
br label %114
114: ; preds = %114, %105
%115 = phi i64 [ %113, %105 ], [ %127, %114 ]
%116 = phi i64 [ 0, %105 ], [ %124, %114 ]
%117 = sub nsw i64 %115, %116
%118 = icmp slt i64 %117, 450
%119 = select i1 %118, i64 %117, i64 450
%120 = trunc i64 %119 to i32
%121 = call i32 @fread(i8* %9, i32 %120, i32 1, i32* %97)
%122 = call i32 (i32, ...) @envia(i32 %22, [500 x i8]* %3, i32 %120)
%123 = sext i32 %122 to i64
%124 = add nsw i64 %116, %123
%125 = load i64, i64* %5
%126 = call i32 @loadbar(i32 50, i64 %124, i64 %125, i32 0)
%127 = load i64, i64* %5
%128 = icmp sgt i64 %127, %124
br i1 %128, label %114, label %129
129: ; preds = %114
%130 = call i32 @loadbar(i32 0, i64 0, i64 0, i32 1)
br label %131
131: ; preds = %99, %129
%132 = phi i8* [ getelementptr inbounds ([23 x i8], [23 x i8]* @str.41, i64 0, i64 0), %129 ], [ getelementptr inbounds ([52 x i8], [52 x i8]* @str.40, i64 0, i64 0), %99 ]
%133 = call i32 @puts(i8* dereferenceable(1) %132)
%134 = call i32 @pclose(i32* %97)
br label %84
135: ; preds = %96
%136 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0), i8* %9)
br label %84
137: ; preds = %87
%138 = call i32 @bcmp(i8* dereferenceable(3) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.18, i64 0, i64 0), i64 3)
%139 = icmp eq i32 %138, 0
br i1 %139, label %140, label %146
140: ; preds = %137
store i32 3, i32* %4
%141 = call i32 (i32, ...) @envia(i32 %22, i32* %4, i64 4)
%142 = call i32 (i32, ...) @envia(i32 %22, [100 x i8]* %8, i64 100)
%143 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @str.42, i64 0, i64 0))
%144 = call i32 (i32, ...) @recebe(i32 %22, [500 x i8]* %3, i64 500)
%145 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %9)
br label %84
146: ; preds = %137
%147 = call i32 @bcmp(i8* dereferenceable(3) %13, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.21, i64 0, i64 0), i64 3)
%148 = icmp eq i32 %147, 0
br i1 %148, label %149, label %159
149: ; preds = %146
store i32 4, i32* %4
%150 = call i32 @strlen(i8* %9)
%151 = icmp eq i32 %150, 0
br i1 %151, label %152, label %154
152: ; preds = %149
%153 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.43, i64 0, i64 0))
br label %84
154: ; preds = %149
%155 = call i32 (i32, ...) @envia(i32 %22, i32* %4, i64 4)
%156 = call i32 (i32, ...) @envia(i32 %22, [500 x i8]* %3, i64 500)
%157 = call i32 (i32, ...) @recebe(i32 %22, [500 x i8]* %3, i64 500)
%158 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.23, i64 0, i64 0), i8* %9)
br label %84
159: ; preds = %146
%160 = call i32 @bcmp(i8* dereferenceable(4) %13, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.24, i64 0, i64 0), i64 4)
%161 = icmp eq i32 %160, 0
br i1 %161, label %162, label %166
162: ; preds = %159
store i32 5, i32* %4
%163 = call i32 (i32, ...) @envia(i32 %22, i32* %4, i64 4)
%164 = call i32 (i32, ...) @recebe(i32 %22, [500 x i8]* %3, i64 500)
%165 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.25, i64 0, i64 0), i8* %9)
br label %84
166: ; preds = %159
%167 = call i32 @bcmp(i8* dereferenceable(4) %13, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.26, i64 0, i64 0), i64 4)
%168 = icmp eq i32 %167, 0
br i1 %168, label %169, label %180
169: ; preds = %166
%170 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.44, i64 0, i64 0))
%171 = call i32* @popen(i8* %49, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.28, i64 0, i64 0))
%172 = call i32* @fgets(i8* %9, i32 500, i32* %171)
%173 = icmp eq i32* %172, null
br i1 %173, label %178, label %174
174: ; preds = %169, %174
%175 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.20, i64 0, i64 0), i8* %9)
%176 = call i32* @fgets(i8* %9, i32 500, i32* %171)
%177 = icmp eq i32* %176, null
br i1 %177, label %178, label %174
178: ; preds = %174, %169
%179 = call i32 @pclose(i32* %171)
br label %84
180: ; preds = %166
%181 = call i32 @bcmp(i8* dereferenceable(4) %13, i8* dereferenceable(4) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.29, i64 0, i64 0), i64 4)
%182 = icmp eq i32 %181, 0
br i1 %182, label %183, label %191
183: ; preds = %180
%184 = call i64 @chdir(i8* %9)
%185 = icmp eq i64 %184, 0
br i1 %185, label %188, label %186
186: ; preds = %183
%187 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.45, i64 0, i64 0))
br label %84
188: ; preds = %183
%189 = call i32 @getcwd(i8* %9, i32 300)
%190 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.31, i64 0, i64 0), i8* %9)
br label %84
191: ; preds = %180
%192 = call i32 @bcmp(i8* dereferenceable(5) %13, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.32, i64 0, i64 0), i64 5)
%193 = icmp eq i32 %192, 0
br i1 %193, label %194, label %197
194: ; preds = %191
%195 = call i32 @getcwd(i8* %9, i32 450)
%196 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.33, i64 0, i64 0), i8* %9)
br label %84
197: ; preds = %191
%198 = call i32 @bcmp(i8* dereferenceable(5) %13, i8* dereferenceable(5) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.34, i64 0, i64 0), i64 5)
%199 = icmp eq i32 %198, 0
br i1 %199, label %200, label %203
200: ; preds = %197
%201 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.46, i64 0, i64 0))
%202 = call i32 @close(i32 %22)
ret i32 0
203: ; preds = %197
%204 = call i32 @bcmp(i8* dereferenceable(6) %13, i8* dereferenceable(6) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.36, i64 0, i64 0), i64 6)
%205 = icmp eq i32 %204, 0
br i1 %205, label %206, label %208
206: ; preds = %203
%207 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @.str.37, i64 0, i64 0))
br label %84
208: ; preds = %203
%209 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.47, i64 0, i64 0))
br label %84
}