#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */
typedef struct TYPE_2__ TYPE_1__;

/* Type definitions */
struct timeval {
  int tv_usec;
  scalar_t__ tv_sec;
};
struct TYPE_2__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int sin_zero;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ clients;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ FD_ISSET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ MSG_NOSIGNAL;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
scalar_t__ asprintf(char **, char *, char *, char *, int);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int /*<<< orphan*/ memset(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
scalar_t__ select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                  int /*<<< orphan*/ *, struct timeval *);
int /*<<< orphan*/ send(int, char *, int, int /*<<< orphan*/);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(void) {
  int res = 0;
  int sockfd, new_fd, numbytes, highest = 0, i;
  int clients[5];
  char buffer[100];
  struct sockaddr_in my_addr, their_addr;
  socklen_t sin_size;
  struct timeval tv;
  fd_set readfds;
  if ((sockfd = socket(AF_INET, SOCK_STREAM, 0)) < 0)
    do {
      res = -1;
      char *bufferr;
      if (0 < asprintf(&bufferr, "%s,%s,%d,", "socket",
                       "/scratch/repos/new/home/jordi_armengol_estape/"
                       "c-scraper/outputs/2022-01-22/02-19-57/repos/manuel-m/"
                       "htmlcc/refs/heads/master/src/attic/test_select.c",
                       36)) {
        perror(bufferr);
        free(bufferr);
      }
      goto end;
    } while (0);
  ;
  my_addr.sin_family = AF_INET;
  my_addr.sin_port = htons(9999);
  my_addr.sin_addr.s_addr = INADDR_ANY;
  memset(&(my_addr.sin_zero), 0, 8);
  if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) < 0)
    do {
      res = -1;
      char *bufferr;
      if (0 < asprintf(&bufferr, "%s,%s,%d,", "socket",
                       "/scratch/repos/new/home/jordi_armengol_estape/"
                       "c-scraper/outputs/2022-01-22/02-19-57/repos/manuel-m/"
                       "htmlcc/refs/heads/master/src/attic/test_select.c",
                       42)) {
        perror(bufferr);
        free(bufferr);
      }
      goto end;
    } while (0);
  ;
  if (listen(sockfd, 5) < 0)
    do {
      res = -1;
      char *bufferr;
      if (0 < asprintf(&bufferr, "%s,%s,%d,", "listen",
                       "/scratch/repos/new/home/jordi_armengol_estape/"
                       "c-scraper/outputs/2022-01-22/02-19-57/repos/manuel-m/"
                       "htmlcc/refs/heads/master/src/attic/test_select.c",
                       43)) {
        perror(bufferr);
        free(bufferr);
      }
      goto end;
    } while (0);
  ;
  memset(clients, 0, sizeof(clients));
  highest = sockfd;
  do {
    sin_size = sizeof(struct sockaddr_in);
    tv.tv_sec = 0;
    tv.tv_usec = 250000;
    FD_ZERO(&readfds);
    for (i = 0; i < 5; i++)
      if (clients[i])
        FD_SET(clients[i], &readfds);
    FD_SET(sockfd, &readfds);
    if (select(highest + 1, &readfds, NULL, NULL, &tv) >= 0) {
      if (FD_ISSET(sockfd, &readfds)) {
        if ((new_fd = accept(sockfd, (struct sockaddr *)&their_addr,
                             &sin_size)) < 0) {
          perror("accept");
          continue;
        }
        for (i = 0; i < 5; i++) {
          if (clients[i] == 0) {
            clients[i] = new_fd;
            break;
          }
        }
        if (i != 5) {
          if (new_fd > highest) {
            highest = clients[i];
          }
          printf("Connexion received from %s (slot %i)\n",
                 inet_ntoa(their_addr.sin_addr), i);
          send(new_fd, "Welcome !", sizeof("Welcome !"), MSG_NOSIGNAL);
        } else {
          send(new_fd, "No room for you !\n", sizeof("No room for you !\n"),
               MSG_NOSIGNAL);
          close(new_fd);
        }
      }
      for (i = 0; i < 5; i++) {
        if (FD_ISSET(clients[i], &readfds)) {
          if ((numbytes = recv(clients[i], buffer, 100, 0)) <= 0) {
            printf("Connexion lost from slot %i\n", i);
            close(clients[i]);
            clients[i] = 0;
          } else {
            buffer[numbytes] = '\0';
            printf("Received from slot %i : %s", i, buffer);
          }
        }
      }
    } else {
      perror("select");
      continue;
    }
  } while (1);
end:
  return (res);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x100,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x18(%rbp)
mov    0x2da1(%rip),%rax
mov    (%rax),%edi
mov    0x2d80(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
mov    %eax,-0xc(%rbp)
cmp    $0x0,%eax
jge    12c3 <main+0xa3>
jmp    126a <main+0x4a>
movl   $0xffffffff,-0x8(%rbp)
lea    -0xe8(%rbp),%rdi
lea    0xd81(%rip),%rsi
lea    0xd84(%rip),%rdx
lea    0xd84(%rip),%rcx
mov    $0x24,%r8d
call   10f0 <asprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    12be <main+0x9e>
mov    -0xe8(%rbp),%rdi
call   1110 <perror@plt>
mov    -0xe8(%rbp),%rdi
call   1030 <free@plt>
jmp    16c1 <main+0x4a1>
mov    0x2d1e(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xa4(%rbp)
mov    $0x270f,%edi
call   1070 <htons@plt>
mov    %eax,-0xa8(%rbp)
mov    0x2cf7(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xac(%rbp)
lea    -0xb0(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    -0xc(%rbp),%edi
lea    -0xb0(%rbp),%rsi
mov    $0x4,%edx
call   1100 <bind@plt>
cmp    $0x0,%rax
jge    1380 <main+0x160>
jmp    1327 <main+0x107>
movl   $0xffffffff,-0x8(%rbp)
lea    -0xf0(%rbp),%rdi
lea    0xcc4(%rip),%rsi
lea    0xcc7(%rip),%rdx
lea    0xcc7(%rip),%rcx
mov    $0x2a,%r8d
call   10f0 <asprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    137b <main+0x15b>
mov    -0xf0(%rbp),%rdi
call   1110 <perror@plt>
mov    -0xf0(%rbp),%rdi
call   1030 <free@plt>
jmp    16c1 <main+0x4a1>
mov    -0xc(%rbp),%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
cmp    $0x0,%rax
jge    13f5 <main+0x1d5>
jmp    139c <main+0x17c>
movl   $0xffffffff,-0x8(%rbp)
lea    -0xf8(%rbp),%rdi
lea    0xc4f(%rip),%rsi
lea    0xced(%rip),%rdx
lea    0xc52(%rip),%rcx
mov    $0x2b,%r8d
call   10f0 <asprintf@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jge    13f0 <main+0x1d0>
mov    -0xf8(%rbp),%rdi
call   1110 <perror@plt>
mov    -0xf8(%rbp),%rdi
call   1030 <free@plt>
jmp    16c1 <main+0x4a1>
lea    -0x30(%rbp),%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10a0 <memset@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x10,-0xc4(%rbp)
movq   $0x0,-0xd0(%rbp)
movl   $0x3d090,-0xd8(%rbp)
lea    -0xdc(%rbp),%rdi
call   10c0 <FD_ZERO@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    147d <main+0x25d>
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
je     146a <main+0x24a>
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0xdc(%rbp),%rsi
call   1130 <FD_SET@plt>
jmp    146f <main+0x24f>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    143d <main+0x21d>
mov    -0xc(%rbp),%edi
lea    -0xdc(%rbp),%rsi
call   1130 <FD_SET@plt>
mov    -0x18(%rbp),%edi
add    $0x1,%edi
lea    -0xdc(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%ecx
lea    -0xd8(%rbp),%r8
mov    %rcx,%rdx
call   10d0 <select@plt>
cmp    $0x0,%rax
jl     1697 <main+0x477>
mov    -0xc(%rbp),%edi
lea    -0xdc(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     15d1 <main+0x3b1>
mov    -0xc(%rbp),%edi
lea    -0xc0(%rbp),%rsi
lea    -0xc4(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x10(%rbp)
cmp    $0x0,%eax
jge    1502 <main+0x2e2>
lea    0xbb4(%rip),%rdi
call   1110 <perror@plt>
jmp    16ad <main+0x48d>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1545 <main+0x325>
movslq -0x1c(%rbp),%rax
cmpl   $0x0,-0x30(%rbp,%rax,4)
jne    1532 <main+0x312>
mov    -0x10(%rbp),%ecx
movslq -0x1c(%rbp),%rax
mov    %ecx,-0x30(%rbp,%rax,4)
jmp    1545 <main+0x325>
jmp    1537 <main+0x317>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1509 <main+0x2e9>
cmpl   $0x5,-0x1c(%rbp)
je     15a7 <main+0x387>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    1566 <main+0x346>
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x18(%rbp)
mov    -0xbc(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,%rsi
mov    -0x1c(%rbp),%edx
lea    0xb35(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
mov    -0x10(%rbp),%edi
mov    0x2a39(%rip),%rax
mov    (%rax),%ecx
lea    0xb41(%rip),%rsi
mov    $0xa,%edx
call   1080 <send@plt>
jmp    15cc <main+0x3ac>
mov    -0x10(%rbp),%edi
mov    0x2a17(%rip),%rax
mov    (%rax),%ecx
lea    0xb29(%rip),%rsi
mov    $0x13,%edx
call   1080 <send@plt>
mov    -0x10(%rbp),%edi
call   10b0 <close@plt>
jmp    15d1 <main+0x3b1>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x5,-0x1c(%rbp)
jge    1692 <main+0x472>
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0xdc(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     167f <main+0x45f>
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0xa0(%rbp),%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
mov    %eax,-0x14(%rbp)
cmp    $0x0,%eax
jg     1656 <main+0x436>
mov    -0x1c(%rbp),%esi
lea    0xac5(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
movslq -0x1c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
call   10b0 <close@plt>
movslq -0x1c(%rbp),%rax
movl   $0x0,-0x30(%rbp,%rax,4)
jmp    167a <main+0x45a>
movslq -0x14(%rbp),%rax
movb   $0x0,-0xa0(%rbp,%rax,1)
mov    -0x1c(%rbp),%esi
lea    -0xa0(%rbp),%rdx
lea    0xaa0(%rip),%rdi
mov    $0x0,%al
call   1090 <printf@plt>
jmp    167f <main+0x45f>
jmp    1684 <main+0x464>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    15d8 <main+0x3b8>
jmp    16a8 <main+0x488>
lea    0xa90(%rip),%rdi
call   1110 <perror@plt>
jmp    16ad <main+0x48d>
jmp    16ad <main+0x48d>
mov    $0x1,%al
test   $0x1,%al
jne    140b <main+0x1eb>
jmp    16bc <main+0x49c>
jmp    16c1 <main+0x4a1>
mov    -0x8(%rbp),%eax
add    $0x100,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xb8,%rsp
mov    0x2db0(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d8f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1140 <socket@plt>
test   %eax,%eax
js     16fd <main+0x4dd>
mov    %eax,%r14d
mov    (%rbx),%eax
mov    %eax,0x34(%rsp)
mov    $0x270f,%edi
call   1070 <htons@plt>
mov    %eax,0x30(%rsp)
mov    0x2d70(%rip),%rax
mov    (%rax),%eax
mov    %eax,0x2c(%rsp)
lea    0x28(%rsp),%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   10a0 <memset@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
mov    $0x4,%edx
call   1100 <bind@plt>
test   %rax,%rax
js     171f <main+0x4ff>
mov    %r14d,%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
test   %rax,%rax
js     1741 <main+0x521>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0x14,%edx
call   10a0 <memset@plt>
lea    0x3c(%rsp),%rbx
lea    0x18(%rsp),%rbp
mov    %r14d,%r12d
jmp    12fd <main+0xdd>
nopw   0x0(%rax,%rax,1)
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xe25(%rip),%rdi
mov    $0x4,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
mov    %r12,%r15
add    $0x1,%r12d
movl   $0x10,0x14(%rsp)
movq   $0x0,0x20(%rsp)
movl   $0x3d090,0x18(%rsp)
mov    %rbx,%rdi
call   10c0 <FD_ZERO@plt>
mov    (%rsp),%edi
test   %edi,%edi
je     1334 <main+0x114>
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    0x4(%rsp),%edi
test   %edi,%edi
je     1344 <main+0x124>
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    0x8(%rsp),%edi
test   %edi,%edi
je     1354 <main+0x134>
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    0xc(%rsp),%edi
test   %edi,%edi
je     1364 <main+0x144>
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    0x10(%rsp),%edi
test   %edi,%edi
je     1374 <main+0x154>
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1130 <FD_SET@plt>
mov    %r12d,%edi
mov    %rbx,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
mov    %rbp,%r8
call   10d0 <select@plt>
test   %rax,%rax
js     13d4 <main+0x1b4>
mov    %r14d,%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1473 <main+0x253>
mov    %r14d,%edi
lea    0xa8(%rsp),%rsi
lea    0x14(%rsp),%rdx
call   1120 <accept@plt>
test   %eax,%eax
jns    13f0 <main+0x1d0>
lea    0xce2(%rip),%rdi
call   1110 <perror@plt>
jmp    1304 <main+0xe4>
lea    0xd53(%rip),%rdi
call   1110 <perror@plt>
jmp    1304 <main+0xe4>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %eax,%r13d
cmpl   $0x0,(%rsp)
je     1450 <main+0x230>
cmpl   $0x0,0x4(%rsp)
mov    %r15,%r12
je     1460 <main+0x240>
cmpl   $0x0,0x8(%rsp)
lea    0x40(%rsp),%r15
je     146c <main+0x24c>
cmpl   $0x0,0xc(%rsp)
je     147d <main+0x25d>
cmpl   $0x0,0x10(%rsp)
je     1484 <main+0x264>
mov    0x2ba4(%rip),%rax
mov    (%rax),%ecx
mov    %r13d,%edi
lea    0xcb3(%rip),%rsi
mov    $0x13,%edx
call   1080 <send@plt>
mov    %r13d,%edi
call   10b0 <close@plt>
jmp    14e0 <main+0x2c0>
nopw   0x0(%rax,%rax,1)
xor    %ebp,%ebp
mov    %r15,%r12
lea    0x40(%rsp),%r15
jmp    1490 <main+0x270>
nopl   0x0(%rax)
mov    $0x1,%ebp
lea    0x40(%rsp),%r15
jmp    1490 <main+0x270>
mov    $0x2,%ebp
jmp    1490 <main+0x270>
mov    %r15,%r12
lea    0x40(%rsp),%r15
jmp    14e0 <main+0x2c0>
mov    $0x3,%ebp
jmp    1490 <main+0x270>
mov    $0x4,%ebp
nopl   0x0(%rax)
mov    %ebp,%eax
mov    %r13d,(%rsp,%rax,4)
cmp    %r12d,%r13d
jle    149f <main+0x27f>
mov    (%rsp,%rax,4),%r12d
mov    0xac(%rsp),%edi
call   1060 <inet_ntoa@plt>
lea    0xc01(%rip),%rdi
mov    %rax,%rsi
mov    %ebp,%edx
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x2b03(%rip),%rax
mov    (%rax),%ecx
mov    %r13d,%edi
lea    0xc08(%rip),%rsi
mov    $0xa,%edx
call   1080 <send@plt>
lea    0x18(%rsp),%rbp
mov    (%rsp),%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     154f <main+0x32f>
mov    (%rsp),%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    1530 <main+0x310>
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xbff(%rip),%rdi
xor    %esi,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    154f <main+0x32f>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0xbbf(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    (%rsp),%edi
call   10b0 <close@plt>
movl   $0x0,(%rsp)
mov    0x4(%rsp),%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     15c4 <main+0x3a4>
mov    0x4(%rsp),%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    15a0 <main+0x380>
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xb8e(%rip),%rdi
mov    $0x1,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    15c4 <main+0x3a4>
cs nopw 0x0(%rax,%rax,1)
lea    0xb4f(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x4(%rsp),%edi
call   10b0 <close@plt>
movl   $0x0,0x4(%rsp)
mov    0x8(%rsp),%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1634 <main+0x414>
mov    0x8(%rsp),%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    1610 <main+0x3f0>
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xb19(%rip),%rdi
mov    $0x2,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    1634 <main+0x414>
nopl   0x0(%rax,%rax,1)
lea    0xadf(%rip),%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x8(%rsp),%edi
call   10b0 <close@plt>
movl   $0x0,0x8(%rsp)
mov    0xc(%rsp),%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     16a4 <main+0x484>
mov    0xc(%rsp),%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jle    1680 <main+0x460>
mov    %eax,%eax
movb   $0x0,0x40(%rsp,%rax,1)
lea    0xaa9(%rip),%rdi
mov    $0x3,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1090 <printf@plt>
jmp    16a4 <main+0x484>
nopl   0x0(%rax,%rax,1)
lea    0xa6f(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0xc(%rsp),%edi
call   10b0 <close@plt>
movl   $0x0,0xc(%rsp)
mov    0x10(%rsp),%edi
mov    %rbx,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     12fd <main+0xdd>
mov    0x10(%rsp),%edi
mov    %r15,%rsi
mov    $0x64,%edx
xor    %ecx,%ecx
call   1040 <recv@plt>
test   %eax,%eax
jg     12e0 <main+0xc0>
lea    0xa1b(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1090 <printf@plt>
mov    0x10(%rsp),%edi
call   10b0 <close@plt>
movl   $0x0,0x10(%rsp)
jmp    12fd <main+0xdd>
lea    0x8fc(%rip),%rsi
lea    0x8ff(%rip),%rdx
lea    0x8ff(%rip),%rcx
lea    0x40(%rsp),%rdi
mov    $0x24,%r8d
jmp    1761 <main+0x541>
lea    0x8da(%rip),%rsi
lea    0x8dd(%rip),%rdx
lea    0x8dd(%rip),%rcx
lea    0x40(%rsp),%rdi
mov    $0x2a,%r8d
jmp    1761 <main+0x541>
lea    0x8b8(%rip),%rsi
lea    0x956(%rip),%rdx
lea    0x8bb(%rip),%rcx
lea    0x40(%rsp),%rdi
mov    $0x2b,%r8d
call   10f0 <asprintf@plt>
test   %rax,%rax
jg     1782 <main+0x562>
mov    $0xffffffff,%eax
add    $0xb8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
mov    0x40(%rsp),%rdi
call   1110 <perror@plt>
mov    0x40(%rsp),%rdi
call   1030 <free@plt>
jmp    176b <main+0x54b>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"%s,%s,%d,\00"
@.str.1 = [7 x i8] c"socket\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/manuel-m/htmlcc/refs/heads/master/src/attic/test_select.c\00"
@INADDR_ANY = global i32 0
@.str.3 = [7 x i8] c"listen\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [38 x i8] c"Connexion received from %s (slot %i)\0A\00"
@.str.6 = [10 x i8] c"Welcome !\00"
@MSG_NOSIGNAL = global i32 0
@.str.7 = [19 x i8] c"No room for you !\0A\00"
@.str.8 = [29 x i8] c"Connexion lost from slot %i\0A\00"
@.str.9 = [27 x i8] c"Received from slot %i : %s\00"
@.str.10 = [7 x i8] c"select\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca [5 x i32]
%9 = alloca [100 x i8]
%10 = alloca %struct.sockaddr_in
%11 = alloca %struct.sockaddr_in
%12 = alloca i32
%13 = alloca %struct.timeval
%14 = alloca i32
%15 = alloca i8*
%16 = alloca i8*
%17 = alloca i8*
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %6
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = call i32 @socket(i32 %18, i32 %19, i32 0)
store i32 %20, i32* %3
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %33
22: ; preds = %0
br label %23
23: ; preds = %22
store i32 -1, i32* %2
%24 = call i64 @asprintf(i8** %15, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 36)
%25 = icmp slt i64 0, %24
br i1 %25, label %26, label %31
26: ; preds = %23
%27 = load i8*, i8** %15
%28 = call i32 @perror(i8* %27)
%29 = load i8*, i8** %15
%30 = call i32 @free(i8* %29)
br label %31
31: ; preds = %26, %23
br label %214
32: ; No predecessors!
br label %33
33: ; preds = %32, %0
%34 = load i32, i32* @AF_INET
%35 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 3
store i32 %34, i32* %35
%36 = call i32 @htons(i32 9999)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 2
store i32 %36, i32* %37
%38 = load i32, i32* @INADDR_ANY
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 1
%40 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %39, i32 0, i32 0
store i32 %38, i32* %40
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i32 0, i32 0
%42 = call i32 @memset(i32* %41, i32 0, i32 8)
%43 = load i32, i32* %3
%44 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%45 = call i64 @bind(i32 %43, %struct.sockaddr* %44, i32 4)
%46 = icmp slt i64 %45, 0
br i1 %46, label %47, label %58
47: ; preds = %33
br label %48
48: ; preds = %47
store i32 -1, i32* %2
%49 = call i64 @asprintf(i8** %16, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 42)
%50 = icmp slt i64 0, %49
br i1 %50, label %51, label %56
51: ; preds = %48
%52 = load i8*, i8** %16
%53 = call i32 @perror(i8* %52)
%54 = load i8*, i8** %16
%55 = call i32 @free(i8* %54)
br label %56
56: ; preds = %51, %48
br label %214
57: ; No predecessors!
br label %58
58: ; preds = %57, %33
%59 = load i32, i32* %3
%60 = call i64 @listen(i32 %59, i32 5)
%61 = icmp slt i64 %60, 0
br i1 %61, label %62, label %73
62: ; preds = %58
br label %63
63: ; preds = %62
store i32 -1, i32* %2
%64 = call i64 @asprintf(i8** %17, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 43)
%65 = icmp slt i64 0, %64
br i1 %65, label %66, label %71
66: ; preds = %63
%67 = load i8*, i8** %17
%68 = call i32 @perror(i8* %67)
%69 = load i8*, i8** %17
%70 = call i32 @free(i8* %69)
br label %71
71: ; preds = %66, %63
br label %214
72: ; No predecessors!
br label %73
73: ; preds = %72, %58
%74 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 0
%75 = call i32 @memset(i32* %74, i32 0, i32 20)
%76 = load i32, i32* %3
store i32 %76, i32* %6
br label %77
77: ; preds = %212, %73
store i32 16, i32* %12
%78 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 1
store i64 0, i64* %78
%79 = getelementptr inbounds %struct.timeval, %struct.timeval* %13, i32 0, i32 0
store i32 250000, i32* %79
%80 = call i32 @FD_ZERO(i32* %14)
store i32 0, i32* %7
br label %81
81: ; preds = %97, %77
%82 = load i32, i32* %7
%83 = icmp slt i32 %82, 5
br i1 %83, label %84, label %100
84: ; preds = %81
%85 = load i32, i32* %7
%86 = sext i32 %85 to i64
%87 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %86
%88 = load i32, i32* %87
%89 = icmp ne i32 %88, 0
br i1 %89, label %90, label %96
90: ; preds = %84
%91 = load i32, i32* %7
%92 = sext i32 %91 to i64
%93 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %92
%94 = load i32, i32* %93
%95 = call i32 @FD_SET(i32 %94, i32* %14)
br label %96
96: ; preds = %90, %84
br label %97
97: ; preds = %96
%98 = load i32, i32* %7
%99 = add nsw i32 %98, 1
store i32 %99, i32* %7
br label %81
100: ; preds = %81
%101 = load i32, i32* %3
%102 = call i32 @FD_SET(i32 %101, i32* %14)
%103 = load i32, i32* %6
%104 = add nsw i32 %103, 1
%105 = call i64 @select(i32 %104, i32* %14, i32* null, i32* null, %struct.timeval* %13)
%106 = icmp sge i64 %105, 0
br i1 %106, label %107, label %209
107: ; preds = %100
%108 = load i32, i32* %3
%109 = call i64 @FD_ISSET(i32 %108, i32* %14)
%110 = icmp ne i64 %109, 0
br i1 %110, label %111, label %166
111: ; preds = %107
%112 = load i32, i32* %3
%113 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%114 = call i32 @accept(i32 %112, %struct.sockaddr* %113, i32* %12)
store i32 %114, i32* %4
%115 = icmp slt i32 %114, 0
br i1 %115, label %116, label %118
116: ; preds = %111
%117 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %212
118: ; preds = %111
store i32 0, i32* %7
br label %119
119: ; preds = %134, %118
%120 = load i32, i32* %7
%121 = icmp slt i32 %120, 5
br i1 %121, label %122, label %137
122: ; preds = %119
%123 = load i32, i32* %7
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = icmp eq i32 %126, 0
br i1 %127, label %128, label %133
128: ; preds = %122
%129 = load i32, i32* %4
%130 = load i32, i32* %7
%131 = sext i32 %130 to i64
%132 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %131
store i32 %129, i32* %132
br label %137
133: ; preds = %122
br label %134
134: ; preds = %133
%135 = load i32, i32* %7
%136 = add nsw i32 %135, 1
store i32 %136, i32* %7
br label %119
137: ; preds = %128, %119
%138 = load i32, i32* %7
%139 = icmp ne i32 %138, 5
br i1 %139, label %140, label %159
140: ; preds = %137
%141 = load i32, i32* %4
%142 = load i32, i32* %6
%143 = icmp sgt i32 %141, %142
br i1 %143, label %144, label %149
144: ; preds = %140
%145 = load i32, i32* %7
%146 = sext i32 %145 to i64
%147 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %146
%148 = load i32, i32* %147
store i32 %148, i32* %6
br label %149
149: ; preds = %144, %140
%150 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
%151 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %150, i32 0, i32 0
%152 = load i32, i32* %151
%153 = call i8* @inet_ntoa(i32 %152)
%154 = load i32, i32* %7
%155 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %153, i32 %154)
%156 = load i32, i32* %4
%157 = load i32, i32* @MSG_NOSIGNAL
%158 = call i32 @send(i32 %156, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 10, i32 %157)
br label %165
159: ; preds = %137
%160 = load i32, i32* %4
%161 = load i32, i32* @MSG_NOSIGNAL
%162 = call i32 @send(i32 %160, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 19, i32 %161)
%163 = load i32, i32* %4
%164 = call i32 @close(i32 %163)
br label %165
165: ; preds = %159, %149
br label %166
166: ; preds = %165, %107
store i32 0, i32* %7
br label %167
167: ; preds = %205, %166
%168 = load i32, i32* %7
%169 = icmp slt i32 %168, 5
br i1 %169, label %170, label %208
170: ; preds = %167
%171 = load i32, i32* %7
%172 = sext i32 %171 to i64
%173 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %172
%174 = load i32, i32* %173
%175 = call i64 @FD_ISSET(i32 %174, i32* %14)
%176 = icmp ne i64 %175, 0
br i1 %176, label %177, label %204
177: ; preds = %170
%178 = load i32, i32* %7
%179 = sext i32 %178 to i64
%180 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %179
%181 = load i32, i32* %180
%182 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%183 = call i32 @recv(i32 %181, i8* %182, i32 100, i32 0)
store i32 %183, i32* %5
%184 = icmp sle i32 %183, 0
br i1 %184, label %185, label %196
185: ; preds = %177
%186 = load i32, i32* %7
%187 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 %186)
%188 = load i32, i32* %7
%189 = sext i32 %188 to i64
%190 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %189
%191 = load i32, i32* %190
%192 = call i32 @close(i32 %191)
%193 = load i32, i32* %7
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds [5 x i32], [5 x i32]* %8, i64 0, i64 %194
store i32 0, i32* %195
br label %203
196: ; preds = %177
%197 = load i32, i32* %5
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 %198
store i8 0, i8* %199
%200 = load i32, i32* %7
%201 = getelementptr inbounds [100 x i8], [100 x i8]* %9, i64 0, i64 0
%202 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 %200, i8* %201)
br label %203
203: ; preds = %196, %185
br label %204
204: ; preds = %203, %170
br label %205
205: ; preds = %204
%206 = load i32, i32* %7
%207 = add nsw i32 %206, 1
store i32 %207, i32* %7
br label %167
208: ; preds = %167
br label %211
209: ; preds = %100
%210 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %212
211: ; preds = %208
br label %212
212: ; preds = %211, %209, %116
br i1 true, label %77, label %213
213: ; preds = %212
br label %214
214: ; preds = %213, %71, %56, %31
%215 = load i32, i32* %2
ret i32 %215
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.timeval = type { i32, i64 }
%struct.sockaddr = type { i32 }
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str = [10 x i8] c"%s,%s,%d,\00"
@.str.1 = [7 x i8] c"socket\00"
@.str.2 = [148 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/manuel-m/htmlcc/refs/heads/master/src/attic/test_select.c\00"
@INADDR_ANY = global i32 0
@.str.3 = [7 x i8] c"listen\00"
@.str.4 = [7 x i8] c"accept\00"
@.str.5 = [38 x i8] c"Connexion received from %s (slot %i)\0A\00"
@.str.6 = [10 x i8] c"Welcome !\00"
@MSG_NOSIGNAL = global i32 0
@.str.7 = [19 x i8] c"No room for you !\0A\00"
@.str.8 = [29 x i8] c"Connexion lost from slot %i\0A\00"
@.str.9 = [27 x i8] c"Received from slot %i : %s\00"
@.str.10 = [7 x i8] c"select\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [100 x i8]
%3 = alloca %struct.sockaddr_in
%4 = alloca %struct.sockaddr_in
%5 = alloca i32
%6 = alloca %struct.timeval
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = bitcast [5 x i32]* %1 to i8*
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = bitcast %struct.sockaddr_in* %3 to i8*
%14 = bitcast %struct.sockaddr_in* %4 to i8*
%15 = bitcast i32* %5 to i8*
%16 = bitcast %struct.timeval* %6 to i8*
%17 = bitcast i32* %7 to i8*
%18 = load i32, i32* @AF_INET
%19 = load i32, i32* @SOCK_STREAM
%20 = tail call i32 @socket(i32 %18, i32 %19, i32 0)
%21 = icmp slt i32 %20, 0
br i1 %21, label %22, label %32
22: ; preds = %0
%23 = bitcast i8** %8 to i8*
%24 = call i64 @asprintf(i8** %8, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 36)
%25 = icmp sgt i64 %24, 0
br i1 %25, label %26, label %31
26: ; preds = %22
%27 = load i8*, i8** %8
%28 = call i32 @perror(i8* %27)
%29 = load i8*, i8** %8
%30 = call i32 @free(i8* %29)
br label %31
31: ; preds = %26, %22
br label %239
32: ; preds = %0
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 3
store i32 %33, i32* %34
%35 = tail call i32 @htons(i32 9999)
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 2
store i32 %35, i32* %36
%37 = load i32, i32* @INADDR_ANY
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 1, i32 0
store i32 %37, i32* %38
%39 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %3, i64 0, i32 0
%40 = call i32 @memset(i32* %39, i32 0, i32 8)
%41 = bitcast %struct.sockaddr_in* %3 to %struct.sockaddr*
%42 = call i64 @bind(i32 %20, %struct.sockaddr* %41, i32 4)
%43 = icmp slt i64 %42, 0
br i1 %43, label %44, label %54
44: ; preds = %32
%45 = bitcast i8** %9 to i8*
%46 = call i64 @asprintf(i8** %9, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 42)
%47 = icmp sgt i64 %46, 0
br i1 %47, label %48, label %53
48: ; preds = %44
%49 = load i8*, i8** %9
%50 = call i32 @perror(i8* %49)
%51 = load i8*, i8** %9
%52 = call i32 @free(i8* %51)
br label %53
53: ; preds = %48, %44
br label %239
54: ; preds = %32
%55 = call i64 @listen(i32 %20, i32 5)
%56 = icmp slt i64 %55, 0
br i1 %56, label %57, label %67
57: ; preds = %54
%58 = bitcast i8** %10 to i8*
%59 = call i64 @asprintf(i8** %10, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i32 43)
%60 = icmp sgt i64 %59, 0
br i1 %60, label %61, label %66
61: ; preds = %57
%62 = load i8*, i8** %10
%63 = call i32 @perror(i8* %62)
%64 = load i8*, i8** %10
%65 = call i32 @free(i8* %64)
br label %66
66: ; preds = %61, %57
br label %239
67: ; preds = %54
%68 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%69 = call i32 @memset(i32* %68, i32 0, i32 20)
%70 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 1
%71 = getelementptr inbounds %struct.timeval, %struct.timeval* %6, i64 0, i32 0
%72 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%73 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
%74 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%75 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%76 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%77 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
br label %78
78: ; preds = %235, %67
%79 = phi i32 [ %20, %67 ], [ %155, %235 ]
%80 = add nsw i32 %79, 1
br label %81
81: ; preds = %238, %78
store i32 16, i32* %5
store i64 0, i64* %70
store i32 250000, i32* %71
%82 = call i32 @FD_ZERO(i32* %7)
%83 = load i32, i32* %68
%84 = icmp eq i32 %83, 0
br i1 %84, label %87, label %85
85: ; preds = %81
%86 = call i32 @FD_SET(i32 %83, i32* %7)
br label %87
87: ; preds = %81, %85
%88 = load i32, i32* %74
%89 = icmp eq i32 %88, 0
br i1 %89, label %92, label %90
90: ; preds = %87
%91 = call i32 @FD_SET(i32 %88, i32* %7)
br label %92
92: ; preds = %90, %87
%93 = load i32, i32* %75
%94 = icmp eq i32 %93, 0
br i1 %94, label %97, label %95
95: ; preds = %92
%96 = call i32 @FD_SET(i32 %93, i32* %7)
br label %97
97: ; preds = %95, %92
%98 = load i32, i32* %76
%99 = icmp eq i32 %98, 0
br i1 %99, label %102, label %100
100: ; preds = %97
%101 = call i32 @FD_SET(i32 %98, i32* %7)
br label %102
102: ; preds = %100, %97
%103 = load i32, i32* %77
%104 = icmp eq i32 %103, 0
br i1 %104, label %107, label %105
105: ; preds = %102
%106 = call i32 @FD_SET(i32 %103, i32* %7)
br label %107
107: ; preds = %105, %102
%108 = call i32 @FD_SET(i32 %20, i32* %7)
%109 = call i64 @select(i32 %80, i32* %7, i32* null, i32* null, %struct.timeval* %6)
%110 = icmp sgt i64 %109, -1
br i1 %110, label %111, label %236
111: ; preds = %107
%112 = call i64 @FD_ISSET(i32 %20, i32* %7)
%113 = icmp eq i64 %112, 0
br i1 %113, label %154, label %114
114: ; preds = %111
%115 = call i32 @accept(i32 %20, %struct.sockaddr* %72, i32* %5)
%116 = icmp slt i32 %115, 0
br i1 %116, label %120, label %117
117: ; preds = %114
%118 = load i32, i32* %68
%119 = icmp eq i32 %118, 0
br i1 %119, label %134, label %122
120: ; preds = %114
%121 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
br label %238
122: ; preds = %117
%123 = load i32, i32* %74
%124 = icmp eq i32 %123, 0
br i1 %124, label %134, label %125
125: ; preds = %122
%126 = load i32, i32* %75
%127 = icmp eq i32 %126, 0
br i1 %127, label %134, label %128
128: ; preds = %125
%129 = load i32, i32* %76
%130 = icmp eq i32 %129, 0
br i1 %130, label %134, label %131
131: ; preds = %128
%132 = load i32, i32* %77
%133 = icmp eq i32 %132, 0
br i1 %133, label %134, label %150
134: ; preds = %117, %122, %125, %128, %131
%135 = phi i32 [ 0, %117 ], [ 1, %122 ], [ 2, %125 ], [ 3, %128 ], [ 4, %131 ]
%136 = zext i32 %135 to i64
%137 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %136
store i32 %115, i32* %137
%138 = icmp sgt i32 %115, %79
br i1 %138, label %139, label %143
139: ; preds = %134
%140 = zext i32 %135 to i64
%141 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %140
%142 = load i32, i32* %141
br label %143
143: ; preds = %139, %134
%144 = phi i32 [ %142, %139 ], [ %79, %134 ]
%145 = load i32, i32* %73
%146 = call i8* @inet_ntoa(i32 %145)
%147 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0), i8* %146, i32 %135)
%148 = load i32, i32* @MSG_NOSIGNAL
%149 = call i32 @send(i32 %115, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 10, i32 %148)
br label %154
150: ; preds = %131
%151 = load i32, i32* @MSG_NOSIGNAL
%152 = call i32 @send(i32 %115, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0), i32 19, i32 %151)
%153 = call i32 @close(i32 %115)
br label %154
154: ; preds = %111, %143, %150
%155 = phi i32 [ %144, %143 ], [ %79, %150 ], [ %79, %111 ]
%156 = load i32, i32* %68
%157 = call i64 @FD_ISSET(i32 %156, i32* %7)
%158 = icmp eq i64 %157, 0
br i1 %158, label %171, label %159
159: ; preds = %154
%160 = load i32, i32* %68
%161 = call i32 @recv(i32 %160, i8* %12, i32 100, i32 0)
%162 = icmp slt i32 %161, 1
br i1 %162, label %163, label %167
163: ; preds = %159
%164 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 0)
%165 = load i32, i32* %68
%166 = call i32 @close(i32 %165)
store i32 0, i32* %68
br label %171
167: ; preds = %159
%168 = zext i32 %161 to i64
%169 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %168
store i8 0, i8* %169
%170 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 0, i8* %12)
br label %171
171: ; preds = %154, %167, %163
%172 = load i32, i32* %74
%173 = call i64 @FD_ISSET(i32 %172, i32* %7)
%174 = icmp eq i64 %173, 0
br i1 %174, label %187, label %175
175: ; preds = %171
%176 = load i32, i32* %74
%177 = call i32 @recv(i32 %176, i8* %12, i32 100, i32 0)
%178 = icmp slt i32 %177, 1
br i1 %178, label %183, label %179
179: ; preds = %175
%180 = zext i32 %177 to i64
%181 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %180
store i8 0, i8* %181
%182 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 1, i8* %12)
br label %187
183: ; preds = %175
%184 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 1)
%185 = load i32, i32* %74
%186 = call i32 @close(i32 %185)
store i32 0, i32* %74
br label %187
187: ; preds = %183, %179, %171
%188 = load i32, i32* %75
%189 = call i64 @FD_ISSET(i32 %188, i32* %7)
%190 = icmp eq i64 %189, 0
br i1 %190, label %203, label %191
191: ; preds = %187
%192 = load i32, i32* %75
%193 = call i32 @recv(i32 %192, i8* %12, i32 100, i32 0)
%194 = icmp slt i32 %193, 1
br i1 %194, label %199, label %195
195: ; preds = %191
%196 = zext i32 %193 to i64
%197 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %196
store i8 0, i8* %197
%198 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 2, i8* %12)
br label %203
199: ; preds = %191
%200 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 2)
%201 = load i32, i32* %75
%202 = call i32 @close(i32 %201)
store i32 0, i32* %75
br label %203
203: ; preds = %199, %195, %187
%204 = load i32, i32* %76
%205 = call i64 @FD_ISSET(i32 %204, i32* %7)
%206 = icmp eq i64 %205, 0
br i1 %206, label %219, label %207
207: ; preds = %203
%208 = load i32, i32* %76
%209 = call i32 @recv(i32 %208, i8* %12, i32 100, i32 0)
%210 = icmp slt i32 %209, 1
br i1 %210, label %215, label %211
211: ; preds = %207
%212 = zext i32 %209 to i64
%213 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %212
store i8 0, i8* %213
%214 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 3, i8* %12)
br label %219
215: ; preds = %207
%216 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 3)
%217 = load i32, i32* %76
%218 = call i32 @close(i32 %217)
store i32 0, i32* %76
br label %219
219: ; preds = %215, %211, %203
%220 = load i32, i32* %77
%221 = call i64 @FD_ISSET(i32 %220, i32* %7)
%222 = icmp eq i64 %221, 0
br i1 %222, label %235, label %223
223: ; preds = %219
%224 = load i32, i32* %77
%225 = call i32 @recv(i32 %224, i8* %12, i32 100, i32 0)
%226 = icmp slt i32 %225, 1
br i1 %226, label %231, label %227
227: ; preds = %223
%228 = zext i32 %225 to i64
%229 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 %228
store i8 0, i8* %229
%230 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.9, i64 0, i64 0), i32 4, i8* %12)
br label %235
231: ; preds = %223
%232 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.8, i64 0, i64 0), i32 4)
%233 = load i32, i32* %77
%234 = call i32 @close(i32 %233)
store i32 0, i32* %77
br label %235
235: ; preds = %231, %227, %219
br label %78
236: ; preds = %107
%237 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.10, i64 0, i64 0))
br label %238
238: ; preds = %236, %120
br label %81
239: ; preds = %31, %53, %66
ret i32 -1
}