#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*/ stSockAddr;
typedef int /*<<< orphan*/ mensaje;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ feof(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
scalar_t__ inet_ntoa(int /*<<< orphan*/);
int inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ read(int, char *, int);
int send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  struct sockaddr_in stSockAddr;
  int sockLen;
  int Res;
  int SocketFD;
  int recibido;
  char buffer[1];
  char mensaje[80];
  int totalBytesRcvd;
  int bytesRcvd;
  FILE *archivo;
  if (argc < 3) {
    perror("USO:./clientFiles <archivo a enviar> <direccionIP del servidor>");
    exit(EXIT_FAILURE);
  }
  archivo = fopen(argv[1], "rb");
  SocketFD = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (!archivo) {
    perror("Error al abrir el archivo:");
    exit(EXIT_FAILURE);
  }
  if (SocketFD == -1) {
    perror("cannot create socket");
    exit(EXIT_FAILURE);
  }
  memset(&stSockAddr, 0, sizeof stSockAddr);
  stSockAddr.sin_family = AF_INET;
  stSockAddr.sin_port = htons(1100);
  Res = inet_pton(AF_INET, argv[2], &stSockAddr.sin_addr);
  sockLen = sizeof(stSockAddr);
  if (0 > Res) {
    perror("error: El primer paránmetro no es una familia de direcciónes");
    close(SocketFD);
    exit(EXIT_FAILURE);
  } else if (Res == 0) {
    perror(
        "char string (El segundo parmetro no contiene una dirección IP válida");
    close(SocketFD);
    exit(EXIT_FAILURE);
  }
  if (connect(SocketFD, (struct sockaddr *)&stSockAddr, sizeof stSockAddr) ==
      -1) {
    perror("Error a la hora de conectarse con el cliente");
    close(SocketFD);
    exit(EXIT_FAILURE);
  }
  printf("Se ha conectado con el servidor:%s\n",
         (char *)inet_ntoa(stSockAddr.sin_addr));
  while (!feof(archivo)) {
    fread(buffer, sizeof(char), 1, archivo);
    if (send(SocketFD, buffer, 1, 0) == -1)
      perror("Error al enviar el arvhivo:");
  }
  read(SocketFD, mensaje, sizeof(mensaje));
  printf("\nConfirmación recibida:\n%s\n", mensaje);
  read(SocketFD, mensaje, sizeof(mensaje));
  printf("\nMD5SUM:\n%s\n", mensaje);
  fclose(archivo);
  close(SocketFD);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    123d <main+0x3d>
lea    0xdd6(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d8a(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdf4(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,-0xa0(%rbp)
mov    0x2d69(%rip),%rax
mov    (%rax),%edi
mov    0x2d68(%rip),%rax
mov    (%rax),%esi
mov    0x2d6f(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0xa0(%rbp)
jne    12a3 <main+0xa3>
lea    0xdb3(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d24(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
cmpl   $0xffffffff,-0x2c(%rbp)
jne    12c7 <main+0xc7>
lea    0xdaa(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2d00(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x44c,%edi
call   1060 <htons@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2cf1(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
lea    -0x20(%rbp),%rdx
call   10d0 <inet_pton@plt>
mov    %eax,-0x28(%rbp)
movl   $0xc,-0x24(%rbp)
xor    %eax,%eax
cmp    -0x28(%rbp),%eax
jle    1341 <main+0x141>
lea    0xd4d(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
mov    0x2c86(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
cmpl   $0x0,-0x28(%rbp)
jne    136d <main+0x16d>
lea    0xd60(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
mov    0x2c5a(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
jmp    1372 <main+0x172>
mov    -0x2c(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   1110 <connect@plt>
cmp    $0xffffffff,%eax
jne    13ae <main+0x1ae>
lea    0xd66(%rip),%rdi
call   10f0 <perror@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
mov    0x2c19(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xd66(%rip),%rdi
call   1080 <printf@plt>
mov    -0xa0(%rbp),%rdi
call   10c0 <feof@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    13e6 <main+0x1e6>
jmp    142a <main+0x22a>
lea    -0x31(%rbp),%rdi
mov    -0xa0(%rbp),%rcx
mov    $0x1,%edx
mov    %edx,%esi
call   1030 <fread@plt>
mov    -0x2c(%rbp),%edi
lea    -0x31(%rbp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
jne    1425 <main+0x225>
lea    0xd2a(%rip),%rdi
call   10f0 <perror@plt>
jmp    13c5 <main+0x1c5>
mov    -0x2c(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x50,%edx
call   10b0 <read@plt>
lea    -0x90(%rbp),%rsi
lea    0xd1a(%rip),%rdi
call   1080 <printf@plt>
mov    -0x2c(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0x50,%edx
call   10b0 <read@plt>
lea    -0x90(%rbp),%rsi
lea    0xd10(%rip),%rdi
call   1080 <printf@plt>
mov    -0xa0(%rbp),%rdi
call   1050 <fclose@plt>
mov    -0x2c(%rbp),%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
cmp    $0x2,%edi
jle    13a6 <main+0x1a6>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xe1d(%rip),%rsi
call   10e0 <fopen@plt>
mov    %rax,%rbx
mov    0x2d96(%rip),%rax
mov    (%rax),%edi
mov    0x2d95(%rip),%rax
mov    (%rax),%esi
mov    0x2d9c(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
test   %rbx,%rbx
je     13af <main+0x1af>
mov    %eax,%r15d
cmp    $0xffffffff,%eax
je     13b8 <main+0x1b8>
lea    0x10(%rsp),%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d6d(%rip),%rbp
mov    0x0(%rbp),%eax
mov    %eax,0x18(%rsp)
mov    $0x44c,%edi
call   1060 <htons@plt>
mov    %eax,0x14(%rsp)
mov    0x0(%rbp),%edi
mov    0x10(%r14),%rsi
mov    %r12,%rdx
call   10d0 <inet_pton@plt>
test   %eax,%eax
js     13c6 <main+0x1c6>
je     13cf <main+0x1cf>
lea    0x10(%rsp),%rsi
mov    %r15d,%edi
mov    $0xc,%edx
call   1110 <connect@plt>
cmp    $0xffffffff,%eax
je     13d8 <main+0x1d8>
mov    0x10(%rsp),%edi
call   1040 <inet_ntoa@plt>
lea    0xe4e(%rip),%rdi
mov    %rax,%rsi
call   1080 <printf@plt>
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
je     134e <main+0x14e>
lea    0x20(%rsp),%rbp
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x50,%edx
call   10b0 <read@plt>
lea    0xe5e(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x50,%edx
call   10b0 <read@plt>
lea    0xe5c(%rip),%rdi
mov    %rbp,%rsi
call   1080 <printf@plt>
mov    %rbx,%rdi
call   1050 <fclose@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xf(%rsp),%rbp
lea    0xdf0(%rip),%r14
jmp    1370 <main+0x170>
nopl   0x0(%rax)
mov    %rbx,%rdi
call   10c0 <feof@plt>
test   %eax,%eax
jne    12ec <main+0xec>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fread@plt>
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0xffffffff,%eax
jne    1360 <main+0x160>
mov    %r14,%rdi
call   10f0 <perror@plt>
jmp    1360 <main+0x160>
lea    0xc53(%rip),%rdi
jmp    13bf <main+0x1bf>
lea    0xc8d(%rip),%rdi
jmp    13bf <main+0x1bf>
lea    0xc9f(%rip),%rdi
call   10f0 <perror@plt>
jmp    13ec <main+0x1ec>
lea    0xca6(%rip),%rdi
jmp    13df <main+0x1df>
lea    0xcdc(%rip),%rdi
jmp    13df <main+0x1df>
lea    0xd1a(%rip),%rdi
call   10f0 <perror@plt>
mov    %r15d,%edi
call   10a0 <close@plt>
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [64 x i8] c"USO:./clientFiles <archivo a enviar> <direccionIP del servidor>\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [27 x i8] c"Error al abrir el archivo:\00"
@.str.3 = [21 x i8] c"cannot create socket\00"
@AF_INET = global i32 0
@.str.4 = [63 x i8] c"error: El primer par\C3\A1nmetro no es una familia de direcci\C3\B3nes\00"
@.str.5 = [71 x i8] c"char string (El segundo parmetro no contiene una direcci\C3\B3n IP v\C3\A1lida\00"
@.str.6 = [45 x i8] c"Error a la hora de conectarse con el cliente\00"
@.str.7 = [36 x i8] c"Se ha conectado con el servidor:%s\0A\00"
@.str.8 = [28 x i8] c"Error al enviar el arvhivo:\00"
@.str.9 = [29 x i8] c"\0AConfirmaci\C3\B3n recibida:\0A%s\0A\00"
@.str.10 = [13 x i8] c"\0AMD5SUM:\0A%s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca %struct.sockaddr_in
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [1 x i8]
%12 = alloca [80 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%16 = load i32, i32* %4
%17 = icmp slt i32 %16, 3
br i1 %17, label %18, label %22
18: ; preds = %2
%19 = call i32 @perror(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%20 = load i32, i32* @EXIT_FAILURE
%21 = call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32* @fopen(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %26, i32** %15
%27 = load i32, i32* @PF_INET
%28 = load i32, i32* @SOCK_STREAM
%29 = load i32, i32* @IPPROTO_TCP
%30 = call i32 @socket(i32 %27, i32 %28, i32 %29)
store i32 %30, i32* %9
%31 = load i32*, i32** %15
%32 = icmp ne i32* %31, null
br i1 %32, label %37, label %33
33: ; preds = %22
%34 = call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%35 = load i32, i32* @EXIT_FAILURE
%36 = call i32 @exit(i32 %35)
unreachable
37: ; preds = %22
%38 = load i32, i32* %9
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %44
40: ; preds = %37
%41 = call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%42 = load i32, i32* @EXIT_FAILURE
%43 = call i32 @exit(i32 %42)
unreachable
44: ; preds = %37
%45 = call i32 @memset(%struct.sockaddr_in* %6, i32 0, i32 12)
%46 = load i32, i32* @AF_INET
%47 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %46, i32* %47
%48 = call i32 @htons(i32 1100)
%49 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
store i32 %48, i32* %49
%50 = load i32, i32* @AF_INET
%51 = load i8**, i8*** %5
%52 = getelementptr inbounds i8*, i8** %51, i64 2
%53 = load i8*, i8** %52
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%55 = call i32 @inet_pton(i32 %50, i8* %53, i32* %54)
store i32 %55, i32* %8
store i32 12, i32* %7
%56 = load i32, i32* %8
%57 = icmp sgt i32 0, %56
br i1 %57, label %58, label %64
58: ; preds = %44
%59 = call i32 @perror(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
%60 = load i32, i32* %9
%61 = call i32 @close(i32 %60)
%62 = load i32, i32* @EXIT_FAILURE
%63 = call i32 @exit(i32 %62)
unreachable
64: ; preds = %44
%65 = load i32, i32* %8
%66 = icmp eq i32 %65, 0
br i1 %66, label %67, label %73
67: ; preds = %64
%68 = call i32 @perror(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0))
%69 = load i32, i32* %9
%70 = call i32 @close(i32 %69)
%71 = load i32, i32* @EXIT_FAILURE
%72 = call i32 @exit(i32 %71)
unreachable
73: ; preds = %64
br label %74
74: ; preds = %73
%75 = load i32, i32* %9
%76 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%77 = call i32 @connect(i32 %75, %struct.sockaddr* %76, i32 12)
%78 = icmp eq i32 %77, -1
br i1 %78, label %79, label %85
79: ; preds = %74
%80 = call i32 @perror(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%81 = load i32, i32* %9
%82 = call i32 @close(i32 %81)
%83 = load i32, i32* @EXIT_FAILURE
%84 = call i32 @exit(i32 %83)
unreachable
85: ; preds = %74
%86 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%87 = load i32, i32* %86
%88 = call i64 @inet_ntoa(i32 %87)
%89 = inttoptr i64 %88 to i8*
%90 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %89)
br label %91
91: ; preds = %106, %85
%92 = load i32*, i32** %15
%93 = call i32 @feof(i32* %92)
%94 = icmp ne i32 %93, 0
%95 = xor i1 %94, true
br i1 %95, label %96, label %107
96: ; preds = %91
%97 = getelementptr inbounds [1 x i8], [1 x i8]* %11, i64 0, i64 0
%98 = load i32*, i32** %15
%99 = call i32 @fread(i8* %97, i32 1, i32 1, i32* %98)
%100 = load i32, i32* %9
%101 = getelementptr inbounds [1 x i8], [1 x i8]* %11, i64 0, i64 0
%102 = call i32 @send(i32 %100, i8* %101, i32 1, i32 0)
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %106
104: ; preds = %96
%105 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %106
106: ; preds = %104, %96
br label %91
107: ; preds = %91
%108 = load i32, i32* %9
%109 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%110 = call i32 @read(i32 %108, i8* %109, i32 80)
%111 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%112 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %111)
%113 = load i32, i32* %9
%114 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%115 = call i32 @read(i32 %113, i8* %114, i32 80)
%116 = getelementptr inbounds [80 x i8], [80 x i8]* %12, i64 0, i64 0
%117 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %116)
%118 = load i32*, i32** %15
%119 = call i32 @fclose(i32* %118)
%120 = load i32, i32* %9
%121 = call i32 @close(i32 %120)
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [64 x i8] c"USO:./clientFiles <archivo a enviar> <direccionIP del servidor>\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [3 x i8] c"rb\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [27 x i8] c"Error al abrir el archivo:\00"
@.str.3 = [21 x i8] c"cannot create socket\00"
@AF_INET = global i32 0
@.str.4 = [63 x i8] c"error: El primer par\C3\A1nmetro no es una familia de direcci\C3\B3nes\00"
@.str.5 = [71 x i8] c"char string (El segundo parmetro no contiene una direcci\C3\B3n IP v\C3\A1lida\00"
@.str.6 = [45 x i8] c"Error a la hora de conectarse con el cliente\00"
@.str.7 = [36 x i8] c"Se ha conectado con el servidor:%s\0A\00"
@.str.8 = [28 x i8] c"Error al enviar el arvhivo:\00"
@.str.9 = [29 x i8] c"\0AConfirmaci\C3\B3n recibida:\0A%s\0A\00"
@.str.10 = [13 x i8] c"\0AMD5SUM:\0A%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca [1 x i8]
%5 = alloca [80 x i8]
%6 = bitcast %struct.sockaddr_in* %3 to i8*
%7 = getelementptr inbounds [1 x i8], [1 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [80 x i8], [80 x i8]* %5, i64 0, i64 0
%9 = icmp slt i32 %0, 3
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = tail call i32 @perror(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* @EXIT_FAILURE
%13 = tail call i32 @exit(i32 %12)
unreachable
14: ; preds = %2
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = tail call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%18 = load i32, i32* @PF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = load i32, i32* @IPPROTO_TCP
%21 = tail call i32 @socket(i32 %18, i32 %19, i32 %20)
%22 = icmp eq i32* %17, null
br i1 %22, label %23, label %27
23: ; preds = %14
%24 = tail call i32 @perror(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = tail call i32 @exit(i32 %25)
unreachable
27: ; preds = %14
%28 = icmp eq i32 %21, -1
br i1 %28, label %29, label %33
29: ; preds = %27
%30 = tail call i32 @perror(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%31 = load i32, i32* @EXIT_FAILURE
%32 = tail call i32 @exit(i32 %31)
unreachable
33: ; preds = %27
%34 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%35 = load i32, i32* @AF_INET
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %35, i32* %36
%37 = call i32 @htons(i32 1100)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
store i32 %37, i32* %38
%39 = load i32, i32* @AF_INET
%40 = getelementptr inbounds i8*, i8** %1, i64 2
%41 = load i8*, i8** %40
%42 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%43 = call i32 @inet_pton(i32 %39, i8* %41, i32* %42)
%44 = icmp slt i32 %43, 0
br i1 %44, label %45, label %50
45: ; preds = %33
%46 = call i32 @perror(i8* getelementptr inbounds ([63 x i8], [63 x i8]* @.str.4, i64 0, i64 0))
%47 = call i32 @close(i32 %21)
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %33
%51 = icmp eq i32 %43, 0
br i1 %51, label %52, label %57
52: ; preds = %50
%53 = call i32 @perror(i8* getelementptr inbounds ([71 x i8], [71 x i8]* @.str.5, i64 0, i64 0))
%54 = call i32 @close(i32 %21)
%55 = load i32, i32* @EXIT_FAILURE
%56 = call i32 @exit(i32 %55)
unreachable
57: ; preds = %50
%58 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%59 = call i32 @connect(i32 %21, %struct.sockaddr* %58, i32 12)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = call i32 @perror(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.6, i64 0, i64 0))
%63 = call i32 @close(i32 %21)
%64 = load i32, i32* @EXIT_FAILURE
%65 = call i32 @exit(i32 %64)
unreachable
66: ; preds = %57
%67 = load i32, i32* %42
%68 = call i64 @inet_ntoa(i32 %67)
%69 = inttoptr i64 %68 to i8*
%70 = call i32 @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0), i8* %69)
%71 = call i32 @feof(i32* %17)
%72 = icmp eq i32 %71, 0
br i1 %72, label %73, label %82
73: ; preds = %66, %79
%74 = call i32 @fread(i8* %7, i32 1, i32 1, i32* %17)
%75 = call i32 @send(i32 %21, i8* %7, i32 1, i32 0)
%76 = icmp eq i32 %75, -1
br i1 %76, label %77, label %79
77: ; preds = %73
%78 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.8, i64 0, i64 0))
br label %79
79: ; preds = %77, %73
%80 = call i32 @feof(i32* %17)
%81 = icmp eq i32 %80, 0
br i1 %81, label %73, label %82
82: ; preds = %79, %66
%83 = call i32 @read(i32 %21, i8* %8, i32 80)
%84 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.9, i64 0, i64 0), i8* %8)
%85 = call i32 @read(i32 %21, i8* %8, i32 80)
%86 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0), i8* %8)
%87 = call i32 @fclose(i32* %17)
%88 = call i32 @close(i32 %21)
ret i32 0
}