#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 /*<<< orphan*/ sa_family;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ server_addr;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int /*<<< orphan*/ EXIT_FAILURE;
int /*<<< orphan*/ FD_CLR(int, int /*<<< orphan*/ *);
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_ANY;
int INET6_ADDRSTRLEN;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ get_in_addr(struct sockaddr *);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
char *inet_ntop(int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main() {
  int port = 8088;
  struct sockaddr_in server_addr;
  memset(&server_addr, 0, sizeof(server_addr));
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  server_addr.sin_port = htons(port);
  int listen_sock = socket(AF_INET, SOCK_STREAM, 0);
  bind(listen_sock, (struct sockaddr *)&server_addr, sizeof(server_addr));
  listen(listen_sock, 1024);
  printf("Listened to port %d\n", port);
  int max_fd = listen_sock;
  fd_set active_fds, read_fds;
  FD_ZERO(&active_fds);
  FD_SET(listen_sock, &active_fds);
  while (true) {
    read_fds = active_fds;
    if (select(max_fd + 1, &read_fds, NULL, NULL, NULL) < 0) {
      perror("select");
      exit(EXIT_FAILURE);
    };
    int fd;
    for (fd = 0; fd <= max_fd; ++fd) {
      if (FD_ISSET(fd, &read_fds)) {
        if (fd == listen_sock) {
          struct sockaddr rem_addr;
          socklen_t addr_len = sizeof rem_addr;
          int new_fd = accept(listen_sock, &rem_addr, &addr_len);
          FD_SET(new_fd, &active_fds);
          if (new_fd > max_fd)
            max_fd = new_fd;
          char remote_ip[INET6_ADDRSTRLEN];
          printf("server: new connection from %s on socket %d\n",
                 inet_ntop(rem_addr.sa_family, get_in_addr(&rem_addr),
                           remote_ip, INET6_ADDRSTRLEN),
                 new_fd);
        } else {
          char buffer[128];
          int bytes = recv(fd, buffer, sizeof buffer, 0);
          if (bytes <= 0) {
            close(fd);
            FD_CLR(fd, &active_fds);
            printf("server: socket %d closed\n", fd);
          } else {
            printf("server: sending %s to client\n", buffer);
            send(fd, buffer, bytes, 0);
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xf0,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1f98,-0x8(%rbp)
lea    -0x18(%rbp),%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    0x2d5c(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
call   1070 <htons@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d48(%rip),%rax
mov    (%rax),%edi
mov    0x2d27(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x18(%rbp),%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
mov    -0x1c(%rbp),%edi
mov    $0x400,%esi
call   10f0 <listen@plt>
mov    -0x8(%rbp),%esi
lea    0xd2b(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x24(%rbp),%rdi
call   10d0 <FD_ZERO@plt>
mov    -0x1c(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   1150 <FD_SET@plt>
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%edi
add    $0x1,%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10e0 <select@plt>
cmp    $0x0,%rax
jge    133b <main+0xfb>
lea    0xced(%rip),%rdi
call   1110 <perror@plt>
mov    0x2c8c(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     14c2 <main+0x282>
mov    -0x2c(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1060 <FD_ISSET@plt>
cmp    $0x0,%rax
je     14af <main+0x26f>
mov    -0x2c(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jne    1426 <main+0x1e6>
movl   $0x4,-0x34(%rbp)
mov    -0x1c(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x34(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   1150 <FD_SET@plt>
mov    -0x38(%rbp),%eax
cmp    -0x20(%rbp),%eax
jle    13a8 <main+0x168>
mov    -0x38(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    0x2c39(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x40(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0xe0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0xe4(%rbp)
lea    -0x30(%rbp),%rdi
call   1050 <get_in_addr@plt>
mov    -0xe4(%rbp),%edi
mov    -0xe0(%rbp),%rdx
mov    %eax,%esi
mov    0x2be9(%rip),%rax
mov    (%rax),%ecx
call   1030 <inet_ntop@plt>
mov    %rax,%rsi
mov    -0x38(%rbp),%edx
lea    0xc09(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x40(%rbp),%rax
mov    %rax,%rsp
jmp    14aa <main+0x26a>
mov    -0x2c(%rbp),%edi
lea    -0xd0(%rbp),%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0xd4(%rbp)
cmpl   $0x0,-0xd4(%rbp)
jg     1479 <main+0x239>
mov    -0x2c(%rbp),%edi
call   10c0 <close@plt>
mov    -0x2c(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   1130 <FD_CLR@plt>
mov    -0x2c(%rbp),%esi
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    14a5 <main+0x265>
lea    -0xd0(%rbp),%rsi
lea    0xbdc(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x2c(%rbp),%edi
lea    -0xd0(%rbp),%rsi
mov    -0xd4(%rbp),%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    14aa <main+0x26a>
jmp    14af <main+0x26f>
jmp    14b4 <main+0x274>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1342 <main+0x102>
jmp    12f7 <main+0xb7>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
lea    -0x48(%rbp),%r14
mov    %r14,%rdi
xor    %esi,%esi
mov    $0xc,%edx
call   10b0 <memset@plt>
mov    0x2d72(%rip),%rbx
mov    (%rbx),%eax
mov    %eax,-0x40(%rbp)
mov    0x2d5e(%rip),%rax
mov    (%rax),%edi
call   10a0 <htonl@plt>
mov    %eax,-0x44(%rbp)
mov    $0x1f98,%edi
call   1070 <htons@plt>
mov    %eax,-0x48(%rbp)
mov    (%rbx),%edi
mov    0x2d2e(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,%ebx
mov    %eax,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   1100 <bind@plt>
mov    %ebx,%edi
mov    $0x400,%esi
call   10f0 <listen@plt>
lea    0xd39(%rip),%rdi
mov    $0x1f98,%esi
xor    %eax,%eax
call   1090 <printf@plt>
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
call   10d0 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1150 <FD_SET@plt>
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    %rbx,-0x38(%rbp)
lea    0x1(%rbx),%edi
lea    -0x2c(%rbp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10e0 <select@plt>
test   %rax,%rax
jns    1325 <main+0xe5>
lea    0xd03(%rip),%rdi
call   1110 <perror@plt>
mov    0x2ca2(%rip),%rax
mov    (%rax),%edi
call   1140 <exit@plt>
lea    -0x2c(%rbp),%r14
lea    -0xe0(%rbp),%r13
mov    -0x38(%rbp),%rbx
mov    %ebx,%r15d
jmp    135e <main+0x11e>
nopl   0x0(%rax)
mov    -0x30(%rbp),%eax
mov    %eax,-0x2c(%rbp)
lea    0x1(%r15),%edi
mov    %r14,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10e0 <select@plt>
test   %rax,%rax
js     130b <main+0xcb>
test   %r15d,%r15d
js     1340 <main+0x100>
xor    %r12d,%r12d
jmp    141a <main+0x1da>
nopl   0x0(%rax,%rax,1)
movl   $0x4,-0x3c(%rbp)
mov    -0x38(%rbp),%rdi
mov    %r13,%rsi
lea    -0x3c(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,%r13d
mov    %eax,%edi
lea    -0x30(%rbp),%rsi
call   1150 <FD_SET@plt>
mov    %rsp,-0x50(%rbp)
cmp    %r15d,%r13d
cmovg  %r13d,%r15d
mov    %r15,-0x58(%rbp)
mov    0x2c3d(%rip),%r14
mov    (%r14),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    -0xe0(%rbp),%r15d
lea    -0xe0(%rbp),%rdi
call   1050 <get_in_addr@plt>
mov    (%r14),%ecx
mov    %r15d,%edi
lea    -0x2c(%rbp),%r14
mov    %eax,%esi
mov    %rbx,%rdx
mov    -0x58(%rbp),%r15
call   1030 <inet_ntop@plt>
lea    0xc2b(%rip),%rdi
mov    %rax,%rsi
mov    %r13d,%edx
lea    -0xe0(%rbp),%r13
xor    %eax,%eax
call   1090 <printf@plt>
mov    -0x50(%rbp),%rsp
lea    0x1(%r12),%eax
cmp    %r15d,%r12d
mov    %eax,%r12d
jge    1340 <main+0x100>
mov    %r12d,%edi
mov    %r14,%rsi
call   1060 <FD_ISSET@plt>
test   %rax,%rax
je     1409 <main+0x1c9>
cmp    %r12d,-0x38(%rbp)
je     1370 <main+0x130>
mov    %r12d,%edi
mov    %r13,%rsi
mov    $0x80,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    146e <main+0x22e>
mov    %eax,%ebx
lea    0xc10(%rip),%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12d,%edi
mov    %r13,%rsi
mov    %ebx,%edx
xor    %ecx,%ecx
call   1080 <send@plt>
jmp    1409 <main+0x1c9>
mov    %r12d,%edi
call   10c0 <close@plt>
mov    %r12d,%edi
lea    -0x30(%rbp),%rsi
call   1130 <FD_CLR@plt>
lea    0xbc0(%rip),%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1409 <main+0x1c9>

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
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"Listened to port %d\0A\00"
@.str.1 = [7 x i8] c"select\00"
@EXIT_FAILURE = global i32 0
@INET6_ADDRSTRLEN = global i32 0
@.str.2 = [45 x i8] c"server: new connection from %s on socket %d\0A\00"
@.str.3 = [26 x i8] c"server: socket %d closed\0A\00"
@.str.4 = [30 x i8] c"server: sending %s to client\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca %struct.sockaddr
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca [128 x i8]
%15 = alloca i32
store i32 0, i32* %1
store i32 8088, i32* %2
%16 = call i32 @memset(%struct.sockaddr_in* %3, i32 0, i32 12)
%17 = load i32, i32* @AF_INET
%18 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 2
store i32 %17, i32* %18
%19 = load i32, i32* @INADDR_ANY
%20 = call i32 @htonl(i32 %19)
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 1
%22 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %21, i32 0, i32 0
store i32 %20, i32* %22
%23 = load i32, i32* %2
%24 = call i32 @htons(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i32 0, i32 0
store i32 %24, i32* %25
%26 = load i32, i32* @AF_INET
%27 = load i32, i32* @SOCK_STREAM
%28 = call i32 @socket(i32 %26, i32 %27, i32 0)
store i32 %28, i32* %4
%29 = load i32, i32* %4
%30 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%31 = call i32 @bind(i32 %29, %struct.sockaddr* %30, i32 12)
%32 = load i32, i32* %4
%33 = call i32 @listen(i32 %32, i32 1024)
%34 = load i32, i32* %2
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %34)
%36 = load i32, i32* %4
store i32 %36, i32* %5
%37 = call i32 @FD_ZERO(i32* %6)
%38 = load i32, i32* %4
%39 = call i32 @FD_SET(i32 %38, i32* %6)
br label %40
40: ; preds = %0, %112
%41 = load i32, i32* %6
store i32 %41, i32* %7
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
%44 = call i64 @select(i32 %43, i32* %7, i32* null, i32* null, i32* null)
%45 = icmp slt i64 %44, 0
br i1 %45, label %46, label %50
46: ; preds = %40
%47 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%48 = load i32, i32* @EXIT_FAILURE
%49 = call i32 @exit(i32 %48)
unreachable
50: ; preds = %40
store i32 0, i32* %8
br label %51
51: ; preds = %109, %50
%52 = load i32, i32* %8
%53 = load i32, i32* %5
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %112
55: ; preds = %51
%56 = load i32, i32* %8
%57 = call i64 @FD_ISSET(i32 %56, i32* %7)
%58 = icmp ne i64 %57, 0
br i1 %58, label %59, label %108
59: ; preds = %55
%60 = load i32, i32* %8
%61 = load i32, i32* %4
%62 = icmp eq i32 %60, %61
br i1 %62, label %63, label %86
63: ; preds = %59
store i32 4, i32* %10
%64 = load i32, i32* %4
%65 = call i32 @accept(i32 %64, %struct.sockaddr* %9, i32* %10)
store i32 %65, i32* %11
%66 = load i32, i32* %11
%67 = call i32 @FD_SET(i32 %66, i32* %6)
%68 = load i32, i32* %11
%69 = load i32, i32* %5
%70 = icmp sgt i32 %68, %69
br i1 %70, label %71, label %73
71: ; preds = %63
%72 = load i32, i32* %11
store i32 %72, i32* %5
br label %73
73: ; preds = %71, %63
%74 = load i32, i32* @INET6_ADDRSTRLEN
%75 = zext i32 %74 to i64
%76 = call i8* @llvm.stacksave()
store i8* %76, i8** %12
%77 = alloca i8, i64 %75
store i64 %75, i64* %13
%78 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %9, i32 0, i32 0
%79 = load i32, i32* %78
%80 = call i32 @get_in_addr(%struct.sockaddr* %9)
%81 = load i32, i32* @INET6_ADDRSTRLEN
%82 = call i8* @inet_ntop(i32 %79, i32 %80, i8* %77, i32 %81)
%83 = load i32, i32* %11
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %82, i32 %83)
%85 = load i8*, i8** %12
br label %107
86: ; preds = %59
%87 = load i32, i32* %8
%88 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%89 = call i32 @recv(i32 %87, i8* %88, i32 128, i32 0)
store i32 %89, i32* %15
%90 = load i32, i32* %15
%91 = icmp sle i32 %90, 0
br i1 %91, label %92, label %99
92: ; preds = %86
%93 = load i32, i32* %8
%94 = call i32 @close(i32 %93)
%95 = load i32, i32* %8
%96 = call i32 @FD_CLR(i32 %95, i32* %6)
%97 = load i32, i32* %8
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %97)
br label %106
99: ; preds = %86
%100 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%101 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %100)
%102 = load i32, i32* %8
%103 = getelementptr inbounds [128 x i8], [128 x i8]* %14, i64 0, i64 0
%104 = load i32, i32* %15
%105 = call i32 @send(i32 %102, i8* %103, i32 %104, i32 0)
br label %106
106: ; preds = %99, %92
br label %107
107: ; preds = %106, %73
br label %108
108: ; preds = %107, %55
br label %109
109: ; preds = %108
%110 = load i32, i32* %8
%111 = add nsw i32 %110, 1
store i32 %111, i32* %8
br label %51
112: ; preds = %51
br label %40
}

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
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@.str = [21 x i8] c"Listened to port %d\0A\00"
@.str.1 = [7 x i8] c"select\00"
@EXIT_FAILURE = global i32 0
@INET6_ADDRSTRLEN = global i32 0
@.str.2 = [45 x i8] c"server: new connection from %s on socket %d\0A\00"
@.str.3 = [26 x i8] c"server: socket %d closed\0A\00"
@.str.4 = [30 x i8] c"server: sending %s to client\0A\00"
define i32 @main() {
%1 = alloca %struct.sockaddr_in
%2 = alloca i32
%3 = alloca i32
%4 = alloca %struct.sockaddr
%5 = alloca i32
%6 = alloca [128 x i8]
%7 = bitcast %struct.sockaddr_in* %1 to i8*
%8 = call i32 @memset(%struct.sockaddr_in* %1, i32 0, i32 12)
%9 = load i32, i32* @AF_INET
%10 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 2
store i32 %9, i32* %10
%11 = load i32, i32* @INADDR_ANY
%12 = call i32 @htonl(i32 %11)
%13 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 1, i32 0
store i32 %12, i32* %13
%14 = call i32 @htons(i32 8088)
%15 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %1, i64 0, i32 0
store i32 %14, i32* %15
%16 = load i32, i32* @AF_INET
%17 = load i32, i32* @SOCK_STREAM
%18 = call i32 @socket(i32 %16, i32 %17, i32 0)
%19 = bitcast %struct.sockaddr_in* %1 to %struct.sockaddr*
%20 = call i32 @bind(i32 %18, %struct.sockaddr* %19, i32 12)
%21 = call i32 @listen(i32 %18, i32 1024)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 8088)
%23 = bitcast i32* %2 to i8*
%24 = bitcast i32* %3 to i8*
%25 = call i32 @FD_ZERO(i32* %2)
%26 = call i32 @FD_SET(i32 %18, i32* %2)
%27 = load i32, i32* %2
store i32 %27, i32* %3
%28 = add nsw i32 %18, 1
%29 = call i64 @select(i32 %28, i32* %3, i32* null, i32* null, i32* null)
%30 = icmp slt i64 %29, 0
br i1 %30, label %45, label %31
31: ; preds = %0
%32 = getelementptr inbounds [128 x i8], [128 x i8]* %6, i64 0, i64 0
%33 = bitcast %struct.sockaddr* %4 to i8*
%34 = bitcast i32* %5 to i8*
%35 = getelementptr inbounds %struct.sockaddr, %struct.sockaddr* %4, i64 0, i32 0
br label %42
36: ; preds = %81, %42
%37 = phi i32 [ %43, %42 ], [ %82, %81 ]
%38 = load i32, i32* %2
store i32 %38, i32* %3
%39 = add nsw i32 %37, 1
%40 = call i64 @select(i32 %39, i32* %3, i32* null, i32* null, i32* null)
%41 = icmp slt i64 %40, 0
br i1 %41, label %45, label %42
42: ; preds = %31, %36
%43 = phi i32 [ %18, %31 ], [ %37, %36 ]
%44 = icmp slt i32 %43, 0
br i1 %44, label %36, label %49
45: ; preds = %36, %0
%46 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%47 = load i32, i32* @EXIT_FAILURE
%48 = call i32 @exit(i32 %47)
unreachable
49: ; preds = %42, %81
%50 = phi i32 [ %82, %81 ], [ %43, %42 ]
%51 = phi i32 [ %83, %81 ], [ 0, %42 ]
%52 = call i64 @FD_ISSET(i32 %51, i32* %3)
%53 = icmp eq i64 %52, 0
br i1 %53, label %81, label %54
54: ; preds = %49
%55 = icmp eq i32 %51, %18
br i1 %55, label %56, label %70
56: ; preds = %54
store i32 4, i32* %5
%57 = call i32 @accept(i32 %18, %struct.sockaddr* %4, i32* %5)
%58 = call i32 @FD_SET(i32 %57, i32* %2)
%59 = icmp sgt i32 %57, %50
%60 = select i1 %59, i32 %57, i32 %50
%61 = load i32, i32* @INET6_ADDRSTRLEN
%62 = zext i32 %61 to i64
%63 = call i8* @llvm.stacksave()
%64 = alloca i8, i64 %62
%65 = load i32, i32* %35
%66 = call i32 @get_in_addr(%struct.sockaddr* %4)
%67 = load i32, i32* @INET6_ADDRSTRLEN
%68 = call i8* @inet_ntop(i32 %65, i32 %66, i8* %64, i32 %67)
%69 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.2, i64 0, i64 0), i8* %68, i32 %57)
br label %81
70: ; preds = %54
%71 = call i32 @recv(i32 %51, i8* %32, i32 128, i32 0)
%72 = icmp slt i32 %71, 1
br i1 %72, label %73, label %77
73: ; preds = %70
%74 = call i32 @close(i32 %51)
%75 = call i32 @FD_CLR(i32 %51, i32* %2)
%76 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %51)
br label %80
77: ; preds = %70
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.4, i64 0, i64 0), i8* %32)
%79 = call i32 @send(i32 %51, i8* %32, i32 %71, i32 0)
br label %80
80: ; preds = %77, %73
br label %81
81: ; preds = %49, %80, %56
%82 = phi i32 [ %60, %56 ], [ %50, %80 ], [ %50, %49 ]
%83 = add nuw nsw i32 %51, 1
%84 = icmp slt i32 %51, %82
br i1 %84, label %49, label %36
}