// File: /workspace/github_cpp_makefile_star2_O3/xocoder[P]m_kcptun/vendor/m_foundation/src/model/m_mem.c
// Function: mm_report
void mm_report(int brief_level) {
   memhead_t *mh = &g_mh;
   _lock(mh->lock);
   if (mh->head) {
      mem_t *m = mh->head;
      _log("[mem] ---- active %d, size %luKb ----\n", mh->count, mh->size>>10);
      if (brief_level == 2) {
         int i = mh->count;
         while (i-- > 0) {
            _log("[mem] (%d:%s), %lu bytes\n", m->line, m->fname, m->size);
            m = m->next;
         };
      }
      else if (brief_level == 1) {
         mrec_t mrec[128];
         memset(mrec, 0, 128*sizeof(mrec_t));
         int i, count=mh->count, top = 0;
         while (count-- > 0) {
            mrec_t *mt = &mrec[top];
            for (i=0; i<top; i++) {
               if (mrec[i].fname == m->fname) {
                  mt = &mrec[i]; mt->size += m->size;
                  goto m_next;
               }
            }
            mt->fname=m->fname;  mt->size=m->size;  top++;
           m_next: m = m->next;
         }
         qsort(mrec, top, sizeof(mrec_t), _rec_compare);
         for (i=0; i<top; i++) {
            mrec_t *mt = &mrec[i];
            _log("[mem] %s, %luKb\n", mt->fname, mt->size>>10);
         }
      }
      else {
         goto report_end;
      }
      _log("[mem] ---- end report ----\n");
   }
   else {
      _log("[mem] no more active\n");
   }
  report_end:
   _unlock(mh->lock);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x808, %rsp            # imm = 0x808
movl %edi, %ebx
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0xa328(%rip)      # 0x102d8
jne 0x5fa6
movq 0xa32f(%rip), %r14      # 0x102e8
testq %r14, %r14
je 0x602e
movl 0xa318(%rip), %esi      # 0x102dc
movq 0xa315(%rip), %rdx      # 0x102e0
shrq $0xa, %rdx
leaq 0x58f7(%rip), %rdi      # 0xb8cd
xorl %eax, %eax
callq 0x2060
cmpl $0x1, %ebx
je 0x603a
cmpl $0x2, %ebx
jne 0x6140
movl 0xa2ea(%rip), %r15d     # 0x102dc
testl %r15d, %r15d
jle 0x6134
incl %r15d
leaq 0x58ef(%rip), %rbx      # 0xb8f4
movzwl 0x20(%r14), %esi
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2060
movq 0x8(%r14), %r14
decl %r15d
cmpl $0x1, %r15d
ja 0x6005
jmp 0x6134
leaq 0x58ea(%rip), %rdi      # 0xb91f
jmp 0x613b
leaq -0x820(%rbp), %rdi
xorl %r15d, %r15d
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x2180
movl 0xa286(%rip), %eax      # 0x102dc
testl %eax, %eax
jle 0x611a
movq 0x10(%r14), %rcx
testl %r15d, %r15d
jle 0x6083
movl %r15d, %edx
shlq $0x4, %rdx
xorl %esi, %esi
cmpq %rcx, -0x820(%rbp,%rsi)
je 0x60a4
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x6070
movslq %r15d, %rdx
shlq $0x4, %rdx
addq %rbp, %rdx
addq $-0x820, %rdx           # imm = 0xF7E0
movq %rcx, (%rdx)
movq 0x18(%r14), %rcx
movq %rcx, 0x8(%rdx)
incl %r15d
jmp 0x60b0
movq 0x18(%r14), %rcx
addq %rcx, -0x818(%rbp,%rsi)
leal -0x1(%rax), %ecx
movq 0x8(%r14), %r14
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x605e
movslq %r15d, %rbx
leaq 0x95(%rip), %rcx        # 0x615d
leaq -0x820(%rbp), %rdi
movl $0x10, %edx
movq %rbx, %rsi
callq 0x2460
testl %ebx, %ebx
jle 0x6134
movl %r15d, %r14d
shlq $0x4, %r14
leaq 0x5820(%rip), %rbx      # 0xb90e
xorl %r15d, %r15d
movq -0x820(%rbp,%r15), %rsi
movq -0x818(%rbp,%r15), %rdx
shrq $0xa, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2060
addq $0x10, %r15
cmpq %r15, %r14
jne 0x60f1
jmp 0x6134
leaq 0x3c(%rip), %rcx        # 0x615d
leaq -0x820(%rbp), %rdi
movl $0x10, %edx
xorl %esi, %esi
callq 0x2460
leaq 0x57f9(%rip), %rdi      # 0xb934
callq 0x23b0
xorl %ecx, %ecx
movl $0x1, %eax
lock
cmpxchgl %ecx, 0xa189(%rip)      # 0x102d8
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq