#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 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*/ opt;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ address;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
scalar_t__ EINTR;
int /*<<< orphan*/ EXIT_FAILURE;
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*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ getpeername(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ htons(int);
char *inet_ntoa(TYPE_1__);
scalar_t__ listen(int, int);
int ntohs(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int read(int, char *, int);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ send(int, char *, scalar_t__, int /*<<< orphan*/);
scalar_t__ setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
scalar_t__ strlen(char *);
int main(int argc, char *argv[]) {
  int opt = 1;
  int master_socket, addrlen, new_socket, client_socket[30],
      max_clients = 30, activity, i, valread, sd;
  int max_sd;
  struct sockaddr_in address;
  char buffer[1025];
  fd_set readfds;
  char *message = "ECHO Daemon v1.0 \r\n";
  for (i = 0; i < max_clients; i++) {
    client_socket[i] = 0;
  }
  if ((master_socket = socket(AF_INET, SOCK_STREAM, 0)) == 0) {
    perror("socket failed");
    exit(EXIT_FAILURE);
  }
  if (setsockopt(master_socket, SOL_SOCKET, SO_REUSEADDR, (char *)&opt,
                 sizeof(opt)) < 0) {
    perror("setsockopt");
    exit(EXIT_FAILURE);
  }
  address.sin_family = AF_INET;
  address.sin_addr.s_addr = INADDR_ANY;
  address.sin_port = htons(3490);
  if (bind(master_socket, (struct sockaddr *)&address, sizeof(address)) < 0) {
    perror("bind failed");
    exit(EXIT_FAILURE);
  }
  printf("Listener on port %d \n", 3490);
  if (listen(master_socket, 3) < 0) {
    perror("listen");
    exit(EXIT_FAILURE);
  }
  addrlen = sizeof(address);
  puts("Waiting for connections ...");
  while (1) {
    FD_ZERO(&readfds);
    FD_SET(master_socket, &readfds);
    max_sd = master_socket;
    for (i = 0; i < max_clients; i++) {
      sd = client_socket[i];
      if (sd > 0)
        FD_SET(sd, &readfds);
      if (sd > max_sd)
        max_sd = sd;
    }
    activity = select(max_sd + 1, &readfds, NULL, NULL, NULL);
    if ((activity < 0) && (errno != EINTR)) {
      printf("select error");
    }
    if (FD_ISSET(master_socket, &readfds)) {
      if ((new_socket = accept(master_socket, (struct sockaddr *)&address,
                               (socklen_t *)&addrlen)) < 0) {
        perror("accept");
        exit(EXIT_FAILURE);
      }
      printf("New connection , socket fd is %d , ip is : %s , port : %d \n",
             new_socket, inet_ntoa(address.sin_addr), ntohs(address.sin_port));
      if (send(new_socket, message, strlen(message), 0) != strlen(message)) {
        perror("send");
      }
      puts("Welcome message sent successfully");
      for (i = 0; i < max_clients; i++) {
        if (client_socket[i] == 0) {
          client_socket[i] = new_socket;
          printf("Adding to list of sockets as %d\n", i);
          break;
        }
      }
    }
    for (i = 0; i < max_clients; i++) {
      sd = client_socket[i];
      if (FD_ISSET(sd, &readfds)) {
        if ((valread = read(sd, buffer, 1024)) == 0) {
          getpeername(sd, (struct sockaddr *)&address, (socklen_t *)&addrlen);
          printf("Host disconnected , ip %s , port %d \n",
                 inet_ntoa(address.sin_addr), ntohs(address.sin_port));
          close(sd);
          client_socket[i] = 0;
        } else {
          buffer[valread] = '\0';
          send(sd, buffer, strlen(buffer), 0);
        }
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x520,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
movl   $0x1e,-0xa4(%rbp)
lea    0xd7f(%rip),%rax
mov    %rax,-0x4e0(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    12ca <main+0x7a>
movslq -0xac(%rbp),%rax
movl   $0x0,-0xa0(%rbp,%rax,4)
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    1292 <main+0x42>
mov    0x2d0f(%rip),%rax
mov    (%rax),%edi
mov    0x2cee(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
mov    %eax,-0x18(%rbp)
cmp    $0x0,%eax
jne    1309 <main+0xb9>
lea    0xd1e(%rip),%rdi
call   1130 <perror@plt>
mov    0x2cb6(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    -0x18(%rbp),%edi
mov    0x2cd5(%rip),%rax
mov    (%rax),%esi
mov    0x2c8c(%rip),%rax
mov    (%rax),%edx
lea    -0x14(%rbp),%rcx
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
cmp    $0x0,%rax
jge    1351 <main+0x101>
lea    0xce4(%rip),%rdi
call   1130 <perror@plt>
mov    0x2c6e(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    0x2c88(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc0(%rbp)
mov    0x2c71(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0xc4(%rbp)
mov    $0xda2,%edi
call   1090 <htons@plt>
mov    %eax,-0xc8(%rbp)
mov    -0x18(%rbp),%edi
lea    -0xc8(%rbp),%rsi
mov    $0xc,%edx
call   1120 <bind@plt>
cmp    $0x0,%rax
jge    13b7 <main+0x167>
lea    0xc89(%rip),%rdi
call   1130 <perror@plt>
mov    0x2c08(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
lea    0xc7b(%rip),%rdi
mov    $0xda2,%esi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x18(%rbp),%edi
mov    $0x3,%esi
call   1100 <listen@plt>
cmp    $0x0,%rax
jge    13fb <main+0x1ab>
lea    0xc67(%rip),%rdi
call   1130 <perror@plt>
mov    0x2bc4(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
movl   $0xc,-0x1c(%rbp)
lea    0xc4d(%rip),%rdi
call   1030 <puts@plt>
lea    -0x4d4(%rbp),%rdi
call   10e0 <FD_ZERO@plt>
mov    -0x18(%rbp),%edi
lea    -0x4d4(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0x18(%rbp),%eax
mov    %eax,-0xb8(%rbp)
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    14b8 <main+0x268>
movslq -0xac(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    %eax,-0xb4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jle    1481 <main+0x231>
mov    -0xb4(%rbp),%edi
lea    -0x4d4(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0xb4(%rbp),%eax
cmp    -0xb8(%rbp),%eax
jle    149f <main+0x24f>
mov    -0xb4(%rbp),%eax
mov    %eax,-0xb8(%rbp)
jmp    14a4 <main+0x254>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    143c <main+0x1ec>
mov    -0xb8(%rbp),%edi
add    $0x1,%edi
lea    -0x4d4(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   10f0 <select@plt>
mov    %eax,-0xa8(%rbp)
cmpl   $0x0,-0xa8(%rbp)
jge    1513 <main+0x2c3>
mov    0x2ace(%rip),%rax
mov    (%rax),%rax
mov    0x2ab4(%rip),%rcx
cmp    (%rcx),%rax
je     1513 <main+0x2c3>
lea    0xb66(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x18(%rbp),%edi
lea    -0x4d4(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1699 <main+0x449>
mov    -0x18(%rbp),%edi
lea    -0xc8(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1140 <accept@plt>
mov    %eax,-0x20(%rbp)
cmp    $0x0,%eax
jge    1565 <main+0x315>
lea    0xb2d(%rip),%rdi
call   1130 <perror@plt>
mov    0x2a5a(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x504(%rbp)
mov    -0xc4(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x500(%rbp)
mov    -0xc8(%rbp),%edi
call   1110 <ntohs@plt>
mov    -0x504(%rbp),%esi
mov    -0x500(%rbp),%rdx
mov    %eax,%ecx
lea    0xae5(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0x20(%rbp),%eax
mov    %eax,-0x4f4(%rbp)
mov    -0x4e0(%rbp),%rax
mov    %rax,-0x4f0(%rbp)
mov    -0x4e0(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x4f4(%rbp),%edi
mov    -0x4f0(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   10a0 <send@plt>
mov    %rax,-0x4e8(%rbp)
mov    -0x4e0(%rbp),%rdi
call   1080 <strlen@plt>
mov    %rax,%rcx
mov    -0x4e8(%rbp),%rax
cmp    %rcx,%rax
je     1614 <main+0x3c4>
lea    0xab3(%rip),%rdi
call   1130 <perror@plt>
lea    0xaac(%rip),%rdi
call   1030 <puts@plt>
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    1694 <main+0x444>
movslq -0xac(%rbp),%rax
cmpl   $0x0,-0xa0(%rbp,%rax,4)
jne    167b <main+0x42b>
mov    -0x20(%rbp),%ecx
movslq -0xac(%rbp),%rax
mov    %ecx,-0xa0(%rbp,%rax,4)
mov    -0xac(%rbp),%esi
lea    0xa7a(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
jmp    1694 <main+0x444>
jmp    1680 <main+0x430>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    162a <main+0x3da>
jmp    1699 <main+0x449>
movl   $0x0,-0xac(%rbp)
mov    -0xac(%rbp),%eax
cmp    -0xa4(%rbp),%eax
jge    17e1 <main+0x591>
movslq -0xac(%rbp),%rax
mov    -0xa0(%rbp,%rax,4),%eax
mov    %eax,-0xb4(%rbp)
mov    -0xb4(%rbp),%edi
lea    -0x4d4(%rbp),%rsi
call   1050 <FD_ISSET@plt>
cmp    $0x0,%rax
je     17c8 <main+0x578>
mov    -0xb4(%rbp),%edi
lea    -0x4d0(%rbp),%rsi
mov    $0x400,%edx
call   10d0 <read@plt>
mov    %eax,-0xb0(%rbp)
cmp    $0x0,%eax
jne    1777 <main+0x527>
mov    -0xb4(%rbp),%edi
lea    -0xc8(%rbp),%rsi
lea    -0x1c(%rbp),%rdx
call   1070 <getpeername@plt>
mov    -0xc4(%rbp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,-0x510(%rbp)
mov    -0xc8(%rbp),%edi
call   1110 <ntohs@plt>
mov    -0x510(%rbp),%rsi
mov    %eax,%edx
lea    0x9bc(%rip),%rdi
mov    $0x0,%al
call   10b0 <printf@plt>
mov    -0xb4(%rbp),%edi
call   10c0 <close@plt>
movslq -0xac(%rbp),%rax
movl   $0x0,-0xa0(%rbp,%rax,4)
jmp    17c3 <main+0x573>
movslq -0xb0(%rbp),%rax
movb   $0x0,-0x4d0(%rbp,%rax,1)
mov    -0xb4(%rbp),%eax
mov    %eax,-0x51c(%rbp)
lea    -0x4d0(%rbp),%rax
mov    %rax,-0x518(%rbp)
lea    -0x4d0(%rbp),%rdi
call   1080 <strlen@plt>
mov    -0x51c(%rbp),%edi
mov    -0x518(%rbp),%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   10a0 <send@plt>
jmp    17c8 <main+0x578>
jmp    17cd <main+0x57d>
mov    -0xac(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xac(%rbp)
jmp    16a3 <main+0x453>
jmp    140e <main+0x1be>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4a8,%rsp
movl   $0x1,0x1c(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x70(%rsp)
movaps %xmm0,0x80(%rsp)
movq   $0x0,0x90(%rsp)
mov    0x2d3b(%rip),%rbx
mov    (%rbx),%edi
mov    0x2d1a(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
test   %eax,%eax
jne    12c7 <main+0x77>
lea    0xd52(%rip),%rdi
jmp    17e4 <main+0x594>
mov    %eax,%ebp
mov    0x2d18(%rip),%rax
mov    (%rax),%esi
mov    0x2ccf(%rip),%rax
mov    (%rax),%edx
lea    0x1c(%rsp),%rcx
mov    %ebp,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
test   %rax,%rax
jns    12fe <main+0xae>
lea    0xd29(%rip),%rdi
jmp    17e4 <main+0x594>
mov    (%rbx),%eax
mov    %eax,0x10(%rsp)
mov    0x2ccd(%rip),%rax
mov    (%rax),%eax
mov    %eax,0xc(%rsp)
mov    $0xda2,%edi
call   1090 <htons@plt>
mov    %eax,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %ebp,%edi
mov    $0xc,%edx
call   1120 <bind@plt>
test   %rax,%rax
jns    1341 <main+0xf1>
lea    0xcf1(%rip),%rdi
jmp    17e4 <main+0x594>
lea    0xcf1(%rip),%rdi
mov    $0xda2,%esi
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %ebp,%edi
mov    $0x3,%esi
call   1100 <listen@plt>
test   %rax,%rax
jns    1371 <main+0x121>
lea    0xce3(%rip),%rdi
jmp    17e4 <main+0x594>
mov    %ebp,0x14(%rsp)
movl   $0xc,0x18(%rsp)
lea    0xcd2(%rip),%rdi
call   1030 <puts@plt>
lea    0x9c(%rsp),%r12
lea    0xa0(%rsp),%r14
lea    0x18(%rsp),%r13
xchg   %ax,%ax
mov    %r12,%rdi
call   10e0 <FD_ZERO@plt>
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
mov    %r12,%rsi
call   1160 <FD_SET@plt>
xor    %ebx,%ebx
jmp    13d1 <main+0x181>
nopw   0x0(%rax,%rax,1)
cmp    %ebp,%r15d
cmovg  %r15d,%ebp
add    $0x1,%rbx
cmp    $0x1e,%rbx
je     13f0 <main+0x1a0>
mov    0x20(%rsp,%rbx,4),%r15d
test   %r15d,%r15d
jle    13c0 <main+0x170>
mov    %r15d,%edi
mov    %r12,%rsi
call   1160 <FD_SET@plt>
jmp    13c0 <main+0x170>
nopl   0x0(%rax,%rax,1)
add    $0x1,%ebp
mov    %ebp,%edi
mov    %r12,%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   10f0 <select@plt>
test   %eax,%eax
jns    1430 <main+0x1e0>
mov    0x2bb1(%rip),%rax
mov    (%rax),%rax
mov    0x2b97(%rip),%rcx
cmp    (%rcx),%rax
je     1430 <main+0x1e0>
lea    0xc4d(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
nopl   0x0(%rax)
mov    0x14(%rsp),%ebx
mov    %ebx,%edi
mov    %r12,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1735 <main+0x4e5>
mov    %ebx,%edi
lea    0x8(%rsp),%rsi
mov    %r13,%rdx
call   1140 <accept@plt>
test   %eax,%eax
js     17dd <main+0x58d>
mov    %eax,%r15d
mov    0xc(%rsp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,%rbx
mov    0x8(%rsp),%edi
call   1110 <ntohs@plt>
lea    0xc09(%rip),%rdi
mov    %r15d,%esi
mov    %rbx,%rdx
mov    %eax,%ecx
xor    %eax,%eax
call   10b0 <printf@plt>
mov    $0x13,%edx
mov    %r15d,%edi
lea    0xb65(%rip),%rsi
xor    %ecx,%ecx
call   10a0 <send@plt>
cmp    $0x13,%rax
jne    1645 <main+0x3f5>
lea    0xc14(%rip),%rdi
call   1030 <puts@plt>
cmpl   $0x0,0x20(%rsp)
je     1620 <main+0x3d0>
cmpl   $0x0,0x24(%rsp)
je     1627 <main+0x3d7>
cmpl   $0x0,0x28(%rsp)
je     1631 <main+0x3e1>
cmpl   $0x0,0x2c(%rsp)
je     163b <main+0x3eb>
cmpl   $0x0,0x30(%rsp)
je     1656 <main+0x406>
cmpl   $0x0,0x34(%rsp)
je     1660 <main+0x410>
cmpl   $0x0,0x38(%rsp)
je     166a <main+0x41a>
cmpl   $0x0,0x3c(%rsp)
je     1674 <main+0x424>
cmpl   $0x0,0x40(%rsp)
je     167e <main+0x42e>
cmpl   $0x0,0x44(%rsp)
je     1688 <main+0x438>
cmpl   $0x0,0x48(%rsp)
je     1692 <main+0x442>
cmpl   $0x0,0x4c(%rsp)
je     169c <main+0x44c>
cmpl   $0x0,0x50(%rsp)
je     16a6 <main+0x456>
cmpl   $0x0,0x54(%rsp)
je     16ad <main+0x45d>
cmpl   $0x0,0x58(%rsp)
je     16b4 <main+0x464>
cmpl   $0x0,0x5c(%rsp)
je     16bb <main+0x46b>
cmpl   $0x0,0x60(%rsp)
je     16c2 <main+0x472>
cmpl   $0x0,0x64(%rsp)
je     16c9 <main+0x479>
cmpl   $0x0,0x68(%rsp)
je     16d0 <main+0x480>
cmpl   $0x0,0x6c(%rsp)
je     16d7 <main+0x487>
cmpl   $0x0,0x70(%rsp)
je     16de <main+0x48e>
cmpl   $0x0,0x74(%rsp)
je     16e5 <main+0x495>
cmpl   $0x0,0x78(%rsp)
je     16ec <main+0x49c>
cmpl   $0x0,0x7c(%rsp)
je     16f3 <main+0x4a3>
cmpl   $0x0,0x80(%rsp)
je     16fa <main+0x4aa>
cmpl   $0x0,0x84(%rsp)
je     1701 <main+0x4b1>
cmpl   $0x0,0x88(%rsp)
je     1708 <main+0x4b8>
cmpl   $0x0,0x8c(%rsp)
je     170f <main+0x4bf>
cmpl   $0x0,0x90(%rsp)
je     1716 <main+0x4c6>
cmpl   $0x0,0x94(%rsp)
jne    1735 <main+0x4e5>
mov    $0x1d,%esi
jmp    1720 <main+0x4d0>
xchg   %ax,%ax
xor    %esi,%esi
jmp    1720 <main+0x4d0>
mov    $0x1,%esi
jmp    1720 <main+0x4d0>
mov    $0x2,%esi
jmp    1720 <main+0x4d0>
mov    $0x3,%esi
jmp    1720 <main+0x4d0>
lea    0xa76(%rip),%rdi
call   1130 <perror@plt>
jmp    14ac <main+0x25c>
mov    $0x4,%esi
jmp    1720 <main+0x4d0>
mov    $0x5,%esi
jmp    1720 <main+0x4d0>
mov    $0x6,%esi
jmp    1720 <main+0x4d0>
mov    $0x7,%esi
jmp    1720 <main+0x4d0>
mov    $0x8,%esi
jmp    1720 <main+0x4d0>
mov    $0x9,%esi
jmp    1720 <main+0x4d0>
mov    $0xa,%esi
jmp    1720 <main+0x4d0>
mov    $0xb,%esi
jmp    1720 <main+0x4d0>
mov    $0xc,%esi
jmp    1720 <main+0x4d0>
mov    $0xd,%esi
jmp    1720 <main+0x4d0>
mov    $0xe,%esi
jmp    1720 <main+0x4d0>
mov    $0xf,%esi
jmp    1720 <main+0x4d0>
mov    $0x10,%esi
jmp    1720 <main+0x4d0>
mov    $0x11,%esi
jmp    1720 <main+0x4d0>
mov    $0x12,%esi
jmp    1720 <main+0x4d0>
mov    $0x13,%esi
jmp    1720 <main+0x4d0>
mov    $0x14,%esi
jmp    1720 <main+0x4d0>
mov    $0x15,%esi
jmp    1720 <main+0x4d0>
mov    $0x16,%esi
jmp    1720 <main+0x4d0>
mov    $0x17,%esi
jmp    1720 <main+0x4d0>
mov    $0x18,%esi
jmp    1720 <main+0x4d0>
mov    $0x19,%esi
jmp    1720 <main+0x4d0>
mov    $0x1a,%esi
jmp    1720 <main+0x4d0>
mov    $0x1b,%esi
jmp    1720 <main+0x4d0>
mov    $0x1c,%esi
nopl   0x0(%rax,%rax,1)
mov    %esi,%eax
mov    %r15d,0x20(%rsp,%rax,4)
lea    0x9bb(%rip),%rdi
xor    %eax,%eax
call   10b0 <printf@plt>
xor    %ebx,%ebx
jmp    176f <main+0x51f>
nopl   0x0(%rax)
cltq
movb   $0x0,0xa0(%rsp,%rax,1)
mov    %r14,%rdi
call   1080 <strlen@plt>
mov    %ebp,%edi
mov    %r14,%rsi
mov    %rax,%rdx
xor    %ecx,%ecx
call   10a0 <send@plt>
add    $0x1,%rbx
cmp    $0x1e,%rbx
je     13a0 <main+0x150>
mov    0x20(%rsp,%rbx,4),%ebp
mov    %ebp,%edi
mov    %r12,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1761 <main+0x511>
mov    %ebp,%edi
mov    %r14,%rsi
mov    $0x400,%edx
call   10d0 <read@plt>
test   %eax,%eax
jne    1740 <main+0x4f0>
mov    %ebp,%edi
lea    0x8(%rsp),%rsi
mov    %r13,%rdx
call   1070 <getpeername@plt>
mov    0xc(%rsp),%edi
call   1060 <inet_ntoa@plt>
mov    %rax,%r15
mov    0x8(%rsp),%edi
call   1110 <ntohs@plt>
lea    0x94a(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10b0 <printf@plt>
mov    %ebp,%edi
call   10c0 <close@plt>
movl   $0x0,0x20(%rsp,%rbx,4)
jmp    1761 <main+0x511>
lea    0x89b(%rip),%rdi
call   1130 <perror@plt>
mov    0x27c8(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"ECHO Daemon v1.0 \0D\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [14 x i8] c"socket failed\00"
@EXIT_FAILURE = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@INADDR_ANY = global i32 0
@.str.3 = [12 x i8] c"bind failed\00"
@.str.4 = [22 x i8] c"Listener on port %d \0A\00"
@.str.5 = [7 x i8] c"listen\00"
@.str.6 = [28 x i8] c"Waiting for connections ...\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.7 = [13 x i8] c"select error\00"
@.str.8 = [7 x i8] c"accept\00"
@.str.9 = [60 x i8] c"New connection , socket fd is %d , ip is : %s , port : %d \0A\00"
@.str.10 = [5 x i8] c"send\00"
@.str.11 = [34 x i8] c"Welcome message sent successfully\00"
@.str.12 = [33 x i8] c"Adding to list of sockets as %d\0A\00"
@.str.13 = [38 x i8] c"Host disconnected , ip %s , port %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca [30 x i32]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca %struct.sockaddr_in
%18 = alloca [1025 x i8]
%19 = alloca i32
%20 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %6
store i32 30, i32* %11
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i8** %20
store i32 0, i32* %13
br label %21
21: ; preds = %29, %2
%22 = load i32, i32* %13
%23 = load i32, i32* %11
%24 = icmp slt i32 %22, %23
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i32, i32* %13
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %27
store i32 0, i32* %28
br label %29
29: ; preds = %25
%30 = load i32, i32* %13
%31 = add nsw i32 %30, 1
store i32 %31, i32* %13
br label %21
32: ; preds = %21
%33 = load i32, i32* @AF_INET
%34 = load i32, i32* @SOCK_STREAM
%35 = call i32 @socket(i32 %33, i32 %34, i32 0)
store i32 %35, i32* %7
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %41
37: ; preds = %32
%38 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%39 = load i32, i32* @EXIT_FAILURE
%40 = call i32 @exit(i32 %39)
unreachable
41: ; preds = %32
%42 = load i32, i32* %7
%43 = load i32, i32* @SOL_SOCKET
%44 = load i32, i32* @SO_REUSEADDR
%45 = bitcast i32* %6 to i8*
%46 = call i64 @setsockopt(i32 %42, i32 %43, i32 %44, i8* %45, i32 4)
%47 = icmp slt i64 %46, 0
br i1 %47, label %48, label %52
48: ; preds = %41
%49 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%50 = load i32, i32* @EXIT_FAILURE
%51 = call i32 @exit(i32 %50)
unreachable
52: ; preds = %41
%53 = load i32, i32* @AF_INET
%54 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 2
store i32 %53, i32* %54
%55 = load i32, i32* @INADDR_ANY
%56 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 1
%57 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %56, i32 0, i32 0
store i32 %55, i32* %57
%58 = call i32 @htons(i32 3490)
%59 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 0
store i32 %58, i32* %59
%60 = load i32, i32* %7
%61 = bitcast %struct.sockaddr_in* %17 to %struct.sockaddr*
%62 = call i64 @bind(i32 %60, %struct.sockaddr* %61, i32 12)
%63 = icmp slt i64 %62, 0
br i1 %63, label %64, label %68
64: ; preds = %52
%65 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%66 = load i32, i32* @EXIT_FAILURE
%67 = call i32 @exit(i32 %66)
unreachable
68: ; preds = %52
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 3490)
%70 = load i32, i32* %7
%71 = call i64 @listen(i32 %70, i32 3)
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %77
73: ; preds = %68
%74 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%75 = load i32, i32* @EXIT_FAILURE
%76 = call i32 @exit(i32 %75)
unreachable
77: ; preds = %68
store i32 12, i32* %8
%78 = call i32 @puts(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
br label %79
79: ; preds = %77, %226
%80 = call i32 @FD_ZERO(i32* %19)
%81 = load i32, i32* %7
%82 = call i32 @FD_SET(i32 %81, i32* %19)
%83 = load i32, i32* %7
store i32 %83, i32* %16
store i32 0, i32* %13
br label %84
84: ; preds = %105, %79
%85 = load i32, i32* %13
%86 = load i32, i32* %11
%87 = icmp slt i32 %85, %86
br i1 %87, label %88, label %108
88: ; preds = %84
%89 = load i32, i32* %13
%90 = sext i32 %89 to i64
%91 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %90
%92 = load i32, i32* %91
store i32 %92, i32* %15
%93 = load i32, i32* %15
%94 = icmp sgt i32 %93, 0
br i1 %94, label %95, label %98
95: ; preds = %88
%96 = load i32, i32* %15
%97 = call i32 @FD_SET(i32 %96, i32* %19)
br label %98
98: ; preds = %95, %88
%99 = load i32, i32* %15
%100 = load i32, i32* %16
%101 = icmp sgt i32 %99, %100
br i1 %101, label %102, label %104
102: ; preds = %98
%103 = load i32, i32* %15
store i32 %103, i32* %16
br label %104
104: ; preds = %102, %98
br label %105
105: ; preds = %104
%106 = load i32, i32* %13
%107 = add nsw i32 %106, 1
store i32 %107, i32* %13
br label %84
108: ; preds = %84
%109 = load i32, i32* %16
%110 = add nsw i32 %109, 1
%111 = call i32 @select(i32 %110, i32* %19, i32* null, i32* null, i32* null)
store i32 %111, i32* %12
%112 = load i32, i32* %12
%113 = icmp slt i32 %112, 0
br i1 %113, label %114, label %120
114: ; preds = %108
%115 = load i64, i64* @errno
%116 = load i64, i64* @EINTR
%117 = icmp ne i64 %115, %116
br i1 %117, label %118, label %120
118: ; preds = %114
%119 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %120
120: ; preds = %118, %114, %108
%121 = load i32, i32* %7
%122 = call i64 @FD_ISSET(i32 %121, i32* %19)
%123 = icmp ne i64 %122, 0
br i1 %123, label %124, label %177
124: ; preds = %120
%125 = load i32, i32* %7
%126 = bitcast %struct.sockaddr_in* %17 to %struct.sockaddr*
%127 = call i32 @accept(i32 %125, %struct.sockaddr* %126, i32* %8)
store i32 %127, i32* %9
%128 = icmp slt i32 %127, 0
br i1 %128, label %129, label %133
129: ; preds = %124
%130 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%131 = load i32, i32* @EXIT_FAILURE
%132 = call i32 @exit(i32 %131)
unreachable
133: ; preds = %124
%134 = load i32, i32* %9
%135 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 1
%136 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %135, i32 0, i32 0
%137 = load i32, i32* %136
%138 = call i8* @inet_ntoa(i32 %137)
%139 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 0
%140 = load i32, i32* %139
%141 = call i32 @ntohs(i32 %140)
%142 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 %134, i8* %138, i32 %141)
%143 = load i32, i32* %9
%144 = load i8*, i8** %20
%145 = load i8*, i8** %20
%146 = call i64 @strlen(i8* %145)
%147 = call i64 @send(i32 %143, i8* %144, i64 %146, i32 0)
%148 = load i8*, i8** %20
%149 = call i64 @strlen(i8* %148)
%150 = icmp ne i64 %147, %149
br i1 %150, label %151, label %153
151: ; preds = %133
%152 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %153
153: ; preds = %151, %133
%154 = call i32 @puts(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
store i32 0, i32* %13
br label %155
155: ; preds = %173, %153
%156 = load i32, i32* %13
%157 = load i32, i32* %11
%158 = icmp slt i32 %156, %157
br i1 %158, label %159, label %176
159: ; preds = %155
%160 = load i32, i32* %13
%161 = sext i32 %160 to i64
%162 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %161
%163 = load i32, i32* %162
%164 = icmp eq i32 %163, 0
br i1 %164, label %165, label %172
165: ; preds = %159
%166 = load i32, i32* %9
%167 = load i32, i32* %13
%168 = sext i32 %167 to i64
%169 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %168
store i32 %166, i32* %169
%170 = load i32, i32* %13
%171 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i32 %170)
br label %176
172: ; preds = %159
br label %173
173: ; preds = %172
%174 = load i32, i32* %13
%175 = add nsw i32 %174, 1
store i32 %175, i32* %13
br label %155
176: ; preds = %165, %155
br label %177
177: ; preds = %176, %120
store i32 0, i32* %13
br label %178
178: ; preds = %223, %177
%179 = load i32, i32* %13
%180 = load i32, i32* %11
%181 = icmp slt i32 %179, %180
br i1 %181, label %182, label %226
182: ; preds = %178
%183 = load i32, i32* %13
%184 = sext i32 %183 to i64
%185 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %184
%186 = load i32, i32* %185
store i32 %186, i32* %15
%187 = load i32, i32* %15
%188 = call i64 @FD_ISSET(i32 %187, i32* %19)
%189 = icmp ne i64 %188, 0
br i1 %189, label %190, label %222
190: ; preds = %182
%191 = load i32, i32* %15
%192 = getelementptr inbounds [1025 x i8], [1025 x i8]* %18, i64 0, i64 0
%193 = call i32 @read(i32 %191, i8* %192, i32 1024)
store i32 %193, i32* %14
%194 = icmp eq i32 %193, 0
br i1 %194, label %195, label %212
195: ; preds = %190
%196 = load i32, i32* %15
%197 = bitcast %struct.sockaddr_in* %17 to %struct.sockaddr*
%198 = call i32 @getpeername(i32 %196, %struct.sockaddr* %197, i32* %8)
%199 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 1
%200 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %199, i32 0, i32 0
%201 = load i32, i32* %200
%202 = call i8* @inet_ntoa(i32 %201)
%203 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %17, i32 0, i32 0
%204 = load i32, i32* %203
%205 = call i32 @ntohs(i32 %204)
%206 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %202, i32 %205)
%207 = load i32, i32* %15
%208 = call i32 @close(i32 %207)
%209 = load i32, i32* %13
%210 = sext i32 %209 to i64
%211 = getelementptr inbounds [30 x i32], [30 x i32]* %10, i64 0, i64 %210
store i32 0, i32* %211
br label %221
212: ; preds = %190
%213 = load i32, i32* %14
%214 = sext i32 %213 to i64
%215 = getelementptr inbounds [1025 x i8], [1025 x i8]* %18, i64 0, i64 %214
store i8 0, i8* %215
%216 = load i32, i32* %15
%217 = getelementptr inbounds [1025 x i8], [1025 x i8]* %18, i64 0, i64 0
%218 = getelementptr inbounds [1025 x i8], [1025 x i8]* %18, i64 0, i64 0
%219 = call i64 @strlen(i8* %218)
%220 = call i64 @send(i32 %216, i8* %217, i64 %219, i32 0)
br label %221
221: ; preds = %212, %195
br label %222
222: ; preds = %221, %182
br label %223
223: ; preds = %222
%224 = load i32, i32* %13
%225 = add nsw i32 %224, 1
store i32 %225, i32* %13
br label %178
226: ; preds = %178
br label %79
}

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, %struct.TYPE_2__, i32 }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@.str = [20 x i8] c"ECHO Daemon v1.0 \0D\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [14 x i8] c"socket failed\00"
@EXIT_FAILURE = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.2 = [11 x i8] c"setsockopt\00"
@INADDR_ANY = global i32 0
@.str.3 = [12 x i8] c"bind failed\00"
@.str.4 = [22 x i8] c"Listener on port %d \0A\00"
@.str.5 = [7 x i8] c"listen\00"
@.str.6 = [28 x i8] c"Waiting for connections ...\00"
@errno = global i64 0
@EINTR = global i64 0
@.str.7 = [13 x i8] c"select error\00"
@.str.8 = [7 x i8] c"accept\00"
@.str.9 = [60 x i8] c"New connection , socket fd is %d , ip is : %s , port : %d \0A\00"
@.str.10 = [5 x i8] c"send\00"
@.str.11 = [34 x i8] c"Welcome message sent successfully\00"
@.str.12 = [33 x i8] c"Adding to list of sockets as %d\0A\00"
@.str.13 = [38 x i8] c"Host disconnected , ip %s , port %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [30 x i32]
%6 = bitcast [30 x i32]* %5 to i8*
%7 = alloca %struct.sockaddr_in
%8 = alloca [1025 x i8]
%9 = alloca i32
%10 = bitcast i32* %3 to i8*
store i32 1, i32* %3
%11 = bitcast i32* %4 to i8*
%12 = bitcast %struct.sockaddr_in* %7 to i8*
%13 = getelementptr inbounds [1025 x i8], [1025 x i8]* %8, i64 0, i64 0
%14 = bitcast i32* %9 to i8*
%15 = load i32, i32* @AF_INET
%16 = load i32, i32* @SOCK_STREAM
%17 = tail call i32 @socket(i32 %15, i32 %16, i32 0)
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %2
%20 = tail call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%21 = load i32, i32* @EXIT_FAILURE
%22 = tail call i32 @exit(i32 %21)
unreachable
23: ; preds = %2
%24 = load i32, i32* @SOL_SOCKET
%25 = load i32, i32* @SO_REUSEADDR
%26 = call i64 @setsockopt(i32 %17, i32 %24, i32 %25, i8* %10, i32 4)
%27 = icmp slt i64 %26, 0
br i1 %27, label %28, label %32
28: ; preds = %23
%29 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
%30 = load i32, i32* @EXIT_FAILURE
%31 = call i32 @exit(i32 %30)
unreachable
32: ; preds = %23
%33 = load i32, i32* @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 2
store i32 %33, i32* %34
%35 = load i32, i32* @INADDR_ANY
%36 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 1, i32 0
store i32 %35, i32* %36
%37 = call i32 @htons(i32 3490)
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %7, i64 0, i32 0
store i32 %37, i32* %38
%39 = bitcast %struct.sockaddr_in* %7 to %struct.sockaddr*
%40 = call i64 @bind(i32 %17, %struct.sockaddr* %39, i32 12)
%41 = icmp slt i64 %40, 0
br i1 %41, label %42, label %46
42: ; preds = %32
%43 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%44 = load i32, i32* @EXIT_FAILURE
%45 = call i32 @exit(i32 %44)
unreachable
46: ; preds = %32
%47 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 3490)
%48 = call i64 @listen(i32 %17, i32 3)
%49 = icmp slt i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %46
%51 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.5, i64 0, i64 0))
%52 = load i32, i32* @EXIT_FAILURE
%53 = call i32 @exit(i32 %52)
unreachable
54: ; preds = %46
store i32 12, i32* %4
%55 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0))
%56 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 0
%57 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 1
%58 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 2
%59 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 3
%60 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 4
%61 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 5
%62 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 6
%63 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 7
%64 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 8
%65 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 9
%66 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 10
%67 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 11
%68 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 12
%69 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 13
%70 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 14
%71 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 15
%72 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 16
%73 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 17
%74 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 18
%75 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 19
%76 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 20
%77 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 21
%78 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 22
%79 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 23
%80 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 24
%81 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 25
%82 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 26
%83 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 27
%84 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 28
%85 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 29
br label %86
86: ; preds = %251, %54
%87 = call i32 @FD_ZERO(i32* %9)
%88 = call i32 @FD_SET(i32 %17, i32* %9)
br label %89
89: ; preds = %86, %97
%90 = phi i64 [ 0, %86 ], [ %100, %97 ]
%91 = phi i32 [ %17, %86 ], [ %99, %97 ]
%92 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 %90
%93 = load i32, i32* %92
%94 = icmp sgt i32 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %89
%96 = call i32 @FD_SET(i32 %93, i32* %9)
br label %97
97: ; preds = %95, %89
%98 = icmp sgt i32 %93, %91
%99 = select i1 %98, i32 %93, i32 %91
%100 = add nuw nsw i64 %90, 1
%101 = icmp eq i64 %100, 30
br i1 %101, label %102, label %89
102: ; preds = %97
%103 = add nsw i32 %99, 1
%104 = call i32 @select(i32 %103, i32* %9, i32* null, i32* null, i32* null)
%105 = icmp slt i32 %104, 0
br i1 %105, label %106, label %112
106: ; preds = %102
%107 = load i64, i64* @errno
%108 = load i64, i64* @EINTR
%109 = icmp eq i64 %107, %108
br i1 %109, label %112, label %110
110: ; preds = %106
%111 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.7, i64 0, i64 0))
br label %112
112: ; preds = %110, %106, %102
%113 = call i64 @FD_ISSET(i32 %17, i32* %9)
%114 = icmp eq i64 %113, 0
br i1 %114, label %228, label %115
115: ; preds = %112
%116 = call i32 @accept(i32 %17, %struct.sockaddr* %39, i32* %4)
%117 = icmp slt i32 %116, 0
br i1 %117, label %118, label %122
118: ; preds = %115
%119 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0))
%120 = load i32, i32* @EXIT_FAILURE
%121 = call i32 @exit(i32 %120)
unreachable
122: ; preds = %115
%123 = load i32, i32* %36
%124 = call i8* @inet_ntoa(i32 %123)
%125 = load i32, i32* %38
%126 = call i32 @ntohs(i32 %125)
%127 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str.9, i64 0, i64 0), i32 %116, i8* %124, i32 %126)
%128 = call i64 @send(i32 %116, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0), i64 19, i32 0)
%129 = icmp eq i64 %128, 19
br i1 %129, label %132, label %130
130: ; preds = %122
%131 = call i32 @perror(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.10, i64 0, i64 0))
br label %132
132: ; preds = %130, %122
%133 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.11, i64 0, i64 0))
%134 = load i32, i32* %56
%135 = icmp eq i32 %134, 0
br i1 %135, label %136, label %141
136: ; preds = %225, %222, %219, %216, %213, %210, %207, %204, %201, %198, %195, %192, %189, %186, %183, %180, %177, %174, %171, %168, %165, %162, %159, %156, %153, %150, %147, %144, %141, %132
%137 = phi i32 [ 0, %132 ], [ 1, %141 ], [ 2, %144 ], [ 3, %147 ], [ 4, %150 ], [ 5, %153 ], [ 6, %156 ], [ 7, %159 ], [ 8, %162 ], [ 9, %165 ], [ 10, %168 ], [ 11, %171 ], [ 12, %174 ], [ 13, %177 ], [ 14, %180 ], [ 15, %183 ], [ 16, %186 ], [ 17, %189 ], [ 18, %192 ], [ 19, %195 ], [ 20, %198 ], [ 21, %201 ], [ 22, %204 ], [ 23, %207 ], [ 24, %210 ], [ 25, %213 ], [ 26, %216 ], [ 27, %219 ], [ 28, %222 ], [ 29, %225 ]
%138 = zext i32 %137 to i64
%139 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 %138
store i32 %116, i32* %139
%140 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.12, i64 0, i64 0), i32 %137)
br label %228
141: ; preds = %132
%142 = load i32, i32* %57
%143 = icmp eq i32 %142, 0
br i1 %143, label %136, label %144
144: ; preds = %141
%145 = load i32, i32* %58
%146 = icmp eq i32 %145, 0
br i1 %146, label %136, label %147
147: ; preds = %144
%148 = load i32, i32* %59
%149 = icmp eq i32 %148, 0
br i1 %149, label %136, label %150
150: ; preds = %147
%151 = load i32, i32* %60
%152 = icmp eq i32 %151, 0
br i1 %152, label %136, label %153
153: ; preds = %150
%154 = load i32, i32* %61
%155 = icmp eq i32 %154, 0
br i1 %155, label %136, label %156
156: ; preds = %153
%157 = load i32, i32* %62
%158 = icmp eq i32 %157, 0
br i1 %158, label %136, label %159
159: ; preds = %156
%160 = load i32, i32* %63
%161 = icmp eq i32 %160, 0
br i1 %161, label %136, label %162
162: ; preds = %159
%163 = load i32, i32* %64
%164 = icmp eq i32 %163, 0
br i1 %164, label %136, label %165
165: ; preds = %162
%166 = load i32, i32* %65
%167 = icmp eq i32 %166, 0
br i1 %167, label %136, label %168
168: ; preds = %165
%169 = load i32, i32* %66
%170 = icmp eq i32 %169, 0
br i1 %170, label %136, label %171
171: ; preds = %168
%172 = load i32, i32* %67
%173 = icmp eq i32 %172, 0
br i1 %173, label %136, label %174
174: ; preds = %171
%175 = load i32, i32* %68
%176 = icmp eq i32 %175, 0
br i1 %176, label %136, label %177
177: ; preds = %174
%178 = load i32, i32* %69
%179 = icmp eq i32 %178, 0
br i1 %179, label %136, label %180
180: ; preds = %177
%181 = load i32, i32* %70
%182 = icmp eq i32 %181, 0
br i1 %182, label %136, label %183
183: ; preds = %180
%184 = load i32, i32* %71
%185 = icmp eq i32 %184, 0
br i1 %185, label %136, label %186
186: ; preds = %183
%187 = load i32, i32* %72
%188 = icmp eq i32 %187, 0
br i1 %188, label %136, label %189
189: ; preds = %186
%190 = load i32, i32* %73
%191 = icmp eq i32 %190, 0
br i1 %191, label %136, label %192
192: ; preds = %189
%193 = load i32, i32* %74
%194 = icmp eq i32 %193, 0
br i1 %194, label %136, label %195
195: ; preds = %192
%196 = load i32, i32* %75
%197 = icmp eq i32 %196, 0
br i1 %197, label %136, label %198
198: ; preds = %195
%199 = load i32, i32* %76
%200 = icmp eq i32 %199, 0
br i1 %200, label %136, label %201
201: ; preds = %198
%202 = load i32, i32* %77
%203 = icmp eq i32 %202, 0
br i1 %203, label %136, label %204
204: ; preds = %201
%205 = load i32, i32* %78
%206 = icmp eq i32 %205, 0
br i1 %206, label %136, label %207
207: ; preds = %204
%208 = load i32, i32* %79
%209 = icmp eq i32 %208, 0
br i1 %209, label %136, label %210
210: ; preds = %207
%211 = load i32, i32* %80
%212 = icmp eq i32 %211, 0
br i1 %212, label %136, label %213
213: ; preds = %210
%214 = load i32, i32* %81
%215 = icmp eq i32 %214, 0
br i1 %215, label %136, label %216
216: ; preds = %213
%217 = load i32, i32* %82
%218 = icmp eq i32 %217, 0
br i1 %218, label %136, label %219
219: ; preds = %216
%220 = load i32, i32* %83
%221 = icmp eq i32 %220, 0
br i1 %221, label %136, label %222
222: ; preds = %219
%223 = load i32, i32* %84
%224 = icmp eq i32 %223, 0
br i1 %224, label %136, label %225
225: ; preds = %222
%226 = load i32, i32* %85
%227 = icmp eq i32 %226, 0
br i1 %227, label %136, label %228
228: ; preds = %225, %136, %112
br label %229
229: ; preds = %228, %251
%230 = phi i64 [ %252, %251 ], [ 0, %228 ]
%231 = getelementptr inbounds [30 x i32], [30 x i32]* %5, i64 0, i64 %230
%232 = load i32, i32* %231
%233 = call i64 @FD_ISSET(i32 %232, i32* %9)
%234 = icmp eq i64 %233, 0
br i1 %234, label %251, label %235
235: ; preds = %229
%236 = call i32 @read(i32 %232, i8* %13, i32 1024)
%237 = icmp eq i32 %236, 0
br i1 %237, label %238, label %246
238: ; preds = %235
%239 = call i32 @getpeername(i32 %232, %struct.sockaddr* %39, i32* %4)
%240 = load i32, i32* %36
%241 = call i8* @inet_ntoa(i32 %240)
%242 = load i32, i32* %38
%243 = call i32 @ntohs(i32 %242)
%244 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %241, i32 %243)
%245 = call i32 @close(i32 %232)
store i32 0, i32* %231
br label %251
246: ; preds = %235
%247 = sext i32 %236 to i64
%248 = getelementptr inbounds [1025 x i8], [1025 x i8]* %8, i64 0, i64 %247
store i8 0, i8* %248
%249 = call i64 @strlen(i8* %13)
%250 = call i64 @send(i32 %232, i8* %13, i64 %249, i32 0)
br label %251
251: ; preds = %229, %246, %238
%252 = add nuw nsw i64 %230, 1
%253 = icmp eq i64 %252, 30
br i1 %253, label %86, label %229
}