#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 */

/* Type definitions */
struct sockaddr_in {
  int sin_port;
  int /*<<< orphan*/ sin_addr;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ cliaddr;

/* Variables and functions */
scalar_t__ EINTR;
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int accept(int, struct sockaddr *, int *);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ handle_connection(int *, int, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
char *inet_ntoa(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdout;
void do_select(int listenfd) {
  int connfd, sockfd;
  struct sockaddr_in cliaddr;
  socklen_t cliaddrlen;
  fd_set rset, allset;
  int maxfd, maxi;
  int i;
  int clientfds[FD_SETSIZE];
  int nready;
  for (i = 0; i < FD_SETSIZE; i++)
    clientfds[i] = -1;
  maxi = -1;
  FD_ZERO(&allset);
  FD_SET(listenfd, &allset);
  maxfd = listenfd;
  for (;;) {
    rset = allset;
    nready = select(maxfd + 1, &rset, NULL, NULL, NULL);
    if (nready == -1) {
      perror("select error:");
      exit(1);
    }
    if (FD_ISSET(listenfd, &rset)) {
      cliaddrlen = sizeof(cliaddr);
      if ((connfd = accept(listenfd, (struct sockaddr *)&cliaddr,
                           &cliaddrlen)) == -1) {
        if (errno == EINTR)
          continue;
        else {
          perror("accept error:");
          exit(1);
        }
      }
      fprintf(stdout, "accept a new client: %s:%d\n",
              inet_ntoa(cliaddr.sin_addr), cliaddr.sin_port);
      for (i = 0; i < FD_SETSIZE; i++) {
        if (clientfds[i] < 0) {
          clientfds[i] = connfd;
          break;
        }
      }
      if (i == FD_SETSIZE) {
        fprintf(stderr, "too many clients.\n");
        exit(1);
      }
      FD_SET(connfd, &allset);
      maxfd = (connfd > maxfd ? connfd : maxfd);
      maxi = (i > maxi ? i : maxi);
      if (--nready <= 0)
        continue;
    }
    handle_connection(clientfds, maxi, &rset, &allset);
  }
}


x86 assembly (clang, -O0):
<do_select>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %edi,-0x4(%rbp)
mov    0x2e26(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x38(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x50(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x40(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    0x2def(%rip),%rcx
cmp    (%rcx),%eax
jge    120e <do_select+0x6e>
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    11df <do_select+0x3f>
movl   $0xffffffff,-0x2c(%rbp)
lea    -0x24(%rbp),%rdi
call   1070 <FD_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x28(%rbp),%edi
add    $0x1,%edi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1080 <select@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0xffffffff,-0x44(%rbp)
jne    1273 <do_select+0xd3>
lea    0xd9c(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x4(%rbp),%edi
lea    -0x20(%rbp),%rsi
call   1030 <FD_ISSET@plt>
cmp    $0x0,%rax
je     13fe <do_select+0x25e>
movl   $0x8,-0x1c(%rbp)
mov    -0x4(%rbp),%edi
lea    -0x18(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   10a0 <accept@plt>
mov    %eax,-0x8(%rbp)
cmp    $0xffffffff,%eax
jne    12e1 <do_select+0x141>
mov    0x2d1d(%rip),%rax
mov    (%rax),%rax
mov    0x2d0b(%rip),%rcx
cmp    (%rcx),%rax
jne    12cb <do_select+0x12b>
jmp    1230 <do_select+0x90>
lea    0xd3c(%rip),%rdi
call   1090 <perror@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    0x2cd8(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x54(%rbp)
mov    -0x14(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    -0x54(%rbp),%edi
mov    %rax,%rdx
mov    -0x18(%rbp),%ecx
lea    0xd17(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0x0,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    0x2cbb(%rip),%rcx
cmp    (%rcx),%eax
jge    135d <do_select+0x1bd>
mov    -0x50(%rbp),%rax
movslq -0x30(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    134a <do_select+0x1aa>
mov    -0x50(%rbp),%rax
mov    -0x8(%rbp),%edx
movslq -0x30(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    135d <do_select+0x1bd>
jmp    134f <do_select+0x1af>
mov    -0x30(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x30(%rbp)
jmp    1313 <do_select+0x173>
mov    -0x30(%rbp),%eax
mov    0x2c71(%rip),%rcx
cmp    (%rcx),%eax
jne    1390 <do_select+0x1f0>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xcb9(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   10b0 <exit@plt>
mov    -0x8(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   10c0 <FD_SET@plt>
mov    -0x8(%rbp),%eax
cmp    -0x28(%rbp),%eax
jle    13b3 <do_select+0x213>
mov    -0x8(%rbp),%eax
mov    %eax,-0x58(%rbp)
jmp    13b9 <do_select+0x219>
mov    -0x28(%rbp),%eax
mov    %eax,-0x58(%rbp)
mov    -0x58(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x30(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jle    13d6 <do_select+0x236>
mov    -0x30(%rbp),%eax
mov    %eax,-0x5c(%rbp)
jmp    13dc <do_select+0x23c>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x44(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x44(%rbp)
cmp    $0x0,%eax
jg     13f9 <do_select+0x259>
jmp    1230 <do_select+0x90>
jmp    13fe <do_select+0x25e>
mov    -0x50(%rbp),%rdi
mov    -0x2c(%rbp),%esi
lea    -0x20(%rbp),%rdx
lea    -0x24(%rbp),%rcx
call   1060 <handle_connection@plt>
jmp    1230 <do_select+0x90>

x86 assembly (clang, -O2):
<do_select>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %edi,%ebx
mov    0x2e0e(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rcx
lea    0xf(,%rdx,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rcx
mov    %rcx,-0x38(%rbp)
mov    %rcx,%rsp
test   %edx,%edx
jle    11fb <do_select+0x4b>
shl    $0x2,%rdx
mov    -0x38(%rbp),%rdi
mov    $0xff,%esi
call   1050 <memset@plt>
lea    -0x30(%rbp),%r14
mov    %r14,%rdi
call   1080 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   10d0 <FD_SET@plt>
movl   $0xffffffff,-0x2c(%rbp)
lea    -0x48(%rbp),%r13
mov    %ebx,%eax
mov    %rax,-0x40(%rbp)
jmp    1243 <do_select+0x93>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    -0x38(%rbp),%rdi
mov    -0x2c(%rbp),%esi
mov    %r13,%rdx
lea    -0x30(%rbp),%rcx
call   1070 <handle_connection@plt>
mov    -0x40(%rbp),%rax
lea    0x1(%rax),%r14d
nopl   0x0(%rax,%rax,1)
mov    -0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
mov    %r14d,%edi
mov    %r13,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1090 <select@plt>
cmp    $0xffffffff,%eax
je     1370 <do_select+0x1c0>
mov    %eax,%r15d
mov    %ebx,%edi
mov    %r13,%rsi
call   1030 <FD_ISSET@plt>
test   %rax,%rax
je     1230 <do_select+0x80>
movl   $0x8,-0x4c(%rbp)
mov    %ebx,%edi
lea    -0x58(%rbp),%rsi
lea    -0x4c(%rbp),%rdx
call   10b0 <accept@plt>
cmp    $0xffffffff,%eax
jne    12c0 <do_select+0x110>
mov    0x2d2b(%rip),%rax
mov    (%rax),%rax
mov    0x2d19(%rip),%rcx
cmp    (%rcx),%rax
je     1250 <do_select+0xa0>
jmp    1379 <do_select+0x1c9>
nopl   0x0(%rax)
mov    %eax,%r12d
mov    0x2cf6(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x54(%rbp),%edi
call   1040 <inet_ntoa@plt>
mov    -0x58(%rbp),%ecx
xor    %r14d,%r14d
mov    -0x44(%rbp),%edi
lea    0xd35(%rip),%rsi
mov    %rax,%rdx
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%eax
test   %eax,%eax
mov    -0x38(%rbp),%rcx
jle    1334 <do_select+0x184>
xor    %r14d,%r14d
cs nopw 0x0(%rax,%rax,1)
nop
cmpl   $0x0,(%rcx,%r14,4)
js     1330 <do_select+0x180>
add    $0x1,%r14
cmp    %r14,%rax
jne    1310 <do_select+0x160>
jmp    138f <do_select+0x1df>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r12d,(%rcx,%r14,4)
cmp    %eax,%r14d
je     138f <do_select+0x1df>
mov    %r12d,%edi
lea    -0x30(%rbp),%rsi
call   10d0 <FD_SET@plt>
mov    -0x40(%rbp),%rax
cmp    %eax,%r12d
cmovg  %r12d,%eax
mov    %rax,-0x40(%rbp)
mov    -0x2c(%rbp),%eax
cmp    %eax,%r14d
cmovg  %r14d,%eax
mov    %eax,-0x2c(%rbp)
cmp    $0x2,%r15d
jl     1243 <do_select+0x93>
jmp    1230 <do_select+0x80>
lea    0xc89(%rip),%rdi
jmp    1380 <do_select+0x1d0>
lea    0xc8e(%rip),%rdi
call   10a0 <perror@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>
mov    0x2c4a(%rip),%rax
mov    (%rax),%edi
lea    0xc99(%rip),%rsi
xor    %eax,%eax
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   10c0 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@FD_SETSIZE = global i32 0
@.str = [14 x i8] c"select error:\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [14 x i8] c"accept error:\00"
@stdout = global i32 0
@.str.2 = [28 x i8] c"accept a new client: %s:%d\0A\00"
@stderr = global i32 0
@.str.3 = [19 x i8] c"too many clients.\0A\00"
define void @do_select(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i64
%14 = alloca i32
store i32 %0, i32* %2
%15 = load i32, i32* @FD_SETSIZE
%16 = zext i32 %15 to i64
%17 = call i8* @llvm.stacksave()
store i8* %17, i8** %12
%18 = alloca i32, i64 %16
store i64 %16, i64* %13
store i32 0, i32* %11
br label %19
19: ; preds = %27, %1
%20 = load i32, i32* %11
%21 = load i32, i32* @FD_SETSIZE
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %30
23: ; preds = %19
%24 = load i32, i32* %11
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds i32, i32* %18, i64 %25
store i32 -1, i32* %26
br label %27
27: ; preds = %23
%28 = load i32, i32* %11
%29 = add nsw i32 %28, 1
store i32 %29, i32* %11
br label %19
30: ; preds = %19
store i32 -1, i32* %10
%31 = call i32 @FD_ZERO(i32* %8)
%32 = load i32, i32* %2
%33 = call i32 @FD_SET(i32 %32, i32* %8)
%34 = load i32, i32* %2
store i32 %34, i32* %9
br label %35
35: ; preds = %123, %121, %58, %30
%36 = load i32, i32* %8
store i32 %36, i32* %7
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
%39 = call i32 @select(i32 %38, i32* %7, i32* null, i32* null, i32* null)
store i32 %39, i32* %14
%40 = load i32, i32* %14
%41 = icmp eq i32 %40, -1
br i1 %41, label %42, label %45
42: ; preds = %35
%43 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%44 = call i32 @exit(i32 1)
unreachable
45: ; preds = %35
%46 = load i32, i32* %2
%47 = call i64 @FD_ISSET(i32 %46, i32* %7)
%48 = icmp ne i64 %47, 0
br i1 %48, label %49, label %123
49: ; preds = %45
store i32 8, i32* %6
%50 = load i32, i32* %2
%51 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%52 = call i32 @accept(i32 %50, %struct.sockaddr* %51, i32* %6)
store i32 %52, i32* %3
%53 = icmp eq i32 %52, -1
br i1 %53, label %54, label %62
54: ; preds = %49
%55 = load i64, i64* @errno
%56 = load i64, i64* @EINTR
%57 = icmp eq i64 %55, %56
br i1 %57, label %58, label %59
58: ; preds = %54
br label %35
59: ; preds = %54
%60 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%61 = call i32 @exit(i32 1)
unreachable
62: ; preds = %49
%63 = load i32, i32* @stdout
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 1
%65 = load i32, i32* %64
%66 = call i8* @inet_ntoa(i32 %65)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i32 0, i32 0
%68 = load i32, i32* %67
%69 = call i32 (i32, i8*, ...) @fprintf(i32 %63, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %66, i32 %68)
store i32 0, i32* %11
br label %70
70: ; preds = %86, %62
%71 = load i32, i32* %11
%72 = load i32, i32* @FD_SETSIZE
%73 = icmp slt i32 %71, %72
br i1 %73, label %74, label %89
74: ; preds = %70
%75 = load i32, i32* %11
%76 = sext i32 %75 to i64
%77 = getelementptr inbounds i32, i32* %18, i64 %76
%78 = load i32, i32* %77
%79 = icmp slt i32 %78, 0
br i1 %79, label %80, label %85
80: ; preds = %74
%81 = load i32, i32* %3
%82 = load i32, i32* %11
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds i32, i32* %18, i64 %83
store i32 %81, i32* %84
br label %89
85: ; preds = %74
br label %86
86: ; preds = %85
%87 = load i32, i32* %11
%88 = add nsw i32 %87, 1
store i32 %88, i32* %11
br label %70
89: ; preds = %80, %70
%90 = load i32, i32* %11
%91 = load i32, i32* @FD_SETSIZE
%92 = icmp eq i32 %90, %91
br i1 %92, label %93, label %97
93: ; preds = %89
%94 = load i32, i32* @stderr
%95 = call i32 (i32, i8*, ...) @fprintf(i32 %94, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%96 = call i32 @exit(i32 1)
unreachable
97: ; preds = %89
%98 = load i32, i32* %3
%99 = call i32 @FD_SET(i32 %98, i32* %8)
%100 = load i32, i32* %3
%101 = load i32, i32* %9
%102 = icmp sgt i32 %100, %101
br i1 %102, label %103, label %105
103: ; preds = %97
%104 = load i32, i32* %3
br label %107
105: ; preds = %97
%106 = load i32, i32* %9
br label %107
107: ; preds = %105, %103
%108 = phi i32 [ %104, %103 ], [ %106, %105 ]
store i32 %108, i32* %9
%109 = load i32, i32* %11
%110 = load i32, i32* %10
%111 = icmp sgt i32 %109, %110
br i1 %111, label %112, label %114
112: ; preds = %107
%113 = load i32, i32* %11
br label %116
114: ; preds = %107
%115 = load i32, i32* %10
br label %116
116: ; preds = %114, %112
%117 = phi i32 [ %113, %112 ], [ %115, %114 ]
store i32 %117, i32* %10
%118 = load i32, i32* %14
%119 = add nsw i32 %118, -1
store i32 %119, i32* %14
%120 = icmp sle i32 %119, 0
br i1 %120, label %121, label %122
121: ; preds = %116
br label %35
122: ; preds = %116
br label %123
123: ; preds = %122, %45
%124 = load i32, i32* %10
%125 = call i32 @handle_connection(i32* %18, i32 %124, i32* %7, i32* %8)
br label %35
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@FD_SETSIZE = global i32 0
@.str = [14 x i8] c"select error:\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.1 = [14 x i8] c"accept error:\00"
@stdout = global i32 0
@.str.2 = [28 x i8] c"accept a new client: %s:%d\0A\00"
@stderr = global i32 0
@.str.3 = [19 x i8] c"too many clients.\0A\00"
define void @do_select(i32 %0) {
%2 = alloca %struct.sockaddr_in
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = bitcast %struct.sockaddr_in* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast i32* %4 to i8*
%9 = bitcast i32* %5 to i8*
%10 = load i32, i32* @FD_SETSIZE
%11 = zext i32 %10 to i64
%12 = alloca i32, i64 %11
%13 = icmp sgt i32 %10, 0
br i1 %13, label %14, label %17
14: ; preds = %1
%15 = bitcast i32* %12 to i8*
%16 = shl nuw nsw i64 %11, 2
br label %17
17: ; preds = %14, %1
%18 = call i32 @FD_ZERO(i32* %5)
%19 = call i32 @FD_SET(i32 %0, i32* %5)
%20 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%21 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
br label %23
23: ; preds = %83, %17
%24 = phi i32 [ -1, %17 ], [ %84, %83 ]
%25 = phi i32 [ %0, %17 ], [ %85, %83 ]
%26 = add nsw i32 %25, 1
br label %27
27: ; preds = %23, %40
%28 = load i32, i32* %5
store i32 %28, i32* %4
%29 = call i32 @select(i32 %26, i32* %4, i32* null, i32* null, i32* null)
%30 = icmp eq i32 %29, -1
br i1 %30, label %31, label %34
31: ; preds = %27
%32 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %27
%35 = call i64 @FD_ISSET(i32 %0, i32* %4)
%36 = icmp eq i64 %35, 0
br i1 %36, label %86, label %37
37: ; preds = %34
store i32 8, i32* %3
%38 = call i32 @accept(i32 %0, %struct.sockaddr* %20, i32* %3)
%39 = icmp eq i32 %38, -1
br i1 %39, label %40, label %47
40: ; preds = %37
%41 = load i64, i64* @errno
%42 = load i64, i64* @EINTR
%43 = icmp eq i64 %41, %42
br i1 %43, label %27, label %44
44: ; preds = %40
%45 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%46 = call i32 @exit(i32 1)
unreachable
47: ; preds = %37
%48 = load i32, i32* @stdout
%49 = load i32, i32* %21
%50 = call i8* @inet_ntoa(i32 %49)
%51 = load i32, i32* %22
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %48, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* %50, i32 %51)
%53 = load i32, i32* @FD_SETSIZE
%54 = icmp sgt i32 %53, 0
br i1 %54, label %55, label %69
55: ; preds = %47
%56 = zext i32 %53 to i64
br label %57
57: ; preds = %55, %66
%58 = phi i64 [ 0, %55 ], [ %67, %66 ]
%59 = getelementptr inbounds i32, i32* %12, i64 %58
%60 = load i32, i32* %59
%61 = icmp slt i32 %60, 0
br i1 %61, label %62, label %66
62: ; preds = %57
%63 = trunc i64 %58 to i32
%64 = and i64 %58, 4294967295
%65 = getelementptr inbounds i32, i32* %12, i64 %64
store i32 %38, i32* %65
br label %69
66: ; preds = %57
%67 = add nuw nsw i64 %58, 1
%68 = icmp eq i64 %67, %56
br i1 %68, label %72, label %57
69: ; preds = %47, %62
%70 = phi i32 [ %63, %62 ], [ 0, %47 ]
%71 = icmp eq i32 %70, %53
br i1 %71, label %72, label %76
72: ; preds = %69, %66
%73 = load i32, i32* @stderr
%74 = call i32 (i32, i8*, ...) @fprintf(i32 %73, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %69
%77 = call i32 @FD_SET(i32 %38, i32* %5)
%78 = icmp sgt i32 %38, %25
%79 = select i1 %78, i32 %38, i32 %25
%80 = icmp sgt i32 %70, %24
%81 = select i1 %80, i32 %70, i32 %24
%82 = icmp slt i32 %29, 2
br i1 %82, label %83, label %86
83: ; preds = %76, %86
%84 = phi i32 [ %87, %86 ], [ %81, %76 ]
%85 = phi i32 [ %88, %86 ], [ %79, %76 ]
br label %23
86: ; preds = %34, %76
%87 = phi i32 [ %81, %76 ], [ %24, %34 ]
%88 = phi i32 [ %79, %76 ], [ %25, %34 ]
%89 = call i32 @handle_connection(i32* %12, i32 %87, i32* %4, i32* %5)
br label %83
}