// File: /workspace/github_cpp_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x800, %rsp            # imm = 0x800
movl %edi, %ebx
movl $0x1, %ecx
xorl %eax, %eax
lock
cmpxchgl %ecx, 0xa27d(%rip)      # 0x102d8
jne 0x6051
movq 0xa284(%rip), %r15      # 0x102e8
testq %r15, %r15
je 0x60e3
movl 0xa26d(%rip), %esi      # 0x102dc
movq 0xa26a(%rip), %rdx      # 0x102e0
shrq $0xa, %rdx
leaq 0x584c(%rip), %rdi      # 0xb8cd
xorl %r14d, %r14d
xorl %eax, %eax
callq 0x2060
cmpl $0x1, %ebx
je 0x60ef
cmpl $0x2, %ebx
jne 0x61dc
movl 0xa23c(%rip), %r12d     # 0x102dc
leaq 0x588d(%rip), %rbx      # 0xb934
testl %r12d, %r12d
jle 0x61d4
incl %r12d
leaq 0x583a(%rip), %r14      # 0xb8f4
movzwl 0x20(%r15), %esi
movq 0x10(%r15), %rdx
movq 0x18(%r15), %rcx
movq %r14, %rdi
xorl %eax, %eax
callq 0x2060
movq 0x8(%r15), %r15
decl %r12d
cmpl $0x1, %r12d
jg 0x60ba
jmp 0x61d4
leaq 0x5835(%rip), %rbx      # 0xb91f
jmp 0x61d4
leaq -0x820(%rbp), %rdi
movl $0x800, %edx            # imm = 0x800
xorl %esi, %esi
callq 0x2180
movl 0xa1d4(%rip), %eax      # 0x102dc
testl %eax, %eax
jle 0x6173
xorl %r14d, %r14d
testl %r14d, %r14d
jle 0x6134
movq 0x10(%r15), %rcx
movl %r14d, %edx
shlq $0x4, %rdx
xorl %esi, %esi
cmpq %rcx, -0x820(%rbp,%rsi)
je 0x6159
addq $0x10, %rsi
cmpq %rsi, %rdx
jne 0x6121
movslq %r14d, %rcx
shlq $0x4, %rcx
addq %rbp, %rcx
addq $-0x820, %rcx           # imm = 0xF7E0
movq 0x10(%r15), %rdx
movq %rdx, (%rcx)
movq 0x18(%r15), %rdx
movq %rdx, 0x8(%rcx)
incl %r14d
jmp 0x6165
movq 0x18(%r15), %rcx
addq %rcx, -0x818(%rbp,%rsi)
leal -0x1(%rax), %ecx
movq 0x8(%r15), %r15
cmpl $0x1, %eax
movl %ecx, %eax
jg 0x610f
movslq %r14d, %rbx
leaq 0x7e(%rip), %rcx        # 0x61fb
leaq -0x820(%rbp), %rdi
movl $0x10, %edx
movq %rbx, %rsi
callq 0x2450
testl %ebx, %ebx
jle 0x61cd
movl %r14d, %r14d
shlq $0x4, %r14
leaq 0x576b(%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 0x61a6
leaq 0x5760(%rip), %rbx      # 0xb934
movq %rbx, %rdi
callq 0x23a0
xorl %ecx, %ecx
movl $0x1, %eax
lock
cmpxchgl %ecx, 0xa0ed(%rip)      # 0x102d8
addq $0x800, %rsp            # imm = 0x800
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq