#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_port;
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int ssize_t;
typedef int /*<<< orphan*/ remote_addr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ SOCK_STREAM;
int atoi(char *);
int /*<<< orphan*/ close(int);
int connect(int, struct sockaddr *, int);
int /*<<< orphan*/ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
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*/ htons(int);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
char *strerror(int /*<<< orphan*/);
int main(int argc, char **argv) {
  int client_socket;
  ssize_t len;
  struct sockaddr_in remote_addr;
  char buffer[BUFSIZ];
  int file_size;
  FILE *received_file;
  int remain_data = 0;
  memset(&remote_addr, 0, sizeof(remote_addr));
  remote_addr.sin_family = AF_INET;
  inet_pton(AF_INET, "127.0.0.1", &(remote_addr.sin_addr));
  remote_addr.sin_port = htons(5000);
  client_socket = socket(AF_INET, SOCK_STREAM, 0);
  if (client_socket == -1) {
    fprintf(stderr, "Error creating socket --> %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  if (connect(client_socket, (struct sockaddr *)&remote_addr,
              sizeof(struct sockaddr)) == -1) {
    fprintf(stderr, "Error on connect --> %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  recv(client_socket, buffer, BUFSIZ, 0);
  file_size = atoi(buffer);
  fprintf(stdout, "\nFile size : %d\n", file_size);
  received_file = fopen("./client_side.txt", "w");
  if (received_file == NULL) {
    fprintf(stderr, "Failed to open file foo --> %s\n", strerror(errno));
    exit(EXIT_FAILURE);
  }
  remain_data = file_size + 1;
  while (((len = recv(client_socket, buffer, BUFSIZ, 0)) > 0) &&
         (remain_data > 0)) {
    fwrite(buffer, sizeof(char), len, received_file);
    remain_data -= len;
    fprintf(stdout, "Receive %d bytes and we hope :- %d bytes\n", len,
            remain_data);
  }
  fclose(received_file);
  close(client_socket);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dcb(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x58(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x38(%rbp)
movl   $0x0,-0x4c(%rbp)
lea    -0x28(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2da8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
lea    -0x28(%rbp),%rdx
add    $0x4,%rdx
lea    0xda3(%rip),%rsi
call   1090 <inet_pton@plt>
mov    $0x1388,%edi
call   1050 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    0x2d72(%rip),%rax
mov    (%rax),%edi
mov    0x2d51(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    12d1 <main+0xf1>
mov    0x2d3c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x5c(%rbp)
mov    0x2d18(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x5c(%rbp),%edi
mov    %rax,%rdx
lea    0xd4e(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2cee(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0x4,%edx
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
jne    1327 <main+0x147>
mov    0x2ce6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x60(%rbp)
mov    0x2cc2(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x60(%rbp),%edi
mov    %rax,%rdx
lea    0xd16(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x58(%rbp),%rsi
mov    -0x14(%rbp),%edi
mov    0x2c93(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    -0x58(%rbp),%rdi
call   10b0 <atoi@plt>
mov    %eax,-0x3c(%rbp)
mov    0x2c5f(%rip),%rax
mov    (%rax),%edi
mov    -0x3c(%rbp),%edx
lea    0xce4(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    0xce7(%rip),%rdi
lea    0xcf2(%rip),%rsi
call   10a0 <fopen@plt>
mov    %rax,-0x48(%rbp)
cmpq   $0x0,-0x48(%rbp)
jne    13c2 <main+0x1e2>
mov    0x2c4b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x64(%rbp)
mov    0x2c27(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
mov    -0x64(%rbp),%edi
mov    %rax,%rdx
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2bfd(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4c(%rbp)
mov    -0x58(%rbp),%rsi
mov    -0x14(%rbp),%edi
mov    0x2bef(%rip),%rax
mov    (%rax),%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,%ecx
mov    %ecx,-0x18(%rbp)
xor    %eax,%eax
cmp    $0x0,%ecx
mov    %al,-0x65(%rbp)
jle    13ff <main+0x21f>
cmpl   $0x0,-0x4c(%rbp)
setg   %al
mov    %al,-0x65(%rbp)
mov    -0x65(%rbp),%al
test   $0x1,%al
jne    140f <main+0x22f>
jmp    1451 <main+0x271>
mov    -0x58(%rbp),%rdi
mov    -0x18(%rbp),%edx
mov    -0x48(%rbp),%rcx
mov    $0x1,%esi
call   10e0 <fwrite@plt>
mov    -0x18(%rbp),%ecx
mov    -0x4c(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x4c(%rbp)
mov    0x2b7a(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%edx
mov    -0x4c(%rbp),%ecx
lea    0xc41(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    13cb <main+0x1eb>
mov    -0x48(%rbp),%rdi
call   1040 <fclose@plt>
mov    -0x14(%rbp),%edi
call   1070 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rsp,%r12
mov    0x2dcd(%rip),%r13
mov    0x0(%r13),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
lea    -0x38(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1060 <memset@plt>
mov    0x2dc1(%rip),%rbx
mov    (%rbx),%edi
mov    %edi,-0x30(%rbp)
lea    -0x34(%rbp),%rdx
lea    0xdc9(%rip),%rsi
call   1090 <inet_pton@plt>
mov    $0x1388,%edi
call   1050 <htons@plt>
mov    %eax,-0x38(%rbp)
mov    (%rbx),%edi
mov    0x2d7e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1100 <socket@plt>
cmp    $0xffffffff,%eax
je     1378 <main+0x198>
mov    %eax,%r14d
lea    -0x38(%rbp),%rsi
mov    %eax,%edi
mov    $0x4,%edx
call   10d0 <connect@plt>
cmp    $0xffffffff,%eax
je     1398 <main+0x1b8>
mov    %r12,-0x40(%rbp)
mov    0x0(%r13),%edx
mov    %r14d,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %r15,%rdi
call   10b0 <atoi@plt>
mov    %eax,%ebx
mov    0x2d0a(%rip),%rax
mov    (%rax),%edi
lea    0xd92(%rip),%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1080 <fprintf@plt>
lea    0xd93(%rip),%rdi
lea    0xd9e(%rip),%rsi
call   10a0 <fopen@plt>
test   %rax,%rax
je     13b8 <main+0x1d8>
mov    %rax,%r12
mov    0x0(%r13),%edx
mov    %r14d,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    1353 <main+0x173>
test   %ebx,%ebx
js     1353 <main+0x173>
mov    %eax,%r13d
add    $0x1,%ebx
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
mov    $0x1,%esi
mov    %r13d,%edx
mov    %r12,%rcx
call   10e0 <fwrite@plt>
sub    %r13d,%ebx
mov    0x2c93(%rip),%rax
mov    (%rax),%edi
lea    0xd60(%rip),%rsi
mov    %r13d,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2c8f(%rip),%rax
mov    (%rax),%edx
mov    %r14d,%edi
mov    %r15,%rsi
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    1353 <main+0x173>
mov    %eax,%r13d
test   %ebx,%ebx
jg     1300 <main+0x120>
mov    %r12,%rdi
call   1040 <fclose@plt>
mov    %r14d,%edi
call   1070 <close@plt>
mov    -0x40(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c59(%rip),%rax
mov    (%rax),%ebx
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc74(%rip),%rsi
jmp    13d6 <main+0x1f6>
mov    0x2c39(%rip),%rax
mov    (%rax),%ebx
mov    0x2c18(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc72(%rip),%rsi
jmp    13d6 <main+0x1f6>
mov    0x2c19(%rip),%rax
mov    (%rax),%ebx
mov    0x2bf8(%rip),%rax
mov    (%rax),%edi
call   10f0 <strerror@plt>
lea    0xc90(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
xor    %eax,%eax
call   1080 <fprintf@plt>
mov    0x2bcf(%rip),%rax
mov    (%rax),%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.1 = [30 x i8] c"Error creating socket --> %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [25 x i8] c"Error on connect --> %s\0A\00"
@stdout = global i32 0
@.str.3 = [17 x i8] c"\0AFile size : %d\0A\00"
@.str.4 = [18 x i8] c"./client_side.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [32 x i8] c"Failed to open file foo --> %s\0A\00"
@.str.7 = [42 x i8] c"Receive %d bytes and we hope :- %d bytes\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 %struct.sockaddr_in
%9 = alloca i8*
%10 = alloca i64
%11 = alloca i32
%12 = alloca i32*
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* @BUFSIZ
%15 = zext i32 %14 to i64
%16 = call i8* @llvm.stacksave()
store i8* %16, i8** %9
%17 = alloca i8, i64 %15
store i64 %15, i64* %10
store i32 0, i32* %13
%18 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%19 = load i32, i32* @AF_INET
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %19, i32* %20
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
%23 = call i32 @inet_pton(i32 %21, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %22)
%24 = call i32 @htons(i32 5000)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
store i32 %24, i32* %25
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %6
%29 = load i32, i32* %6
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %38
31: ; preds = %2
%32 = load i32, i32* @stderr
%33 = load i32, i32* @errno
%34 = call i8* @strerror(i32 %33)
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %2
%39 = load i32, i32* %6
%40 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%41 = call i32 @connect(i32 %39, %struct.sockaddr* %40, i32 4)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %50
43: ; preds = %38
%44 = load i32, i32* @stderr
%45 = load i32, i32* @errno
%46 = call i8* @strerror(i32 %45)
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %46)
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %38
%51 = load i32, i32* %6
%52 = load i32, i32* @BUFSIZ
%53 = call i32 @recv(i32 %51, i8* %17, i32 %52, i32 0)
%54 = call i32 @atoi(i8* %17)
store i32 %54, i32* %11
%55 = load i32, i32* @stdout
%56 = load i32, i32* %11
%57 = call i32 (i32, i8*, ...) @fprintf(i32 %55, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %56)
%58 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
store i32* %58, i32** %12
%59 = load i32*, i32** %12
%60 = icmp eq i32* %59, null
br i1 %60, label %61, label %68
61: ; preds = %50
%62 = load i32, i32* @stderr
%63 = load i32, i32* @errno
%64 = call i8* @strerror(i32 %63)
%65 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %64)
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %50
%69 = load i32, i32* %11
%70 = add nsw i32 %69, 1
store i32 %70, i32* %13
br label %71
71: ; preds = %81, %68
%72 = load i32, i32* %6
%73 = load i32, i32* @BUFSIZ
%74 = call i32 @recv(i32 %72, i8* %17, i32 %73, i32 0)
store i32 %74, i32* %7
%75 = icmp sgt i32 %74, 0
br i1 %75, label %76, label %79
76: ; preds = %71
%77 = load i32, i32* %13
%78 = icmp sgt i32 %77, 0
br label %79
79: ; preds = %76, %71
%80 = phi i1 [ false, %71 ], [ %78, %76 ]
br i1 %80, label %81, label %92
81: ; preds = %79
%82 = load i32, i32* %7
%83 = load i32*, i32** %12
%84 = call i32 @fwrite(i8* %17, i32 1, i32 %82, i32* %83)
%85 = load i32, i32* %7
%86 = load i32, i32* %13
%87 = sub nsw i32 %86, %85
store i32 %87, i32* %13
%88 = load i32, i32* @stdout
%89 = load i32, i32* %7
%90 = load i32, i32* %13
%91 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %89, i32 %90)
br label %71
92: ; preds = %79
%93 = load i32*, i32** %12
%94 = call i32 @fclose(i32* %93)
%95 = load i32, i32* %6
%96 = call i32 @close(i32 %95)
store i32 0, i32* %3
%97 = load i8*, i8** %9
%98 = load i32, i32* %3
ret i32 %98
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@AF_INET = global i32 0
@.str = [10 x i8] c"127.0.0.1\00"
@SOCK_STREAM = global i32 0
@stderr = global i32 0
@.str.1 = [30 x i8] c"Error creating socket --> %s\0A\00"
@errno = global i32 0
@EXIT_FAILURE = global i32 0
@.str.2 = [25 x i8] c"Error on connect --> %s\0A\00"
@stdout = global i32 0
@.str.3 = [17 x i8] c"\0AFile size : %d\0A\00"
@.str.4 = [18 x i8] c"./client_side.txt\00"
@.str.5 = [2 x i8] c"w\00"
@.str.6 = [32 x i8] c"Failed to open file foo --> %s\0A\00"
@.str.7 = [42 x i8] c"Receive %d bytes and we hope :- %d bytes\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = bitcast %struct.sockaddr_in* %3 to i8*
%5 = load i32, i32* @BUFSIZ
%6 = zext i32 %5 to i64
%7 = tail call i8* @llvm.stacksave()
%8 = alloca i8, i64 %6
%9 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%10 = load i32, i32* @AF_INET
%11 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %10, i32* %11
%12 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%13 = call i32 @inet_pton(i32 %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i32* %12)
%14 = call i32 @htons(i32 5000)
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %14, i32* %15
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %27
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i32, i32* @errno
%23 = call i8* @strerror(i32 %22)
%24 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; preds = %2
%28 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%29 = call i32 @connect(i32 %18, %struct.sockaddr* %28, i32 4)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %38
31: ; preds = %27
%32 = load i32, i32* @stderr
%33 = load i32, i32* @errno
%34 = call i8* @strerror(i32 %33)
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %32, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i8* %34)
%36 = load i32, i32* @EXIT_FAILURE
%37 = call i32 @exit(i32 %36)
unreachable
38: ; preds = %27
%39 = load i32, i32* @BUFSIZ
%40 = call i32 @recv(i32 %18, i8* %8, i32 %39, i32 0)
%41 = call i32 @atoi(i8* %8)
%42 = load i32, i32* @stdout
%43 = call i32 (i32, i8*, ...) @fprintf(i32 %42, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0), i32 %41)
%44 = call i32* @fopen(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
%45 = icmp eq i32* %44, null
br i1 %45, label %46, label %53
46: ; preds = %38
%47 = load i32, i32* @stderr
%48 = load i32, i32* @errno
%49 = call i8* @strerror(i32 %48)
%50 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = load i32, i32* @EXIT_FAILURE
%52 = call i32 @exit(i32 %51)
unreachable
53: ; preds = %38
%54 = load i32, i32* @BUFSIZ
%55 = call i32 @recv(i32 %18, i8* %8, i32 %54, i32 0)
%56 = icmp sgt i32 %55, 0
%57 = icmp sgt i32 %41, -1
%58 = and i1 %56, %57
br i1 %58, label %59, label %73
59: ; preds = %53
%60 = add nuw nsw i32 %41, 1
br label %61
61: ; preds = %59, %61
%62 = phi i32 [ %69, %61 ], [ %55, %59 ]
%63 = phi i32 [ %65, %61 ], [ %60, %59 ]
%64 = call i32 @fwrite(i8* %8, i32 1, i32 %62, i32* %44)
%65 = sub nsw i32 %63, %62
%66 = load i32, i32* @stdout
%67 = call i32 (i32, i8*, ...) @fprintf(i32 %66, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.7, i64 0, i64 0), i32 %62, i32 %65)
%68 = load i32, i32* @BUFSIZ
%69 = call i32 @recv(i32 %18, i8* %8, i32 %68, i32 0)
%70 = icmp sgt i32 %69, 0
%71 = icmp sgt i32 %65, 0
%72 = and i1 %70, %71
br i1 %72, label %61, label %73
73: ; preds = %61, %53
%74 = call i32 @fclose(i32* %44)
%75 = call i32 @close(i32 %18)
ret i32 0
}