#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 {
  int sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ server_addr;
typedef int /*<<< orphan*/ client_addr;
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(void *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int server_socket;
  if ((server_socket = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("socket()");
    exit(1);
  }
  struct sockaddr_in server_addr;
  memset((void *)&server_addr, 0, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_port = htons(5555);
  server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  if (bind(server_socket, (struct sockaddr *)&server_addr,
           sizeof(server_addr)) < 0) {
    perror("bind()");
    exit(1);
  }
  if (listen(server_socket, 5) < 0) {
    perror("listen()");
    exit(1);
  }
  int accept_socket;
  struct sockaddr_in client_addr;
  int client_addr_len = sizeof(client_addr);
  char buffer[1024];
  int iDataNum;
  while (1) {
    printf("accept() ... start\n");
    accept_socket = accept(server_socket, (struct sockaddr *)&client_addr,
                           (socklen_t *)&client_addr_len);
    if (accept_socket < 0) {
      perror("accept()");
      exit(1);
    } else {
      printf("accept() ... done\n");
    }
    printf("recv() ... start\n");
    iDataNum = recv(accept_socket, buffer, sizeof(buffer), 0);
    if (iDataNum < 0) {
      perror("recv()");
      continue;
    } else {
      printf("recv() ... done\n");
    }
    printf("IP is %s\n", inet_ntoa(client_addr.sin_addr));
    printf("Port is %d\n", htons(client_addr.sin_port));
    printf("Recv length is %d\n", iDataNum);
    printf("Recv Data   is %s\n\n", buffer);
    send(accept_socket, buffer, sizeof(buffer), 0);
    printf("close client connect ... start\n");
    close(accept_socket);
    printf("close client connect ... done\n");
    if (strcmp(buffer, "quit") == 0) {
      break;
    }
  }
  printf("close server socket ... start\n");
  close(server_socket);
  printf("close server socket ... done\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2dd8(%rip),%rax
mov    (%rax),%edi
mov    0x2db7(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1110 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jge    1244 <main+0x54>
lea    0xdcb(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   1090 <memset@plt>
mov    0x2d8d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    $0x15b3,%edi
call   1050 <htons@plt>
mov    %eax,-0x20(%rbp)
mov    0x2d6c(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0x0,%rax
jge    12af <main+0xbf>
lea    0xd69(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
cmp    $0x0,%rax
jge    12dc <main+0xec>
lea    0xd43(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
movl   $0xc,-0x34(%rbp)
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x24(%rbp)
jge    1324 <main+0x134>
lea    0xd18(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1100 <exit@plt>
lea    0xd0b(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0xd10(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x444(%rbp)
cmpl   $0x0,-0x444(%rbp)
jge    137a <main+0x18a>
lea    0xceb(%rip),%rdi
call   10e0 <perror@plt>
jmp    12e3 <main+0xf3>
lea    0xce1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x2c(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    %rax,%rsi
lea    0xcd9(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x30(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,%esi
lea    0xccb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x444(%rbp),%esi
lea    0xcc3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x440(%rbp),%rsi
lea    0xcc1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%edi
lea    -0x440(%rbp),%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1060 <send@plt>
lea    0xcb1(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x24(%rbp),%edi
call   10a0 <close@plt>
lea    0xcbb(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x440(%rbp),%rdi
lea    0xcc5(%rip),%rsi
call   10b0 <strcmp@plt>
cmp    $0x0,%rax
jne    143e <main+0x24e>
jmp    1443 <main+0x253>
jmp    12e3 <main+0xf3>
lea    0xcaa(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    -0x14(%rbp),%edi
call   10a0 <close@plt>
lea    0xcb3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
xor    %eax,%eax
add    $0x450,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x438,%rsp
mov    0x2dd0(%rip),%rbx
mov    (%rbx),%edi
mov    0x2daf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1120 <socket@plt>
test   %eax,%eax
js     1435 <main+0x235>
mov    %eax,%ebp
lea    0x20(%rsp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10a0 <memset@plt>
mov    (%rbx),%eax
mov    %eax,0x28(%rsp)
mov    $0x15b3,%edi
call   1060 <htons@plt>
mov    %eax,0x20(%rsp)
mov    0x2d7d(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x24(%rsp)
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
js     143e <main+0x23e>
mov    %ebp,%edi
mov    $0x5,%esi
call   10d0 <listen@plt>
test   %rax,%rax
js     1447 <main+0x247>
movl   $0xc,0xc(%rsp)
lea    0xdc1(%rip),%rdi
call   1040 <puts@plt>
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
mov    %ebp,%edi
call   1100 <accept@plt>
test   %eax,%eax
js     141f <main+0x21f>
mov    %eax,%r15d
lea    0x30(%rsp),%rbx
lea    0xdf9(%rip),%r13
lea    0xd88(%rip),%r14
jmp    1318 <main+0x118>
lea    0xd3b(%rip),%rdi
call   10f0 <perror@plt>
nopl   0x0(%rax)
lea    0xd74(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
lea    0x10(%rsp),%rsi
lea    0xc(%rsp),%rdx
call   1100 <accept@plt>
mov    %eax,%r15d
test   %eax,%eax
js     141f <main+0x21f>
lea    0xd5f(%rip),%rdi
call   1040 <puts@plt>
lea    0xd65(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
js     12e0 <main+0xe0>
mov    %eax,%r12d
lea    0xd51(%rip),%rdi
call   1040 <puts@plt>
mov    0x14(%rsp),%edi
call   1050 <inet_ntoa@plt>
lea    0xcc4(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    0x10(%rsp),%edi
call   1060 <htons@plt>
lea    0xcb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xcb0(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xcb2(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    $0x400,%edx
xor    %ecx,%ecx
call   1070 <send@plt>
lea    0xcee(%rip),%rdi
call   1040 <puts@plt>
mov    %r15d,%edi
call   10b0 <close@plt>
mov    %r13,%rdi
call   1040 <puts@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   10c0 <strcmp@plt>
test   %rax,%rax
jne    12f0 <main+0xf0>
lea    0xcfb(%rip),%rdi
call   1040 <puts@plt>
mov    %ebp,%edi
call   10b0 <close@plt>
lea    0xd06(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbf3(%rip),%rdi
call   10f0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xbc4(%rip),%rdi
jmp    1426 <main+0x226>
lea    0xbc4(%rip),%rdi
jmp    1426 <main+0x226>
lea    0xbc2(%rip),%rdi
jmp    1426 <main+0x226>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [9 x i8] c"socket()\00"
@INADDR_ANY = global i32 0
@.str.1 = [7 x i8] c"bind()\00"
@.str.2 = [9 x i8] c"listen()\00"
@.str.3 = [20 x i8] c"accept() ... start\0A\00"
@.str.4 = [9 x i8] c"accept()\00"
@.str.5 = [19 x i8] c"accept() ... done\0A\00"
@.str.6 = [18 x i8] c"recv() ... start\0A\00"
@.str.7 = [7 x i8] c"recv()\00"
@.str.8 = [17 x i8] c"recv() ... done\0A\00"
@.str.9 = [10 x i8] c"IP is %s\0A\00"
@.str.10 = [12 x i8] c"Port is %d\0A\00"
@.str.11 = [19 x i8] c"Recv length is %d\0A\00"
@.str.12 = [20 x i8] c"Recv Data is %s\0A\0A\00"
@.str.13 = [32 x i8] c"close client connect ... start\0A\00"
@.str.14 = [31 x i8] c"close client connect ... done\0A\00"
@.str.15 = [5 x i8] c"quit\00"
@.str.16 = [31 x i8] c"close server socket ... start\0A\00"
@.str.17 = [30 x i8] c"close server socket ... done\0A\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 i32
%9 = alloca %struct.sockaddr_in
%10 = alloca i32
%11 = alloca [1024 x i8]
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* @AF_INET
%14 = load i32, i32* @SOCK_STREAM
%15 = call i32 @socket(i32 %13, i32 %14, i32 0)
store i32 %15, i32* %6
%16 = icmp slt i32 %15, 0
br i1 %16, label %17, label %20
17: ; preds = %2
%18 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%19 = call i32 @exit(i32 1)
unreachable
20: ; preds = %2
%21 = bitcast %struct.sockaddr_in* %7 to i8*
%22 = call i32 @memset(i8* %21, i32 0, i32 12)
%23 = load i32, i32* @AF_INET
%24 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 2
store i32 %23, i32* %24
%25 = call i32 @htons(i32 5555)
%26 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i32 0, i32 0
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* %7, i32 0, i32 1
%30 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %29, i32 0, i32 0
store i32 %28, i32* %30
%31 = load i32, i32* %6
%32 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%33 = call i64 @bind(i32 %31, %struct.sockaddr* %32, i32 12)
%34 = icmp slt i64 %33, 0
br i1 %34, label %35, label %38
35: ; preds = %20
%36 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%37 = call i32 @exit(i32 1)
unreachable
38: ; preds = %20
%39 = load i32, i32* %6
%40 = call i64 @listen(i32 %39, i32 5)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %45
42: ; preds = %38
%43 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %38
store i32 12, i32* %10
br label %46
46: ; preds = %45, %65, %94
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.3, i64 0, i64 0))
%48 = load i32, i32* %6
%49 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%50 = call i32 @accept(i32 %48, %struct.sockaddr* %49, i32* %10)
store i32 %50, i32* %8
%51 = load i32, i32* %8
%52 = icmp slt i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %46
%54 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%55 = call i32 @exit(i32 1)
unreachable
56: ; preds = %46
%57 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.5, i64 0, i64 0))
br label %58
58: ; preds = %56
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.6, i64 0, i64 0))
%60 = load i32, i32* %8
%61 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%62 = call i32 @recv(i32 %60, i8* %61, i32 1024, i32 0)
store i32 %62, i32* %12
%63 = load i32, i32* %12
%64 = icmp slt i32 %63, 0
br i1 %64, label %65, label %67
65: ; preds = %58
%66 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %46
67: ; preds = %58
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.8, i64 0, i64 0))
br label %69
69: ; preds = %67
%70 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%71 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %70, i32 0, i32 0
%72 = load i32, i32* %71
%73 = call i8* @inet_ntoa(i32 %72)
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%76 = load i32, i32* %75
%77 = call i32 @htons(i32 %76)
%78 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %77)
%79 = load i32, i32* %12
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %79)
%81 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%82 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* %81)
%83 = load i32, i32* %8
%84 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%85 = call i32 @send(i32 %83, i8* %84, i32 1024, i32 0)
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.13, i64 0, i64 0))
%87 = load i32, i32* %8
%88 = call i32 @close(i32 %87)
%89 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.14, i64 0, i64 0))
%90 = getelementptr inbounds [1024 x i8], [1024 x i8]* %11, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %69
br label %95
94: ; preds = %69
br label %46
95: ; preds = %93
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.16, i64 0, i64 0))
%97 = load i32, i32* %6
%98 = call i32 @close(i32 %97)
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.17, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [9 x i8] c"socket()\00"
@INADDR_ANY = global i32 0
@.str.1 = [7 x i8] c"bind()\00"
@.str.2 = [9 x i8] c"listen()\00"
@.str.4 = [9 x i8] c"accept()\00"
@.str.7 = [7 x i8] c"recv()\00"
@.str.9 = [10 x i8] c"IP is %s\0A\00"
@.str.10 = [12 x i8] c"Port is %d\0A\00"
@.str.11 = [19 x i8] c"Recv length is %d\0A\00"
@.str.12 = [20 x i8] c"Recv Data is %s\0A\0A\00"
@.str.15 = [5 x i8] c"quit\00"
@str = [19 x i8] c"accept() ... start\00"
@str.18 = [18 x i8] c"accept() ... done\00"
@str.19 = [17 x i8] c"recv() ... start\00"
@str.20 = [16 x i8] c"recv() ... done\00"
@str.21 = [31 x i8] c"close client connect ... start\00"
@str.22 = [30 x i8] c"close client connect ... done\00"
@str.23 = [30 x i8] c"close server socket ... start\00"
@str.24 = [29 x i8] c"close server socket ... done\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 [1024 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 slt i32 %9, 0
br i1 %10, label %11, label %14
11: ; preds = %2
%12 = tail call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 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 = call i32 @memset(i8* %15, i32 0, i32 12)
%17 = load i32, i32* @AF_INET
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %17, i32* %18
%19 = call i32 @htons(i32 5555)
%20 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %19, i32* %20
%21 = load i32, i32* @INADDR_ANY
%22 = call i32 @htonl(i32 %21)
%23 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %22, i32* %23
%24 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%25 = call i64 @bind(i32 %9, %struct.sockaddr* %24, i32 12)
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %14
%28 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %14
%31 = call i64 @listen(i32 %9, i32 5)
%32 = icmp slt i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %30
%34 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @exit(i32 1)
unreachable
36: ; preds = %30
%37 = bitcast %struct.sockaddr_in* %4 to i8*
%38 = bitcast i32* %5 to i8*
store i32 12, i32* %5
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %6, i64 0, i64 0
%40 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%41 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%42 = call i32 @accept(i32 %9, %struct.sockaddr* %41, i32* %5)
%43 = icmp slt i32 %42, 0
br i1 %43, label %47, label %44
44: ; preds = %36
%45 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
br label %50
47: ; preds = %58, %36
%48 = call i32 @perror(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
%49 = call i32 @exit(i32 1)
unreachable
50: ; preds = %44, %58
%51 = phi i32 [ %42, %44 ], [ %60, %58 ]
%52 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str.18, i64 0, i64 0))
%53 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str.19, i64 0, i64 0))
%54 = call i32 @recv(i32 %51, i8* %39, i32 1024, i32 0)
%55 = icmp slt i32 %54, 0
br i1 %55, label %56, label %62
56: ; preds = %50
%57 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %58
58: ; preds = %56, %62
%59 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%60 = call i32 @accept(i32 %9, %struct.sockaddr* %41, i32* %5)
%61 = icmp slt i32 %60, 0
br i1 %61, label %47, label %50
62: ; preds = %50
%63 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str.20, i64 0, i64 0))
%64 = load i32, i32* %45
%65 = call i8* @inet_ntoa(i32 %64)
%66 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.9, i64 0, i64 0), i8* %65)
%67 = load i32, i32* %46
%68 = call i32 @htons(i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.10, i64 0, i64 0), i32 %68)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.11, i64 0, i64 0), i32 %54)
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.12, i64 0, i64 0), i8* %39)
%72 = call i32 @send(i32 %51, i8* %39, i32 1024, i32 0)
%73 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @str.21, i64 0, i64 0))
%74 = call i32 @close(i32 %51)
%75 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.22, i64 0, i64 0))
%76 = call i64 @strcmp(i8* %39, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.15, i64 0, i64 0))
%77 = icmp eq i64 %76, 0
br i1 %77, label %78, label %58
78: ; preds = %62
%79 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str.23, i64 0, i64 0))
%80 = call i32 @close(i32 %9)
%81 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.24, i64 0, i64 0))
ret i32 0
}