#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;
};

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int O_APPEND;
int O_CREAT;
int O_WRONLY;
int /*<<< orphan*/ SOCK_STREAM;
scalar_t__ calloc(int, int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int open(char *, int, int);
int /*<<< orphan*/ printf(char *, ...);
unsigned int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int write(int, char *, unsigned int);
int main(int argc, char *argv[]) {
  int fd;
  int outcriptor, writer;
  struct hostent *rec;
  struct sockaddr_in servidor;
  int recHi = 0;
  char *blockB;
  unsigned int sizebytes;
  blockB = (char *)calloc(1024, sizeof(char));
  if (argc != 2) {
    printf("\n[*]Uso: %s <SERVER IP>\n", argv[0]);
    exit(-1);
  }
  if ((rec = gethostbyname(argv[1])) == NULL) {
    printf("\nError con el gethostbyname\n");
    exit(-1);
  }
  if ((fd = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    printf("\nError con la creacion del socket\n");
    exit(-1);
  }
  servidor.sin_family = AF_INET;
  servidor.sin_port = htons(9999);
  servidor.sin_addr = *((struct in_addr *)rec->h_addr);
  memset(servidor.sin_zero, 0, 8);
  if (connect(fd, (struct sockaddr *)&servidor, sizeof(struct sockaddr)) ==
      -1) {
    printf("\nError intentar conectar\n");
    exit(-1);
  }
  while (!recHi) {
    sizebytes = recv(fd, blockB, 1024, 0);
    if (sizebytes < 0) {
      printf("\nError al recibir la respuesta del servidor\n");
      exit(-1);
    } else if (sizebytes > 0) {
      *(blockB + sizebytes) = '\0';
      outcriptor = open("doc.htm", O_WRONLY | O_CREAT | O_APPEND, 0666);
      if (outcriptor < 0) {
        printf("\nError al crear el archivo de destino\n");
        exit(-1);
      }
      writer = write(outcriptor, blockB, sizebytes);
      if (writer < 0) {
        printf("\nError al escribir en el archivo\n");
        exit(-1);
      }
      memset(blockB, 0, 1024);
    } else {
      printf("\n[*] Se ha escrito correctamente el archivo\n");
      recHi = 1;
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x44(%rbp)
mov    $0x400,%edi
mov    $0x1,%esi
call   1080 <calloc@plt>
mov    %rax,-0x50(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1209 <main+0x59>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe08(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1090 <gethostbyname@plt>
mov    %rax,-0x28(%rbp)
cmp    $0x0,%rax
jne    123c <main+0x8c>
lea    0xdee(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d9d(%rip),%rax
mov    (%rax),%edi
mov    0x2d84(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10d0 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1279 <main+0xc9>
lea    0xdce(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    0x2d60(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x30(%rbp)
mov    $0x270f,%edi
call   1050 <htons@plt>
mov    %eax,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    (%rax),%rax
mov    (%rax),%eax
mov    %eax,-0x38(%rbp)
mov    -0x40(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1070 <memset@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   10c0 <connect@plt>
cmp    $0xffffffff,%eax
jne    12e0 <main+0x130>
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
jmp    12e5 <main+0x135>
cmpl   $0x0,-0x44(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    12fb <main+0x14b>
jmp    1401 <main+0x251>
mov    -0x14(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x54(%rbp)
cmpl   $0x0,-0x54(%rbp)
jae    1333 <main+0x183>
lea    0xd51(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
cmpl   $0x0,-0x54(%rbp)
jbe    13e2 <main+0x232>
mov    -0x50(%rbp),%rax
mov    -0x54(%rbp),%ecx
movb   $0x0,(%rax,%rcx,1)
mov    0x2c71(%rip),%rax
mov    (%rax),%esi
mov    0x2ca0(%rip),%rax
or     (%rax),%esi
mov    0x2c57(%rip),%rax
or     (%rax),%esi
lea    0xd36(%rip),%rdi
mov    $0x1b6,%edx
call   10a0 <open@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    1399 <main+0x1e9>
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x18(%rbp),%edi
mov    -0x50(%rbp),%rsi
mov    -0x54(%rbp),%edx
call   1040 <write@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    13cd <main+0x21d>
lea    0xd13(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   10b0 <exit@plt>
mov    -0x50(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
jmp    13f7 <main+0x247>
lea    0xd08(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x44(%rbp)
jmp    13fc <main+0x24c>
jmp    12e5 <main+0x135>
mov    -0x4(%rbp),%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0x400,%edi
mov    $0x1,%esi
call   1090 <calloc@plt>
cmp    $0x2,%ebp
jne    133b <main+0x17b>
mov    %rax,%rbx
mov    0x8(%r14),%rdi
call   10a0 <gethostbyname@plt>
test   %rax,%rax
je     1356 <main+0x196>
mov    %rax,%rbp
mov    0x2dd6(%rip),%r14
mov    (%r14),%edi
mov    0x2dbc(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   10e0 <socket@plt>
cmp    $0xffffffff,%eax
je     135f <main+0x19f>
mov    %eax,%r15d
mov    (%r14),%eax
mov    %eax,0x10(%rsp)
mov    $0x270f,%edi
call   1060 <htons@plt>
mov    %eax,0xc(%rsp)
mov    0x0(%rbp),%rax
mov    (%rax),%eax
mov    %eax,0x8(%rsp)
xor    %esi,%esi
mov    $0x8,%edx
call   1080 <memset@plt>
mov    %rsp,%rsi
mov    %r15d,%edi
mov    $0x4,%edx
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
je     1368 <main+0x1a8>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
je     12ff <main+0x13f>
mov    %eax,%ebp
mov    0x2d6c(%rip),%r13
mov    0x2d25(%rip),%r12
lea    0xd7f(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    %ebp,%eax
movb   $0x0,(%rbx,%rax,1)
mov    0x0(%r13),%esi
mov    0x2d0f(%rip),%rax
or     (%rax),%esi
or     (%r12),%esi
mov    %r14,%rdi
mov    $0x1b6,%edx
call   10b0 <open@plt>
test   %eax,%eax
js     131c <main+0x15c>
mov    %eax,%edi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1050 <write@plt>
test   %eax,%eax
js     1325 <main+0x165>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%ebp
test   %eax,%eax
jne    12a0 <main+0xe0>
lea    0xd1b(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xd4b(%rip),%rdi
jmp    132c <main+0x16c>
lea    0xd21(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
mov    (%r14),%rsi
lea    0xcbb(%rip),%rdi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0xffffffff,%edi
call   10c0 <exit@plt>
lea    0xd72(%rip),%rdi
jmp    132c <main+0x16c>
lea    0xd47(%rip),%rdi
jmp    132c <main+0x16c>
lea    0xd25(%rip),%rdi
jmp    132c <main+0x16c>

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 }
@.str = [25 x i8] c"\0A[*]Uso: %s <SERVER IP>\0A\00"
@.str.1 = [29 x i8] c"\0AError con el gethostbyname\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.2 = [35 x i8] c"\0AError con la creacion del socket\0A\00"
@.str.3 = [26 x i8] c"\0AError intentar conectar\0A\00"
@.str.4 = [45 x i8] c"\0AError al recibir la respuesta del servidor\0A\00"
@.str.5 = [8 x i8] c"doc.htm\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_APPEND = global i32 0
@.str.6 = [39 x i8] c"\0AError al crear el archivo de destino\0A\00"
@.str.7 = [34 x i8] c"\0AError al escribir en el archivo\0A\00"
@.str.8 = [45 x i8] c"\0A[*] Se ha escrito correctamente el archivo\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 %struct.hostent*
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %11
%14 = call i64 @calloc(i32 1024, i32 1)
%15 = inttoptr i64 %14 to i8*
store i8* %15, i8** %12
%16 = load i32, i32* %4
%17 = icmp ne i32 %16, 2
br i1 %17, label %18, label %24
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 0
%21 = load i8*, i8** %20
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %21)
%23 = call i32 @exit(i32 -1)
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call %struct.hostent* @gethostbyname(i8* %27)
store %struct.hostent* %28, %struct.hostent** %9
%29 = icmp eq %struct.hostent* %28, null
br i1 %29, label %30, label %33
30: ; preds = %24
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
%32 = call i32 @exit(i32 -1)
unreachable
33: ; preds = %24
%34 = load i32, i32* @AF_INET
%35 = load i32, i32* @SOCK_STREAM
%36 = call i32 @socket(i32 %34, i32 %35, i32 0)
store i32 %36, i32* %6
%37 = icmp eq i32 %36, -1
br i1 %37, label %38, label %41
38: ; preds = %33
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.2, i64 0, i64 0))
%40 = call i32 @exit(i32 -1)
unreachable
41: ; preds = %33
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 3
store i32 %42, i32* %43
%44 = call i32 @htons(i32 9999)
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %44, i32* %45
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%47 = load %struct.hostent*, %struct.hostent** %9
%48 = getelementptr inbounds %struct.hostent, %struct.hostent* %47, i32 0, i32 0
%49 = load i64, i64* %48
%50 = inttoptr i64 %49 to %struct.in_addr*
%51 = bitcast %struct.in_addr* %46 to i8*
%52 = bitcast %struct.in_addr* %50 to i8*
%53 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%54 = load i8*, i8** %53
%55 = call i32 @memset(i8* %54, i32 0, i32 8)
%56 = load i32, i32* %6
%57 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%58 = call i32 @connect(i32 %56, %struct.sockaddr* %57, i32 4)
%59 = icmp eq i32 %58, -1
br i1 %59, label %60, label %63
60: ; preds = %41
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 @exit(i32 -1)
unreachable
63: ; preds = %41
br label %64
64: ; preds = %112, %63
%65 = load i32, i32* %11
%66 = icmp ne i32 %65, 0
%67 = xor i1 %66, true
br i1 %67, label %68, label %113
68: ; preds = %64
%69 = load i32, i32* %6
%70 = load i8*, i8** %12
%71 = call i32 @recv(i32 %69, i8* %70, i32 1024, i32 0)
store i32 %71, i32* %13
%72 = load i32, i32* %13
%73 = icmp ult i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %68
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.4, i64 0, i64 0))
%76 = call i32 @exit(i32 -1)
unreachable
77: ; preds = %68
%78 = load i32, i32* %13
%79 = icmp ugt i32 %78, 0
br i1 %79, label %80, label %109
80: ; preds = %77
%81 = load i8*, i8** %12
%82 = load i32, i32* %13
%83 = zext i32 %82 to i64
%84 = getelementptr inbounds i8, i8* %81, i64 %83
store i8 0, i8* %84
%85 = load i32, i32* @O_WRONLY
%86 = load i32, i32* @O_CREAT
%87 = or i32 %85, %86
%88 = load i32, i32* @O_APPEND
%89 = or i32 %87, %88
%90 = call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %89, i32 438)
store i32 %90, i32* %7
%91 = load i32, i32* %7
%92 = icmp slt i32 %91, 0
br i1 %92, label %93, label %96
93: ; preds = %80
%94 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.6, i64 0, i64 0))
%95 = call i32 @exit(i32 -1)
unreachable
96: ; preds = %80
%97 = load i32, i32* %7
%98 = load i8*, i8** %12
%99 = load i32, i32* %13
%100 = call i32 @write(i32 %97, i8* %98, i32 %99)
store i32 %100, i32* %8
%101 = load i32, i32* %8
%102 = icmp slt i32 %101, 0
br i1 %102, label %103, label %106
103: ; preds = %96
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.7, i64 0, i64 0))
%105 = call i32 @exit(i32 -1)
unreachable
106: ; preds = %96
%107 = load i8*, i8** %12
%108 = call i32 @memset(i8* %107, i32 0, i32 1024)
br label %111
109: ; preds = %77
%110 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %11
br label %111
111: ; preds = %109, %106
br label %112
112: ; preds = %111
br label %64
113: ; preds = %64
%114 = load i32, i32* %3
ret i32 %114
}

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 }
@.str = [25 x i8] c"\0A[*]Uso: %s <SERVER IP>\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.5 = [8 x i8] c"doc.htm\00"
@O_WRONLY = global i32 0
@O_CREAT = global i32 0
@O_APPEND = global i32 0
@str = [44 x i8] c"\0A[*] Se ha escrito correctamente el archivo\00"
@str.9 = [33 x i8] c"\0AError al escribir en el archivo\00"
@str.10 = [38 x i8] c"\0AError al crear el archivo de destino\00"
@str.11 = [25 x i8] c"\0AError intentar conectar\00"
@str.12 = [34 x i8] c"\0AError con la creacion del socket\00"
@str.13 = [28 x i8] c"\0AError con el gethostbyname\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = bitcast %struct.sockaddr_in* %3 to i8*
%5 = tail call i64 @calloc(i32 1024, i32 1)
%6 = inttoptr i64 %5 to i8*
%7 = icmp eq i32 %0, 2
br i1 %7, label %12, label %8
8: ; preds = %2
%9 = load i8*, i8** %1
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %9)
%11 = tail call i32 @exit(i32 -1)
unreachable
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = tail call %struct.hostent* @gethostbyname(i8* %14)
%16 = icmp eq %struct.hostent* %15, null
br i1 %16, label %17, label %20
17: ; preds = %12
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.13, i64 0, i64 0))
%19 = tail call i32 @exit(i32 -1)
unreachable
20: ; preds = %12
%21 = load i32, i32* @AF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = tail call i32 @socket(i32 %21, i32 %22, i32 0)
%24 = icmp eq i32 %23, -1
br i1 %24, label %25, label %28
25: ; preds = %20
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str.12, i64 0, i64 0))
%27 = tail call i32 @exit(i32 -1)
unreachable
28: ; preds = %20
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 %29, i32* %30
%31 = tail call i32 @htons(i32 9999)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %31, i32* %32
%33 = getelementptr inbounds %struct.hostent, %struct.hostent* %15, i64 0, i32 0
%34 = load i64, i64* %33
%35 = inttoptr i64 %34 to i32*
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
%37 = load i32, i32* %35
store i32 %37, i32* %36
%38 = tail call i32 @memset(i8* undef, i32 0, i32 8)
%39 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%40 = call i32 @connect(i32 %23, %struct.sockaddr* %39, i32 4)
%41 = icmp eq i32 %40, -1
br i1 %41, label %45, label %42
42: ; preds = %28
%43 = call i32 @recv(i32 %23, i8* %6, i32 1024, i32 0)
%44 = icmp eq i32 %43, 0
br i1 %44, label %72, label %48
45: ; preds = %28
%46 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.11, i64 0, i64 0))
%47 = call i32 @exit(i32 -1)
unreachable
48: ; preds = %42, %68
%49 = phi i32 [ %70, %68 ], [ %43, %42 ]
%50 = zext i32 %49 to i64
%51 = getelementptr inbounds i8, i8* %6, i64 %50
store i8 0, i8* %51
%52 = load i32, i32* @O_WRONLY
%53 = load i32, i32* @O_CREAT
%54 = or i32 %53, %52
%55 = load i32, i32* @O_APPEND
%56 = or i32 %54, %55
%57 = call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.5, i64 0, i64 0), i32 %56, i32 438)
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %48
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str.10, i64 0, i64 0))
%61 = call i32 @exit(i32 -1)
unreachable
62: ; preds = %48
%63 = call i32 @write(i32 %57, i8* %6, i32 %49)
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %68
65: ; preds = %62
%66 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @str.9, i64 0, i64 0))
%67 = call i32 @exit(i32 -1)
unreachable
68: ; preds = %62
%69 = call i32 @memset(i8* %6, i32 0, i32 1024)
%70 = call i32 @recv(i32 %23, i8* %6, i32 1024, i32 0)
%71 = icmp eq i32 %70, 0
br i1 %71, label %72, label %48
72: ; preds = %68, %42
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str, i64 0, i64 0))
ret i32 0
}