#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*/ SEEK_END;
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ fread(char *, int, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int ftell(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, int /*<<< orphan*/);
int /*<<< orphan*/ snprintf(char *, int, char *, ...);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
int strlen(char *);
void send_File(char *file, int send_sockfd, int recv_sockfd) {
  char command[1024];
  int size = 0;
  FILE *f = fopen(file, "rb");
  if (!f) {
    fprintf(stderr, "ERROR: Unable opening the specified file!\n");
    return;
  }
  fseek(f, 0, SEEK_END);
  size = ftell(f);
  fseek(f, 0, SEEK_SET);
  snprintf(command, 1024, "f");
  snprintf(command + strlen(command), 1024, " ");
  snprintf(command + strlen(command), 1024, "%s", file);
  snprintf(command + strlen(command), 1024, " ");
  snprintf(command + strlen(command), 1024, "%d", size);
  if (send(send_sockfd, command, strlen(command), 0) < 0) {
    fprintf(stderr, "ERROR: 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;
  }
  if (strcmp(command, "Accept") != 0) {
    return;
  }
  int i = 0, no = size / 1024, rest = size % 1024;
  memset(command, 0, 1024);
  for (i = 0; i < no; i++) {
    fread(command, 1, 1024, f);
    if (send(send_sockfd, command, 1024, 0) < 0) {
      fprintf(stderr, "ERROR: 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;
    }
    memset(command, 0, 1024);
  }
  fread(command, 1, rest, f);
  if (send(send_sockfd, command, rest, 0) < 0) {
    fprintf(stderr, "ERROR: 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;
  }
  if (strcmp(command, "Done!") == 0) {
    printf("INFO: File transferred successfully!\n");
  } else {
    fprintf(stderr, "ERROR: Unable transferring the file!\n");
  }
  memset(command, 0, 1024);
  fclose(f);
}


x86 assembly (clang, -O0):
<send_File>:
push   %rbp
mov    %rsp,%rbp
sub    $0x460,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
movl   $0x0,-0x414(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe06(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x420(%rbp)
cmpq   $0x0,-0x420(%rbp)
jne    122e <send_File+0x5e>
mov    0x2dbd(%rip),%rax
mov    (%rax),%edi
lea    0xddf(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
mov    -0x420(%rbp),%rdi
mov    0x2dac(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    -0x420(%rbp),%rdi
call   10d0 <ftell@plt>
mov    %eax,-0x414(%rbp)
mov    -0x420(%rbp),%rdi
mov    0x2d6b(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   10e0 <fseek@plt>
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
lea    0xdad(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x460(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x460(%rbp),%rdi
cltq
add    %rax,%rdi
mov    $0x400,%esi
lea    0xd76(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x458(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x458(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x8(%rbp),%rcx
mov    $0x400,%esi
lea    0xd3b(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x450(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x450(%rbp),%rdi
cltq
add    %rax,%rdi
mov    $0x400,%esi
lea    0xd00(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
lea    -0x410(%rbp),%rax
mov    %rax,-0x448(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x448(%rbp),%rdi
cltq
add    %rax,%rdi
mov    -0x414(%rbp),%ecx
mov    $0x400,%esi
lea    0xcc6(%rip),%rdx
mov    $0x0,%al
call   1090 <snprintf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x43c(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x438(%rbp)
lea    -0x410(%rbp),%rdi
call   1060 <strlen@plt>
mov    -0x43c(%rbp),%edi
mov    -0x438(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0x0,%rax
jge    13d3 <send_File+0x203>
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
lea    0xc6f(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x10(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jg     1420 <send_File+0x250>
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
lea    0xc44(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
lea    0xc50(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
je     1442 <send_File+0x272>
jmp    1676 <send_File+0x4a6>
movl   $0x0,-0x424(%rbp)
mov    -0x414(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %eax,-0x428(%rbp)
mov    -0x414(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    %edx,-0x42c(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
movl   $0x0,-0x424(%rbp)
mov    -0x424(%rbp),%eax
cmp    -0x428(%rbp),%eax
jge    156e <send_File+0x39e>
lea    -0x410(%rbp),%rdi
mov    -0x420(%rbp),%rcx
mov    $0x1,%esi
mov    $0x400,%edx
call   1040 <fread@plt>
mov    -0xc(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0x0,%rax
jge    14fa <send_File+0x32a>
mov    0x2af1(%rip),%rax
mov    (%rax),%edi
lea    0xb48(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x10(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jg     1547 <send_File+0x377>
mov    0x2aa4(%rip),%rax
mov    (%rax),%edi
lea    0xb1d(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    1491 <send_File+0x2c1>
lea    -0x410(%rbp),%rdi
mov    -0x42c(%rbp),%edx
mov    -0x420(%rbp),%rcx
mov    $0x1,%esi
call   1040 <fread@plt>
mov    -0xc(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    -0x42c(%rbp),%edx
xor    %ecx,%ecx
call   1070 <send@plt>
cmp    $0x0,%rax
jge    15c7 <send_File+0x3f7>
mov    0x2a24(%rip),%rax
mov    (%rax),%edi
lea    0xa7b(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x10(%rbp),%edi
lea    -0x410(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
cmp    $0x0,%rax
jg     1614 <send_File+0x444>
mov    0x29d7(%rip),%rax
mov    (%rax),%edi
lea    0xa50(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    1676 <send_File+0x4a6>
lea    -0x410(%rbp),%rdi
lea    0xa63(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    1642 <send_File+0x472>
lea    0xa53(%rip),%rdi
call   1080 <printf@plt>
jmp    1657 <send_File+0x487>
mov    0x298f(%rip),%rax
mov    (%rax),%edi
lea    0xa5f(%rip),%rsi
call   10c0 <fprintf@plt>
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    -0x420(%rbp),%rdi
call   1050 <fclose@plt>
add    $0x460,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<send_File>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    %edx,0xc(%rsp)
mov    %esi,%r12d
mov    %rdi,%rbx
lea    0xe0e(%rip),%rsi
call   10f0 <fopen@plt>
test   %rax,%rax
je     148f <send_File+0x2bf>
mov    %rax,%r13
mov    0x2dde(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
mov    %r13,%rdi
call   10d0 <ftell@plt>
mov    %eax,%r15d
mov    0x2da8(%rip),%rax
mov    (%rax),%edx
mov    %r13,%rdi
xor    %esi,%esi
call   10e0 <fseek@plt>
lea    0xdf3(%rip),%rdx
lea    0x10(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x400,%esi
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
lea    0xdc8(%rip),%r14
mov    $0x400,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
lea    0xda2(%rip),%rdx
mov    $0x400,%esi
mov    %rbx,%rcx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
mov    $0x400,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
cltq
lea    (%rsp,%rax,1),%rdi
add    $0x10,%rdi
lea    0xd5c(%rip),%rdx
mov    $0x400,%esi
mov    %r15d,%ecx
xor    %eax,%eax
call   1090 <snprintf@plt>
mov    %rbp,%rdi
call   1070 <strlen@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
test   %rax,%rax
js     14b5 <send_File+0x2e5>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    14c7 <send_File+0x2f7>
lea    0xd3f(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
jne    14dc <send_File+0x30c>
lea    0x3ff(%r15),%r14d
test   %r15d,%r15d
cmovns %r15d,%r14d
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
cmp    $0x400,%r15d
jl     13ff <send_File+0x22f>
mov    %r14d,%ebp
sar    $0xa,%ebp
lea    0x10(%rsp),%rbx
nopl   0x0(%rax)
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x400,%edx
mov    %r13,%rcx
call   1050 <fread@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
test   %rax,%rax
js     14b5 <send_File+0x2e5>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    14c7 <send_File+0x2f7>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
add    $0xffffffff,%ebp
jne    1390 <send_File+0x1c0>
and    $0xfffffc00,%r14d
sub    %r14d,%r15d
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %r15d,%edx
mov    %r13,%rcx
call   1050 <fread@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
mov    %r15d,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
test   %rax,%rax
js     14b5 <send_File+0x2e5>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %rax,%rax
jle    14c7 <send_File+0x2f7>
lea    0xc1c(%rip),%rsi
lea    0x10(%rsp),%rdi
call   10b0 <strcmp@plt>
test   %rax,%rax
je     14ee <send_File+0x31e>
mov    0x2b59(%rip),%rax
mov    (%rax),%edi
lea    0xc03(%rip),%rsi
call   10c0 <fprintf@plt>
jmp    14fa <send_File+0x32a>
mov    0x2b42(%rip),%rax
mov    (%rax),%edi
lea    0xb64(%rip),%rsi
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    10c0 <fprintf@plt>
mov    0x2b1c(%rip),%rax
mov    (%rax),%edi
lea    0xb73(%rip),%rsi
jmp    14d7 <send_File+0x307>
mov    0x2b0a(%rip),%rax
mov    (%rax),%edi
lea    0xb83(%rip),%rsi
call   10c0 <fprintf@plt>
add    $0x418,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbbc(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   10a0 <memset@plt>
mov    %r13,%rdi
call   1060 <fclose@plt>
jmp    14dc <send_File+0x30c>

LLVM IR (-O0):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"ERROR: Unable opening the specified file!\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [2 x i8] c"f\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [34 x i8] c"ERROR: Unable writing on socket!\0A\00"
@.str.7 = [36 x i8] c"ERROR: Unable reading from socket!\0A\00"
@.str.8 = [7 x i8] c"Accept\00"
@.str.9 = [6 x i8] c"Done!\00"
@.str.10 = [38 x i8] c"INFO: File transferred successfully!\0A\00"
@.str.11 = [38 x i8] c"ERROR: Unable transferring the file!\0A\00"
define void @send_File(i8* %0, i32 %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca [1024 x i8]
%8 = alloca i32
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
store i32 0, i32* %8
%13 = load i8*, i8** %4
%14 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %14, i32** %9
%15 = load i32*, i32** %9
%16 = icmp ne i32* %15, null
br i1 %16, label %20, label %17
17: ; preds = %3
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %156
20: ; preds = %3
%21 = load i32*, i32** %9
%22 = load i32, i32* @SEEK_END
%23 = call i32 @fseek(i32* %21, i32 0, i32 %22)
%24 = load i32*, i32** %9
%25 = call i32 @ftell(i32* %24)
store i32 %25, i32* %8
%26 = load i32*, i32** %9
%27 = load i32, i32* @SEEK_SET
%28 = call i32 @fseek(i32* %26, i32 0, i32 %27)
%29 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%30 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %29, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%31 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%33 = call i32 @strlen(i8* %32)
%34 = sext i32 %33 to i64
%35 = getelementptr inbounds i8, i8* %31, i64 %34
%36 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %35, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%37 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%38 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%39 = call i32 @strlen(i8* %38)
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds i8, i8* %37, i64 %40
%42 = load i8*, i8** %4
%43 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %41, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %42)
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%45 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%46 = call i32 @strlen(i8* %45)
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %44, i64 %47
%49 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %48, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%50 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%52 = call i32 @strlen(i8* %51)
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i32, i32* %8
%56 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %54, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %55)
%57 = load i32, i32* %5
%58 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%59 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%60 = call i32 @strlen(i8* %59)
%61 = call i64 @send(i32 %57, i8* %58, i32 %60, i32 0)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %20
%64 = load i32, i32* @stderr
%65 = call i32 @fprintf(i32 %64, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %156
66: ; preds = %20
%67 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%68 = call i32 @memset(i8* %67, i32 0, i32 1024)
%69 = load i32, i32* %6
%70 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%71 = call i64 @recv(i32 %69, i8* %70, i32 1024, i32 0)
%72 = icmp sle i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %66
%74 = load i32, i32* @stderr
%75 = call i32 @fprintf(i32 %74, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %156
76: ; preds = %66
%77 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%78 = call i64 @strcmp(i8* %77, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%79 = icmp ne i64 %78, 0
br i1 %79, label %80, label %81
80: ; preds = %76
br label %156
81: ; preds = %76
store i32 0, i32* %10
%82 = load i32, i32* %8
%83 = sdiv i32 %82, 1024
store i32 %83, i32* %11
%84 = load i32, i32* %8
%85 = srem i32 %84, 1024
store i32 %85, i32* %12
%86 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%87 = call i32 @memset(i8* %86, i32 0, i32 1024)
store i32 0, i32* %10
br label %88
88: ; preds = %116, %81
%89 = load i32, i32* %10
%90 = load i32, i32* %11
%91 = icmp slt i32 %89, %90
br i1 %91, label %92, label %119
92: ; preds = %88
%93 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%94 = load i32*, i32** %9
%95 = call i32 @fread(i8* %93, i32 1, i32 1024, i32* %94)
%96 = load i32, i32* %5
%97 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%98 = call i64 @send(i32 %96, i8* %97, i32 1024, i32 0)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %92
%101 = load i32, i32* @stderr
%102 = call i32 @fprintf(i32 %101, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %156
103: ; preds = %92
%104 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%105 = call i32 @memset(i8* %104, i32 0, i32 1024)
%106 = load i32, i32* %6
%107 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%108 = call i64 @recv(i32 %106, i8* %107, i32 1024, i32 0)
%109 = icmp sle i64 %108, 0
br i1 %109, label %110, label %113
110: ; preds = %103
%111 = load i32, i32* @stderr
%112 = call i32 @fprintf(i32 %111, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %156
113: ; preds = %103
%114 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%115 = call i32 @memset(i8* %114, i32 0, i32 1024)
br label %116
116: ; preds = %113
%117 = load i32, i32* %10
%118 = add nsw i32 %117, 1
store i32 %118, i32* %10
br label %88
119: ; preds = %88
%120 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%121 = load i32, i32* %12
%122 = load i32*, i32** %9
%123 = call i32 @fread(i8* %120, i32 1, i32 %121, i32* %122)
%124 = load i32, i32* %5
%125 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%126 = load i32, i32* %12
%127 = call i64 @send(i32 %124, i8* %125, i32 %126, i32 0)
%128 = icmp slt i64 %127, 0
br i1 %128, label %129, label %132
129: ; preds = %119
%130 = load i32, i32* @stderr
%131 = call i32 @fprintf(i32 %130, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %156
132: ; preds = %119
%133 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%134 = call i32 @memset(i8* %133, i32 0, i32 1024)
%135 = load i32, i32* %6
%136 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%137 = call i64 @recv(i32 %135, i8* %136, i32 1024, i32 0)
%138 = icmp sle i64 %137, 0
br i1 %138, label %139, label %142
139: ; preds = %132
%140 = load i32, i32* @stderr
%141 = call i32 @fprintf(i32 %140, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %156
142: ; preds = %132
%143 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%144 = call i64 @strcmp(i8* %143, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%145 = icmp eq i64 %144, 0
br i1 %145, label %146, label %148
146: ; preds = %142
%147 = call i32 @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.10, i64 0, i64 0))
br label %151
148: ; preds = %142
%149 = load i32, i32* @stderr
%150 = call i32 @fprintf(i32 %149, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %151
151: ; preds = %148, %146
%152 = getelementptr inbounds [1024 x i8], [1024 x i8]* %7, i64 0, i64 0
%153 = call i32 @memset(i8* %152, i32 0, i32 1024)
%154 = load i32*, i32** %9
%155 = call i32 @fclose(i32* %154)
br label %156
156: ; preds = %151, %139, %129, %110, %100, %80, %73, %63, %17
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"rb\00"
@stderr = global i32 0
@.str.1 = [43 x i8] c"ERROR: Unable opening the specified file!\0A\00"
@SEEK_END = global i32 0
@SEEK_SET = global i32 0
@.str.2 = [2 x i8] c"f\00"
@.str.3 = [2 x i8] c" \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [3 x i8] c"%d\00"
@.str.6 = [34 x i8] c"ERROR: Unable writing on socket!\0A\00"
@.str.7 = [36 x i8] c"ERROR: Unable reading from socket!\0A\00"
@.str.8 = [7 x i8] c"Accept\00"
@.str.9 = [6 x i8] c"Done!\00"
@.str.11 = [38 x i8] c"ERROR: Unable transferring the file!\0A\00"
@str = [37 x i8] c"INFO: File transferred successfully!\00"
define void @send_File(i8* %0, i32 %1, i32 %2) {
%4 = alloca [1024 x i8]
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%6 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32* %6, null
br i1 %7, label %8, label %11
8: ; preds = %3
%9 = load i32, i32* @stderr
%10 = tail call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.1, i64 0, i64 0))
br label %99
11: ; preds = %3
%12 = load i32, i32* @SEEK_END
%13 = tail call i32 @fseek(i32* %6, i32 0, i32 %12)
%14 = tail call i32 @ftell(i32* %6)
%15 = load i32, i32* @SEEK_SET
%16 = tail call i32 @fseek(i32* %6, i32 0, i32 %15)
%17 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %5, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%18 = call i32 @strlen(i8* %5)
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %19
%21 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %20, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%22 = call i32 @strlen(i8* %5)
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %23
%25 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %24, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %0)
%26 = call i32 @strlen(i8* %5)
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %27
%29 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %28, i32 1024, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%30 = call i32 @strlen(i8* %5)
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 %31
%33 = call i32 (i8*, i32, i8*, ...) @snprintf(i8* %32, i32 1024, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i32 %14)
%34 = call i32 @strlen(i8* %5)
%35 = call i64 @send(i32 %1, i8* %5, i32 %34, i32 0)
%36 = icmp slt i64 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %11
%38 = load i32, i32* @stderr
%39 = call i32 @fprintf(i32 %38, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %99
40: ; preds = %11
%41 = call i32 @memset(i8* %5, i32 0, i32 1024)
%42 = call i64 @recv(i32 %2, i8* %5, i32 1024, i32 0)
%43 = icmp slt i64 %42, 1
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* @stderr
%46 = call i32 @fprintf(i32 %45, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %99
47: ; preds = %40
%48 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%49 = icmp eq i64 %48, 0
br i1 %49, label %50, label %99
50: ; preds = %47
%51 = sdiv i32 %14, 1024
%52 = srem i32 %14, 1024
%53 = call i32 @memset(i8* %5, i32 0, i32 1024)
%54 = icmp sgt i32 %14, 1023
br i1 %54, label %55, label %74
55: ; preds = %50, %70
%56 = phi i32 [ %72, %70 ], [ 0, %50 ]
%57 = call i32 @fread(i8* %5, i32 1, i32 1024, i32* %6)
%58 = call i64 @send(i32 %1, i8* %5, i32 1024, i32 0)
%59 = icmp slt i64 %58, 0
br i1 %59, label %60, label %63
60: ; preds = %55
%61 = load i32, i32* @stderr
%62 = call i32 @fprintf(i32 %61, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %99
63: ; preds = %55
%64 = call i32 @memset(i8* %5, i32 0, i32 1024)
%65 = call i64 @recv(i32 %2, i8* %5, i32 1024, i32 0)
%66 = icmp slt i64 %65, 1
br i1 %66, label %67, label %70
67: ; preds = %63
%68 = load i32, i32* @stderr
%69 = call i32 @fprintf(i32 %68, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %99
70: ; preds = %63
%71 = call i32 @memset(i8* %5, i32 0, i32 1024)
%72 = add nuw nsw i32 %56, 1
%73 = icmp eq i32 %72, %51
br i1 %73, label %74, label %55
74: ; preds = %70, %50
%75 = call i32 @fread(i8* %5, i32 1, i32 %52, i32* %6)
%76 = call i64 @send(i32 %1, i8* %5, i32 %52, i32 0)
%77 = icmp slt i64 %76, 0
br i1 %77, label %78, label %81
78: ; preds = %74
%79 = load i32, i32* @stderr
%80 = call i32 @fprintf(i32 %79, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.6, i64 0, i64 0))
br label %99
81: ; preds = %74
%82 = call i32 @memset(i8* %5, i32 0, i32 1024)
%83 = call i64 @recv(i32 %2, i8* %5, i32 1024, i32 0)
%84 = icmp slt i64 %83, 1
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = load i32, i32* @stderr
%87 = call i32 @fprintf(i32 %86, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
br label %99
88: ; preds = %81
%89 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.9, i64 0, i64 0))
%90 = icmp eq i64 %89, 0
br i1 %90, label %91, label %93
91: ; preds = %88
%92 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
br label %96
93: ; preds = %88
%94 = load i32, i32* @stderr
%95 = call i32 @fprintf(i32 %94, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0))
br label %96
96: ; preds = %93, %91
%97 = call i32 @memset(i8* %5, i32 0, i32 1024)
%98 = call i32 @fclose(i32* %6)
br label %99
99: ; preds = %60, %67, %78, %85, %96, %47, %44, %37, %8
ret void
}