#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 */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ serveraddr;
typedef int /*<<< orphan*/ clientaddr;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int INET_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr const *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntop(int /*<<< orphan*/, TYPE_1__ *, char *, int);
int listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ puts(char *);
int recv(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ writefile(int, int /*<<< orphan*/ *);
int main(int argc, char *argv[]) {
  int sockfd = socket(AF_INET, SOCK_STREAM, 0);
  if (sockfd == -1) {
    perror("Can't allocate sockfd");
    exit(1);
  }
  struct sockaddr_in clientaddr, serveraddr;
  memset(&serveraddr, 0, sizeof(serveraddr));
  serveraddr.sin_family = AF_INET;
  serveraddr.sin_addr.s_addr = htonl(INADDR_ANY);
  serveraddr.sin_port = htons(8877);
  if (bind(sockfd, (const struct sockaddr *)&serveraddr, sizeof(serveraddr)) ==
      -1) {
    perror("Bind Error");
    exit(1);
  }
  if (listen(sockfd, 7788) == -1) {
    perror("Listen Error");
    exit(1);
  }
  socklen_t addrlen = sizeof(clientaddr);
  int connfd = accept(sockfd, (struct sockaddr *)&clientaddr, &addrlen);
  if (connfd == -1) {
    perror("Connect Error");
    exit(1);
  }
  close(sockfd);
  char filename[4096] = {0};
  if (recv(connfd, filename, 4096, 0) == -1) {
    perror("Can't receive filename");
    exit(1);
  }
  FILE *fp = fopen(filename, "wb");
  if (fp == NULL) {
    perror("Can't open file");
    exit(1);
  }
  char addr[INET_ADDRSTRLEN];
  printf("Start receive file: %s from %s\n", filename,
         inet_ntop(AF_INET, &clientaddr.sin_addr, addr, INET_ADDRSTRLEN));
  writefile(connfd, fp);
  puts("Receive Success");
  fclose(fp);
  close(connfd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1060,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
mov    0x2d97(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1265 <main+0x55>
lea    0xdaa(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    0x2d6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    $0x22ad,%edi
call   1070 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12cf <main+0xbf>
lea    0xd56(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x1e6c,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
jne    12fb <main+0xeb>
lea    0xd35(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
movl   $0xc,-0x34(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1110 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1335 <main+0x125>
lea    0xd08(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    -0x14(%rbp),%edi
call   10b0 <close@plt>
lea    -0x1040(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   10a0 <memset@plt>
mov    -0x38(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
jne    1385 <main+0x175>
lea    0xcc6(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
lea    -0x1040(%rbp),%rdi
lea    0xcc0(%rip),%rsi
call   10f0 <fopen@plt>
mov    %rax,-0x1048(%rbp)
cmpq   $0x0,-0x1048(%rbp)
jne    13c3 <main+0x1b3>
lea    0xca2(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>
mov    0x2bfe(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x1050(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    %rax,-0x1058(%rbp)
lea    -0x1040(%rbp),%rax
mov    %rax,-0x1060(%rbp)
mov    0x2be2(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
mov    0x2bb5(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x1060(%rbp),%rsi
mov    %rax,%rdx
lea    0xc3b(%rip),%rdi
call   1080 <printf@plt>
mov    -0x38(%rbp),%edi
mov    -0x1048(%rbp),%rsi
call   10c0 <writefile@plt>
lea    0xc40(%rip),%rdi
call   1050 <puts@plt>
mov    -0x1048(%rbp),%rdi
call   1060 <fclose@plt>
mov    -0x38(%rbp),%edi
call   10b0 <close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x1050(%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   %r12
push   %rbx
sub    $0x1020,%rsp
mov    0x2dbf(%rip),%r15
mov    (%r15),%edi
mov    0x2d9d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
cmp    $0xffffffff,%eax
je     139e <main+0x18e>
mov    %eax,%ebx
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    (%r15),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d79(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    $0x22ad,%edi
call   1070 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
je     13a7 <main+0x197>
mov    %ebx,%edi
mov    $0x1e6c,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
je     13b0 <main+0x1a0>
movl   $0xc,-0x24(%rbp)
lea    -0x40(%rbp),%rsi
lea    -0x24(%rbp),%rdx
mov    %ebx,%edi
call   1110 <accept@plt>
cmp    $0xffffffff,%eax
je     13b9 <main+0x1a9>
mov    %eax,%r14d
mov    %ebx,%edi
call   10b0 <close@plt>
lea    -0x1040(%rbp),%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   10a0 <memset@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
je     13c2 <main+0x1b2>
lea    0xd47(%rip),%rsi
lea    -0x1040(%rbp),%rdi
call   10f0 <fopen@plt>
test   %rax,%rax
je     13cb <main+0x1bb>
mov    %rax,%rbx
mov    %rsp,%r12
mov    0x2c9a(%rip),%rax
mov    (%rax),%ecx
mov    %rsp,%rdx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
sub    %rcx,%rdx
mov    %rdx,%rsp
mov    (%r15),%edi
mov    (%rax),%ecx
lea    -0x40(%rbp),%rsi
call   1030 <inet_ntop@plt>
lea    0xd10(%rip),%rdi
lea    -0x1040(%rbp),%rsi
mov    %rax,%rdx
call   1080 <printf@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   10c0 <writefile@plt>
lea    0xd0f(%rip),%rdi
call   1050 <puts@plt>
mov    %rbx,%rdi
call   1060 <fclose@plt>
mov    %r14d,%edi
call   10b0 <close@plt>
mov    %r12,%rsp
xor    %eax,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc5b(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc68(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc6a(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc6e(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc73(%rip),%rdi
jmp    13d2 <main+0x1c2>
lea    0xc84(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"Can't allocate sockfd\00"
@INADDR_ANY = global i32 0
@.str.1 = [11 x i8] c"Bind Error\00"
@.str.2 = [13 x i8] c"Listen Error\00"
@.str.3 = [14 x i8] c"Connect Error\00"
@.str.4 = [23 x i8] c"Can't receive filename\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [16 x i8] c"Can't open file\00"
@INET_ADDRSTRLEN = global i32 0
@.str.7 = [32 x i8] c"Start receive file: %s from %s\0A\00"
@.str.8 = [16 x i8] c"Receive Success\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca %struct.sockaddr_in
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca i32
%11 = alloca [4096 x i8]
%12 = alloca i32*
%13 = alloca i8*
%14 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = call i32 @socket(i32 %15, i32 %16, i32 0)
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %2
%21 = call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %2
%24 = call i32 @memset(%struct.sockaddr_in* %8, i32 0, i32 12)
%25 = load i32, i32* @AF_INET
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 2
store i32 %25, i32* %26
%27 = load i32, i32* @INADDR_ANY
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 0
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = call i32 @htons(i32 8877)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %8, i32 0, i32 1
store i32 %31, i32* %32
%33 = load i32, i32* %6
%34 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
%35 = call i32 @bind(i32 %33, %struct.sockaddr* %34, i32 12)
%36 = icmp eq i32 %35, -1
br i1 %36, label %37, label %40
37: ; preds = %23
%38 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%39 = call i32 @exit(i32 1)
unreachable
40: ; preds = %23
%41 = load i32, i32* %6
%42 = call i32 @listen(i32 %41, i32 7788)
%43 = icmp eq i32 %42, -1
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %40
store i32 12, i32* %9
%48 = load i32, i32* %6
%49 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%50 = call i32 @accept(i32 %48, %struct.sockaddr* %49, i32* %9)
store i32 %50, i32* %10
%51 = load i32, i32* %10
%52 = icmp eq i32 %51, -1
br i1 %52, label %53, label %56
53: ; preds = %47
%54 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %47
%57 = load i32, i32* %6
%58 = call i32 @close(i32 %57)
%59 = bitcast [4096 x i8]* %11 to i8*
%60 = load i32, i32* %10
%61 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%62 = call i32 @recv(i32 %60, i8* %61, i32 4096, i32 0)
%63 = icmp eq i32 %62, -1
br i1 %63, label %64, label %67
64: ; preds = %56
%65 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%66 = call i32 @exit(i32 1)
unreachable
67: ; preds = %56
%68 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%69 = call i32* @fopen(i8* %68, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
store i32* %69, i32** %12
%70 = load i32*, i32** %12
%71 = icmp eq i32* %70, null
br i1 %71, label %72, label %75
72: ; preds = %67
%73 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%74 = call i32 @exit(i32 1)
unreachable
75: ; preds = %67
%76 = load i32, i32* @INET_ADDRSTRLEN
%77 = zext i32 %76 to i64
%78 = call i8* @llvm.stacksave()
store i8* %78, i8** %13
%79 = alloca i8, i64 %77
store i64 %77, i64* %14
%80 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%81 = load i32, i32* @AF_INET
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%83 = load i32, i32* @INET_ADDRSTRLEN
%84 = call i8* @inet_ntop(i32 %81, %struct.TYPE_2__* %82, i8* %79, i32 %83)
%85 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %80, i8* %84)
%86 = load i32, i32* %10
%87 = load i32*, i32** %12
%88 = call i32 @writefile(i32 %86, i32* %87)
%89 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%90 = load i32*, i32** %12
%91 = call i32 @fclose(i32* %90)
%92 = load i32, i32* %10
%93 = call i32 @close(i32 %92)
store i32 0, i32* %3
%94 = load i8*, i8** %13
%95 = load i32, i32* %3
ret i32 %95
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [22 x i8] c"Can't allocate sockfd\00"
@INADDR_ANY = global i32 0
@.str.1 = [11 x i8] c"Bind Error\00"
@.str.2 = [13 x i8] c"Listen Error\00"
@.str.3 = [14 x i8] c"Connect Error\00"
@.str.4 = [23 x i8] c"Can't receive filename\00"
@.str.5 = [3 x i8] c"wb\00"
@.str.6 = [16 x i8] c"Can't open file\00"
@INET_ADDRSTRLEN = global i32 0
@.str.7 = [32 x i8] c"Start receive file: %s from %s\0A\00"
@.str.8 = [16 x i8] c"Receive Success\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca [4096 x i8]
%7 = load i32, i32* @AF_INET
%8 = load i32, i32* @SOCK_STREAM
%9 = tail call i32 @socket(i32 %7, i32 %8, i32 0)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = tail call i32 @perror(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %2
%15 = bitcast %struct.sockaddr_in* %3 to i8*
%16 = bitcast %struct.sockaddr_in* %4 to i8*
%17 = call i32 @memset(%struct.sockaddr_in* %4, i32 0, i32 12)
%18 = load i32, i32* @AF_INET
%19 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %18, i32* %19
%20 = load i32, i32* @INADDR_ANY
%21 = call i32 @htonl(i32 %20)
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
store i32 %21, i32* %22
%23 = call i32 @htons(i32 8877)
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %23, i32* %24
%25 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%26 = call i32 @bind(i32 %9, %struct.sockaddr* %25, i32 12)
%27 = icmp eq i32 %26, -1
br i1 %27, label %28, label %31
28: ; preds = %14
%29 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%30 = call i32 @exit(i32 1)
unreachable
31: ; preds = %14
%32 = call i32 @listen(i32 %9, i32 7788)
%33 = icmp eq i32 %32, -1
br i1 %33, label %34, label %37
34: ; preds = %31
%35 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %31
%38 = bitcast i32* %5 to i8*
store i32 12, i32* %5
%39 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%40 = call i32 @accept(i32 %9, %struct.sockaddr* %39, i32* %5)
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %45
42: ; preds = %37
%43 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %37
%46 = call i32 @close(i32 %9)
%47 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%48 = call i32 @recv(i32 %40, i8* %47, i32 4096, i32 0)
%49 = icmp eq i32 %48, -1
br i1 %49, label %50, label %53
50: ; preds = %45
%51 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %45
%54 = call i32* @fopen(i8* %47, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %59
56: ; preds = %53
%57 = call i32 @perror(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
%58 = call i32 @exit(i32 1)
unreachable
59: ; preds = %53
%60 = load i32, i32* @INET_ADDRSTRLEN
%61 = zext i32 %60 to i64
%62 = call i8* @llvm.stacksave()
%63 = alloca i8, i64 %61
%64 = load i32, i32* @AF_INET
%65 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%66 = load i32, i32* @INET_ADDRSTRLEN
%67 = call i8* @inet_ntop(i32 %64, %struct.TYPE_2__* %65, i8* %63, i32 %66)
%68 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.7, i64 0, i64 0), i8* %47, i8* %67)
%69 = call i32 @writefile(i32 %40, i32* %54)
%70 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.8, i64 0, i64 0))
%71 = call i32 @fclose(i32* %54)
%72 = call i32 @close(i32 %40)
ret i32 0
}