#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 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*/ server;
typedef int /*<<< orphan*/ fullClientList;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ client;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int connectionHandler(int, int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int listen(int, int);
int /*<<< orphan*/ memcpy(int /*<<< orphan*/ *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int sock, fd;
  socklen_t clientLen;
  struct sockaddr_in server, client;
  fd_set fullClientList, activeClientList;
  int i;
  FD_ZERO(&fullClientList);
  FD_ZERO(&activeClientList);
  printf(
      "FD_SETSIZE (number of maximum clients this server can monitor) = %d\n",
      FD_SETSIZE);
  if ((sock = socket(AF_INET, SOCK_STREAM, 0)) == -1) {
    do {
      perror("socket");
      exit(EXIT_FAILURE);
    } while (0);
  }
  server.sin_family = AF_INET;
  server.sin_addr.s_addr = htonl(INADDR_ANY);
  server.sin_port = htons(8000);
  if (bind(sock, (struct sockaddr *)&server, (socklen_t)sizeof(server)) == -1) {
    do {
      perror("bind");
      exit(EXIT_FAILURE);
    } while (0);
  }
  if (listen(sock, 5) == -1) {
    do {
      perror("listen");
      exit(EXIT_FAILURE);
    } while (0);
  }
  printf("Listening on port %d\n", 8000);
  FD_SET(sock, &fullClientList);
  while (1) {
    memcpy(&activeClientList, &fullClientList, sizeof(fullClientList));
    select(FD_SETSIZE, &activeClientList, NULL, NULL, NULL);
    if (FD_ISSET(sock, &activeClientList)) {
      clientLen = sizeof(client);
      if ((fd = accept(sock, (struct sockaddr *)&client,
                       (socklen_t *)&clientLen)) == -1) {
        do {
          perror("accept");
          exit(EXIT_FAILURE);
        } while (0);
      }
      FD_SET(fd, &fullClientList);
      printf("Got new connection from client: %d\n", client.sin_addr.s_addr);
    }
    for (i = 3; i < FD_SETSIZE; i++) {
      if (i != sock) {
        if (FD_ISSET(i, &activeClientList)) {
          if (connectionHandler(i, i) == -1) {
            printf("Client closed connection, so server closing connection\n");
            close(i);
            FD_CLR(i, &fullClientList);
          }
        }
      }
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x3c(%rbp),%rdi
call   1090 <FD_ZERO@plt>
lea    -0x40(%rbp),%rdi
call   1090 <FD_ZERO@plt>
mov    0x2d89(%rip),%rax
mov    (%rax),%esi
lea    0xdb8(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2d92(%rip),%rax
mov    (%rax),%edi
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1130 <socket@plt>
mov    %eax,-0x14(%rbp)
cmp    $0xffffffff,%eax
jne    1293 <main+0x83>
jmp    1279 <main+0x69>
lea    0xdc5(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2d34(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    0x2d4e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x20(%rbp)
mov    0x2d3a(%rip),%rax
mov    (%rax),%edi
call   1060 <htonl@plt>
mov    %eax,-0x28(%rbp)
mov    $0x1f40,%edi
call   1040 <htons@plt>
mov    %eax,-0x24(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
mov    $0xc,%edx
call   10d0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12f6 <main+0xe6>
jmp    12dc <main+0xcc>
lea    0xd69(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2cd1(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x14(%rbp),%edi
mov    $0x5,%esi
call   10c0 <listen@plt>
cmp    $0xffffffff,%eax
jne    132b <main+0x11b>
jmp    1311 <main+0x101>
lea    0xd39(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2c9c(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
lea    0xd26(%rip),%rdi
mov    $0x1f40,%esi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x14(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   1120 <FD_SET@plt>
lea    -0x40(%rbp),%rdi
lea    -0x3c(%rbp),%rsi
mov    $0x4,%edx
call   1080 <memcpy@plt>
mov    0x2c65(%rip),%rax
mov    (%rax),%edi
lea    -0x40(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10a0 <select@plt>
mov    -0x14(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     13ee <main+0x1de>
movl   $0xc,-0x1c(%rbp)
mov    -0x14(%rbp),%edi
lea    -0x38(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10f0 <accept@plt>
mov    %eax,-0x18(%rbp)
cmp    $0xffffffff,%eax
jne    13d1 <main+0x1c1>
jmp    13b7 <main+0x1a7>
lea    0xcb0(%rip),%rdi
call   10e0 <perror@plt>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
call   1110 <exit@plt>
mov    -0x18(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   1120 <FD_SET@plt>
mov    -0x38(%rbp),%esi
lea    0xc8e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x3,-0x44(%rbp)
mov    -0x44(%rbp),%eax
mov    0x2bc9(%rip),%rcx
cmp    (%rcx),%eax
jge    147c <main+0x26c>
mov    -0x44(%rbp),%eax
cmp    -0x14(%rbp),%eax
je     1469 <main+0x259>
mov    -0x44(%rbp),%edi
lea    -0x40(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1464 <main+0x254>
mov    -0x44(%rbp),%edi
mov    -0x44(%rbp),%esi
call   10b0 <connectionHandler@plt>
cmp    $0xffffffff,%eax
jne    145f <main+0x24f>
lea    0xc55(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x44(%rbp),%edi
call   1070 <close@plt>
mov    -0x44(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   1100 <FD_CLR@plt>
jmp    1464 <main+0x254>
jmp    1469 <main+0x259>
jmp    146e <main+0x25e>
mov    -0x44(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x44(%rbp)
jmp    13f5 <main+0x1e5>
jmp    134a <main+0x13a>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
lea    0x10(%rsp),%rdi
call   10a0 <FD_ZERO@plt>
lea    0xc(%rsp),%rdi
call   10a0 <FD_ZERO@plt>
mov    0x2d7f(%rip),%r13
mov    0x0(%r13),%esi
lea    0xdac(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    0x2d86(%rip),%rbp
mov    0x0(%rbp),%edi
mov    0x2d64(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
cmp    $0xffffffff,%eax
jne    1286 <main+0x66>
lea    0xdc4(%rip),%rdi
jmp    13f0 <main+0x1d0>
mov    %eax,%ebx
mov    0x0(%rbp),%eax
mov    %eax,0x20(%rsp)
mov    0x2d4a(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,0x18(%rsp)
mov    $0x1f40,%edi
call   1050 <htons@plt>
mov    %eax,0x1c(%rsp)
lea    0x18(%rsp),%rsi
mov    %ebx,%edi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0xffffffff,%eax
jne    12d1 <main+0xb1>
lea    0xd80(%rip),%rdi
jmp    13f0 <main+0x1d0>
mov    %ebx,%edi
mov    $0x5,%esi
call   10d0 <listen@plt>
cmp    $0xffffffff,%eax
jne    12ee <main+0xce>
lea    0xd68(%rip),%rdi
jmp    13f0 <main+0x1d0>
lea    0xd63(%rip),%rdi
mov    $0x1f40,%esi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0x10(%rsp),%r14
mov    %ebx,%edi
mov    %r14,%rsi
call   1130 <FD_SET@plt>
lea    0xc(%rsp),%r15
lea    0xd7d(%rip),%r12
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0x4,%edx
call   1090 <memcpy@plt>
mov    0x0(%r13),%edi
mov    %r15,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10b0 <select@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     138c <main+0x16c>
movl   $0xc,0x14(%rsp)
mov    %ebx,%edi
lea    0x28(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1100 <accept@plt>
cmp    $0xffffffff,%eax
je     13e9 <main+0x1c9>
mov    %eax,%edi
mov    %r14,%rsi
call   1130 <FD_SET@plt>
mov    0x28(%rsp),%esi
lea    0xcf0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
cmpl   $0x4,0x0(%r13)
jl     1320 <main+0x100>
mov    $0x3,%ebp
jmp    13ad <main+0x18d>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
cmp    0x0(%r13),%ebp
jge    1320 <main+0x100>
cmp    %ebp,%ebx
je     13a0 <main+0x180>
mov    %ebp,%edi
mov    %r15,%rsi
call   1040 <FD_ISSET@plt>
test   %rax,%rax
je     13a0 <main+0x180>
mov    %ebp,%edi
mov    %ebp,%esi
call   10c0 <connectionHandler@plt>
cmp    $0xffffffff,%eax
jne    13a0 <main+0x180>
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %ebp,%edi
mov    %r14,%rsi
call   1110 <FD_CLR@plt>
jmp    13a0 <main+0x180>
lea    0xc7e(%rip),%rdi
call   10f0 <perror@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%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 }
@.str = [69 x i8] c"FD_SETSIZE (number of maximum clients this server can monitor) = %d\0A\00"
@FD_SETSIZE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@EXIT_FAILURE = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [5 x i8] c"bind\00"
@.str.3 = [7 x i8] c"listen\00"
@.str.4 = [22 x i8] c"Listening on port %d\0A\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [36 x i8] c"Got new connection from client: %d\0A\00"
@.str.7 = [56 x i8] c"Client closed connection, so server closing connection\0A\00"
@EXIT_SUCCESS = global i32 0
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
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = call i32 @FD_ZERO(i32* %11)
%15 = call i32 @FD_ZERO(i32* %12)
%16 = load i32, i32* @FD_SETSIZE
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = call i32 @socket(i32 %18, i32 %19, i32 0)
store i32 %20, i32* %6
%21 = icmp eq i32 %20, -1
br i1 %21, label %22, label %28
22: ; preds = %2
br label %23
23: ; preds = %22
%24 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%25 = load i32, i32* @EXIT_FAILURE
%26 = call i32 @exit(i32 %25)
unreachable
27: ; No predecessors!
br label %28
28: ; preds = %27, %2
%29 = load i32, i32* @AF_INET
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 2
store i32 %29, i32* %30
%31 = load i32, i32* @INADDR_ANY
%32 = call i32 @htonl(i32 %31)
%33 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 0
%34 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %33, i32 0, i32 0
store i32 %32, i32* %34
%35 = call i32 @htons(i32 8000)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %9, i32 0, i32 1
store i32 %35, i32* %36
%37 = load i32, i32* %6
%38 = bitcast %struct.sockaddr_in* %9 to %struct.sockaddr*
%39 = call i32 @bind(i32 %37, %struct.sockaddr* %38, i32 12)
%40 = icmp eq i32 %39, -1
br i1 %40, label %41, label %47
41: ; preds = %28
br label %42
42: ; preds = %41
%43 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; No predecessors!
br label %47
47: ; preds = %46, %28
%48 = load i32, i32* %6
%49 = call i32 @listen(i32 %48, i32 5)
%50 = icmp eq i32 %49, -1
br i1 %50, label %51, label %57
51: ; preds = %47
br label %52
52: ; preds = %51
%53 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%54 = load i32, i32* @EXIT_FAILURE
%55 = call i32 @exit(i32 %54)
unreachable
56: ; No predecessors!
br label %57
57: ; preds = %56, %47
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 8000)
%59 = load i32, i32* %6
%60 = call i32 @FD_SET(i32 %59, i32* %11)
br label %61
61: ; preds = %57, %116
%62 = call i32 @memcpy(i32* %12, i32* %11, i32 4)
%63 = load i32, i32* @FD_SETSIZE
%64 = call i32 @select(i32 %63, i32* %12, i32* null, i32* null, i32* null)
%65 = load i32, i32* %6
%66 = call i64 @FD_ISSET(i32 %65, i32* %12)
%67 = icmp ne i64 %66, 0
br i1 %67, label %68, label %86
68: ; preds = %61
store i32 12, i32* %8
%69 = load i32, i32* %6
%70 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%71 = call i32 @accept(i32 %69, %struct.sockaddr* %70, i32* %8)
store i32 %71, i32* %7
%72 = icmp eq i32 %71, -1
br i1 %72, label %73, label %79
73: ; preds = %68
br label %74
74: ; preds = %73
%75 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%76 = load i32, i32* @EXIT_FAILURE
%77 = call i32 @exit(i32 %76)
unreachable
78: ; No predecessors!
br label %79
79: ; preds = %78, %68
%80 = load i32, i32* %7
%81 = call i32 @FD_SET(i32 %80, i32* %11)
%82 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%83 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %82, i32 0, i32 0
%84 = load i32, i32* %83
%85 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %84)
br label %86
86: ; preds = %79, %61
store i32 3, i32* %13
br label %87
87: ; preds = %113, %86
%88 = load i32, i32* %13
%89 = load i32, i32* @FD_SETSIZE
%90 = icmp slt i32 %88, %89
br i1 %90, label %91, label %116
91: ; preds = %87
%92 = load i32, i32* %13
%93 = load i32, i32* %6
%94 = icmp ne i32 %92, %93
br i1 %94, label %95, label %112
95: ; preds = %91
%96 = load i32, i32* %13
%97 = call i64 @FD_ISSET(i32 %96, i32* %12)
%98 = icmp ne i64 %97, 0
br i1 %98, label %99, label %111
99: ; preds = %95
%100 = load i32, i32* %13
%101 = load i32, i32* %13
%102 = call i32 @connectionHandler(i32 %100, i32 %101)
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %110
104: ; preds = %99
%105 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.7, i64 0, i64 0))
%106 = load i32, i32* %13
%107 = call i32 @close(i32 %106)
%108 = load i32, i32* %13
%109 = call i32 @FD_CLR(i32 %108, i32* %11)
br label %110
110: ; preds = %104, %99
br label %111
111: ; preds = %110, %95
br label %112
112: ; preds = %111, %91
br label %113
113: ; preds = %112
%114 = load i32, i32* %13
%115 = add nsw i32 %114, 1
store i32 %115, i32* %13
br label %87
116: ; preds = %87
br label %61
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [69 x i8] c"FD_SETSIZE (number of maximum clients this server can monitor) = %d\0A\00"
@FD_SETSIZE = global i32 0
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [7 x i8] c"socket\00"
@EXIT_FAILURE = global i32 0
@INADDR_ANY = global i32 0
@.str.2 = [5 x i8] c"bind\00"
@.str.3 = [7 x i8] c"listen\00"
@.str.4 = [22 x i8] c"Listening on port %d\0A\00"
@.str.5 = [7 x i8] c"accept\00"
@.str.6 = [36 x i8] c"Got new connection from client: %d\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [55 x i8] c"Client closed connection, so server closing connection\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = bitcast i32* %3 to i8*
%9 = bitcast %struct.sockaddr_in* %4 to i8*
%10 = bitcast %struct.sockaddr_in* %5 to i8*
%11 = bitcast i32* %6 to i8*
%12 = bitcast i32* %7 to i8*
%13 = call i32 @FD_ZERO(i32* %6)
%14 = call i32 @FD_ZERO(i32* %7)
%15 = load i32, i32* @FD_SETSIZE
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i32 %15)
%17 = load i32, i32* @AF_INET
%18 = load i32, i32* @SOCK_STREAM
%19 = call i32 @socket(i32 %17, i32 %18, i32 0)
%20 = icmp eq i32 %19, -1
br i1 %20, label %21, label %25
21: ; preds = %2
%22 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%23 = load i32, i32* @EXIT_FAILURE
%24 = call i32 @exit(i32 %23)
unreachable
25: ; preds = %2
%26 = load i32, i32* @AF_INET
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %26, i32* %27
%28 = load i32, i32* @INADDR_ANY
%29 = call i32 @htonl(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0, i32 0
store i32 %29, i32* %30
%31 = call i32 @htons(i32 8000)
%32 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i32 %31, i32* %32
%33 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%34 = call i32 @bind(i32 %19, %struct.sockaddr* %33, i32 12)
%35 = icmp eq i32 %34, -1
br i1 %35, label %36, label %40
36: ; preds = %25
%37 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %25
%41 = call i32 @listen(i32 %19, i32 5)
%42 = icmp eq i32 %41, -1
br i1 %42, label %43, label %47
43: ; preds = %40
%44 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%45 = load i32, i32* @EXIT_FAILURE
%46 = call i32 @exit(i32 %45)
unreachable
47: ; preds = %40
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 8000)
%49 = call i32 @FD_SET(i32 %19, i32* %6)
%50 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%51 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
br label %52
52: ; preds = %72, %47
%53 = call i32 @memcpy(i32* %7, i32* %6, i32 4)
%54 = load i32, i32* @FD_SETSIZE
%55 = call i32 @select(i32 %54, i32* %7, i32* null, i32* null, i32* null)
%56 = call i64 @FD_ISSET(i32 %19, i32* %7)
%57 = icmp eq i64 %56, 0
br i1 %57, label %69, label %58
58: ; preds = %52
store i32 12, i32* %3
%59 = call i32 @accept(i32 %19, %struct.sockaddr* %50, i32* %3)
%60 = icmp eq i32 %59, -1
br i1 %60, label %61, label %65
61: ; preds = %58
%62 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%63 = load i32, i32* @EXIT_FAILURE
%64 = call i32 @exit(i32 %63)
unreachable
65: ; preds = %58
%66 = call i32 @FD_SET(i32 %59, i32* %6)
%67 = load i32, i32* %51
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.6, i64 0, i64 0), i32 %67)
br label %69
69: ; preds = %65, %52
%70 = load i32, i32* @FD_SETSIZE
%71 = icmp sgt i32 %70, 3
br i1 %71, label %73, label %72
72: ; preds = %86, %69
br label %52
73: ; preds = %69, %86
%74 = phi i32 [ %87, %86 ], [ 3, %69 ]
%75 = icmp eq i32 %74, %19
br i1 %75, label %86, label %76
76: ; preds = %73
%77 = call i64 @FD_ISSET(i32 %74, i32* %7)
%78 = icmp eq i64 %77, 0
br i1 %78, label %86, label %79
79: ; preds = %76
%80 = call i32 @connectionHandler(i32 %74, i32 %74)
%81 = icmp eq i32 %80, -1
br i1 %81, label %82, label %86
82: ; preds = %79
%83 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%84 = call i32 @close(i32 %74)
%85 = call i32 @FD_CLR(i32 %74, i32* %6)
br label %86
86: ; preds = %73, %79, %82, %76
%87 = add nuw nsw i32 %74, 1
%88 = load i32, i32* @FD_SETSIZE
%89 = icmp slt i32 %87, %88
br i1 %89, label %73, label %72
}