#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_4__ TYPE_2__;
typedef struct TYPE_3__ TYPE_1__;

/* Type definitions */
struct TYPE_3__ {
  int /*<<< orphan*/ s_addr;
};
struct sockaddr_in {
  int /*<<< orphan*/ sin_port;
  TYPE_1__ sin_addr;
  int /*<<< orphan*/ sin_family;
};
struct sockaddr {
  int dummy;
};
struct TYPE_4__ {
  int fd;
};
struct epoll_event {
  int events;
  TYPE_2__ data;
};
typedef int /*<<< orphan*/ socklen_t;
typedef int /*<<< orphan*/ local;

/* Variables and functions */
int /*<<< orphan*/ AF_INET;
int BUFSIZ;
scalar_t__ EAGAIN;
scalar_t__ ECONNABORTED;
scalar_t__ EINTR;
int EPOLLET;
int EPOLLIN;
int EPOLLOUT;
int /*<<< orphan*/ EPOLL_CTL_ADD;
int /*<<< orphan*/ EPOLL_CTL_MOD;
scalar_t__ EPROTO;
int EXIT_FAILURE;
int /*<<< orphan*/ INADDR_ANY;
int /*<<< orphan*/ SOCK_STREAM;
int accept(int, struct sockaddr *, int /*<<< orphan*/ *);
scalar_t__ bind(int, struct sockaddr *, int);
int /*<<< orphan*/ bzero(struct sockaddr_in *, int);
int /*<<< orphan*/ close(int);
int epoll_create(int);
int epoll_ctl(int, int /*<<< orphan*/, int, struct epoll_event *);
int epoll_wait(int, struct epoll_event *, int, int);
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ htonl(int /*<<< orphan*/);
int /*<<< orphan*/ htons(int);
int /*<<< orphan*/ listen(int, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, int, char *);
int read(int, char *, int);
int /*<<< orphan*/ setnonblocking(int);
int socket(int /*<<< orphan*/, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *, int);
int strlen(char *);
int write(int, char *, int);
int main() {
  struct epoll_event ev, events[10];
  int addrlen, listenfd, conn_sock, nfds, epfd, fd, i, nread, n;
  struct sockaddr_in local, remote;
  char buf[BUFSIZ];
  char my_buf[2048] = {0};
  char *my_ptr = my_buf;
  for (int i = 0; i < 2047; i++) {
    *my_ptr++ = 0x30 + i % 10;
  }
  printf("%d: %s", strlen(my_buf), my_buf);
  if ((listenfd = socket(AF_INET, SOCK_STREAM, 0)) < 0) {
    perror("sockfd\n");
    exit(1);
  }
  setnonblocking(listenfd);
  bzero(&local, sizeof(local));
  local.sin_family = AF_INET;
  local.sin_addr.s_addr = htonl(INADDR_ANY);
  local.sin_port = htons(8080);
  if (bind(listenfd, (struct sockaddr *)&local, sizeof(local)) < 0) {
    perror("bind\n");
    exit(1);
  }
  listen(listenfd, 20);
  epfd = epoll_create(10);
  if (epfd == -1) {
    perror("epoll_create");
    exit(EXIT_FAILURE);
  }
  ev.events = EPOLLIN;
  ev.data.fd = listenfd;
  if (epoll_ctl(epfd, EPOLL_CTL_ADD, listenfd, &ev) == -1) {
    perror("epoll_ctl: listen_sock");
    exit(EXIT_FAILURE);
  }
  for (;;) {
    nfds = epoll_wait(epfd, events, 10, -1);
    if (nfds == -1) {
      perror("epoll_pwait");
      exit(EXIT_FAILURE);
    }
    for (i = 0; i < nfds; ++i) {
      fd = events[i].data.fd;
      if (fd == listenfd) {
        while ((conn_sock = accept(listenfd, (struct sockaddr *)&remote,
                                   (socklen_t *)&addrlen)) > 0) {
          setnonblocking(conn_sock);
          ev.events = EPOLLIN | EPOLLET;
          ev.data.fd = conn_sock;
          if (epoll_ctl(epfd, EPOLL_CTL_ADD, conn_sock, &ev) == -1) {
            perror("epoll_ctl: add");
            exit(EXIT_FAILURE);
          }
        }
        if (conn_sock == -1) {
          if (errno != EAGAIN && errno != ECONNABORTED && errno != EPROTO &&
              errno != EINTR)
            perror("accept");
        }
        continue;
      }
      if (events[i].events & EPOLLIN) {
        n = 0;
        while ((nread = read(fd, buf + n, BUFSIZ - 1)) > 0) {
          n += nread;
        }
        if (nread == -1 && errno != EAGAIN) {
          perror("read error");
        }
        ev.data.fd = fd;
        ev.events = events[i].events | EPOLLOUT;
        if (epoll_ctl(epfd, EPOLL_CTL_MOD, fd, &ev) == -1) {
          perror("epoll_ctl: mod");
        }
      }
      if (events[i].events & EPOLLOUT) {
        sprintf(buf, "HTTP/1.1 200 OK\r\nContent-Length: %d\r\n\r\nHello World",
                11);
        int nwrite, data_size = strlen(my_buf);
        n = data_size;
        while (n > 0) {
          nwrite = write(fd, my_buf + data_size - n, n);
          if (nwrite < n) {
            if (nwrite == -1 && errno != EAGAIN) {
              perror("write error");
            }
            break;
          }
          n -= nwrite;
        }
        close(fd);
      }
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8d0,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2d47(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0xa8(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x8d0(%rbp)
mov    %rcx,%rsp
mov    %rax,-0xb0(%rbp)
lea    -0x8b0(%rbp),%rdi
xor    %esi,%esi
mov    $0x800,%edx
call   1080 <memset@plt>
lea    -0x8b0(%rbp),%rax
mov    %rax,-0x8b8(%rbp)
movl   $0x0,-0x8bc(%rbp)
cmpl   $0x7ff,-0x8bc(%rbp)
jge    1300 <main+0xc0>
mov    -0x8bc(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
add    $0x30,%edx
mov    %dl,%cl
mov    -0x8b8(%rbp),%rax
mov    %rax,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8b8(%rbp)
mov    %cl,(%rax)
mov    -0x8bc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8bc(%rbp)
jmp    12b2 <main+0x72>
lea    -0x8b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,%esi
lea    -0x8b0(%rbp),%rdx
lea    0xce4(%rip),%rdi
call   1060 <printf@plt>
mov    0x2cc0(%rip),%rax
mov    (%rax),%edi
mov    0x2c7f(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
mov    %eax,-0x68(%rbp)
cmp    $0x0,%eax
jge    135c <main+0x11c>
lea    0xcba(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x68(%rbp),%edi
call   10f0 <setnonblocking@plt>
lea    -0x90(%rbp),%rdi
mov    $0xc,%esi
call   1110 <bzero@plt>
mov    0x2c6c(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x88(%rbp)
mov    0x2c45(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x8c(%rbp)
mov    $0x1f90,%edi
call   1050 <htons@plt>
mov    %eax,-0x90(%rbp)
mov    -0x68(%rbp),%edi
lea    -0x90(%rbp),%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
cmp    $0x0,%rax
jge    13dc <main+0x19c>
lea    0xc42(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    -0x68(%rbp),%edi
mov    $0x14,%esi
call   10c0 <listen@plt>
mov    $0xa,%edi
call   1130 <epoll_create@plt>
mov    %eax,-0x74(%rbp)
cmpl   $0xffffffff,-0x74(%rbp)
jne    141a <main+0x1da>
lea    0xc0e(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b7d(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
mov    0x2bbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x68(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x74(%rbp),%edi
mov    0x2ba2(%rip),%rax
mov    (%rax),%esi
mov    -0x68(%rbp),%edx
lea    -0x10(%rbp),%rcx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    1467 <main+0x227>
lea    0xbce(%rip),%rdi
call   1100 <perror@plt>
mov    0x2b30(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
jmp    146c <main+0x22c>
mov    -0x74(%rbp),%edi
lea    -0x60(%rbp),%rsi
mov    $0xa,%edx
mov    $0xffffffff,%ecx
call   10d0 <epoll_wait@plt>
mov    %eax,-0x70(%rbp)
cmpl   $0xffffffff,-0x70(%rbp)
jne    14a9 <main+0x269>
lea    0xba3(%rip),%rdi
call   1100 <perror@plt>
mov    0x2aee(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
movl   $0x0,-0x7c(%rbp)
mov    -0x7c(%rbp),%eax
cmp    -0x70(%rbp),%eax
jge    17d6 <main+0x596>
movslq -0x7c(%rbp),%rax
mov    -0x5c(%rbp,%rax,8),%eax
mov    %eax,-0x78(%rbp)
mov    -0x78(%rbp),%eax
cmp    -0x68(%rbp),%eax
jne    15e2 <main+0x3a2>
jmp    14d8 <main+0x298>
mov    -0x68(%rbp),%edi
lea    -0xa0(%rbp),%rsi
lea    -0x64(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,-0x6c(%rbp)
cmp    $0x0,%eax
jle    155a <main+0x31a>
mov    -0x6c(%rbp),%edi
call   10f0 <setnonblocking@plt>
mov    0x2ada(%rip),%rax
mov    (%rax),%eax
mov    0x2a71(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0x6c(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x74(%rbp),%edi
mov    0x2ab4(%rip),%rax
mov    (%rax),%esi
mov    -0x6c(%rbp),%edx
lea    -0x10(%rbp),%rcx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    1555 <main+0x315>
lea    0xb03(%rip),%rdi
call   1100 <perror@plt>
mov    0x2a42(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>
jmp    14d8 <main+0x298>
cmpl   $0xffffffff,-0x6c(%rbp)
jne    15dd <main+0x39d>
mov    0x2a2d(%rip),%rax
mov    (%rax),%rax
mov    0x29f3(%rip),%rcx
cmp    (%rcx),%rax
je     15d8 <main+0x398>
mov    0x2a13(%rip),%rax
mov    (%rax),%rax
mov    0x29e9(%rip),%rcx
cmp    (%rcx),%rax
je     15d8 <main+0x398>
mov    0x29f9(%rip),%rax
mov    (%rax),%rax
mov    0x2a0f(%rip),%rcx
cmp    (%rcx),%rax
je     15d8 <main+0x398>
mov    0x29df(%rip),%rax
mov    (%rax),%rax
mov    0x29c5(%rip),%rcx
cmp    (%rcx),%rax
je     15d8 <main+0x398>
lea    0xa81(%rip),%rdi
call   1100 <perror@plt>
jmp    15dd <main+0x39d>
jmp    17c8 <main+0x588>
movslq -0x7c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%eax
mov    0x29ef(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     16c7 <main+0x487>
movl   $0x0,-0x84(%rbp)
mov    -0x8d0(%rbp),%rsi
mov    -0x78(%rbp),%edi
movslq -0x84(%rbp),%rax
add    %rax,%rsi
mov    0x297f(%rip),%rax
mov    (%rax),%edx
sub    $0x1,%edx
call   10b0 <read@plt>
mov    %eax,-0x80(%rbp)
cmp    $0x0,%eax
jle    164b <main+0x40b>
mov    -0x80(%rbp),%eax
add    -0x84(%rbp),%eax
mov    %eax,-0x84(%rbp)
jmp    1606 <main+0x3c6>
cmpl   $0xffffffff,-0x80(%rbp)
jne    167b <main+0x43b>
mov    0x293c(%rip),%rax
mov    (%rax),%rax
mov    0x2902(%rip),%rcx
cmp    (%rcx),%rax
je     167b <main+0x43b>
lea    0x9e5(%rip),%rdi
call   1100 <perror@plt>
mov    -0x78(%rbp),%eax
mov    %eax,-0xc(%rbp)
movslq -0x7c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%eax
mov    0x2918(%rip),%rcx
or     (%rcx),%eax
mov    %eax,-0x10(%rbp)
mov    -0x74(%rbp),%edi
mov    0x2921(%rip),%rax
mov    (%rax),%esi
mov    -0x78(%rbp),%edx
lea    -0x10(%rbp),%rcx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    16c2 <main+0x482>
lea    0x9a9(%rip),%rdi
call   1100 <perror@plt>
jmp    16c7 <main+0x487>
movslq -0x7c(%rbp),%rax
mov    -0x60(%rbp,%rax,8),%eax
mov    0x28d2(%rip),%rcx
and    (%rcx),%eax
cmp    $0x0,%eax
je     17c3 <main+0x583>
mov    -0x8d0(%rbp),%rdi
lea    0x986(%rip),%rsi
mov    $0xb,%edx
call   1140 <sprintf@plt>
lea    -0x8b0(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0x8c4(%rbp)
mov    -0x8c4(%rbp),%eax
mov    %eax,-0x84(%rbp)
cmpl   $0x0,-0x84(%rbp)
jle    17bb <main+0x57b>
mov    -0x78(%rbp),%edi
lea    -0x8b0(%rbp),%rsi
movslq -0x8c4(%rbp),%rax
add    %rax,%rsi
movslq -0x84(%rbp),%rcx
xor    %eax,%eax
sub    %rcx,%rax
add    %rax,%rsi
mov    -0x84(%rbp),%edx
call   1030 <write@plt>
mov    %eax,-0x8c0(%rbp)
mov    -0x8c0(%rbp),%eax
cmp    -0x84(%rbp),%eax
jge    17a2 <main+0x562>
cmpl   $0xffffffff,-0x8c0(%rbp)
jne    179d <main+0x55d>
mov    0x281a(%rip),%rax
mov    (%rax),%rax
mov    0x27e0(%rip),%rcx
cmp    (%rcx),%rax
je     179d <main+0x55d>
lea    0x910(%rip),%rdi
call   1100 <perror@plt>
jmp    17bb <main+0x57b>
mov    -0x8c0(%rbp),%ecx
mov    -0x84(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x84(%rbp)
jmp    1717 <main+0x4d7>
mov    -0x78(%rbp),%edi
call   1090 <close@plt>
jmp    17c8 <main+0x588>
mov    -0x7c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x7c(%rbp)
jmp    14b0 <main+0x270>
jmp    146c <main+0x22c>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x898,%rsp
mov    0x2d45(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r13
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r13
mov    %r13,%rsp
lea    -0x8c0(%rbp),%rdi
mov    $0x800,%edx
xor    %esi,%esi
call   1080 <memset@plt>
movdqa 0xd77(%rip),%xmm5
movdqa 0xd7f(%rip),%xmm4
mov    $0x10,%eax
movdqa 0xd82(%rip),%xmm2
movdqa 0xd8a(%rip),%xmm3
movdqa 0xd91(%rip),%xmm8
movdqa 0xd98(%rip),%xmm9
movdqa 0xda0(%rip),%xmm6
movdqa %xmm4,%xmm7
pmulhuw %xmm2,%xmm7
psrlw  $0x3,%xmm7
pmullw %xmm3,%xmm7
movdqa %xmm4,%xmm1
psubw  %xmm7,%xmm1
movdqa %xmm5,%xmm7
pmulhuw %xmm2,%xmm7
psrlw  $0x3,%xmm7
pmullw %xmm3,%xmm7
movdqa %xmm5,%xmm0
psubw  %xmm7,%xmm0
packuswb %xmm0,%xmm1
por    %xmm8,%xmm1
movdqa %xmm1,-0x8d0(%rbp,%rax,1)
ff ff
cmp    $0x7f0,%rax
je     136b <main+0x12b>
movdqa %xmm5,%xmm0
paddw  %xmm9,%xmm0
movdqa %xmm4,%xmm1
paddw  %xmm9,%xmm1
movdqa %xmm1,%xmm7
pmulhuw %xmm2,%xmm7
psrlw  $0x3,%xmm7
pmullw %xmm3,%xmm7
psubw  %xmm7,%xmm1
movdqa %xmm0,%xmm7
pmulhuw %xmm2,%xmm7
psrlw  $0x3,%xmm7
pmullw %xmm3,%xmm7
psubw  %xmm7,%xmm0
packuswb %xmm0,%xmm1
por    %xmm8,%xmm1
movdqa %xmm1,-0x8c0(%rbp,%rax,1)
ff ff
paddw  %xmm6,%xmm4
paddw  %xmm6,%xmm5
add    $0x20,%rax
jmp    12c0 <main+0x80>
movabs $0x3938373635343332,%rax
37 38 39
mov    %rax,-0xd0(%rbp)
movl   $0x33323130,-0xc8(%rbp)
31 32 33
movw   $0x3534,-0xc4(%rbp)
34 35
movb   $0x36,-0xc2(%rbp)
lea    -0x8c0(%rbp),%rbx
mov    %rbx,%rdi
call   1040 <strlen@plt>
lea    0xcc4(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1060 <printf@plt>
mov    0x2c2b(%rip),%rbx
mov    (%rbx),%edi
mov    0x2bea(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1160 <socket@plt>
test   %eax,%eax
jns    13dc <main+0x19c>
lea    0xc9d(%rip),%rdi
jmp    1436 <main+0x1f6>
mov    %eax,%r15d
mov    %eax,%edi
call   10f0 <setnonblocking@plt>
lea    -0x58(%rbp),%r14
mov    %r14,%rdi
mov    $0xc,%esi
call   1110 <bzero@plt>
mov    (%rbx),%eax
mov    %eax,-0x50(%rbp)
mov    0x2bcd(%rip),%rax
mov    (%rax),%edi
call   1070 <htonl@plt>
mov    %eax,-0x54(%rbp)
mov    $0x1f90,%edi
call   1050 <htons@plt>
mov    %eax,-0x58(%rbp)
mov    %r15d,%edi
mov    %r14,%rsi
mov    $0xc,%edx
call   10e0 <bind@plt>
test   %rax,%rax
jns    1445 <main+0x205>
lea    0xc49(%rip),%rdi
call   1100 <perror@plt>
mov    $0x1,%edi
call   1150 <exit@plt>
mov    %r13,-0x48(%rbp)
mov    %r15d,%edi
mov    $0x14,%esi
call   10c0 <listen@plt>
mov    $0xa,%edi
call   1130 <epoll_create@plt>
cmp    $0xffffffff,%eax
jne    1471 <main+0x231>
lea    0xc19(%rip),%rdi
jmp    178c <main+0x54c>
mov    %eax,%r13d
mov    0x2b65(%rip),%r12
mov    (%r12),%eax
mov    %eax,-0x30(%rbp)
mov    %r15d,-0x2c(%rbp)
mov    0x2b4b(%rip),%rax
mov    (%rax),%esi
lea    -0x30(%rbp),%rcx
mov    %r13d,%edi
mov    %r15d,%edx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    14af <main+0x26f>
lea    0xbe8(%rip),%rdi
jmp    178c <main+0x54c>
lea    -0xc0(%rbp),%rsi
mov    %r13d,%edi
mov    $0xa,%edx
mov    $0xffffffff,%ecx
call   10d0 <epoll_wait@plt>
cmp    $0xffffffff,%eax
jne    14d9 <main+0x299>
lea    0xbd5(%rip),%rdi
jmp    178c <main+0x54c>
mov    %r15d,-0x3c(%rbp)
jmp    14fe <main+0x2be>
nop
mov    %r13d,%edi
lea    -0xc0(%rbp),%rsi
mov    $0xa,%edx
mov    $0xffffffff,%ecx
call   10d0 <epoll_wait@plt>
cmp    $0xffffffff,%eax
je     14cd <main+0x28d>
test   %eax,%eax
jle    14e0 <main+0x2a0>
mov    %eax,%eax
mov    %rax,-0x60(%rbp)
xor    %ebx,%ebx
jmp    153d <main+0x2fd>
cmp    $0xffffffff,%eax
je     1738 <main+0x4f8>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r14d,%edi
call   1090 <close@plt>
mov    0x2ab1(%rip),%r12
mov    -0x38(%rbp),%rbx
add    $0x1,%rbx
cmp    -0x60(%rbp),%rbx
je     14e0 <main+0x2a0>
mov    -0xbc(%rbp,%rbx,8),%r14d
ff
cmp    %r15d,%r14d
mov    %rbx,-0x38(%rbp)
jne    15b0 <main+0x370>
mov    0x2a83(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15d,%edi
lea    -0x70(%rbp),%rsi
lea    -0x64(%rbp),%rdx
call   1120 <accept@plt>
mov    %eax,%ebx
test   %eax,%eax
jle    16d0 <main+0x490>
mov    %ebx,%edi
call   10f0 <setnonblocking@plt>
mov    0x29f8(%rip),%rax
mov    (%rax),%eax
or     (%r12),%eax
mov    %eax,-0x30(%rbp)
mov    %ebx,-0x2c(%rbp)
mov    (%r14),%esi
mov    %r13d,%edi
mov    %ebx,%edx
lea    -0x30(%rbp),%rcx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
jne    1560 <main+0x320>
jmp    1785 <main+0x545>
nop
mov    (%r12),%eax
test   %eax,-0xc0(%rbp,%rbx,8)
je     1651 <main+0x411>
xor    %ebx,%ebx
mov    -0x48(%rbp),%r12
mov    0x29d2(%rip),%r15
xchg   %ax,%ax
movslq %ebx,%rbx
lea    (%r12,%rbx,1),%rsi
mov    (%r15),%edx
add    $0xffffffff,%edx
mov    %r14d,%edi
call   10b0 <read@plt>
add    %eax,%ebx
test   %eax,%eax
jg     15d0 <main+0x390>
cmp    $0xffffffff,%eax
jne    160a <main+0x3ca>
mov    0x29a1(%rip),%rax
mov    (%rax),%rax
mov    0x2967(%rip),%rcx
cmp    (%rcx),%rax
jne    1774 <main+0x534>
mov    %r14d,-0x2c(%rbp)
mov    0x2993(%rip),%rax
mov    (%rax),%eax
mov    -0x38(%rbp),%rbx
or     -0xc0(%rbp,%rbx,8),%eax
mov    %eax,-0x30(%rbp)
mov    0x2994(%rip),%rax
mov    (%rax),%esi
mov    %r13d,%edi
mov    %r14d,%edx
lea    -0x30(%rbp),%rcx
call   10a0 <epoll_ctl@plt>
cmp    $0xffffffff,%eax
mov    -0x3c(%rbp),%r15d
mov    0x2995(%rip),%r12
je     1763 <main+0x523>
mov    0x2950(%rip),%rax
mov    (%rax),%eax
test   %eax,-0xc0(%rbp,%rbx,8)
je     1533 <main+0x2f3>
mov    -0x48(%rbp),%rdi
lea    0xa73(%rip),%rsi
mov    $0xb,%edx
call   1140 <sprintf@plt>
lea    -0x8c0(%rbp),%rdi
call   1040 <strlen@plt>
test   %eax,%eax
jle    1520 <main+0x2e0>
mov    %eax,%r12d
mov    %eax,%eax
lea    (%rax,%rbp,1),%rbx
add    $0xfffffffffffff740,%rbx
mov    %r12d,%eax
mov    %rbx,%rsi
sub    %rax,%rsi
mov    %r14d,%edi
mov    %r12d,%edx
call   1030 <write@plt>
sub    %eax,%r12d
jg     150c <main+0x2cc>
test   %r12d,%r12d
jg     16a0 <main+0x460>
jmp    1520 <main+0x2e0>
nopw   0x0(%rax,%rax,1)
cmp    $0xffffffff,%ebx
mov    -0x38(%rbp),%rbx
jne    1533 <main+0x2f3>
mov    0x28b4(%rip),%rax
mov    (%rax),%rax
mov    0x287a(%rip),%rcx
cmp    (%rcx),%rax
je     1533 <main+0x2f3>
mov    0x287a(%rip),%rcx
cmp    (%rcx),%rax
je     1533 <main+0x2f3>
mov    0x28aa(%rip),%rcx
cmp    (%rcx),%rax
je     1533 <main+0x2f3>
mov    0x286a(%rip),%rcx
cmp    (%rcx),%rax
je     1533 <main+0x2f3>
lea    0x996(%rip),%rdi
call   1100 <perror@plt>
jmp    1533 <main+0x2f3>
mov    0x2859(%rip),%rax
mov    (%rax),%rax
mov    0x281f(%rip),%rcx
cmp    (%rcx),%rax
je     1520 <main+0x2e0>
lea    0x9bf(%rip),%rdi
call   1100 <perror@plt>
jmp    1520 <main+0x2e0>
lea    0x96c(%rip),%rdi
call   1100 <perror@plt>
jmp    1651 <main+0x411>
lea    0x950(%rip),%rdi
call   1100 <perror@plt>
jmp    160a <main+0x3ca>
lea    0x929(%rip),%rdi
call   1100 <perror@plt>
mov    0x27f8(%rip),%rax
mov    (%rax),%edi
call   1150 <exit@plt>

LLVM IR (-O0):
%struct.epoll_event = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_3__, i32 }
%struct.TYPE_3__ = type { i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@.str = [7 x i8] c"%d: %s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [8 x i8] c"sockfd\0A\00"
@INADDR_ANY = global i32 0
@.str.2 = [6 x i8] c"bind\0A\00"
@.str.3 = [13 x i8] c"epoll_create\00"
@EXIT_FAILURE = global i32 0
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [23 x i8] c"epoll_ctl: listen_sock\00"
@.str.5 = [12 x i8] c"epoll_pwait\00"
@EPOLLET = global i32 0
@.str.6 = [15 x i8] c"epoll_ctl: add\00"
@errno = global i64 0
@EAGAIN = global i64 0
@ECONNABORTED = global i64 0
@EPROTO = global i64 0
@EINTR = global i64 0
@.str.7 = [7 x i8] c"accept\00"
@.str.8 = [11 x i8] c"read error\00"
@EPOLLOUT = global i32 0
@EPOLL_CTL_MOD = global i32 0
@.str.9 = [15 x i8] c"epoll_ctl: mod\00"
@.str.10 = [51 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Length: %d\0D\0A\0D\0AHello World\00"
@.str.11 = [12 x i8] c"write error\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca %struct.epoll_event
%3 = alloca [10 x %struct.epoll_event]
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca %struct.sockaddr_in
%14 = alloca %struct.sockaddr_in
%15 = alloca i8*
%16 = alloca i64
%17 = alloca [2048 x i8]
%18 = alloca i8*
%19 = alloca i32
%20 = alloca i32
%21 = alloca i32
store i32 0, i32* %1
%22 = load i32, i32* @BUFSIZ
%23 = zext i32 %22 to i64
%24 = call i8* @llvm.stacksave()
store i8* %24, i8** %15
%25 = alloca i8, i64 %23
store i64 %23, i64* %16
%26 = bitcast [2048 x i8]* %17 to i8*
%27 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
store i8* %27, i8** %18
store i32 0, i32* %19
br label %28
28: ; preds = %38, %0
%29 = load i32, i32* %19
%30 = icmp slt i32 %29, 2047
br i1 %30, label %31, label %41
31: ; preds = %28
%32 = load i32, i32* %19
%33 = srem i32 %32, 10
%34 = add nsw i32 48, %33
%35 = trunc i32 %34 to i8
%36 = load i8*, i8** %18
%37 = getelementptr inbounds i8, i8* %36, i32 1
store i8* %37, i8** %18
store i8 %35, i8* %36
br label %38
38: ; preds = %31
%39 = load i32, i32* %19
%40 = add nsw i32 %39, 1
store i32 %40, i32* %19
br label %28
41: ; preds = %28
%42 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%43 = call i32 @strlen(i8* %42)
%44 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%45 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %43, i8* %44)
%46 = load i32, i32* @AF_INET
%47 = load i32, i32* @SOCK_STREAM
%48 = call i32 @socket(i32 %46, i32 %47, i32 0)
store i32 %48, i32* %5
%49 = icmp slt i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %41
%51 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%52 = call i32 @exit(i32 1)
unreachable
53: ; preds = %41
%54 = load i32, i32* %5
%55 = call i32 @setnonblocking(i32 %54)
%56 = call i32 @bzero(%struct.sockaddr_in* %13, i32 12)
%57 = load i32, i32* @AF_INET
%58 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 2
store i32 %57, i32* %58
%59 = load i32, i32* @INADDR_ANY
%60 = call i32 @htonl(i32 %59)
%61 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 1
%62 = getelementptr inbounds %struct.TYPE_3__, %struct.TYPE_3__* %61, i32 0, i32 0
store i32 %60, i32* %62
%63 = call i32 @htons(i32 8080)
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %13, i32 0, i32 0
store i32 %63, i32* %64
%65 = load i32, i32* %5
%66 = bitcast %struct.sockaddr_in* %13 to %struct.sockaddr*
%67 = call i64 @bind(i32 %65, %struct.sockaddr* %66, i32 12)
%68 = icmp slt i64 %67, 0
br i1 %68, label %69, label %72
69: ; preds = %53
%70 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%71 = call i32 @exit(i32 1)
unreachable
72: ; preds = %53
%73 = load i32, i32* %5
%74 = call i32 @listen(i32 %73, i32 20)
%75 = call i32 @epoll_create(i32 10)
store i32 %75, i32* %8
%76 = load i32, i32* %8
%77 = icmp eq i32 %76, -1
br i1 %77, label %78, label %82
78: ; preds = %72
%79 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%80 = load i32, i32* @EXIT_FAILURE
%81 = call i32 @exit(i32 %80)
unreachable
82: ; preds = %72
%83 = load i32, i32* @EPOLLIN
%84 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 0
store i32 %83, i32* %84
%85 = load i32, i32* %5
%86 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 1
%87 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %86, i32 0, i32 0
store i32 %85, i32* %87
%88 = load i32, i32* %8
%89 = load i32, i32* @EPOLL_CTL_ADD
%90 = load i32, i32* %5
%91 = call i32 @epoll_ctl(i32 %88, i32 %89, i32 %90, %struct.epoll_event* %2)
%92 = icmp eq i32 %91, -1
br i1 %92, label %93, label %97
93: ; preds = %82
%94 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%95 = load i32, i32* @EXIT_FAILURE
%96 = call i32 @exit(i32 %95)
unreachable
97: ; preds = %82
br label %98
98: ; preds = %277, %97
%99 = load i32, i32* %8
%100 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %3, i64 0, i64 0
%101 = call i32 @epoll_wait(i32 %99, %struct.epoll_event* %100, i32 10, i32 -1)
store i32 %101, i32* %7
%102 = load i32, i32* %7
%103 = icmp eq i32 %102, -1
br i1 %103, label %104, label %108
104: ; preds = %98
%105 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%106 = load i32, i32* @EXIT_FAILURE
%107 = call i32 @exit(i32 %106)
unreachable
108: ; preds = %98
store i32 0, i32* %10
br label %109
109: ; preds = %274, %108
%110 = load i32, i32* %10
%111 = load i32, i32* %7
%112 = icmp slt i32 %110, %111
br i1 %112, label %113, label %277
113: ; preds = %109
%114 = load i32, i32* %10
%115 = sext i32 %114 to i64
%116 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %3, i64 0, i64 %115
%117 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %116, i32 0, i32 1
%118 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %117, i32 0, i32 0
%119 = load i32, i32* %118
store i32 %119, i32* %9
%120 = load i32, i32* %9
%121 = load i32, i32* %5
%122 = icmp eq i32 %120, %121
br i1 %122, label %123, label %172
123: ; preds = %113
br label %124
124: ; preds = %148, %123
%125 = load i32, i32* %5
%126 = bitcast %struct.sockaddr_in* %14 to %struct.sockaddr*
%127 = call i32 @accept(i32 %125, %struct.sockaddr* %126, i32* %4)
store i32 %127, i32* %6
%128 = icmp sgt i32 %127, 0
br i1 %128, label %129, label %149
129: ; preds = %124
%130 = load i32, i32* %6
%131 = call i32 @setnonblocking(i32 %130)
%132 = load i32, i32* @EPOLLIN
%133 = load i32, i32* @EPOLLET
%134 = or i32 %132, %133
%135 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 0
store i32 %134, i32* %135
%136 = load i32, i32* %6
%137 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 1
%138 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %137, i32 0, i32 0
store i32 %136, i32* %138
%139 = load i32, i32* %8
%140 = load i32, i32* @EPOLL_CTL_ADD
%141 = load i32, i32* %6
%142 = call i32 @epoll_ctl(i32 %139, i32 %140, i32 %141, %struct.epoll_event* %2)
%143 = icmp eq i32 %142, -1
br i1 %143, label %144, label %148
144: ; preds = %129
%145 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%146 = load i32, i32* @EXIT_FAILURE
%147 = call i32 @exit(i32 %146)
unreachable
148: ; preds = %129
br label %124
149: ; preds = %124
%150 = load i32, i32* %6
%151 = icmp eq i32 %150, -1
br i1 %151, label %152, label %171
152: ; preds = %149
%153 = load i64, i64* @errno
%154 = load i64, i64* @EAGAIN
%155 = icmp ne i64 %153, %154
br i1 %155, label %156, label %170
156: ; preds = %152
%157 = load i64, i64* @errno
%158 = load i64, i64* @ECONNABORTED
%159 = icmp ne i64 %157, %158
br i1 %159, label %160, label %170
160: ; preds = %156
%161 = load i64, i64* @errno
%162 = load i64, i64* @EPROTO
%163 = icmp ne i64 %161, %162
br i1 %163, label %164, label %170
164: ; preds = %160
%165 = load i64, i64* @errno
%166 = load i64, i64* @EINTR
%167 = icmp ne i64 %165, %166
br i1 %167, label %168, label %170
168: ; preds = %164
%169 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %170
170: ; preds = %168, %164, %160, %156, %152
br label %171
171: ; preds = %170, %149
br label %274
172: ; preds = %113
%173 = load i32, i32* %10
%174 = sext i32 %173 to i64
%175 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %3, i64 0, i64 %174
%176 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %175, i32 0, i32 0
%177 = load i32, i32* %176
%178 = load i32, i32* @EPOLLIN
%179 = and i32 %177, %178
%180 = icmp ne i32 %179, 0
br i1 %180, label %181, label %224
181: ; preds = %172
store i32 0, i32* %12
br label %182
182: ; preds = %191, %181
%183 = load i32, i32* %9
%184 = load i32, i32* %12
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds i8, i8* %25, i64 %185
%187 = load i32, i32* @BUFSIZ
%188 = sub nsw i32 %187, 1
%189 = call i32 @read(i32 %183, i8* %186, i32 %188)
store i32 %189, i32* %11
%190 = icmp sgt i32 %189, 0
br i1 %190, label %191, label %195
191: ; preds = %182
%192 = load i32, i32* %11
%193 = load i32, i32* %12
%194 = add nsw i32 %193, %192
store i32 %194, i32* %12
br label %182
195: ; preds = %182
%196 = load i32, i32* %11
%197 = icmp eq i32 %196, -1
br i1 %197, label %198, label %204
198: ; preds = %195
%199 = load i64, i64* @errno
%200 = load i64, i64* @EAGAIN
%201 = icmp ne i64 %199, %200
br i1 %201, label %202, label %204
202: ; preds = %198
%203 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %204
204: ; preds = %202, %198, %195
%205 = load i32, i32* %9
%206 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 1
%207 = getelementptr inbounds %struct.TYPE_4__, %struct.TYPE_4__* %206, i32 0, i32 0
store i32 %205, i32* %207
%208 = load i32, i32* %10
%209 = sext i32 %208 to i64
%210 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %3, i64 0, i64 %209
%211 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %210, i32 0, i32 0
%212 = load i32, i32* %211
%213 = load i32, i32* @EPOLLOUT
%214 = or i32 %212, %213
%215 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %2, i32 0, i32 0
store i32 %214, i32* %215
%216 = load i32, i32* %8
%217 = load i32, i32* @EPOLL_CTL_MOD
%218 = load i32, i32* %9
%219 = call i32 @epoll_ctl(i32 %216, i32 %217, i32 %218, %struct.epoll_event* %2)
%220 = icmp eq i32 %219, -1
br i1 %220, label %221, label %223
221: ; preds = %204
%222 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %223
223: ; preds = %221, %204
br label %224
224: ; preds = %223, %172
%225 = load i32, i32* %10
%226 = sext i32 %225 to i64
%227 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %3, i64 0, i64 %226
%228 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %227, i32 0, i32 0
%229 = load i32, i32* %228
%230 = load i32, i32* @EPOLLOUT
%231 = and i32 %229, %230
%232 = icmp ne i32 %231, 0
br i1 %232, label %233, label %273
233: ; preds = %224
%234 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.10, i64 0, i64 0), i32 11)
%235 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%236 = call i32 @strlen(i8* %235)
store i32 %236, i32* %21
%237 = load i32, i32* %21
store i32 %237, i32* %12
br label %238
238: ; preds = %266, %233
%239 = load i32, i32* %12
%240 = icmp sgt i32 %239, 0
br i1 %240, label %241, label %270
241: ; preds = %238
%242 = load i32, i32* %9
%243 = getelementptr inbounds [2048 x i8], [2048 x i8]* %17, i64 0, i64 0
%244 = load i32, i32* %21
%245 = sext i32 %244 to i64
%246 = getelementptr inbounds i8, i8* %243, i64 %245
%247 = load i32, i32* %12
%248 = sext i32 %247 to i64
%249 = sub i64 0, %248
%250 = getelementptr inbounds i8, i8* %246, i64 %249
%251 = load i32, i32* %12
%252 = call i32 @write(i32 %242, i8* %250, i32 %251)
store i32 %252, i32* %20
%253 = load i32, i32* %20
%254 = load i32, i32* %12
%255 = icmp slt i32 %253, %254
br i1 %255, label %256, label %266
256: ; preds = %241
%257 = load i32, i32* %20
%258 = icmp eq i32 %257, -1
br i1 %258, label %259, label %265
259: ; preds = %256
%260 = load i64, i64* @errno
%261 = load i64, i64* @EAGAIN
%262 = icmp ne i64 %260, %261
br i1 %262, label %263, label %265
263: ; preds = %259
%264 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
br label %265
265: ; preds = %263, %259, %256
br label %270
266: ; preds = %241
%267 = load i32, i32* %20
%268 = load i32, i32* %12
%269 = sub nsw i32 %268, %267
store i32 %269, i32* %12
br label %238
270: ; preds = %265, %238
%271 = load i32, i32* %9
%272 = call i32 @close(i32 %271)
br label %273
273: ; preds = %270, %224
br label %274
274: ; preds = %273, %171
%275 = load i32, i32* %10
%276 = add nsw i32 %275, 1
store i32 %276, i32* %10
br label %109
277: ; preds = %109
br label %98
}

LLVM IR (-O2):
%struct.epoll_event = type { i32, %struct.TYPE_4__ }
%struct.TYPE_4__ = type { i32 }
%struct.sockaddr_in = type { i32, %struct.TYPE_3__, i32 }
%struct.TYPE_3__ = type { i32 }
%struct.sockaddr = type { i32 }
@BUFSIZ = global i32 0
@.str = [7 x i8] c"%d: %s\00"
@AF_INET = global i32 0
@SOCK_STREAM = global i32 0
@.str.1 = [8 x i8] c"sockfd\0A\00"
@INADDR_ANY = global i32 0
@.str.2 = [6 x i8] c"bind\0A\00"
@.str.3 = [13 x i8] c"epoll_create\00"
@EXIT_FAILURE = global i32 0
@EPOLLIN = global i32 0
@EPOLL_CTL_ADD = global i32 0
@.str.4 = [23 x i8] c"epoll_ctl: listen_sock\00"
@.str.5 = [12 x i8] c"epoll_pwait\00"
@EPOLLET = global i32 0
@.str.6 = [15 x i8] c"epoll_ctl: add\00"
@errno = global i64 0
@EAGAIN = global i64 0
@ECONNABORTED = global i64 0
@EPROTO = global i64 0
@EINTR = global i64 0
@.str.7 = [7 x i8] c"accept\00"
@.str.8 = [11 x i8] c"read error\00"
@EPOLLOUT = global i32 0
@EPOLL_CTL_MOD = global i32 0
@.str.9 = [15 x i8] c"epoll_ctl: mod\00"
@.str.10 = [51 x i8] c"HTTP/1.1 200 OK\0D\0AContent-Length: %d\0D\0A\0D\0AHello World\00"
@.str.11 = [12 x i8] c"write error\00"
define i32 @main() {
%1 = alloca %struct.epoll_event
%2 = alloca [10 x %struct.epoll_event]
%3 = alloca i32
%4 = alloca %struct.sockaddr_in
%5 = alloca %struct.sockaddr_in
%6 = alloca [2048 x i8]
%7 = bitcast %struct.epoll_event* %1 to i8*
%8 = bitcast [10 x %struct.epoll_event]* %2 to i8*
%9 = bitcast i32* %3 to i8*
%10 = bitcast %struct.sockaddr_in* %4 to i8*
%11 = bitcast %struct.sockaddr_in* %5 to i8*
%12 = load i32, i32* @BUFSIZ
%13 = zext i32 %12 to i64
%14 = alloca i8, i64 %13
%15 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 0
%16 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2032
br label %17
17: ; preds = %27, %0
%18 = phi i64 [ 0, %0 ], [ %34, %27 ]
%19 = phi <16 x i16> [ <i16 0, i16 1, i16 2, i16 3, i16 4, i16 5, i16 6, i16 7, i16 8, i16 9, i16 10, i16 11, i16 12, i16 13, i16 14, i16 15>, %0 ], [ %35, %27 ]
%20 = getelementptr [2048 x i8], [2048 x i8]* %6, i64 0, i64 %18
%21 = urem <16 x i16> %19, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
%22 = trunc <16 x i16> %21 to <16 x i8>
%23 = or <16 x i8> %22, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%24 = bitcast i8* %20 to <16 x i8>*
store <16 x i8> %23, <16 x i8>* %24
%25 = or i64 %18, 16
%26 = icmp eq i64 %25, 2032
br i1 %26, label %36, label %27
27: ; preds = %17
%28 = add <16 x i16> %19, <i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16, i16 16>
%29 = getelementptr [2048 x i8], [2048 x i8]* %6, i64 0, i64 %25
%30 = urem <16 x i16> %28, <i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10, i16 10>
%31 = trunc <16 x i16> %30 to <16 x i8>
%32 = or <16 x i8> %31, <i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48, i8 48>
%33 = bitcast i8* %29 to <16 x i8>*
store <16 x i8> %32, <16 x i8>* %33
%34 = add nuw nsw i64 %18, 32
%35 = add <16 x i16> %19, <i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32, i16 32>
br label %17
36: ; preds = %17
%37 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2033
store i8 50, i8* %16
%38 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2034
store i8 51, i8* %37
%39 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2035
store i8 52, i8* %38
%40 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2036
store i8 53, i8* %39
%41 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2037
store i8 54, i8* %40
%42 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2038
store i8 55, i8* %41
%43 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2039
store i8 56, i8* %42
%44 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2040
store i8 57, i8* %43
%45 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2041
store i8 48, i8* %44
%46 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2042
store i8 49, i8* %45
%47 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2043
store i8 50, i8* %46
%48 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2044
store i8 51, i8* %47
%49 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2045
store i8 52, i8* %48
%50 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 2046
store i8 53, i8* %49
store i8 54, i8* %50
%51 = call i32 @strlen(i8* %15)
%52 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %51, i8* %15)
%53 = load i32, i32* @AF_INET
%54 = load i32, i32* @SOCK_STREAM
%55 = call i32 @socket(i32 %53, i32 %54, i32 0)
%56 = icmp slt i32 %55, 0
br i1 %56, label %57, label %60
57: ; preds = %36
%58 = call i32 @perror(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
%59 = call i32 @exit(i32 1)
unreachable
60: ; preds = %36
%61 = call i32 @setnonblocking(i32 %55)
%62 = call i32 @bzero(%struct.sockaddr_in* %4, i32 12)
%63 = load i32, i32* @AF_INET
%64 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 2
store i32 %63, i32* %64
%65 = load i32, i32* @INADDR_ANY
%66 = call i32 @htonl(i32 %65)
%67 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 1, i32 0
store i32 %66, i32* %67
%68 = call i32 @htons(i32 8080)
%69 = getelementptr inbounds %struct.sockaddr_in, %struct.sockaddr_in* %4, i64 0, i32 0
store i32 %68, i32* %69
%70 = bitcast %struct.sockaddr_in* %4 to %struct.sockaddr*
%71 = call i64 @bind(i32 %55, %struct.sockaddr* %70, i32 12)
%72 = icmp slt i64 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %60
%74 = call i32 @perror(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
%75 = call i32 @exit(i32 1)
unreachable
76: ; preds = %60
%77 = call i32 @listen(i32 %55, i32 20)
%78 = call i32 @epoll_create(i32 10)
%79 = icmp eq i32 %78, -1
br i1 %79, label %80, label %84
80: ; preds = %76
%81 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0))
%82 = load i32, i32* @EXIT_FAILURE
%83 = call i32 @exit(i32 %82)
unreachable
84: ; preds = %76
%85 = load i32, i32* @EPOLLIN
%86 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %1, i64 0, i32 0
store i32 %85, i32* %86
%87 = getelementptr inbounds %struct.epoll_event, %struct.epoll_event* %1, i64 0, i32 1, i32 0
store i32 %55, i32* %87
%88 = load i32, i32* @EPOLL_CTL_ADD
%89 = call i32 @epoll_ctl(i32 %78, i32 %88, i32 %55, %struct.epoll_event* %1)
%90 = icmp eq i32 %89, -1
br i1 %90, label %97, label %91
91: ; preds = %84
%92 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %2, i64 0, i64 0
%93 = call i32 @epoll_wait(i32 %78, %struct.epoll_event* %92, i32 10, i32 -1)
%94 = icmp eq i32 %93, -1
br i1 %94, label %109, label %95
95: ; preds = %91
%96 = bitcast %struct.sockaddr_in* %5 to %struct.sockaddr*
br label %104
97: ; preds = %84
%98 = call i32 @perror(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0))
%99 = load i32, i32* @EXIT_FAILURE
%100 = call i32 @exit(i32 %99)
unreachable
101: ; preds = %214, %104
%102 = call i32 @epoll_wait(i32 %78, %struct.epoll_event* %92, i32 10, i32 -1)
%103 = icmp eq i32 %102, -1
br i1 %103, label %109, label %104
104: ; preds = %95, %101
%105 = phi i32 [ %93, %95 ], [ %102, %101 ]
%106 = icmp sgt i32 %105, 0
br i1 %106, label %107, label %101
107: ; preds = %104
%108 = zext i32 %105 to i64
br label %113
109: ; preds = %101, %91
%110 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.5, i64 0, i64 0))
%111 = load i32, i32* @EXIT_FAILURE
%112 = call i32 @exit(i32 %111)
unreachable
113: ; preds = %107, %214
%114 = phi i64 [ 0, %107 ], [ %215, %214 ]
%115 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %2, i64 0, i64 %114, i32 1, i32 0
%116 = load i32, i32* %115
%117 = icmp eq i32 %116, %55
br i1 %117, label %118, label %150
118: ; preds = %113, %121
%119 = call i32 @accept(i32 %55, %struct.sockaddr* %96, i32* %3)
%120 = icmp sgt i32 %119, 0
br i1 %120, label %121, label %133
121: ; preds = %118
%122 = call i32 @setnonblocking(i32 %119)
%123 = load i32, i32* @EPOLLIN
%124 = load i32, i32* @EPOLLET
%125 = or i32 %124, %123
store i32 %125, i32* %86
store i32 %119, i32* %87
%126 = load i32, i32* @EPOLL_CTL_ADD
%127 = call i32 @epoll_ctl(i32 %78, i32 %126, i32 %119, %struct.epoll_event* %1)
%128 = icmp eq i32 %127, -1
br i1 %128, label %129, label %118
129: ; preds = %121
%130 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.6, i64 0, i64 0))
%131 = load i32, i32* @EXIT_FAILURE
%132 = call i32 @exit(i32 %131)
unreachable
133: ; preds = %118
%134 = icmp eq i32 %119, -1
br i1 %134, label %135, label %214
135: ; preds = %133
%136 = load i64, i64* @errno
%137 = load i64, i64* @EAGAIN
%138 = icmp eq i64 %136, %137
%139 = load i64, i64* @ECONNABORTED
%140 = icmp eq i64 %136, %139
%141 = select i1 %138, i1 true, i1 %140
%142 = load i64, i64* @EPROTO
%143 = icmp eq i64 %136, %142
%144 = select i1 %141, i1 true, i1 %143
%145 = load i64, i64* @EINTR
%146 = icmp eq i64 %136, %145
%147 = select i1 %144, i1 true, i1 %146
br i1 %147, label %214, label %148
148: ; preds = %135
%149 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.7, i64 0, i64 0))
br label %214
150: ; preds = %113
%151 = getelementptr inbounds [10 x %struct.epoll_event], [10 x %struct.epoll_event]* %2, i64 0, i64 %114, i32 0
%152 = load i32, i32* %151
%153 = load i32, i32* @EPOLLIN
%154 = and i32 %153, %152
%155 = icmp eq i32 %154, 0
br i1 %155, label %182, label %156
156: ; preds = %150, %156
%157 = phi i32 [ %164, %156 ], [ 0, %150 ]
%158 = sext i32 %157 to i64
%159 = getelementptr inbounds i8, i8* %14, i64 %158
%160 = load i32, i32* @BUFSIZ
%161 = add nsw i32 %160, -1
%162 = call i32 @read(i32 %116, i8* %159, i32 %161)
%163 = icmp sgt i32 %162, 0
%164 = add nsw i32 %162, %157
br i1 %163, label %156, label %165
165: ; preds = %156
%166 = icmp eq i32 %162, -1
br i1 %166, label %167, label %173
167: ; preds = %165
%168 = load i64, i64* @errno
%169 = load i64, i64* @EAGAIN
%170 = icmp eq i64 %168, %169
br i1 %170, label %173, label %171
171: ; preds = %167
%172 = call i32 @perror(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0))
br label %173
173: ; preds = %171, %167, %165
store i32 %116, i32* %87
%174 = load i32, i32* %151
%175 = load i32, i32* @EPOLLOUT
%176 = or i32 %175, %174
store i32 %176, i32* %86
%177 = load i32, i32* @EPOLL_CTL_MOD
%178 = call i32 @epoll_ctl(i32 %78, i32 %177, i32 %116, %struct.epoll_event* %1)
%179 = icmp eq i32 %178, -1
br i1 %179, label %180, label %182
180: ; preds = %173
%181 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.9, i64 0, i64 0))
br label %182
182: ; preds = %173, %180, %150
%183 = load i32, i32* %151
%184 = load i32, i32* @EPOLLOUT
%185 = and i32 %184, %183
%186 = icmp eq i32 %185, 0
br i1 %186, label %214, label %187
187: ; preds = %182
%188 = call i32 @sprintf(i8* %14, i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.10, i64 0, i64 0), i32 11)
%189 = call i32 @strlen(i8* %15)
%190 = icmp sgt i32 %189, 0
br i1 %190, label %191, label %212
191: ; preds = %187
%192 = zext i32 %189 to i64
%193 = getelementptr inbounds [2048 x i8], [2048 x i8]* %6, i64 0, i64 %192
br label %196
194: ; preds = %196
%195 = icmp sgt i32 %203, 0
br i1 %195, label %196, label %212
196: ; preds = %191, %194
%197 = phi i32 [ %189, %191 ], [ %203, %194 ]
%198 = zext i32 %197 to i64
%199 = sub nsw i64 0, %198
%200 = getelementptr inbounds i8, i8* %193, i64 %199
%201 = call i32 @write(i32 %116, i8* %200, i32 %197)
%202 = icmp sgt i32 %197, %201
%203 = sub nsw i32 %197, %201
br i1 %202, label %204, label %194
204: ; preds = %196
%205 = icmp eq i32 %201, -1
br i1 %205, label %206, label %212
206: ; preds = %204
%207 = load i64, i64* @errno
%208 = load i64, i64* @EAGAIN
%209 = icmp eq i64 %207, %208
br i1 %209, label %212, label %210
210: ; preds = %206
%211 = call i32 @perror(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.11, i64 0, i64 0))
br label %212
212: ; preds = %194, %187, %204, %206, %210
%213 = call i32 @close(i32 %116)
br label %214
214: ; preds = %182, %212, %133, %148, %135
%215 = add nuw nsw i64 %114, 1
%216 = icmp eq i64 %215, %108
br i1 %216, label %101, label %113
}