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

/* Forward declarations */

/* Type definitions */
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  int /*<<< orphan*/ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int socklen_t;
typedef int /*<<< orphan*/ fd_set;
typedef int /*<<< orphan*/ client_address;
typedef int /*<<< orphan*/ buf;
typedef int /*<<< orphan*/ 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*/ MSG_OOB;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int *);
int /*<<< orphan*/ assert(int);
int atoi(char *);
char *basename(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ inet_pton(int /*<<< orphan*/, char const *,
                             int /*<<< orphan*/ *);
int listen(int, int);
int /*<<< orphan*/ memset(char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int recv(int, char *, int, int /*<<< orphan*/);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int i, maxi;
  char buf[1024];
  fd_set read_fds, all_read_fds;
  fd_set exception_fds, all_exception_fds;
  int nready, connectfd[FD_SETSIZE];
  int connfd, sockfd, maxfd;
  struct sockaddr_in client_address;
  socklen_t client_addrlen = sizeof(client_address);
  if (argc <= 2) {
    printf("usage: %s ip_address port_number\n", basename(argv[0]));
    return 1;
  }
  const char *ip = argv[1];
  int port = atoi(argv[2]);
  int ret = 0;
  struct sockaddr_in address;
  bzero(&address, sizeof(address));
  address.sin_family = AF_INET;
  inet_pton(AF_INET, ip, &address.sin_addr);
  address.sin_port = htons(port);
  int listenfd = socket(AF_INET, SOCK_STREAM, 0);
  assert(listenfd >= 0);
  ret = bind(listenfd, (struct sockaddr *)&address, sizeof(address));
  assert(ret != -1);
  ret = listen(listenfd, 5);
  assert(ret != -1);
  maxfd = listenfd;
  maxi = -1;
  for (i = 0; i < FD_SETSIZE; i++)
    connectfd[i] = -1;
  FD_ZERO(&all_read_fds);
  FD_ZERO(&all_exception_fds);
  FD_SET(listenfd, &all_read_fds);
  while (1) {
    read_fds = all_read_fds;
    exception_fds = all_exception_fds;
    memset(buf, 0, sizeof(buf));
    nready = select(maxfd + 1, &read_fds, NULL, &exception_fds, NULL);
    if (FD_ISSET(listenfd, &read_fds)) {
      connfd =
          accept(listenfd, (struct sockaddr *)&client_address, &client_addrlen);
      if (connfd < 0) {
        perror("accept failed\n");
        exit(-1);
      }
      for (i = 0; i < FD_SETSIZE; i++) {
        if (connectfd[i] < 0) {
          connectfd[i] = connfd;
          break;
        }
      }
      if (i == FD_SETSIZE) {
        printf("too many clients..\n");
        exit(-1);
      }
      FD_SET(connfd, &all_read_fds);
      FD_SET(connfd, &all_exception_fds);
      if (connfd > maxfd)
        maxfd = connfd;
      if (i > maxi)
        maxi = i;
      if (--nready <= 0)
        continue;
    }
    for (i = 0; i <= maxi; i++) {
      if ((sockfd = connectfd[i]) < 0)
        continue;
      if (FD_ISSET(sockfd, &read_fds)) {
        ret = recv(sockfd, buf, sizeof(buf) - 1, 0);
        if (ret <= 0)
          break;
        printf("get %d bytes of normal data:%s\n", ret, buf);
        if (--nready <= 0)
          continue;
      }
      for (i = 0; i <= maxi; i++) {
        if ((sockfd = connectfd[i]) < 0)
          continue;
        if (FD_ISSET(sockfd, &read_fds)) {
          ret = recv(sockfd, buf, sizeof(buf) - 1, 0);
          if (ret <= 0)
            break;
          printf("get %d bytes of normal data:%s\n", ret, buf);
        } else if (FD_ISSET(sockfd, &exception_fds)) {
          ret = recv(connfd, buf, sizeof(buf) - 1, MSG_OOB);
          if (ret <= 0)
            break;
          printf("get %d bytes of OOB data: %s", ret, buf);
        }
        FD_CLR(sockfd, &all_read_fds);
        FD_CLR(sockfd, &all_exception_fds);
        close(sockfd);
        if (--nready <= 0)
          break;
      }
    }
    close(listenfd);
    return 0;
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x4a0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2d58(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x440(%rbp)
lea    0xf(,%rax,4),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x498(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x448(%rbp)
movl   $0xc,-0x464(%rbp)
cmpl   $0x2,-0x8(%rbp)
jg     12e6 <main+0x96>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   10a0 <basename@plt>
mov    %rax,%rsi
lea    0xd37(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x468(%rbp)
jmp    187c <main+0x62c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x470(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1130 <atoi@plt>
mov    %eax,-0x474(%rbp)
movl   $0x0,-0x478(%rbp)
lea    -0x488(%rbp),%rdi
mov    $0xc,%esi
call   1110 <bzero@plt>
mov    0x2cbe(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x480(%rbp)
mov    0x2caf(%rip),%rax
mov    (%rax),%edi
mov    -0x470(%rbp),%rsi
lea    -0x488(%rbp),%rdx
add    $0x4,%rdx
call   10b0 <inet_pton@plt>
mov    -0x474(%rbp),%edi
call   1050 <htons@plt>
mov    %eax,-0x488(%rbp)
mov    0x2c7e(%rip),%rax
mov    (%rax),%edi
mov    0x2c5d(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1170 <socket@plt>
mov    %eax,-0x48c(%rbp)
cmpl   $0x0,-0x48c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x48c(%rbp),%edi
lea    -0x488(%rbp),%rsi
mov    $0xc,%edx
call   10f0 <bind@plt>
mov    %eax,-0x478(%rbp)
cmpl   $0xffffffff,-0x478(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x48c(%rbp),%edi
mov    $0x5,%esi
call   10e0 <listen@plt>
mov    %eax,-0x478(%rbp)
cmpl   $0xffffffff,-0x478(%rbp)
setne  %al
and    $0x1,%al
movzbl %al,%edi
call   1090 <assert@plt>
mov    -0x48c(%rbp),%eax
mov    %eax,-0x454(%rbp)
movl   $0xffffffff,-0x18(%rbp)
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2bb3(%rip),%rcx
cmp    (%rcx),%eax
jge    143d <main+0x1ed>
mov    -0x498(%rbp),%rax
movslq -0x14(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    140b <main+0x1bb>
lea    -0x428(%rbp),%rdi
call   10c0 <FD_ZERO@plt>
lea    -0x430(%rbp),%rdi
call   10c0 <FD_ZERO@plt>
mov    -0x48c(%rbp),%edi
lea    -0x428(%rbp),%rsi
call   1160 <FD_SET@plt>
jmp    146c <main+0x21c>
mov    -0x428(%rbp),%eax
mov    %eax,-0x424(%rbp)
mov    -0x430(%rbp),%eax
mov    %eax,-0x42c(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1070 <memset@plt>
mov    -0x454(%rbp),%edi
add    $0x1,%edi
lea    -0x424(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
lea    -0x42c(%rbp),%rcx
mov    %r8,%rdx
call   10d0 <select@plt>
mov    %eax,-0x434(%rbp)
mov    -0x48c(%rbp),%edi
lea    -0x424(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     1619 <main+0x3c9>
mov    -0x48c(%rbp),%edi
lea    -0x460(%rbp),%rsi
lea    -0x464(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x44c(%rbp)
cmpl   $0x0,-0x44c(%rbp)
jge    151f <main+0x2cf>
lea    0xb12(%rip),%rdi
call   1100 <perror@plt>
mov    $0xffffffff,%edi
call   1150 <exit@plt>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
mov    0x2a98(%rip),%rcx
cmp    (%rcx),%eax
jge    1579 <main+0x329>
mov    -0x498(%rbp),%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jge    1566 <main+0x316>
mov    -0x498(%rbp),%rax
mov    -0x44c(%rbp),%edx
movslq -0x14(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
jmp    1579 <main+0x329>
jmp    156b <main+0x31b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1526 <main+0x2d6>
mov    -0x14(%rbp),%eax
mov    0x2a45(%rip),%rcx
cmp    (%rcx),%eax
jne    15a3 <main+0x353>
lea    0xa9f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0xffffffff,%edi
call   1150 <exit@plt>
mov    -0x44c(%rbp),%edi
lea    -0x428(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0x44c(%rbp),%edi
lea    -0x430(%rbp),%rsi
call   1160 <FD_SET@plt>
mov    -0x44c(%rbp),%eax
cmp    -0x454(%rbp),%eax
jle    15e5 <main+0x395>
mov    -0x44c(%rbp),%eax
mov    %eax,-0x454(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    15f7 <main+0x3a7>
mov    -0x14(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x434(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x434(%rbp)
cmp    $0x0,%eax
jg     1614 <main+0x3c4>
jmp    1467 <main+0x217>
jmp    1619 <main+0x3c9>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1860 <main+0x610>
mov    -0x498(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x450(%rbp)
cmp    $0x0,%eax
jge    164e <main+0x3fe>
jmp    1852 <main+0x602>
mov    -0x450(%rbp),%edi
lea    -0x424(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     16d8 <main+0x488>
mov    -0x450(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x478(%rbp)
cmpl   $0x0,-0x478(%rbp)
jg     169b <main+0x44b>
jmp    1860 <main+0x610>
mov    -0x478(%rbp),%esi
lea    -0x420(%rbp),%rdx
lea    0x996(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x434(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x434(%rbp)
cmp    $0x0,%eax
jg     16d3 <main+0x483>
jmp    1852 <main+0x602>
jmp    16d8 <main+0x488>
movl   $0x0,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     184d <main+0x5fd>
mov    -0x498(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    %eax,-0x450(%rbp)
cmp    $0x0,%eax
jge    170d <main+0x4bd>
jmp    183f <main+0x5ef>
mov    -0x450(%rbp),%edi
lea    -0x424(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     177a <main+0x52a>
mov    -0x450(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
mov    %eax,-0x478(%rbp)
cmpl   $0x0,-0x478(%rbp)
jg     175a <main+0x50a>
jmp    184d <main+0x5fd>
mov    -0x478(%rbp),%esi
lea    -0x420(%rbp),%rdx
lea    0x8d7(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    17ee <main+0x59e>
mov    -0x450(%rbp),%edi
lea    -0x42c(%rbp),%rsi
call   1040 <FD_ISSET@plt>
cmp    $0x0,%rax
je     17e9 <main+0x599>
mov    -0x44c(%rbp),%edi
lea    -0x420(%rbp),%rsi
mov    0x2836(%rip),%rax
mov    (%rax),%ecx
mov    $0x3ff,%edx
call   1030 <recv@plt>
mov    %eax,-0x478(%rbp)
cmpl   $0x0,-0x478(%rbp)
jg     17ce <main+0x57e>
jmp    184d <main+0x5fd>
mov    -0x478(%rbp),%esi
lea    -0x420(%rbp),%rdx
lea    0x883(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
jmp    17ee <main+0x59e>
mov    -0x450(%rbp),%edi
lea    -0x428(%rbp),%rsi
call   1140 <FD_CLR@plt>
mov    -0x450(%rbp),%edi
lea    -0x430(%rbp),%rsi
call   1140 <FD_CLR@plt>
mov    -0x450(%rbp),%edi
call   1080 <close@plt>
mov    -0x434(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x434(%rbp)
cmp    $0x0,%eax
jg     183a <main+0x5ea>
jmp    184d <main+0x5fd>
jmp    183f <main+0x5ef>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    16df <main+0x48f>
jmp    1852 <main+0x602>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1620 <main+0x3d0>
mov    -0x48c(%rbp),%edi
call   1080 <close@plt>
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x468(%rbp)
mov    -0x440(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x458,%rsp
mov    %rsp,%rbx
mov    0x2d4a(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r12
lea    0xf(,%rax,4),%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
movl   $0xc,-0x5c(%rbp)
cmp    $0x2,%edi
jg     12c4 <main+0x64>
mov    (%rsi),%rdi
call   10b0 <basename@plt>
lea    0xd50(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1070 <printf@plt>
mov    $0x1,%eax
jmp    166a <main+0x40a>
mov    %rbx,-0x70(%rbp)
mov    0x8(%rsi),%r15
mov    0x10(%rsi),%rdi
call   1140 <atoi@plt>
mov    %eax,%ebx
lea    -0x68(%rbp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   1120 <bzero@plt>
mov    0x2cf9(%rip),%r13
mov    0x0(%r13),%edi
mov    %edi,-0x60(%rbp)
lea    -0x64(%rbp),%rdx
mov    %r15,%rsi
call   10c0 <inet_pton@plt>
mov    %ebx,%edi
call   1060 <htons@plt>
mov    %eax,-0x68(%rbp)
mov    0x0(%r13),%edi
mov    0x2cb9(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1180 <socket@plt>
mov    %eax,%ebx
mov    %eax,%edi
not    %edi
shr    $0x1f,%edi
call   10a0 <assert@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    0x2c8e(%rip),%r14
mov    $0xc,%edx
call   1100 <bind@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   10a0 <assert@plt>
mov    %ebx,%edi
mov    $0x5,%esi
call   10f0 <listen@plt>
xor    %edi,%edi
cmp    $0xffffffff,%eax
setne  %dil
call   10a0 <assert@plt>
mov    (%r14),%edx
test   %edx,%edx
jle    1384 <main+0x124>
shl    $0x2,%rdx
mov    %r12,%rdi
mov    $0xff,%esi
call   1080 <memset@plt>
lea    -0x34(%rbp),%r15
mov    %r15,%rdi
call   10d0 <FD_ZERO@plt>
lea    -0x30(%rbp),%rdi
call   10d0 <FD_ZERO@plt>
mov    %ebx,%edi
mov    %r15,%rsi
call   1170 <FD_SET@plt>
mov    $0xffffffff,%eax
mov    %rax,-0x40(%rbp)
mov    %ebx,-0x44(%rbp)
mov    %ebx,%r13d
mov    %r12,-0x50(%rbp)
cs nopw 0x0(%rax,%rax,1)
mov    %r14,%r12
mov    -0x34(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x48(%rbp)
lea    -0x480(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1080 <memset@plt>
lea    0x1(%r13),%edi
lea    -0x38(%rbp),%r14
mov    %r14,%rsi
xor    %edx,%edx
lea    -0x48(%rbp),%rcx
xor    %r8d,%r8d
call   10e0 <select@plt>
mov    %eax,%r15d
mov    -0x44(%rbp),%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     14cc <main+0x26c>
mov    %ebx,%edi
lea    -0x80(%rbp),%rsi
lea    -0x5c(%rbp),%rdx
call   1130 <accept@plt>
mov    %eax,-0x2c(%rbp)
test   %eax,%eax
js     1692 <main+0x432>
mov    (%r12),%eax
xor    %ebx,%ebx
test   %eax,%eax
jle    1470 <main+0x210>
mov    -0x50(%rbp),%r12
nopl   0x0(%rax)
cmpl   $0x0,(%r12,%rbx,4)
js     1460 <main+0x200>
add    $0x1,%rbx
cmp    %rbx,%rax
jne    1440 <main+0x1e0>
jmp    167c <main+0x41c>
cs nopw 0x0(%rax,%rax,1)
nop
mov    -0x2c(%rbp),%ecx
mov    %ecx,(%r12,%rbx,4)
cmp    %eax,%ebx
jne    147c <main+0x21c>
jmp    167c <main+0x41c>
mov    -0x50(%rbp),%r12
cmp    %eax,%ebx
je     167c <main+0x41c>
mov    -0x2c(%rbp),%r14d
mov    %r14d,%edi
lea    -0x34(%rbp),%rsi
call   1170 <FD_SET@plt>
mov    %r14d,%edi
lea    -0x30(%rbp),%rsi
call   1170 <FD_SET@plt>
cmp    %r13d,%r14d
cmovg  %r14d,%r13d
mov    0x2b22(%rip),%r14
mov    -0x40(%rbp),%rax
cmp    %eax,%ebx
cmovg  %ebx,%eax
mov    %rax,-0x40(%rbp)
cmp    $0x2,%r15d
jl     13c0 <main+0x160>
add    $0xffffffff,%r15d
cmpl   $0x0,-0x40(%rbp)
jns    14da <main+0x27a>
jmp    165c <main+0x3fc>
mov    -0x50(%rbp),%r12
cmpl   $0x0,-0x40(%rbp)
js     165c <main+0x3fc>
mov    -0x40(%rbp),%rax
add    $0x1,%eax
mov    %rax,-0x58(%rbp)
lea    -0x480(%rbp),%r14
xor    %r13d,%r13d
jmp    151e <main+0x2be>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %r15d,%r14d
lea    0x1(%r13),%eax
mov    %r14d,%r15d
cmp    -0x40(%rbp),%r13d
mov    %eax,%r13d
lea    -0x480(%rbp),%r14
jge    165c <main+0x3fc>
movslq %r13d,%rax
mov    (%r12,%rax,4),%ebx
test   %ebx,%ebx
js     1500 <main+0x2a0>
mov    %ebx,%edi
lea    -0x38(%rbp),%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     1572 <main+0x312>
mov    %ebx,%edi
mov    %r14,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    165c <main+0x3fc>
lea    0xad8(%rip),%rdi
mov    %eax,%esi
mov    %r14,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
lea    -0x1(%r15),%r14d
cmp    $0x2,%r15d
mov    %r14d,%r15d
jl     1503 <main+0x2a3>
xor    %r13d,%r13d
mov    %r15d,%r14d
mov    -0x58(%rbp),%r15
jmp    158d <main+0x32d>
xchg   %ax,%ax
add    $0x1,%r13
cmp    %r13,%r15
je     164c <main+0x3ec>
mov    (%r12,%r13,4),%ebx
test   %ebx,%ebx
js     1580 <main+0x320>
mov    %ebx,%edi
lea    -0x38(%rbp),%rsi
call   1050 <FD_ISSET@plt>
mov    %ebx,%edi
test   %rax,%rax
je     15d0 <main+0x370>
lea    -0x480(%rbp),%r15
mov    %r15,%rsi
mov    $0x3ff,%edx
xor    %ecx,%ecx
call   1030 <recv@plt>
test   %eax,%eax
jle    1503 <main+0x2a3>
lea    0xa65(%rip),%rdi
jmp    160d <main+0x3ad>
xchg   %ax,%ax
lea    -0x48(%rbp),%rsi
call   1050 <FD_ISSET@plt>
test   %rax,%rax
je     161d <main+0x3bd>
mov    0x29fb(%rip),%rax
mov    (%rax),%ecx
mov    -0x2c(%rbp),%edi
lea    -0x480(%rbp),%r15
mov    %r15,%rsi
mov    $0x3ff,%edx
call   1030 <recv@plt>
test   %eax,%eax
jle    1503 <main+0x2a3>
lea    0xa44(%rip),%rdi
mov    %eax,%esi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <printf@plt>
mov    -0x58(%rbp),%r15
mov    %ebx,%edi
lea    -0x34(%rbp),%rsi
call   1150 <FD_CLR@plt>
mov    %ebx,%edi
lea    -0x30(%rbp),%rsi
call   1150 <FD_CLR@plt>
mov    %ebx,%edi
call   1090 <close@plt>
lea    -0x1(%r14),%eax
cmp    $0x2,%r14d
jl     1654 <main+0x3f4>
mov    %eax,%r14d
jmp    1580 <main+0x320>
mov    %r15d,%r13d
jmp    1503 <main+0x2a3>
mov    %eax,%r14d
jmp    1503 <main+0x2a3>
mov    -0x44(%rbp),%edi
call   1090 <close@plt>
xor    %eax,%eax
mov    -0x70(%rbp),%rbx
mov    %rbx,%rsp
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x9eb(%rip),%rdi
call   1040 <puts@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>
lea    0x989(%rip),%rdi
call   1110 <perror@plt>
mov    $0xffffffff,%edi
call   1160 <exit@plt>

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

LLVM IR (-O2):
%struct.sockaddr_in = type { i32, i32, i32 }
%struct.sockaddr = type { i32 }
@FD_SETSIZE = global i32 0
@.str = [34 x i8] c"usage: %s ip_address port_number\0A\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [15 x i8] c"accept failed\0A\00"
@.str.3 = [32 x i8] c"get %d bytes of normal data:%s\0A\00"
@MSG_OOB = global i32 0
@.str.4 = [29 x i8] c"get %d bytes of OOB data: %s\00"
@str = [19 x i8] c"too many clients..\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sockaddr_in
%9 = alloca i32
%10 = alloca %struct.sockaddr_in
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%12 = bitcast i32* %4 to i8*
%13 = bitcast i32* %5 to i8*
%14 = bitcast i32* %6 to i8*
%15 = bitcast i32* %7 to i8*
%16 = load i32, i32* @FD_SETSIZE
%17 = zext i32 %16 to i64
%18 = tail call i8* @llvm.stacksave()
%19 = alloca i32, i64 %17
%20 = bitcast i32* %19 to i8*
%21 = bitcast %struct.sockaddr_in* %8 to i8*
%22 = bitcast i32* %9 to i8*
store i32 12, i32* %9
%23 = icmp slt i32 %0, 3
br i1 %23, label %24, label %28
24: ; preds = %2
%25 = load i8*, i8** %1
%26 = tail call i8* @basename(i8* %25)
%27 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %26)
br label %190
28: ; preds = %2
%29 = getelementptr inbounds i8*, i8** %1, i64 1
%30 = load i8*, i8** %29
%31 = getelementptr inbounds i8*, i8** %1, i64 2
%32 = load i8*, i8** %31
%33 = tail call i32 @atoi(i8* %32)
%34 = bitcast %struct.sockaddr_in* %10 to i8*
%35 = call i32 @bzero(%struct.sockaddr_in* %10, i32 12)
%36 = load i32, i32* @AF_INET
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 2
store i32 %36, i32* %37
%38 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 1
%39 = call i32 @inet_pton(i32 %36, i8* %30, i32* %38)
%40 = call i32 @htons(i32 %33)
%41 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %10, i64 0, i32 0
store i32 %40, i32* %41
%42 = load i32, i32* @AF_INET
%43 = load i32, i32* @SOCK_STREAM
%44 = call i32 @socket(i32 %42, i32 %43, i32 0)
%45 = xor i32 %44, -1
%46 = lshr i32 %45, 31
%47 = call i32 @assert(i32 %46)
%48 = bitcast %struct.sockaddr_in* %10 to %struct.sockaddr*
%49 = call i32 @bind(i32 %44, %struct.sockaddr* %48, i32 12)
%50 = icmp ne i32 %49, -1
%51 = zext i1 %50 to i32
%52 = call i32 @assert(i32 %51)
%53 = call i32 @listen(i32 %44, i32 5)
%54 = icmp ne i32 %53, -1
%55 = zext i1 %54 to i32
%56 = call i32 @assert(i32 %55)
%57 = load i32, i32* @FD_SETSIZE
%58 = icmp sgt i32 %57, 0
br i1 %58, label %59, label %62
59: ; preds = %28
%60 = zext i32 %57 to i64
%61 = shl nuw nsw i64 %60, 2
br label %62
62: ; preds = %59, %28
%63 = call i32 @FD_ZERO(i32* %5)
%64 = call i32 @FD_ZERO(i32* %7)
%65 = call i32 @FD_SET(i32 %44, i32* %5)
%66 = bitcast %struct.sockaddr_in* %8 to %struct.sockaddr*
br label %67
67: ; preds = %107, %62
%68 = phi i32 [ undef, %62 ], [ %79, %107 ]
%69 = phi i32 [ %44, %62 ], [ %111, %107 ]
%70 = phi i32 [ -1, %62 ], [ %113, %107 ]
%71 = load i32, i32* %5
store i32 %71, i32* %4
%72 = load i32, i32* %7
store i32 %72, i32* %6
%73 = call i32 @memset(i8* %11, i32 0, i32 1024)
%74 = add nsw i32 %69, 1
%75 = call i32 @select(i32 %74, i32* %4, i32* null, i32* %6, i32* null)
%76 = call i64 @FD_ISSET(i32 %44, i32* %4)
%77 = icmp eq i64 %76, 0
br i1 %77, label %117, label %78
78: ; preds = %67
%79 = call i32 @accept(i32 %44, %struct.sockaddr* %66, i32* %9)
%80 = icmp slt i32 %79, 0
br i1 %80, label %86, label %81
81: ; preds = %78
%82 = load i32, i32* @FD_SETSIZE
%83 = icmp sgt i32 %82, 0
br i1 %83, label %84, label %101
84: ; preds = %81
%85 = zext i32 %82 to i64
br label %89
86: ; preds = %78
%87 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
%88 = call i32 @exit(i32 -1)
unreachable
89: ; preds = %84, %98
%90 = phi i64 [ 0, %84 ], [ %99, %98 ]
%91 = getelementptr inbounds i32, i32* %19, i64 %90
%92 = load i32, i32* %91
%93 = icmp slt i32 %92, 0
br i1 %93, label %94, label %98
94: ; preds = %89
%95 = trunc i64 %90 to i32
%96 = and i64 %90, 4294967295
%97 = getelementptr inbounds i32, i32* %19, i64 %96
store i32 %79, i32* %97
br label %101
98: ; preds = %89
%99 = add nuw nsw i64 %90, 1
%100 = icmp eq i64 %99, %85
br i1 %100, label %104, label %89
101: ; preds = %81, %94
%102 = phi i32 [ %95, %94 ], [ 0, %81 ]
%103 = icmp eq i32 %102, %82
br i1 %103, label %104, label %107
104: ; preds = %101, %98
%105 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
%106 = call i32 @exit(i32 -1)
unreachable
107: ; preds = %101
%108 = call i32 @FD_SET(i32 %79, i32* %5)
%109 = call i32 @FD_SET(i32 %79, i32* %7)
%110 = icmp sgt i32 %79, %69
%111 = select i1 %110, i32 %79, i32 %69
%112 = icmp sgt i32 %102, %70
%113 = select i1 %112, i32 %102, i32 %70
%114 = icmp slt i32 %75, 2
br i1 %114, label %67, label %115
115: ; preds = %107
%116 = add nsw i32 %75, -1
br label %117
117: ; preds = %67, %115
%118 = phi i32 [ %116, %115 ], [ %75, %67 ]
%119 = phi i32 [ %79, %115 ], [ %68, %67 ]
%120 = phi i32 [ %113, %115 ], [ %70, %67 ]
%121 = icmp slt i32 %120, 0
br i1 %121, label %188, label %122
122: ; preds = %117
%123 = add nuw i32 %120, 1
%124 = zext i32 %123 to i64
br label %125
125: ; preds = %122, %183
%126 = phi i32 [ 0, %122 ], [ %186, %183 ]
%127 = phi i32 [ %118, %122 ], [ %184, %183 ]
%128 = sext i32 %126 to i64
%129 = getelementptr inbounds i32, i32* %19, i64 %128
%130 = load i32, i32* %129
%131 = icmp slt i32 %130, 0
br i1 %131, label %183, label %132
132: ; preds = %125
%133 = call i64 @FD_ISSET(i32 %130, i32* %4)
%134 = icmp eq i64 %133, 0
br i1 %134, label %142, label %135
135: ; preds = %132
%136 = call i32 @recv(i32 %130, i8* %11, i32 1023, i32 0)
%137 = icmp slt i32 %136, 1
br i1 %137, label %188, label %138
138: ; preds = %135
%139 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %136, i8* %11)
%140 = add nsw i32 %127, -1
%141 = icmp slt i32 %127, 2
br i1 %141, label %183, label %142
142: ; preds = %132, %138
%143 = phi i32 [ %140, %138 ], [ %127, %132 ]
br label %144
144: ; preds = %142, %173
%145 = phi i64 [ %175, %173 ], [ 0, %142 ]
%146 = phi i32 [ %174, %173 ], [ %143, %142 ]
%147 = getelementptr inbounds i32, i32* %19, i64 %145
%148 = load i32, i32* %147
%149 = icmp slt i32 %148, 0
br i1 %149, label %173, label %150
150: ; preds = %144
%151 = call i64 @FD_ISSET(i32 %148, i32* %4)
%152 = icmp eq i64 %151, 0
br i1 %152, label %158, label %153
153: ; preds = %150
%154 = call i32 @recv(i32 %148, i8* %11, i32 1023, i32 0)
%155 = icmp slt i32 %154, 1
br i1 %155, label %177, label %156
156: ; preds = %153
%157 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.3, i64 0, i64 0), i32 %154, i8* %11)
br label %167
158: ; preds = %150
%159 = call i64 @FD_ISSET(i32 %148, i32* %6)
%160 = icmp eq i64 %159, 0
br i1 %160, label %167, label %161
161: ; preds = %158
%162 = load i32, i32* @MSG_OOB
%163 = call i32 @recv(i32 %119, i8* %11, i32 1023, i32 %162)
%164 = icmp slt i32 %163, 1
br i1 %164, label %179, label %165
165: ; preds = %161
%166 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i32 %163, i8* %11)
br label %167
167: ; preds = %158, %165, %156
%168 = call i32 @FD_CLR(i32 %148, i32* %5)
%169 = call i32 @FD_CLR(i32 %148, i32* %7)
%170 = call i32 @close(i32 %148)
%171 = add nsw i32 %146, -1
%172 = icmp slt i32 %146, 2
br i1 %172, label %181, label %173
173: ; preds = %167, %144
%174 = phi i32 [ %146, %144 ], [ %171, %167 ]
%175 = add nuw nsw i64 %145, 1
%176 = icmp eq i64 %175, %124
br i1 %176, label %183, label %144
177: ; preds = %153
%178 = trunc i64 %145 to i32
br label %183
179: ; preds = %161
%180 = trunc i64 %145 to i32
br label %183
181: ; preds = %167
%182 = trunc i64 %145 to i32
br label %183
183: ; preds = %173, %177, %179, %181, %138, %125
%184 = phi i32 [ %127, %125 ], [ %140, %138 ], [ %146, %177 ], [ %146, %179 ], [ %171, %181 ], [ %174, %173 ]
%185 = phi i32 [ %126, %125 ], [ %126, %138 ], [ %178, %177 ], [ %180, %179 ], [ %182, %181 ], [ %123, %173 ]
%186 = add nsw i32 %185, 1
%187 = icmp slt i32 %185, %120
br i1 %187, label %125, label %188
188: ; preds = %183, %135, %117
%189 = call i32 @close(i32 %44)
br label %190
190: ; preds = %188, %24
%191 = phi i32 [ 1, %24 ], [ 0, %188 ]
ret i32 %191
}