LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_bind
struct ns_connection *ns_bind(struct ns_mgr *srv, const char *str,
                              ns_callback_t callback, void *user_data) {
  union socket_address sa;
  struct ns_connection *nc = NULL;
  int use_ssl, proto;
  char cert[100], ca_cert[100];
  sock_t sock;

  ns_parse_address(str, &sa, &proto, &use_ssl, cert, ca_cert);
  if (use_ssl && cert[0] == '\0') return NULL;

  if ((sock = ns_open_listening_socket(&sa, proto)) == INVALID_SOCKET) {
  } else if ((nc = ns_add_sock(srv, sock, callback, NULL)) == NULL) {
    closesocket(sock);
  } else {
    nc->sa = sa;
    nc->flags |= NSF_LISTENING;
    nc->user_data = user_data;
    nc->callback = callback;

    if (proto == SOCK_DGRAM) {
      nc->flags |= NSF_UDP;
    }

#ifdef NS_ENABLE_SSL
    if (use_ssl) {
      nc->ssl_ctx = SSL_CTX_new(SSLv23_server_method());
      if (ns_use_cert(nc->ssl_ctx, cert) != 0 ||
          ns_use_ca_cert(nc->ssl_ctx, ca_cert) != 0) {
        ns_close_conn(nc);
        nc = NULL;
      }
    }
#endif

    DBG(("%p sock %d/%d ssl %p %p", nc, sock, proto, nc->ssl_ctx, nc->ssl));
  }

  return nc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, %r14
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r15
leaq -0x44(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
leaq -0x48(%rbp), %r12
leaq -0xb0(%rbp), %r8
leaq -0x120(%rbp), %r9
movq %rax, %rdi
movq %r12, %rcx
callq 0x57d03
cmpl $0x0, (%r12)
je 0x57c0a
cmpb $0x0, -0xb0(%rbp)
je 0x57c66
movl -0x2c(%rbp), %r12d
movl $0x10, -0x34(%rbp)
movl $0x1, -0x30(%rbp)
movzwl -0x44(%rbp), %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc550
cmpl $-0x1, %eax
je 0x57c66
movl %eax, %r13d
pushq $0x1
popq %rsi
pushq $0x2
popq %rdx
leaq -0x30(%rbp), %rcx
pushq $0x4
popq %r8
movl %eax, %edi
callq 0xc1b0
testl %eax, %eax
jne 0x57c5e
leaq -0x44(%rbp), %rsi
pushq $0x10
popq %rdx
movl %r13d, %edi
callq 0xca90
testl %eax, %eax
je 0x57c7a
movl %r13d, %edi
callq 0xc2b0
xorl %eax, %eax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %r12d
je 0x57c91
movl %r13d, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0xcc90
testl %eax, %eax
jne 0x57c5e
movl %r13d, %edi
callq 0x58a3f
leaq -0x44(%rbp), %rsi
leaq -0x34(%rbp), %rdx
movl %r13d, %edi
callq 0xc080
movq %r15, %rdi
movl %r13d, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x57edd
testq %rax, %rax
je 0x57c5e
movl 0xa0(%rax), %ecx
movl %ecx, %edx
orl $0x80, %edx
movups -0x44(%rbp), %xmm0
movups %xmm0, 0x24(%rax)
movl %edx, 0xa0(%rax)
movq %r14, 0x80(%rax)
movq %rbx, 0x98(%rax)
cmpl $0x2, %r12d
jne 0x57c68
orl $0x180, %ecx            # imm = 0x180
movl %ecx, 0xa0(%rax)
jmp 0x57c68
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_add_sock
struct ns_connection *ns_add_sock(struct ns_mgr *s, sock_t sock,
                                  ns_callback_t callback, void *user_data) {
  struct ns_connection *conn;
  if ((conn = (struct ns_connection *) NS_MALLOC(sizeof(*conn))) != NULL) {
    memset(conn, 0, sizeof(*conn));
    ns_set_non_blocking_mode(sock);
    ns_set_close_on_exec(sock);
    conn->sock = sock;
    conn->user_data = user_data;
    conn->callback = callback;
    conn->mgr = s;
    conn->last_io_time = time(NULL);
    ns_add_conn(s, conn);
    DBG(("%p %d", conn, sock));
  }
  return conn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r12
movq %rdx, %r15
movl %esi, %r13d
movq %rdi, %rbx
pushq $0x1
popq %rdi
movl $0xa8, %esi
callq 0xc9a0
movq %rax, %r14
testq %rax, %rax
je 0x57f52
movl %r13d, %edi
callq 0x58a3f
movl %r13d, %edi
callq 0x579bd
movl %r13d, 0x20(%r14)
movq %r12, 0x80(%r14)
movq %r15, 0x98(%r14)
movq %rbx, 0x18(%r14)
xorl %edi, %edi
callq 0xc850
movq %rax, 0x90(%r14)
movq (%rbx), %rax
movq %rax, (%r14)
movq %r14, (%rbx)
testq %rax, %rax
je 0x57f52
movq %r14, 0x8(%rax)
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_sock_to_str
void ns_sock_to_str(sock_t sock, char *buf, size_t len, int flags) {
  union socket_address sa;
  socklen_t slen = sizeof(sa);

  if (buf != NULL && len > 0) {
    buf[0] = '\0';
    memset(&sa, 0, sizeof(sa));
    if (flags & 4) {
      getpeername(sock, &sa.sa, &slen);
    } else {
      getsockname(sock, &sa.sa, &slen);
    }
    if (flags & 1) {
#if defined(NS_ENABLE_IPV6)
      inet_ntop(sa.sa.sa_family, sa.sa.sa_family == AF_INET ?
                (void *) &sa.sin.sin_addr :
                (void *) &sa.sin6.sin6_addr, buf, len);
#elif defined(_WIN32)
      // Only Windoze Vista (and newer) have inet_ntop()
      strncpy(buf, inet_ntoa(sa.sin.sin_addr), len);
#else
      inet_ntop(sa.sa.sa_family, (void *) &sa.sin.sin_addr, buf,(socklen_t)len);
#endif
    }
    if (flags & 2) {
      snprintf(buf + strlen(buf), len - (strlen(buf) + 1), "%s%d",
               flags & 1 ? ":" : "", (int) ntohs(sa.sin.sin_port));
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r15d
movl $0x10, -0x1c(%rbp)
testq %rsi, %rsi
sete %al
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x5801e
movq %rdx, %rbx
movq %rsi, %r14
movb $0x0, (%rsi)
xorps %xmm0, %xmm0
movaps %xmm0, -0x30(%rbp)
leaq -0x30(%rbp), %rsi
leaq -0x1c(%rbp), %rdx
testb $0x4, %r15b
jne 0x57fb4
callq 0xc080
jmp 0x57fb9
callq 0xcd30
testb $0x1, %r15b
je 0x57fd1
leaq -0x2c(%rbp), %rsi
movzwl -0x4(%rsi), %edi
movq %r14, %rdx
movl %ebx, %ecx
callq 0xc2a0
testb $0x2, %r15b
je 0x5801e
movq %r14, %rdi
callq 0xc470
addq %rax, %r14
notq %rax
addq %rax, %rbx
testb $0x1, %r15b
leaq 0xf65f(%rip), %rax      # 0x67652
leaq 0x9c72(%rip), %rcx      # 0x61c6c
cmoveq %rax, %rcx
movzwl -0x2e(%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %r8d
leaq 0x1029a(%rip), %rdx     # 0x682ab
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc5e0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_hexdump
int ns_hexdump(const void *buf, int len, char *dst, int dst_len) {
  const unsigned char *p = (const unsigned char *) buf;
  char ascii[17] = "";
  int i, idx, n = 0;

  for (i = 0; i < len; i++) {
    idx = i % 16;
    if (idx == 0) {
      if (i > 0) n += snprintf(dst + n, dst_len - n, "  %s\n", ascii);
      n += snprintf(dst + n, dst_len - n, "%04x ", i);
    }
    n += snprintf(dst + n, dst_len - n, " %02x", p[i]);
    ascii[idx] = p[i] < 0x20 || p[i] > 0x7e ? '.' : p[i];
    ascii[idx + 1] = '\0';
  }

  while (i++ % 16) n += snprintf(dst + n, dst_len - n, "%s", "   ");
  n += snprintf(dst + n, dst_len - n, "  %s\n\n", ascii);

  return n;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %ebx
movq %rdx, -0x38(%rbp)
movl %esi, %r15d
movq %rdi, -0x58(%rbp)
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movb $0x0, -0x40(%rbp)
xorl %eax, %eax
testl %esi, %esi
cmovlel %eax, %r15d
movl %r15d, %eax
negb %al
movb %al, -0x29(%rbp)
xorl %r13d, %r13d
xorl %eax, %eax
movq %r15, -0x60(%rbp)
cmpq %r13, %r15
je 0x5813f
movq %r13, %r12
movl %ebx, %r15d
andq $0xf, %r12
je 0x58086
movq -0x38(%rbp), %rbx
jmp 0x580de
testq %r13, %r13
je 0x580b6
movslq %eax, %r14
movq -0x38(%rbp), %rbx
leaq (%rbx,%r14), %rdi
movl %r15d, %eax
subl %r14d, %eax
movslq %eax, %rsi
leaq 0x8fce(%rip), %rdx      # 0x61074
leaq -0x50(%rbp), %rcx
xorl %eax, %eax
callq 0xc5e0
addl %r14d, %eax
jmp 0x580ba
movq -0x38(%rbp), %rbx
movslq %eax, %r14
leaq (%rbx,%r14), %rdi
movl %r15d, %eax
subl %r14d, %eax
movslq %eax, %rsi
leaq 0x101df(%rip), %rdx     # 0x682b0
movl %r13d, %ecx
xorl %eax, %eax
callq 0xc5e0
addl %r14d, %eax
movslq %eax, %r14
leaq (%rbx,%r14), %rdi
movl %r15d, %eax
subl %r14d, %eax
movslq %eax, %rsi
movq -0x58(%rbp), %rbx
movzbl (%rbx,%r13), %ecx
leaq 0x101b8(%rip), %rdx     # 0x682b6
xorl %eax, %eax
callq 0xc5e0
addl %r14d, %eax
movzbl (%rbx,%r13), %ecx
leal -0x7f(%rcx), %edx
cmpb $-0x5f, %dl
pushq $0x2e
popq %rdx
cmovbl %edx, %ecx
movl %r13d, %edx
andl $0xf, %edx
movb %cl, -0x50(%rbp,%rdx)
leaq -0x50(%rbp), %rcx
movb $0x0, 0x1(%r12,%rcx)
incq %r13
incb -0x29(%rbp)
movl %r15d, %ebx
movq -0x60(%rbp), %r15
jmp 0x5806b
andb $0xf, -0x29(%rbp)
leaq 0xf9b5(%rip), %r13      # 0x67aff
movq -0x38(%rbp), %r14
movl %r15d, %ecx
andb $0xf, %cl
movslq %eax, %r12
cmpb %cl, -0x29(%rbp)
je 0x58181
incl %r15d
leaq (%r14,%r12), %rdi
movl %ebx, %eax
subl %r12d, %eax
movslq %eax, %rsi
leaq 0xe1bd(%rip), %rdx      # 0x6632f
movq %r13, %rcx
xorl %eax, %eax
callq 0xc5e0
addl %r12d, %eax
jmp 0x5814e
addq %r12, %r14
subl %r12d, %ebx
movslq %ebx, %rsi
leaq 0x1012b(%rip), %rdx     # 0x682bc
leaq -0x50(%rbp), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0xc5e0
addl %r12d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_add_to_set
static void ns_add_to_set(sock_t sock, fd_set *set, sock_t *max_fd) {
  if ( (sock != INVALID_SOCKET) && (sock < FD_SETSIZE) ) {
    FD_SET(sock, set);
    if (*max_fd == INVALID_SOCKET || sock > *max_fd) {
      *max_fd = sock;
    }
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $-0x1, %edi
sete %al
cmpl $0x400, %edi            # imm = 0x400
setge %cl
orb %al, %cl
jne 0x5864d
movq %rdx, %r8
movl $0x40, %ecx
movl %edi, %eax
cltd
idivl %ecx
movslq %eax, %rdx
shll $0x6, %eax
movl %edi, %ecx
subl %eax, %ecx
movabsq $0x1, %rax
shlq %cl, %rax
orq %rax, (%rsi,%rdx,8)
movl (%r8), %eax
cmpl $-0x1, %eax
setne %cl
cmpl %edi, %eax
setge %al
testb %al, %cl
jne 0x5864d
movl %edi, (%r8)
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_call
static void ns_call(struct ns_connection *nc, int ev, void *p) {
  if (nc->mgr->hexdump_file != NULL && ev != NS_POLL) {
    int len = (ev == NS_RECV || ev == NS_SEND) ? * (int *) p : 0;
    hexdump(nc, nc->mgr->hexdump_file, len, ev);
  }

  nc->callback(nc, ev, p);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movq %rdx, %r12
movl %esi, %r15d
movq %rdi, %r14
movq 0x18(%rdi), %rax
movq 0x8(%rax), %rdi
testq %rdi, %rdi
sete %al
testl %esi, %esi
sete %cl
orb %al, %cl
jne 0x587dd
leal -0x3(%r15), %ebx
movq $0x0, -0x40(%rbp)
cmpl $0x1, %ebx
ja 0x586a0
movl (%r12), %eax
movq %rax, -0x40(%rbp)
cmpl $0x4, %r15d
pushq $0x58
popq %rax
pushq $0x40
popq %r13
cmoveq %rax, %r13
leaq 0x9430(%rip), %rsi      # 0x61ae6
callq 0xcbb0
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x587dd
movq %r12, -0x48(%rbp)
movl 0x20(%r14), %edi
leaq -0xd0(%rbp), %rsi
pushq $0x3c
popq %r12
pushq $0x3
popq %rcx
movq %r12, %rdx
callq 0x57f64
movl 0x20(%r14), %edi
leaq -0x90(%rbp), %rsi
pushq $0x7
popq %rcx
movq %r12, %rdx
callq 0x57f64
xorl %edi, %edi
callq 0xc850
movq 0x80(%r14), %rcx
cmpl $0x3, %r15d
leaq 0xfd8d(%rip), %rdx      # 0x684a2
leaq 0xfd89(%rip), %r9       # 0x684a5
cmoveq %rdx, %r9
cmpl $0x2, %ebx
movq -0x40(%rbp), %rbx
jb 0x5874e
cmpl $0x1, %r15d
jne 0x58738
leaq 0xfd72(%rip), %r9       # 0x684a8
jmp 0x5874e
cmpl $0x2, %r15d
leaq 0xfd68(%rip), %rdx      # 0x684ab
leaq 0xfd64(%rip), %r9       # 0x684ae
cmoveq %rdx, %r9
leaq 0xfd39(%rip), %rsi      # 0x6848e
leaq -0xd0(%rbp), %r8
movq -0x30(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
pushq %rbx
leaq -0x90(%rbp), %r10
pushq %r10
callq 0xc260
popq %rcx
popq %rdx
testl %ebx, %ebx
jle 0x587d0
leal (%rbx,%rbx,4), %eax
addl $0x64, %eax
movl %eax, -0x34(%rbp)
movl %eax, %edi
callq 0xca30
testq %rax, %rax
je 0x587d0
movq %rax, %r12
movq (%r14,%r13), %rdi
cmpl $0x4, %r15d
jne 0x587a2
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x587a9
movq 0x8(%r14,%r13), %rcx
movl %ebx, %eax
addq %rcx, %rdi
subq %rax, %rdi
movl %ebx, %esi
movq %r12, %rdx
movl -0x34(%rbp), %ecx
callq 0x58029
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0xc390
movq %r12, %rdi
callq 0xc250
movq -0x30(%rbp), %rdi
callq 0xc4c0
movq -0x48(%rbp), %r12
movq %r14, %rdi
movl %r15d, %esi
movq %r12, %rdx
callq *0x98(%r14)
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_close_conn
static void ns_close_conn(struct ns_connection *conn) {
  DBG(("%p %d", conn, conn->flags));
  ns_call(conn, NS_CLOSE, NULL);
  ns_remove_conn(conn);
  ns_destroy_conn(conn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
pushq $0x5
popq %rsi
xorl %edx, %edx
callq 0x5864f
movq (%rbx), %rax
movq 0x8(%rbx), %rcx
movq %rcx, %rdx
testq %rcx, %rcx
jne 0x58825
movq 0x18(%rbx), %rdx
movq %rax, (%rdx)
testq %rax, %rax
je 0x58831
movq %rcx, 0x8(%rax)
movl 0x20(%rbx), %edi
callq 0xc2b0
leaq 0x40(%rbx), %rdi
callq 0x57682
leaq 0x58(%rbx), %rdi
callq 0x57682
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xc250
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_connect
struct ns_connection *ns_connect(struct ns_mgr *mgr, const char *address,
                                 ns_callback_t callback, void *user_data) {
  sock_t sock = INVALID_SOCKET;
  struct ns_connection *nc = NULL;
  union socket_address sa;
  char cert[100], ca_cert[100];
  int rc, use_ssl, proto;

  ns_parse_address(address, &sa, &proto, &use_ssl, cert, ca_cert);
  if ((sock = socket(AF_INET, proto, 0)) == INVALID_SOCKET) {
    return NULL;
  }
  ns_set_non_blocking_mode(sock);
  rc = (proto == SOCK_DGRAM) ? 0 : connect(sock, &sa.sa, sizeof(sa.sin));

  if (rc != 0 && ns_is_error(rc)) {
    closesocket(sock);
    return NULL;
  } else if ((nc = ns_add_sock(mgr, sock, callback, user_data)) == NULL) {
    closesocket(sock);
    return NULL;
  }

  nc->sa = sa;   // Important, cause UDP conns will use sendto()
  nc->flags = (proto == SOCK_DGRAM) ? NSF_UDP : NSF_CONNECTING;

#ifdef NS_ENABLE_SSL
  if (use_ssl) {
    if ((nc->ssl_ctx = SSL_CTX_new(SSLv23_client_method())) == NULL ||
        ns_use_cert(nc->ssl_ctx, cert) != 0 ||
        ns_use_ca_cert(nc->ssl_ctx, ca_cert) != 0 ||
        (nc->ssl = SSL_new(nc->ssl_ctx)) == NULL) {
      ns_close_conn(nc);
      return NULL;
    } else {
      SSL_set_fd(nc->ssl, sock);
    }
  }
#endif

  return nc;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, -0x30(%rbp)
movq %rdx, %r14
movq %rsi, %rax
movq %rdi, %r15
leaq -0x48(%rbp), %rsi
leaq -0x34(%rbp), %rbx
leaq -0x38(%rbp), %rcx
leaq -0x120(%rbp), %r8
leaq -0xb0(%rbp), %r9
movq %rax, %rdi
movq %rbx, %rdx
callq 0x57d03
movl (%rbx), %r12d
pushq $0x2
popq %rdi
xorl %ebx, %ebx
movl %r12d, %esi
xorl %edx, %edx
callq 0xc550
cmpl $-0x1, %eax
je 0x58a2a
movl %eax, %r13d
movl %eax, %edi
callq 0x58a3f
cmpl $0x2, %r12d
je 0x589e7
leaq -0x48(%rbp), %rsi
pushq $0x10
popq %rdx
movl %r13d, %edi
callq 0xc420
testl %eax, %eax
je 0x589e7
movl %eax, %edi
callq 0x58a6c
testl %eax, %eax
jne 0x58a20
movq %r15, %rdi
movl %r13d, %esi
movq %r14, %rdx
movq -0x30(%rbp), %rcx
callq 0x57edd
testq %rax, %rax
je 0x58a20
movq %rax, %rbx
cmpl $0x2, %r12d
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x24(%rax)
movl $0x100, %eax            # imm = 0x100
pushq $0x8
popq %rcx
cmovel %eax, %ecx
movl %ecx, 0xa0(%rbx)
jmp 0x58a2a
movl %r13d, %edi
callq 0xc2b0
xorl %ebx, %ebx
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_is_error
static int ns_is_error(int n) {
  return n == 0 ||
    (n < 0 && errno != EINTR && errno != EINPROGRESS &&
     errno != EAGAIN && errno != EWOULDBLOCK
#ifdef _WIN32
     && WSAGetLastError() != WSAEINTR && WSAGetLastError() != WSAEWOULDBLOCK
#endif
    );
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
pushq $0x1
popq %r14
testl %edi, %edi
je 0x58a97
xorl %ebx, %ebx
testl %edi, %edi
jns 0x58a9a
callq 0xcb50
movl (%rax), %eax
cmpl $0x4, %eax
je 0x58a9a
cmpl $0xb, %eax
je 0x58a9a
cmpl $0x73, %eax
je 0x58a9a
movl %r14d, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_broadcast
void ns_broadcast(struct ns_mgr *mgr, ns_callback_t cb,void *data, size_t len) {
  struct ctl_msg ctl_msg;
  if (mgr->ctl[0] != INVALID_SOCKET && data != NULL &&
      len < sizeof(ctl_msg.message)) {
    ctl_msg.callback = cb;
    memcpy(ctl_msg.message, data, len);
    send(mgr->ctl[0], (char *) &ctl_msg,
         offsetof(struct ctl_msg, message) + len, 0);
    recv(mgr->ctl[0], (char *) &len, 1, 0);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x2018, %rsp           # imm = 0x2018
movq %rcx, -0x20(%rbp)
cmpq $0x1fff, %rcx           # imm = 0x1FFF
ja 0x58b12
testq %rdx, %rdx
je 0x58b12
movq %rdi, %rbx
movl 0x10(%rdi), %r15d
cmpl $-0x1, %r15d
je 0x58b12
movq %rcx, %r14
leaq -0x2020(%rbp), %rdi
movq %rsi, -0x8(%rdi)
movq %rdx, %rsi
movq %rcx, %rdx
callq 0xc0f0
addq $0x8, %r14
leaq -0x2028(%rbp), %rsi
movl %r15d, %edi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xc3e0
movl 0x10(%rbx), %edi
leaq -0x20(%rbp), %rsi
pushq $0x1
popq %rdx
xorl %ecx, %ecx
callq 0xcab0
addq $0x2018, %rsp           # imm = 0x2018
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_mgr_init
void ns_mgr_init(struct ns_mgr *s, void *user_data) {
  memset(s, 0, sizeof(*s));
  s->ctl[0] = s->ctl[1] = INVALID_SOCKET;
  s->user_data = user_data;

#ifdef _WIN32
  { WSADATA data; WSAStartup(MAKEWORD(2, 2), &data); }
#else
  // Ignore SIGPIPE signal, so if client cancels the request, it
  // won't kill the whole process.
  signal(SIGPIPE, SIG_IGN);
#endif

#ifndef NS_DISABLE_SOCKETPAIR
  {
    int attempts = 0, max_attempts = NS_MAX_SOCKETPAIR_ATTEMPTS;
    do {
      ns_socketpair2(s->ctl, SOCK_DGRAM);
    } while (s->ctl[0] == INVALID_SOCKET && ++attempts < max_attempts);
  }
#endif

#ifdef NS_ENABLE_SSL
  {static int init_done; if (!init_done) { SSL_library_init(); init_done++; }}
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
leaq 0x10(%rdi), %rbx
orq $-0x1, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
pushq $0xd
popq %rdi
pushq $0x1
popq %rsi
callq 0xc3f0
xorl %r15d, %r15d
pushq $0x2
popq %r14
movq %rbx, %rdi
movl %r14d, %esi
callq 0x579d3
cmpl $-0x1, (%rbx)
jne 0x58b6c
leal 0x1(%r15), %eax
cmpl $0x9, %r15d
movl %eax, %r15d
jb 0x58b4f
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_mgr_free
void ns_mgr_free(struct ns_mgr *s) {
  struct ns_connection *conn, *tmp_conn;

  DBG(("%p", s));
  if (s == NULL) return;
  // Do one last poll, see https://github.com/cesanta/mongoose/issues/286
  ns_mgr_poll(s, 0);

  if (s->ctl[0] != INVALID_SOCKET) closesocket(s->ctl[0]);
  if (s->ctl[1] != INVALID_SOCKET) closesocket(s->ctl[1]);
  s->ctl[0] = s->ctl[1] = INVALID_SOCKET;

  for (conn = s->active_connections; conn != NULL; conn = tmp_conn) {
    tmp_conn = conn->next;
    ns_close_conn(conn);
  }
}

// Assembly:
testq %rdi, %rdi
je 0x58bc6
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x581bb
movl 0x10(%rbx), %edi
cmpl $-0x1, %edi
je 0x58b99
callq 0xc2b0
movl 0x14(%rbx), %edi
cmpl $-0x1, %edi
je 0x58ba6
callq 0xc2b0
orq $-0x1, 0x10(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x58bc0
movq (%rdi), %rbx
callq 0x587ff
movq %rbx, %rdi
jmp 0x58bae
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_url_decode
int mg_url_decode(const char *src, size_t src_len, char *dst,
                  size_t dst_len, int is_form_url_encoded) {
  size_t i, j = 0;
  int a, b;
#define HEXTOI(x) (isdigit(x) ? (x) - '0' : (x) - 'W')

  for (i = j = 0; i < src_len && j < dst_len - 1; i++, j++) {
    if (src[i] == '%' && i + 2 < src_len &&
        isxdigit(* (const unsigned char *) (src + i + 1)) &&
        isxdigit(* (const unsigned char *) (src + i + 2))) {
      a = tolower(* (const unsigned char *) (src + i + 1));
      b = tolower(* (const unsigned char *) (src + i + 2));
      dst[j] = (char) ((HEXTOI(a) << 4) | HEXTOI(b));
      i += 2;
    } else if (is_form_url_encoded && src[i] == '+') {
      dst[j] = ' ';
    } else {
      dst[j] = src[i];
    }
  }

  dst[j] = '\0'; // Null-terminate the destination

  return i >= src_len ? j : -1;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, -0x2c(%rbp)
decq %rcx
xorl %r14d, %r14d
xorl %ebx, %ebx
movq %rdx, -0x50(%rbp)
movq %rcx, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
movq %rdi, -0x38(%rbp)
cmpq %rsi, %rbx
jae 0x58da2
cmpq %rcx, %r14
jae 0x58da2
movb (%rdi,%rbx), %r13b
cmpb $0x25, %r13b
jne 0x58d84
leaq 0x2(%rbx), %r15
cmpq %rsi, %r15
jae 0x58d93
callq 0xc190
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %rdx
movq (%rax), %rax
movzbl 0x1(%rdi,%rbx), %r12d
testb $0x10, 0x1(%rax,%r12,2)
je 0x58d93
movzbl 0x2(%rdi,%rbx), %r8d
testb $0x10, 0x1(%rax,%r8,2)
je 0x58d93
movq %rax, %rbx
movq %r8, %r13
callq 0xc4a0
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq (%rax), %rax
movslq (%rax,%r12,4), %rcx
movslq (%rax,%r13,4), %rax
xorl %edx, %edx
testb $0x8, 0x1(%rbx,%rcx,2)
sete %dl
leal (%rdx,%rdx,8), %edx
addl %ecx, %edx
shll $0x4, %edx
leal 0xd0(%rax), %ecx
leal 0xa9(%rax), %r13d
testb $0x8, 0x1(%rbx,%rax,2)
cmovnel %ecx, %r13d
movq -0x48(%rbp), %rcx
orl %edx, %r13d
movq -0x50(%rbp), %rdx
movq %r15, %rbx
jmp 0x58d93
cmpl $0x0, -0x2c(%rbp)
je 0x58d93
cmpb $0x2b, %r13b
jne 0x58d93
movb $0x20, %r13b
movb %r13b, (%rdx,%r14)
incq %rbx
incq %r14
jmp 0x58ccd
cmpq %rsi, %rbx
movb $0x0, (%rdx,%r14)
pushq $-0x1
popq %rax
cmovael %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_get_header
const char *mg_get_header(const struct mg_connection *ri, const char *s) {
  int i;

  for (i = 0; i < ri->num_headers; i++)
    if (!mg_strcasecmp(s, ri->http_headers[i].name))
      return ri->http_headers[i].value;

  return NULL;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
movl 0x84(%rdi), %r12d
xorl %ebx, %ebx
testl %r12d, %r12d
cmovlel %ebx, %r12d
movq %rsi, %r15
shlq $0x4, %r12
addq $0x10, %r12
xorl %ecx, %ecx
leaq 0x10(%rcx), %r13
cmpq %r13, %r12
je 0x58e16
movq 0x88(%r14,%rcx), %rsi
movq %r15, %rdi
callq 0x58e28
movq %r13, %rcx
testl %eax, %eax
jne 0x58dee
movq 0x80(%r14,%r13), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_strcasecmp
static int mg_strcasecmp(const char *s1, const char *s2) {
  int diff;

  do {
    diff = lowercase(s1++) - lowercase(s2++);
  } while (diff == 0 && s1[-1] != '\0');

  return diff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %r15
movq %r15, %rdi
callq 0x58fe4
movl %eax, %ebx
movq %r14, %rdi
callq 0x58fe4
cmpl %eax, %ebx
jne 0x58e5d
incq %r14
cmpb $0x0, (%r15)
leaq 0x1(%r15), %r15
jne 0x58e38
movl %ebx, %eax
subl %eax, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_match_prefix
int mg_match_prefix(const char *pattern, ssize_t pattern_len, const char *str) {
  const char *or_str;
  int len, res, i = 0, j = 0;

  if ((or_str = (const char *) memchr(pattern, '|', pattern_len)) != NULL) {
    res = mg_match_prefix(pattern, or_str - pattern, str);
    return res > 0 ? res : mg_match_prefix(or_str + 1,
      (pattern + pattern_len) - (or_str + 1), str);
  }

  for (; i < pattern_len; i++, j++) {
    if (pattern[i] == '?' && str[j] != '\0') {
      continue;
    } else if (pattern[i] == '$') {
      return str[j] == '\0' ? j : -1;
    } else if (pattern[i] == '*') {
      i++;
      if (pattern[i] == '*') {
        i++;
        len = (int) strlen(str + j);
      } else {
        len = (int) strcspn(str + j, "/");
      }
      if (i == pattern_len) {
        return j + len;
      }
      do {
        res = mg_match_prefix(pattern + i, pattern_len - i, str + j + len);
      } while (res == -1 && len-- > 0);
      return res == -1 ? -1 : j + res + len;
    } else if (lowercase(&pattern[i]) != lowercase(&str[j])) {
      return -1;
    }
  }
  return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, -0x30(%rbp)
movq %rsi, %r14
movq %rdi, %rbx
pushq $0x7c
popq %r13
movq %rbx, %rdi
movl %r13d, %esi
movq %r14, %rdx
callq 0xc4d0
testq %rax, %rax
je 0x58ec2
movq %rax, %r15
movq %rax, %rsi
subq %rbx, %rsi
movq %rbx, %rdi
movq -0x30(%rbp), %rdx
callq 0x58e6c
testl %eax, %eax
jg 0x58f1e
incq %r15
addq %rbx, %r14
subq %r15, %r14
movq %r15, %rbx
jmp 0x58e88
xorl %r13d, %r13d
testq %r14, %r14
movl $0x0, %r12d
cmovgq %r14, %r12
cmpq %r13, %r12
je 0x58f21
movzbl (%rbx,%r13), %eax
cmpl $0x3f, %eax
je 0x58eed
cmpl $0x24, %eax
je 0x58f33
cmpl $0x2a, %eax
jne 0x58ef8
jmp 0x58f49
movq -0x30(%rbp), %rax
cmpb $0x0, (%rax,%r13)
jne 0x58f16
leaq (%rbx,%r13), %rdi
callq 0x58fe4
movl %eax, %r15d
movq -0x30(%rbp), %rax
leaq (%rax,%r13), %rdi
callq 0x58fe4
cmpl %eax, %r15d
jne 0x58f1b
incq %r13
jmp 0x58ed2
pushq $-0x1
popq %rax
movl %eax, %r12d
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %r13d, %eax
xorl %r12d, %r12d
movq -0x30(%rbp), %rcx
cmpb (%rcx,%rax), %r12b
sbbl %r12d, %r12d
orl %r13d, %r12d
jmp 0x58f21
leaq 0x1(%r13), %r15
movl %r15d, %eax
cmpb $0x2a, (%rbx,%rax)
jne 0x58f68
movl %r13d, %edi
leal 0x2(%r13), %r15d
addq -0x30(%rbp), %rdi
callq 0xc470
jmp 0x58f7b
movl %r13d, %edi
addq -0x30(%rbp), %rdi
leaq 0x10616(%rip), %rsi     # 0x6958c
callq 0xc890
movq %rax, %r12
movslq %r15d, %rax
subq %rax, %r14
jne 0x58f8b
addl %r13d, %r12d
jmp 0x58f21
addq %rax, %rbx
movslq %r12d, %r12
movl %r12d, %r15d
sarl $0x1f, %r15d
andl %r12d, %r15d
decl %r15d
movl %r13d, %eax
addq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
leaq (%rax,%r12), %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x58e6c
cmpl $-0x1, %eax
jne 0x58fcc
leaq -0x1(%r12), %rcx
testq %r12, %r12
movq %rcx, %r12
jg 0x58fa5
jmp 0x58fcf
movl %r12d, %r15d
addl %r15d, %r13d
addl %eax, %r13d
cmpl $-0x1, %eax
cmovel %eax, %r13d
movl %r13d, %r12d
jmp 0x58f21
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_template
void mg_template(struct mg_connection *conn, const char *s,
                 struct mg_expansion *expansions) {
  int i, j, pos = 0, inside_marker = 0;

  for (i = 0; s[i] != '\0'; i++) {
    if (inside_marker == 0 && !memcmp(&s[i], "{{", 2)) {
      if (i > pos) {
        mg_send_data(conn, &s[pos], i - pos);
      }
      pos = i;
      inside_marker = 1;
    }
    if (inside_marker == 1 && !memcmp(&s[i], "}}", 2)) {
      for (j = 0; expansions[j].keyword != NULL; j++) {
        const char *kw = expansions[j].keyword;
        if ((int) strlen(kw) == i - (pos + 2) &&
            memcmp(kw, &s[pos + 2], i - (pos + 2)) == 0) {
          expansions[j].handler(conn);
          pos = i + 2;
          break;
        }
      }
      inside_marker = 0;
    }
  }
  if (i > pos) {
    mg_send_data(conn, &s[pos], i - pos);
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, -0x30(%rbp)
addq $0x8, %rdx
movq %rdx, -0x50(%rbp)
xorl %r15d, %r15d
xorl %ecx, %ecx
xorl %ebx, %ebx
movq %rsi, -0x40(%rbp)
cmpb $0x0, (%r12,%r15)
movslq %ecx, %rax
je 0x590fa
leaq (%r12,%r15), %r14
testl %ebx, %ebx
je 0x59053
cmpw $0x7d7d, (%r14)         # imm = 0x7D7D
je 0x5907d
pushq $0x1
popq %rbx
jmp 0x590f2
xorl %ebx, %ebx
cmpw $0x7b7b, (%r14)         # imm = 0x7B7B
jne 0x590f2
cmpq %rax, %r15
jle 0x59078
leaq (%r12,%rax), %rsi
movl %r15d, %edx
subl %eax, %edx
movq -0x30(%rbp), %rdi
callq 0x5912e
movl %r15d, %ecx
jmp 0x59043
movq %r15, -0x48(%rbp)
subl %ecx, %r15d
addl $-0x2, %r15d
movl %ecx, -0x34(%rbp)
movslq %ecx, %rax
addq %r12, %rax
addq $0x2, %rax
movq %rax, -0x58(%rbp)
movslq %r15d, %r14
movq -0x50(%rbp), %r13
movq -0x8(%r13), %r12
xorl %ebx, %ebx
testq %r12, %r12
je 0x590d1
movq %r12, %rdi
callq 0xc470
cmpl %eax, %r15d
jne 0x590cb
movq %r12, %rdi
movq -0x58(%rbp), %rsi
movq %r14, %rdx
callq 0xc800
testl %eax, %eax
je 0x590de
addq $0x10, %r13
jmp 0x590a0
movq -0x40(%rbp), %r12
movq -0x48(%rbp), %r15
movl -0x34(%rbp), %ecx
jmp 0x590f2
movq -0x30(%rbp), %rdi
callq *(%r13)
movq -0x48(%rbp), %r15
leal 0x2(%r15), %ecx
movq -0x40(%rbp), %r12
incq %r15
jmp 0x5902d
subl %ecx, %r15d
jle 0x5911f
addq %rax, %r12
movq -0x30(%rbp), %rdi
movq %r12, %rsi
movl %r15d, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x5912e
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_send_data
size_t mg_send_data(struct mg_connection *c, const void *data, int data_len) {
  struct connection *conn = MG_CONN_2_CONN(c);
  terminate_headers(c);
  write_chunk(MG_CONN_2_CONN(c), (const char *) data, data_len);
  return conn->ns_conn->send_iobuf.len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x8(%rdi), %r12
callq 0x5958b
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x595db
movq -0x8(%r15), %rax
movq 0x60(%rax), %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_send_status
void mg_send_status(struct mg_connection *c, int status) {
  struct connection *conn = MG_CONN_2_CONN(c);
  if (c->status_code == 0) {
    c->status_code = status;
    mg_printf(c, "HTTP/1.1 %d %s\r\n", status, status_code_to_str(status));
  }
  conn->ns_conn->flags |= MG_USING_CHUNKED_API;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x27c(%rdi)
jne 0x591c3
movl %esi, %r14d
movl %esi, 0x27c(%rbx)
movl %esi, %edi
callq 0x591d6
leaq 0xf116(%rip), %rsi      # 0x682c9
movq %rbx, %rdi
movl %r14d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x58c06
movq -0x8(%rbx), %rax
orl $0x200000, 0xa0(%rax)   # imm = 0x200000
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_send_header
void mg_send_header(struct mg_connection *c, const char *name, const char *v) {
  struct connection *conn = MG_CONN_2_CONN(c);
  if (c->status_code == 0) {
    c->status_code = 200;
    mg_printf(c, "HTTP/1.1 %d %s\r\n", 200, status_code_to_str(200));
  }
  mg_printf(c, "%s: %s\r\n", name, v);
  conn->ns_conn->flags |= MG_USING_CHUNKED_API;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
cmpl $0x0, 0x27c(%rdi)
jne 0x5955b
movl $0xc8, 0x27c(%rbx)
leaq 0xed84(%rip), %rsi      # 0x682c9
leaq 0xef8d(%rip), %rcx      # 0x684d9
movq %rbx, %rdi
movl $0xc8, %edx
xorl %eax, %eax
callq 0x58c06
leaq 0xed78(%rip), %rsi      # 0x682da
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x58c06
movq -0x8(%rbx), %rax
orl $0x200000, 0xa0(%rax)   # imm = 0x200000
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: terminate_headers
static void terminate_headers(struct mg_connection *c) {
  struct connection *conn = MG_CONN_2_CONN(c);
  if (!(conn->ns_conn->flags & MG_HEADERS_SENT)) {
    mg_send_header(c, "Transfer-Encoding", "chunked");
    mg_write(c, "\r\n", 2);
    conn->ns_conn->flags |= MG_HEADERS_SENT;
  }
}

// Assembly:
movq -0x8(%rdi), %rax
testb $0x10, 0xa2(%rax)
jne 0x595da
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0xf2dd(%rip), %rsi      # 0x68885
leaq 0xf2e8(%rip), %rdx      # 0x68897
callq 0x59518
leaq 0xedaf(%rip), %rsi      # 0x6836a
pushq $0x2
popq %rdx
movq %rbx, %rdi
callq 0x59168
movq -0x8(%rbx), %rax
orl $0x100000, 0xa0(%rax)   # imm = 0x100000
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: write_chunk
static void write_chunk(struct connection *conn, const char *buf, int len) {
  char chunk_size[50];
  int n = mg_snprintf(chunk_size, sizeof(chunk_size), "%X\r\n", len);
  ns_send(conn->ns_conn, chunk_size, n);
  ns_send(conn->ns_conn, buf, len);
  ns_send(conn->ns_conn, "\r\n", 2);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x40, %rsp
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %rbx
leaq 0xf2a5(%rip), %rdx      # 0x6889f
leaq -0x60(%rbp), %r12
pushq $0x32
popq %rsi
movq %r12, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x5bc9e
movq (%rbx), %rdi
movslq %eax, %rdx
movq %r12, %rsi
callq 0x57905
movq (%rbx), %rdi
movslq %r14d, %rdx
movq %r15, %rsi
callq 0x57905
movq (%rbx), %rdi
leaq 0xed36(%rip), %rsi      # 0x6836a
pushq $0x2
popq %rdx
callq 0x57905
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_vprintf_data
size_t mg_vprintf_data(struct mg_connection *c, const char *fmt, va_list ap) {
  struct connection *conn = MG_CONN_2_CONN(c);
  int len;
  char mem[IOBUF_SIZE], *buf = mem;

  terminate_headers(c);

  len = ns_avprintf(&buf, sizeof(mem), fmt, ap);

  if (len >= 0) {
    write_chunk((struct connection *) conn, buf, len);
  }
  if (buf != mem && buf != NULL) {
    NS_FREE(buf);
  }
  return conn->ns_conn->send_iobuf.len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2008, %rsp           # imm = 0x2008
movq %rdx, %r14
movq %rsi, %r15
leaq -0x8(%rdi), %rbx
leaq -0x2030(%rbp), %r13
leaq -0x30(%rbp), %r12
movq %r13, (%r12)
callq 0x5958b
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x577ad
movq (%r12), %r14
testl %eax, %eax
js 0x5971c
movq %rbx, %rdi
movq %r14, %rsi
movl %eax, %edx
callq 0x595db
cmpq %r13, %r14
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x59734
movq %r14, %rdi
callq 0xc250
movq (%rbx), %rax
movq 0x60(%rax), %rax
addq $0x2008, %rsp           # imm = 0x2008
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_websocket_printf
size_t mg_websocket_printf(struct mg_connection *conn, int opcode,
                           const char *fmt, ...) {
  char mem[4192], *buf = mem;
  va_list ap;
  int len;

  va_start(ap, fmt);
  if ((len = ns_avprintf(&buf, sizeof(mem), fmt, ap)) > 0) {
    mg_websocket_write(conn, opcode, buf, len);
  }
  va_end(ap);

  if (buf != mem && buf != NULL) {
    NS_FREE(buf);
  }

  return MG_CONN_2_CONN(conn)->ns_conn->send_iobuf.len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1130, %rsp           # imm = 0x1130
movl %esi, %r14d
movq %rdi, %rbx
leaq -0xf0(%rbp), %rsi
movq %rcx, 0x18(%rsi)
movq %r8, 0x20(%rsi)
movq %r9, 0x28(%rsi)
testb %al, %al
je 0x598cf
movaps %xmm0, -0xc0(%rbp)
movaps %xmm1, -0xb0(%rbp)
movaps %xmm2, -0xa0(%rbp)
movaps %xmm3, -0x90(%rbp)
movaps %xmm4, -0x80(%rbp)
movaps %xmm5, -0x70(%rbp)
movaps %xmm6, -0x60(%rbp)
movaps %xmm7, -0x50(%rbp)
leaq -0x1150(%rbp), %r12
leaq -0x28(%rbp), %r15
movq %r12, (%r15)
leaq -0x40(%rbp), %rcx
movq %rsi, 0x10(%rcx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rcx)
movabsq $0x3000000018, %rax     # imm = 0x3000000018
movq %rax, (%rcx)
movl $0x1060, %esi           # imm = 0x1060
movq %r15, %rdi
callq 0x577ad
movq (%r15), %r15
testl %eax, %eax
jle 0x5991e
movl %eax, %ecx
movq %rbx, %rdi
movl %r14d, %esi
movq %r15, %rdx
callq 0x5974d
cmpq %r12, %r15
sete %al
testq %r15, %r15
sete %cl
orb %al, %cl
jne 0x59936
movq %r15, %rdi
callq 0xc250
movq -0x8(%rbx), %rax
movq 0x60(%rax), %rax
addq $0x1130, %rsp           # imm = 0x1130
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_get_mime_type
const char *mg_get_mime_type(const char *path, const char *default_mime_type) {
  const char *ext;
  size_t i, path_len;

  path_len = strlen(path);

  for (i = 0; static_builtin_mime_types[i].extension != NULL; i++) {
    ext = path + (path_len - static_builtin_mime_types[i].ext_len);
    if (path_len > static_builtin_mime_types[i].ext_len &&
        mg_strcasecmp(ext, static_builtin_mime_types[i].extension) == 0) {
      return static_builtin_mime_types[i].mime_type;
    }
  }

  return default_mime_type;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0xc470
movq %rax, %r15
pushq $0x10
popq %r12
leaq 0x2cf7b(%rip), %r13     # 0x868f0
cmpq $0x478, %r12            # imm = 0x478
je 0x599a3
movq %r15, %rdi
subq -0x8(%r12,%r13), %rdi
jbe 0x59999
movq -0x10(%r12,%r13), %rsi
addq %r14, %rdi
callq 0x58e28
testl %eax, %eax
je 0x5999f
addq $0x18, %r12
jmp 0x59975
movq (%r12,%r13), %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_send_file_data
void mg_send_file_data(struct mg_connection *c, int fd) {
  struct connection *conn = MG_CONN_2_CONN(c);
  conn->endpoint_type = EP_FILE;
  conn->endpoint.fd = fd;
  ns_set_close_on_exec(conn->endpoint.fd);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movl $0x1, 0x2b0(%rdi)
movl %esi, 0x2a8(%rdi)
movl %esi, %edi
popq %rbp
jmp 0x579bd
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_url_encode
size_t mg_url_encode(const char *src, size_t s_len, char *dst, size_t dst_len) {
  static const char *dont_escape = "._-$,;~()";
  static const char *hex = "0123456789abcdef";
  size_t i = 0, j = 0;

  for (i = j = 0; dst_len > 0 && i < s_len && j + 2 < dst_len - 1; i++, j++) {
    if (isalnum(* (const unsigned char *) (src + i)) ||
        strchr(dont_escape, * (const unsigned char *) (src + i)) != NULL) {
      dst[j] = src[i];
    } else if (j + 3 < dst_len) {
      dst[j] = '%';
      dst[j + 1] = hex[(* (const unsigned char *) (src + i)) >> 4];
      dst[j + 2] = hex[(* (const unsigned char *) (src + i)) & 0xf];
      j += 2;
    }
  }

  dst[j] = '\0';
  return j;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r14
movq %rdx, -0x30(%rbp)
movq %rsi, -0x48(%rbp)
movq %rdi, -0x38(%rbp)
leaq -0x1(%rcx), %rax
movq %rax, -0x40(%rbp)
xorl %r15d, %r15d
xorl %ebx, %ebx
testq %r14, %r14
je 0x59a98
cmpq -0x48(%rbp), %r15
jae 0x59a98
leaq 0x2(%rbx), %r13
cmpq -0x40(%rbp), %r13
jae 0x59a98
callq 0xc190
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movb (%rcx,%r15), %r12b
movzbl %r12b, %esi
testb $0x8, (%rax,%rsi,2)
jne 0x59a49
leaq 0xe8a7(%rip), %rdi      # 0x682e3
pushq $0xa
popq %rdx
callq 0xc4d0
testq %rax, %rax
je 0x59a5f
movq %rbx, %r13
movq -0x30(%rbp), %rax
movb %r12b, (%rax,%r13)
movq %r13, %rbx
incq %r15
incq %rbx
jmp 0x599fe
leaq 0x3(%rbx), %rax
cmpq %r14, %rax
jae 0x59a57
movq -0x30(%rbp), %rcx
movb $0x25, (%rcx,%rbx)
movq -0x38(%rbp), %rdx
movzbl (%rdx,%r15), %eax
shrl $0x4, %eax
leaq 0xe86a(%rip), %rsi      # 0x682ed
movb (%rax,%rsi), %al
movb %al, 0x1(%rcx,%rbx)
movzbl (%rdx,%r15), %eax
andl $0xf, %eax
movb (%rax,%rsi), %r12b
jmp 0x59a4c
movq -0x30(%rbp), %rax
movb $0x0, (%rax,%rbx)
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_send_digest_auth_request
void mg_send_digest_auth_request(struct mg_connection *c) {
  struct connection *conn = MG_CONN_2_CONN(c);
  c->status_code = 401;
  mg_printf(c,
            "HTTP/1.1 401 Unauthorized\r\n"
            "Content-Length: 0\r\n"
            "WWW-Authenticate: Digest qop=\"auth\", "
            "realm=\"%s\", nonce=\"%lu\"\r\n\r\n",
            conn->server->config_options[AUTH_DOMAIN],
            (unsigned long) time(NULL));
  close_local_endpoint(conn);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0x8(%rdi), %r14
movl $0x191, 0x27c(%rdi)     # imm = 0x191
movq 0x2a0(%rdi), %rax
movq 0x48(%rax), %r15
xorl %edi, %edi
callq 0xc850
leaq 0xe818(%rip), %rsi      # 0x682fe
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x58c06
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x59b05
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_strncasecmp
static int mg_strncasecmp(const char *s1, const char *s2, size_t len) {
  int diff = 0;

  if (len > 0)
    do {
      diff = lowercase(s1++) - lowercase(s2++);
    } while (diff == 0 && s1[-1] != '\0' && --len > 0);

  return diff;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
testq %rdx, %rdx
je 0x5a2de
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
decq %rbx
movq %r15, %rdi
callq 0x58fe4
movl %eax, %r12d
movq %r14, %rdi
callq 0x58fe4
subl %eax, %r12d
jne 0x5a2e1
subq $0x1, %rbx
setb %al
cmpb $0x0, (%r15)
je 0x5a2de
incq %r14
incq %r15
testb %al, %al
je 0x5a2af
xorl %r12d, %r12d
movl %r12d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: parse_header
static int parse_header(const char *str, size_t str_len, const char *var_name,
                        char *buf, size_t buf_size) {
  int ch = ' ', ch1 = ',', len = 0;
  size_t n = strlen(var_name);
  const char *p, *end = str + str_len, *s = NULL;

  if (buf != NULL && buf_size > 0) buf[0] = '\0';

  // Find where variable starts
  for (s = str; s != NULL && s + n < end; s++) {
    if ((s == str || s[-1] == ch || s[-1] == ch1) && s[n] == '=' &&
        !memcmp(s, var_name, n)) break;
  }

  if (s != NULL && &s[n + 1] < end) {
    s += n + 1;
    if (*s == '"' || *s == '\'') ch = ch1 = *s++;
    p = s;
    while (p < end && p[0] != ch && p[0] != ch1 && len < (int) buf_size) {
      if (ch == ch1 && p[0] == '\\' && p[1] == ch) p++;
      buf[len++] = *p++;
    }
    if (len >= (int) buf_size || (ch != ' ' && *p != ch)) {
      len = 0;
    } else {
      if (len > 0 && s[len - 1] == ',') len--;
      if (len > 0 && s[len - 1] == ';') len--;
      buf[len] = '\0';
    }
  }

  return len;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %r8, %r12
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r13
movq %rdx, -0x40(%rbp)
movq %rdx, %rdi
callq 0xc470
movq %rax, %rbx
testq %r14, %r14
sete %al
movq %r12, -0x30(%rbp)
testq %r12, %r12
sete %cl
orb %al, %cl
jne 0x5a372
movb $0x0, (%r14)
movq %r14, -0x38(%rbp)
addq %r13, %r15
movq %rbx, %r14
addq %r13, %r14
xorl %r12d, %r12d
movq %r13, %rdi
addq %r12, %rdi
je 0x5a3c2
leaq (%r14,%r12), %rax
cmpq %r15, %rax
jae 0x5a3c2
testq %r12, %r12
je 0x5a3a8
movzbl -0x1(%r13,%r12), %ecx
cmpl $0x2c, %ecx
je 0x5a3a8
cmpl $0x20, %ecx
jne 0x5a3bd
cmpb $0x3d, (%rax)
jne 0x5a3bd
movq -0x40(%rbp), %rsi
movq %rbx, %rdx
callq 0xc800
testl %eax, %eax
je 0x5a3c7
incq %r12
jmp 0x5a382
testq %rdi, %rdi
je 0x5a3ec
leaq (%r12,%r14), %rcx
incq %rcx
cmpq %r15, %rcx
jae 0x5a3ec
movzbl (%rcx), %eax
cmpl $0x22, %eax
je 0x5a3e0
cmpl $0x27, %eax
jne 0x5a3f3
leaq (%r12,%r14), %rcx
addq $0x2, %rcx
movl %eax, %edx
jmp 0x5a3f9
xorl %eax, %eax
jmp 0x5a48f
pushq $0x20
popq %rdx
pushq $0x2c
popq %rax
movq -0x38(%rbp), %rbx
movq -0x30(%rbp), %r14
movslq %r14d, %r8
xorl %esi, %esi
pushq $0x5c
popq %r9
movq %rcx, %rdi
cmpq %r15, %rdi
jae 0x5a452
movb (%rdi), %r10b
movsbl %r10b, %r11d
cmpl %r11d, %edx
je 0x5a452
cmpl %r11d, %eax
je 0x5a452
cmpq %r8, %rsi
jge 0x5a452
cmpl %eax, %edx
jne 0x5a446
cmpb $0x5c, %r10b
jne 0x5a446
leaq 0x1(%rdi), %r11
movsbl 0x1(%rdi), %r10d
cmpl %r10d, %eax
cmovnel %r9d, %r10d
cmoveq %r11, %rdi
incq %rdi
movb %r10b, (%rbx,%rsi)
incq %rsi
jmp 0x5a40d
xorl %eax, %eax
cmpl %r14d, %esi
jge 0x5a48f
cmpl $0x20, %edx
je 0x5a465
movsbl (%rdi), %edi
cmpl %edi, %edx
jne 0x5a48f
testq %rsi, %rsi
je 0x5a486
leal -0x1(%rsi), %edx
cmpb $0x2c, (%rcx,%rdx)
movl %esi, %eax
cmovel %edx, %eax
testl %eax, %eax
jle 0x5a488
leal -0x1(%rax), %edx
cmpb $0x3b, (%rcx,%rdx)
cmovel %edx, %eax
jmp 0x5a488
xorl %eax, %eax
movslq %eax, %rcx
movb $0x0, (%rbx,%rcx)
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: must_hide_file
static int must_hide_file(struct connection *conn, const char *path) {
  const char *pw_pattern = "**" PASSWORDS_FILE_NAME "$";
  const char *pattern = conn->server->config_options[HIDE_FILES_PATTERN];
  return mg_match_prefix(pw_pattern, strlen(pw_pattern), path) > 0 ||
    (pattern != NULL && mg_match_prefix(pattern, strlen(pattern), path) > 0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq 0x2a8(%rdi), %rax
movq 0x98(%rax), %r14
leaq 0xceb5(%rip), %rdi      # 0x68be5
pushq $0xc
popq %rsi
movq %rbx, %rdx
callq 0x58e6c
testl %eax, %eax
jle 0x5bd44
pushq $0x1
popq %rax
jmp 0x5bd6c
testq %r14, %r14
je 0x5bd6a
movq %r14, %rdi
callq 0xc470
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0x58e6c
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
setg %al
jmp 0x5bd6c
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_connect
struct mg_connection *mg_connect(struct mg_server *server, const char *addr) {
  struct ns_connection *nsconn;
  struct connection *conn;

  nsconn = ns_connect(&server->ns_mgr, addr, mg_ev_handler, NULL);
  if (nsconn == NULL) return 0;

  if ((conn = (struct connection *) NS_CALLOC(1, sizeof(*conn))) == NULL) {
    nsconn->flags |= NSF_CLOSE_IMMEDIATELY;
    return 0;
  }

  // Interlink two structs
  conn->ns_conn = nsconn;
  nsconn->user_data = conn;

  conn->server = server;
  conn->endpoint_type = EP_CLIENT;
  //conn->handler = handler;
  conn->mg_conn.server_param = server->ns_mgr.user_data;
  conn->ns_conn->flags = NSF_CONNECTING;

  return &conn->mg_conn;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq -0x1975(%rip), %rdx     # 0x5a69b
xorl %r15d, %r15d
xorl %ecx, %ecx
callq 0x5895c
testq %rax, %rax
je 0x5c079
movq %rax, %r14
pushq $0x1
popq %rdi
movl $0x2e8, %esi            # imm = 0x2E8
callq 0xc9a0
testq %rax, %rax
je 0x5c06e
movq %r14, (%rax)
movq %rax, 0x80(%r14)
movq %rbx, 0x2a8(%rax)
movl $0x5, 0x2b8(%rax)
movq 0x18(%rbx), %rcx
movq %rax, %r15
addq $0x8, %r15
movq %rcx, 0x290(%rax)
movl $0x8, 0xa0(%r14)
jmp 0x5c079
orb $0x10, 0xa0(%r14)
xorl %r15d, %r15d
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq