// File: /workspace/github_c_makefile_star2_O3/coyove[P]chann/./lib/mongoose/mongoose.c
// Function: on_recv_data
static void on_recv_data(struct connection *conn) {
  struct iobuf *io = &conn->ns_conn->recv_iobuf;
  int n;

  if (conn->endpoint_type == EP_PROXY) {
    if (conn->endpoint.nc != NULL) do_proxy(conn);
    return;
  }

  try_parse(conn);
  DBG(("%p %d %lu %d", conn, conn->request_len, (unsigned long)io->len,
       conn->ns_conn->flags));
  if (conn->request_len < 0 ||
      (conn->request_len > 0 && !is_valid_uri(conn->mg_conn.uri))) {
    send_http_error(conn, 400, NULL);
  } else if (conn->request_len == 0 && io->len > MAX_REQUEST_SIZE) {
    send_http_error(conn, 413, NULL);
  } else if (conn->request_len > 0 &&
             strcmp(conn->mg_conn.http_version, "1.0") != 0 &&
             strcmp(conn->mg_conn.http_version, "1.1") != 0) {
    send_http_error(conn, 505, NULL);
  } else if (conn->request_len > 0 && conn->endpoint_type == EP_NONE) {
#ifndef MONGOOSE_NO_WEBSOCKET
    send_websocket_handshake_if_requested(&conn->mg_conn);
#endif
    send_continue_if_expected(conn);
    open_local_endpoint(conn, 0);
  }

#ifndef MONGOOSE_NO_CGI
  if (conn->endpoint_type == EP_CGI && conn->endpoint.nc != NULL) {
    ns_forward(conn->ns_conn, conn->endpoint.nc);
  }
#endif
  if (conn->endpoint_type == EP_USER) {
    conn->mg_conn.content = io->buf;
    conn->mg_conn.content_len = io->len;
    n = call_user(conn, MG_RECV);
    if (n < 0) {
      conn->ns_conn->flags |= NSF_FINISHED_SENDING_DATA;
    } else if ((size_t) n <= io->len) {
      iobuf_remove(io, n);
    }
    call_request_handler_if_data_is_buffered(conn);
  }
#ifndef MONGOOSE_NO_DAV
  if (conn->endpoint_type == EP_PUT && io->len > 0) {
    forward_put_data(conn);
  }
#endif
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2a8, %rsp            # imm = 0x2A8
movq %rdi, %rbx
movq (%rdi), %r15
cmpl $0x6, 0x2b8(%rdi)
jne 0x6d2f1
movq 0x2b0(%rbx), %rdi
testq %rdi, %rdi
je 0x6d926
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
callq 0x6661a
cmpq $0x0, 0x48(%r15)
je 0x6d926
movq $0x0, 0x48(%r15)
jmp 0x6d926
movq %rbx, %rdi
callq 0x6da54
cmpq $0x0, 0x2e0(%rbx)
js 0x6d3a2
je 0x6d3ac
movq 0x10(%rbx), %r14
movzbl (%r14), %eax
cmpl $0x2f, %eax
je 0x6d366
cmpl $0x2a, %eax
jne 0x6d326
cmpb $0x0, 0x1(%r14)
je 0x6d366
leaq 0xc180(%rip), %rsi      # 0x794ad
movl $0x4, %edx
movq %r14, %rdi
callq 0x69234
testl %eax, %eax
je 0x6d366
leaq 0xc16d(%rip), %rsi      # 0x794b2
leaq -0x2d0(%rbp), %rdx
movq %r14, %rdi
xorl %eax, %eax
callq 0xc100
testl %eax, %eax
jle 0x6d3a2
cmpq $0x0, 0x2e0(%rbx)
je 0x6d3ac
jle 0x6d3c7
movq 0x18(%rbx), %r14
leaq 0x747e(%rip), %rsi      # 0x747ef
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6d482
leaq 0xbb62(%rip), %rsi      # 0x78eea
movq %r14, %rdi
callq 0xc950
testl %eax, %eax
je 0x6d482
movq %rbx, %rdi
movl $0x1f9, %esi            # imm = 0x1F9
jmp 0x6d3be
movq %rbx, %rdi
movl $0x190, %esi            # imm = 0x190
jmp 0x6d3be
cmpq $0x4001, 0x48(%r15)     # imm = 0x4001
jb 0x6d3c7
movq %rbx, %rdi
movl $0x19d, %esi            # imm = 0x19D
xorl %edx, %edx
xorl %eax, %eax
callq 0x6ae64
movl 0x2b8(%rbx), %eax
cmpl $0x2, %eax
jne 0x6d3fd
movq 0x2b0(%rbx), %rdi
testq %rdi, %rdi
je 0x6d3fd
movq (%rbx), %r14
movq 0x40(%r14), %rsi
movq 0x48(%r14), %rdx
callq 0x6661a
cmpq $0x0, 0x48(%r14)
je 0x6d3fd
movq $0x0, 0x48(%r14)
movl 0x2b8(%rbx), %eax
cmpl $0x3, %eax
jne 0x6d8ad
movq 0x40(%r15), %rax
movq %rax, 0x270(%rbx)
movq 0x48(%r15), %rax
movq %rax, 0x278(%rbx)
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x6d6b9
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6d6b9
leaq 0x8(%rbx), %rdi
movl $0x69, %esi
callq *%rax
testl %eax, %eax
js 0x6d6af
movq 0x48(%r15), %rdx
movl %eax, %r14d
subq %r14, %rdx
setb %cl
testl %eax, %eax
sete %al
orb %cl, %al
jne 0x6d6b9
movq 0x40(%r15), %rdi
leaq (%rdi,%r14), %rsi
callq 0xc1f0
subq %r14, 0x48(%r15)
jmp 0x6d6b9
movl 0x2b8(%rbx), %eax
testl %eax, %eax
jne 0x6d3cd
movq %r15, -0x38(%rbp)
leaq 0x8(%rbx), %r14
leaq 0xc01f(%rip), %rsi      # 0x794be
movq %r14, %rdi
callq 0x67c6a
movq %rax, %r12
leaq 0xc023(%rip), %rsi      # 0x794d4
movq %r14, %rdi
callq 0x67c6a
movq %rax, %r15
testq %r12, %r12
setne %al
testq %r15, %r15
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6d9a3
movl $0x1, 0x280(%rbx)
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x6d504
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6d504
movq %r14, %rdi
movl $0x6b, %esi
callq *%rax
testl %eax, %eax
jne 0x6d984
leaq 0xba4e(%rip), %rdx      # 0x78f59
leaq 0xbfd4(%rip), %r8       # 0x794e6
xorl %r13d, %r13d
leaq -0x2d0(%rbp), %r12
movl $0x1f4, %esi            # imm = 0x1F4
movq %r12, %rdi
movq %r15, %rcx
xorl %eax, %eax
callq 0x6ad62
movaps 0xacfb(%rip), %xmm0     # 0x78230
leaq -0xdc(%rbp), %r15
movups %xmm0, (%r15)
movl $0xc3d2e1f0, %eax       # imm = 0xC3D2E1F0
movq %rax, 0x10(%r15)
movl $0x0, 0x18(%r15)
movq %r12, %rdi
callq 0xc460
movq %r15, %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x6e77a
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x4, %rax
setb %cl
movl -0xc8(%rbp,%rcx,4), %edx
movl %r13d, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %edx
movb %dl, -0x80(%rbp,%rax)
incq %rax
addl $0x8, %r13d
cmpq $0x8, %rax
jne 0x6d569
leaq -0x29(%rbp), %rsi
movb $-0x80, (%rsi)
leaq -0xdc(%rbp), %r15
movl $0x1, %edx
movq %r15, %rdi
callq 0x6e77a
movl $0x1f8, %r13d           # imm = 0x1F8
movl 0x14(%r15), %eax
andl %r13d, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
je 0x6d5eb
leaq -0x29(%rbp), %r12
movb $0x0, -0x29(%rbp)
movl $0x1, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x6e77a
movl -0xc8(%rbp), %eax
andl %r13d, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x6d5c7
leaq -0xdc(%rbp), %rdi
leaq -0x80(%rbp), %rsi
movl $0x8, %edx
callq 0x6e77a
xorl %eax, %eax
xorl %edx, %edx
movl %edx, %ecx
andl $-0x4, %ecx
movl -0xdc(%rbp,%rcx), %esi
movl %eax, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %esi
movb %sil, -0x50(%rbp,%rdx)
incq %rdx
addl $0x8, %eax
cmpq $0x14, %rdx
jne 0x6d604
leaq -0x7d(%rbp), %rax
xorl %ecx, %ecx
leaq 0xbf36(%rip), %rdx      # 0x7956d
movl $0x0, %esi
cmpq $0x11, %rcx
ja 0x6d647
movzbl -0x4e(%rbp,%rcx), %esi
movzbl -0x50(%rbp,%rcx), %r8d
movzbl -0x4f(%rbp,%rcx), %edi
movl %r8d, %r9d
shrl $0x2, %r9d
movb (%r9,%rdx), %r9b
movb %r9b, -0x3(%rax)
shll $0x4, %r8d
andl $0x30, %r8d
movl %edi, %r9d
shrl $0x4, %r9d
orl %r8d, %r9d
movb (%r9,%rdx), %r8b
movb %r8b, -0x2(%rax)
andl $0xf, %edi
movl %esi, %r8d
shrl $0x6, %r8d
leal (%r8,%rdi,4), %edi
movb (%rdi,%rdx), %dil
movb %dil, -0x1(%rax)
cmpq $0x11, %rcx
ja 0x6d938
andl $0x3f, %esi
movb (%rsi,%rdx), %sil
movb %sil, (%rax)
addq $0x3, %rcx
addq $0x4, %rax
jmp 0x6d637
movq (%rbx), %rax
orl $0x1, 0xa0(%rax)
movq %r15, -0x38(%rbp)
cmpl $0x0, 0x280(%rbx)
je 0x6d813
leaq 0x8(%rbx), %r14
movq (%rbx), %rax
movq 0x40(%rax), %r12
movq 0x48(%rax), %rcx
cmpq $0x2, %rcx
jb 0x6d72e
movzbl 0x1(%r12), %eax
movl %eax, %r15d
andl $0x7f, %r15d
shrl $0x5, %eax
andl $0x4, %eax
cmpb $0x7e, %r15b
setae %dl
cmpq %rax, %rcx
setb %sil
orb %dl, %sil
je 0x6d738
cmpb $0x7e, %r15b
jne 0x6d718
leaq 0x4(%rax), %r13
cmpq %r13, %rcx
jae 0x6d800
movq %rax, %r13
orq $0xa, %r13
cmpq %r13, %rcx
jb 0x6d730
movq 0x2(%r12), %r15
bswapq %r15
jmp 0x6d73f
xorl %eax, %eax
xorl %r13d, %r13d
xorl %r15d, %r15d
jmp 0x6d73f
movq %rax, %r13
orq $0x2, %r13
leaq (%r15,%r13), %rdx
decq %rdx
cmpq %rcx, %rdx
jae 0x6d8a3
movq %r15, 0x278(%rbx)
leaq (%r12,%r13), %rcx
movq %rcx, 0x270(%rbx)
movzbl (%r12), %edx
movl %edx, 0x288(%rbx)
testq %rax, %rax
je 0x6d793
testq %r15, %r15
je 0x6d793
movq %rcx, %rdx
subq %rax, %rdx
xorl %eax, %eax
movl %eax, %esi
andl $0x3, %esi
movb (%rdx,%rsi), %sil
xorb %sil, (%rcx,%rax)
incq %rax
cmpq %rax, %r15
jne 0x6d77e
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x6d7c0
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6d7c0
movq %r14, %rdi
movl $0x67, %esi
callq *%rax
testl %eax, %eax
je 0x6d7c0
movb (%r12), %al
andb $0xf, %al
cmpb $0x8, %al
jne 0x6d7fb
movq (%rbx), %r12
orl $0x1, 0xa0(%r12)
addq %r13, %r15
je 0x6d6ce
movq 0x48(%r12), %rdx
subq %r15, %rdx
jb 0x6d6ce
movq 0x40(%r12), %rdi
leaq (%rdi,%r15), %rsi
callq 0xc1f0
subq %r15, 0x48(%r12)
jmp 0x6d6ce
movq (%rbx), %r12
jmp 0x6d7cc
movzwl 0x2(%r12), %edx
rolw $0x8, %dx
movzwl %dx, %r15d
jmp 0x6d73f
movq 0x2e0(%rbx), %rax
addq 0x2d8(%rbx), %rax
cmpq %rax, 0x2d0(%rbx)
jl 0x6d8a3
movq (%rbx), %rax
movq 0x40(%rax), %rax
movq %rax, 0x270(%rbx)
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x6d896
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6d896
leaq 0x8(%rbx), %r14
movq %r14, %rdi
movl $0x67, %esi
callq *%rax
testl %eax, %eax
je 0x6d896
cmpl $0x1, %eax
jne 0x6d8a3
movq (%rbx), %rax
testb $0x20, 0xa2(%rax)
je 0x6d88c
movq %r14, %rdi
callq 0x6846e
movq (%rbx), %rdi
leaq 0xbf97(%rip), %rsi      # 0x79819
movl $0x5, %edx
callq 0x6661a
movq %rbx, %rdi
callq 0x68a64
jmp 0x6d8a3
movq %rbx, %rdi
movl $0x1, %esi
callq 0x6db5a
movl 0x2b8(%rbx), %eax
movq -0x38(%rbp), %r15
cmpl $0x4, %eax
jne 0x6d926
cmpq $0x0, 0x48(%r15)
je 0x6d926
movq (%rbx), %r15
movq 0x2d8(%rbx), %rax
movq 0x40(%r15), %rsi
movq 0x48(%r15), %rdx
cmpq %rdx, %rax
cmovlq %rax, %rdx
movl 0x2b0(%rbx), %edi
callq 0xcb50
testq %rax, %rax
je 0x6d912
movq %rax, %r14
movq 0x48(%r15), %rdx
subq %rax, %rdx
jb 0x6d8ff
movq 0x40(%r15), %rdi
leaq (%rdi,%r14), %rsi
callq 0xc1f0
subq %r14, 0x48(%r15)
movq 0x2d8(%rbx), %rax
subq %r14, %rax
movq %rax, 0x2d8(%rbx)
jmp 0x6d919
movq 0x2d8(%rbx), %rax
testq %rax, %rax
jg 0x6d926
movq %rbx, %rdi
callq 0x68a64
addq $0x2a8, %rsp            # imm = 0x2A8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq -0x80(%rbp), %r8
movw $0x3d, 0x1b(%r8)
leaq 0xb60d(%rip), %rdx      # 0x78f57
leaq 0xbbba(%rip), %rcx      # 0x7950b
leaq 0xaa30(%rip), %r9       # 0x78388
leaq -0x2d0(%rbp), %r15
movl $0x1f4, %esi            # imm = 0x1F4
movq %r15, %rdi
xorl %eax, %eax
callq 0x6ad62
movq %r15, %rdi
callq 0xc460
movq (%rbx), %rdi
movq %r15, %rsi
movq %rax, %rdx
callq 0x6661a
movq 0x2a8(%rbx), %rax
testq %rax, %rax
je 0x6d9a3
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6d9a3
movq %r14, %rdi
movl $0x6c, %esi
callq *%rax
leaq 0xbc04(%rip), %rsi      # 0x795ae
movq %r14, %rdi
callq 0x67c6a
testq %rax, %rax
movq -0x38(%rbp), %r15
je 0x6da03
movq %rax, %r14
callq 0xc4a0
movq (%rax), %rax
xorl %ecx, %ecx
leaq 0xbbe6(%rip), %rdx      # 0x795b5
movzbl (%r14,%rcx), %r8d
movl (%rax,%r8,4), %esi
movzbl (%rcx,%rdx), %edi
movl (%rax,%rdi,4), %edi
testl %r8d, %r8d
je 0x6d9eb
incq %rcx
cmpl %edi, %esi
je 0x6d9cf
cmpl %edi, %esi
jne 0x6da03
movq (%rbx), %rdi
leaq 0xa757(%rip), %rsi      # 0x78150
movl $0x19, %edx
callq 0x6661a
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6db5a
jmp 0x6d3c7