#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 timeval {
  int tv_sec;
  int tv_usec;
};
struct sockaddr_in {
  int dummy;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ cli_addr;
typedef int /*<<< orphan*/ buf;

/* Variables and functions */
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 FD_SETSIZE;
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ close(int);
int create_socket(char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ printf(char *, ...);
int read(int, char *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ write(int, char *, int);
int main(int argc, char *argv[]) {
  int i, maxfd, nready, str_len;
  fd_set global_rfds, current_rfds;
  char buf[1024];
  struct timeval timeout;
  struct sockaddr_in cli_addr;
  socklen_t socklen;
  int socket_fd, connect_fd;
  if (argc != 2) {
    fprintf(stderr, "Usage: %s <port>\n", argv[0]);
    exit(EXIT_FAILURE);
  }
  socket_fd = create_socket(argv[1]);
  if (socket_fd == -1) {
    fprintf(stderr, "create_socket() failed.\n");
    exit(EXIT_FAILURE);
  }
  maxfd = socket_fd;
  FD_ZERO(&global_rfds);
  FD_SET(socket_fd, &global_rfds);
  printf("FD_SETSIZE = %d\n", FD_SETSIZE);
  socklen = sizeof(cli_addr);
  while (1) {
    timeout.tv_sec = 5;
    timeout.tv_usec = 500 * 1000;
    current_rfds = global_rfds;
    nready = select(maxfd + 1, &current_rfds, NULL, NULL, &timeout);
    if (nready == -1) {
      fprintf(stderr, "select() failed\n");
      break;
    } else if (nready == 0) {
      printf("time out!\n");
      continue;
    }
    for (i = 0; i < maxfd + 1; ++i) {
      if (FD_ISSET(i, &current_rfds)) {
        if (i == socket_fd) {
          connect_fd =
              accept(socket_fd, (struct sockaddr *)&cli_addr, &socklen);
          FD_SET(connect_fd, &global_rfds);
          if (connect_fd > maxfd)
            maxfd = connect_fd;
          printf("new client connected\n");
        } else {
          str_len = read(i, buf, sizeof(buf));
          if (str_len <= 0) {
            FD_CLR(i, &global_rfds);
            close(i);
            printf("client closed\n");
          } else {
            write(i, buf, str_len);
          }
        }
      }
    }
  }
  close(socket_fd);
  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)
cmpl   $0x2,-0x8(%rbp)
je     121f <main+0x4f>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2db8(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10b0 <create_socket@plt>
mov    %eax,-0x448(%rbp)
cmpl   $0xffffffff,-0x448(%rbp)
jne    1264 <main+0x94>
mov    0x2d9a(%rip),%rax
mov    (%rax),%edi
lea    0xdc3(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
call   10e0 <exit@plt>
mov    -0x448(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    -0x24(%rbp),%rdi
call   1090 <FD_ZERO@plt>
mov    -0x448(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    0x2d4c(%rip),%rax
mov    (%rax),%esi
lea    0xd96(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x4,-0x444(%rbp)
movl   $0x5,-0x438(%rbp)
movl   $0x7a120,-0x434(%rbp)
mov    -0x24(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%edi
add    $0x1,%edi
lea    -0x28(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0x438(%rbp),%r8
mov    %rcx,%rdx
call   10a0 <select@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0xffffffff,-0x1c(%rbp)
jne    1306 <main+0x136>
mov    0x2cef(%rip),%rax
mov    (%rax),%edi
lea    0xd42(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
jmp    143a <main+0x26a>
cmpl   $0x0,-0x1c(%rbp)
jne    1323 <main+0x153>
lea    0xd36(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    12a6 <main+0xd6>
jmp    1328 <main+0x158>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    -0x18(%rbp),%ecx
add    $0x1,%ecx
cmp    %ecx,%eax
jge    1435 <main+0x265>
mov    -0x14(%rbp),%edi
lea    -0x28(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1422 <main+0x252>
mov    -0x14(%rbp),%eax
cmp    -0x448(%rbp),%eax
jne    13be <main+0x1ee>
mov    -0x448(%rbp),%edi
lea    -0x440(%rbp),%rsi
lea    -0x444(%rbp),%rdx
call   10c0 <accept@plt>
mov    %eax,-0x44c(%rbp)
mov    -0x44c(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   10f0 <FD_SET@plt>
mov    -0x44c(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    13ab <main+0x1db>
mov    -0x44c(%rbp),%eax
mov    %eax,-0x18(%rbp)
lea    0xca6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    141d <main+0x24d>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0x400,%edx
call   1070 <read@plt>
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jg     1406 <main+0x236>
mov    -0x14(%rbp),%edi
lea    -0x24(%rbp),%rsi
call   10d0 <FD_CLR@plt>
mov    -0x14(%rbp),%edi
call   1060 <close@plt>
lea    0xc74(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1418 <main+0x248>
mov    -0x14(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    -0x20(%rbp),%edx
call   1030 <write@plt>
jmp    141d <main+0x24d>
jmp    1422 <main+0x252>
jmp    1427 <main+0x257>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    132f <main+0x15f>
jmp    12a6 <main+0xd6>
mov    -0x448(%rbp),%edi
call   1060 <close@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
cmp    $0x2,%edi
jne    13a3 <main+0x1c3>
mov    0x8(%rsi),%rdi
call   10c0 <create_socket@plt>
cmp    $0xffffffff,%eax
je     13bf <main+0x1df>
mov    %eax,%ebp
lea    0xc(%rsp),%rbx
mov    %rbx,%rdi
call   10a0 <FD_ZERO@plt>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1100 <FD_SET@plt>
mov    0x2dac(%rip),%rax
mov    (%rax),%esi
lea    0xdf6(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movl   $0x4,0x18(%rsp)
movabs $0x7a12000000005,%r15
lea    0x1c(%rsp),%rbx
lea    0x28(%rsp),%r14
lea    0xe11(%rip),%r12
mov    %ebp,%ecx
mov    %ebp,0x8(%rsp)
lea    0x1(%rcx),%ebp
mov    %rcx,%r13
jmp    1278 <main+0x98>
nopl   (%rax)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r15,0x28(%rsp)
mov    0xc(%rsp),%eax
mov    %eax,0x1c(%rsp)
mov    %ebp,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %r14,%r8
call   10b0 <select@plt>
test   %eax,%eax
je     1270 <main+0x90>
cmp    $0xffffffff,%eax
je     136f <main+0x18f>
test   %r13d,%r13d
js     1278 <main+0x98>
mov    %r13,%rcx
xor    %r13d,%r13d
mov    0x8(%rsp),%ebp
jmp    1313 <main+0x133>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebp,%edi
lea    0x20(%rsp),%rsi
lea    0x18(%rsp),%rdx
call   10d0 <accept@plt>
mov    %eax,%ebp
mov    %eax,%edi
lea    0xc(%rsp),%rsi
call   1100 <FD_SET@plt>
mov    0x10(%rsp),%rax
cmp    %eax,%ebp
cmovg  %ebp,%eax
mov    %rax,0x10(%rsp)
mov    0x8(%rsp),%ebp
lea    0xd62(%rip),%rdi
call   1030 <puts@plt>
lea    0x1(%r13),%eax
mov    0x10(%rsp),%rcx
cmp    %ecx,%r13d
mov    %eax,%r13d
jge    1265 <main+0x85>
mov    %rcx,0x10(%rsp)
mov    %r13d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     12fe <main+0x11e>
cmp    %r13d,%ebp
je     12c0 <main+0xe0>
mov    %r13d,%edi
lea    0x30(%rsp),%rsi
mov    $0x400,%edx
call   1080 <read@plt>
mov    %r13d,%edi
test   %eax,%eax
jle    1354 <main+0x174>
lea    0x30(%rsp),%rsi
mov    %eax,%edx
call   1040 <write@plt>
jmp    12fe <main+0x11e>
lea    0xc(%rsp),%rsi
call   10e0 <FD_CLR@plt>
mov    %r13d,%edi
call   1070 <close@plt>
lea    0xce0(%rip),%rdi
jmp    12f9 <main+0x119>
mov    0x2c6a(%rip),%rax
mov    (%rax),%edi
lea    0xcbd(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x8(%rsp),%edi
call   1070 <close@plt>
xor    %eax,%eax
add    $0x438,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x2c36(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xc4a(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
jmp    13d6 <main+0x1f6>
mov    0x2c1a(%rip),%rax
mov    (%rax),%edi
lea    0xc43(%rip),%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x2bf3(%rip),%rax
mov    (%rax),%edi
call   10f0 <exit@plt>

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <port>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [25 x i8] c"create_socket() failed.\0A\00"
@.str.2 = [17 x i8] c"FD_SETSIZE = %d\0A\00"
@FD_SETSIZE = global i32 0
@.str.3 = [17 x i8] c"select() failed\0A\00"
@.str.4 = [11 x i8] c"time out!\0A\00"
@.str.5 = [22 x i8] c"new client connected\0A\00"
@.str.6 = [15 x i8] c"client closed\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 i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca [1024 x i8]
%13 = alloca %struct.timeval
%14 = alloca %struct.sockaddr_in
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%18 = load i32, i32* %4
%19 = icmp ne i32 %18, 2
br i1 %19, label %20, label %28
20: ; preds = %2
%21 = load i32, i32* @stderr
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 0
%24 = load i8*, i8** %23
%25 = call i32 (i32, i8*, ...) @fprintf(i32 %21, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %24)
%26 = load i32, i32* @EXIT_FAILURE
%27 = call i32 @exit(i32 %26)
unreachable
28: ; preds = %2
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32 @create_socket(i8* %31)
store i32 %32, i32* %16
%33 = load i32, i32* %16
%34 = icmp eq i32 %33, -1
br i1 %34, label %35, label %40
35: ; preds = %28
%36 = load i32, i32* @stderr
%37 = call i32 (i32, i8*, ...) @fprintf(i32 %36, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%38 = load i32, i32* @EXIT_FAILURE
%39 = call i32 @exit(i32 %38)
unreachable
40: ; preds = %28
%41 = load i32, i32* %16
store i32 %41, i32* %7
%42 = call i32 @FD_ZERO(i32* %10)
%43 = load i32, i32* %16
%44 = call i32 @FD_SET(i32 %43, i32* %10)
%45 = load i32, i32* @FD_SETSIZE
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %45)
store i32 4, i32* %15
br label %47
47: ; preds = %40, %62, %115
%48 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
store i32 5, i32* %48
%49 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
store i32 500000, i32* %49
%50 = load i32, i32* %10
store i32 %50, i32* %11
%51 = load i32, i32* %7
%52 = add nsw i32 %51, 1
%53 = call i32 @select(i32 %52, i32* %11, i32* null, i32* null, %struct.timeval* %13)
store i32 %53, i32* %8
%54 = load i32, i32* %8
%55 = icmp eq i32 %54, -1
br i1 %55, label %56, label %59
56: ; preds = %47
%57 = load i32, i32* @stderr
%58 = call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
br label %116
59: ; preds = %47
%60 = load i32, i32* %8
%61 = icmp eq i32 %60, 0
br i1 %61, label %62, label %64
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.4, i64 0, i64 0))
br label %47
64: ; preds = %59
br label %65
65: ; preds = %64
store i32 0, i32* %6
br label %66
66: ; preds = %112, %65
%67 = load i32, i32* %6
%68 = load i32, i32* %7
%69 = add nsw i32 %68, 1
%70 = icmp slt i32 %67, %69
br i1 %70, label %71, label %115
71: ; preds = %66
%72 = load i32, i32* %6
%73 = call i64 @FD_ISSET(i32 %72, i32* %11)
%74 = icmp ne i64 %73, 0
br i1 %74, label %75, label %111
75: ; preds = %71
%76 = load i32, i32* %6
%77 = load i32, i32* %16
%78 = icmp eq i32 %76, %77
br i1 %78, label %79, label %92
79: ; preds = %75
%80 = load i32, i32* %16
%81 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%82 = call i32 @accept(i32 %80, %struct.sockaddr* %81, i32* %15)
store i32 %82, i32* %17
%83 = load i32, i32* %17
%84 = call i32 @FD_SET(i32 %83, i32* %10)
%85 = load i32, i32* %17
%86 = load i32, i32* %7
%87 = icmp sgt i32 %85, %86
br i1 %87, label %88, label %90
88: ; preds = %79
%89 = load i32, i32* %17
store i32 %89, i32* %7
br label %90
90: ; preds = %88, %79
%91 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
br label %110
92: ; preds = %75
%93 = load i32, i32* %6
%94 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%95 = call i32 @read(i32 %93, i8* %94, i32 1024)
store i32 %95, i32* %9
%96 = load i32, i32* %9
%97 = icmp sle i32 %96, 0
br i1 %97, label %98, label %104
98: ; preds = %92
%99 = load i32, i32* %6
%100 = call i32 @FD_CLR(i32 %99, i32* %10)
%101 = load i32, i32* %6
%102 = call i32 @close(i32 %101)
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
br label %109
104: ; preds = %92
%105 = load i32, i32* %6
%106 = getelementptr inbounds [1024 x i8], [1024 x i8]* %12, i64 0, i64 0
%107 = load i32, i32* %9
%108 = call i32 @write(i32 %105, i8* %106, i32 %107)
br label %109
109: ; preds = %104, %98
br label %110
110: ; preds = %109, %90
br label %111
111: ; preds = %110, %71
br label %112
112: ; preds = %111
%113 = load i32, i32* %6
%114 = add nsw i32 %113, 1
store i32 %114, i32* %6
br label %66
115: ; preds = %66
br label %47
116: ; preds = %56
%117 = load i32, i32* %16
%118 = call i32 @close(i32 %117)
ret i32 0
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.sockaddr_in = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [18 x i8] c"Usage: %s <port>\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [25 x i8] c"create_socket() failed.\0A\00"
@.str.2 = [17 x i8] c"FD_SETSIZE = %d\0A\00"
@FD_SETSIZE = global i32 0
@.str.3 = [17 x i8] c"select() failed\0A\00"
@str = [14 x i8] c"client closed\00"
@str.7 = [21 x i8] c"new client connected\00"
@str.8 = [10 x i8] c"time out!\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [1024 x i8]
%6 = alloca %struct.timeval
%7 = alloca %struct.sockaddr_in
%8 = alloca i32
%9 = bitcast i32* %3 to i8*
%10 = bitcast i32* %4 to i8*
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%12 = bitcast %struct.timeval* %6 to i8*
%13 = bitcast %struct.sockaddr_in* %7 to i8*
%14 = bitcast i32* %8 to i8*
%15 = icmp eq i32 %0, 2
br i1 %15, label %22, label %16
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = load i8*, i8** %1
%19 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* @EXIT_FAILURE
%21 = tail call i32 @exit(i32 %20)
unreachable
22: ; preds = %2
%23 = getelementptr inbounds i8*, i8** %1, i64 1
%24 = load i8*, i8** %23
%25 = tail call i32 @create_socket(i8* %24)
%26 = icmp eq i32 %25, -1
br i1 %26, label %27, label %32
27: ; preds = %22
%28 = load i32, i32* @stderr
%29 = tail call i32 (i32, i8*, ...) @fprintf(i32 %28, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = tail call i32 @exit(i32 %30)
unreachable
32: ; preds = %22
%33 = call i32 @FD_ZERO(i32* %3)
%34 = call i32 @FD_SET(i32 %25, i32* %3)
%35 = load i32, i32* @FD_SETSIZE
%36 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.2, i64 0, i64 0), i32 %35)
store i32 4, i32* %8
%37 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%38 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%39 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
br label %40
40: ; preds = %77, %32
%41 = phi i32 [ %25, %32 ], [ %78, %77 ]
%42 = add nsw i32 %41, 1
%43 = icmp slt i32 %41, 0
br label %44
44: ; preds = %40, %48
br label %45
45: ; preds = %44, %53
store i32 5, i32* %37
store i32 500000, i32* %38
%46 = load i32, i32* %3
store i32 %46, i32* %4
%47 = call i32 @select(i32 %42, i32* %4, i32* null, i32* null, %struct.timeval* %6)
switch i32 %47, label %48 [
i32 -1, label %49
i32 0, label %53
]
48: ; preds = %45
br i1 %43, label %44, label %55
49: ; preds = %45
%50 = load i32, i32* @stderr
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @close(i32 %25)
ret i32 0
53: ; preds = %45
%54 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @str.8, i64 0, i64 0))
br label %45
55: ; preds = %48, %77
%56 = phi i32 [ %79, %77 ], [ 0, %48 ]
%57 = phi i32 [ %78, %77 ], [ %41, %48 ]
%58 = call i64 @FD_ISSET(i32 %56, i32* %4)
%59 = icmp eq i64 %58, 0
br i1 %59, label %77, label %60
60: ; preds = %55
%61 = icmp eq i32 %56, %25
br i1 %61, label %62, label %68
62: ; preds = %60
%63 = call i32 @accept(i32 %25, %struct.sockaddr* %39, i32* %8)
%64 = call i32 @FD_SET(i32 %63, i32* %3)
%65 = icmp sgt i32 %63, %57
%66 = select i1 %65, i32 %63, i32 %57
%67 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.7, i64 0, i64 0))
br label %77
68: ; preds = %60
%69 = call i32 @read(i32 %56, i8* %11, i32 1024)
%70 = icmp slt i32 %69, 1
br i1 %70, label %71, label %75
71: ; preds = %68
%72 = call i32 @FD_CLR(i32 %56, i32* %3)
%73 = call i32 @close(i32 %56)
%74 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
br label %77
75: ; preds = %68
%76 = call i32 @write(i32 %56, i8* %11, i32 %69)
br label %77
77: ; preds = %55, %71, %75, %62
%78 = phi i32 [ %66, %62 ], [ %57, %71 ], [ %57, %75 ], [ %57, %55 ]
%79 = add nuw nsw i32 %56, 1
%80 = icmp slt i32 %56, %78
br i1 %80, label %55, label %40
}