// File: /workspace/github_c_makefile_star2_O0/sfeakes[P]unifi-motion/mongoose.c
// Function: mg_recv_common
MG_INTERNAL void mg_recv_common(struct mg_connection *nc, void *buf, int len,
                                int own) {
  DBG(("%p %d %u", nc, len, (unsigned int) nc->recv_mbuf.len));

#if !defined(NO_LIBC) && MG_ENABLE_HEXDUMP
  if (nc->mgr && nc->mgr->hexdump_file != NULL) {
    mg_hexdump_connection(nc, nc->mgr->hexdump_file, buf, len, MG_EV_RECV);
  }
#endif

  if (nc->flags & MG_F_CLOSE_IMMEDIATELY) {
    DBG(("%p discarded %d bytes", nc, len));
    /*
     * This connection will not survive next poll. Do not deliver events,
     * send data to /dev/null without acking.
     */
    if (own) {
      MG_FREE(buf);
    }
    return;
  }
  nc->last_io_time = (time_t) mg_time();
  if (!own) {
    mbuf_append(&nc->recv_mbuf, buf, len);
  } else if (nc->recv_mbuf.len == 0) {
    /* Adopt buf as recv_mbuf's backing store. */
    mbuf_free(&nc->recv_mbuf);
    nc->recv_mbuf.buf = (char *) buf;
    nc->recv_mbuf.size = nc->recv_mbuf.len = len;
  } else {
    mbuf_append(&nc->recv_mbuf, buf, len);
    MG_FREE(buf);
  }
  mg_call(nc, NULL, nc->user_data, MG_EV_RECV, &len);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movl %edx, -0x14(%rbp)
movl %ecx, -0x18(%rbp)
movl $0x4, %edi
leaq 0x147a1(%rip), %rsi     # 0x20203
leaq 0x13ae1(%rip), %rdx     # 0x1f54a
callq 0x4650
cmpl $0x0, %eax
je 0xba92
movq -0x8(%rbp), %rsi
movl -0x14(%rbp), %edx
movq -0x8(%rbp), %rax
movq 0x48(%rax), %rax
movl %eax, %ecx
leaq 0x14787(%rip), %rdi     # 0x20212
movb $0x0, %al
callq 0x47a0
jmp 0xba94
movq -0x8(%rbp), %rax
cmpq $0x0, 0x18(%rax)
je 0xbad0
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
cmpq $0x0, 0x8(%rax)
je 0xbad0
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0x18(%rax), %rax
movq 0x8(%rax), %rsi
movq -0x10(%rbp), %rdx
movl -0x14(%rbp), %ecx
movl $0x3, %r8d
callq 0xb7f0
movq -0x8(%rbp), %rax
movq 0xc8(%rax), %rax
andq $0x800, %rax            # imm = 0x800
cmpq $0x0, %rax
je 0xbb31
jmp 0xbae9
movl $0x4, %edi
leaq 0x1470e(%rip), %rsi     # 0x20203
leaq 0x13a4e(%rip), %rdx     # 0x1f54a
callq 0x4650
cmpl $0x0, %eax
je 0xbb1b
movq -0x8(%rbp), %rsi
movl -0x14(%rbp), %edx
leaq 0x14707(%rip), %rdi     # 0x2021b
movb $0x0, %al
callq 0x47a0
jmp 0xbb1d
cmpl $0x0, -0x18(%rbp)
je 0xbb2c
movq -0x10(%rbp), %rdi
callq 0x3050
jmp 0xbbdb
callq 0xb6e0
cvttsd2si %xmm0, %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x70(%rax)
cmpl $0x0, -0x18(%rbp)
jne 0xbb60
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0x89b0
jmp 0xbbba
movq -0x8(%rbp), %rax
cmpq $0x0, 0x48(%rax)
jne 0xbb9a
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
callq 0x86e0
movq -0x10(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x40(%rax)
movslq -0x14(%rbp), %rcx
movq -0x8(%rbp), %rax
movq %rcx, 0x48(%rax)
movq -0x8(%rbp), %rax
movq %rcx, 0x50(%rax)
jmp 0xbbb8
movq -0x8(%rbp), %rdi
addq $0x40, %rdi
movq -0x10(%rbp), %rsi
movslq -0x14(%rbp), %rdx
callq 0x89b0
movq -0x10(%rbp), %rdi
callq 0x3050
jmp 0xbbba
movq -0x8(%rbp), %rdi
movq -0x8(%rbp), %rax
movq 0xa0(%rax), %rdx
xorl %eax, %eax
movl %eax, %esi
movl $0x3, %ecx
leaq -0x14(%rbp), %r8
callq 0xa8e0
addq $0x20, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)