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

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ IPPROTO_TCP;
int /*<<< orphan*/ PF_INET;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, unsigned int *);
int atoi(char *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
scalar_t__ listen(int, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, int *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int write(int, int *, int);
int main(int argc, char *argv[]) {
  int serverSocket;
  int clientSocket;
  int server_port;
  struct sockaddr_in serverAddr;
  struct sockaddr_in clientAddr;
  unsigned int clientAddrLen;
  int recv_number;
  if (argc != 2) {
    fprintf(stderr, "usage: incrementServer <ServerPortNumber>\n");
    fprintf(stderr, "Defaulting to port 10001\n");
    server_port = 10001;
  } else if (argc == 2)
    server_port = atoi(argv[1]);
  serverSocket = socket(PF_INET, SOCK_STREAM, IPPROTO_TCP);
  if (serverSocket < 0) {
    perror("socket error");
    exit(1);
  }
  printf("Socket created.\n");
  bzero(&serverAddr, sizeof(serverAddr));
  serverAddr.sin_family = AF_INET;
  serverAddr.sin_addr.s_addr = htonl(INADDR_ANY);
  serverAddr.sin_port = htons(server_port);
  if (bind(serverSocket, (struct sockaddr *)&serverAddr, sizeof(serverAddr)) <
      0) {
    perror("bind() error");
    exit(1);
  }
  printf("Address binding successful.\n");
  if (listen(serverSocket, 5) < 0) {
    perror("listen() error");
    exit(1);
  }
  printf("Server process is listening for connection requests.\n");
  clientAddrLen = sizeof(clientAddr);
  for (;;) {
    clientSocket =
        accept(serverSocket, (struct sockaddr *)&clientAddr, &clientAddrLen);
    if (clientSocket < 0) {
      perror("accept() error");
      exit(1);
    }
    printf("Client TCP port: %d\n", ntohs(clientAddr.sin_port));
    if (read(clientSocket, &recv_number, sizeof(int)) != sizeof(int)) {
      perror("read() error");
      exit(1);
    }
    printf("Received number %d from a client.\n", recv_number);
    recv_number++;
    if (write(clientSocket, &recv_number, sizeof(int)) != sizeof(int)) {
      perror("write error");
      exit(1);
    }
    printf("Returned number %d to the client.\n", recv_number);
    close(clientSocket);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1256 <main+0x56>
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
lea    0xdd0(%rip),%rsi
call   1090 <fprintf@plt>
mov    0x2d8c(%rip),%rax
mov    (%rax),%edi
lea    0xde6(%rip),%rsi
call   1090 <fprintf@plt>
movl   $0x2711,-0x1c(%rbp)
jmp    1275 <main+0x75>
cmpl   $0x2,-0x8(%rbp)
jne    1270 <main+0x70>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1100 <atoi@plt>
mov    %eax,-0x1c(%rbp)
jmp    1275 <main+0x75>
mov    0x2d3c(%rip),%rax
mov    (%rax),%edi
mov    0x2d3b(%rip),%rax
mov    (%rax),%esi
mov    0x2d4a(%rip),%rax
mov    (%rax),%edx
call   1120 <socket@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jge    12b8 <main+0xb8>
lea    0xd9c(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xd93(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    -0x28(%rbp),%rdi
mov    $0xc,%esi
call   10e0 <bzero@plt>
mov    0x2d0d(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2cf9(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x24(%rbp)
mov    -0x1c(%rbp),%edi
call   1040 <htons@plt>
mov    %eax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   10c0 <bind@plt>
cmp    $0x0,%rax
jge    132d <main+0x12d>
lea    0xd45(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xd3c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10a0 <listen@plt>
cmp    $0x0,%rax
jge    1368 <main+0x168>
lea    0xd34(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
lea    0xd2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0xc,-0x3c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x3c(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x18(%rbp)
jge    13b0 <main+0x1b0>
lea    0xd31(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x38(%rbp),%edi
call   10b0 <ntohs@plt>
mov    %eax,%esi
lea    0xd20(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1080 <read@plt>
cltq
cmp    $0x4,%rax
je     13fb <main+0x1fb>
lea    0xd0a(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x40(%rbp),%esi
lea    0xcfe(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
mov    -0x18(%rbp),%edi
lea    -0x40(%rbp),%rsi
mov    $0x4,%edx
call   1030 <write@plt>
cltq
cmp    $0x4,%rax
je     1448 <main+0x248>
lea    0xced(%rip),%rdi
call   10d0 <perror@plt>
mov    $0x1,%edi
call   1110 <exit@plt>
mov    -0x40(%rbp),%esi
lea    0xce0(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x18(%rbp),%edi
call   1070 <close@plt>
jmp    137d <main+0x17d>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x28,%rsp
cmp    $0x2,%edi
jne    1230 <main+0x20>
mov    0x8(%rsi),%rdi
call   1110 <atoi@plt>
mov    %eax,%ebx
jmp    1258 <main+0x48>
mov    0x2d91(%rip),%rbx
mov    (%rbx),%edi
lea    0xdc0(%rip),%rsi
call   10a0 <fprintf@plt>
mov    (%rbx),%edi
lea    0xddd(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0x2711,%ebx
mov    0x2d59(%rip),%rax
mov    (%rax),%edi
mov    0x2d58(%rip),%rax
mov    (%rax),%esi
mov    0x2d67(%rip),%rax
mov    (%rax),%edx
call   1130 <socket@plt>
test   %eax,%eax
jns    1288 <main+0x78>
lea    0xdc2(%rip),%rdi
jmp    1407 <main+0x1f7>
mov    %eax,%r15d
lea    0xe5f(%rip),%rdi
call   1030 <puts@plt>
lea    0x8(%rsp),%rbp
mov    %rbp,%rdi
mov    $0xc,%esi
call   10f0 <bzero@plt>
mov    0x2d38(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x10(%rsp)
mov    0x2d23(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0xc(%rsp)
mov    %ebx,%edi
call   1050 <htons@plt>
mov    %eax,0x8(%rsp)
mov    %r15d,%edi
mov    %rbp,%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
test   %rax,%rax
jns    12f4 <main+0xe4>
lea    0xd63(%rip),%rdi
jmp    1407 <main+0x1f7>
lea    0xe06(%rip),%rdi
call   1030 <puts@plt>
mov    %r15d,%edi
mov    $0x5,%esi
call   10b0 <listen@plt>
test   %rax,%rax
jns    131e <main+0x10e>
lea    0xd46(%rip),%rdi
jmp    1407 <main+0x1f7>
lea    0xdf8(%rip),%rdi
call   1030 <puts@plt>
movl   $0xc,0x4(%rsp)
lea    0x18(%rsp),%rsi
lea    0x4(%rsp),%rdx
mov    %r15d,%edi
call   1100 <accept@plt>
test   %eax,%eax
js     13ee <main+0x1de>
mov    %eax,%ebp
mov    %rsp,%rbx
lea    0x18(%rsp),%r14
lea    0x4(%rsp),%r12
nopl   0x0(%rax,%rax,1)
mov    0x18(%rsp),%edi
call   10c0 <ntohs@plt>
lea    0xd0d(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1090 <read@plt>
cmp    $0x4,%eax
jne    13f7 <main+0x1e7>
mov    (%rsp),%r13d
lea    0xd07(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
add    $0x1,%r13d
mov    %r13d,(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1040 <write@plt>
cmp    $0x4,%eax
jne    1400 <main+0x1f0>
lea    0xd09(%rip),%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1060 <printf@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %r15d,%edi
mov    %r14,%rsi
mov    %r12,%rdx
call   1100 <accept@plt>
mov    %eax,%ebp
test   %eax,%eax
jns    1360 <main+0x150>
lea    0xc79(%rip),%rdi
jmp    1407 <main+0x1f7>
lea    0xc94(%rip),%rdi
jmp    1407 <main+0x1f7>
lea    0xcbb(%rip),%rdi
call   10e0 <perror@plt>
mov    $0x1,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [43 x i8] c"usage: incrementServer <ServerPortNumber>\0A\00"
@.str.1 = [26 x i8] c"Defaulting to port 10001\0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [13 x i8] c"socket error\00"
@.str.3 = [17 x i8] c"Socket created.\0A\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.5 = [29 x i8] c"Address binding successful.\0A\00"
@.str.6 = [15 x i8] c"listen() error\00"
@.str.7 = [54 x i8] c"Server process is listening for connection requests.\0A\00"
@.str.8 = [15 x i8] c"accept() error\00"
@.str.9 = [21 x i8] c"Client TCP port: %d\0A\00"
@.str.10 = [13 x i8] c"read() error\00"
@.str.11 = [35 x i8] c"Received number %d from a client.\0A\00"
@.str.12 = [12 x i8] c"write error\00"
@.str.13 = [35 x i8] c"Returned number %d to the client.\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 i32
%9 = alloca %struct.sockaddr_in
%10 = alloca %struct.sockaddr_in
%11 = alloca i32
%12 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%13 = load i32, i32* %4
%14 = icmp ne i32 %13, 2
br i1 %14, label %15, label %20
15: ; preds = %2
%16 = load i32, i32* @stderr
%17 = call i32 @fprintf(i32 %16, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%18 = load i32, i32* @stderr
%19 = call i32 @fprintf(i32 %18, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
store i32 10001, i32* %8
br label %29
20: ; preds = %2
%21 = load i32, i32* %4
%22 = icmp eq i32 %21, 2
br i1 %22, label %23, label %28
23: ; preds = %20
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = call i32 @atoi(i8* %26)
store i32 %27, i32* %8
br label %28
28: ; preds = %23, %20
br label %29
29: ; preds = %28, %15
%30 = load i32, i32* @PF_INET
%31 = load i32, i32* @SOCK_STREAM
%32 = load i32, i32* @IPPROTO_TCP
%33 = call i32 @socket(i32 %30, i32 %31, i32 %32)
store i32 %33, i32* %6
%34 = load i32, i32* %6
%35 = icmp slt i32 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %29
%37 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%38 = call i32 @exit(i32 1)
unreachable
39: ; preds = %29
%40 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%41 = call i32 @bzero(%struct.sockaddr_in* %9, i32 12)
%42 = load i32, i32* @AF_INET
%43 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %42, i32* %43
%44 = load i32, i32* @INADDR_ANY
%45 = call i32 @htonl(i32 %44)
%46 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
%47 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %46, i32 0, i32 0
store i32 %45, i32* %47
%48 = load i32, i32* %8
%49 = call i32 @htons(i32 %48)
%50 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
store i32 %49, i32* %50
%51 = load i32, i32* %6
%52 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%53 = call i64 @bind(i32 %51, %struct.sockaddr* %52, i32 12)
%54 = icmp slt i64 %53, 0
br i1 %54, label %55, label %58
55: ; preds = %39
%56 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%57 = call i32 @exit(i32 1)
unreachable
58: ; preds = %39
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.5, i64 0, i64 0))
%60 = load i32, i32* %6
%61 = call i64 @listen(i32 %60, i32 5)
%62 = icmp slt i64 %61, 0
br i1 %62, label %63, label %66
63: ; preds = %58
%64 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%65 = call i32 @exit(i32 1)
unreachable
66: ; preds = %58
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.7, i64 0, i64 0))
store i32 12, i32* %11
br label %68
68: ; preds = %101, %66
%69 = load i32, i32* %6
%70 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%71 = call i32 @accept(i32 %69, %struct.sockaddr* %70, i32* %11)
store i32 %71, i32* %7
%72 = load i32, i32* %7
%73 = icmp slt i32 %72, 0
br i1 %73, label %74, label %77
74: ; preds = %68
%75 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%76 = call i32 @exit(i32 1)
unreachable
77: ; preds = %68
%78 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call i32 @ntohs(i32 %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %80)
%82 = load i32, i32* %7
%83 = call i32 @read(i32 %82, i32* %12, i32 4)
%84 = sext i32 %83 to i64
%85 = icmp ne i64 %84, 4
br i1 %85, label %86, label %89
86: ; preds = %77
%87 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%88 = call i32 @exit(i32 1)
unreachable
89: ; preds = %77
%90 = load i32, i32* %12
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0), i32 %90)
%92 = load i32, i32* %12
%93 = add nsw i32 %92, 1
store i32 %93, i32* %12
%94 = load i32, i32* %7
%95 = call i32 @write(i32 %94, i32* %12, i32 4)
%96 = sext i32 %95 to i64
%97 = icmp ne i64 %96, 4
br i1 %97, label %98, label %101
98: ; preds = %89
%99 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%100 = call i32 @exit(i32 1)
unreachable
101: ; preds = %89
%102 = load i32, i32* %12
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 %102)
%104 = load i32, i32* %7
%105 = call i32 @close(i32 %104)
br label %68
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [43 x i8] c"usage: incrementServer <ServerPortNumber>\0A\00"
@.str.1 = [26 x i8] c"Defaulting to port 10001\0A\00"
@PF_INET = global i32 0
@SOCK_STREAM = global i32 0
@IPPROTO_TCP = global i32 0
@.str.2 = [13 x i8] c"socket error\00"
@AF_INET = global i32 0
@INADDR_ANY = global i32 0
@.str.4 = [13 x i8] c"bind() error\00"
@.str.6 = [15 x i8] c"listen() error\00"
@.str.8 = [15 x i8] c"accept() error\00"
@.str.9 = [21 x i8] c"Client TCP port: %d\0A\00"
@.str.10 = [13 x i8] c"read() error\00"
@.str.11 = [35 x i8] c"Received number %d from a client.\0A\00"
@.str.12 = [12 x i8] c"write error\00"
@.str.13 = [35 x i8] c"Returned number %d to the client.\0A\00"
@str = [16 x i8] c"Socket created.\00"
@str.14 = [28 x i8] c"Address binding successful.\00"
@str.15 = [53 x i8] c"Server process is listening for connection requests.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca i32
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast %struct.sockaddr_in* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = bitcast i32* %6 to i8*
%11 = icmp eq i32 %0, 2
br i1 %11, label %17, label %12
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0))
br label %21
17: ; preds = %2
%18 = getelementptr inbounds i8*, i8** %1, i64 1
%19 = load i8*, i8** %18
%20 = tail call i32 @atoi(i8* %19)
br label %21
21: ; preds = %17, %12
%22 = phi i32 [ 10001, %12 ], [ %20, %17 ]
%23 = load i32, i32* @PF_INET
%24 = load i32, i32* @SOCK_STREAM
%25 = load i32, i32* @IPPROTO_TCP
%26 = tail call i32 @socket(i32 %23, i32 %24, i32 %25)
%27 = icmp slt i32 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %21
%29 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%30 = tail call i32 @exit(i32 1)
unreachable
31: ; preds = %21
%32 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%33 = call i32 @bzero(%struct.sockaddr_in* %3, i32 12)
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %34, i32* %35
%36 = load i32, i32* @INADDR_ANY
%37 = tail call i32 @htonl(i32 %36)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %37, i32* %38
%39 = tail call i32 @htons(i32 %22)
%40 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
store i32 %39, i32* %40
%41 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%42 = call i64 @bind(i32 %26, %struct.sockaddr* %41, i32 12)
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %31
%45 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %31
%48 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str.14, i64 0, i64 0))
%49 = call i64 @listen(i32 %26, i32 5)
%50 = icmp slt i64 %49, 0
br i1 %50, label %51, label %54
51: ; preds = %47
%52 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%53 = call i32 @exit(i32 1)
unreachable
54: ; preds = %47
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str.15, i64 0, i64 0))
store i32 12, i32* %5
%56 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%57 = call i32 @accept(i32 %26, %struct.sockaddr* %56, i32* %5)
%58 = icmp slt i32 %57, 0
br i1 %58, label %61, label %59
59: ; preds = %54
%60 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
br label %64
61: ; preds = %83, %54
%62 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%63 = call i32 @exit(i32 1)
unreachable
64: ; preds = %59, %83
%65 = phi i32 [ %57, %59 ], [ %86, %83 ]
%66 = load i32, i32* %60
%67 = call i32 @ntohs(i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.9, i64 0, i64 0), i32 %67)
%69 = call i32 @read(i32 %65, i32* %6, i32 4)
%70 = icmp eq i32 %69, 4
br i1 %70, label %74, label %71
71: ; preds = %64
%72 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.10, i64 0, i64 0))
%73 = call i32 @exit(i32 1)
unreachable
74: ; preds = %64
%75 = load i32, i32* %6
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.11, i64 0, i64 0), i32 %75)
%77 = add nsw i32 %75, 1
store i32 %77, i32* %6
%78 = call i32 @write(i32 %65, i32* %6, i32 4)
%79 = icmp eq i32 %78, 4
br i1 %79, label %83, label %80
80: ; preds = %74
%81 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.12, i64 0, i64 0))
%82 = call i32 @exit(i32 1)
unreachable
83: ; preds = %74
%84 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.13, i64 0, i64 0), i32 %77)
%85 = call i32 @close(i32 %65)
%86 = call i32 @accept(i32 %26, %struct.sockaddr* %56, i32* %5)
%87 = icmp slt i32 %86, 0
br i1 %87, label %61, label %64
}