#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 {
  TYPE_1__ sin_addr;
  void *sin_port;
  void *sin_family;
};
struct sockaddr {
  int dummy;
};
typedef int /*<<< orphan*/ serv_addr;
typedef int /*<<< orphan*/ on;
typedef int /*<<< orphan*/ local_addr;
typedef int /*<<< orphan*/ int64_t;
typedef int /*<<< orphan*/ inbuf;
typedef int /*<<< orphan*/ fd_set;

/* Variables and functions */
void *AF_INET;
int /*<<< orphan*/ FD_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ FD_ZERO(int /*<<< orphan*/ *);
scalar_t__ FIONBIO;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int /*<<< orphan*/ SOL_SOCKET;
int /*<<< orphan*/ SO_REUSEADDR;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
int /*<<< orphan*/ add_to_queue(int /*<<< orphan*/, unsigned char *);
int /*<<< orphan*/ atoi(char *);
int bind(int, struct sockaddr *, int);
int /*<<< orphan*/ close(int);
scalar_t__ connect(int, struct sockaddr *, int);
int /*<<< orphan*/ empty_queue(int);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
double get_time();
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
void *htons(int /*<<< orphan*/);
scalar_t__ inet_pton(void *, char *, TYPE_1__ *);
scalar_t__ ioctl(int, int, char *);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ memset(struct sockaddr_in *, int /*<<< orphan*/, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int read(int, ...);
int select(int, int /*<<< orphan*/ *, int /*<<< orphan*/ *,
           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int setsockopt(int, int /*<<< orphan*/, int /*<<< orphan*/, char *, int);
int socket(void *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int write(int, char *, int);
int main(int argc, char *argv[]) {
  int connfd[5];
  int sockfd;
  int listenfd;
  int i, n;
  struct sockaddr_in serv_addr, local_addr;
  int res;
  int on = 1;
  if (argc != 4) {
    fprintf(stderr, "client remote-ip remote-port local-port\n");
    return 1;
  }
  memset(&local_addr, '0', sizeof(local_addr));
  local_addr.sin_family = AF_INET;
  local_addr.sin_addr.s_addr = htonl(INADDR_ANY);
  local_addr.sin_port = htons(atoi(argv[3]));
  listenfd = socket(AF_INET, SOCK_STREAM, 0);
  int rc =
      setsockopt(listenfd, SOL_SOCKET, SO_REUSEADDR, (char *)&on, sizeof(on));
  if (rc < 0) {
    perror("setsockopt() failed");
    close(listenfd);
    exit(-1);
  }
  res = bind(listenfd, (struct sockaddr *)&local_addr, sizeof(local_addr));
  if (res < 0) {
    perror("Bind error:");
    return 0;
  }
  listen(listenfd, 10);
  fprintf(stderr, "Waiting for connection on port %s\n", argv[3]);
  sockfd = accept(listenfd, (struct sockaddr *)NULL, NULL);
  if (ioctl(sockfd, (int)FIONBIO, (char *)&on)) {
    fprintf(stderr, "ioctl FIONBIO call failed\n");
  }
  fprintf(stderr, "Accepted.\n");
  memset(&serv_addr, '0', sizeof(serv_addr));
  serv_addr.sin_family = AF_INET;
  serv_addr.sin_port = htons(atoi(argv[2]));
  if (inet_pton(AF_INET, argv[1], &serv_addr.sin_addr) <= 0) {
    printf("\n inet_pton error occured\n");
    return 1;
  }
  for (i = 0; i < 5; i++) {
    if ((connfd[i] = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
      printf("\n Error : Could not create socket \n");
      return 1;
    }
    if (connect(connfd[i], (struct sockaddr *)&serv_addr, sizeof(serv_addr)) <
        0) {
      printf("\n Error : Connect Failed \n");
      return 1;
    }
    int on = 1;
    if (ioctl(connfd[i], (int)FIONBIO, (char *)&on)) {
      printf("ioctl FIONBIO call failed\n");
    }
    printf("Connection %d connected\n", i);
  }
  fd_set readfds;
  FD_ZERO(&readfds);
  int max_fd = 0;
  for (i = 0; i < 5; i++) {
    FD_SET(connfd[i], &readfds);
    if (connfd[i] > max_fd) {
      max_fd = connfd[i];
    }
  }
  max_fd++;
  fprintf(stderr, "%d %d %d - max_fd=%d\n", connfd[0], connfd[1], connfd[2],
          max_fd);
  double last_time = get_time();
  int bytesread = 0;
  unsigned char buf[5][(7 * 188) + 8];
  int x[5];
  char inbuf[1024];
  for (i = 0; i < 5; i++) {
    x[i] = 0;
  }
  while (1) {
    n = read(sockfd, inbuf, sizeof(inbuf));
    if (n > 0) {
      fprintf(stderr, "Read %d bytes from sockfd\n", (int)n);
      int n2 = write(connfd[0], inbuf, n);
      fprintf(stderr, "Wrote %d bytes to connfd[0] - res=%d\n", (int)n,
              (int)n2);
    }
    n = select(max_fd, &readfds, NULL, NULL, NULL);
    n = 1;
    if (n < 0) {
      perror("select failed");
    } else {
      for (i = 0; i < 5; i++) {
        n = read(connfd[i], buf[i] + x[i], (7 * 188) + 8 - x[i]);
        if (n > 0) {
          bytesread += n;
          x[i] += n;
          if (x[i] == (7 * 188) + 8) {
            int64_t blockno = *(int64_t *)&buf[i][0];
            add_to_queue(blockno, &buf[i][8]);
            x[i] = 0;
          }
        }
      }
      empty_queue(sockfd);
    }
    if (get_time() > last_time + 1000.0) {
      fprintf(stderr, "%d bits/s (%dKB/s)\n", bytesread * 8, bytesread / 1024);
      bytesread = 0;
      last_time = get_time();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1ea0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x78(%rbp)
cmpl   $0x4,-0x8(%rbp)
je     12dd <main+0x4d>
mov    0x2d07(%rip),%rax
mov    (%rax),%edi
lea    0xd3e(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18e9 <main+0x659>
lea    -0x70(%rbp),%rdi
mov    $0x30,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    0x2ce9(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x60(%rbp)
mov    0x2cd3(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x70(%rbp)
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,-0x68(%rbp)
mov    0x2cb2(%rip),%rax
mov    (%rax),%rdi
mov    0x2c88(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%edi
mov    0x2c9a(%rip),%rax
mov    (%rax),%esi
mov    0x2c59(%rip),%rax
mov    (%rax),%edx
lea    -0x78(%rbp),%rcx
mov    $0x4,%r8d
call   1030 <setsockopt@plt>
mov    %eax,-0x7c(%rbp)
cmpl   $0x0,-0x7c(%rbp)
jge    1393 <main+0x103>
lea    0xcb5(%rip),%rdi
call   1140 <perror@plt>
mov    -0x38(%rbp),%edi
call   10a0 <close@plt>
mov    $0xffffffff,%edi
call   1170 <exit@plt>
mov    -0x38(%rbp),%edi
lea    -0x70(%rbp),%rsi
mov    $0x18,%edx
call   1130 <bind@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0x0,-0x74(%rbp)
jge    13c9 <main+0x139>
lea    0xc8d(%rip),%rdi
call   1140 <perror@plt>
movl   $0x0,-0x4(%rbp)
jmp    18e9 <main+0x659>
mov    -0x38(%rbp),%edi
mov    $0xa,%esi
call   1120 <listen@plt>
mov    0x2beb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xc63(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x38(%rbp),%edi
xor    %eax,%eax
mov    %eax,%edx
mov    %rdx,%rsi
call   1150 <accept@plt>
mov    %eax,-0x34(%rbp)
mov    -0x34(%rbp),%edi
mov    0x2ba7(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x78(%rbp),%rdx
call   1090 <ioctl@plt>
cmp    $0x0,%rax
je     1440 <main+0x1b0>
mov    0x2b98(%rip),%rax
mov    (%rax),%edi
lea    0xc3b(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    0x2b81(%rip),%rax
mov    (%rax),%edi
lea    0xc3f(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
lea    -0x58(%rbp),%rdi
mov    $0x30,%esi
mov    $0x18,%edx
call   1080 <memset@plt>
mov    0x2b6f(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x48(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1160 <atoi@plt>
mov    %eax,%edi
call   1050 <htons@plt>
mov    %rax,-0x50(%rbp)
mov    0x2b49(%rip),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    -0x58(%rbp),%rdx
call   10f0 <inet_pton@plt>
cmp    $0x0,%rax
jg     14cf <main+0x23f>
lea    0xbde(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18e9 <main+0x659>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    15ba <main+0x32a>
mov    0x2af9(%rip),%rax
mov    (%rax),%rdi
mov    0x2acf(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   11b0 <socket@plt>
movslq -0x3c(%rbp),%rcx
mov    %eax,-0x30(%rbp,%rcx,4)
cmp    $0x0,%eax
jge    1525 <main+0x295>
lea    0xba3(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18e9 <main+0x659>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0x58(%rbp),%rsi
mov    $0x18,%edx
call   1180 <connect@plt>
cmp    $0x0,%rax
jge    155f <main+0x2cf>
lea    0xb8d(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    18e9 <main+0x659>
movl   $0x1,-0x80(%rbp)
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
mov    0x2a43(%rip),%rax
mov    (%rax),%rax
mov    %eax,%esi
lea    -0x80(%rbp),%rdx
call   1090 <ioctl@plt>
cmp    $0x0,%rax
je     159b <main+0x30b>
lea    0xae0(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xb4f(%rip),%rdi
mov    $0x0,%al
call   1060 <printf@plt>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    14d6 <main+0x246>
lea    -0x84(%rbp),%rdi
call   1100 <FD_ZERO@plt>
movl   $0x0,-0x88(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    162a <main+0x39a>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
lea    -0x84(%rbp),%rsi
call   1190 <FD_SET@plt>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x88(%rbp),%eax
jle    1617 <main+0x387>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x88(%rbp)
jmp    161c <main+0x38c>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    15d7 <main+0x347>
mov    -0x88(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x88(%rbp)
mov    0x2988(%rip),%rax
mov    (%rax),%edi
mov    -0x30(%rbp),%edx
mov    -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%r8d
mov    -0x88(%rbp),%r9d
lea    0xab3(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    $0x0,%al
call   10d0 <get_time@plt>
movsd  %xmm0,-0x90(%rbp)
ff
movl   $0x0,-0x94(%rbp)
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    16a8 <main+0x418>
movslq -0x3c(%rbp),%rax
movl   $0x0,-0x1a90(%rbp,%rax,4)
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    1681 <main+0x3f1>
jmp    16ad <main+0x41d>
mov    -0x34(%rbp),%edi
lea    -0x1e90(%rbp),%rsi
mov    $0x400,%edx
mov    $0x0,%al
call   10c0 <read@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jle    1722 <main+0x492>
mov    0x28f1(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
lea    0xa40(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x30(%rbp),%edi
lea    -0x1e90(%rbp),%rsi
mov    -0x40(%rbp),%edx
call   1040 <write@plt>
mov    %eax,-0x1e94(%rbp)
mov    0x28bf(%rip),%rax
mov    (%rax),%edi
mov    -0x40(%rbp),%edx
mov    -0x1e94(%rbp),%ecx
lea    0xa23(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
mov    -0x88(%rbp),%edi
lea    -0x84(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%r8d
mov    %r8,%rdx
mov    %r8,%rcx
call   1110 <select@plt>
mov    %eax,-0x40(%rbp)
movl   $0x1,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jge    1764 <main+0x4d4>
lea    0xa0a(%rip),%rdi
call   1140 <perror@plt>
jmp    186e <main+0x5de>
movl   $0x0,-0x3c(%rbp)
cmpl   $0x5,-0x3c(%rbp)
jge    1866 <main+0x5d6>
movslq -0x3c(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edi
movslq -0x3c(%rbp),%rax
lea    -0x1a70(%rbp),%rsi
imul   $0x52c,%rax,%rax
add    %rax,%rsi
movslq -0x3c(%rbp),%rax
movslq -0x1a90(%rbp,%rax,4),%rax
ff
add    %rax,%rsi
movslq -0x3c(%rbp),%rax
mov    $0x52c,%edx
sub    -0x1a90(%rbp,%rax,4),%edx
mov    $0x0,%al
call   10c0 <read@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jle    1853 <main+0x5c3>
mov    -0x40(%rbp),%eax
add    -0x94(%rbp),%eax
mov    %eax,-0x94(%rbp)
mov    -0x40(%rbp),%ecx
movslq -0x3c(%rbp),%rax
add    -0x1a90(%rbp,%rax,4),%ecx
mov    %ecx,-0x1a90(%rbp,%rax,4)
movslq -0x3c(%rbp),%rax
cmpl   $0x52c,-0x1a90(%rbp,%rax,4)
jne    184e <main+0x5be>
movslq -0x3c(%rbp),%rcx
lea    -0x1a70(%rbp),%rax
imul   $0x52c,%rcx,%rcx
add    %rcx,%rax
mov    (%rax),%eax
mov    %eax,-0x1e98(%rbp)
mov    -0x1e98(%rbp),%edi
movslq -0x3c(%rbp),%rax
lea    -0x1a70(%rbp),%rsi
imul   $0x52c,%rax,%rax
add    %rax,%rsi
add    $0x8,%rsi
call   11a0 <add_to_queue@plt>
movslq -0x3c(%rbp),%rax
movl   $0x0,-0x1a90(%rbp,%rax,4)
jmp    1853 <main+0x5c3>
jmp    1858 <main+0x5c8>
mov    -0x3c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x3c(%rbp)
jmp    176b <main+0x4db>
mov    -0x34(%rbp),%edi
call   10b0 <empty_queue@plt>
mov    $0x0,%al
call   10d0 <get_time@plt>
movsd  0x783(%rip),%xmm1
addsd  -0x90(%rbp),%xmm1
ff
ucomisd %xmm1,%xmm0
jbe    18e4 <main+0x654>
mov    0x2732(%rip),%rax
mov    (%rax),%edi
mov    -0x94(%rbp),%eax
shl    $0x3,%eax
mov    %eax,-0x1e9c(%rbp)
mov    -0x94(%rbp),%eax
mov    $0x400,%ecx
cltd
idiv   %ecx
mov    -0x1e9c(%rbp),%edx
mov    %eax,%ecx
lea    0x8ae(%rip),%rsi
mov    $0x0,%al
call   10e0 <fprintf@plt>
movl   $0x0,-0x94(%rbp)
mov    $0x0,%al
call   10d0 <get_time@plt>
movsd  %xmm0,-0x90(%rbp)
ff
jmp    16ad <main+0x41d>
mov    -0x4(%rbp),%eax
add    $0x1ea0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1e78,%rsp
movl   $0x1,0x18(%rsp)
cmp    $0x4,%edi
jne    14de <main+0x23e>
mov    %rsi,%rbp
lea    0x60(%rsp),%rdi
mov    $0x30,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2d00(%rip),%rbx
mov    (%rbx),%rax
mov    %rax,0x70(%rsp)
mov    0x2ce9(%rip),%rax
mov    (%rax),%edi
call   1080 <htonl@plt>
mov    %eax,0x60(%rsp)
mov    0x18(%rbp),%rdi
call   1170 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %rax,0x68(%rsp)
mov    (%rbx),%rdi
mov    0x2ca7(%rip),%rax
mov    %rax,%r12
mov    (%rax),%esi
xor    %edx,%edx
call   11c0 <socket@plt>
mov    %eax,%ebx
mov    0x2cba(%rip),%rax
mov    (%rax),%esi
mov    0x2c79(%rip),%rax
mov    (%rax),%edx
lea    0x18(%rsp),%rcx
mov    %ebx,%edi
mov    $0x4,%r8d
call   1040 <setsockopt@plt>
test   %eax,%eax
js     1900 <main+0x660>
lea    0x60(%rsp),%rsi
mov    %ebx,%edi
mov    $0x18,%edx
call   1140 <bind@plt>
test   %eax,%eax
js     18ed <main+0x64d>
mov    %ebx,%edi
mov    $0xa,%esi
call   1130 <listen@plt>
mov    0x2c49(%rip),%r14
mov    (%r14),%edi
mov    0x18(%rbp),%rdx
lea    0xcc4(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %ebx,%edi
xor    %esi,%esi
xor    %edx,%edx
call   1160 <accept@plt>
mov    0x2c12(%rip),%rcx
mov    (%rcx),%esi
lea    0x18(%rsp),%rdx
mov    %eax,0x10(%rsp)
mov    %eax,%edi
call   10a0 <ioctl@plt>
test   %rax,%rax
je     13ce <main+0x12e>
mov    (%r14),%edi
lea    0xcad(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    (%r14),%edi
lea    0xcb7(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
lea    0x78(%rsp),%r14
mov    %r14,%rdi
mov    $0x30,%esi
mov    $0x18,%edx
call   1090 <memset@plt>
mov    0x2be3(%rip),%rbx
mov    (%rbx),%rax
mov    %rax,0x88(%rsp)
mov    0x10(%rbp),%rdi
call   1170 <atoi@plt>
mov    %eax,%edi
call   1060 <htons@plt>
mov    %rax,0x80(%rsp)
mov    (%rbx),%rdi
mov    0x8(%rbp),%rsi
mov    %r14,%rdx
call   1100 <inet_pton@plt>
test   %rax,%rax
jle    14f7 <main+0x257>
lea    0x78(%rsp),%r15
lea    0x90(%rsp),%r14
lea    0xc4e(%rip),%r13
xor    %ebp,%ebp
mov    %r12,%rbx
jmp    147a <main+0x1da>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r13,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1070 <printf@plt>
add    $0x1,%rbp
cmp    $0x5,%rbp
je     152c <main+0x28c>
mov    0x2b5f(%rip),%rax
mov    (%rax),%rdi
mov    (%rbx),%esi
xor    %edx,%edx
call   11c0 <socket@plt>
mov    %eax,0x40(%rsp,%rbp,4)
test   %eax,%eax
js     1500 <main+0x260>
mov    %eax,%r12d
mov    %eax,%edi
mov    %r15,%rsi
mov    $0x18,%edx
call   1190 <connect@plt>
test   %rax,%rax
js     1509 <main+0x269>
movl   $0x1,0x90(%rsp)
mov    0x2afa(%rip),%rax
mov    (%rax),%esi
mov    %r12d,%edi
mov    %r14,%rdx
call   10a0 <ioctl@plt>
test   %rax,%rax
je     1460 <main+0x1c0>
lea    0xc47(%rip),%rdi
call   1030 <puts@plt>
jmp    1460 <main+0x1c0>
mov    0x2ae3(%rip),%rax
mov    (%rax),%edi
lea    0xb1a(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
jmp    1515 <main+0x275>
lea    0xc77(%rip),%rdi
jmp    1510 <main+0x270>
lea    0xc4b(%rip),%rdi
jmp    1510 <main+0x270>
lea    0xc28(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x1e78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x3c(%rsp),%r14
mov    %r14,%rdi
call   1110 <FD_ZERO@plt>
mov    0x40(%rsp),%r15d
mov    %r15d,%edi
mov    %r14,%rsi
call   11a0 <FD_SET@plt>
test   %r15d,%r15d
mov    $0x0,%ebp
cmovns %r15d,%ebp
mov    0x44(%rsp),%r12d
mov    %r12d,%edi
mov    %r14,%rsi
call   11a0 <FD_SET@plt>
cmp    %ebp,%r12d
cmovg  %r12d,%ebp
mov    0x48(%rsp),%r13d
mov    %r13d,%edi
mov    %r14,%rsi
call   11a0 <FD_SET@plt>
cmp    %ebp,%r13d
cmovg  %r13d,%ebp
mov    0x4c(%rsp),%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   11a0 <FD_SET@plt>
cmp    %ebp,%ebx
mov    %ebx,0x24(%rsp)
cmovg  %ebx,%ebp
mov    0x50(%rsp),%ebx
mov    %ebx,%edi
mov    %r14,%rsi
call   11a0 <FD_SET@plt>
cmp    %ebp,%ebx
mov    %ebx,0x20(%rsp)
cmovg  %ebx,%ebp
add    $0x1,%ebp
mov    0x2a0d(%rip),%rax
mov    (%rax),%edi
lea    0xaef(%rip),%rsi
mov    %r15d,0x1c(%rsp)
mov    %r15d,%edx
mov    %r12d,0x2c(%rsp)
mov    %r12d,%ecx
mov    %r13d,0x28(%rsp)
mov    %r13d,%r8d
mov    %ebp,0x30(%rsp)
mov    %ebp,%r9d
xor    %eax,%eax
call   10f0 <fprintf@plt>
xor    %eax,%eax
call   10e0 <get_time@plt>
lea    0x1a70(%rsp),%rbx
movl   $0x0,0xc(%rsp)
movl   $0x0,0x14(%rsp)
xor    %ebp,%ebp
xor    %r12d,%r12d
movl   $0x0,0x8(%rsp)
mov    0x10(%rsp),%r14d
jmp    1657 <main+0x3b7>
nopl   (%rax)
mov    0x29a1(%rip),%rax
mov    (%rax),%edi
lea    0x0(,%r13,8),%edx
lea    0x3ff(%r13),%ecx
test   %r13d,%r13d
cmovns %r13d,%ecx
sar    $0xa,%ecx
lea    0xac1(%rip),%rsi
xor    %eax,%eax
call   10f0 <fprintf@plt>
xor    %eax,%eax
call   10e0 <get_time@plt>
addsd  0x9a1(%rip),%xmm0
xor    %r13d,%r13d
movsd  %xmm0,0x58(%rsp)
jmp    16ae <main+0x40e>
nopw   0x0(%rax,%rax,1)
mov    0x1540(%rsp),%edi
lea    0x1548(%rsp),%rsi
call   11b0 <add_to_queue@plt>
movl   $0x0,0x8(%rsp)
mov    %r15d,%r14d
mov    %r15d,%edi
call   10c0 <empty_queue@plt>
xor    %eax,%eax
call   10e0 <get_time@plt>
movsd  0x58(%rsp),%xmm1
ucomisd %xmm1,%xmm0
ja     1620 <main+0x380>
mov    %r12d,0x34(%rsp)
mov    %ebp,0x38(%rsp)
mov    0x14(%rsp),%ebp
mov    $0x400,%edx
mov    %r14d,%edi
mov    %rbx,%rsi
xor    %eax,%eax
call   10d0 <read@plt>
mov    0x1c(%rsp),%r15d
test   %eax,%eax
jle    171c <main+0x47c>
mov    %eax,%r12d
mov    0x28e8(%rip),%r14
mov    (%r14),%edi
lea    0x9df(%rip),%rsi
mov    %eax,%edx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %r12d,%edx
call   1050 <write@plt>
mov    (%r14),%edi
mov    0x10(%rsp),%r14d
lea    0x9d4(%rip),%rsi
mov    %r12d,%edx
mov    %eax,%ecx
xor    %eax,%eax
call   10f0 <fprintf@plt>
mov    0x30(%rsp),%edi
lea    0x3c(%rsp),%rsi
xor    %edx,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1120 <select@plt>
mov    0xc(%rsp),%r12d
movslq %r12d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x90,%rsi
mov    $0x52c,%edx
sub    %eax,%edx
mov    %r15d,%edi
xor    %eax,%eax
call   10d0 <read@plt>
test   %eax,%eax
jle    1790 <main+0x4f0>
add    %eax,%r13d
add    %eax,%r12d
cmp    $0x52c,%r12d
mov    %rbx,%r15
jne    17a0 <main+0x500>
mov    0x90(%rsp),%edi
lea    0x98(%rsp),%rsi
call   11b0 <add_to_queue@plt>
movl   $0x0,0xc(%rsp)
jmp    17a5 <main+0x505>
nopl   0x0(%rax)
mov    %rbx,%r15
jmp    17a5 <main+0x505>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r12d,0xc(%rsp)
mov    %ebp,%ebx
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x5bc,%rsi
mov    $0x52c,%edx
sub    %eax,%edx
mov    0x2c(%rsp),%edi
xor    %eax,%eax
call   10d0 <read@plt>
test   %eax,%eax
mov    0x38(%rsp),%ebp
mov    0x34(%rsp),%r12d
jle    17f7 <main+0x557>
add    %eax,%r13d
add    %eax,%ebx
cmp    $0x52c,%ebx
jne    17f7 <main+0x557>
mov    0x5bc(%rsp),%edi
lea    0x5c4(%rsp),%rsi
call   11b0 <add_to_queue@plt>
xor    %ebx,%ebx
movslq %ebp,%rax
lea    (%rsp,%rax,1),%rsi
add    $0xae8,%rsi
mov    $0x52c,%edx
sub    %eax,%edx
mov    0x28(%rsp),%edi
xor    %eax,%eax
call   10d0 <read@plt>
test   %eax,%eax
jle    183e <main+0x59e>
add    %eax,%r13d
add    %eax,%ebp
cmp    $0x52c,%ebp
jne    183e <main+0x59e>
mov    0xae8(%rsp),%edi
lea    0xaf0(%rsp),%rsi
call   11b0 <add_to_queue@plt>
xor    %ebp,%ebp
mov    %ebx,0x14(%rsp)
movslq %r12d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x1014,%rsi
mov    $0x52c,%edx
sub    %eax,%edx
mov    0x24(%rsp),%edi
xor    %eax,%eax
call   10d0 <read@plt>
mov    %r15,%rbx
test   %eax,%eax
jle    18a0 <main+0x600>
add    %eax,%r13d
add    %eax,%r12d
cmp    $0x52c,%r12d
jne    18a0 <main+0x600>
mov    %r14d,%r15d
mov    0x1014(%rsp),%edi
lea    0x101c(%rsp),%rsi
call   11b0 <add_to_queue@plt>
xor    %r12d,%r12d
jmp    18a3 <main+0x603>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14d,%r15d
mov    0x8(%rsp),%r14d
movslq %r14d,%rax
lea    (%rsp,%rax,1),%rsi
add    $0x1540,%rsi
mov    $0x52c,%edx
sub    %eax,%edx
mov    0x20(%rsp),%edi
xor    %eax,%eax
call   10d0 <read@plt>
test   %eax,%eax
jle    168c <main+0x3ec>
add    %eax,%r13d
add    %eax,%r14d
cmp    $0x52c,%r14d
je     1670 <main+0x3d0>
mov    %r14d,0x8(%rsp)
jmp    168c <main+0x3ec>
lea    0x751(%rip),%rdi
call   1150 <perror@plt>
xor    %eax,%eax
jmp    151a <main+0x27a>
lea    0x72a(%rip),%rdi
call   1150 <perror@plt>
mov    %ebx,%edi
call   10b0 <close@plt>
mov    $0xffffffff,%edi
call   1180 <exit@plt>

LLVM IR (-O0):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [41 x i8] c"client remote-ip remote-port local-port\0A\00"
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [20 x i8] c"setsockopt() failed\00"
@.str.2 = [12 x i8] c"Bind error:\00"
@.str.3 = [35 x i8] c"Waiting for connection on port %s\0A\00"
@FIONBIO = global i64 0
@.str.4 = [27 x i8] c"ioctl FIONBIO call failed\0A\00"
@.str.5 = [11 x i8] c"Accepted.\0A\00"
@.str.6 = [27 x i8] c"\0A inet_pton error occured\0A\00"
@.str.7 = [36 x i8] c"\0A Error : Could not create socket \0A\00"
@.str.8 = [27 x i8] c"\0A Error : Connect Failed \0A\00"
@.str.9 = [25 x i8] c"Connection %d connected\0A\00"
@.str.10 = [22 x i8] c"%d %d %d - max_fd=%d\0A\00"
@.str.11 = [27 x i8] c"Read %d bytes from sockfd\0A\00"
@.str.12 = [38 x i8] c"Wrote %d bytes to connfd[0] - res=%d\0A\00"
@.str.13 = [14 x i8] c"select failed\00"
@.str.14 = [20 x i8] c"%d bits/s (%dKB/s)\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca %struct.sockaddr_in
%12 = alloca %struct.sockaddr_in
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
%19 = alloca double
%20 = alloca i32
%21 = alloca [5 x [1324 x i8]]
%22 = alloca [5 x i32]
%23 = alloca [1024 x i8]
%24 = alloca i32
%25 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 1, i32* %14
%26 = load i32, i32* %4
%27 = icmp ne i32 %26, 4
br i1 %27, label %28, label %31
28: ; preds = %2
%29 = load i32, i32* @stderr
%30 = call i32 (i32, i8*, ...) @fprintf(i32 %29, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %306
31: ; preds = %2
%32 = call i32 @memset(%struct.sockaddr_in* %12, i32 48, i32 24)
%33 = load i8*, i8** @AF_INET
%34 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 2
store i8* %33, i8** %34
%35 = load i32, i32* @INADDR_ANY
%36 = call i32 @htonl(i32 %35)
%37 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 0
%38 = getelementptr inbounds %struct.TYPE_2__, %struct.TYPE_2__* %37, i32 0, i32 0
store i32 %36, i32* %38
%39 = load i8**, i8*** %5
%40 = getelementptr inbounds i8*, i8** %39, i64 3
%41 = load i8*, i8** %40
%42 = call i32 @atoi(i8* %41)
%43 = call i8* @htons(i32 %42)
%44 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %12, i32 0, i32 1
store i8* %43, i8** %44
%45 = load i8*, i8** @AF_INET
%46 = load i32, i32* @SOCK_STREAM
%47 = call i32 @socket(i8* %45, i32 %46, i32 0)
store i32 %47, i32* %8
%48 = load i32, i32* %8
%49 = load i32, i32* @SOL_SOCKET
%50 = load i32, i32* @SO_REUSEADDR
%51 = bitcast i32* %14 to i8*
%52 = call i32 @setsockopt(i32 %48, i32 %49, i32 %50, i8* %51, i32 4)
store i32 %52, i32* %15
%53 = load i32, i32* %15
%54 = icmp slt i32 %53, 0
br i1 %54, label %55, label %60
55: ; preds = %31
%56 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%57 = load i32, i32* %8
%58 = call i32 @close(i32 %57)
%59 = call i32 @exit(i32 -1)
unreachable
60: ; preds = %31
%61 = load i32, i32* %8
%62 = bitcast %struct.sockaddr_in* %12 to %struct.sockaddr*
%63 = call i32 @bind(i32 %61, %struct.sockaddr* %62, i32 24)
store i32 %63, i32* %13
%64 = load i32, i32* %13
%65 = icmp slt i32 %64, 0
br i1 %65, label %66, label %68
66: ; preds = %60
%67 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %306
68: ; preds = %60
%69 = load i32, i32* %8
%70 = call i32 @listen(i32 %69, i32 10)
%71 = load i32, i32* @stderr
%72 = load i8**, i8*** %5
%73 = getelementptr inbounds i8*, i8** %72, i64 3
%74 = load i8*, i8** %73
%75 = call i32 (i32, i8*, ...) @fprintf(i32 %71, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %74)
%76 = load i32, i32* %8
%77 = call i32 @accept(i32 %76, %struct.sockaddr* null, i32* null)
store i32 %77, i32* %7
%78 = load i32, i32* %7
%79 = load i64, i64* @FIONBIO
%80 = trunc i64 %79 to i32
%81 = bitcast i32* %14 to i8*
%82 = call i64 @ioctl(i32 %78, i32 %80, i8* %81)
%83 = icmp ne i64 %82, 0
br i1 %83, label %84, label %87
84: ; preds = %68
%85 = load i32, i32* @stderr
%86 = call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %87
87: ; preds = %84, %68
%88 = load i32, i32* @stderr
%89 = call i32 (i32, i8*, ...) @fprintf(i32 %88, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%90 = call i32 @memset(%struct.sockaddr_in* %11, i32 48, i32 24)
%91 = load i8*, i8** @AF_INET
%92 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 2
store i8* %91, i8** %92
%93 = load i8**, i8*** %5
%94 = getelementptr inbounds i8*, i8** %93, i64 2
%95 = load i8*, i8** %94
%96 = call i32 @atoi(i8* %95)
%97 = call i8* @htons(i32 %96)
%98 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 1
store i8* %97, i8** %98
%99 = load i8*, i8** @AF_INET
%100 = load i8**, i8*** %5
%101 = getelementptr inbounds i8*, i8** %100, i64 1
%102 = load i8*, i8** %101
%103 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %11, i32 0, i32 0
%104 = call i64 @inet_pton(i8* %99, i8* %102, %struct.TYPE_2__* %103)
%105 = icmp sle i64 %104, 0
br i1 %105, label %106, label %108
106: ; preds = %87
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %3
br label %306
108: ; preds = %87
store i32 0, i32* %9
br label %109
109: ; preds = %147, %108
%110 = load i32, i32* %9
%111 = icmp slt i32 %110, 5
br i1 %111, label %112, label %150
112: ; preds = %109
%113 = load i8*, i8** @AF_INET
%114 = load i32, i32* @SOCK_STREAM
%115 = call i32 @socket(i8* %113, i32 %114, i32 0)
%116 = load i32, i32* %9
%117 = sext i32 %116 to i64
%118 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %117
store i32 %115, i32* %118
%119 = icmp slt i32 %115, 0
br i1 %119, label %120, label %122
120: ; preds = %112
%121 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.7, i64 0, i64 0))
store i32 1, i32* %3
br label %306
122: ; preds = %112
%123 = load i32, i32* %9
%124 = sext i32 %123 to i64
%125 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %124
%126 = load i32, i32* %125
%127 = bitcast %struct.sockaddr_in* %11 to %struct.sockaddr*
%128 = call i64 @connect(i32 %126, %struct.sockaddr* %127, i32 24)
%129 = icmp slt i64 %128, 0
br i1 %129, label %130, label %132
130: ; preds = %122
%131 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %3
br label %306
132: ; preds = %122
store i32 1, i32* %16
%133 = load i32, i32* %9
%134 = sext i32 %133 to i64
%135 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %134
%136 = load i32, i32* %135
%137 = load i64, i64* @FIONBIO
%138 = trunc i64 %137 to i32
%139 = bitcast i32* %16 to i8*
%140 = call i64 @ioctl(i32 %136, i32 %138, i8* %139)
%141 = icmp ne i64 %140, 0
br i1 %141, label %142, label %144
142: ; preds = %132
%143 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %144
144: ; preds = %142, %132
%145 = load i32, i32* %9
%146 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %145)
br label %147
147: ; preds = %144
%148 = load i32, i32* %9
%149 = add nsw i32 %148, 1
store i32 %149, i32* %9
br label %109
150: ; preds = %109
%151 = call i32 @FD_ZERO(i32* %17)
store i32 0, i32* %18
store i32 0, i32* %9
br label %152
152: ; preds = %173, %150
%153 = load i32, i32* %9
%154 = icmp slt i32 %153, 5
br i1 %154, label %155, label %176
155: ; preds = %152
%156 = load i32, i32* %9
%157 = sext i32 %156 to i64
%158 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %157
%159 = load i32, i32* %158
%160 = call i32 @FD_SET(i32 %159, i32* %17)
%161 = load i32, i32* %9
%162 = sext i32 %161 to i64
%163 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %162
%164 = load i32, i32* %163
%165 = load i32, i32* %18
%166 = icmp sgt i32 %164, %165
br i1 %166, label %167, label %172
167: ; preds = %155
%168 = load i32, i32* %9
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %169
%171 = load i32, i32* %170
store i32 %171, i32* %18
br label %172
172: ; preds = %167, %155
br label %173
173: ; preds = %172
%174 = load i32, i32* %9
%175 = add nsw i32 %174, 1
store i32 %175, i32* %9
br label %152
176: ; preds = %152
%177 = load i32, i32* %18
%178 = add nsw i32 %177, 1
store i32 %178, i32* %18
%179 = load i32, i32* @stderr
%180 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%181 = load i32, i32* %180
%182 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 1
%183 = load i32, i32* %182
%184 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 2
%185 = load i32, i32* %184
%186 = load i32, i32* %18
%187 = call i32 (i32, i8*, ...) @fprintf(i32 %179, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %181, i32 %183, i32 %185, i32 %186)
%188 = call double (...) @get_time()
store double %188, double* %19
store i32 0, i32* %20
store i32 0, i32* %9
br label %189
189: ; preds = %196, %176
%190 = load i32, i32* %9
%191 = icmp slt i32 %190, 5
br i1 %191, label %192, label %199
192: ; preds = %189
%193 = load i32, i32* %9
%194 = sext i32 %193 to i64
%195 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %194
store i32 0, i32* %195
br label %196
196: ; preds = %192
%197 = load i32, i32* %9
%198 = add nsw i32 %197, 1
store i32 %198, i32* %9
br label %189
199: ; preds = %189
br label %200
200: ; preds = %199, %305
%201 = load i32, i32* %7
%202 = getelementptr inbounds [1024 x i8], [1024 x i8]* %23, i64 0, i64 0
%203 = call i32 (i32, ...) @read(i32 %201, i8* %202, i64 1024)
store i32 %203, i32* %10
%204 = load i32, i32* %10
%205 = icmp sgt i32 %204, 0
br i1 %205, label %206, label %219
206: ; preds = %200
%207 = load i32, i32* @stderr
%208 = load i32, i32* %10
%209 = call i32 (i32, i8*, ...) @fprintf(i32 %207, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %208)
%210 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%211 = load i32, i32* %210
%212 = getelementptr inbounds [1024 x i8], [1024 x i8]* %23, i64 0, i64 0
%213 = load i32, i32* %10
%214 = call i32 @write(i32 %211, i8* %212, i32 %213)
store i32 %214, i32* %24
%215 = load i32, i32* @stderr
%216 = load i32, i32* %10
%217 = load i32, i32* %24
%218 = call i32 (i32, i8*, ...) @fprintf(i32 %215, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %216, i32 %217)
br label %219
219: ; preds = %206, %200
%220 = load i32, i32* %18
%221 = call i32 @select(i32 %220, i32* %17, i32* null, i32* null, i32* null)
store i32 %221, i32* %10
store i32 1, i32* %10
%222 = load i32, i32* %10
%223 = icmp slt i32 %222, 0
br i1 %223, label %224, label %226
224: ; preds = %219
%225 = call i32 @perror(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.13, i64 0, i64 0))
br label %292
226: ; preds = %219
store i32 0, i32* %9
br label %227
227: ; preds = %286, %226
%228 = load i32, i32* %9
%229 = icmp slt i32 %228, 5
br i1 %229, label %230, label %289
230: ; preds = %227
%231 = load i32, i32* %9
%232 = sext i32 %231 to i64
%233 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %232
%234 = load i32, i32* %233
%235 = load i32, i32* %9
%236 = sext i32 %235 to i64
%237 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %21, i64 0, i64 %236
%238 = getelementptr inbounds [1324 x i8], [1324 x i8]* %237, i64 0, i64 0
%239 = load i32, i32* %9
%240 = sext i32 %239 to i64
%241 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %240
%242 = load i32, i32* %241
%243 = sext i32 %242 to i64
%244 = getelementptr inbounds i8, i8* %238, i64 %243
%245 = load i32, i32* %9
%246 = sext i32 %245 to i64
%247 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %246
%248 = load i32, i32* %247
%249 = sub nsw i32 1324, %248
%250 = call i32 (i32, ...) @read(i32 %234, i8* %244, i32 %249)
store i32 %250, i32* %10
%251 = load i32, i32* %10
%252 = icmp sgt i32 %251, 0
br i1 %252, label %253, label %285
253: ; preds = %230
%254 = load i32, i32* %10
%255 = load i32, i32* %20
%256 = add nsw i32 %255, %254
store i32 %256, i32* %20
%257 = load i32, i32* %10
%258 = load i32, i32* %9
%259 = sext i32 %258 to i64
%260 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %259
%261 = load i32, i32* %260
%262 = add nsw i32 %261, %257
store i32 %262, i32* %260
%263 = load i32, i32* %9
%264 = sext i32 %263 to i64
%265 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %264
%266 = load i32, i32* %265
%267 = icmp eq i32 %266, 1324
br i1 %267, label %268, label %284
268: ; preds = %253
%269 = load i32, i32* %9
%270 = sext i32 %269 to i64
%271 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %21, i64 0, i64 %270
%272 = getelementptr inbounds [1324 x i8], [1324 x i8]* %271, i64 0, i64 0
%273 = bitcast i8* %272 to i32*
%274 = load i32, i32* %273
store i32 %274, i32* %25
%275 = load i32, i32* %25
%276 = load i32, i32* %9
%277 = sext i32 %276 to i64
%278 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %21, i64 0, i64 %277
%279 = getelementptr inbounds [1324 x i8], [1324 x i8]* %278, i64 0, i64 8
%280 = call i32 @add_to_queue(i32 %275, i8* %279)
%281 = load i32, i32* %9
%282 = sext i32 %281 to i64
%283 = getelementptr inbounds [5 x i32], [5 x i32]* %22, i64 0, i64 %282
store i32 0, i32* %283
br label %284
284: ; preds = %268, %253
br label %285
285: ; preds = %284, %230
br label %286
286: ; preds = %285
%287 = load i32, i32* %9
%288 = add nsw i32 %287, 1
store i32 %288, i32* %9
br label %227
289: ; preds = %227
%290 = load i32, i32* %7
%291 = call i32 @empty_queue(i32 %290)
br label %292
292: ; preds = %289, %224
%293 = call double (...) @get_time()
%294 = load double, double* %19
%295 = fadd double %294, 1.000000e+03
%296 = fcmp ogt double %293, %295
br i1 %296, label %297, label %305
297: ; preds = %292
%298 = load i32, i32* @stderr
%299 = load i32, i32* %20
%300 = mul nsw i32 %299, 8
%301 = load i32, i32* %20
%302 = sdiv i32 %301, 1024
%303 = call i32 (i32, i8*, ...) @fprintf(i32 %298, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %300, i32 %302)
store i32 0, i32* %20
%304 = call double (...) @get_time()
store double %304, double* %19
br label %305
305: ; preds = %297, %292
br label %200
306: ; preds = %130, %120, %106, %66, %28
%307 = load i32, i32* %3
ret i32 %307
}

LLVM IR (-O2):
%struct.sockaddr_in = type { %struct.TYPE_2__, i8*, i8* }
%struct.TYPE_2__ = type { i32 }
%struct.sockaddr = type { i32 }
@stderr = global i32 0
@.str = [41 x i8] c"client remote-ip remote-port local-port\0A\00"
@AF_INET = global i8* null
@INADDR_ANY = global i32 0
@SOCK_STREAM = global i32 0
@SOL_SOCKET = global i32 0
@SO_REUSEADDR = global i32 0
@.str.1 = [20 x i8] c"setsockopt() failed\00"
@.str.2 = [12 x i8] c"Bind error:\00"
@.str.3 = [35 x i8] c"Waiting for connection on port %s\0A\00"
@FIONBIO = global i64 0
@.str.4 = [27 x i8] c"ioctl FIONBIO call failed\0A\00"
@.str.5 = [11 x i8] c"Accepted.\0A\00"
@.str.9 = [25 x i8] c"Connection %d connected\0A\00"
@.str.10 = [22 x i8] c"%d %d %d - max_fd=%d\0A\00"
@.str.11 = [27 x i8] c"Read %d bytes from sockfd\0A\00"
@.str.12 = [38 x i8] c"Wrote %d bytes to connfd[0] - res=%d\0A\00"
@.str.14 = [20 x i8] c"%d bits/s (%dKB/s)\0A\00"
@str = [26 x i8] c"ioctl FIONBIO call failed\00"
@str.15 = [26 x i8] c"\0A Error : Connect Failed \00"
@str.16 = [35 x i8] c"\0A Error : Could not create socket \00"
@str.17 = [26 x i8] c"\0A inet_pton error occured\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5 x i32]
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [5 x [1324 x i8]]
%10 = alloca [1024 x i8]
%11 = bitcast [5 x i32]* %3 to i8*
%12 = bitcast %struct.sockaddr_in* %4 to i8*
%13 = bitcast %struct.sockaddr_in* %5 to i8*
%14 = bitcast i32* %6 to i8*
store i32 1, i32* %6
%15 = icmp eq i32 %0, 4
br i1 %15, label %19, label %16
16: ; preds = %2
%17 = load i32, i32* @stderr
%18 = tail call i32 (i32, i8*, ...) @fprintf(i32 %17, i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
br label %266
19: ; preds = %2
%20 = call i32 @memset(%struct.sockaddr_in* %5, i32 48, i32 24)
%21 = load i8*, i8** @AF_INET
%22 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 2
store i8* %21, i8** %22
%23 = load i32, i32* @INADDR_ANY
%24 = call i32 @htonl(i32 %23)
%25 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 0, i32 0
store i32 %24, i32* %25
%26 = getelementptr inbounds i8*, i8** %1, i64 3
%27 = load i8*, i8** %26
%28 = call i32 @atoi(i8* %27)
%29 = call i8* @htons(i32 %28)
%30 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %5, i64 0, i32 1
store i8* %29, i8** %30
%31 = load i8*, i8** @AF_INET
%32 = load i32, i32* @SOCK_STREAM
%33 = call i32 @socket(i8* %31, i32 %32, i32 0)
%34 = load i32, i32* @SOL_SOCKET
%35 = load i32, i32* @SO_REUSEADDR
%36 = call i32 @setsockopt(i32 %33, i32 %34, i32 %35, i8* %14, i32 4)
%37 = icmp slt i32 %36, 0
br i1 %37, label %38, label %42
38: ; preds = %19
%39 = call i32 @perror(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0))
%40 = call i32 @close(i32 %33)
%41 = call i32 @exit(i32 -1)
unreachable
42: ; preds = %19
%43 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
%44 = call i32 @bind(i32 %33, %struct.sockaddr* %43, i32 24)
%45 = icmp slt i32 %44, 0
br i1 %45, label %46, label %48
46: ; preds = %42
%47 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
br label %266
48: ; preds = %42
%49 = call i32 @listen(i32 %33, i32 10)
%50 = load i32, i32* @stderr
%51 = load i8*, i8** %26
%52 = call i32 (i32, i8*, ...) @fprintf(i32 %50, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.3, i64 0, i64 0), i8* %51)
%53 = call i32 @accept(i32 %33, %struct.sockaddr* null, i32* null)
%54 = load i64, i64* @FIONBIO
%55 = trunc i64 %54 to i32
%56 = call i64 @ioctl(i32 %53, i32 %55, i8* %14)
%57 = icmp eq i64 %56, 0
br i1 %57, label %61, label %58
58: ; preds = %48
%59 = load i32, i32* @stderr
%60 = call i32 (i32, i8*, ...) @fprintf(i32 %59, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
br label %61
61: ; preds = %58, %48
%62 = load i32, i32* @stderr
%63 = call i32 (i32, i8*, ...) @fprintf(i32 %62, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0))
%64 = call i32 @memset(%struct.sockaddr_in* %4, i32 48, i32 24)
%65 = load i8*, i8** @AF_INET
%66 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i8* %65, i8** %66
%67 = getelementptr inbounds i8*, i8** %1, i64 2
%68 = load i8*, i8** %67
%69 = call i32 @atoi(i8* %68)
%70 = call i8* @htons(i32 %69)
%71 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1
store i8* %70, i8** %71
%72 = load i8*, i8** @AF_INET
%73 = getelementptr inbounds i8*, i8** %1, i64 1
%74 = load i8*, i8** %73
%75 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
%76 = call i64 @inet_pton(i8* %72, i8* %74, %struct.TYPE_2__* %75)
%77 = icmp slt i64 %76, 1
br i1 %77, label %81, label %78
78: ; preds = %61
%79 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%80 = bitcast i32* %7 to i8*
br label %83
81: ; preds = %61
%82 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.17, i64 0, i64 0))
br label %266
83: ; preds = %78, %104
%84 = phi i64 [ 0, %78 ], [ %107, %104 ]
%85 = load i8*, i8** @AF_INET
%86 = load i32, i32* @SOCK_STREAM
%87 = call i32 @socket(i8* %85, i32 %86, i32 0)
%88 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 %84
store i32 %87, i32* %88
%89 = icmp slt i32 %87, 0
br i1 %89, label %90, label %92
90: ; preds = %83
%91 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str.16, i64 0, i64 0))
br label %266
92: ; preds = %83
%93 = call i64 @connect(i32 %87, %struct.sockaddr* %79, i32 24)
%94 = icmp slt i64 %93, 0
br i1 %94, label %95, label %97
95: ; preds = %92
%96 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.15, i64 0, i64 0))
br label %266
97: ; preds = %92
store i32 1, i32* %7
%98 = load i64, i64* @FIONBIO
%99 = trunc i64 %98 to i32
%100 = call i64 @ioctl(i32 %87, i32 %99, i8* %80)
%101 = icmp eq i64 %100, 0
br i1 %101, label %104, label %102
102: ; preds = %97
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str, i64 0, i64 0))
br label %104
104: ; preds = %102, %97
%105 = trunc i64 %84 to i32
%106 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.9, i64 0, i64 0), i32 %105)
%107 = add nuw nsw i64 %84, 1
%108 = icmp eq i64 %107, 5
br i1 %108, label %109, label %83
109: ; preds = %104
%110 = bitcast i32* %8 to i8*
%111 = call i32 @FD_ZERO(i32* %8)
%112 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%113 = load i32, i32* %112
%114 = call i32 @FD_SET(i32 %113, i32* %8)
%115 = icmp sgt i32 %113, 0
%116 = select i1 %115, i32 %113, i32 0
%117 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 1
%118 = load i32, i32* %117
%119 = call i32 @FD_SET(i32 %118, i32* %8)
%120 = icmp sgt i32 %118, %116
%121 = select i1 %120, i32 %118, i32 %116
%122 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 2
%123 = load i32, i32* %122
%124 = call i32 @FD_SET(i32 %123, i32* %8)
%125 = icmp sgt i32 %123, %121
%126 = select i1 %125, i32 %123, i32 %121
%127 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 3
%128 = load i32, i32* %127
%129 = call i32 @FD_SET(i32 %128, i32* %8)
%130 = icmp sgt i32 %128, %126
%131 = select i1 %130, i32 %128, i32 %126
%132 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 4
%133 = load i32, i32* %132
%134 = call i32 @FD_SET(i32 %133, i32* %8)
%135 = icmp sgt i32 %133, %131
%136 = select i1 %135, i32 %133, i32 %131
%137 = add nuw nsw i32 %136, 1
%138 = load i32, i32* @stderr
%139 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0), i32 %113, i32 %118, i32 %123, i32 %137)
%140 = call double (...) @get_time()
%141 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 0, i64 0
%142 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%143 = bitcast [5 x [1324 x i8]]* %9 to i32*
%144 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 0, i64 8
%145 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 1
%146 = bitcast [1324 x i8]* %145 to i32*
%147 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 1, i64 8
%148 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 2
%149 = bitcast [1324 x i8]* %148 to i32*
%150 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 2, i64 8
%151 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 3
%152 = bitcast [1324 x i8]* %151 to i32*
%153 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 3, i64 8
%154 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 4
%155 = bitcast [1324 x i8]* %154 to i32*
%156 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 4, i64 8
br label %157
157: ; preds = %260, %109
%158 = phi i32 [ %195, %260 ], [ 0, %109 ]
%159 = phi i32 [ %210, %260 ], [ 0, %109 ]
%160 = phi i32 [ %225, %260 ], [ 0, %109 ]
%161 = phi i32 [ %240, %260 ], [ 0, %109 ]
%162 = phi i32 [ %255, %260 ], [ 0, %109 ]
%163 = phi double [ %265, %260 ], [ %140, %109 ]
%164 = fadd double %163, 1.000000e+03
br label %165
165: ; preds = %157, %254
%166 = phi i32 [ %195, %254 ], [ %158, %157 ]
%167 = phi i32 [ %210, %254 ], [ %159, %157 ]
%168 = phi i32 [ %225, %254 ], [ %160, %157 ]
%169 = phi i32 [ %240, %254 ], [ %161, %157 ]
%170 = phi i32 [ %255, %254 ], [ %162, %157 ]
%171 = phi i32 [ %256, %254 ], [ 0, %157 ]
%172 = call i32 (i32, ...) @read(i32 %53, i8* %142, i64 1024)
%173 = icmp sgt i32 %172, 0
br i1 %173, label %174, label %180
174: ; preds = %165
%175 = load i32, i32* @stderr
%176 = call i32 (i32, i8*, ...) @fprintf(i32 %175, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.11, i64 0, i64 0), i32 %172)
%177 = call i32 @write(i32 %113, i8* %142, i32 %172)
%178 = load i32, i32* @stderr
%179 = call i32 (i32, i8*, ...) @fprintf(i32 %178, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.12, i64 0, i64 0), i32 %172, i32 %177)
br label %180
180: ; preds = %174, %165
%181 = call i32 @select(i32 %137, i32* %8, i32* null, i32* null, i32* null)
%182 = sext i32 %166 to i64
%183 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 0, i64 %182
%184 = sub nsw i32 1324, %166
%185 = call i32 (i32, ...) @read(i32 %113, i8* %183, i32 %184)
%186 = icmp sgt i32 %185, 0
br i1 %186, label %187, label %194
187: ; preds = %180
%188 = add nsw i32 %185, %171
%189 = add nsw i32 %185, %166
%190 = icmp eq i32 %189, 1324
br i1 %190, label %191, label %194
191: ; preds = %187
%192 = load i32, i32* %143
%193 = call i32 @add_to_queue(i32 %192, i8* %144)
br label %194
194: ; preds = %180, %191, %187
%195 = phi i32 [ 0, %191 ], [ %189, %187 ], [ %166, %180 ]
%196 = phi i32 [ %188, %191 ], [ %188, %187 ], [ %171, %180 ]
%197 = sext i32 %167 to i64
%198 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 1, i64 %197
%199 = sub nsw i32 1324, %167
%200 = call i32 (i32, ...) @read(i32 %118, i8* %198, i32 %199)
%201 = icmp sgt i32 %200, 0
br i1 %201, label %202, label %209
202: ; preds = %194
%203 = add nsw i32 %200, %196
%204 = add nsw i32 %200, %167
%205 = icmp eq i32 %204, 1324
br i1 %205, label %206, label %209
206: ; preds = %202
%207 = load i32, i32* %146
%208 = call i32 @add_to_queue(i32 %207, i8* %147)
br label %209
209: ; preds = %206, %202, %194
%210 = phi i32 [ 0, %206 ], [ %204, %202 ], [ %167, %194 ]
%211 = phi i32 [ %203, %206 ], [ %203, %202 ], [ %196, %194 ]
%212 = sext i32 %168 to i64
%213 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 2, i64 %212
%214 = sub nsw i32 1324, %168
%215 = call i32 (i32, ...) @read(i32 %123, i8* %213, i32 %214)
%216 = icmp sgt i32 %215, 0
br i1 %216, label %217, label %224
217: ; preds = %209
%218 = add nsw i32 %215, %211
%219 = add nsw i32 %215, %168
%220 = icmp eq i32 %219, 1324
br i1 %220, label %221, label %224
221: ; preds = %217
%222 = load i32, i32* %149
%223 = call i32 @add_to_queue(i32 %222, i8* %150)
br label %224
224: ; preds = %221, %217, %209
%225 = phi i32 [ 0, %221 ], [ %219, %217 ], [ %168, %209 ]
%226 = phi i32 [ %218, %221 ], [ %218, %217 ], [ %211, %209 ]
%227 = sext i32 %169 to i64
%228 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 3, i64 %227
%229 = sub nsw i32 1324, %169
%230 = call i32 (i32, ...) @read(i32 %128, i8* %228, i32 %229)
%231 = icmp sgt i32 %230, 0
br i1 %231, label %232, label %239
232: ; preds = %224
%233 = add nsw i32 %230, %226
%234 = add nsw i32 %230, %169
%235 = icmp eq i32 %234, 1324
br i1 %235, label %236, label %239
236: ; preds = %232
%237 = load i32, i32* %152
%238 = call i32 @add_to_queue(i32 %237, i8* %153)
br label %239
239: ; preds = %236, %232, %224
%240 = phi i32 [ 0, %236 ], [ %234, %232 ], [ %169, %224 ]
%241 = phi i32 [ %233, %236 ], [ %233, %232 ], [ %226, %224 ]
%242 = sext i32 %170 to i64
%243 = getelementptr inbounds [5 x [1324 x i8]], [5 x [1324 x i8]]* %9, i64 0, i64 4, i64 %242
%244 = sub nsw i32 1324, %170
%245 = call i32 (i32, ...) @read(i32 %133, i8* %243, i32 %244)
%246 = icmp sgt i32 %245, 0
br i1 %246, label %247, label %254
247: ; preds = %239
%248 = add nsw i32 %245, %241
%249 = add nsw i32 %245, %170
%250 = icmp eq i32 %249, 1324
br i1 %250, label %251, label %254
251: ; preds = %247
%252 = load i32, i32* %155
%253 = call i32 @add_to_queue(i32 %252, i8* %156)
br label %254
254: ; preds = %251, %247, %239
%255 = phi i32 [ 0, %251 ], [ %249, %247 ], [ %170, %239 ]
%256 = phi i32 [ %248, %251 ], [ %248, %247 ], [ %241, %239 ]
%257 = call i32 @empty_queue(i32 %53)
%258 = call double (...) @get_time()
%259 = fcmp ogt double %258, %164
br i1 %259, label %260, label %165
260: ; preds = %254
%261 = load i32, i32* @stderr
%262 = shl nsw i32 %256, 3
%263 = sdiv i32 %256, 1024
%264 = call i32 (i32, i8*, ...) @fprintf(i32 %261, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.14, i64 0, i64 0), i32 %262, i32 %263)
%265 = call double (...) @get_time()
br label %157
266: ; preds = %46, %81, %90, %95, %16
%267 = phi i32 [ 1, %16 ], [ 0, %46 ], [ 1, %81 ], [ 1, %90 ], [ 1, %95 ]
ret i32 %267
}