#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SEEK_END;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
long fread(char *, int, long, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
long ftell(int /*<<< orphan*/ *);
int getopt(int, char **, char *);
int /*<<< orphan*/ htons(int);
scalar_t__ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
scalar_t__ malloc(int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
char *optarg;
int /*<<< orphan*/ printf(char *);
int recv(int, ...);
int /*<<< orphan*/ rewind(int /*<<< orphan*/ *);
long send(int, ...);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ *stderr;
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int sockfd = 0, n = 0, clave, option = 0, port, intentos = 0;
  char recvBuff[1024];
  char sendBuff[1024];
  FILE *file;
  char *buffer, *ddespl, *ip;
  long size;
  struct sockaddr_in serv_addr;
  if (argc != 11) {
    fprintf(stderr, "Uso: scdax_cli -i <dir_ip> -p <puerto_scdax_svr> -c "
                    "<clave> -a <dir_despl> -f <arch_input>\n");
    exit(1);
  }
  while ((option = getopt(argc, argv, "i:p:c:a:f:")) != -1) {
    switch (option) {
    case 'i':
      ip = optarg;
      break;
    case 'p':
      port = atoi(optarg);
      break;
    case 'c':
      clave = atoi(optarg);
      break;
    case 'a':
      ddespl = optarg;
      break;
    case 'f':
      file = fopen(optarg, "r");
      break;
    default:
      fprintf(stderr, "Uso: scdax_cli -i <dir_ip> -p <puerto_scdax_svr> -c "
                      "<clave> -a <dir_despl> -f <arch_input>\n");
      exit(0);
    }
  }
  if (strcmp(ddespl, "derecha") == 0) {
    clave = -clave;
  } else if (strcmp(ddespl, "izquierda") == 0) {
  } else {
    fprintf(stderr,
            "La direccion de desplazamiento debe ser derecha o izquierda\n");
    exit(0);
  }
  fseek(file, 0, SEEK_END);
  size = ftell(file);
  rewind(file);
  buffer = (char *)malloc(sizeof(char) * size);
  if (fread(buffer, 1, size, file) != size) {
    fprintf(stderr, "\nError: leyendo archivo\n");
    exit(1);
  }
  fclose(file);
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    fprintf(stderr, "\nError: No pude crear socket\n");
    exit(1);
  }
  memset(&serv_addr, '0', sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons(port);
  if (inet_pton(AF_INET, ip, &serv_addr.sin_addr) <= 0) {
    fprintf(stderr, "\nError: inet");
    exit(1);
  }
  while (connect(sockfd, (struct sockaddr *)&serv_addr, sizeof(serv_addr)) <
         0) {
    intentos++;
    if (intentos == 3) {
      fprintf(stderr, "\nError : Connect Failed\n");
      exit(1);
    }
  }
  if (send(sockfd, &clave, sizeof(int), 0) != sizeof(int)) {
    fprintf(stderr, "\nError : Error en numero de envio\n");
    exit(1);
  }
  if (send(sockfd, &size, sizeof(int), 0) != sizeof(int)) {
    fprintf(stderr, "\nError : Error en numero de envio\n");
    exit(1);
  }
  if (send(sockfd, buffer, size, 0) != size) {
    fprintf(stderr, "\nError : Error en numero de envio txt\n");
    exit(1);
  }
  if ((n = recv(sockfd, &size, sizeof(int), 0)) < 0) {
    fprintf(stderr, "\nError : Error en numero recibido\n");
    exit(1);
  }
  if (!size) {
    fprintf(
        stderr,
        "\nError : El archivo no es valido para encriptar o desencriptar\n");
    exit(1);
  }
  n = 0;
  file = fopen("salida.txt", "w");
  while (n < size) {
    int bytes = 0;
    if ((bytes = recv(sockfd, recvBuff, 1024 - 1, 0)) < 1) {
      fprintf(stderr, "\nError : Failed to receive bytes from server\n");
      exit(1);
    }
    n += bytes;
    recvBuff[bytes] = '\0';
    printf(recvBuff);
    fprintf(file, recvBuff);
  }
  fprintf(file, "\n");
  fclose(file);
  printf("\n");
  close(sockfd);
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x880,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
cmpl   $0xb,-0x8(%rbp)
je     12af <main+0x5f>
mov    0x2d32(%rip),%rax
mov    (%rax),%rdi
lea    0xda0(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    12b4 <main+0x64>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xdda(%rip),%rdx
call   1130 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     13a0 <main+0x150>
mov    -0x20(%rbp),%eax
add    $0xffffff9f,%eax
mov    %eax,%ecx
mov    %rcx,-0x878(%rbp)
sub    $0xf,%eax
ja     137e <main+0x12e>
mov    -0x878(%rbp),%rax
lea    0xd07(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    0x2cef(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x850(%rbp)
jmp    139b <main+0x14b>
mov    0x2cd9(%rip),%rax
mov    (%rax),%rdi
call   1140 <atoi@plt>
mov    %eax,-0x24(%rbp)
jmp    139b <main+0x14b>
mov    0x2cc2(%rip),%rax
mov    (%rax),%rdi
call   1140 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    139b <main+0x14b>
mov    0x2cab(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x848(%rbp)
jmp    139b <main+0x14b>
mov    0x2c95(%rip),%rax
mov    (%rax),%rdi
lea    0xd3a(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x838(%rbp)
jmp    139b <main+0x14b>
mov    0x2c43(%rip),%rax
mov    (%rax),%rdi
lea    0xcb1(%rip),%rsi
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1150 <exit@plt>
jmp    12b4 <main+0x64>
mov    -0x848(%rbp),%rdi
lea    0xcfb(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    13ca <main+0x17a>
xor    %eax,%eax
sub    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
jmp    140e <main+0x1be>
mov    -0x848(%rbp),%rdi
lea    0xcd9(%rip),%rsi
call   10c0 <strcmp@plt>
cmp    $0x0,%rax
jne    13ec <main+0x19c>
jmp    1409 <main+0x1b9>
mov    0x2bd5(%rip),%rax
mov    (%rax),%rdi
lea    0xcbe(%rip),%rsi
call   10d0 <fprintf@plt>
xor    %edi,%edi
call   1150 <exit@plt>
jmp    140e <main+0x1be>
mov    -0x838(%rbp),%rdi
mov    0x2bc4(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1110 <fseek@plt>
mov    -0x838(%rbp),%rdi
call   10e0 <ftell@plt>
mov    %rax,-0x858(%rbp)
mov    -0x838(%rbp),%rdi
call   1090 <rewind@plt>
mov    -0x858(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1100 <malloc@plt>
mov    %rax,-0x840(%rbp)
mov    -0x840(%rbp),%rdi
mov    -0x858(%rbp),%rdx
mov    -0x838(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
cmp    -0x858(%rbp),%rax
je     14a9 <main+0x259>
mov    0x2b38(%rip),%rax
mov    (%rax),%rdi
lea    0xc5e(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x838(%rbp),%rdi
call   1050 <fclose@plt>
mov    0x2b1c(%rip),%rax
mov    (%rax),%edi
mov    0x2afb(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    14fa <main+0x2aa>
mov    0x2ae7(%rip),%rax
mov    (%rax),%rdi
lea    0xc26(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
lea    -0x868(%rbp),%rdi
mov    $0x30,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2ac1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x860(%rbp)
mov    -0x24(%rbp),%edi
call   1060 <htons@plt>
mov    %eax,-0x864(%rbp)
mov    0x2aa4(%rip),%rax
mov    (%rax),%edi
mov    -0x850(%rbp),%rsi
lea    -0x868(%rbp),%rdx
call   10f0 <inet_pton@plt>
cmp    $0x0,%rax
jg     1573 <main+0x323>
mov    0x2a6e(%rip),%rax
mov    (%rax),%rdi
lea    0xbcb(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    1578 <main+0x328>
mov    -0x14(%rbp),%edi
lea    -0x868(%rbp),%rsi
mov    $0xc,%edx
call   1160 <connect@plt>
cmp    $0x0,%rax
jge    15ce <main+0x37e>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
cmpl   $0x3,-0x28(%rbp)
jne    15c9 <main+0x379>
mov    0x2a18(%rip),%rax
mov    (%rax),%rdi
lea    0xb82(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
jmp    1578 <main+0x328>
mov    -0x14(%rbp),%edi
lea    -0x1c(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1070 <send@plt>
cmp    $0x4,%rax
je     160d <main+0x3bd>
mov    0x29d4(%rip),%rax
mov    (%rax),%rdi
lea    0xb57(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x858(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1070 <send@plt>
cmp    $0x4,%rax
je     164f <main+0x3ff>
mov    0x2992(%rip),%rax
mov    (%rax),%rdi
lea    0xb15(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x14(%rbp),%edi
mov    -0x840(%rbp),%rsi
mov    -0x858(%rbp),%rdx
xor    %ecx,%ecx
mov    $0x0,%al
call   1070 <send@plt>
cmp    -0x858(%rbp),%rax
je     1696 <main+0x446>
mov    0x294b(%rip),%rax
mov    (%rax),%rdi
lea    0xaf1(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x858(%rbp),%rsi
mov    $0x4,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1030 <recv@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jge    16da <main+0x48a>
mov    0x2907(%rip),%rax
mov    (%rax),%rdi
lea    0xad4(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
cmpq   $0x0,-0x858(%rbp)
jne    1708 <main+0x4b8>
mov    0x28d9(%rip),%rax
mov    (%rax),%rdi
lea    0xac9(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
movl   $0x0,-0x18(%rbp)
lea    0xaec(%rip),%rdi
lea    0xaf0(%rip),%rsi
call   1120 <fopen@plt>
mov    %rax,-0x838(%rbp)
movslq -0x18(%rbp),%rax
cmp    -0x858(%rbp),%rax
jge    17ca <main+0x57a>
movl   $0x0,-0x86c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1030 <recv@plt>
mov    %eax,-0x86c(%rbp)
cmp    $0x1,%eax
jge    178b <main+0x53b>
mov    0x2856(%rip),%rax
mov    (%rax),%rdi
lea    0xa93(%rip),%rsi
call   10d0 <fprintf@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x86c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
movslq -0x86c(%rbp),%rax
movb   $0x0,-0x430(%rbp,%rax,1)
lea    -0x430(%rbp),%rdi
call   1080 <printf@plt>
mov    -0x838(%rbp),%rdi
lea    -0x430(%rbp),%rsi
call   10d0 <fprintf@plt>
jmp    1729 <main+0x4d9>
mov    -0x838(%rbp),%rdi
lea    0x8c2(%rip),%rsi
call   10d0 <fprintf@plt>
mov    -0x838(%rbp),%rdi
call   1050 <fclose@plt>
lea    0x8aa(%rip),%rdi
call   1080 <printf@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
xor    %edi,%edi
call   1150 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
cmp    $0xb,%edi
jne    16a6 <main+0x426>
mov    %rsi,%rbp
lea    0xdf8(%rip),%r15
mov    0x2d4d(%rip),%r14
lea    0xd4e(%rip),%r12
jmp    12c3 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%r14),%rbx
mov    $0xb,%edi
mov    %rbp,%rsi
mov    %r15,%rdx
call   1150 <getopt@plt>
cmp    $0x69,%eax
je     12c0 <main+0x40>
lea    -0x61(%rax),%ecx
cmp    $0xf,%ecx
ja     1324 <main+0xa4>
movslq (%r12,%rcx,4),%rax
add    %r12,%rax
jmp    *%rax
mov    (%r14),%rax
mov    %rax,0x28(%rsp)
jmp    12c3 <main+0x43>
mov    (%r14),%rdi
lea    0xdaa(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,0x20(%rsp)
jmp    12c3 <main+0x43>
mov    (%r14),%rdi
call   1160 <atoi@plt>
mov    %eax,0x1c(%rsp)
jmp    12c3 <main+0x43>
mov    (%r14),%rdi
call   1160 <atoi@plt>
mov    %eax,%r13d
jmp    12c3 <main+0x43>
cmp    $0xffffffff,%eax
jne    1356 <main+0xd6>
mov    %r13d,0xc(%rsp)
lea    0xd74(%rip),%rsi
mov    0x28(%rsp),%rbp
mov    %rbp,%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
jne    137d <main+0xfd>
neg    %r13d
mov    %r13d,0xc(%rsp)
mov    0x20(%rsp),%r14
jmp    139a <main+0x11a>
mov    0x2c6b(%rip),%rax
mov    (%rax),%rcx
lea    0xcd9(%rip),%rdi
mov    $0x5b,%esi
mov    $0x1,%edx
call   1190 <fwrite@plt>
xor    %edi,%edi
call   1170 <exit@plt>
lea    0xd2d(%rip),%rsi
mov    %rbp,%rdi
call   10e0 <strcmp@plt>
test   %rax,%rax
mov    0x20(%rsp),%r14
jne    144e <main+0x1ce>
mov    0x2c3f(%rip),%rax
mov    (%rax),%edx
mov    %r14,%rdi
xor    %esi,%esi
call   1130 <fseek@plt>
mov    %r14,%rdi
call   1100 <ftell@plt>
mov    %rax,%rbp
mov    %rax,(%rsp)
mov    %r14,%rdi
call   10a0 <rewind@plt>
mov    %ebp,%edi
call   1120 <malloc@plt>
mov    %rax,%r12
mov    %rax,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1050 <fread@plt>
cmp    %rbp,%rax
jne    1424 <main+0x1a4>
mov    %r14,%rdi
call   1060 <fclose@plt>
mov    0x2be3(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2bc1(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11a0 <socket@plt>
test   %eax,%eax
jns    1469 <main+0x1e9>
mov    0x2bb5(%rip),%rax
mov    (%rax),%rcx
lea    0xcf4(%rip),%rdi
mov    $0x1d,%esi
jmp    143a <main+0x1ba>
mov    0x2b9d(%rip),%rax
mov    (%rax),%rcx
lea    0xcc3(%rip),%rdi
mov    $0x18,%esi
mov    $0x1,%edx
call   1190 <fwrite@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
mov    0x2b73(%rip),%rax
mov    (%rax),%rcx
lea    0xc5c(%rip),%rdi
mov    $0x3c,%esi
jmp    136c <main+0xec>
mov    %eax,%r14d
lea    0x10(%rsp),%r15
mov    %r15,%rdi
mov    $0x30,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    0x1c(%rsp),%edi
call   1070 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x0(%rbp),%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1110 <inet_pton@plt>
test   %rax,%rax
jg     14c5 <main+0x245>
mov    0x2b17(%rip),%rax
mov    (%rax),%rcx
lea    0xc74(%rip),%rdi
mov    $0xc,%esi
jmp    143a <main+0x1ba>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   1180 <connect@plt>
test   %rax,%rax
jns    1520 <main+0x2a0>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   1180 <connect@plt>
test   %rax,%rax
jns    1520 <main+0x2a0>
lea    0x10(%rsp),%rsi
mov    %r14d,%edi
mov    $0xc,%edx
call   1180 <connect@plt>
test   %rax,%rax
jns    1520 <main+0x2a0>
mov    0x2ab7(%rip),%rax
mov    (%rax),%rcx
lea    0xc21(%rip),%rdi
jmp    1435 <main+0x1b5>
lea    0xc(%rsp),%rsi
mov    $0x4,%edx
mov    %r14d,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1080 <send@plt>
cmp    $0x4,%rax
jne    15a2 <main+0x322>
mov    %rsp,%rsi
mov    $0x4,%edx
mov    %r14d,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1080 <send@plt>
cmp    $0x4,%rax
jne    15a2 <main+0x322>
mov    (%rsp),%rdx
mov    %r14d,%edi
mov    %r12,%rsi
xor    %ecx,%ecx
xor    %eax,%eax
call   1080 <send@plt>
cmp    (%rsp),%rax
jne    15bd <main+0x33d>
mov    %rsp,%rsi
mov    $0x4,%edx
mov    %r14d,%edi
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <recv@plt>
test   %eax,%eax
jns    15d8 <main+0x358>
mov    0x2a3a(%rip),%rax
mov    (%rax),%rcx
lea    0xc07(%rip),%rdi
mov    $0x22,%esi
jmp    143a <main+0x1ba>
mov    0x2a1f(%rip),%rax
mov    (%rax),%rcx
lea    0xba2(%rip),%rdi
mov    $0x22,%esi
jmp    143a <main+0x1ba>
mov    0x2a04(%rip),%rax
mov    (%rax),%rcx
lea    0xbaa(%rip),%rdi
mov    $0x26,%esi
jmp    143a <main+0x1ba>
cmpq   $0x0,(%rsp)
jne    15fa <main+0x37a>
mov    0x29e2(%rip),%rax
mov    (%rax),%rcx
lea    0xbd2(%rip),%rdi
mov    $0x3f,%esi
jmp    143a <main+0x1ba>
lea    0xc01(%rip),%rdi
lea    0xc05(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,%r15
cmpq   $0x0,(%rsp)
jle    165d <main+0x3dd>
lea    0x30(%rsp),%rbp
xor    %ebx,%ebx
xchg   %ax,%ax
mov    %r14d,%edi
mov    %rbp,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
xor    %eax,%eax
call   1030 <recv@plt>
test   %eax,%eax
jle    168b <main+0x40b>
add    %eax,%ebx
mov    %eax,%eax
movb   $0x0,0x30(%rsp,%rax,1)
mov    %rbp,%rdi
call   1090 <printf@plt>
mov    %r15,%rdi
mov    %rbp,%rsi
call   10f0 <fprintf@plt>
movslq %ebx,%rax
cmp    %rax,(%rsp)
jg     1620 <main+0x3a0>
mov    $0xa,%edi
mov    %r15,%rsi
call   10d0 <fputc@plt>
mov    %r15,%rdi
call   1060 <fclose@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
mov    %r14d,%edi
call   10c0 <close@plt>
xor    %edi,%edi
call   1170 <exit@plt>
mov    0x2936(%rip),%rax
mov    (%rax),%rcx
lea    0xb73(%rip),%rdi
mov    $0x2d,%esi
jmp    143a <main+0x1ba>
mov    0x291b(%rip),%rax
mov    (%rax),%rcx
lea    0x989(%rip),%rdi
mov    $0x5b,%esi
jmp    143a <main+0x1ba>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32* null
@.str = [92 x i8] c"Uso: scdax_cli -i <dir_ip> -p <puerto_scdax_svr> -c <clave> -a <dir_despl> -f <arch_input>\0A\00"
@.str.1 = [11 x i8] c"i:p:c:a:f:\00"
@optarg = global i8* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [8 x i8] c"derecha\00"
@.str.4 = [10 x i8] c"izquierda\00"
@.str.5 = [61 x i8] c"La direccion de desplazamiento debe ser derecha o izquierda\0A\00"
@SEEK_END = global i32 0
@.str.6 = [25 x i8] c"\0AError: leyendo archivo\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [30 x i8] c"\0AError: No pude crear socket\0A\00"
@.str.8 = [13 x i8] c"\0AError: inet\00"
@.str.9 = [25 x i8] c"\0AError : Connect Failed\0A\00"
@.str.10 = [35 x i8] c"\0AError : Error en numero de envio\0A\00"
@.str.11 = [39 x i8] c"\0AError : Error en numero de envio txt\0A\00"
@.str.12 = [35 x i8] c"\0AError : Error en numero recibido\0A\00"
@.str.13 = [64 x i8] c"\0AError : El archivo no es valido para encriptar o desencriptar\0A\00"
@.str.14 = [11 x i8] c"salida.txt\00"
@.str.15 = [2 x i8] c"w\00"
@.str.16 = [46 x i8] c"\0AError : Failed to receive bytes from server\0A\00"
@.str.17 = [2 x i8] c"\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 i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca [1024 x i8]
%14 = alloca i32*
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
%18 = alloca i64
%19 = alloca %struct.sockaddr_in
%20 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %9
store i32 0, i32* %11
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 11
br i1 %22, label %23, label %27
23: ; preds = %2
%24 = load i32*, i32** @stderr
%25 = call i32 @fprintf(i32* %24, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0))
%26 = call i32 @exit(i32 1)
unreachable
27: ; preds = %2
br label %28
28: ; preds = %52, %27
%29 = load i32, i32* %4
%30 = load i8**, i8*** %5
%31 = call i32 @getopt(i32 %29, i8** %30, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
store i32 %31, i32* %9
%32 = icmp ne i32 %31, -1
br i1 %32, label %33, label %53
33: ; preds = %28
%34 = load i32, i32* %9
switch i32 %34, label %48 [
i32 105, label %35
i32 112, label %37
i32 99, label %40
i32 97, label %43
i32 102, label %45
]
35: ; preds = %33
%36 = load i8*, i8** @optarg
store i8* %36, i8** %17
br label %52
37: ; preds = %33
%38 = load i8*, i8** @optarg
%39 = call i32 @atoi(i8* %38)
store i32 %39, i32* %10
br label %52
40: ; preds = %33
%41 = load i8*, i8** @optarg
%42 = call i32 @atoi(i8* %41)
store i32 %42, i32* %8
br label %52
43: ; preds = %33
%44 = load i8*, i8** @optarg
store i8* %44, i8** %16
br label %52
45: ; preds = %33
%46 = load i8*, i8** @optarg
%47 = call i32* @fopen(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32* %47, i32** %14
br label %52
48: ; preds = %33
%49 = load i32*, i32** @stderr
%50 = call i32 @fprintf(i32* %49, i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0))
%51 = call i32 @exit(i32 0)
unreachable
52: ; preds = %45, %43, %40, %37, %35
br label %28
53: ; preds = %28
%54 = load i8*, i8** %16
%55 = call i64 @strcmp(i8* %54, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %53
%58 = load i32, i32* %8
%59 = sub nsw i32 0, %58
store i32 %59, i32* %8
br label %70
60: ; preds = %53
%61 = load i8*, i8** %16
%62 = call i64 @strcmp(i8* %61, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%63 = icmp eq i64 %62, 0
br i1 %63, label %64, label %65
64: ; preds = %60
br label %69
65: ; preds = %60
%66 = load i32*, i32** @stderr
%67 = call i32 @fprintf(i32* %66, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0))
%68 = call i32 @exit(i32 0)
unreachable
69: ; preds = %64
br label %70
70: ; preds = %69, %57
%71 = load i32*, i32** %14
%72 = load i32, i32* @SEEK_END
%73 = call i32 @fseek(i32* %71, i32 0, i32 %72)
%74 = load i32*, i32** %14
%75 = call i64 @ftell(i32* %74)
store i64 %75, i64* %18
%76 = load i32*, i32** %14
%77 = call i32 @rewind(i32* %76)
%78 = load i64, i64* %18
%79 = mul i64 1, %78
%80 = trunc i64 %79 to i32
%81 = call i64 @malloc(i32 %80)
%82 = inttoptr i64 %81 to i8*
store i8* %82, i8** %15
%83 = load i8*, i8** %15
%84 = load i64, i64* %18
%85 = load i32*, i32** %14
%86 = call i64 @fread(i8* %83, i32 1, i64 %84, i32* %85)
%87 = load i64, i64* %18
%88 = icmp ne i64 %86, %87
br i1 %88, label %89, label %93
89: ; preds = %70
%90 = load i32*, i32** @stderr
%91 = call i32 @fprintf(i32* %90, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0))
%92 = call i32 @exit(i32 1)
unreachable
93: ; preds = %70
%94 = load i32*, i32** %14
%95 = call i32 @fclose(i32* %94)
%96 = load i32, i32* @AF_INET
%97 = load i32, i32* @SOCK_STREAM
%98 = call i32 @socket(i32 %96, i32 %97, i32 0)
store i32 %98, i32* %6
%99 = icmp slt i32 %98, 0
br i1 %99, label %100, label %104
100: ; preds = %93
%101 = load i32*, i32** @stderr
%102 = call i32 @fprintf(i32* %101, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0))
%103 = call i32 @exit(i32 1)
unreachable
104: ; preds = %93
%105 = call i32 @memset(%struct.sockaddr_in* %19, i32 48, i32 12)
%106 = load i32, i32* @AF_INET
%107 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 2
store i32 %106, i32* %107
%108 = load i32, i32* %10
%109 = call i32 @htons(i32 %108)
%110 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 1
store i32 %109, i32* %110
%111 = load i32, i32* @AF_INET
%112 = load i8*, i8** %17
%113 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %19, i32 0, i32 0
%114 = call i64 @inet_pton(i32 %111, i8* %112, i32* %113)
%115 = icmp sle i64 %114, 0
br i1 %115, label %116, label %120
116: ; preds = %104
%117 = load i32*, i32** @stderr
%118 = call i32 @fprintf(i32* %117, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0))
%119 = call i32 @exit(i32 1)
unreachable
120: ; preds = %104
br label %121
121: ; preds = %135, %120
%122 = load i32, i32* %6
%123 = bitcast %struct.sockaddr_in* %19 to %struct.sockaddr*
%124 = call i64 @connect(i32 %122, %struct.sockaddr* %123, i32 12)
%125 = icmp slt i64 %124, 0
br i1 %125, label %126, label %136
126: ; preds = %121
%127 = load i32, i32* %11
%128 = add nsw i32 %127, 1
store i32 %128, i32* %11
%129 = load i32, i32* %11
%130 = icmp eq i32 %129, 3
br i1 %130, label %131, label %135
131: ; preds = %126
%132 = load i32*, i32** @stderr
%133 = call i32 @fprintf(i32* %132, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0))
%134 = call i32 @exit(i32 1)
unreachable
135: ; preds = %126
br label %121
136: ; preds = %121
%137 = load i32, i32* %6
%138 = call i64 (i32, ...) @send(i32 %137, i32* %8, i64 4, i32 0)
%139 = icmp ne i64 %138, 4
br i1 %139, label %140, label %144
140: ; preds = %136
%141 = load i32*, i32** @stderr
%142 = call i32 @fprintf(i32* %141, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%143 = call i32 @exit(i32 1)
unreachable
144: ; preds = %136
%145 = load i32, i32* %6
%146 = call i64 (i32, ...) @send(i32 %145, i64* %18, i64 4, i32 0)
%147 = icmp ne i64 %146, 4
br i1 %147, label %148, label %152
148: ; preds = %144
%149 = load i32*, i32** @stderr
%150 = call i32 @fprintf(i32* %149, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0))
%151 = call i32 @exit(i32 1)
unreachable
152: ; preds = %144
%153 = load i32, i32* %6
%154 = load i8*, i8** %15
%155 = load i64, i64* %18
%156 = call i64 (i32, ...) @send(i32 %153, i8* %154, i64 %155, i32 0)
%157 = load i64, i64* %18
%158 = icmp ne i64 %156, %157
br i1 %158, label %159, label %163
159: ; preds = %152
%160 = load i32*, i32** @stderr
%161 = call i32 @fprintf(i32* %160, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0))
%162 = call i32 @exit(i32 1)
unreachable
163: ; preds = %152
%164 = load i32, i32* %6
%165 = call i32 (i32, ...) @recv(i32 %164, i64* %18, i64 4, i32 0)
store i32 %165, i32* %7
%166 = icmp slt i32 %165, 0
br i1 %166, label %167, label %171
167: ; preds = %163
%168 = load i32*, i32** @stderr
%169 = call i32 @fprintf(i32* %168, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0))
%170 = call i32 @exit(i32 1)
unreachable
171: ; preds = %163
%172 = load i64, i64* %18
%173 = icmp ne i64 %172, 0
br i1 %173, label %178, label %174
174: ; preds = %171
%175 = load i32*, i32** @stderr
%176 = call i32 @fprintf(i32* %175, i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0))
%177 = call i32 @exit(i32 1)
unreachable
178: ; preds = %171
store i32 0, i32* %7
%179 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
store i32* %179, i32** %14
br label %180
180: ; preds = %194, %178
%181 = load i32, i32* %7
%182 = sext i32 %181 to i64
%183 = load i64, i64* %18
%184 = icmp slt i64 %182, %183
br i1 %184, label %185, label %206
185: ; preds = %180
store i32 0, i32* %20
%186 = load i32, i32* %6
%187 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%188 = call i32 (i32, ...) @recv(i32 %186, i8* %187, i32 1023, i32 0)
store i32 %188, i32* %20
%189 = icmp slt i32 %188, 1
br i1 %189, label %190, label %194
190: ; preds = %185
%191 = load i32*, i32** @stderr
%192 = call i32 @fprintf(i32* %191, i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.16, i64 0, i64 0))
%193 = call i32 @exit(i32 1)
unreachable
194: ; preds = %185
%195 = load i32, i32* %20
%196 = load i32, i32* %7
%197 = add nsw i32 %196, %195
store i32 %197, i32* %7
%198 = load i32, i32* %20
%199 = sext i32 %198 to i64
%200 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 %199
store i8 0, i8* %200
%201 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%202 = call i32 @printf(i8* %201)
%203 = load i32*, i32** %14
%204 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%205 = call i32 @fprintf(i32* %203, i8* %204)
br label %180
206: ; preds = %180
%207 = load i32*, i32** %14
%208 = call i32 @fprintf(i32* %207, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%209 = load i32*, i32** %14
%210 = call i32 @fclose(i32* %209)
%211 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.17, i64 0, i64 0))
%212 = load i32, i32* %6
%213 = call i32 @close(i32 %212)
%214 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32* null
@.str = [92 x i8] c"Uso: scdax_cli -i <dir_ip> -p <puerto_scdax_svr> -c <clave> -a <dir_despl> -f <arch_input>\0A\00"
@.str.1 = [11 x i8] c"i:p:c:a:f:\00"
@optarg = global i8* null
@.str.2 = [2 x i8] c"r\00"
@.str.3 = [8 x i8] c"derecha\00"
@.str.4 = [10 x i8] c"izquierda\00"
@.str.5 = [61 x i8] c"La direccion de desplazamiento debe ser derecha o izquierda\0A\00"
@SEEK_END = global i32 0
@.str.6 = [25 x i8] c"\0AError: leyendo archivo\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.7 = [30 x i8] c"\0AError: No pude crear socket\0A\00"
@.str.8 = [13 x i8] c"\0AError: inet\00"
@.str.9 = [25 x i8] c"\0AError : Connect Failed\0A\00"
@.str.10 = [35 x i8] c"\0AError : Error en numero de envio\0A\00"
@.str.11 = [39 x i8] c"\0AError : Error en numero de envio txt\0A\00"
@.str.12 = [35 x i8] c"\0AError : Error en numero recibido\0A\00"
@.str.13 = [64 x i8] c"\0AError : El archivo no es valido para encriptar o desencriptar\0A\00"
@.str.14 = [11 x i8] c"salida.txt\00"
@.str.15 = [2 x i8] c"w\00"
@.str.16 = [46 x i8] c"\0AError : Failed to receive bytes from server\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca [1024 x i8]
%5 = alloca i64
%6 = alloca %struct.sockaddr_in
%7 = bitcast i32* %3 to i8*
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%9 = bitcast i64* %5 to i8*
%10 = bitcast %struct.sockaddr_in* %6 to i8*
%11 = icmp eq i32 %0, 11
br i1 %11, label %27, label %12
12: ; preds = %2
%13 = load i32*, i32** @stderr
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i64 91, i64 1, i32* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %42, %19
%17 = phi i8* [ %20, %19 ], [ %44, %42 ]
%18 = tail call i32 @getopt(i32 11, i8** %1, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
switch i32 %18, label %50 [
i32 -1, label %54
i32 105, label %19
i32 112, label %21
i32 99, label %24
i32 97, label %45
i32 102, label %47
]
19: ; preds = %16
%20 = load i8*, i8** @optarg
br label %16
21: ; preds = %16
%22 = load i8*, i8** @optarg
%23 = tail call i32 @atoi(i8* %22)
br label %33
24: ; preds = %16
%25 = load i8*, i8** @optarg
%26 = tail call i32 @atoi(i8* %25)
br label %27
27: ; preds = %2, %24
%28 = phi i32 [ %26, %24 ], [ undef, %2 ]
%29 = phi i32 [ %34, %24 ], [ undef, %2 ]
%30 = phi i32* [ %39, %24 ], [ undef, %2 ]
%31 = phi i8* [ %43, %24 ], [ undef, %2 ]
%32 = phi i8* [ %17, %24 ], [ undef, %2 ]
br label %33
33: ; preds = %27, %21
%34 = phi i32 [ %29, %27 ], [ %23, %21 ]
%35 = phi i32* [ %30, %27 ], [ %39, %21 ]
%36 = phi i8* [ %31, %27 ], [ %43, %21 ]
%37 = phi i8* [ %32, %27 ], [ %17, %21 ]
br label %38
38: ; preds = %33, %47
%39 = phi i32* [ %35, %33 ], [ %49, %47 ]
%40 = phi i8* [ %36, %33 ], [ %43, %47 ]
%41 = phi i8* [ %37, %33 ], [ %17, %47 ]
br label %42
42: ; preds = %38, %45
%43 = phi i8* [ %40, %38 ], [ %46, %45 ]
%44 = phi i8* [ %41, %38 ], [ %17, %45 ]
br label %16
45: ; preds = %16
%46 = load i8*, i8** @optarg
br label %42
47: ; preds = %16
%48 = load i8*, i8** @optarg
%49 = tail call i32* @fopen(i8* %48, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %38
50: ; preds = %16
%51 = load i32*, i32** @stderr
%52 = tail call i64 @fwrite(i8* getelementptr inbounds ([92 x i8], [92 x i8]* @.str, i64 0, i64 0), i64 91, i64 1, i32* %51)
%53 = tail call i32 @exit(i32 0)
unreachable
54: ; preds = %16
store i32 %28, i32* %3
%55 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%56 = icmp eq i64 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = sub nsw i32 0, %28
store i32 %58, i32* %3
br label %66
59: ; preds = %54
%60 = tail call i64 @strcmp(i8* %43, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%61 = icmp eq i64 %60, 0
br i1 %61, label %66, label %62
62: ; preds = %59
%63 = load i32*, i32** @stderr
%64 = tail call i64 @fwrite(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.5, i64 0, i64 0), i64 60, i64 1, i32* %63)
%65 = tail call i32 @exit(i32 0)
unreachable
66: ; preds = %59, %57
%67 = load i32, i32* @SEEK_END
%68 = tail call i32 @fseek(i32* %39, i32 0, i32 %67)
%69 = tail call i64 @ftell(i32* %39)
store i64 %69, i64* %5
%70 = tail call i32 @rewind(i32* %39)
%71 = trunc i64 %69 to i32
%72 = tail call i64 @malloc(i32 %71)
%73 = inttoptr i64 %72 to i8*
%74 = tail call i64 @fread(i8* %73, i32 1, i64 %69, i32* %39)
%75 = icmp eq i64 %74, %69
br i1 %75, label %80, label %76
76: ; preds = %66
%77 = load i32*, i32** @stderr
%78 = tail call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i64 24, i64 1, i32* %77)
%79 = tail call i32 @exit(i32 1)
unreachable
80: ; preds = %66
%81 = tail call i32 @fclose(i32* %39)
%82 = load i32, i32* @AF_INET
%83 = load i32, i32* @SOCK_STREAM
%84 = tail call i32 @socket(i32 %82, i32 %83, i32 0)
%85 = icmp slt i32 %84, 0
br i1 %85, label %86, label %90
86: ; preds = %80
%87 = load i32*, i32** @stderr
%88 = tail call i64 @fwrite(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.7, i64 0, i64 0), i64 29, i64 1, i32* %87)
%89 = tail call i32 @exit(i32 1)
unreachable
90: ; preds = %80
%91 = call i32 @memset(%struct.sockaddr_in* %6, i32 48, i32 12)
%92 = load i32, i32* @AF_INET
%93 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 2
store i32 %92, i32* %93
%94 = call i32 @htons(i32 %34)
%95 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 1
store i32 %94, i32* %95
%96 = load i32, i32* @AF_INET
%97 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i64 0, i32 0
%98 = call i64 @inet_pton(i32 %96, i8* %17, i32* %97)
%99 = icmp slt i64 %98, 1
br i1 %99, label %104, label %100
100: ; preds = %90
%101 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%102 = call i64 @connect(i32 %84, %struct.sockaddr* %101, i32 12)
%103 = icmp slt i64 %102, 0
br i1 %103, label %108, label %118
104: ; preds = %90
%105 = load i32*, i32** @stderr
%106 = call i64 @fwrite(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.8, i64 0, i64 0), i64 12, i64 1, i32* %105)
%107 = call i32 @exit(i32 1)
unreachable
108: ; preds = %100
%109 = call i64 @connect(i32 %84, %struct.sockaddr* %101, i32 12)
%110 = icmp slt i64 %109, 0
br i1 %110, label %111, label %118
111: ; preds = %108
%112 = call i64 @connect(i32 %84, %struct.sockaddr* %101, i32 12)
%113 = icmp slt i64 %112, 0
br i1 %113, label %114, label %118
114: ; preds = %111
%115 = load i32*, i32** @stderr
%116 = call i64 @fwrite(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i64 24, i64 1, i32* %115)
%117 = call i32 @exit(i32 1)
unreachable
118: ; preds = %111, %108, %100
%119 = call i64 (i32, ...) @send(i32 %84, i32* %3, i64 4, i32 0)
%120 = icmp eq i64 %119, 4
br i1 %120, label %125, label %121
121: ; preds = %118
%122 = load i32*, i32** @stderr
%123 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i64 34, i64 1, i32* %122)
%124 = call i32 @exit(i32 1)
unreachable
125: ; preds = %118
%126 = call i64 (i32, ...) @send(i32 %84, i64* %5, i64 4, i32 0)
%127 = icmp eq i64 %126, 4
br i1 %127, label %132, label %128
128: ; preds = %125
%129 = load i32*, i32** @stderr
%130 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.10, i64 0, i64 0), i64 34, i64 1, i32* %129)
%131 = call i32 @exit(i32 1)
unreachable
132: ; preds = %125
%133 = load i64, i64* %5
%134 = call i64 (i32, ...) @send(i32 %84, i8* %73, i64 %133, i32 0)
%135 = load i64, i64* %5
%136 = icmp eq i64 %134, %135
br i1 %136, label %141, label %137
137: ; preds = %132
%138 = load i32*, i32** @stderr
%139 = call i64 @fwrite(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.11, i64 0, i64 0), i64 38, i64 1, i32* %138)
%140 = call i32 @exit(i32 1)
unreachable
141: ; preds = %132
%142 = call i32 (i32, ...) @recv(i32 %84, i64* %5, i64 4, i32 0)
%143 = icmp slt i32 %142, 0
br i1 %143, label %144, label %148
144: ; preds = %141
%145 = load i32*, i32** @stderr
%146 = call i64 @fwrite(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i64 34, i64 1, i32* %145)
%147 = call i32 @exit(i32 1)
unreachable
148: ; preds = %141
%149 = load i64, i64* %5
%150 = icmp eq i64 %149, 0
br i1 %150, label %151, label %155
151: ; preds = %148
%152 = load i32*, i32** @stderr
%153 = call i64 @fwrite(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.13, i64 0, i64 0), i64 63, i64 1, i32* %152)
%154 = call i32 @exit(i32 1)
unreachable
155: ; preds = %148
%156 = call i32* @fopen(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.14, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.15, i64 0, i64 0))
%157 = load i64, i64* %5
%158 = icmp sgt i64 %157, 0
br i1 %158, label %159, label %176
159: ; preds = %155, %167
%160 = phi i32 [ %168, %167 ], [ 0, %155 ]
%161 = call i32 (i32, ...) @recv(i32 %84, i8* %8, i32 1023, i32 0)
%162 = icmp slt i32 %161, 1
br i1 %162, label %163, label %167
163: ; preds = %159
%164 = load i32*, i32** @stderr
%165 = call i64 @fwrite(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str.16, i64 0, i64 0), i64 45, i64 1, i32* %164)
%166 = call i32 @exit(i32 1)
unreachable
167: ; preds = %159
%168 = add nsw i32 %161, %160
%169 = zext i32 %161 to i64
%170 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %169
store i8 0, i8* %170
%171 = call i32 @printf(i8* %8)
%172 = call i32 @fprintf(i32* %156, i8* %8)
%173 = sext i32 %168 to i64
%174 = load i64, i64* %5
%175 = icmp sgt i64 %174, %173
br i1 %175, label %159, label %176
176: ; preds = %167, %155
%177 = call i32 @fputc(i32 10, i32* %156)
%178 = call i32 @fclose(i32* %156)
%179 = call i32 @putchar(i32 10)
%180 = call i32 @close(i32 %84)
%181 = call i32 @exit(i32 0)
unreachable
}