#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 in_addr {
  int dummy;
};
struct sockaddr_in {
  char sin_zero;
  struct in_addr sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  scalar_t__ h_addr;
};
typedef int /*<<< orphan*/ command;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ close(int);
char *concat(char *, char *);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ error(char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ free(char *);
int fwrite(char *, int, int, int /*<<< orphan*/ *);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(char *, char, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printSize(long);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
char *strtok(char *, char *);
int main(int argc, char *argv[]) {
  int sockfd;
  struct hostent *he;
  struct sockaddr_in server_address;
  if (argc != 3) {
    fprintf(stderr, "Uso: cliente host_address port\n");
    exit(1);
  }
  char *address = argv[1];
  int port = atoi(argv[2]);
  if ((he = gethostbyname(argv[1])) == NULL) {
    perror("gethostbyname");
    exit(1);
  }
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    perror("socket");
    exit(1);
  }
  server_address.sin_family = AF_INET;
  server_address.sin_port = htons(port);
  server_address.sin_addr = *((struct in_addr *)he->h_addr);
  memset(&(server_address.sin_zero), '\0', 8);
  if (connect(sockfd, (struct sockaddr *)&server_address,
              sizeof(struct sockaddr)) == -1) {
    perror("connect");
    exit(1);
  }
  printf("Conexión exitosa al servidor %s:%d.\n", address, port);
  char command[256];
  char *cmd;
  char *filename;
  while (1) {
    printf("Ingrese comandos: ");
    memset(command, 0, sizeof(command));
    fgets(command, sizeof(command), stdin);
    cmd = strtok(command, " ");
    filename = strtok(NULL, "\n");
    if (strcmp("traer", cmd) == 0) {
      printf("Comando: Traer\n");
      char *request = concat(cmd, " ");
      request = concat(request, filename);
      if (send(sockfd, request, strlen(request), 0) == -1)
        perror("send");
      free(request);
      FILE *fw = fopen(filename, "w");
      char file_buffer[16];
      bzero(file_buffer, 16);
      long int total_bytes_read = 0;
      int bytes_read = 0;
      while ((bytes_read = recv(sockfd, file_buffer, 16, 0)) > 0) {
        int bytes_written = fwrite(file_buffer, sizeof(char), bytes_read, fw);
        if (bytes_written < bytes_read) {
          error("File download failed.\n");
        }
        bzero(file_buffer, 16);
        total_bytes_read += bytes_read;
        printSize(total_bytes_read);
        if (bytes_read == 0 || bytes_read != 16) {
          printf("\nTransfer complete.\n");
          break;
        }
      }
      fclose(fw);
    } else if (strcmp("subir", cmd) == 0) {
      printf("Comando: Subir\n");
      char *request = concat(cmd, " ");
      request = concat(request, filename);
      if (send(sockfd, request, strlen(request), 0) == -1)
        perror("send");
      free(request);
      FILE *fs = fopen(filename, "r");
      if (fs == NULL) {
        printf("ERROR: File %s not found.\n", filename);
        exit(1);
      }
      char file_buffer[16];
      int bytes_read = 0;
      while ((bytes_read = fread(file_buffer, sizeof(char), 16, fs)) > 0) {
        if (send(sockfd, file_buffer, bytes_read, 0) < 0) {
          perror("send");
          exit(1);
        }
        bzero(file_buffer, 16);
      }
      fclose(fs);
    } else if (strcmp("salir\n", cmd) == 0) {
      printf("Cerrando el programa...\n");
      return 0;
    } else {
      printf("Comando inválido.\n");
    }
  }
  close(sockfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     12d2 <main+0x42>
mov    0x2d16(%rip),%rax
mov    (%rax),%edi
lea    0xd3d(%rip),%rsi
call   1100 <fprintf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1170 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10f0 <gethostbyname@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jne    131f <main+0x8f>
lea    0xd10(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
mov    0x2c99(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    135a <main+0xca>
lea    0xce3(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    0x2c87(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x24(%rbp)
mov    -0x3c(%rbp),%edi
call   1080 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10c0 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0x4,%edx
call   1190 <connect@plt>
cmp    $0xffffffff,%eax
jne    13bd <main+0x12d>
lea    0xc87(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    -0x38(%rbp),%rsi
mov    -0x3c(%rbp),%edx
lea    0xc72(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    0xc8a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
lea    -0x140(%rbp),%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <memset@plt>
lea    -0x140(%rbp),%rdi
mov    0x2bdf(%rip),%rax
mov    (%rax),%edx
mov    $0x100,%esi
call   10d0 <fgets@plt>
lea    -0x140(%rbp),%rdi
lea    0xc59(%rip),%rsi
call   1150 <strtok@plt>
mov    %rax,-0x148(%rbp)
xor    %eax,%eax
mov    %eax,%edi
lea    0xcdc(%rip),%rsi
call   1150 <strtok@plt>
mov    %rax,-0x150(%rbp)
mov    -0x148(%rbp),%rsi
lea    0xc2a(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    1613 <main+0x383>
lea    0xc1a(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x148(%rbp),%rdi
lea    0xbfd(%rip),%rsi
call   10b0 <concat@plt>
mov    %rax,-0x158(%rbp)
mov    -0x158(%rbp),%rdi
mov    -0x150(%rbp),%rsi
call   10b0 <concat@plt>
mov    %rax,-0x158(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1b4(%rbp)
mov    -0x158(%rbp),%rax
mov    %rax,-0x1b0(%rbp)
mov    -0x158(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1b4(%rbp),%edi
mov    -0x1b0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
cmp    $0xffffffff,%eax
jne    14eb <main+0x25b>
lea    0xba6(%rip),%rdi
call   1140 <perror@plt>
mov    -0x158(%rbp),%rdi
call   1030 <free@plt>
mov    -0x150(%rbp),%rdi
lea    0xb8c(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x160(%rbp)
lea    -0x170(%rbp),%rdi
mov    $0x10,%esi
call   1160 <bzero@plt>
movq   $0x0,-0x178(%rbp)
movl   $0x0,-0x17c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x170(%rbp),%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x17c(%rbp)
cmp    $0x0,%eax
jle    1602 <main+0x372>
lea    -0x170(%rbp),%rdi
mov    -0x17c(%rbp),%edx
mov    -0x160(%rbp),%rcx
mov    $0x1,%esi
call   11a0 <fwrite@plt>
mov    %eax,-0x180(%rbp)
mov    -0x180(%rbp),%eax
cmp    -0x17c(%rbp),%eax
jge    159e <main+0x30e>
lea    0xafa(%rip),%rdi
call   1120 <error@plt>
lea    -0x170(%rbp),%rdi
mov    $0x10,%esi
call   1160 <bzero@plt>
movslq -0x17c(%rbp),%rax
add    -0x178(%rbp),%rax
mov    %rax,-0x178(%rbp)
mov    -0x178(%rbp),%rdi
call   1110 <printSize@plt>
cmpl   $0x0,-0x17c(%rbp)
je     15ea <main+0x35a>
cmpl   $0x10,-0x17c(%rbp)
je     15fd <main+0x36d>
lea    0xab9(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    1602 <main+0x372>
jmp    1537 <main+0x2a7>
mov    -0x160(%rbp),%rdi
call   1060 <fclose@plt>
jmp    17f4 <main+0x564>
mov    -0x148(%rbp),%rsi
lea    0xa9e(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    17a6 <main+0x516>
lea    0xa8e(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    -0x148(%rbp),%rdi
lea    0xa28(%rip),%rsi
call   10b0 <concat@plt>
mov    %rax,-0x188(%rbp)
mov    -0x188(%rbp),%rdi
mov    -0x150(%rbp),%rsi
call   10b0 <concat@plt>
mov    %rax,-0x188(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0x1c4(%rbp)
mov    -0x188(%rbp),%rax
mov    %rax,-0x1c0(%rbp)
mov    -0x188(%rbp),%rdi
call   1070 <strlen@plt>
mov    -0x1c4(%rbp),%edi
mov    -0x1c0(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1090 <send@plt>
cmp    $0xffffffff,%eax
jne    16c0 <main+0x430>
lea    0x9d1(%rip),%rdi
call   1140 <perror@plt>
mov    -0x188(%rbp),%rdi
call   1030 <free@plt>
mov    -0x150(%rbp),%rdi
lea    0x9a0(%rip),%rsi
call   1130 <fopen@plt>
mov    %rax,-0x190(%rbp)
cmpq   $0x0,-0x190(%rbp)
jne    1713 <main+0x483>
mov    -0x150(%rbp),%rsi
lea    0x9d3(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
movl   $0x0,-0x1a4(%rbp)
lea    -0x1a0(%rbp),%rdi
mov    -0x190(%rbp),%rcx
mov    $0x1,%esi
mov    $0x10,%edx
call   1050 <fread@plt>
mov    %eax,-0x1a4(%rbp)
cmp    $0x0,%eax
jle    1795 <main+0x505>
mov    -0x14(%rbp),%edi
lea    -0x1a0(%rbp),%rsi
mov    -0x1a4(%rbp),%edx
xor    %ecx,%ecx
call   1090 <send@plt>
cmp    $0x0,%eax
jge    177f <main+0x4ef>
lea    0x91c(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
lea    -0x1a0(%rbp),%rdi
mov    $0x10,%esi
call   1160 <bzero@plt>
jmp    171d <main+0x48d>
mov    -0x190(%rbp),%rdi
call   1060 <fclose@plt>
jmp    17ef <main+0x55f>
mov    -0x148(%rbp),%rsi
lea    0x93c(%rip),%rdi
call   10e0 <strcmp@plt>
cmp    $0x0,%rax
jne    17dc <main+0x54c>
lea    0x92d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
xor    %eax,%eax
add    $0x1d0,%rsp
pop    %rbp
ret
lea    0x92d(%rip),%rdi
mov    $0x0,%al
call   10a0 <printf@plt>
jmp    17ef <main+0x55f>
jmp    17f4 <main+0x564>
jmp    13d2 <main+0x142>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x128,%rsp
cmp    $0x3,%edi
jne    1642 <main+0x3a2>
mov    0x8(%rsi),%r14
mov    0x10(%rsi),%rdi
call   1180 <atoi@plt>
mov    %eax,%r12d
mov    %r14,%rdi
call   1100 <gethostbyname@plt>
test   %rax,%rax
je     1661 <main+0x3c1>
mov    %rax,%rbx
mov    0x2d03(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2cd9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11c0 <socket@plt>
cmp    $0xffffffff,%eax
je     166a <main+0x3ca>
mov    %eax,%r15d
mov    0x0(%rbp),%eax
mov    %eax,0xc(%rsp)
mov    %r12d,%edi
call   1090 <htons@plt>
mov    %eax,0x8(%rsp)
mov    (%rbx),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rsp)
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10d0 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   11a0 <connect@plt>
cmp    $0xffffffff,%eax
je     1673 <main+0x3d3>
lea    0xceb(%rip),%rdi
mov    %r14,%rsi
mov    %r12d,%edx
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0xd0e(%rip),%rbp
lea    0x10(%rsp),%r14
jmp    1388 <main+0xe8>
lea    0xd97(%rip),%rdi
call   1050 <puts@plt>
mov    %r12,%rdi
call   1070 <fclose@plt>
lea    0xcec(%rip),%rbp
lea    0xcd4(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10d0 <memset@plt>
mov    0x2c2f(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0x100,%esi
call   10e0 <fgets@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1160 <strtok@plt>
mov    %rax,%rbx
xor    %edi,%edi
lea    0xc8a(%rip),%rsi
call   1160 <strtok@plt>
mov    %rax,%r13
lea    0xc90(%rip),%rdi
mov    %rbx,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1440 <main+0x1a0>
lea    0xca0(%rip),%rdi
mov    %rbx,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     1520 <main+0x280>
lea    0xca9(%rip),%rdi
mov    %rbx,%rsi
call   10f0 <strcmp@plt>
test   %rax,%rax
je     15f1 <main+0x351>
lea    0xc98(%rip),%rdi
call   1050 <puts@plt>
jmp    1388 <main+0xe8>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    0xcb5(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10c0 <concat@plt>
mov    %rax,%rdi
mov    %r13,%rsi
call   10c0 <concat@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10a0 <send@plt>
cmp    $0xffffffff,%eax
je     15cf <main+0x32f>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
lea    0xbea(%rip),%rsi
call   1140 <fopen@plt>
mov    %rax,%r12
mov    %r14,%rdi
mov    $0x10,%esi
call   1170 <bzero@plt>
xor    %ebx,%ebx
lea    0xbce(%rip),%r13
jmp    14e3 <main+0x243>
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    $0x10,%esi
call   1170 <bzero@plt>
mov    %ebp,%eax
add    %rax,%rbx
mov    %rbx,%rdi
call   1120 <printSize@plt>
cmp    $0x10,%ebp
jne    136d <main+0xcd>
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0x10,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    1379 <main+0xd9>
mov    %eax,%ebp
mov    %r14,%rdi
mov    $0x1,%esi
mov    %eax,%edx
mov    %r12,%rcx
call   11b0 <fwrite@plt>
cmp    %ebp,%eax
jge    14c0 <main+0x220>
mov    %r13,%rdi
call   1130 <error@plt>
jmp    14c0 <main+0x220>
nop
lea    0xbc6(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10c0 <concat@plt>
mov    %rax,%rdi
mov    %r13,%rsi
call   10c0 <concat@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10a0 <send@plt>
cmp    $0xffffffff,%eax
je     15e0 <main+0x340>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r13,%rdi
lea    0xb96(%rip),%rsi
call   1140 <fopen@plt>
test   %rax,%rax
je     1627 <main+0x387>
mov    %rax,%r12
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %r12,%rcx
call   1060 <fread@plt>
test   %eax,%eax
jle    1379 <main+0xd9>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   10a0 <send@plt>
test   %eax,%eax
js     1611 <main+0x371>
mov    %r14,%rdi
mov    $0x10,%esi
call   1170 <bzero@plt>
jmp    1590 <main+0x2f0>
lea    0xaa6(%rip),%rdi
call   1150 <perror@plt>
jmp    1485 <main+0x1e5>
lea    0xa95(%rip),%rdi
call   1150 <perror@plt>
jmp    1561 <main+0x2c1>
lea    0xadd(%rip),%rdi
call   1050 <puts@plt>
xor    %eax,%eax
add    $0x128,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xa64(%rip),%rdi
call   1150 <perror@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    0xa72(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
mov    0x2987(%rip),%rax
mov    (%rax),%edi
lea    0x9ae(%rip),%rsi
call   1110 <fprintf@plt>
mov    $0x1,%edi
call   1190 <exit@plt>
lea    0x9b8(%rip),%rdi
jmp    1618 <main+0x378>
lea    0x9bd(%rip),%rdi
jmp    1618 <main+0x378>
lea    0x9bb(%rip),%rdi
jmp    1618 <main+0x378>

LLVM IR (-O0):
%struct.hostent = type { i64 }
%struct.sockaddr_in = type { i8, %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"Uso: cliente host_address port\0A\00"
@.str.1 = [14 x i8] c"gethostbyname\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [38 x i8] c"Conexi\C3\B3n exitosa al servidor %s:%d.\0A\00"
@.str.5 = [19 x i8] c"Ingrese comandos: \00"
@stdin = global i32 0
@.str.6 = [2 x i8] c" \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [6 x i8] c"traer\00"
@.str.9 = [16 x i8] c"Comando: Traer\0A\00"
@.str.10 = [5 x i8] c"send\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [23 x i8] c"File download failed.\0A\00"
@.str.13 = [21 x i8] c"\0ATransfer complete.\0A\00"
@.str.14 = [6 x i8] c"subir\00"
@.str.15 = [16 x i8] c"Comando: Subir\0A\00"
@.str.16 = [2 x i8] c"r\00"
@.str.17 = [27 x i8] c"ERROR: File %s not found.\0A\00"
@.str.18 = [7 x i8] c"salir\0A\00"
@.str.19 = [25 x i8] c"Cerrando el programa...\0A\00"
@.str.20 = [20 x i8] c"Comando inv\C3\A1lido.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.hostent*
%8 = alloca %struct.sockaddr_in
%9 = alloca i8*
%10 = alloca i32
%11 = alloca [256 x i8]
%12 = alloca i8*
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32*
%16 = alloca [16 x i8]
%17 = alloca i64
%18 = alloca i32
%19 = alloca i32
%20 = alloca i8*
%21 = alloca i32*
%22 = alloca [16 x i8]
%23 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%24 = load i32, i32* %4
%25 = icmp ne i32 %24, 3
br i1 %25, label %26, label %30
26: ; preds = %2
%27 = load i32, i32* @stderr
%28 = call i32 @fprintf(i32 %27, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %2
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 1
%33 = load i8*, i8** %32
store i8* %33, i8** %9
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = call i32 @atoi(i8* %36)
store i32 %37, i32* %10
%38 = load i8**, i8*** %5
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call %struct.hostent* @gethostbyname(i8* %40)
store %struct.hostent* %41, %struct.hostent** %7
%42 = icmp eq %struct.hostent* %41, null
br i1 %42, label %43, label %46
43: ; preds = %30
%44 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%45 = call i32 @exit(i32 1)
unreachable
46: ; preds = %30
%47 = load i32, i32* @AF_INET
%48 = load i32, i32* @SOCK_STREAM
%49 = call i32 @socket(i32 %47, i32 %48, i32 0)
store i32 %49, i32* %6
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %54
51: ; preds = %46
%52 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %46
%55 = load i32, i32* @AF_INET
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 3
store i32 %55, i32* %56
%57 = load i32, i32* %10
%58 = call i32 @htons(i32 %57)
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %58, i32* %59
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%61 = load %struct.hostent*, %struct.hostent** %7
%62 = getelementptr inbounds %struct.hostent, %struct.hostent* %61, i32 0, i32 0
%63 = load i64, i64* %62
%64 = inttoptr i64 %63 to %struct.in_addr*
%65 = bitcast %struct.in_addr* %60 to i8*
%66 = bitcast %struct.in_addr* %64 to i8*
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%68 = call i32 @memset(i8* %67, i8 signext 0, i32 8)
%69 = load i32, i32* %6
%70 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%71 = call i32 @connect(i32 %69, %struct.sockaddr* %70, i32 4)
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %76
73: ; preds = %54
%74 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %54
%77 = load i8*, i8** %9
%78 = load i32, i32* %10
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %77, i32 %78)
br label %80
80: ; preds = %76, %211
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%82 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%83 = call i32 @memset(i8* %82, i8 signext 0, i32 256)
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%85 = load i32, i32* @stdin
%86 = call i32 @fgets(i8* %84, i32 256, i32 %85)
%87 = getelementptr inbounds [256 x i8], [256 x i8]* %11, i64 0, i64 0
%88 = call i8* @strtok(i8* %87, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %88, i8** %12
%89 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
store i8* %89, i8** %13
%90 = load i8*, i8** %12
%91 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %90)
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %150
93: ; preds = %80
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.9, i64 0, i64 0))
%95 = load i8*, i8** %12
%96 = call i8* @concat(i8* %95, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %96, i8** %14
%97 = load i8*, i8** %14
%98 = load i8*, i8** %13
%99 = call i8* @concat(i8* %97, i8* %98)
store i8* %99, i8** %14
%100 = load i32, i32* %6
%101 = load i8*, i8** %14
%102 = load i8*, i8** %14
%103 = call i32 @strlen(i8* %102)
%104 = call i32 @send(i32 %100, i8* %101, i32 %103, i32 0)
%105 = icmp eq i32 %104, -1
br i1 %105, label %106, label %108
106: ; preds = %93
%107 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %108
108: ; preds = %106, %93
%109 = load i8*, i8** %14
%110 = call i32 @free(i8* %109)
%111 = load i8*, i8** %13
%112 = call i32* @fopen(i8* %111, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
store i32* %112, i32** %15
%113 = getelementptr inbounds [16 x i8], [16 x i8]* %16, i64 0, i64 0
%114 = call i32 @bzero(i8* %113, i32 16)
store i64 0, i64* %17
store i32 0, i32* %18
br label %115
115: ; preds = %146, %108
%116 = load i32, i32* %6
%117 = getelementptr inbounds [16 x i8], [16 x i8]* %16, i64 0, i64 0
%118 = call i32 @recv(i32 %116, i8* %117, i32 16, i32 0)
store i32 %118, i32* %18
%119 = icmp sgt i32 %118, 0
br i1 %119, label %120, label %147
120: ; preds = %115
%121 = getelementptr inbounds [16 x i8], [16 x i8]* %16, i64 0, i64 0
%122 = load i32, i32* %18
%123 = load i32*, i32** %15
%124 = call i32 @fwrite(i8* %121, i32 1, i32 %122, i32* %123)
store i32 %124, i32* %19
%125 = load i32, i32* %19
%126 = load i32, i32* %18
%127 = icmp slt i32 %125, %126
br i1 %127, label %128, label %130
128: ; preds = %120
%129 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %130
130: ; preds = %128, %120
%131 = getelementptr inbounds [16 x i8], [16 x i8]* %16, i64 0, i64 0
%132 = call i32 @bzero(i8* %131, i32 16)
%133 = load i32, i32* %18
%134 = sext i32 %133 to i64
%135 = load i64, i64* %17
%136 = add nsw i64 %135, %134
store i64 %136, i64* %17
%137 = load i64, i64* %17
%138 = call i32 @printSize(i64 %137)
%139 = load i32, i32* %18
%140 = icmp eq i32 %139, 0
br i1 %140, label %144, label %141
141: ; preds = %130
%142 = load i32, i32* %18
%143 = icmp ne i32 %142, 16
br i1 %143, label %144, label %146
144: ; preds = %141, %130
%145 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.13, i64 0, i64 0))
br label %147
146: ; preds = %141
br label %115
147: ; preds = %144, %115
%148 = load i32*, i32** %15
%149 = call i32 @fclose(i32* %148)
br label %211
150: ; preds = %80
%151 = load i8*, i8** %12
%152 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %151)
%153 = icmp eq i64 %152, 0
br i1 %153, label %154, label %201
154: ; preds = %150
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.15, i64 0, i64 0))
%156 = load i8*, i8** %12
%157 = call i8* @concat(i8* %156, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
store i8* %157, i8** %20
%158 = load i8*, i8** %20
%159 = load i8*, i8** %13
%160 = call i8* @concat(i8* %158, i8* %159)
store i8* %160, i8** %20
%161 = load i32, i32* %6
%162 = load i8*, i8** %20
%163 = load i8*, i8** %20
%164 = call i32 @strlen(i8* %163)
%165 = call i32 @send(i32 %161, i8* %162, i32 %164, i32 0)
%166 = icmp eq i32 %165, -1
br i1 %166, label %167, label %169
167: ; preds = %154
%168 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %169
169: ; preds = %167, %154
%170 = load i8*, i8** %20
%171 = call i32 @free(i8* %170)
%172 = load i8*, i8** %13
%173 = call i32* @fopen(i8* %172, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
store i32* %173, i32** %21
%174 = load i32*, i32** %21
%175 = icmp eq i32* %174, null
br i1 %175, label %176, label %180
176: ; preds = %169
%177 = load i8*, i8** %13
%178 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.17, i64 0, i64 0), i8* %177)
%179 = call i32 @exit(i32 1)
unreachable
180: ; preds = %169
store i32 0, i32* %23
br label %181
181: ; preds = %195, %180
%182 = getelementptr inbounds [16 x i8], [16 x i8]* %22, i64 0, i64 0
%183 = load i32*, i32** %21
%184 = call i32 @fread(i8* %182, i32 1, i32 16, i32* %183)
store i32 %184, i32* %23
%185 = icmp sgt i32 %184, 0
br i1 %185, label %186, label %198
186: ; preds = %181
%187 = load i32, i32* %6
%188 = getelementptr inbounds [16 x i8], [16 x i8]* %22, i64 0, i64 0
%189 = load i32, i32* %23
%190 = call i32 @send(i32 %187, i8* %188, i32 %189, i32 0)
%191 = icmp slt i32 %190, 0
br i1 %191, label %192, label %195
192: ; preds = %186
%193 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%194 = call i32 @exit(i32 1)
unreachable
195: ; preds = %186
%196 = getelementptr inbounds [16 x i8], [16 x i8]* %22, i64 0, i64 0
%197 = call i32 @bzero(i8* %196, i32 16)
br label %181
198: ; preds = %181
%199 = load i32*, i32** %21
%200 = call i32 @fclose(i32* %199)
br label %210
201: ; preds = %150
%202 = load i8*, i8** %12
%203 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i8* %202)
%204 = icmp eq i64 %203, 0
br i1 %204, label %205, label %207
205: ; preds = %201
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.19, i64 0, i64 0))
ret i32 0
207: ; preds = %201
%208 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.20, i64 0, i64 0))
br label %209
209: ; preds = %207
br label %210
210: ; preds = %209, %198
br label %211
211: ; preds = %210, %147
br label %80
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i8, %struct.in_addr, i32, i32 }
%struct.in_addr = type { i32 }
%struct.hostent = type { i64 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [32 x i8] c"Uso: cliente host_address port\0A\00"
@.str.1 = [14 x i8] c"gethostbyname\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [7 x i8] c"socket\00"
@.str.3 = [8 x i8] c"connect\00"
@.str.4 = [38 x i8] c"Conexi\C3\B3n exitosa al servidor %s:%d.\0A\00"
@.str.5 = [19 x i8] c"Ingrese comandos: \00"
@stdin = global i32 0
@.str.6 = [2 x i8] c" \00"
@.str.7 = [2 x i8] c"\0A\00"
@.str.8 = [6 x i8] c"traer\00"
@.str.10 = [5 x i8] c"send\00"
@.str.11 = [2 x i8] c"w\00"
@.str.12 = [23 x i8] c"File download failed.\0A\00"
@.str.14 = [6 x i8] c"subir\00"
@.str.16 = [2 x i8] c"r\00"
@.str.17 = [27 x i8] c"ERROR: File %s not found.\0A\00"
@.str.18 = [7 x i8] c"salir\0A\00"
@str = [19 x i8] c"Comando inv\C3\A1lido.\00"
@str.21 = [24 x i8] c"Cerrando el programa...\00"
@str.22 = [15 x i8] c"Comando: Subir\00"
@str.23 = [15 x i8] c"Comando: Traer\00"
@str.24 = [20 x i8] c"\0ATransfer complete.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [256 x i8]
%5 = alloca [16 x i8]
%6 = alloca [16 x i8]
%7 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%8 = icmp eq i32 %0, 3
br i1 %8, label %13, label %9
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = tail call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0))
%12 = tail call i32 @exit(i32 1)
unreachable
13: ; preds = %2
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = tail call i32 @atoi(i8* %17)
%19 = tail call %struct.hostent* @gethostbyname(i8* %15)
%20 = icmp eq %struct.hostent* %19, null
br i1 %20, label %21, label %24
21: ; preds = %13
%22 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%23 = tail call i32 @exit(i32 1)
unreachable
24: ; preds = %13
%25 = load i32, i32* @AF_INET
%26 = load i32, i32* @SOCK_STREAM
%27 = tail call i32 @socket(i32 %25, i32 %26, i32 0)
%28 = icmp eq i32 %27, -1
br i1 %28, label %29, label %32
29: ; preds = %24
%30 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
%31 = tail call i32 @exit(i32 1)
unreachable
32: ; preds = %24
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 %33, i32* %34
%35 = tail call i32 @htons(i32 %18)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %35, i32* %36
%37 = getelementptr inbounds %struct.hostent, %struct.hostent* %19, i64 0, i32 0
%38 = load i64, i64* %37
%39 = inttoptr i64 %38 to i32*
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%41 = load i32, i32* %39
store i32 %41, i32* %40
%42 = call i32 @memset(i8* %7, i8 signext 0, i32 8)
%43 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%44 = call i32 @connect(i32 %27, %struct.sockaddr* %43, i32 4)
%45 = icmp eq i32 %44, -1
br i1 %45, label %46, label %49
46: ; preds = %32
%47 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.3, i64 0, i64 0))
%48 = call i32 @exit(i32 1)
unreachable
49: ; preds = %32
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0), i8* %15, i32 %18)
%51 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%52 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%53 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
br label %54
54: ; preds = %130, %49
%55 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
%56 = call i32 @memset(i8* %51, i8 signext 0, i32 256)
%57 = load i32, i32* @stdin
%58 = call i32 @fgets(i8* %51, i32 256, i32 %57)
%59 = call i8* @strtok(i8* %51, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%60 = call i8* @strtok(i8* null, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.7, i64 0, i64 0))
%61 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i8* %59)
%62 = icmp eq i64 %61, 0
br i1 %62, label %63, label %95
63: ; preds = %54
%64 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.23, i64 0, i64 0))
%65 = call i8* @concat(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%66 = call i8* @concat(i8* %65, i8* %60)
%67 = call i32 @strlen(i8* %66)
%68 = call i32 @send(i32 %27, i8* %66, i32 %67, i32 0)
%69 = icmp eq i32 %68, -1
br i1 %69, label %70, label %72
70: ; preds = %63
%71 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %72
72: ; preds = %70, %63
%73 = call i32 @free(i8* %66)
%74 = call i32* @fopen(i8* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.11, i64 0, i64 0))
%75 = call i32 @bzero(i8* %53, i32 16)
br label %76
76: ; preds = %85, %72
%77 = phi i64 [ 0, %72 ], [ %88, %85 ]
%78 = call i32 @recv(i32 %27, i8* %53, i32 16, i32 0)
%79 = icmp sgt i32 %78, 0
br i1 %79, label %80, label %93
80: ; preds = %76
%81 = call i32 @fwrite(i8* %53, i32 1, i32 %78, i32* %74)
%82 = icmp slt i32 %81, %78
br i1 %82, label %83, label %85
83: ; preds = %80
%84 = call i32 @error(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.12, i64 0, i64 0))
br label %85
85: ; preds = %83, %80
%86 = call i32 @bzero(i8* %53, i32 16)
%87 = zext i32 %78 to i64
%88 = add nuw nsw i64 %77, %87
%89 = call i32 @printSize(i64 %88)
%90 = icmp eq i32 %78, 16
br i1 %90, label %76, label %91
91: ; preds = %85
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @str.24, i64 0, i64 0))
br label %93
93: ; preds = %76, %91
%94 = call i32 @fclose(i32* %74)
br label %130
95: ; preds = %54
%96 = call i64 @strcmp(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i8* %59)
%97 = icmp eq i64 %96, 0
br i1 %97, label %98, label %131
98: ; preds = %95
%99 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.22, i64 0, i64 0))
%100 = call i8* @concat(i8* %59, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.6, i64 0, i64 0))
%101 = call i8* @concat(i8* %100, i8* %60)
%102 = call i32 @strlen(i8* %101)
%103 = call i32 @send(i32 %27, i8* %101, i32 %102, i32 0)
%104 = icmp eq i32 %103, -1
br i1 %104, label %105, label %107
105: ; preds = %98
%106 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %107
107: ; preds = %105, %98
%108 = call i32 @free(i8* %101)
%109 = call i32* @fopen(i8* %60, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.16, i64 0, i64 0))
%110 = icmp eq i32* %109, null
br i1 %110, label %111, label %114
111: ; preds = %107
%112 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.17, i64 0, i64 0), i8* %60)
%113 = call i32 @exit(i32 1)
unreachable
114: ; preds = %107
%115 = call i32 @fread(i8* %52, i32 1, i32 16, i32* %109)
%116 = icmp sgt i32 %115, 0
br i1 %116, label %117, label %128
117: ; preds = %114, %124
%118 = phi i32 [ %126, %124 ], [ %115, %114 ]
%119 = call i32 @send(i32 %27, i8* %52, i32 %118, i32 0)
%120 = icmp slt i32 %119, 0
br i1 %120, label %121, label %124
121: ; preds = %117
%122 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
%123 = call i32 @exit(i32 1)
unreachable
124: ; preds = %117
%125 = call i32 @bzero(i8* %52, i32 16)
%126 = call i32 @fread(i8* %52, i32 1, i32 16, i32* %109)
%127 = icmp sgt i32 %126, 0
br i1 %127, label %117, label %128
128: ; preds = %124, %114
%129 = call i32 @fclose(i32* %109)
br label %130
130: ; preds = %128, %136, %93
br label %54
131: ; preds = %95
%132 = call i64 @strcmp(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.18, i64 0, i64 0), i8* %59)
%133 = icmp eq i64 %132, 0
br i1 %133, label %134, label %136
134: ; preds = %131
%135 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.21, i64 0, i64 0))
ret i32 0
136: ; preds = %131
%137 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %130
}