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

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
  TYPE_1__ sin_addr;
};
struct sockaddr {
  int dummy;
};
struct hostent {
  int /*<<< orphan*/ h_addr;
};
typedef int /*<<< orphan*/ j;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
struct hostent *gethostbyname(char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memcpy(TYPE_1__ *, int /*<<< orphan*/, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char const *,
                      int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char *);
void init_server_socket(char *bind_addr, int bind_port,
                        struct sockaddr_in *server, int *server_socket) {
  char *binded;
  struct hostent *host_ptr;
  *server_socket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (*server_socket == -1) {
    perror("socket(server_socket)");
    exit(1);
  }
  int j = 1;
  if (setsockopt(*server_socket, SOL_SOCKET, SO_REUSEADDR, (const char *)&j,
                 sizeof(j)) < 0) {
    perror("setsockopt(SO_REUSEADDR)");
    exit(1);
  }
  memset(server, 0, sizeof(struct sockaddr_in));
  if (!bind_addr) {
    binded = "*";
    server->sin_addr.s_addr = htonl(INADDR_ANY);
  } else {
    host_ptr = gethostbyname(bind_addr);
    if (!host_ptr) {
      fprintf(stderr, "Error can't resolve bind address: %s\n", bind_addr);
      exit(1);
    }
    memcpy(&server->sin_addr, host_ptr->h_addr, sizeof(server->sin_addr));
    binded = inet_ntoa(server->sin_addr);
  }
  fprintf(stderr, "Binding to %s:%i\t", binded, bind_port);
  if (strcmp(binded, "*") == 0)
    fprintf(stderr, "\t");
  server->sin_family = AF_INET;
  server->sin_port = htons(bind_port);
  if (bind(*server_socket, (struct sockaddr *)server,
           sizeof(struct sockaddr_in)) < 0) {
    perror("bind(server_socket)");
    exit(1);
  }
  if (listen(*server_socket, 256) < 0) {
    perror("listen()");
    exit(1);
  }
  fputs("[OK]\n", stderr);
}


x86 assembly (clang, -O0):
<init_server_socket>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    0x2da2(%rip),%rax
mov    (%rax),%edi
mov    0x2da1(%rip),%rax
mov    (%rax),%esi
mov    0x2db0(%rip),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
cmpl   $0xffffffff,(%rax)
jne    1252 <init_server_socket+0x62>
lea    0xdbd(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
movl   $0x1,-0x34(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    0x2d82(%rip),%rax
mov    (%rax),%esi
mov    0x2d39(%rip),%rax
mov    (%rax),%edx
lea    -0x34(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
cmp    $0x0,%rax
jge    12a0 <init_server_socket+0xb0>
lea    0xd85(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
cmpq   $0x0,-0x8(%rbp)
jne    12e2 <init_server_socket+0xf2>
lea    0xd6d(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0x2d0b(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x8(%rax)
jmp    1347 <init_server_socket+0x157>
mov    -0x8(%rbp),%rdi
call   10a0 <gethostbyname@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    131f <init_server_socket+0x12f>
mov    0x2cbf(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xd23(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x18(%rbp),%rdi
add    $0x8,%rdi
mov    -0x30(%rbp),%rax
mov    (%rax),%esi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
mov    -0x18(%rbp),%rax
mov    0x8(%rax),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,-0x28(%rbp)
mov    0x2c72(%rip),%rax
mov    (%rax),%edi
mov    -0x28(%rbp),%rdx
mov    -0xc(%rbp),%ecx
lea    0xcf9(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    -0x28(%rbp),%rdi
lea    0xcbf(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%rax
jne    1396 <init_server_socket+0x1a6>
mov    0x2c3a(%rip),%rax
mov    (%rax),%edi
lea    0xcd8(%rip),%rsi
mov    $0x0,%al
call   10b0 <fprintf@plt>
mov    0x2c43(%rip),%rax
mov    (%rax),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0xc(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0x0,%rax
jge    13ea <init_server_socket+0x1fa>
lea    0xc8e(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x20(%rbp),%rax
mov    (%rax),%edi
mov    $0x100,%esi
call   10d0 <listen@plt>
cmp    $0x0,%rax
jge    141a <init_server_socket+0x22a>
lea    0xc72(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2b9f(%rip),%rax
mov    (%rax),%esi
lea    0xc5c(%rip),%rdi
call   1060 <fputs@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_server_socket>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%r14
mov    %rdx,%rbx
mov    %esi,%r15d
mov    %rdi,%rbp
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    0x2da0(%rip),%rax
mov    (%rax),%esi
mov    0x2daf(%rip),%rax
mov    (%rax),%edx
call   1110 <socket@plt>
mov    %eax,(%r14)
cmp    $0xffffffff,%eax
je     1362 <init_server_socket+0x172>
movl   $0x1,0xc(%rsp)
mov    0x2da5(%rip),%rcx
mov    (%rcx),%esi
mov    0x2d5c(%rip),%rcx
mov    (%rcx),%edx
lea    0xc(%rsp),%rcx
mov    %eax,%edi
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
test   %rax,%rax
js     136b <init_server_socket+0x17b>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1080 <memset@plt>
test   %rbp,%rbp
je     12ab <init_server_socket+0xbb>
mov    %rbp,%rdi
call   10a0 <gethostbyname@plt>
test   %rax,%rax
je     1393 <init_server_socket+0x1a3>
lea    0x8(%rbx),%rdi
mov    (%rax),%esi
mov    $0x4,%edx
call   10c0 <memcpy@plt>
mov    0x8(%rbx),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rbp
jmp    12c3 <init_server_socket+0xd3>
mov    0x2d26(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x8(%rbx)
lea    0xd6c(%rip),%rbp
mov    0x2cf6(%rip),%r12
mov    (%r12),%edi
lea    0xd82(%rip),%rsi
mov    %rbp,%rdx
mov    %r15d,%ecx
xor    %eax,%eax
call   10b0 <fprintf@plt>
lea    0xd46(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %rax,%rax
jne    1308 <init_server_socket+0x118>
mov    (%r12),%edi
lea    0xd66(%rip),%rsi
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x4(%rbx)
mov    %r15d,%edi
call   1050 <htons@plt>
mov    %eax,(%rbx)
mov    (%r14),%edi
mov    %rbx,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
js     1374 <init_server_socket+0x184>
mov    (%r14),%edi
mov    $0x100,%esi
call   10d0 <listen@plt>
test   %rax,%rax
js     137d <init_server_socket+0x18d>
mov    (%r12),%esi
lea    0xd36(%rip),%rdi
call   1060 <fputs@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xc97(%rip),%rdi
jmp    1384 <init_server_socket+0x194>
lea    0xca4(%rip),%rdi
jmp    1384 <init_server_socket+0x194>
lea    0xcee(%rip),%rdi
jmp    1384 <init_server_socket+0x194>
lea    0xcf9(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    0x2c26(%rip),%rax
mov    (%rax),%edi
lea    0xc8e(%rip),%rsi
mov    %rbp,%rdx
xor    %eax,%eax
call   10b0 <fprintf@plt>
mov    $0x1,%edi
call   1100 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [22 x i8] c"socket(server_socket)\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [25 x i8] c"setsockopt(SO_REUSEADDR)\00"
@.str.2 = [2 x i8] c"*\00"
@INADDR_ANY = global i32 0
@stderr = global i32 0
@.str.3 = [38 x i8] c"Error can't resolve bind address: %s\0A\00"
@.str.4 = [18 x i8] c"Binding to %s:%i\09\00"
@.str.5 = [2 x i8] c"\09\00"
@AF_INET = global i32 0
@.str.6 = [20 x i8] c"bind(server_socket)\00"
@.str.7 = [9 x i8] c"listen()\00"
@.str.8 = [6 x i8] c"[OK]\0A\00"
define void @init_server_socket(i8* %0, i32 %1, %struct.sockaddr_in* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca %struct.sockaddr_in*
%8 = alloca i32*
%9 = alloca i8*
%10 = alloca %struct.hostent*
%11 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store %struct.sockaddr_in* %2, %struct.sockaddr_in** %7
store i32* %3, i32** %8
%12 = load i32, i32* @PF_INET
%13 = load i32, i32* @SOCK_STREAM
%14 = load i32, i32* @IPPROTO_TCP
%15 = call i32 @socket(i32 %12, i32 %13, i32 %14)
%16 = load i32*, i32** %8
store i32 %15, i32* %16
%17 = load i32*, i32** %8
%18 = load i32, i32* %17
%19 = icmp eq i32 %18, -1
br i1 %19, label %20, label %23
20: ; preds = %4
%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 = %4
store i32 1, i32* %11
%24 = load i32*, i32** %8
%25 = load i32, i32* %24
%26 = load i32, i32* @SOL_SOCKET
%27 = load i32, i32* @SO_REUSEADDR
%28 = bitcast i32* %11 to i8*
%29 = call i64 @setsockopt(i32 %25, i32 %26, i32 %27, i8* %28, i32 4)
%30 = icmp slt i64 %29, 0
br i1 %30, label %31, label %34
31: ; preds = %23
%32 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %23
%35 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%36 = call i32 @memset(%struct.sockaddr_in* %35, i32 0, i32 12)
%37 = load i8*, i8** %5
%38 = icmp ne i8* %37, null
br i1 %38, label %45, label %39
39: ; preds = %34
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8** %9
%40 = load i32, i32* @INADDR_ANY
%41 = call i32 @htonl(i32 %40)
%42 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %42, i32 0, i32 2
%44 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %43, i32 0, i32 0
store i32 %41, i32* %44
br label %67
45: ; preds = %34
%46 = load i8*, i8** %5
%47 = call %struct.hostent* @gethostbyname(i8* %46)
store %struct.hostent* %47, %struct.hostent** %10
%48 = load %struct.hostent*, %struct.hostent** %10
%49 = icmp ne %struct.hostent* %48, null
br i1 %49, label %55, label %50
50: ; preds = %45
%51 = load i32, i32* @stderr
%52 = load i8*, i8** %5
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %51, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %52)
%54 = call i32 @exit(i32 1)
unreachable
55: ; preds = %45
%56 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%57 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %56, i32 0, i32 2
%58 = load %struct.hostent*, %struct.hostent** %10
%59 = getelementptr inbounds %struct.hostent, %struct.hostent* %58, i32 0, i32 0
%60 = load i32, i32* %59
%61 = call i32 @memcpy(%struct.TYPE_3__* %57, i32 %60, i32 4)
%62 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%63 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %62, i32 0, i32 2
%64 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %63, i32 0, i32 0
%65 = load i32, i32* %64
%66 = call i8* @inet_ntoa(i32 %65)
store i8* %66, i8** %9
br label %67
67: ; preds = %55, %39
%68 = load i32, i32* @stderr
%69 = load i8*, i8** %9
%70 = load i32, i32* %6
%71 = call i32 (i32, i8*, ...) @fprintf(i32 %68, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %69, i32 %70)
%72 = load i8*, i8** %9
%73 = call i64 @strcmp(i8* %72, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%74 = icmp eq i64 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %67
%76 = load i32, i32* @stderr
%77 = call i32 (i32, i8*, ...) @fprintf(i32 %76, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %78
78: ; preds = %75, %67
%79 = load i32, i32* @AF_INET
%80 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%81 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %80, i32 0, i32 1
store i32 %79, i32* %81
%82 = load i32, i32* %6
%83 = call i32 @htons(i32 %82)
%84 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%85 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %84, i32 0, i32 0
store i32 %83, i32* %85
%86 = load i32*, i32** %8
%87 = load i32, i32* %86
%88 = load %struct.sockaddr_in*, %struct.sockaddr_in** %7
%89 = bitcast %struct.sockaddr_in* %88 to %struct.sockaddr*
%90 = call i64 @bind(i32 %87, %struct.sockaddr* %89, i32 12)
%91 = icmp slt i64 %90, 0
br i1 %91, label %92, label %95
92: ; preds = %78
%93 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%94 = call i32 @exit(i32 1)
unreachable
95: ; preds = %78
%96 = load i32*, i32** %8
%97 = load i32, i32* %96
%98 = call i64 @listen(i32 %97, i32 256)
%99 = icmp slt i64 %98, 0
br i1 %99, label %100, label %103
100: ; preds = %95
%101 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%102 = call i32 @exit(i32 1)
unreachable
103: ; preds = %95
%104 = load i32, i32* @stderr
%105 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %104)
ret void
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, %struct.TYPE_3__ }
%struct.TYPE_3__ = type { i32 }
%struct.hostent = type { i32 }
%struct.sockaddr = type { i32 }
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str = [22 x i8] c"socket(server_socket)\00"
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [25 x i8] c"setsockopt(SO_REUSEADDR)\00"
@.str.2 = [2 x i8] c"*\00"
@INADDR_ANY = global i32 0
@stderr = global i32 0
@.str.3 = [38 x i8] c"Error can't resolve bind address: %s\0A\00"
@.str.4 = [18 x i8] c"Binding to %s:%i\09\00"
@.str.5 = [2 x i8] c"\09\00"
@AF_INET = global i32 0
@.str.6 = [20 x i8] c"bind(server_socket)\00"
@.str.7 = [9 x i8] c"listen()\00"
@.str.8 = [6 x i8] c"[OK]\0A\00"
define void @init_server_socket(i8* %0, i32 %1, %struct.sockaddr_in* %2, i32* nocapture %3) {
%5 = alloca i32
%6 = load i32, i32* @PF_INET
%7 = load i32, i32* @SOCK_STREAM
%8 = load i32, i32* @IPPROTO_TCP
%9 = tail call i32 @socket(i32 %6, i32 %7, i32 %8)
store i32 %9, i32* %3
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %14
11: ; preds = %4
%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 = %4
%15 = bitcast i32* %5 to i8*
store i32 1, i32* %5
%16 = load i32, i32* @SOL_SOCKET
%17 = load i32, i32* @SO_REUSEADDR
%18 = call i64 @setsockopt(i32 %9, i32 %16, i32 %17, i8* %15, i32 4)
%19 = icmp slt i64 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14
%21 = call i32 @perror(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %14
%24 = call i32 @memset(%struct.sockaddr_in* %2, i32 0, i32 12)
%25 = icmp eq i8* %0, null
br i1 %25, label %26, label %30
26: ; preds = %23
%27 = load i32, i32* @INADDR_ANY
%28 = call i32 @htonl(i32 %27)
%29 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2, i32 0
store i32 %28, i32* %29
br label %45
30: ; preds = %23
%31 = call %struct.hostent* @gethostbyname(i8* %0)
%32 = icmp eq %struct.hostent* %31, null
br i1 %32, label %33, label %37
33: ; preds = %30
%34 = load i32, i32* @stderr
%35 = call i32 (i32, i8*, ...) @fprintf(i32 %34, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.3, i64 0, i64 0), i8* %0)
%36 = call i32 @exit(i32 1)
unreachable
37: ; preds = %30
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
%39 = getelementptr inbounds %struct.hostent, %struct.hostent* %31, i64 0, i32 0
%40 = load i32, i32* %39
%41 = call i32 @memcpy(%struct.TYPE_3__* %38, i32 %40, i32 4)
%42 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %38, i64 0, i32 0
%43 = load i32, i32* %42
%44 = call i8* @inet_ntoa(i32 %43)
br label %45
45: ; preds = %37, %26
%46 = phi i8* [ %44, %37 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), %26 ]
%47 = load i32, i32* @stderr
%48 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.4, i64 0, i64 0), i8* %46, i32 %1)
%49 = call i64 @strcmp(i8* %46, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%50 = icmp eq i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %45
%52 = load i32, i32* @stderr
%53 = call i32 (i32, i8*, ...) @fprintf(i32 %52, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %54
54: ; preds = %51, %45
%55 = load i32, i32* @AF_INET
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
store i32 %55, i32* %56
%57 = call i32 @htons(i32 %1)
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
store i32 %57, i32* %58
%59 = load i32, i32* %3
%60 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%61 = call i64 @bind(i32 %59, %struct.sockaddr* %60, i32 12)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %54
%64 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.6, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %54
%67 = load i32, i32* %3
%68 = call i64 @listen(i32 %67, i32 256)
%69 = icmp slt i64 %68, 0
br i1 %69, label %70, label %73
70: ; preds = %66
%71 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%72 = call i32 @exit(i32 1)
unreachable
73: ; preds = %66
%74 = load i32, i32* @stderr
%75 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.8, i64 0, i64 0), i32 %74)
ret void
}