// File: /workspace/github_c_makefile_star2_O1/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 $0x2c8, %rsp            # imm = 0x2C8
movq (%rdi), %r14
cmpl $0x6, 0x2b8(%rdi)
jne 0x6eea8
movq 0x2b0(%rdi), %rsi
testq %rsi, %rsi
je 0x6f678
movq %r14, %rdi
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x6ffee
movq %rdi, -0x30(%rbp)
movq -0x30(%rbp), %rdi
callq 0x6f6cc
movq -0x30(%rbp), %rdi
cmpq $0x0, 0x2e0(%rdi)
js 0x6ef1a
je 0x6ef29
movq 0x10(%rdi), %r15
cmpb $0x2f, (%r15)
je 0x6ef25
leaq 0x87d7(%rip), %rsi      # 0x776ad
movq %r15, %rdi
callq 0xc950
testl %eax, %eax
je 0x6ef25
leaq 0xc5c4(%rip), %rsi      # 0x7b4ad
movl $0x4, %edx
movq %r15, %rdi
callq 0x6ae41
testl %eax, %eax
je 0x6ef25
leaq 0xc5b1(%rip), %rsi      # 0x7b4b2
leaq -0x2f0(%rbp), %rdx
movq %r15, %rdi
xorl %eax, %eax
callq 0xc100
testl %eax, %eax
movq -0x30(%rbp), %rdi
jg 0x6ef29
movq -0x30(%rbp), %rdi
movl $0x190, %esi            # imm = 0x190
jmp 0x6ef48
movq -0x30(%rbp), %rdi
movq 0x2e0(%rdi), %rbx
testq %rbx, %rbx
jne 0x6ef5a
cmpq $0x4001, 0x48(%r14)     # imm = 0x4001
jb 0x6ef5a
movq -0x30(%rbp), %rdi
movl $0x19d, %esi            # imm = 0x19D
xorl %edx, %edx
xorl %eax, %eax
callq 0x6c73d
movq -0x30(%rbp), %rdi
jmp 0x6f33a
testq %rbx, %rbx
jle 0x6f33a
movq 0x18(%rdi), %r15
leaq 0x7879(%rip), %rsi      # 0x767e7
movq %r15, %rdi
callq 0xc950
testl %eax, %eax
je 0x6efa7
leaq 0xbf69(%rip), %rsi      # 0x7aeea
movq %r15, %rdi
callq 0xc950
testl %eax, %eax
je 0x6efa7
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
movl $0x1f9, %esi            # imm = 0x1F9
xorl %edx, %edx
xorl %eax, %eax
callq 0x6c73d
jmp 0x6f337
testq %rbx, %rbx
movq -0x30(%rbp), %rdi
jle 0x6f33a
cmpl $0x0, 0x2b8(%rdi)
jne 0x6f33a
leaq 0x8(%rdi), %r15
leaq 0xc4f2(%rip), %rsi      # 0x7b4be
movq %r15, %rdi
callq 0x69863
movq %rax, %r13
leaq 0xc4f6(%rip), %rsi      # 0x7b4d4
movq %r15, %rdi
callq 0x69863
movq %rax, %r12
testq %r13, %r13
setne %al
testq %r12, %r12
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x6f2c9
movq -0x30(%rbp), %rax
movl $0x1, 0x280(%rax)
movq 0x2a8(%rax), %rax
testq %rax, %rax
je 0x6f035
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6f035
movq %r15, %rdi
movl $0x6b, %esi
callq *%rax
testl %eax, %eax
jne 0x6f2a6
leaq 0xbf1d(%rip), %rdx      # 0x7af59
leaq 0xc4a3(%rip), %r8       # 0x7b4e6
xorl %ebx, %ebx
leaq -0x2f0(%rbp), %r13
movl $0x1f4, %esi            # imm = 0x1F4
movq %r13, %rdi
movq %r12, %rcx
xorl %eax, %eax
callq 0x6c630
movaps 0xb1cb(%rip), %xmm0     # 0x7a230
leaq -0xf0(%rbp), %r12
movups %xmm0, (%r12)
movl $0xc3d2e1f0, %eax       # imm = 0xC3D2E1F0
movq %rax, 0x10(%r12)
movl $0x0, 0x18(%r12)
movq %r13, %rdi
callq 0xc460
movq %r12, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x70417
xorl %eax, %eax
xorl %ecx, %ecx
cmpq $0x4, %rax
setb %cl
movl -0xdc(%rbp,%rcx,4), %edx
movl %ebx, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %edx
movb %dl, -0x70(%rbp,%rax)
incq %rax
addl $0x8, %ebx
cmpq $0x8, %rax
jne 0x6f09c
leaq -0x31(%rbp), %rsi
movb $-0x80, (%rsi)
leaq -0xf0(%rbp), %r12
movl $0x1, %edx
movq %r12, %rdi
callq 0x70417
movl $0x1f8, %ebx            # imm = 0x1F8
movl 0x14(%r12), %eax
andl %ebx, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
je 0x6f11a
leaq -0x31(%rbp), %r13
movb $0x0, -0x31(%rbp)
movl $0x1, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x70417
movl -0xdc(%rbp), %eax
andl %ebx, %eax
cmpl $0x1c0, %eax            # imm = 0x1C0
jne 0x6f0f7
leaq -0xf0(%rbp), %rdi
leaq -0x70(%rbp), %rsi
movl $0x8, %edx
callq 0x70417
xorl %eax, %eax
xorl %edx, %edx
movl %edx, %ecx
andl $-0x4, %ecx
movl -0xf0(%rbp,%rcx), %esi
movl %eax, %ecx
notb %cl
andb $0x18, %cl
shrl %cl, %esi
movb %sil, -0x90(%rbp,%rdx)
incq %rdx
addl $0x8, %eax
cmpq $0x14, %rdx
jne 0x6f133
xorps %xmm0, %xmm0
movups %xmm0, -0xa4(%rbp)
movaps %xmm0, -0xb0(%rbp)
movaps %xmm0, -0xc0(%rbp)
movaps %xmm0, -0xd0(%rbp)
movaps %xmm0, -0xe0(%rbp)
movaps %xmm0, -0xf0(%rbp)
xorl %eax, %eax
leaq 0xc3db(%rip), %rcx      # 0x7b56d
xorl %edx, %edx
movl $0x0, %esi
cmpq $0x11, %rax
ja 0x6f1a7
movzbl -0x8e(%rbp,%rax), %esi
movzbl -0x90(%rbp,%rax), %r8d
movzbl -0x8f(%rbp,%rax), %edi
movl %r8d, %r9d
shrl $0x2, %r9d
movb (%r9,%rcx), %r9b
movslq %edx, %rbx
movb %r9b, -0x70(%rbp,%rbx)
shll $0x4, %r8d
andl $0x30, %r8d
movl %edi, %r9d
shrl $0x4, %r9d
orl %r8d, %r9d
movb (%r9,%rcx), %r8b
movb %r8b, -0x6f(%rbp,%rbx)
andl $0xf, %edi
movl %esi, %r8d
shrl $0x6, %r8d
leal (%r8,%rdi,4), %edi
movb (%rdi,%rcx), %dil
movb %dil, -0x6e(%rbp,%rbx)
addq $0x3, %rbx
cmpq $0x11, %rax
ja 0x6f218
andl $0x3f, %esi
movb (%rsi,%rcx), %sil
addl $0x4, %edx
movb %sil, -0x70(%rbp,%rbx)
movl %edx, %ebx
leaq 0x3(%rax), %rsi
movl %ebx, %edx
cmpq $0x11, %rax
movq %rsi, %rax
jb 0x6f194
movl %ebx, %eax
andl $0x3, %eax
je 0x6f255
movslq %ebx, %rcx
leaq (%rcx,%rbp), %rdi
addq $-0x70, %rdi
movl $0x4, %edx
subl %eax, %edx
movl $0x3d, %esi
callq 0xc360
movl %ebx, %eax
orl $-0x4, %eax
subl %eax, %ebx
movslq %ebx, %rax
movb $0x0, -0x70(%rbp,%rax)
leaq 0xbcf3(%rip), %rdx      # 0x7af57
leaq 0xc2a0(%rip), %rcx      # 0x7b50b
leaq 0xb116(%rip), %r9       # 0x7a388
leaq -0x2f0(%rbp), %r12
leaq -0x70(%rbp), %r8
movl $0x1f4, %esi            # imm = 0x1F4
movq %r12, %rdi
xorl %eax, %eax
callq 0x6c630
movq %r12, %rdi
callq 0xc460
movq -0x30(%rbp), %rcx
movq (%rcx), %rdi
movq %r12, %rsi
movq %rax, %rdx
callq 0x681c0
movq -0x30(%rbp), %rax
movq 0x2a8(%rax), %rax
testq %rax, %rax
je 0x6f2c9
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6f2c9
movq %r15, %rdi
movl $0x6c, %esi
callq *%rax
leaq 0xc2de(%rip), %rsi      # 0x7b5ae
movq %r15, %rdi
callq 0x69863
testq %rax, %rax
je 0x6f329
movq %rax, %r15
callq 0xc4a0
movq (%rax), %rax
xorl %ecx, %ecx
leaq 0xc2c4(%rip), %rdx      # 0x7b5b5
movzbl (%r15,%rcx), %r8d
movl (%rax,%r8,4), %esi
movzbl (%rcx,%rdx), %edi
movl (%rax,%rdi,4), %edi
testl %r8d, %r8d
je 0x6f30d
incq %rcx
cmpl %edi, %esi
je 0x6f2f1
cmpl %edi, %esi
jne 0x6f329
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq 0xae31(%rip), %rsi      # 0x7a150
movl $0x19, %edx
callq 0x681c0
movq -0x30(%rbp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x6f7bb
movq %rbx, %rdi
movq %r14, -0x40(%rbp)
cmpl $0x2, 0x2b8(%rdi)
jne 0x6f363
movq 0x2b0(%rdi), %rsi
testq %rsi, %rsi
je 0x6f363
movq -0x30(%rbp), %rax
movq (%rax), %rdi
callq 0x6ffee
movq -0x30(%rbp), %rdi
cmpl $0x3, 0x2b8(%rdi)
jne 0x6f5fa
movq -0x40(%rbp), %r14
movq 0x40(%r14), %rax
movq %rax, 0x270(%rdi)
movq 0x48(%r14), %rax
movq %rax, 0x278(%rdi)
xorl %eax, %eax
testq %rdi, %rdi
je 0x6f3b9
movq 0x2a8(%rdi), %rcx
testq %rcx, %rcx
je 0x6f3b9
movq 0x30(%rcx), %rcx
testq %rcx, %rcx
je 0x6f3b9
movq -0x30(%rbp), %rax
leaq 0x8(%rax), %rdi
movl $0x69, %esi
callq *%rcx
movq -0x30(%rbp), %rdi
testl %eax, %eax
js 0x6f3e7
je 0x6f3f1
movl %eax, %ebx
cmpq %rbx, 0x48(%r14)
jb 0x6f3f1
movq 0x48(%r14), %rdx
subq %rbx, %rdx
jb 0x6f3f1
movq 0x40(%r14), %rdi
leaq (%rdi,%rbx), %rsi
callq 0xc1f0
movq -0x30(%rbp), %rdi
subq %rbx, 0x48(%r14)
jmp 0x6f3f1
movq (%rdi), %rax
orl $0x1, 0xa0(%rax)
cmpl $0x0, 0x280(%rdi)
je 0x6f549
leaq 0x8(%rdi), %rax
movq %rax, -0x48(%rbp)
movq (%rdi), %rax
movq 0x40(%rax), %r13
movq 0x48(%rax), %r12
cmpq $0x2, %r12
jb 0x6f462
movzbl 0x1(%r13), %eax
movl %eax, %r14d
andl $0x7f, %r14d
shrl $0x5, %eax
andl $0x4, %eax
cmpb $0x7e, %r14b
setae %cl
cmpq %rax, %r12
setb %dl
orb %cl, %dl
je 0x6f46c
cmpb $0x7e, %r14b
jne 0x6f44d
leaq 0x4(%rax), %r15
cmpq %r15, %r12
jae 0x6f537
movq %rax, %r15
orq $0xa, %r15
cmpq %r15, %r12
jb 0x6f464
movq 0x2(%r13), %r14
bswapq %r14
jmp 0x6f473
xorl %eax, %eax
xorl %r15d, %r15d
xorl %r14d, %r14d
jmp 0x6f473
movq %rax, %r15
orq $0x2, %r15
leaq (%r14,%r15), %rbx
decq %rbx
cmpq %r12, %rbx
jae 0x6f5fa
movq %r14, 0x278(%rdi)
leaq (%r15,%r13), %rcx
movq %rcx, 0x270(%rdi)
movzbl (%r13), %edx
movl %edx, 0x288(%rdi)
testq %rax, %rax
je 0x6f4c7
testq %r14, %r14
je 0x6f4c7
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, %r14
jne 0x6f4b2
movq 0x2a8(%rdi), %rax
testq %rax, %rax
je 0x6f4f9
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6f4f9
movq -0x48(%rbp), %rdi
movl $0x67, %esi
callq *%rax
movq -0x30(%rbp), %rdi
testl %eax, %eax
je 0x6f4f9
movb (%r13), %al
andb $0xf, %al
cmpb $0x8, %al
jne 0x6f503
movq (%rdi), %rax
orl $0x1, 0xa0(%rax)
addq %r15, %r14
je 0x6f529
movq (%rdi), %r15
movq 0x48(%r15), %rdx
subq %r14, %rdx
jb 0x6f529
movq 0x40(%r15), %rdi
leaq (%rdi,%r14), %rsi
callq 0xc1f0
movq -0x30(%rbp), %rdi
subq %r14, 0x48(%r15)
cmpq %r12, %rbx
jb 0x6f406
jmp 0x6f5fa
movzwl 0x2(%r13), %ecx
rolw $0x8, %cx
movzwl %cx, %r14d
jmp 0x6f473
movq 0x2e0(%rdi), %rax
addq 0x2d8(%rdi), %rax
cmpq %rax, 0x2d0(%rdi)
jl 0x6f5fa
movq (%rdi), %rax
movq 0x40(%rax), %rax
leaq 0x8(%rdi), %r12
movq %rax, 0x270(%rdi)
movq 0x2a8(%rdi), %rax
xorl %r15d, %r15d
testq %rax, %rax
je 0x6f59f
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x6f59f
movq %r12, %rdi
movl $0x67, %esi
callq *%rax
movq -0x30(%rbp), %rdi
movl %eax, %r15d
testl %r15d, %r15d
je 0x6f5e8
cmpl $0x1, %r15d
jne 0x6f5fa
movq (%rdi), %rax
testb $0x20, 0xa2(%rax)
je 0x6f5d6
movq %r12, %rdi
callq 0x6a032
movq -0x30(%rbp), %rax
movq (%rax), %rdi
leaq 0xc24d(%rip), %rsi      # 0x7b819
movl $0x5, %edx
callq 0x681c0
movq -0x30(%rbp), %rdi
callq 0x6a615
movq -0x30(%rbp), %rdi
testl %r15d, %r15d
jne 0x6f5fa
movq -0x30(%rbp), %rdi
movl $0x1, %esi
callq 0x6f7bb
movq -0x30(%rbp), %rdi
cmpl $0x4, 0x2b8(%rdi)
movq -0x40(%rbp), %rax
jne 0x6f678
cmpq $0x0, 0x48(%rax)
je 0x6f678
movq (%rdi), %rbx
movq 0x2d8(%rdi), %rax
movq 0x40(%rbx), %rsi
movq 0x48(%rbx), %rdx
cmpq %rdx, %rax
cmovlq %rax, %rdx
movq -0x30(%rbp), %rax
movl 0x2b0(%rax), %edi
callq 0xcb50
movq -0x30(%rbp), %rdi
testq %rax, %rax
je 0x6f669
movq %rax, %r14
movq 0x48(%rbx), %rdx
subq %rax, %rdx
jb 0x6f662
movq 0x40(%rbx), %rdi
movq %r14, %rsi
addq %rdi, %rsi
callq 0xc1f0
movq -0x30(%rbp), %rdi
subq %r14, 0x48(%rbx)
subq %r14, 0x2d8(%rdi)
cmpq $0x0, 0x2d8(%rdi)
jg 0x6f678
callq 0x6a615
addq $0x2c8, %rsp            # imm = 0x2C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq