#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 */
typedef int /*<<< orphan*/ time_t;
struct tm {
  int tm_year;
  int tm_mon;
  int tm_mday;
  int tm_hour;
  int tm_min;
  int tm_sec;
};
struct timeval {
  int dummy;
};
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 dummy;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ server_address;
typedef int /*<<< orphan*/ name;
typedef int /*<<< orphan*/ message;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ client_address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
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*/ FIONREAD;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ ioctl(int, int /*<<< orphan*/, int *);
int /*<<< orphan*/ listen(int, int);
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ read(int, char *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, struct timeval *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, char *, ...);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int /*<<< orphan*/ write(int, char *, int);
int main() {
  int server_sockfd, client_sockfd;
  int server_len, client_len;
  struct sockaddr_in server_address;
  struct sockaddr_in client_address;
  int result;
  fd_set readfds, testfds;
  char name[20][20];
  server_sockfd = socket(AF_INET, SOCK_STREAM, 0);
  server_address.sin_family = AF_INET;
  server_address.sin_addr.s_addr = htonl(INADDR_ANY);
  server_address.sin_port = htons(9734);
  server_len = sizeof(server_address);
  bind(server_sockfd, (struct sockaddr *)&server_address, server_len);
  listen(server_sockfd, 5);
  FD_ZERO(&readfds);
  FD_SET(server_sockfd, &readfds);
  while (1) {
    char message[250 + 1];
    int fd, fdd;
    int nread;
    testfds = readfds;
    printf("server waiting\n");
    result = select(FD_SETSIZE, &testfds, (fd_set *)0, (fd_set *)0,
                    (struct timeval *)0);
    if (result < 1) {
      perror("server");
      exit(1);
    }
    for (fd = 0; fd < FD_SETSIZE; fd++) {
      if (FD_ISSET(fd, &testfds)) {
        if (fd == server_sockfd) {
          client_len = sizeof(client_address);
          client_sockfd =
              accept(server_sockfd, (struct sockaddr *)&client_address,
                     (socklen_t *)&client_len);
          FD_SET(client_sockfd, &readfds);
          memset(name[client_sockfd], 0, sizeof(name[client_sockfd]));
          read(client_sockfd, name[client_sockfd], 250);
          printf("adding client on fd %d: %s\n", client_sockfd,
                 name[client_sockfd]);
          if (strcmp(name[client_sockfd], "admin") == 0)
            continue;
          for (fdd = 0; fdd < FD_SETSIZE; fdd++)
            if (FD_ISSET(fdd, &readfds) && (fdd != server_sockfd)) {
              struct tm *tm_ptr;
              time_t the_time;
              time(&the_time);
              tm_ptr = localtime(&the_time);
              sprintf(message,
                      "* %s has been online!\n@ %02d/%02d/%02d %02d:%02d:%02d",
                      name[client_sockfd], tm_ptr->tm_year - 100,
                      tm_ptr->tm_mon + 1, tm_ptr->tm_mday, tm_ptr->tm_hour,
                      tm_ptr->tm_min, tm_ptr->tm_sec);
              write(fdd, message, 250);
            }
        } else {
          ioctl(fd, FIONREAD, &nread);
          if (nread == 0) {
            close(fd);
            FD_CLR(fd, &readfds);
            printf("removing client on fd %d\n", fd);
            if (strcmp(name[fd], "admin") == 0)
              continue;
            for (fdd = 0; fdd < FD_SETSIZE; fdd++)
              if (FD_ISSET(fdd, &readfds) && (fdd != server_sockfd)) {
                struct tm *tm_ptr;
                time_t the_time;
                time(&the_time);
                tm_ptr = localtime(&the_time);
                sprintf(
                    message,
                    "* %s has been offline!\n@ %02d/%02d/%02d %02d:%02d:%02d",
                    name[client_sockfd], tm_ptr->tm_year - 100,
                    tm_ptr->tm_mon + 1, tm_ptr->tm_mday, tm_ptr->tm_hour,
                    tm_ptr->tm_min, tm_ptr->tm_sec);
                write(fdd, message, 250);
              }
          } else {
            memset(message, 0, sizeof(message));
            read(fd, message, 250);
            for (fdd = 0; fdd < FD_SETSIZE; fdd++)
              if (FD_ISSET(fdd, &readfds) && (fdd != server_sockfd)) {
                char mess[300];
                printf("serving client on fd %d\n", fdd);
                sprintf(mess, "%s: %s", name[fd], message);
                write(fdd, mess, 250);
              }
          }
        }
      }
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x450,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2d57(%rip),%rax
mov    (%rax),%edi
mov    0x2d36(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1190 <socket@plt>
mov    %eax,-0x8(%rbp)
mov    0x2d3b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x18(%rbp)
mov    0x2d27(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,-0x1c(%rbp)
mov    $0x2606,%edi
call   1060 <htons@plt>
mov    %eax,-0x20(%rbp)
movl   $0xc,-0x10(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x20(%rbp),%rsi
mov    -0x10(%rbp),%edx
call   1120 <bind@plt>
mov    -0x8(%rbp),%edi
mov    $0x5,%esi
call   1110 <listen@plt>
lea    -0x38(%rbp),%rdi
call   10f0 <FD_ZERO@plt>
mov    -0x8(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1180 <FD_SET@plt>
mov    -0x38(%rbp),%eax
mov    %eax,-0x3c(%rbp)
lea    0xcf3(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
mov    0x2ca5(%rip),%rax
mov    (%rax),%edi
lea    -0x3c(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1100 <select@plt>
mov    %eax,-0x34(%rbp)
cmpl   $0x1,-0x34(%rbp)
jge    1354 <main+0xe4>
lea    0xccb(%rip),%rdi
call   1130 <perror@plt>
mov    $0x1,%edi
call   1170 <exit@plt>
movl   $0x0,-0x2d4(%rbp)
mov    -0x2d4(%rbp),%eax
mov    0x2c55(%rip),%rcx
cmp    (%rcx),%eax
jge    180c <main+0x59c>
mov    -0x2d4(%rbp),%edi
lea    -0x3c(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     17f3 <main+0x583>
mov    -0x2d4(%rbp),%eax
cmp    -0x8(%rbp),%eax
jne    1563 <main+0x2f3>
movl   $0xc,-0x14(%rbp)
mov    -0x8(%rbp),%edi
lea    -0x30(%rbp),%rsi
lea    -0x14(%rbp),%rdx
call   1140 <accept@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1180 <FD_SET@plt>
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   1090 <memset@plt>
mov    -0xc(%rbp),%edi
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rsi
imul   $0x14,%rax,%rax
add    %rax,%rsi
mov    $0xfa,%edx
call   10c0 <read@plt>
mov    -0xc(%rbp),%esi
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rdx
imul   $0x14,%rax,%rax
add    %rax,%rdx
lea    0xbfd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    0xbf9(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    144e <main+0x1de>
jmp    17f8 <main+0x588>
movl   $0x0,-0x2d8(%rbp)
mov    -0x2d8(%rbp),%eax
mov    0x2b5b(%rip),%rcx
cmp    (%rcx),%eax
jge    155e <main+0x2ee>
mov    -0x2d8(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1545 <main+0x2d5>
mov    -0x2d8(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     1545 <main+0x2d5>
lea    -0x2ec(%rbp),%rdi
call   10e0 <time@plt>
lea    -0x2ec(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x2e8(%rbp)
lea    -0x2d0(%rbp),%rdi
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rdx
imul   $0x14,%rax,%rax
add    %rax,%rdx
mov    -0x2e8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x64,%ecx
mov    -0x2e8(%rbp),%rax
mov    0x4(%rax),%r8d
add    $0x1,%r8d
mov    -0x2e8(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x2e8(%rbp),%rax
mov    0xc(%rax),%r11d
mov    -0x2e8(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x2e8(%rbp),%rax
mov    0x14(%rax),%eax
lea    0xb1f(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1160 <sprintf@plt>
mov    -0x2d8(%rbp),%edi
lea    -0x2d0(%rbp),%rsi
mov    $0xfa,%edx
call   1040 <write@plt>
jmp    154a <main+0x2da>
mov    -0x2d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d8(%rbp)
jmp    1458 <main+0x1e8>
jmp    17ee <main+0x57e>
mov    -0x2d4(%rbp),%edi
mov    0x2a78(%rip),%rax
mov    (%rax),%esi
lea    -0x2dc(%rbp),%rdx
call   10a0 <ioctl@plt>
cmpl   $0x0,-0x2dc(%rbp)
jne    16fe <main+0x48e>
mov    -0x2d4(%rbp),%edi
call   10b0 <close@plt>
mov    -0x2d4(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1150 <FD_CLR@plt>
mov    -0x2d4(%rbp),%esi
lea    0xabd(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movslq -0x2d4(%rbp),%rax
lea    -0x1d0(%rbp),%rdi
imul   $0x14,%rax,%rax
add    %rax,%rdi
lea    0xa5e(%rip),%rsi
call   10d0 <strcmp@plt>
cmp    $0x0,%rax
jne    15e9 <main+0x379>
jmp    17f8 <main+0x588>
movl   $0x0,-0x2d8(%rbp)
mov    -0x2d8(%rbp),%eax
mov    0x29c0(%rip),%rcx
cmp    (%rcx),%eax
jge    16f9 <main+0x489>
mov    -0x2d8(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     16e0 <main+0x470>
mov    -0x2d8(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     16e0 <main+0x470>
lea    -0x2fc(%rbp),%rdi
call   10e0 <time@plt>
lea    -0x2fc(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x2f8(%rbp)
lea    -0x2d0(%rbp),%rdi
movslq -0xc(%rbp),%rax
lea    -0x1d0(%rbp),%rdx
imul   $0x14,%rax,%rax
add    %rax,%rdx
mov    -0x2f8(%rbp),%rax
mov    (%rax),%ecx
sub    $0x64,%ecx
mov    -0x2f8(%rbp),%rax
mov    0x4(%rax),%r8d
add    $0x1,%r8d
mov    -0x2f8(%rbp),%rax
mov    0x8(%rax),%r9d
mov    -0x2f8(%rbp),%rax
mov    0xc(%rax),%r11d
mov    -0x2f8(%rbp),%rax
mov    0x10(%rax),%r10d
mov    -0x2f8(%rbp),%rax
mov    0x14(%rax),%eax
lea    0x9d4(%rip),%rsi
mov    %r11d,(%rsp)
mov    %r10d,0x8(%rsp)
mov    %eax,0x10(%rsp)
mov    $0x0,%al
call   1160 <sprintf@plt>
mov    -0x2d8(%rbp),%edi
lea    -0x2d0(%rbp),%rsi
mov    $0xfa,%edx
call   1040 <write@plt>
jmp    16e5 <main+0x475>
mov    -0x2d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d8(%rbp)
jmp    15f3 <main+0x383>
jmp    17e9 <main+0x579>
lea    -0x2d0(%rbp),%rdi
xor    %esi,%esi
mov    $0xfb,%edx
call   1090 <memset@plt>
mov    -0x2d4(%rbp),%edi
lea    -0x2d0(%rbp),%rsi
mov    $0xfa,%edx
call   10c0 <read@plt>
movl   $0x0,-0x2d8(%rbp)
mov    -0x2d8(%rbp),%eax
mov    0x2881(%rip),%rcx
cmp    (%rcx),%eax
jge    17e4 <main+0x574>
mov    -0x2d8(%rbp),%edi
lea    -0x38(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     17cb <main+0x55b>
mov    -0x2d8(%rbp),%eax
cmp    -0x8(%rbp),%eax
je     17cb <main+0x55b>
mov    -0x2d8(%rbp),%esi
lea    0x944(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    -0x430(%rbp),%rdi
movslq -0x2d4(%rbp),%rax
lea    -0x1d0(%rbp),%rdx
imul   $0x14,%rax,%rax
add    %rax,%rdx
lea    -0x2d0(%rbp),%rcx
lea    0x92c(%rip),%rsi
mov    $0x0,%al
call   1160 <sprintf@plt>
mov    -0x2d8(%rbp),%edi
lea    -0x430(%rbp),%rsi
mov    $0xfa,%edx
call   1040 <write@plt>
jmp    17d0 <main+0x560>
mov    -0x2d8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d8(%rbp)
jmp    1732 <main+0x4c2>
jmp    17e9 <main+0x579>
jmp    17ee <main+0x57e>
jmp    17f3 <main+0x583>
jmp    17f8 <main+0x588>
mov    -0x2d4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2d4(%rbp)
jmp    135e <main+0xee>
jmp    1300 <main+0x90>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x418,%rsp
mov    0x2d48(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d27(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11a0 <socket@plt>
mov    %eax,%r12d
mov    (%rbx),%eax
mov    %eax,0x30(%rsp)
mov    0x2d1e(%rip),%rax
mov    (%rax),%edi
call   1090 <htonl@plt>
mov    %eax,0x2c(%rsp)
mov    $0x2606,%edi
call   1070 <htons@plt>
mov    %eax,0x28(%rsp)
lea    0x28(%rsp),%rsi
mov    %r12d,%edi
mov    $0xc,%edx
call   1130 <bind@plt>
mov    %r12d,%edi
mov    $0x5,%esi
call   1120 <listen@plt>
lea    0x8(%rsp),%rbx
mov    %rbx,%rdi
call   1100 <FD_ZERO@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
call   1190 <FD_SET@plt>
mov    0x8(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0xdb7(%rip),%rdi
call   1040 <puts@plt>
mov    0x2c9b(%rip),%r13
mov    0x0(%r13),%edi
lea    0x4(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1110 <select@plt>
test   %eax,%eax
jg     1354 <main+0xd4>
lea    0xcbb(%rip),%rdi
call   1140 <perror@plt>
mov    $0x1,%edi
call   1180 <exit@plt>
mov    %r12d,%eax
mov    %rax,0x38(%rsp)
lea    0x4(%rsp),%rbp
mov    %r12d,0xc(%rsp)
jmp    139b <main+0x11b>
nopl   0x0(%rax,%rax,1)
mov    0x8(%rsp),%eax
mov    %eax,0x4(%rsp)
lea    0xd51(%rip),%rdi
call   1040 <puts@plt>
mov    0x0(%r13),%edi
mov    %rbp,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1110 <select@plt>
test   %eax,%eax
jle    133e <main+0xbe>
cmpl   $0x0,0x0(%r13)
jle    1370 <main+0xf0>
xor    %r14d,%r14d
jmp    13c0 <main+0x140>
nopw   0x0(%rax,%rax,1)
mov    0x0(%r13),%ecx
add    $0x1,%r14
movslq %ecx,%rax
cmp    %rax,%r14
jge    1370 <main+0xf0>
mov    %r14d,%edi
mov    %rbp,%rsi
call   1060 <FD_ISSET@plt>
test   %rax,%rax
je     13b0 <main+0x130>
cmp    0x38(%rsp),%r14
mov    %r14,0x10(%rsp)
jne    1520 <main+0x2a0>
movl   $0xc,0x24(%rsp)
mov    %r12d,%edi
lea    0x40(%rsp),%rsi
lea    0x24(%rsp),%rdx
call   1150 <accept@plt>
mov    %eax,%ebx
mov    %eax,%edi
lea    0x8(%rsp),%rsi
call   1190 <FD_SET@plt>
mov    %ebx,0x1c(%rsp)
movslq %ebx,%rbx
lea    (%rbx,%rbx,4),%rax
mov    %r13,%rbp
lea    (%rsp,%rax,4),%r12
add    $0x280,%r12
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10a0 <memset@plt>
mov    %ebx,%edi
mov    %r12,%rsi
mov    $0xfa,%edx
call   10d0 <read@plt>
lea    0xbc1(%rip),%rdi
mov    %ebx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1080 <printf@plt>
mov    %r12,%rdi
lea    0xbc7(%rip),%rsi
call   10e0 <strcmp@plt>
mov    0x0(%r13),%ecx
test   %rax,%rax
je     1600 <main+0x380>
test   %ecx,%ecx
jle    1600 <main+0x380>
xor    %r15d,%r15d
jmp    1491 <main+0x211>
nopl   0x0(%rax,%rax,1)
add    $0x1,%r15d
mov    0x0(%r13),%ecx
cmp    %ecx,%r15d
jge    1600 <main+0x380>
mov    %r15d,%edi
lea    0x8(%rsp),%rsi
call   1060 <FD_ISSET@plt>
test   %rax,%rax
je     1480 <main+0x200>
cmp    %r15d,0xc(%rsp)
je     1480 <main+0x200>
lea    0x150(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%ecx
mov    0x4(%rax),%r8d
add    $0xffffff9c,%ecx
add    $0x1,%r8d
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r10d
mov    0x10(%rax),%ebp
mov    0x14(%rax),%ebx
sub    $0x8,%rsp
lea    0x58(%rsp),%r14
mov    %r14,%rdi
lea    0xb39(%rip),%rsi
mov    %r12,%rdx
xor    %eax,%eax
push   %rbx
push   %rbp
push   %r10
call   1170 <sprintf@plt>
add    $0x20,%rsp
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xfa,%edx
call   1050 <write@plt>
jmp    1480 <main+0x200>
nopw   0x0(%rax,%rax,1)
mov    0x2ac1(%rip),%rax
mov    (%rax),%esi
mov    %r14d,%edi
lea    0x20(%rsp),%rdx
call   10b0 <ioctl@plt>
cmpl   $0x0,0x20(%rsp)
je     1614 <main+0x394>
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0xfb,%edx
call   10a0 <memset@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0xfa,%edx
call   10d0 <read@plt>
mov    0x0(%r13),%ecx
test   %ecx,%ecx
jle    13b4 <main+0x134>
lea    (%r14,%r14,4),%rax
lea    (%rsp,%rax,4),%rbp
add    $0x280,%rbp
xor    %ebx,%ebx
jmp    159f <main+0x31f>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%ebx
mov    0x0(%r13),%ecx
cmp    %ecx,%ebx
jge    1728 <main+0x4a8>
mov    %ebx,%edi
lea    0x8(%rsp),%rsi
call   1060 <FD_ISSET@plt>
test   %rax,%rax
je     1590 <main+0x310>
cmp    %ebx,%r12d
je     1590 <main+0x310>
lea    0xaf4(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0x150(%rsp),%r15
mov    %r15,%rdi
lea    0xaf2(%rip),%rsi
mov    %rbp,%rdx
lea    0x50(%rsp),%rcx
xor    %eax,%eax
call   1170 <sprintf@plt>
mov    %ebx,%edi
mov    %r15,%rsi
mov    $0xfa,%edx
call   1050 <write@plt>
jmp    1590 <main+0x310>
nopw   0x0(%rax,%rax,1)
mov    0xc(%rsp),%r12d
lea    0x4(%rsp),%rbp
mov    0x10(%rsp),%r14
jmp    13b4 <main+0x134>
mov    %r14d,%edi
call   10c0 <close@plt>
mov    %r14d,%edi
lea    0x8(%rsp),%rsi
call   1160 <FD_CLR@plt>
lea    0xa2f(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1080 <printf@plt>
lea    (%r14,%r14,4),%rax
lea    (%rsp,%rax,4),%rdi
add    $0x280,%rdi
lea    0x9d3(%rip),%rsi
call   10e0 <strcmp@plt>
mov    0x0(%r13),%ecx
test   %rax,%rax
je     13b4 <main+0x134>
test   %ecx,%ecx
jle    13b4 <main+0x134>
movslq 0x1c(%rsp),%rax
lea    (%rax,%rax,4),%rax
lea    (%rsp,%rax,4),%r15
add    $0x280,%r15
xor    %ebp,%ebp
jmp    169f <main+0x41f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
add    $0x1,%ebp
mov    0x0(%r13),%ecx
cmp    %ecx,%ebp
jge    1728 <main+0x4a8>
mov    %ebp,%edi
lea    0x8(%rsp),%rsi
call   1060 <FD_ISSET@plt>
test   %rax,%rax
je     1690 <main+0x410>
cmp    %ebp,%r12d
je     1690 <main+0x410>
lea    0x150(%rsp),%rbx
mov    %rbx,%rdi
call   10f0 <time@plt>
mov    %rbx,%rdi
call   1030 <localtime@plt>
mov    (%rax),%ecx
mov    0x4(%rax),%r8d
add    $0xffffff9c,%ecx
add    $0x1,%r8d
mov    0x8(%rax),%r9d
mov    0xc(%rax),%r10d
mov    0x10(%rax),%r11d
mov    0x14(%rax),%ebx
sub    $0x8,%rsp
lea    0x58(%rsp),%r14
mov    %r14,%rdi
lea    0x97d(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
push   %rbx
push   %r11
push   %r10
call   1170 <sprintf@plt>
add    $0x20,%rsp
mov    %ebp,%edi
mov    %r14,%rsi
mov    0x10(%rsp),%r14
mov    $0xfa,%edx
call   1050 <write@plt>
jmp    1690 <main+0x410>
lea    0x4(%rsp),%rbp
jmp    13b4 <main+0x134>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
%struct.sockaddr = type { i32 }
%struct.timeval = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
@.str = [16 x i8] c"server waiting\0A\00"
@FD_SETSIZE = global i32 0
@.str.1 = [7 x i8] c"server\00"
@.str.2 = [28 x i8] c"adding client on fd %d: %s\0A\00"
@.str.3 = [6 x i8] c"admin\00"
@.str.4 = [54 x i8] c"* %s has been online!\0A@ %02d/%02d/%02d %02d:%02d:%02d\00"
@FIONREAD = global i32 0
@.str.5 = [26 x i8] c"removing client on fd %d\0A\00"
@.str.6 = [55 x i8] c"* %s has been offline!\0A@ %02d/%02d/%02d %02d:%02d:%02d\00"
@.str.7 = [25 x i8] c"serving client on fd %d\0A\00"
@.str.8 = [7 x i8] c"%s: %s\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 %struct.sockaddr_in
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [20 x [20 x i8]]
%12 = alloca [251 x i8]
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca %struct.tm*
%17 = alloca i32
%18 = alloca %struct.tm*
%19 = alloca i32
%20 = alloca [300 x i8]
store i32 0, i32* %1
%21 = load i32, i32* @AF_INET
%22 = load i32, i32* @SOCK_STREAM
%23 = call i32 @socket(i32 %21, i32 %22, i32 0)
store i32 %23, i32* %2
%24 = load i32, i32* @AF_INET
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 2
store i32 %24, i32* %25
%26 = load i32, i32* @INADDR_ANY
%27 = call i32 @htonl(i32 %26)
%28 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 1
%29 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %28, i32 0, i32 0
store i32 %27, i32* %29
%30 = call i32 @htons(i32 9734)
%31 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %6, i32 0, i32 0
store i32 %30, i32* %31
store i32 12, i32* %4
%32 = load i32, i32* %2
%33 = bitcast %struct.sockaddr_in* %6 to %struct.sockaddr*
%34 = load i32, i32* %4
%35 = call i32 @bind(i32 %32, %struct.sockaddr* %33, i32 %34)
%36 = load i32, i32* %2
%37 = call i32 @listen(i32 %36, i32 5)
%38 = call i32 @FD_ZERO(i32* %9)
%39 = load i32, i32* %2
%40 = call i32 @FD_SET(i32 %39, i32* %9)
br label %41
41: ; preds = %0, %256
%42 = load i32, i32* %9
store i32 %42, i32* %10
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%44 = load i32, i32* @FD_SETSIZE
%45 = call i32 @select(i32 %44, i32* %10, i32* null, i32* null, %struct.timeval* null)
store i32 %45, i32* %8
%46 = load i32, i32* %8
%47 = icmp slt i32 %46, 1
br i1 %47, label %48, label %51
48: ; preds = %41
%49 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%50 = call i32 @exit(i32 1)
unreachable
51: ; preds = %41
store i32 0, i32* %13
br label %52
52: ; preds = %253, %51
%53 = load i32, i32* %13
%54 = load i32, i32* @FD_SETSIZE
%55 = icmp slt i32 %53, %54
br i1 %55, label %56, label %256
56: ; preds = %52
%57 = load i32, i32* %13
%58 = call i64 @FD_ISSET(i32 %57, i32* %10)
%59 = icmp ne i64 %58, 0
br i1 %59, label %60, label %252
60: ; preds = %56
%61 = load i32, i32* %13
%62 = load i32, i32* %2
%63 = icmp eq i32 %61, %62
br i1 %63, label %64, label %144
64: ; preds = %60
store i32 12, i32* %5
%65 = load i32, i32* %2
%66 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%67 = call i32 @accept(i32 %65, %struct.sockaddr* %66, i32* %5)
store i32 %67, i32* %3
%68 = load i32, i32* %3
%69 = call i32 @FD_SET(i32 %68, i32* %9)
%70 = load i32, i32* %3
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %71
%73 = getelementptr inbounds [20 x i8], [20 x i8]* %72, i64 0, i64 0
%74 = call i32 @memset(i8* %73, i32 0, i32 20)
%75 = load i32, i32* %3
%76 = load i32, i32* %3
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %77
%79 = getelementptr inbounds [20 x i8], [20 x i8]* %78, i64 0, i64 0
%80 = call i32 @read(i32 %75, i8* %79, i32 250)
%81 = load i32, i32* %3
%82 = load i32, i32* %3
%83 = sext i32 %82 to i64
%84 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %83
%85 = getelementptr inbounds [20 x i8], [20 x i8]* %84, i64 0, i64 0
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %81, i8* %85)
%87 = load i32, i32* %3
%88 = sext i32 %87 to i64
%89 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %88
%90 = getelementptr inbounds [20 x i8], [20 x i8]* %89, i64 0, i64 0
%91 = call i64 @strcmp(i8* %90, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%92 = icmp eq i64 %91, 0
br i1 %92, label %93, label %94
93: ; preds = %64
br label %253
94: ; preds = %64
store i32 0, i32* %14
br label %95
95: ; preds = %140, %94
%96 = load i32, i32* %14
%97 = load i32, i32* @FD_SETSIZE
%98 = icmp slt i32 %96, %97
br i1 %98, label %99, label %143
99: ; preds = %95
%100 = load i32, i32* %14
%101 = call i64 @FD_ISSET(i32 %100, i32* %9)
%102 = icmp ne i64 %101, 0
br i1 %102, label %103, label %139
103: ; preds = %99
%104 = load i32, i32* %14
%105 = load i32, i32* %2
%106 = icmp ne i32 %104, %105
br i1 %106, label %107, label %139
107: ; preds = %103
%108 = call i32 @time(i32* %17)
%109 = call %struct.tm* @localtime(i32* %17)
store %struct.tm* %109, %struct.tm** %16
%110 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%111 = load i32, i32* %3
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %112
%114 = getelementptr inbounds [20 x i8], [20 x i8]* %113, i64 0, i64 0
%115 = load %struct.tm*, %struct.tm** %16
%116 = getelementptr inbounds %struct.tm, %struct.tm* %115, i32 0, i32 0
%117 = load i32, i32* %116
%118 = sub nsw i32 %117, 100
%119 = load %struct.tm*, %struct.tm** %16
%120 = getelementptr inbounds %struct.tm, %struct.tm* %119, i32 0, i32 1
%121 = load i32, i32* %120
%122 = add nsw i32 %121, 1
%123 = load %struct.tm*, %struct.tm** %16
%124 = getelementptr inbounds %struct.tm, %struct.tm* %123, i32 0, i32 2
%125 = load i32, i32* %124
%126 = load %struct.tm*, %struct.tm** %16
%127 = getelementptr inbounds %struct.tm, %struct.tm* %126, i32 0, i32 3
%128 = load i32, i32* %127
%129 = load %struct.tm*, %struct.tm** %16
%130 = getelementptr inbounds %struct.tm, %struct.tm* %129, i32 0, i32 4
%131 = load i32, i32* %130
%132 = load %struct.tm*, %struct.tm** %16
%133 = getelementptr inbounds %struct.tm, %struct.tm* %132, i32 0, i32 5
%134 = load i32, i32* %133
%135 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %110, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %114, i32 %118, i32 %122, i32 %125, i32 %128, i32 %131, i32 %134)
%136 = load i32, i32* %14
%137 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%138 = call i32 @write(i32 %136, i8* %137, i32 250)
br label %139
139: ; preds = %107, %103, %99
br label %140
140: ; preds = %139
%141 = load i32, i32* %14
%142 = add nsw i32 %141, 1
store i32 %142, i32* %14
br label %95
143: ; preds = %95
br label %251
144: ; preds = %60
%145 = load i32, i32* %13
%146 = load i32, i32* @FIONREAD
%147 = call i32 @ioctl(i32 %145, i32 %146, i32* %15)
%148 = load i32, i32* %15
%149 = icmp eq i32 %148, 0
br i1 %149, label %150, label %214
150: ; preds = %144
%151 = load i32, i32* %13
%152 = call i32 @close(i32 %151)
%153 = load i32, i32* %13
%154 = call i32 @FD_CLR(i32 %153, i32* %9)
%155 = load i32, i32* %13
%156 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %155)
%157 = load i32, i32* %13
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %158
%160 = getelementptr inbounds [20 x i8], [20 x i8]* %159, i64 0, i64 0
%161 = call i64 @strcmp(i8* %160, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%162 = icmp eq i64 %161, 0
br i1 %162, label %163, label %164
163: ; preds = %150
br label %253
164: ; preds = %150
store i32 0, i32* %14
br label %165
165: ; preds = %210, %164
%166 = load i32, i32* %14
%167 = load i32, i32* @FD_SETSIZE
%168 = icmp slt i32 %166, %167
br i1 %168, label %169, label %213
169: ; preds = %165
%170 = load i32, i32* %14
%171 = call i64 @FD_ISSET(i32 %170, i32* %9)
%172 = icmp ne i64 %171, 0
br i1 %172, label %173, label %209
173: ; preds = %169
%174 = load i32, i32* %14
%175 = load i32, i32* %2
%176 = icmp ne i32 %174, %175
br i1 %176, label %177, label %209
177: ; preds = %173
%178 = call i32 @time(i32* %19)
%179 = call %struct.tm* @localtime(i32* %19)
store %struct.tm* %179, %struct.tm** %18
%180 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%181 = load i32, i32* %3
%182 = sext i32 %181 to i64
%183 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %182
%184 = getelementptr inbounds [20 x i8], [20 x i8]* %183, i64 0, i64 0
%185 = load %struct.tm*, %struct.tm** %18
%186 = getelementptr inbounds %struct.tm, %struct.tm* %185, i32 0, i32 0
%187 = load i32, i32* %186
%188 = sub nsw i32 %187, 100
%189 = load %struct.tm*, %struct.tm** %18
%190 = getelementptr inbounds %struct.tm, %struct.tm* %189, i32 0, i32 1
%191 = load i32, i32* %190
%192 = add nsw i32 %191, 1
%193 = load %struct.tm*, %struct.tm** %18
%194 = getelementptr inbounds %struct.tm, %struct.tm* %193, i32 0, i32 2
%195 = load i32, i32* %194
%196 = load %struct.tm*, %struct.tm** %18
%197 = getelementptr inbounds %struct.tm, %struct.tm* %196, i32 0, i32 3
%198 = load i32, i32* %197
%199 = load %struct.tm*, %struct.tm** %18
%200 = getelementptr inbounds %struct.tm, %struct.tm* %199, i32 0, i32 4
%201 = load i32, i32* %200
%202 = load %struct.tm*, %struct.tm** %18
%203 = getelementptr inbounds %struct.tm, %struct.tm* %202, i32 0, i32 5
%204 = load i32, i32* %203
%205 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %180, i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i8* %184, i32 %188, i32 %192, i32 %195, i32 %198, i32 %201, i32 %204)
%206 = load i32, i32* %14
%207 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%208 = call i32 @write(i32 %206, i8* %207, i32 250)
br label %209
209: ; preds = %177, %173, %169
br label %210
210: ; preds = %209
%211 = load i32, i32* %14
%212 = add nsw i32 %211, 1
store i32 %212, i32* %14
br label %165
213: ; preds = %165
br label %250
214: ; preds = %144
%215 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%216 = call i32 @memset(i8* %215, i32 0, i32 251)
%217 = load i32, i32* %13
%218 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%219 = call i32 @read(i32 %217, i8* %218, i32 250)
store i32 0, i32* %14
br label %220
220: ; preds = %246, %214
%221 = load i32, i32* %14
%222 = load i32, i32* @FD_SETSIZE
%223 = icmp slt i32 %221, %222
br i1 %223, label %224, label %249
224: ; preds = %220
%225 = load i32, i32* %14
%226 = call i64 @FD_ISSET(i32 %225, i32* %9)
%227 = icmp ne i64 %226, 0
br i1 %227, label %228, label %245
228: ; preds = %224
%229 = load i32, i32* %14
%230 = load i32, i32* %2
%231 = icmp ne i32 %229, %230
br i1 %231, label %232, label %245
232: ; preds = %228
%233 = load i32, i32* %14
%234 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %233)
%235 = getelementptr inbounds [300 x i8], [300 x i8]* %20, i64 0, i64 0
%236 = load i32, i32* %13
%237 = sext i32 %236 to i64
%238 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %11, i64 0, i64 %237
%239 = getelementptr inbounds [20 x i8], [20 x i8]* %238, i64 0, i64 0
%240 = getelementptr inbounds [251 x i8], [251 x i8]* %12, i64 0, i64 0
%241 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %235, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %239, i8* %240)
%242 = load i32, i32* %14
%243 = getelementptr inbounds [300 x i8], [300 x i8]* %20, i64 0, i64 0
%244 = call i32 @write(i32 %242, i8* %243, i32 250)
br label %245
245: ; preds = %232, %228, %224
br label %246
246: ; preds = %245
%247 = load i32, i32* %14
%248 = add nsw i32 %247, 1
store i32 %248, i32* %14
br label %220
249: ; preds = %220
br label %250
250: ; preds = %249, %213
br label %251
251: ; preds = %250, %143
br label %252
252: ; preds = %251, %56
br label %253
253: ; preds = %252, %163, %93
%254 = load i32, i32* %13
%255 = add nsw i32 %254, 1
store i32 %255, i32* %13
br label %52
256: ; preds = %52
br label %41
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
%struct.timeval = type { i32 }
%struct.tm = type { i32, i32, i32, i32, i32, i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@INADDR_ANY = global i32 0
@FD_SETSIZE = global i32 0
@.str.1 = [7 x i8] c"server\00"
@.str.2 = [28 x i8] c"adding client on fd %d: %s\0A\00"
@.str.3 = [6 x i8] c"admin\00"
@.str.4 = [54 x i8] c"* %s has been online!\0A@ %02d/%02d/%02d %02d:%02d:%02d\00"
@FIONREAD = global i32 0
@.str.5 = [26 x i8] c"removing client on fd %d\0A\00"
@.str.6 = [55 x i8] c"* %s has been offline!\0A@ %02d/%02d/%02d %02d:%02d:%02d\00"
@.str.7 = [25 x i8] c"serving client on fd %d\0A\00"
@.str.8 = [7 x i8] c"%s: %s\00"
@str = [15 x i8] c"server waiting\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.sockaddr_in
%3 = alloca %struct.sockaddr_in
%4 = alloca i32
%5 = alloca i32
%6 = alloca [20 x [20 x i8]]
%7 = alloca [251 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca [300 x i8]
%12 = bitcast i32* %1 to i8*
%13 = bitcast %struct.sockaddr_in* %2 to i8*
%14 = bitcast %struct.sockaddr_in* %3 to i8*
%15 = bitcast i32* %4 to i8*
%16 = bitcast i32* %5 to i8*
%17 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %6, i64 0, i64 0, i64 0
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = load i32, i32* @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 2
store i32 %21, i32* %22
%23 = load i32, i32* @INADDR_ANY
%24 = tail call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 1, i32 0
store i32 %24, i32* %25
%26 = tail call i32 @htons(i32 9734)
%27 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %2, i64 0, i32 0
store i32 %26, i32* %27
%28 = bitcast %struct.sockaddr_in* %2 to %struct.sockaddr*
%29 = call i32 @bind(i32 %20, %struct.sockaddr* %28, i32 12)
%30 = call i32 @listen(i32 %20, i32 5)
%31 = call i32 @FD_ZERO(i32* %4)
%32 = call i32 @FD_SET(i32 %20, i32* %4)
%33 = getelementptr inbounds [251 x i8], [251 x i8]* %7, i64 0, i64 0
%34 = bitcast i32* %8 to i8*
%35 = load i32, i32* %4
store i32 %35, i32* %5
%36 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%37 = load i32, i32* @FD_SETSIZE
%38 = call i32 @select(i32 %37, i32* %5, i32* null, i32* null, %struct.timeval* null)
%39 = icmp slt i32 %38, 1
br i1 %39, label %50, label %40
40: ; preds = %0
%41 = getelementptr inbounds [300 x i8], [300 x i8]* %11, i64 0, i64 0
%42 = bitcast i32* %10 to i8*
%43 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%44 = bitcast i32* %9 to i8*
%45 = zext i32 %20 to i64
br label %46
46: ; preds = %40, %179
%47 = phi i32 [ undef, %40 ], [ %180, %179 ]
%48 = load i32, i32* @FD_SETSIZE
%49 = icmp sgt i32 %48, 0
br i1 %49, label %53, label %179
50: ; preds = %179, %0
%51 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %46, %173
%54 = phi i64 [ %176, %173 ], [ 0, %46 ]
%55 = phi i32 [ %175, %173 ], [ %47, %46 ]
%56 = trunc i64 %54 to i32
%57 = call i64 @FD_ISSET(i32 %56, i32* %5)
%58 = icmp eq i64 %57, 0
br i1 %58, label %59, label %61
59: ; preds = %53
%60 = load i32, i32* @FD_SETSIZE
br label %173
61: ; preds = %53
%62 = icmp eq i64 %54, %45
br i1 %62, label %63, label %105
63: ; preds = %61
store i32 12, i32* %1
%64 = call i32 @accept(i32 %20, %struct.sockaddr* %43, i32* %1)
%65 = call i32 @FD_SET(i32 %64, i32* %4)
%66 = sext i32 %64 to i64
%67 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %6, i64 0, i64 %66, i64 0
%68 = call i32 @memset(i8* %67, i32 0, i32 20)
%69 = call i32 @read(i32 %64, i8* %67, i32 250)
%70 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i32 %64, i8* %67)
%71 = call i64 @strcmp(i8* %67, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%72 = icmp ne i64 %71, 0
%73 = load i32, i32* @FD_SETSIZE
%74 = icmp sgt i32 %73, 0
%75 = select i1 %72, i1 %74, i1 false
br i1 %75, label %76, label %173
76: ; preds = %63, %101
%77 = phi i32 [ %102, %101 ], [ 0, %63 ]
%78 = call i64 @FD_ISSET(i32 %77, i32* %4)
%79 = icmp eq i64 %78, 0
%80 = icmp eq i32 %77, %20
%81 = select i1 %79, i1 true, i1 %80
br i1 %81, label %101, label %82
82: ; preds = %76
%83 = call i32 @time(i32* %9)
%84 = call %struct.tm* @localtime(i32* %9)
%85 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 0
%86 = load i32, i32* %85
%87 = add nsw i32 %86, -100
%88 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 1
%89 = load i32, i32* %88
%90 = add nsw i32 %89, 1
%91 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 2
%92 = load i32, i32* %91
%93 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 3
%94 = load i32, i32* %93
%95 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 4
%96 = load i32, i32* %95
%97 = getelementptr inbounds %struct.tm, %struct.tm* %84, i64 0, i32 5
%98 = load i32, i32* %97
%99 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.4, i64 0, i64 0), i8* %67, i32 %87, i32 %90, i32 %92, i32 %94, i32 %96, i32 %98)
%100 = call i32 @write(i32 %77, i8* %33, i32 250)
br label %101
101: ; preds = %76, %82
%102 = add nuw nsw i32 %77, 1
%103 = load i32, i32* @FD_SETSIZE
%104 = icmp slt i32 %102, %103
br i1 %104, label %76, label %173
105: ; preds = %61
%106 = load i32, i32* @FIONREAD
%107 = call i32 @ioctl(i32 %56, i32 %106, i32* %8)
%108 = load i32, i32* %8
%109 = icmp eq i32 %108, 0
br i1 %109, label %110, label %152
110: ; preds = %105
%111 = call i32 @close(i32 %56)
%112 = call i32 @FD_CLR(i32 %56, i32* %4)
%113 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.5, i64 0, i64 0), i32 %56)
%114 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %6, i64 0, i64 %54, i64 0
%115 = call i64 @strcmp(i8* %114, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0))
%116 = icmp ne i64 %115, 0
%117 = load i32, i32* @FD_SETSIZE
%118 = icmp sgt i32 %117, 0
%119 = select i1 %116, i1 %118, i1 false
br i1 %119, label %120, label %173
120: ; preds = %110
%121 = sext i32 %55 to i64
%122 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %6, i64 0, i64 %121, i64 0
br label %123
123: ; preds = %120, %148
%124 = phi i32 [ 0, %120 ], [ %149, %148 ]
%125 = call i64 @FD_ISSET(i32 %124, i32* %4)
%126 = icmp eq i64 %125, 0
%127 = icmp eq i32 %124, %20
%128 = select i1 %126, i1 true, i1 %127
br i1 %128, label %148, label %129
129: ; preds = %123
%130 = call i32 @time(i32* %10)
%131 = call %struct.tm* @localtime(i32* %10)
%132 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 0
%133 = load i32, i32* %132
%134 = add nsw i32 %133, -100
%135 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 1
%136 = load i32, i32* %135
%137 = add nsw i32 %136, 1
%138 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 2
%139 = load i32, i32* %138
%140 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 3
%141 = load i32, i32* %140
%142 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 4
%143 = load i32, i32* %142
%144 = getelementptr inbounds %struct.tm, %struct.tm* %131, i64 0, i32 5
%145 = load i32, i32* %144
%146 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %33, i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.6, i64 0, i64 0), i8* %122, i32 %134, i32 %137, i32 %139, i32 %141, i32 %143, i32 %145)
%147 = call i32 @write(i32 %124, i8* %33, i32 250)
br label %148
148: ; preds = %123, %129
%149 = add nuw nsw i32 %124, 1
%150 = load i32, i32* @FD_SETSIZE
%151 = icmp slt i32 %149, %150
br i1 %151, label %123, label %173
152: ; preds = %105
%153 = call i32 @memset(i8* %33, i32 0, i32 251)
%154 = call i32 @read(i32 %56, i8* %33, i32 250)
%155 = load i32, i32* @FD_SETSIZE
%156 = icmp sgt i32 %155, 0
br i1 %156, label %157, label %173
157: ; preds = %152
%158 = getelementptr inbounds [20 x [20 x i8]], [20 x [20 x i8]]* %6, i64 0, i64 %54, i64 0
br label %159
159: ; preds = %157, %169
%160 = phi i32 [ 0, %157 ], [ %170, %169 ]
%161 = call i64 @FD_ISSET(i32 %160, i32* %4)
%162 = icmp eq i64 %161, 0
%163 = icmp eq i32 %160, %20
%164 = select i1 %162, i1 true, i1 %163
br i1 %164, label %169, label %165
165: ; preds = %159
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i32 %160)
%167 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %41, i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* %158, i8* %33)
%168 = call i32 @write(i32 %160, i8* %41, i32 250)
br label %169
169: ; preds = %159, %165
%170 = add nuw nsw i32 %160, 1
%171 = load i32, i32* @FD_SETSIZE
%172 = icmp slt i32 %170, %171
br i1 %172, label %159, label %173
173: ; preds = %169, %148, %101, %59, %152, %110, %63
%174 = phi i32 [ %73, %63 ], [ %117, %110 ], [ %60, %59 ], [ %155, %152 ], [ %103, %101 ], [ %150, %148 ], [ %171, %169 ]
%175 = phi i32 [ %64, %63 ], [ %55, %110 ], [ %55, %59 ], [ %55, %152 ], [ %64, %101 ], [ %55, %148 ], [ %55, %169 ]
%176 = add nuw nsw i64 %54, 1
%177 = sext i32 %174 to i64
%178 = icmp slt i64 %176, %177
br i1 %178, label %53, label %179
179: ; preds = %173, %46
%180 = phi i32 [ %47, %46 ], [ %175, %173 ]
%181 = load i32, i32* %4
store i32 %181, i32* %5
%182 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%183 = load i32, i32* @FD_SETSIZE
%184 = call i32 @select(i32 %183, i32* %5, i32* null, i32* null, %struct.timeval* null)
%185 = icmp slt i32 %184, 1
br i1 %185, label %50, label %46
}