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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int INET_ADDRSTRLEN;
int O_CREAT;
int O_WRONLY;
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*/ 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 open(char *, int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(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);
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);
  }
  int fd = open(filename, O_CREAT | O_WRONLY, 0644);
  if (fd < 0) {
    printf("Error in create file\n");
    return fd;
  }
  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, fd);
  puts("Receive Success");
  close(fd);
  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    0x2dc0(%rip),%rax
mov    (%rax),%edi
mov    0x2d9f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0xffffffff,-0x14(%rbp)
jne    1255 <main+0x55>
lea    0xdba(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d74(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d60(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    $0x22ad,%edi
call   1060 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12bf <main+0xbf>
lea    0xd66(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x1e6c,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
jne    12eb <main+0xeb>
lea    0xd45(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
movl   $0xc,-0x34(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1100 <accept@plt>
mov    %eax,-0x38(%rbp)
cmpl   $0xffffffff,-0x38(%rbp)
jne    1325 <main+0x125>
lea    0xd18(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
lea    -0x1040(%rbp),%rdi
xor    %esi,%esi
mov    $0x1000,%edx
call   1090 <memset@plt>
mov    -0x38(%rbp),%edi
lea    -0x1040(%rbp),%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
jne    1375 <main+0x175>
lea    0xcd6(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    -0x1040(%rbp),%rdi
mov    0x2c75(%rip),%rax
mov    (%rax),%esi
mov    0x2c24(%rip),%rax
or     (%rax),%esi
mov    $0x1a4,%edx
call   10e0 <open@plt>
mov    %eax,-0x1044(%rbp)
cmpl   $0x0,-0x1044(%rbp)
jge    13c7 <main+0x1c7>
lea    0xca1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x1044(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1474 <main+0x274>
mov    0x2bf2(%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    0x2bd6(%rip),%rax
mov    (%rax),%edi
lea    -0x20(%rbp),%rsi
mov    0x2ba9(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    -0x1060(%rbp),%rsi
mov    %rax,%rdx
lea    0xc3a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x38(%rbp),%edi
mov    -0x1044(%rbp),%esi
call   10b0 <writefile@plt>
lea    0xc3e(%rip),%rdi
call   1050 <puts@plt>
mov    -0x1044(%rbp),%edi
call   10a0 <close@plt>
mov    -0x38(%rbp),%edi
call   10a0 <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    0x2dc7(%rip),%r15
mov    (%r15),%edi
mov    0x2da5(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
cmp    $0xffffffff,%eax
je     13a8 <main+0x1a8>
mov    %eax,%ebx
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    (%r15),%eax
mov    %eax,-0x28(%rbp)
mov    0x2d81(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x30(%rbp)
mov    $0x22ad,%edi
call   1060 <htons@plt>
mov    %eax,-0x2c(%rbp)
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
je     13b1 <main+0x1b1>
mov    %ebx,%edi
mov    $0x1e6c,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
je     13ba <main+0x1ba>
movl   $0xc,-0x24(%rbp)
lea    -0x40(%rbp),%rsi
lea    -0x24(%rbp),%rdx
mov    %ebx,%edi
call   1100 <accept@plt>
cmp    $0xffffffff,%eax
je     13c3 <main+0x1c3>
mov    %eax,%r14d
mov    %ebx,%edi
call   10a0 <close@plt>
lea    -0x1040(%rbp),%rbx
mov    $0x1000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1090 <memset@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x1000,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
cmp    $0xffffffff,%eax
je     13cc <main+0x1cc>
mov    0x2cfc(%rip),%rax
mov    0x2cad(%rip),%rcx
mov    (%rcx),%esi
or     (%rax),%esi
lea    -0x1040(%rbp),%rdi
mov    $0x1a4,%edx
call   10e0 <open@plt>
mov    %eax,%ebx
test   %eax,%eax
js     138d <main+0x18d>
mov    %rsp,%r12
mov    0x2c98(%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    0xd03(%rip),%rdi
lea    -0x1040(%rbp),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    %r14d,%edi
mov    %ebx,%esi
call   10b0 <writefile@plt>
lea    0xd01(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%edi
call   10a0 <close@plt>
mov    %r14d,%edi
call   10a0 <close@plt>
mov    %r12,%rsp
xor    %ebx,%ebx
jmp    1399 <main+0x199>
lea    0xcef(%rip),%rdi
call   1050 <puts@plt>
mov    %ebx,%eax
lea    -0x20(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc51(%rip),%rdi
jmp    13d3 <main+0x1d3>
lea    0xc5e(%rip),%rdi
jmp    13d3 <main+0x1d3>
lea    0xc60(%rip),%rdi
jmp    13d3 <main+0x1d3>
lea    0xc64(%rip),%rdi
jmp    13d3 <main+0x1d3>
lea    0xc69(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <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"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@.str.5 = [22 x i8] c"Error in create file\0A\00"
@INET_ADDRSTRLEN = global i32 0
@.str.6 = [32 x i8] c"Start receive file: %s from %s\0A\00"
@.str.7 = [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 = load i32, i32* @O_CREAT
%70 = load i32, i32* @O_WRONLY
%71 = or i32 %69, %70
%72 = call i32 @open(i8* %68, i32 %71, i32 420)
store i32 %72, i32* %12
%73 = load i32, i32* %12
%74 = icmp slt i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%77 = load i32, i32* %12
store i32 %77, i32* %3
br label %98
78: ; preds = %67
%79 = load i32, i32* @INET_ADDRSTRLEN
%80 = zext i32 %79 to i64
%81 = call i8* @llvm.stacksave()
store i8* %81, i8** %13
%82 = alloca i8, i64 %80
store i64 %80, i64* %14
%83 = getelementptr inbounds [4096 x i8], [4096 x i8]* %11, i64 0, i64 0
%84 = load i32, i32* @AF_INET
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
%86 = load i32, i32* @INET_ADDRSTRLEN
%87 = call i8* @inet_ntop(i32 %84, %struct.TYPE_2__* %85, i8* %82, i32 %86)
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %83, i8* %87)
%89 = load i32, i32* %10
%90 = load i32, i32* %12
%91 = call i32 @writefile(i32 %89, i32 %90)
%92 = call i32 @puts(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%93 = load i32, i32* %12
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %10
%96 = call i32 @close(i32 %95)
store i32 0, i32* %3
%97 = load i8*, i8** %13
br label %98
98: ; preds = %78, %75
%99 = load i32, i32* %3
ret i32 %99
}

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"
@O_CREAT = global i32 0
@O_WRONLY = global i32 0
@INET_ADDRSTRLEN = global i32 0
@.str.6 = [32 x i8] c"Start receive file: %s from %s\0A\00"
@.str.7 = [16 x i8] c"Receive Success\00"
@str = [21 x i8] c"Error in create file\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 = load i32, i32* @O_CREAT
%55 = load i32, i32* @O_WRONLY
%56 = or i32 %55, %54
%57 = call i32 @open(i8* %47, i32 %56, i32 420)
%58 = icmp slt i32 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str, i64 0, i64 0))
br label %75
61: ; preds = %53
%62 = load i32, i32* @INET_ADDRSTRLEN
%63 = zext i32 %62 to i64
%64 = call i8* @llvm.stacksave()
%65 = alloca i8, i64 %63
%66 = load i32, i32* @AF_INET
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%68 = load i32, i32* @INET_ADDRSTRLEN
%69 = call i8* @inet_ntop(i32 %66, %struct.TYPE_2__* %67, i8* %65, i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.6, i64 0, i64 0), i8* %47, i8* %69)
%71 = call i32 @writefile(i32 %40, i32 %57)
%72 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.7, i64 0, i64 0))
%73 = call i32 @close(i32 %57)
%74 = call i32 @close(i32 %40)
br label %75
75: ; preds = %61, %59
%76 = phi i32 [ %57, %59 ], [ 0, %61 ]
ret i32 %76
}