// File: /workspace/github_cpp_makefile_star2_O2/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
pushq $0x1
popq %rcx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0x982b(%rip)      # 0xf2c8
jne 0x5a93
movq 0x9832(%rip), %r14      # 0xf2d8
testq %r14, %r14
je 0x5b12
movl 0x981b(%rip), %esi      # 0xf2cc
movq 0x9818(%rip), %rdx      # 0xf2d0
shrq $0xa, %rdx
leaq 0x4e0a(%rip), %rdi      # 0xa8cd
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x2050
cmpl $0x1, %ebx
je 0x5b1e
cmpl $0x2, %ebx
jne 0x5c0a
movl 0x97ea(%rip), %r15d     # 0xf2cc
leaq 0x4e0b(%rip), %rbx      # 0xa8f4
testl %r15d, %r15d
jle 0x5bfe
decl %r15d
movzwl 0x20(%r14), %esi
movq 0x10(%r14), %rdx
movq 0x18(%r14), %rcx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
movq 0x8(%r14), %r14
jmp 0x5ae9
leaq 0x4e06(%rip), %rdi      # 0xa91f
jmp 0x5c05
leaq -0x820(%rbp), %rdi
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x2180
movl 0x9795(%rip), %eax      # 0xf2cc
movslq %r15d, %rbx
testl %eax, %eax
jle 0x5ba6
decl %eax
movq %rbx, %rcx
shlq $0x4, %rcx
testl %ebx, %ebx
movl $0x0, %edx
cmovgl %r15d, %edx
addq %rbp, %rcx
addq $-0x820, %rcx           # imm = 0xF7E0
shlq $0x4, %rdx
addq $0x10, %rdx
xorl %edi, %edi
leaq 0x10(%rdi), %rsi
cmpq %rsi, %rdx
je 0x5b8e
movq -0x820(%rbp,%rdi), %r8
movq %rsi, %rdi
cmpq 0x10(%r14), %r8
jne 0x5b66
movq 0x18(%r14), %rcx
addq %rcx, -0x828(%rbp,%rsi)
jmp 0x5ba0
movq 0x10(%r14), %rdx
movq %rdx, (%rcx)
movq 0x18(%r14), %rdx
movq %rdx, 0x8(%rcx)
incl %r15d
movq 0x8(%r14), %r14
jmp 0x5b37
leaq 0x78(%rip), %rcx        # 0x5c25
leaq -0x820(%rbp), %rdi
pushq $0x10
popq %rdx
movq %rbx, %rsi
callq 0x2430
xorl %eax, %eax
testl %ebx, %ebx
cmovlel %eax, %r15d
shlq $0x4, %r15
leaq 0x4d3c(%rip), %rbx      # 0xa90e
xorl %r14d, %r14d
cmpq %r14, %r15
je 0x5bfe
movq -0x820(%rbp,%r14), %rsi
movq -0x818(%rbp,%r14), %rdx
shrq $0xa, %rdx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x2050
addq $0x10, %r14
jmp 0x5bd5
leaq 0x4d2f(%rip), %rdi      # 0xa934
callq 0x2390
pushq $0x1
popq %rax
xorl %ecx, %ecx
lock
cmpxchgl %ecx, 0x96b1(%rip)      # 0xf2c8
addq $0x808, %rsp            # imm = 0x808
popq %rbx
popq %r14
popq %r15
popq %rbp
retq