LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: ns_socketpair2
int ns_socketpair2(sock_t sp[2], int sock_type) {
  union socket_address sa;
  sock_t sock;
  socklen_t len = sizeof(sa.sin);
  int ret = 0;

  sp[0] = sp[1] = INVALID_SOCKET;

  (void) memset(&sa, 0, sizeof(sa));
  sa.sin.sin_family = AF_INET;
  sa.sin.sin_port = htons(0);
  sa.sin.sin_addr.s_addr = htonl(0x7f000001);

  if ((sock = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
      !bind(sock, &sa.sa, len) &&
      (sock_type == SOCK_DGRAM || !listen(sock, 1)) &&
      !getsockname(sock, &sa.sa, &len) &&
      (sp[0] = socket(AF_INET, sock_type, 0)) != INVALID_SOCKET &&
      !connect(sp[0], &sa.sa, len) &&
      (sock_type == SOCK_STREAM ||
       (!getsockname(sp[0], &sa.sa, &len) && !connect(sock, &sa.sa, len))) &&
      (sp[1] = (sock_type == SOCK_DGRAM ? sock :
                accept(sock, &sa.sa, &len))) != INVALID_SOCKET) {
    ns_set_close_on_exec(sp[0]);
    ns_set_close_on_exec(sp[1]);
    ret = 1;
  } else {
    if (sp[0] != INVALID_SOCKET) closesocket(sp[0]);
    if (sp[1] != INVALID_SOCKET) closesocket(sp[1]);
    sp[0] = sp[1] = INVALID_SOCKET;
  }
  if (sock_type != SOCK_DGRAM) closesocket(sock);

  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movl %esi, %ebx
movq %rdi, %r15
movl $0x10, -0x24(%rbp)
movq $-0x1, (%rdi)
xorps %xmm0, %xmm0
movaps %xmm0, -0x40(%rbp)
movabsq $0x100007f00000002, %rax # imm = 0x100007F00000002
movq %rax, -0x40(%rbp)
movl $0x2, %edi
xorl %edx, %edx
callq 0xc550
movl %eax, %r14d
cmpl $-0x1, %eax
je 0x68318
movl -0x24(%rbp), %edx
leaq -0x40(%rbp), %rsi
movl %r14d, %edi
callq 0xca60
testl %eax, %eax
jne 0x68318
cmpl $0x2, %ebx
je 0x68304
movl %r14d, %edi
movl $0x1, %esi
callq 0xcc60
testl %eax, %eax
jne 0x68318
leaq -0x40(%rbp), %rsi
leaq -0x24(%rbp), %rdx
movl %r14d, %edi
callq 0xc070
testl %eax, %eax
je 0x6835a
movl (%r15), %edi
cmpl $-0x1, %edi
je 0x68325
callq 0xc2b0
movl 0x4(%r15), %edi
cmpl $-0x1, %edi
je 0x68333
callq 0xc2b0
movq $-0x1, (%r15)
xorl %r12d, %r12d
cmpl $0x2, %ebx
je 0x6834a
movl %r14d, %edi
callq 0xc2b0
movl %r12d, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movl $0x2, %edi
movl %ebx, %esi
xorl %edx, %edx
callq 0xc550
movl %eax, (%r15)
cmpl $-0x1, %eax
je 0x68318
movl -0x24(%rbp), %edx
leaq -0x40(%rbp), %rsi
movl %eax, %edi
callq 0xc420
testl %eax, %eax
jne 0x68318
cmpl $0x1, %ebx
jne 0x683e0
movl %r14d, %eax
cmpl $0x2, %ebx
je 0x6839f
leaq -0x40(%rbp), %rsi
leaq -0x24(%rbp), %rdx
movl %r14d, %edi
callq 0xc960
movl %eax, 0x4(%r15)
cmpl $-0x1, %eax
je 0x68318
movl (%r15), %edi
movl $0x1, %r12d
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0xc220
movl 0x4(%r15), %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0xc220
jmp 0x6833d
movl (%r15), %edi
leaq -0x40(%rbp), %rsi
leaq -0x24(%rbp), %rdx
callq 0xc070
testl %eax, %eax
jne 0x68318
movl -0x24(%rbp), %edx
leaq -0x40(%rbp), %rsi
movl %r14d, %edi
callq 0xc420
testl %eax, %eax
jne 0x68318
jmp 0x68387
// File: /workspace/github_c_makefile_star2_O1/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 $0x108, %rsp            # imm = 0x108
movq %rcx, %r12
movq %rdx, %rbx
movq %rsi, %rax
movq %rdi, %r15
leaq -0x44(%rbp), %rsi
leaq -0x30(%rbp), %rdx
leaq -0x54(%rbp), %r14
leaq -0xc0(%rbp), %r8
leaq -0x130(%rbp), %r9
movq %rax, %rdi
movq %r14, %rcx
callq 0x6860c
cmpl $0x0, (%r14)
je 0x684c9
cmpb $0x0, -0xc0(%rbp)
je 0x6859e
movq %r12, -0x50(%rbp)
movl -0x30(%rbp), %r12d
movl $0x10, -0x2c(%rbp)
movl $0x1, -0x34(%rbp)
movzwl -0x44(%rbp), %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc550
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x68539
movl %eax, %r13d
leaq -0x34(%rbp), %rcx
movl %eax, %edi
movl $0x1, %esi
movl $0x2, %edx
movl $0x4, %r8d
callq 0xc190
testl %eax, %eax
jne 0x68531
movl -0x2c(%rbp), %edx
leaq -0x44(%rbp), %rsi
movl %r13d, %edi
callq 0xca60
testl %eax, %eax
je 0x685b2
movl %r13d, %edi
callq 0xc2b0
cmpl $-0x1, %r14d
je 0x6859e
movq %r15, %rdi
movl %r14d, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x68800
testq %rax, %rax
je 0x68596
movups -0x44(%rbp), %xmm0
movups %xmm0, 0x24(%rax)
movl 0xa0(%rax), %ecx
movl %ecx, %edx
orl $0x80, %edx
movl %edx, 0xa0(%rax)
movq -0x50(%rbp), %rdx
movq %rdx, 0x80(%rax)
movq %rbx, 0x98(%rax)
cmpl $0x2, %r12d
jne 0x685a0
orl $0x180, %ecx            # imm = 0x180
movl %ecx, 0xa0(%rax)
jmp 0x685a0
movl %r14d, %edi
callq 0xc2b0
xorl %eax, %eax
addq $0x108, %rsp            # imm = 0x108
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x2, %r12d
je 0x685cd
movl %r13d, %edi
movl $0x1000, %esi           # imm = 0x1000
callq 0xcc60
testl %eax, %eax
jne 0x68531
movl %r13d, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc220
orl $0x800, %eax            # imm = 0x800
movl %r13d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0xc220
leaq -0x44(%rbp), %rsi
leaq -0x2c(%rbp), %rdx
movl %r13d, %edi
callq 0xc070
movl %r13d, %r14d
jmp 0x68539
// File: /workspace/github_c_makefile_star2_O1/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, %r14
movl $0xa8, %edi
callq 0xca00
movq %rax, %rbx
testq %rax, %rax
je 0x688b8
movl $0xa8, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0xc360
movl %r13d, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc220
orl $0x800, %eax            # imm = 0x800
movl %r13d, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0xc220
movl %r13d, %edi
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
callq 0xc220
movl %r13d, 0x20(%rbx)
movq %r12, 0x80(%rbx)
movq %r15, 0x98(%rbx)
movq %r14, 0x18(%rbx)
xorl %edi, %edi
callq 0xc820
movq %rax, 0x90(%rbx)
movq (%r14), %rax
movq %rax, (%rbx)
movq %rbx, (%r14)
movq $0x0, 0x8(%rbx)
testq %rax, %rax
je 0x688b8
movq %rbx, 0x8(%rax)
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_O1/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 0x68984
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 0x6891a
callq 0xc070
jmp 0x6891f
callq 0xccf0
testb $0x1, %r15b
je 0x68937
leaq -0x2c(%rbp), %rsi
movzwl -0x4(%rsi), %edi
movq %r14, %rdx
movl %ebx, %ecx
callq 0xc2a0
testb $0x2, %r15b
je 0x68984
movq %r14, %rdi
callq 0xc460
addq %rax, %r14
notq %rax
addq %rax, %rbx
testb $0x1, %r15b
leaq 0x10d0e(%rip), %rax     # 0x79667
leaq 0xb315(%rip), %rcx      # 0x73c75
cmoveq %rax, %rcx
movzwl -0x2e(%rbp), %eax
rolw $0x8, %ax
movzwl %ax, %r8d
leaq 0x11954(%rip), %rdx     # 0x7a2cb
movq %r14, %rdi
movq %rbx, %rsi
xorl %eax, %eax
callq 0xc5d0
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
xorps %xmm0, %xmm0
movaps %xmm0, -0x50(%rbp)
movb $0x0, -0x40(%rbp)
testl %esi, %esi
movq %rdx, -0x38(%rbp)
movl %ecx, -0x2c(%rbp)
jle 0x68a9a
movq %rdi, %r12
movl %esi, %eax
movq %rax, -0x58(%rbp)
xorl %r15d, %r15d
xorl %eax, %eax
movq %r15, %r13
andq $0xf, %r13
je 0x689db
movq -0x38(%rbp), %rcx
movl -0x2c(%rbp), %r14d
jmp 0x68a3b
testq %r15, %r15
movq -0x38(%rbp), %rcx
je 0x68a11
movslq %eax, %rbx
leaq (%rcx,%rbx), %rdi
movl -0x2c(%rbp), %r14d
movl %r14d, %eax
subl %ebx, %eax
movslq %eax, %rsi
leaq 0xa676(%rip), %rdx      # 0x73074
leaq -0x50(%rbp), %rcx
xorl %eax, %eax
callq 0xc5d0
movq -0x38(%rbp), %rcx
addl %ebx, %eax
jmp 0x68a15
movl -0x2c(%rbp), %r14d
movslq %eax, %rbx
leaq (%rcx,%rbx), %rdi
movl %r14d, %eax
subl %ebx, %eax
movslq %eax, %rsi
leaq 0x118a5(%rip), %rdx     # 0x7a2d0
movl %r15d, %ecx
xorl %eax, %eax
callq 0xc5d0
movq -0x38(%rbp), %rcx
addl %ebx, %eax
movslq %eax, %rbx
leaq (%rcx,%rbx), %rdi
subl %ebx, %r14d
movslq %r14d, %rsi
movzbl (%r12,%r15), %ecx
leaq 0x11882(%rip), %rdx     # 0x7a2d6
xorl %eax, %eax
callq 0xc5d0
addl %ebx, %eax
movzbl (%r12,%r15), %ecx
leal -0x7f(%rcx), %edx
cmpb $-0x5f, %dl
movl $0x2e, %edx
cmovbl %edx, %ecx
movl %r15d, %edx
andl $0xf, %edx
movb %cl, -0x50(%rbp,%rdx)
leaq -0x50(%rbp), %rcx
movb $0x0, 0x1(%r13,%rcx)
incq %r15
cmpq %r15, -0x58(%rbp)
jne 0x689c8
movq -0x38(%rbp), %r8
movl -0x2c(%rbp), %ecx
jmp 0x68aa2
movq %rdx, %r8
xorl %r15d, %r15d
xorl %eax, %eax
testb $0xf, %r15b
je 0x68aec
incl %r15d
leaq 0xf892(%rip), %r14      # 0x78344
leaq 0x1105b(%rip), %r13     # 0x79b14
movl %r15d, %r12d
movslq %eax, %rbx
leaq (%r8,%rbx), %rdi
movl %ecx, %eax
subl %ebx, %eax
movslq %eax, %rsi
movq %r14, %rdx
movq %r13, %rcx
xorl %eax, %eax
callq 0xc5d0
movl -0x2c(%rbp), %ecx
movq -0x38(%rbp), %r8
addl %ebx, %eax
incl %r12d
testb $0xf, %r15b
movl %r12d, %r15d
jne 0x68abc
movslq %eax, %rbx
addq %rbx, %r8
subl %ebx, %ecx
movslq %ecx, %rsi
leaq 0x117de(%rip), %rdx     # 0x7a2dc
leaq -0x50(%rbp), %rcx
movq %r8, %rdi
xorl %eax, %eax
callq 0xc5d0
addl %ebx, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movq %rdx, %rbx
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 0x69218
leal -0x3(%r15), %r12d
xorl %eax, %eax
cmpl $0x1, %r12d
ja 0x690d4
movl (%rbx), %eax
movq %rax, -0x40(%rbp)
cmpl $0x4, %r15d
movl $0x58, %eax
movl $0x40, %r13d
cmoveq %rax, %r13
leaq 0xaa27(%rip), %rsi      # 0x73b19
callq 0xcb90
movq %rax, -0x30(%rbp)
testq %rax, %rax
je 0x69218
movl 0x20(%r14), %edi
leaq -0xc0(%rbp), %rsi
movl $0x3c, %edx
movl $0x3, %ecx
callq 0x688ca
movl 0x20(%r14), %edi
leaq -0x80(%rbp), %rsi
movl $0x3c, %edx
movl $0x7, %ecx
callq 0x688ca
xorl %edi, %edi
callq 0xc820
movq 0x80(%r14), %rcx
cmpl $0x3, %r15d
leaq 0x11374(%rip), %rdx     # 0x7a4c2
leaq 0x11370(%rip), %r9      # 0x7a4c5
cmoveq %rdx, %r9
cmpl $0x2, %r12d
jb 0x69184
cmpl $0x1, %r15d
jne 0x6916e
leaq 0x1135c(%rip), %r9      # 0x7a4c8
jmp 0x69184
cmpl $0x2, %r15d
leaq 0x11352(%rip), %rdx     # 0x7a4cb
leaq 0x1134e(%rip), %r9      # 0x7a4ce
cmoveq %rdx, %r9
leaq 0x11323(%rip), %rsi     # 0x7a4ae
leaq -0xc0(%rbp), %r8
movq -0x30(%rbp), %rdi
movq %rax, %rdx
xorl %eax, %eax
movq -0x40(%rbp), %r12
pushq %r12
leaq -0x80(%rbp), %r10
pushq %r10
callq 0xc260
movq %r12, %rax
addq $0x10, %rsp
testl %eax, %eax
jle 0x6920f
leal (%rax,%rax,4), %eax
addl $0x64, %eax
movl %eax, -0x34(%rbp)
movl %eax, %edi
callq 0xca00
movq -0x40(%rbp), %rsi
testq %rax, %rax
je 0x6920f
movq %rax, %r12
movq (%r14,%r13), %rdi
cmpl $0x4, %r15d
jne 0x691e3
xorl %eax, %eax
xorl %ecx, %ecx
jmp 0x691ea
movq 0x8(%r14,%r13), %rcx
movl %esi, %eax
addq %rcx, %rdi
subq %rax, %rdi
movq %r12, %rdx
movl -0x34(%rbp), %ecx
callq 0x6898f
movq %r12, %rdi
movq -0x30(%rbp), %rsi
callq 0xc380
movq %r12, %rdi
callq 0xc250
movq -0x30(%rbp), %rdi
callq 0xc4c0
movq %r14, %rdi
movl %r15d, %esi
movq %rbx, %rdx
callq *0x98(%r14)
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x5, %esi
xorl %edx, %edx
callq 0x6908e
movq (%rbx), %rcx
movq 0x8(%rbx), %rax
movq %rax, %rdx
testq %rax, %rax
jne 0x69262
movq 0x18(%rbx), %rdx
movq %rcx, (%rdx)
movq (%rbx), %rcx
testq %rcx, %rcx
je 0x69271
movq %rax, 0x8(%rcx)
movl 0x20(%rbx), %edi
callq 0xc2b0
leaq 0x40(%rbx), %rdi
callq 0x67f29
leaq 0x58(%rbx), %rdi
callq 0x67f29
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0xc250
// File: /workspace/github_c_makefile_star2_O1/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 0x6860c
movl (%rbx), %r12d
xorl %r13d, %r13d
movl $0x2, %edi
movl %r12d, %esi
xorl %edx, %edx
callq 0xc550
cmpl $-0x1, %eax
je 0x694b4
movl %eax, %ebx
movl %eax, %edi
movl $0x3, %esi
xorl %edx, %edx
xorl %eax, %eax
callq 0xc220
orl $0x800, %eax            # imm = 0x800
movl %ebx, %edi
movl $0x4, %esi
movl %eax, %edx
xorl %eax, %eax
callq 0xc220
cmpl $0x2, %r12d
je 0x6945e
leaq -0x48(%rbp), %rsi
movl %ebx, %edi
movl $0x10, %edx
callq 0xc420
movl %eax, %r13d
testl %r13d, %r13d
je 0x6946f
movl %r13d, %edi
callq 0x694c9
testl %eax, %eax
jne 0x694aa
movq %r15, %rdi
movl %ebx, %esi
movq %r14, %rdx
movq -0x30(%rbp), %rcx
callq 0x68800
testq %rax, %rax
je 0x694aa
movq %rax, %r13
cmpl $0x2, %r12d
movups -0x48(%rbp), %xmm0
movups %xmm0, 0x24(%rax)
movl $0x100, %eax            # imm = 0x100
movl $0x8, %ecx
cmovel %eax, %ecx
movl %ecx, 0xa0(%r13)
jmp 0x694b4
movl %ebx, %edi
callq 0xc2b0
xorl %r13d, %r13d
movq %r13, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movl $0x1, %ebx
testl %edi, %edi
je 0x694de
xorl %ebx, %ebx
testl %edi, %edi
js 0x694e7
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
callq 0xcb20
movl (%rax), %eax
cmpl $0x4, %eax
je 0x694de
cmpl $0xb, %eax
je 0x694de
cmpl $0x73, %eax
je 0x694de
movl $0x1, %ebx
jmp 0x694de
// File: /workspace/github_c_makefile_star2_O1/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 0x69577
testq %rdx, %rdx
je 0x69577
movq %rdi, %rbx
movl 0x10(%rdi), %r15d
cmpl $-0x1, %r15d
je 0x69577
movq %rcx, %r14
leaq -0x2020(%rbp), %rdi
movq %rsi, -0x8(%rdi)
movq %rdx, %rsi
movq %rcx, %rdx
callq 0xc0e0
addq $0x8, %r14
leaq -0x2028(%rbp), %rsi
movl %r15d, %edi
movq %r14, %rdx
xorl %ecx, %ecx
callq 0xc3d0
movl 0x10(%rbx), %edi
leaq -0x20(%rbp), %rsi
movl $0x1, %edx
xorl %ecx, %ecx
callq 0xca80
addq $0x2018, %rsp           # imm = 0x2018
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r14
pushq %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x10(%rdi)
movups %xmm0, (%rdi)
leaq 0x10(%rdi), %rbx
movq $-0x1, 0x10(%rdi)
movq %rsi, 0x18(%rdi)
movl $0x1, %esi
movl $0xd, %edi
callq 0xc3f0
xorl %r14d, %r14d
movq %rbx, %rdi
movl $0x2, %esi
callq 0x68290
cmpl $-0x1, (%rbx)
jne 0x695d7
leal 0x1(%r14), %eax
cmpl $0x9, %r14d
movl %eax, %r14d
jb 0x695b8
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x69631
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %esi, %esi
callq 0x68b27
movl 0x10(%rbx), %edi
cmpl $-0x1, %edi
je 0x695fe
callq 0xc2b0
movl 0x14(%rbx), %edi
cmpl $-0x1, %edi
je 0x6960b
callq 0xc2b0
movq $-0x1, 0x10(%rbx)
movq (%rbx), %rdi
testq %rdi, %rdi
je 0x6962b
movq (%rdi), %rbx
callq 0x6923a
movq %rbx, %rdi
testq %rbx, %rbx
jne 0x6961b
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_printf
size_t mg_printf(struct mg_connection *conn, const char *fmt, ...) {
  va_list ap;
  int ret;

  va_start(ap, fmt);
  ret = mg_vprintf(conn, fmt, ap);
  va_end(ap);

  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
leaq -0xd0(%rbp), %rdi
movq %rdx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %r8, 0x20(%rdi)
movq %r9, 0x28(%rdi)
testb %al, %al
je 0x696c5
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
leaq -0x20(%rbp), %rdx
movq %rdi, 0x10(%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
movq -0x8(%rbx), %rdi
callq 0x68152
movq -0x8(%rbx), %rax
movslq 0x60(%rax), %rax
addq $0xc8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movq %rdi, -0x38(%rbp)
testq %rsi, %rsi
setne %al
sete %dil
decq %rcx
sete %r9b
orb %dil, %r9b
jne 0x69841
xorl %ebx, %ebx
xorl %r14d, %r14d
movq %rdx, -0x50(%rbp)
movl %r8d, -0x2c(%rbp)
movq %rcx, -0x48(%rbp)
movq %rsi, -0x40(%rbp)
movq -0x38(%rbp), %rax
movb (%rax,%rbx), %r13b
cmpb $0x25, %r13b
jne 0x697b3
leaq 0x2(%rbx), %r15
cmpq %rsi, %r15
jae 0x697b3
callq 0xc170
movq -0x40(%rbp), %rsi
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x50(%rbp), %rdx
movq (%rax), %rdi
movq -0x38(%rbp), %rax
movzbl 0x1(%rax,%rbx), %r12d
testb $0x10, 0x1(%rdi,%r12,2)
je 0x697b3
movq -0x38(%rbp), %rax
movzbl 0x2(%rax,%rbx), %eax
testb $0x10, 0x1(%rdi,%rax,2)
jne 0x697de
testl %r8d, %r8d
je 0x697c5
cmpb $0x2b, %r13b
jne 0x697c5
movb $0x20, (%rdx,%r14)
jmp 0x697c9
movb %r13b, (%rdx,%r14)
incq %rbx
incq %r14
cmpq %rsi, %rbx
setb %al
jae 0x69844
cmpq %rcx, %r14
jb 0x69762
jmp 0x69844
movq %rdi, %rbx
movq %rax, %r13
callq 0xc4a0
movq -0x48(%rbp), %rcx
movl -0x2c(%rbp), %r8d
movq -0x50(%rbp), %rdx
movq (%rax), %rax
movslq (%rax,%r12,4), %r9
movslq (%rax,%r13,4), %rax
movzwl (%rbx,%r9,2), %edi
xorl %esi, %esi
btl $0xb, %edi
setae %sil
leal (%rsi,%rsi,8), %edi
addl %r9d, %edi
shll $0x4, %edi
movzwl (%rbx,%rax,2), %r9d
leal 0xd0(%rax), %r10d
addl $0xa9, %eax
btl $0xb, %r9d
movq -0x40(%rbp), %rsi
cmovbl %r10d, %eax
orl %edi, %eax
movb %al, (%rdx,%r14)
movq %r15, %rbx
jmp 0x697c9
xorl %r14d, %r14d
movb $0x0, (%rdx,%r14)
testb %al, %al
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmovel %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 %rbx
pushq %rax
movslq 0x84(%rdi), %r15
testq %r15, %r15
jle 0x698d2
movq %rsi, %rbx
movq %rdi, %r14
addq $0x88, %r14
callq 0xc4a0
movq (%rax), %rcx
xorl %eax, %eax
xorl %edx, %edx
movq %rdx, %rdi
shlq $0x4, %rdi
leaq (%r14,%rdi), %rsi
movq (%r14,%rdi), %rdi
xorl %r8d, %r8d
movzbl (%rbx,%r8), %r11d
movl (%rcx,%r11,4), %r9d
movzbl (%rdi,%r8), %r10d
movl (%rcx,%r10,4), %r10d
testl %r11d, %r11d
je 0x698c3
incq %r8
cmpl %r10d, %r9d
je 0x698a4
cmpl %r10d, %r9d
je 0x698d6
incq %rdx
cmpq %r15, %rdx
jne 0x69892
jmp 0x698da
xorl %eax, %eax
jmp 0x698da
movq 0x8(%rsi), %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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, %r14
movq %rsi, %rbx
movq %rdi, %r15
movq %r15, %rdi
movl $0x7c, %esi
movq %rbx, %rdx
callq 0xc4d0
testq %rax, %rax
je 0x69937
movq %rax, %r12
movq %rax, %rsi
subq %r15, %rsi
movq %r15, %rdi
movq %r14, %rdx
callq 0x698e5
testl %eax, %eax
jg 0x6998e
incq %r12
addq %r15, %rbx
subq %r12, %rbx
movq %r12, %r15
jmp 0x698fc
testq %rbx, %rbx
jle 0x69995
xorl %r12d, %r12d
movzbl (%r15,%r12), %r13d
cmpl $0x3f, %r13d
je 0x69958
cmpl $0x24, %r13d
je 0x699bd
cmpl $0x2a, %r13d
jne 0x6996b
jmp 0x6999c
cmpb $0x0, (%r14,%r12)
jne 0x69981
cmpq $0x2a, %r13
je 0x6999c
cmpl $0x24, %r13d
je 0x699bd
callq 0xc4a0
movq (%rax), %rax
movl (%rax,%r13,4), %ecx
movzbl (%r14,%r12), %edx
cmpl (%rax,%rdx,4), %ecx
jne 0x699cd
incq %r12
cmpq %r12, %rbx
jne 0x6993f
jmp 0x69a47
movl %eax, %ebx
jmp 0x69a47
xorl %ebx, %ebx
jmp 0x69a47
leaq 0x1(%r12), %r13
movl %r13d, %eax
cmpb $0x2a, (%r15,%rax)
jne 0x699d4
movl %r12d, %edi
leal 0x2(%r12), %r13d
addq %r14, %rdi
callq 0xc460
jmp 0x699e6
movl %r12d, %eax
xorl %ebx, %ebx
cmpb (%r14,%rax), %bl
sbbl %ebx, %ebx
orl %r12d, %ebx
jmp 0x69a47
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x69a47
movl %r12d, %edi
addq %r14, %rdi
leaq 0x11bcb(%rip), %rsi     # 0x7b5ac
callq 0xc870
movslq %r13d, %rcx
subq %rcx, %rbx
jne 0x699f5
addl %r12d, %eax
movl %eax, %ebx
jmp 0x69a47
addq %rcx, %r15
movslq %eax, %r13
movl %r13d, %eax
sarl $0x1f, %eax
andl %r13d, %eax
decl %eax
movl %eax, -0x2c(%rbp)
movl %r12d, %eax
addq %rax, %r14
leaq (%r14,%r13), %rdx
movq %r15, %rdi
movq %rbx, %rsi
callq 0x698e5
cmpl $-0x1, %eax
jne 0x69a34
leaq -0x1(%r13), %rcx
testq %r13, %r13
movq %rcx, %r13
jg 0x69a0f
movl -0x2c(%rbp), %ecx
jmp 0x69a37
movl %r13d, %ecx
addl %ecx, %r12d
addl %eax, %r12d
cmpl $-0x1, %eax
cmovel %eax, %r12d
movl %r12d, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
cmpb $0x0, (%rsi)
movq %rdi, -0x38(%rbp)
je 0x69b74
leaq -0x8(%rdi), %rax
movq %rax, -0x50(%rbp)
movq %rdx, -0x58(%rbp)
leaq 0x10(%rdx), %rax
movq %rax, -0x48(%rbp)
xorl %r13d, %r13d
xorl %ecx, %ecx
xorl %r14d, %r14d
movq %r12, -0x30(%rbp)
movq %r13, %r15
movb $0x1, %bl
testl %ecx, %ecx
jne 0x69ae0
cmpw $0x7b7b, (%r12,%r15)    # imm = 0x7B7B
je 0x69aaf
xorl %ebx, %ebx
jmp 0x69ae0
movslq %r14d, %rax
cmpq %rax, %r15
jle 0x69add
leaq (%r12,%rax), %r13
movl %r15d, %r12d
subl %eax, %r12d
movq -0x38(%rbp), %rdi
callq 0x6a032
movq -0x50(%rbp), %rdi
movq %r13, %rsi
movl %r12d, %edx
movq -0x30(%rbp), %r12
callq 0x6a085
movl %r15d, %r14d
xorl %ecx, %ecx
testb %bl, %bl
je 0x69b62
cmpw $0x7d7d, (%r12,%r15)    # imm = 0x7D7D
je 0x69af6
movl $0x1, %ecx
jmp 0x69b62
movq -0x58(%rbp), %rax
movq (%rax), %r13
testq %r13, %r13
je 0x69b62
leal 0x2(%r15), %eax
movl %eax, -0x3c(%rbp)
movq -0x48(%rbp), %rbx
movq %r13, %rdi
callq 0xc460
leal 0x2(%r14), %edx
movl %r15d, %ecx
subl %edx, %ecx
movb $0x1, %r12b
cmpl %eax, %ecx
jne 0x69b4b
movslq %edx, %rsi
addq -0x30(%rbp), %rsi
movslq %ecx, %rdx
movq %r13, %rdi
callq 0xc7c0
testl %eax, %eax
jne 0x69b4b
movq -0x38(%rbp), %rdi
callq *-0x8(%rbx)
xorl %r12d, %r12d
movl -0x3c(%rbp), %eax
movl %eax, %r14d
testb %r12b, %r12b
je 0x69b5c
movq (%rbx), %r13
addq $0x10, %rbx
testq %r13, %r13
jne 0x69b0d
movq -0x30(%rbp), %r12
xorl %ecx, %ecx
leaq 0x1(%r15), %r13
cmpb $0x0, 0x1(%r12,%r15)
jne 0x69a99
jmp 0x69b7a
xorl %r14d, %r14d
xorl %r13d, %r13d
subl %r14d, %r13d
jle 0x69bae
movslq %r14d, %rax
addq %rax, %r12
movq -0x38(%rbp), %rdi
leaq -0x8(%rdi), %r15
callq 0x6a032
movq %r15, %rdi
movq %r12, %rsi
movl %r13d, %edx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6a085
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6a032
movq %r12, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x6a085
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_O1/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 0x69c52
movl %esi, %r14d
movl %esi, 0x27c(%rbx)
movl %esi, %edi
callq 0x69c65
leaq 0x106a7(%rip), %rsi     # 0x7a2e9
movq %rbx, %rdi
movl %r14d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x69675
movq -0x8(%rbx), %rax
orl $0x200000, 0xa0(%rax)   # imm = 0x200000
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6a002
movl $0xc8, 0x27c(%rbx)
leaq 0x102fd(%rip), %rsi     # 0x7a2e9
leaq 0x10506(%rip), %rcx     # 0x7a4f9
movq %rbx, %rdi
movl $0xc8, %edx
xorl %eax, %eax
callq 0x69675
leaq 0x102f1(%rip), %rsi     # 0x7a2fa
movq %rbx, %rdi
movq %r15, %rdx
movq %r14, %rcx
xorl %eax, %eax
callq 0x69675
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_O1/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 0x6a084
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x10856(%rip), %rsi     # 0x7a8a5
leaq 0x10861(%rip), %rdx     # 0x7a8b7
callq 0x69fbf
movq -0x8(%rbx), %rdi
leaq 0x10324(%rip), %rsi     # 0x7a38a
movl $0x2, %edx
callq 0x681c0
movq -0x8(%rbx), %rax
orl $0x100000, 0xa0(%rax)   # imm = 0x100000
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x1081b(%rip), %rdx     # 0x7a8bf
leaq -0x60(%rbp), %r12
movl $0x32, %esi
movq %r12, %rdi
movl %r14d, %ecx
xorl %eax, %eax
callq 0x6c630
movq (%rbx), %rdi
movslq %eax, %rdx
movq %r12, %rsi
callq 0x681c0
movq (%rbx), %rdi
movslq %r14d, %rdx
movq %r15, %rsi
callq 0x681c0
movq (%rbx), %rdi
leaq 0x102aa(%rip), %rsi     # 0x7a38a
movl $0x2, %edx
callq 0x681c0
addq $0x40, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: mg_printf_data
size_t mg_printf_data(struct mg_connection *c, const char *fmt, ...) {
  va_list ap;
  int ret;

  va_start(ap, fmt);
  ret = mg_vprintf_data(c, fmt, ap);
  va_end(ap);

  return ret;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xd0, %rsp
leaq -0xd0(%rbp), %r10
movq %rdx, 0x10(%r10)
movq %rcx, 0x18(%r10)
movq %r8, 0x20(%r10)
movq %r9, 0x28(%r10)
testb %al, %al
je 0x6a143
movaps %xmm0, -0xa0(%rbp)
movaps %xmm1, -0x90(%rbp)
movaps %xmm2, -0x80(%rbp)
movaps %xmm3, -0x70(%rbp)
movaps %xmm4, -0x60(%rbp)
movaps %xmm5, -0x50(%rbp)
movaps %xmm6, -0x40(%rbp)
movaps %xmm7, -0x30(%rbp)
leaq -0x20(%rbp), %rdx
movq %r10, 0x10(%rdx)
leaq 0x10(%rbp), %rax
movq %rax, 0x8(%rdx)
movabsq $0x3000000010, %rax     # imm = 0x3000000010
movq %rax, (%rdx)
callq 0x6a170
cltq
addq $0xd0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x6a032
movl $0x2000, %esi           # imm = 0x2000
movq %r12, %rdi
movq %r15, %rdx
movq %r14, %rcx
callq 0x68067
testl %eax, %eax
js 0x6a1c7
movq -0x30(%rbp), %rsi
movq %rbx, %rdi
movl %eax, %edx
callq 0x6a085
movq -0x30(%rbp), %rdi
cmpq %r13, %rdi
sete %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x6a1e0
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_O1/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 %rbx
subq $0x1138, %rsp           # imm = 0x1138
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 0x6a37a
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), %r15
leaq -0x20(%rbp), %rdi
movq %r15, (%rdi)
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
callq 0x68067
testl %eax, %eax
jle 0x6a3c4
movq -0x20(%rbp), %rdx
movl %eax, %ecx
movq %rbx, %rdi
movl %r14d, %esi
callq 0x6a1f9
movq -0x20(%rbp), %rdi
cmpq %r15, %rdi
sete %al
testq %rdi, %rdi
sete %cl
orb %al, %cl
jne 0x6a3dd
callq 0xc250
movq -0x8(%rbx), %rax
movq 0x60(%rax), %rax
addq $0x1138, %rsp           # imm = 0x1138
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
subq $0x18, %rsp
movq %rsi, -0x30(%rbp)
movq %rdi, -0x40(%rbp)
callq 0xc460
leaq 0x2b4c8(%rip), %r14     # 0x958e0
leaq 0x104a5(%rip), %rbx     # 0x7a8c4
xorl %r13d, %r13d
movq %r14, %r12
movq %rax, -0x38(%rbp)
movq %rax, %r15
subq 0x8(%r12), %r15
jbe 0x6a463
addq -0x40(%rbp), %r15
callq 0xc4a0
movq (%rax), %rax
xorl %ecx, %ecx
movzbl (%r15,%rcx), %edi
movl (%rax,%rdi,4), %edx
movzbl (%rbx,%rcx), %esi
movl (%rax,%rsi,4), %esi
testl %edi, %edi
je 0x6a45b
incq %rcx
cmpl %esi, %edx
je 0x6a441
cmpl %esi, %edx
movq -0x38(%rbp), %rax
je 0x6a485
incq %r13
leaq (,%r13,2), %rcx
addq %r13, %rcx
leaq (%r14,%rcx,8), %r12
movq (%r12), %rbx
cmpq $0x2f, %r13
jne 0x6a429
movq -0x30(%rbp), %rax
jmp 0x6a48a
movq 0x10(%r12), %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x2, %esi
movl $0x1, %edx
xorl %eax, %eax
popq %rbp
jmp 0xc220
// File: /workspace/github_c_makefile_star2_O1/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 %rdi, -0x38(%rbp)
testq %rcx, %rcx
sete %al
movq %rsi, -0x48(%rbp)
testq %rsi, %rsi
sete %cl
orb %al, %cl
jne 0x6a5a4
leaq -0x1(%r14), %rax
movq %rax, -0x40(%rbp)
movl $0x1, %ebx
xorl %r13d, %r13d
leaq 0x2(%r13), %r15
cmpq -0x40(%rbp), %r15
jae 0x6a5a7
callq 0xc170
movq (%rax), %rax
movq -0x38(%rbp), %rcx
movb -0x1(%rcx,%rbx), %r12b
movzbl %r12b, %esi
testb $0x8, (%rax,%rsi,2)
jne 0x6a544
movl $0xa, %edx
leaq 0xfdc9(%rip), %rdi      # 0x7a303
callq 0xc4d0
testq %rax, %rax
je 0x6a569
movq %r13, %r15
movq -0x30(%rbp), %rax
movb %r12b, (%rax,%r15)
movq %r15, %r13
incq %r13
testq %r14, %r14
je 0x6a5a7
leaq 0x1(%rbx), %rax
cmpq -0x48(%rbp), %rbx
movq %rax, %rbx
jb 0x6a505
jmp 0x6a5a7
leaq 0x3(%r13), %rax
cmpq %r14, %rax
jae 0x6a552
movq -0x30(%rbp), %rcx
movb $0x25, (%rcx,%r13)
movq -0x38(%rbp), %rdx
movzbl -0x1(%rdx,%rbx), %eax
shrl $0x4, %eax
leaq 0xfd7f(%rip), %rsi      # 0x7a30d
movb (%rax,%rsi), %al
movb %al, 0x1(%rcx,%r13)
movzbl -0x1(%rdx,%rbx), %eax
andl $0xf, %eax
movb (%rax,%rsi), %r12b
jmp 0x6a547
xorl %r13d, %r13d
movq -0x30(%rbp), %rax
movb $0x0, (%rax,%r13)
movq %r13, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0xc820
leaq 0xfd28(%rip), %rsi      # 0x7a31e
movq %rbx, %rdi
movq %r15, %rdx
movq %rax, %rcx
xorl %eax, %eax
callq 0x69675
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x6a615
// File: /workspace/github_c_makefile_star2_O1/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:
testq %rdx, %rdx
je 0x6ae96
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
callq 0xc4a0
movq (%rax), %rcx
decq %rbx
xorl %edx, %edx
movzbl (%r15,%rdx), %esi
movl (%rcx,%rsi,4), %eax
movzbl (%r14,%rdx), %edi
subl (%rcx,%rdi,4), %eax
jne 0x6ae8b
xorl %eax, %eax
testb %sil, %sil
je 0x6ae8b
leaq 0x1(%rdx), %rsi
cmpq %rdx, %rbx
movq %rsi, %rdx
jne 0x6ae66
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
xorl %eax, %eax
retq