#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 /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_port;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ clientname;
typedef int /*<<< orphan*/ FILE;

/* 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 *, size_t *);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ daemon_local();
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int getpid();
char *inet_ntoa(int /*<<< orphan*/);
scalar_t__ listen(int, int);
int make_socket(int);
int /*<<< orphan*/ ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
scalar_t__ read_from_client(int);
int /*<<< orphan*/ remove(char *);
scalar_t__ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int main() {
  int sock;
  fd_set active_fd_set, read_fd_set;
  int i;
  struct sockaddr_in clientname;
  size_t size;
  FILE *fp = NULL;
  daemon_local();
  if ((fp = fopen("/var/run/locallisten.pid", "w")) == NULL) {
    perror("open file error!\n");
    exit(EXIT_FAILURE);
  }
  fprintf(fp, "%d", getpid());
  fclose(fp);
  sock = make_socket(5656);
  if (listen(sock, 1) < 0) {
    perror("listen");
    exit(EXIT_FAILURE);
  }
  FD_ZERO(&active_fd_set);
  FD_SET(sock, &active_fd_set);
  while (1) {
    read_fd_set = active_fd_set;
    if (select(FD_SETSIZE, &read_fd_set, NULL, NULL, NULL) < 0) {
      perror("select");
      exit(EXIT_FAILURE);
    }
    fprintf(stderr, "thread!\n");
    for (i = 0; i < FD_SETSIZE; ++i) {
      if (FD_ISSET(i, &read_fd_set)) {
        if (i == sock) {
          int new;
          size = sizeof(clientname);
          new = accept(sock, (struct sockaddr *)&clientname, &size);
          if (new < 0) {
            perror("accept");
            exit(EXIT_FAILURE);
          }
          fprintf(stderr, "Server: connect from host %s, port %hd.\n",
                  inet_ntoa(clientname.sin_addr), ntohs(clientname.sin_port));
          FD_SET(new, &active_fd_set);
          close(i);
          FD_CLR(i, &active_fd_set);
          remove("/var/run/locallisten.pid");
          exit(0);
        } else {
          if (read_from_client(i) < 0) {
            close(i);
            FD_CLR(i, &active_fd_set);
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x30(%rbp)
mov    $0x0,%al
call   10c0 <daemon_local@plt>
lea    0xd9b(%rip),%rdi
lea    0xdad(%rip),%rsi
call   1100 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmp    $0x0,%rax
jne    1299 <main+0x59>
lea    0xd95(%rip),%rdi
call   1110 <perror@plt>
mov    0x2d3e(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    -0x30(%rbp),%rax
mov    %eax,-0x38(%rbp)
mov    $0x0,%al
call   1040 <getpid@plt>
mov    -0x38(%rbp),%edi
mov    %eax,%edx
lea    0xd7a(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x30(%rbp),%rdi
call   1070 <fclose@plt>
mov    $0x1618,%edi
call   10f0 <make_socket@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%edi
mov    $0x1,%esi
call   10d0 <listen@plt>
cmp    $0x0,%rax
jge    1301 <main+0xc1>
lea    0xd42(%rip),%rdi
call   1110 <perror@plt>
mov    0x2cd6(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
lea    -0xc(%rbp),%rdi
call   10a0 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    0x2cb5(%rip),%rax
mov    (%rax),%edi
lea    -0x10(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10b0 <select@plt>
cmp    $0x0,%rax
jge    135d <main+0x11d>
lea    0xced(%rip),%rdi
call   1110 <perror@plt>
mov    0x2c7a(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    0x2c7c(%rip),%rax
mov    (%rax),%edi
lea    0xcd1(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2c53(%rip),%rcx
cmp    (%rcx),%eax
jge    149b <main+0x25b>
mov    -0x14(%rbp),%edi
lea    -0x10(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1488 <main+0x248>
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1458 <main+0x218>
movq   $0x8,-0x28(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
lea    -0x28(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jge    13ee <main+0x1ae>
lea    0xc6c(%rip),%rdi
call   1110 <perror@plt>
mov    0x2be9(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    0x2beb(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x40(%rbp)
mov    -0x1c(%rbp),%edi
call   10e0 <ntohs@plt>
mov    -0x44(%rbp),%edi
mov    -0x40(%rbp),%rdx
mov    %eax,%ecx
lea    0xc30(%rip),%rsi
mov    $0x0,%al
call   1090 <fprintf@plt>
mov    -0x34(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    -0x14(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1130 <FD_CLR@plt>
lea    0xbb4(%rip),%rdi
call   1030 <remove@plt>
xor    %edi,%edi
call   1150 <exit@plt>
mov    -0x14(%rbp),%edi
call   1140 <read_from_client@plt>
cmp    $0x0,%rax
jge    147e <main+0x23e>
mov    -0x14(%rbp),%edi
call   1080 <close@plt>
mov    -0x14(%rbp),%edi
lea    -0xc(%rbp),%rsi
call   1130 <FD_CLR@plt>
jmp    1483 <main+0x243>
jmp    1488 <main+0x248>
jmp    148d <main+0x24d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    137b <main+0x13b>
jmp    1316 <main+0xd6>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   10c0 <daemon_local@plt>
lea    0xda4(%rip),%rdi
lea    0xdb6(%rip),%rsi
call   1100 <fopen@plt>
test   %rax,%rax
je     143d <main+0x1fd>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <getpid@plt>
lea    0xdab(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rbx,%rdi
call   1070 <fclose@plt>
mov    $0x1618,%edi
call   10f0 <make_socket@plt>
mov    %eax,%r12d
mov    %eax,%edi
mov    $0x1,%esi
call   10d0 <listen@plt>
test   %rax,%rax
js     1449 <main+0x209>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   10a0 <FD_ZERO@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1160 <FD_SET@plt>
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
mov    0x2cfd(%rip),%r13
mov    0x0(%r13),%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10b0 <select@plt>
test   %rax,%rax
js     1431 <main+0x1f1>
lea    0xd3e(%rip),%r14
lea    0x4(%rsp),%rbx
mov    %rsp,%r15
jmp    132f <main+0xef>
nopw   0x0(%rax,%rax,1)
mov    (%rsp),%eax
mov    %eax,0x4(%rsp)
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10b0 <select@plt>
test   %rax,%rax
js     1431 <main+0x1f1>
mov    0x2caa(%rip),%rax
mov    (%rax),%edi
mov    %r14,%rsi
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    0x0(%r13),%edi
test   %edi,%edi
jle    1310 <main+0xd0>
xor    %ebp,%ebp
jmp    135b <main+0x11b>
xchg   %ax,%ax
add    $0x1,%ebp
mov    0x0(%r13),%edi
cmp    %edi,%ebp
jge    1310 <main+0xd0>
mov    %ebp,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1350 <main+0x110>
cmp    %ebp,%r12d
je     138e <main+0x14e>
mov    %ebp,%edi
call   1140 <read_from_client@plt>
test   %rax,%rax
jns    1350 <main+0x110>
mov    %ebp,%edi
call   1080 <close@plt>
mov    %ebp,%edi
mov    %r15,%rsi
call   1130 <FD_CLR@plt>
jmp    1350 <main+0x110>
movq   $0x8,0x10(%rsp)
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
mov    %r12d,%edi
call   1120 <accept@plt>
test   %eax,%eax
jns    13c7 <main+0x187>
lea    0xc93(%rip),%rdi
call   1110 <perror@plt>
mov    0x2c10(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    %eax,%ebx
mov    0x2c10(%rip),%rax
mov    (%rax),%r14d
mov    0x8(%rsp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,%rbp
mov    0xc(%rsp),%edi
call   10e0 <ntohs@plt>
lea    0xc5f(%rip),%rsi
mov    %r14d,%edi
mov    %rbp,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   1090 <fprintf@plt>
mov    %rsp,%rbp
mov    %ebx,%edi
mov    %rbp,%rsi
call   1160 <FD_SET@plt>
mov    %r12d,%edi
call   1080 <close@plt>
mov    %r12d,%edi
mov    %rbp,%rsi
call   1130 <FD_CLR@plt>
lea    0xbdb(%rip),%rdi
call   1030 <remove@plt>
xor    %edi,%edi
call   1150 <exit@plt>
lea    0xbff(%rip),%rdi
jmp    13b4 <main+0x174>
lea    0xbd7(%rip),%rdi
jmp    13b4 <main+0x174>
lea    0xbe0(%rip),%rdi
jmp    13b4 <main+0x174>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [25 x i8] c"/var/run/locallisten.pid\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [18 x i8] c"open file error!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [7 x i8] c"listen\00"
@FD_SETSIZE = global i32 0
@.str.5 = [7 x i8] c"select\00"
@stderr = global i32 0
@.str.6 = [9 x i8] c"thread!\0A\00"
@.str.7 = [7 x i8] c"accept\00"
@.str.8 = [41 x i8] c"Server: connect from host %s, port %hd.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca %struct.sockaddr_in
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %8
%10 = call i32 (...) @daemon_local()
%11 = call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %11, i32** %8
%12 = icmp eq i32* %11, null
br i1 %12, label %13, label %17
13: ; preds = %0
%14 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
%16 = call i32 @exit(i32 %15)
unreachable
17: ; preds = %0
%18 = load i32*, i32** %8
%19 = ptrtoint i32* %18 to i32
%20 = call i32 (...) @getpid()
%21 = call i32 (i32, i8*, ...) @fprintf(i32 %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %20)
%22 = load i32*, i32** %8
%23 = call i32 @fclose(i32* %22)
%24 = call i32 @make_socket(i32 5656)
store i32 %24, i32* %2
%25 = load i32, i32* %2
%26 = call i64 @listen(i32 %25, i32 1)
%27 = icmp slt i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %17
%29 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %17
%33 = call i32 @FD_ZERO(i32* %3)
%34 = load i32, i32* %2
%35 = call i32 @FD_SET(i32 %34, i32* %3)
br label %36
36: ; preds = %32, %102
%37 = load i32, i32* %3
store i32 %37, i32* %4
%38 = load i32, i32* @FD_SETSIZE
%39 = call i64 @select(i32 %38, i32* %4, i32* null, i32* null, i32* null)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %36
%42 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %36
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
store i32 0, i32* %5
br label %48
48: ; preds = %99, %45
%49 = load i32, i32* %5
%50 = load i32, i32* @FD_SETSIZE
%51 = icmp slt i32 %49, %50
br i1 %51, label %52, label %102
52: ; preds = %48
%53 = load i32, i32* %5
%54 = call i64 @FD_ISSET(i32 %53, i32* %4)
%55 = icmp ne i64 %54, 0
br i1 %55, label %56, label %98
56: ; preds = %52
%57 = load i32, i32* %5
%58 = load i32, i32* %2
%59 = icmp eq i32 %57, %58
br i1 %59, label %60, label %87
60: ; preds = %56
store i64 8, i64* %7
%61 = load i32, i32* %2
%62 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%63 = call i32 @accept(i32 %61, %struct.sockaddr* %62, i64* %7)
store i32 %63, i32* %9
%64 = load i32, i32* %9
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %70
66: ; preds = %60
%67 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%68 = load i32, i32* @EXIT_FAILURE
%69 = call i32 @exit(i32 %68)
unreachable
70: ; preds = %60
%71 = load i32, i32* @stderr
%72 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
%73 = load i32, i32* %72
%74 = call i8* @inet_ntoa(i32 %73)
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%76 = load i32, i32* %75
%77 = call i32 @ntohs(i32 %76)
%78 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i8* %74, i32 %77)
%79 = load i32, i32* %9
%80 = call i32 @FD_SET(i32 %79, i32* %3)
%81 = load i32, i32* %5
%82 = call i32 @close(i32 %81)
%83 = load i32, i32* %5
%84 = call i32 @FD_CLR(i32 %83, i32* %3)
%85 = call i32 @remove(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%86 = call i32 @exit(i32 0)
unreachable
87: ; preds = %56
%88 = load i32, i32* %5
%89 = call i64 @read_from_client(i32 %88)
%90 = icmp slt i64 %89, 0
br i1 %90, label %91, label %96
91: ; preds = %87
%92 = load i32, i32* %5
%93 = call i32 @close(i32 %92)
%94 = load i32, i32* %5
%95 = call i32 @FD_CLR(i32 %94, i32* %3)
br label %96
96: ; preds = %91, %87
br label %97
97: ; preds = %96
br label %98
98: ; preds = %97, %52
br label %99
99: ; preds = %98
%100 = load i32, i32* %5
%101 = add nsw i32 %100, 1
store i32 %101, i32* %5
br label %48
102: ; preds = %48
br label %36
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32 }
%struct.sockaddr = type { i32 }
@.str = [25 x i8] c"/var/run/locallisten.pid\00"
@.str.1 = [2 x i8] c"w\00"
@.str.2 = [18 x i8] c"open file error!\0A\00"
@EXIT_FAILURE = global i32 0
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [7 x i8] c"listen\00"
@FD_SETSIZE = global i32 0
@.str.5 = [7 x i8] c"select\00"
@stderr = global i32 0
@.str.6 = [9 x i8] c"thread!\0A\00"
@.str.7 = [7 x i8] c"accept\00"
@.str.8 = [41 x i8] c"Server: connect from host %s, port %hd.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca %struct.sockaddr_in
%4 = alloca i64
%5 = bitcast i32* %1 to i8*
%6 = bitcast i32* %2 to i8*
%7 = bitcast %struct.sockaddr_in* %3 to i8*
%8 = bitcast i64* %4 to i8*
%9 = tail call i32 (...) @daemon_local()
%10 = tail call i32* @fopen(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %16
12: ; preds = %0
%13 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @EXIT_FAILURE
%15 = tail call i32 @exit(i32 %14)
unreachable
16: ; preds = %0
%17 = ptrtoint i32* %10 to i64
%18 = trunc i64 %17 to i32
%19 = tail call i32 (...) @getpid()
%20 = tail call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = tail call i32 @fclose(i32* %10)
%22 = tail call i32 @make_socket(i32 5656)
%23 = tail call i64 @listen(i32 %22, i32 1)
%24 = icmp slt i64 %23, 0
br i1 %24, label %25, label %29
25: ; preds = %16
%26 = tail call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%27 = load i32, i32* @EXIT_FAILURE
%28 = tail call i32 @exit(i32 %27)
unreachable
29: ; preds = %16
%30 = call i32 @FD_ZERO(i32* %1)
%31 = call i32 @FD_SET(i32 %22, i32* %1)
%32 = load i32, i32* %1
store i32 %32, i32* %2
%33 = load i32, i32* @FD_SETSIZE
%34 = call i64 @select(i32 %33, i32* %2, i32* null, i32* null, i32* null)
%35 = icmp slt i64 %34, 0
br i1 %35, label %41, label %45
36: ; preds = %84, %45
%37 = phi i32 [ %48, %45 ], [ %86, %84 ]
%38 = load i32, i32* %1
store i32 %38, i32* %2
%39 = call i64 @select(i32 %37, i32* %2, i32* null, i32* null, i32* null)
%40 = icmp slt i64 %39, 0
br i1 %40, label %41, label %45
41: ; preds = %36, %29
%42 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%43 = load i32, i32* @EXIT_FAILURE
%44 = call i32 @exit(i32 %43)
unreachable
45: ; preds = %29, %36
%46 = load i32, i32* @stderr
%47 = call i32 (i32, i8*, ...) @fprintf(i32 %46, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
%48 = load i32, i32* @FD_SETSIZE
%49 = icmp sgt i32 %48, 0
br i1 %49, label %50, label %36
50: ; preds = %45, %84
%51 = phi i32 [ %85, %84 ], [ 0, %45 ]
%52 = call i64 @FD_ISSET(i32 %51, i32* %2)
%53 = icmp eq i64 %52, 0
br i1 %53, label %84, label %54
54: ; preds = %50
%55 = icmp eq i32 %51, %22
br i1 %55, label %56, label %78
56: ; preds = %54
store i64 8, i64* %4
%57 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%58 = call i32 @accept(i32 %22, %struct.sockaddr* %57, i64* %4)
%59 = icmp slt i32 %58, 0
br i1 %59, label %60, label %64
60: ; preds = %56
%61 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
%62 = load i32, i32* @EXIT_FAILURE
%63 = call i32 @exit(i32 %62)
unreachable
64: ; preds = %56
%65 = load i32, i32* @stderr
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%67 = load i32, i32* %66
%68 = call i8* @inet_ntoa(i32 %67)
%69 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1
%70 = load i32, i32* %69
%71 = call i32 @ntohs(i32 %70)
%72 = call i32 (i32, i8*, ...) @fprintf(i32 %65, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.8, i64 0, i64 0), i8* %68, i32 %71)
%73 = call i32 @FD_SET(i32 %58, i32* %1)
%74 = call i32 @close(i32 %22)
%75 = call i32 @FD_CLR(i32 %22, i32* %1)
%76 = call i32 @remove(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%77 = call i32 @exit(i32 0)
unreachable
78: ; preds = %54
%79 = call i64 @read_from_client(i32 %51)
%80 = icmp slt i64 %79, 0
br i1 %80, label %81, label %84
81: ; preds = %78
%82 = call i32 @close(i32 %51)
%83 = call i32 @FD_CLR(i32 %51, i32* %1)
br label %84
84: ; preds = %50, %78, %81
%85 = add nuw nsw i32 %51, 1
%86 = load i32, i32* @FD_SETSIZE
%87 = icmp slt i32 %85, %86
br i1 %87, label %50, label %36
}