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

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fwrite(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ printf(char *);
scalar_t__ recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strlen(char *);
void receive_File(char *file, int size, int send_sockfd, int recv_sockfd) {
  char command[1024];
  snprintf(command, 1024, "Accept");
  if (send(send_sockfd, command, strlen(command), 0) < 0) {
    fprintf(stderr, "ERROR: Unable writing on socket!\n");
    return;
  }
  char new_file[1024];
  snprintf(new_file, 1024, "new_");
  strcat(new_file, file);
  FILE *f = fopen(new_file, "wb");
  if (!f) {
    fprintf(stderr, "ERROR: Unable creating new file!\n");
    return;
  }
  int i, no = size / 1024, rest = size % 1024;
  memset(command, 0, 1024);
  for (i = 0; i < no; i++) {
    if (recv(recv_sockfd, command, sizeof(command), 0) <= 0) {
      fprintf(stderr, "ERROR: Unable reading from socket!\n");
      return;
    }
    fwrite(command, 1, 1024, f);
    memset(command, 0, 1024);
    sprintf(command, "Continue");
    if (send(send_sockfd, command, strlen(command), 0) < 0) {
      fprintf(stderr, "ERROR SERVER: Unable writing on socket!\n");
      return;
    }
    memset(command, 0, 1024);
  }
  if (recv(recv_sockfd, command, sizeof(command), 0) <= 0) {
    fprintf(stderr, "ERROR: Unable reading from socket!\n");
    return;
  }
  fwrite(command, 1, rest, f);
  memset(command, 0, 1024);
  sprintf(command, "Done!");
  if (send(send_sockfd, command, strlen(command), 0) < 0) {
    fprintf(stderr, "ERROR SERVER: Unable writing on socket!\n");
    return;
  }
  printf("INFO: File received successfully!\n");
  memset(command, 0, 1024);
  fclose(f);
}


x86 assembly (clang, -O0):
<receive_File>:
push   %rbp
mov    %rsp,%rbp
sub    $0x870,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
lea    -0x420(%rbp),%rdi
mov    $0x400,%esi
lea    0xe15(%rip),%rdx
call   1080 <snprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x844(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x840(%rbp)
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x844(%rbp),%edi
mov    -0x840(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    124d <receive_File+0x8d>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
lea    0xdc4(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
lea    -0x820(%rbp),%rdi
mov    $0x400,%esi
lea    0xdc9(%rip),%rdx
call   1080 <snprintf@plt>
lea    -0x820(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   10c0 <strcat@plt>
lea    -0x820(%rbp),%rdi
lea    0xdab(%rip),%rsi
call   10b0 <fopen@plt>
mov    %rax,-0x828(%rbp)
cmpq   $0x0,-0x828(%rbp)
jne    12b7 <receive_File+0xf7>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
lea    0xd84(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
mov    -0xc(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x830(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %edx,-0x834(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
movl   $0x0,-0x82c(%rbp)
mov    -0x82c(%rbp),%eax
cmp    -0x830(%rbp),%eax
jge    1409 <receive_File+0x249>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jg     1342 <receive_File+0x182>
mov    0x2cb1(%rip),%rax
mov    (%rax),%edi
lea    0xd1b(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
lea    -0x420(%rbp),%rdi
mov    -0x828(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   10e0 <fwrite@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    -0x420(%rbp),%rdi
lea    0xcf7(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x854(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x850(%rbp)
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x854(%rbp),%edi
mov    -0x850(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    13e2 <receive_File+0x222>
mov    0x2c11(%rip),%rax
mov    (%rax),%edi
lea    0xca8(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    -0x82c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x82c(%rbp)
jmp    12f6 <receive_File+0x136>
mov    -0x14(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jg     1443 <receive_File+0x283>
mov    0x2bb0(%rip),%rax
mov    (%rax),%edi
lea    0xc1a(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
lea    -0x420(%rbp),%rdi
mov    -0x834(%rbp),%edx
mov    -0x828(%rbp),%rcx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
lea    -0x420(%rbp),%rdi
lea    0xc27(%rip),%rsi
call   10d0 <sprintf@plt>
mov    -0x10(%rbp),%eax
mov    %eax,-0x864(%rbp)
lea    -0x420(%rbp),%rax
mov    %rax,-0x860(%rbp)
lea    -0x420(%rbp),%rdi
call   1050 <strlen@plt>
mov    -0x864(%rbp),%edi
mov    -0x860(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
cmp    $0x0,%rax
jge    14e4 <receive_File+0x324>
mov    0x2b0f(%rip),%rax
mov    (%rax),%edi
lea    0xba6(%rip),%rsi
call   10a0 <fprintf@plt>
jmp    150f <receive_File+0x34f>
lea    0xbc4(%rip),%rdi
call   1070 <printf@plt>
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    -0x828(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x870,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<receive_File>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x818,%rsp
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %esi,%r14d
mov    %rdi,%rbp
lea    0xe2c(%rip),%rdx
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1080 <snprintf@plt>
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     13bd <receive_File+0x20d>
lea    0xe1c(%rip),%rdx
lea    0x410(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x400,%esi
call   1080 <snprintf@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
call   10c0 <strcat@plt>
lea    0xdfa(%rip),%rsi
mov    %rbx,%rdi
call   10b0 <fopen@plt>
test   %rax,%rax
je     13cf <receive_File+0x21f>
mov    %rax,%r15
lea    0x3ff(%r14),%eax
test   %r14d,%r14d
cmovns %r14d,%eax
mov    %eax,0xc(%rsp)
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
cmp    $0x400,%r14d
jl     131b <receive_File+0x16b>
mov    0xc(%rsp),%ebx
sar    $0xa,%ebx
lea    0x10(%rsp),%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r12d,%edi
mov    %rbp,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    13e1 <receive_File+0x231>
mov    %rbp,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r15,%rcx
call   10d0 <fwrite@plt>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
movabs $0x65756e69746e6f43,%rax
6e 75 65
mov    %rax,0x10(%rsp)
movb   $0x0,0x18(%rsp)
mov    %rbp,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     13f3 <receive_File+0x243>
mov    %rbp,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
add    $0xffffffff,%ebx
jne    1290 <receive_File+0xe0>
lea    0x10(%rsp),%rsi
mov    %r12d,%edi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    13e1 <receive_File+0x231>
mov    0xc(%rsp),%eax
and    $0xfffffc00,%eax
sub    %eax,%r14d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r14d,%edx
mov    %r15,%rcx
call   10d0 <fwrite@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
movl   $0x656e6f44,0x10(%rsp)
65
movw   $0x21,0x14(%rsp)
mov    %rbx,%rdi
call   1060 <strlen@plt>
mov    %r13d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
test   %rax,%rax
js     13f3 <receive_File+0x243>
lea    0xd12(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1090 <memset@plt>
mov    %r15,%rdi
call   1050 <fclose@plt>
jmp    1408 <receive_File+0x258>
mov    0x2c1c(%rip),%rax
mov    (%rax),%edi
lea    0xc3a(%rip),%rsi
jmp    1403 <receive_File+0x253>
mov    0x2c0a(%rip),%rax
mov    (%rax),%edi
lea    0xc52(%rip),%rsi
jmp    1403 <receive_File+0x253>
mov    0x2bf8(%rip),%rax
mov    (%rax),%edi
lea    0xc62(%rip),%rsi
jmp    1403 <receive_File+0x253>
mov    0x2be6(%rip),%rax
mov    (%rax),%edi
lea    0xc7d(%rip),%rsi
call   10a0 <fprintf@plt>
add    $0x818,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"Accept\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"ERROR: Unable writing on socket!\0A\00"
@.str.2 = [5 x i8] c"new_\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [34 x i8] c"ERROR: Unable creating new file!\0A\00"
@.str.5 = [36 x i8] c"ERROR: Unable reading from socket!\0A\00"
@.str.6 = [9 x i8] c"Continue\00"
@.str.7 = [41 x i8] c"ERROR SERVER: Unable writing on socket!\0A\00"
@.str.8 = [6 x i8] c"Done!\00"
@.str.9 = [35 x i8] c"INFO: File received successfully!\0A\00"
define void @receive_File(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
%11 = alloca i32*
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%15 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%16 = call i32 @snprintf(i8* %15, i32 1024, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%17 = load i32, i32* %7
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%20 = call i32 @strlen(i8* %19)
%21 = call i64 @send(i32 %17, i8* %18, i32 %20, i32 0)
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %4
%24 = load i32, i32* @stderr
%25 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %113
26: ; preds = %4
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%28 = call i32 @snprintf(i8* %27, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%30 = load i8*, i8** %5
%31 = call i32 @strcat(i8* %29, i8* %30)
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%33 = call i32* @fopen(i8* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32* %33, i32** %11
%34 = load i32*, i32** %11
%35 = icmp ne i32* %34, null
br i1 %35, label %39, label %36
36: ; preds = %26
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %113
39: ; preds = %26
%40 = load i32, i32* %6
%41 = sdiv i32 %40, 1024
store i32 %41, i32* %13
%42 = load i32, i32* %6
%43 = srem i32 %42, 1024
store i32 %43, i32* %14
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%45 = call i32 @memset(i8* %44, i32 0, i32 1024)
store i32 0, i32* %12
br label %46
46: ; preds = %78, %39
%47 = load i32, i32* %12
%48 = load i32, i32* %13
%49 = icmp slt i32 %47, %48
br i1 %49, label %50, label %81
50: ; preds = %46
%51 = load i32, i32* %8
%52 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%53 = call i64 @recv(i32 %51, i8* %52, i32 1024, i32 0)
%54 = icmp sle i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %50
%56 = load i32, i32* @stderr
%57 = call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
br label %113
58: ; preds = %50
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%60 = load i32*, i32** %11
%61 = call i32 @fwrite(i8* %59, i32 1, i32 1024, i32* %60)
%62 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%63 = call i32 @memset(i8* %62, i32 0, i32 1024)
%64 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%65 = call i32 @sprintf(i8* %64, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%66 = load i32, i32* %7
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%68 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%69 = call i32 @strlen(i8* %68)
%70 = call i64 @send(i32 %66, i8* %67, i32 %69, i32 0)
%71 = icmp slt i64 %70, 0
br i1 %71, label %72, label %75
72: ; preds = %58
%73 = load i32, i32* @stderr
%74 = call i32 @fprintf(i32 %73, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %113
75: ; preds = %58
%76 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%77 = call i32 @memset(i8* %76, i32 0, i32 1024)
br label %78
78: ; preds = %75
%79 = load i32, i32* %12
%80 = add nsw i32 %79, 1
store i32 %80, i32* %12
br label %46
81: ; preds = %46
%82 = load i32, i32* %8
%83 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%84 = call i64 @recv(i32 %82, i8* %83, i32 1024, i32 0)
%85 = icmp sle i64 %84, 0
br i1 %85, label %86, label %89
86: ; preds = %81
%87 = load i32, i32* @stderr
%88 = call i32 @fprintf(i32 %87, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
br label %113
89: ; preds = %81
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%91 = load i32, i32* %14
%92 = load i32*, i32** %11
%93 = call i32 @fwrite(i8* %90, i32 1, i32 %91, i32* %92)
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%95 = call i32 @memset(i8* %94, i32 0, i32 1024)
%96 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%97 = call i32 @sprintf(i8* %96, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0))
%98 = load i32, i32* %7
%99 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%100 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%101 = call i32 @strlen(i8* %100)
%102 = call i64 @send(i32 %98, i8* %99, i32 %101, i32 0)
%103 = icmp slt i64 %102, 0
br i1 %103, label %104, label %107
104: ; preds = %89
%105 = load i32, i32* @stderr
%106 = call i32 @fprintf(i32 %105, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %113
107: ; preds = %89
%108 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.9, i64 0, i64 0))
%109 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%110 = call i32 @memset(i8* %109, i32 0, i32 1024)
%111 = load i32*, i32** %11
%112 = call i32 @fclose(i32* %111)
br label %113
113: ; preds = %107, %104, %86, %72, %55, %36, %23
ret void
}

LLVM IR (-O2):
@.str = [7 x i8] c"Accept\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"ERROR: Unable writing on socket!\0A\00"
@.str.2 = [5 x i8] c"new_\00"
@.str.3 = [3 x i8] c"wb\00"
@.str.4 = [34 x i8] c"ERROR: Unable creating new file!\0A\00"
@.str.5 = [36 x i8] c"ERROR: Unable reading from socket!\0A\00"
@.str.6 = [9 x i8] c"Continue\00"
@.str.7 = [41 x i8] c"ERROR SERVER: Unable writing on socket!\0A\00"
@.str.8 = [6 x i8] c"Done!\00"
@str = [34 x i8] c"INFO: File received successfully!\00"
define void @receive_File(i8* %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca [1024 x i8]
%6 = alloca [1024 x i8]
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%8 = call i32 @snprintf(i8* %7, i32 1024, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @strlen(i8* %7)
%10 = call i64 @send(i32 %2, i8* %7, i32 %9, i32 0)
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %15
12: ; preds = %4
%13 = load i32, i32* @stderr
%14 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0))
br label %69
15: ; preds = %4
%16 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%17 = call i32 @snprintf(i8* %16, i32 1024, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @strcat(i8* %16, i8* %0)
%19 = call i32* @fopen(i8* %16, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32* %19, null
br i1 %20, label %21, label %24
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.4, i64 0, i64 0))
br label %68
24: ; preds = %15
%25 = sdiv i32 %1, 1024
%26 = srem i32 %1, 1024
%27 = call i32 @memset(i8* %7, i32 0, i32 1024)
%28 = icmp sgt i32 %1, 1023
br i1 %28, label %29, label %49
29: ; preds = %24, %45
%30 = phi i32 [ %47, %45 ], [ 0, %24 ]
%31 = call i64 @recv(i32 %3, i8* %7, i32 1024, i32 0)
%32 = icmp slt i64 %31, 1
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i32, i32* @stderr
%35 = call i32 @fprintf(i32 %34, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
br label %68
36: ; preds = %29
%37 = call i32 @fwrite(i8* %7, i32 1, i32 1024, i32* %19)
%38 = call i32 @memset(i8* %7, i32 0, i32 1024)
%39 = call i32 @strlen(i8* %7)
%40 = call i64 @send(i32 %2, i8* %7, i32 %39, i32 0)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %36
%43 = load i32, i32* @stderr
%44 = call i32 @fprintf(i32 %43, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %68
45: ; preds = %36
%46 = call i32 @memset(i8* %7, i32 0, i32 1024)
%47 = add nuw nsw i32 %30, 1
%48 = icmp eq i32 %47, %25
br i1 %48, label %49, label %29
49: ; preds = %45, %24
%50 = call i64 @recv(i32 %3, i8* %7, i32 1024, i32 0)
%51 = icmp slt i64 %50, 1
br i1 %51, label %52, label %55
52: ; preds = %49
%53 = load i32, i32* @stderr
%54 = call i32 @fprintf(i32 %53, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
br label %68
55: ; preds = %49
%56 = call i32 @fwrite(i8* %7, i32 1, i32 %26, i32* %19)
%57 = call i32 @memset(i8* %7, i32 0, i32 1024)
%58 = call i32 @strlen(i8* %7)
%59 = call i64 @send(i32 %2, i8* %7, i32 %58, i32 0)
%60 = icmp slt i64 %59, 0
br i1 %60, label %61, label %64
61: ; preds = %55
%62 = load i32, i32* @stderr
%63 = call i32 @fprintf(i32 %62, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.7, i64 0, i64 0))
br label %68
64: ; preds = %55
%65 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%66 = call i32 @memset(i8* %7, i32 0, i32 1024)
%67 = call i32 @fclose(i32* %19)
br label %68
68: ; preds = %33, %42, %52, %61, %64, %21
br label %69
69: ; preds = %68, %12
ret void
}