// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/jemalloc.c
// Function: je_get_defrag_hint
JEMALLOC_NOTHROW
je_get_defrag_hint(void* ptr, int *bin_util, int *run_util) {
    int defrag = 0;
    arena_chunk_t *chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(ptr);
    if (likely(chunk != ptr)) { /* indication that this is not a HUGE alloc */
        size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
        size_t mapbits = arena_mapbits_get(chunk, pageind);
        if (likely((mapbits & CHUNK_MAP_LARGE) == 0)) { /* indication that this is not a LARGE alloc */
            arena_t *arena = extent_node_arena_get(&chunk->node);
            size_t rpages_ind = pageind - arena_mapbits_small_runind_get(chunk, pageind);
            arena_run_t *run = &arena_miscelm_get_mutable(chunk, rpages_ind)->run;
            arena_bin_t *bin = &arena->bins[run->binind];
            tsd_t *tsd = tsd_fetch();
            malloc_mutex_lock(tsd_tsdn(tsd), &bin->lock);
            /* runs that are in the same chunk in as the current chunk, are likely to be the next currun */
            if (chunk != (arena_chunk_t *)CHUNK_ADDR2BASE(bin->runcur)) {
                arena_bin_info_t *bin_info = &arena_bin_info[run->binind];
                size_t availregs = bin_info->nregs * bin->stats.curruns;
                *bin_util = (bin->stats.curregs<<16) / availregs;
                *run_util = ((bin_info->nregs - run->nfree)<<16) / bin_info->nregs;
                defrag = 1;
            }
	    malloc_mutex_unlock(tsd_tsdn(tsd), &bin->lock);
        }
    }
    return defrag;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x100(%rbp)
movq %rsi, -0x108(%rbp)
movq %rdx, -0x110(%rbp)
movl $0x0, -0x114(%rbp)
movq -0x100(%rbp), %rax
leaq 0x6c4b8(%rip), %rcx     # 0xa40b0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x120(%rbp)
movq -0x120(%rbp), %rax
cmpq -0x100(%rbp), %rax
setne %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x380f4
movq -0x100(%rbp), %rax
movq -0x120(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movq %rax, -0x128(%rbp)
movq -0x120(%rbp), %rcx
movq -0x128(%rbp), %rax
movq %rcx, -0xe0(%rbp)
movq %rax, -0xe8(%rbp)
movq -0xe0(%rbp), %rcx
movq -0xe8(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq %rax, -0x50(%rbp)
movq -0x48(%rbp), %rcx
movq -0x50(%rbp), %rax
movq %rcx, -0x38(%rbp)
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x8(%rbp)
movq %rax, -0x10(%rbp)
movq -0x8(%rbp), %rax
addq $0x78, %rax
movq -0x10(%rbp), %rcx
leaq 0x6c2f0(%rip), %rdx     # 0xa3fa0
subq (%rdx), %rcx
shlq $0x3, %rcx
addq %rcx, %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x130(%rbp)
movq -0x130(%rbp), %rax
andq $0x2, %rax
cmpq $0x0, %rax
sete %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x380f2
movq -0x120(%rbp), %rdi
callq 0x38110
movq %rax, -0x138(%rbp)
movq -0x128(%rbp), %rax
movq -0x120(%rbp), %rdx
movq -0x128(%rbp), %rcx
movq %rdx, -0xc8(%rbp)
movq %rcx, -0xd0(%rbp)
movq -0xc8(%rbp), %rdx
movq -0xd0(%rbp), %rcx
movq %rdx, -0xb8(%rbp)
movq %rcx, -0xc0(%rbp)
movq -0xb8(%rbp), %rdx
movq -0xc0(%rbp), %rcx
movq %rdx, -0x58(%rbp)
movq %rcx, -0x60(%rbp)
movq -0x58(%rbp), %rdx
movq -0x60(%rbp), %rcx
movq %rdx, -0x28(%rbp)
movq %rcx, -0x30(%rbp)
movq -0x28(%rbp), %rdx
movq -0x30(%rbp), %rcx
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x18(%rbp), %rcx
addq $0x78, %rcx
movq -0x20(%rbp), %rdx
leaq 0x6c212(%rip), %rsi     # 0xa3fa0
subq (%rsi), %rdx
shlq $0x3, %rdx
addq %rdx, %rcx
movq %rcx, -0x70(%rbp)
movq -0x70(%rbp), %rcx
movq (%rcx), %rcx
movq %rcx, -0xd8(%rbp)
movq -0xd8(%rbp), %rcx
shrq $0xd, %rcx
subq %rcx, %rax
movq %rax, -0x140(%rbp)
movq -0x120(%rbp), %rcx
movq -0x140(%rbp), %rax
movq %rcx, -0xa8(%rbp)
movq %rax, -0xb0(%rbp)
movq -0xa8(%rbp), %rax
leaq 0x6c1bf(%rip), %rcx     # 0xa3fa8
addq (%rcx), %rax
imulq $0x60, -0xb0(%rbp), %rcx
addq %rcx, %rax
xorl %ecx, %ecx
leaq 0x6c1a0(%rip), %rdx     # 0xa3fa0
subq (%rdx), %rcx
imulq $0x60, %rcx, %rcx
addq %rcx, %rax
addq $0x18, %rax
movq %rax, -0x148(%rbp)
movq -0x138(%rbp), %rax
addq $0x980, %rax            # imm = 0x980
movq -0x148(%rbp), %rcx
movl (%rcx), %ecx
imulq $0xa8, %rcx, %rcx
addq %rcx, %rax
movq %rax, -0x150(%rbp)
movb $0x1, -0x91(%rbp)
movb -0x91(%rbp), %al
andb $0x1, %al
movb %al, -0x81(%rbp)
movq 0x6b198(%rip), %rcx     # 0xa2ff0
movq %fs:0x0, %rax
addq %rcx, %rax
movq %rax, -0xa0(%rbp)
testb $0x1, -0x91(%rbp)
jne 0x37e96
xorl %eax, %eax
testb $0x1, %al
jne 0x37e7c
jmp 0x37e96
cmpq $0x0, -0xa0(%rbp)
jne 0x37e96
movq $0x0, -0x90(%rbp)
jmp 0x37fd9
movq -0xa0(%rbp), %rax
cmpl $0x1, (%rax)
setne %al
testb $0x1, %al
jne 0x37eac
jmp 0x37fcb
movq -0xa0(%rbp), %rax
cmpl $0x0, (%rax)
jne 0x37f3c
movq -0xa0(%rbp), %rax
movl $0x1, (%rax)
movq -0xa0(%rbp), %rax
movq %rax, -0x80(%rbp)
movq 0x6b115(%rip), %rax     # 0xa2ff0
movq %fs:0x0, %rdi
addq %rax, %rdi
movq -0x80(%rbp), %rsi
movl $0x68, %edx
callq 0xb310
leaq 0x6c638(%rip), %rax     # 0xa4534
movl (%rax), %edi
movq 0x6b0eb(%rip), %rax     # 0xa2ff0
movq %fs:0x0, %rsi
addq %rax, %rsi
callq 0xb590
cmpl $0x0, %eax
je 0x37f37
leaq 0x58f58(%rip), %rdi     # 0x90e7a
callq 0x828c0
testb $0x1, 0x6b5d2(%rip)     # 0xa3500
je 0x37f35
callq 0xb050
jmp 0x37f37
jmp 0x37fc9
movq -0xa0(%rbp), %rax
cmpl $0x2, (%rax)
jne 0x37fc5
movq -0xa0(%rbp), %rax
movl $0x3, (%rax)
movq -0xa0(%rbp), %rax
movq %rax, -0x78(%rbp)
movq 0x6b089(%rip), %rax     # 0xa2ff0
movq %fs:0x0, %rdi
addq %rax, %rdi
movq -0x78(%rbp), %rsi
movl $0x68, %edx
callq 0xb310
leaq 0x6c5ac(%rip), %rax     # 0xa4534
movl (%rax), %edi
movq 0x6b05f(%rip), %rax     # 0xa2ff0
movq %fs:0x0, %rsi
addq %rax, %rsi
callq 0xb590
cmpl $0x0, %eax
je 0x37fc3
leaq 0x58ecc(%rip), %rdi     # 0x90e7a
callq 0x828c0
testb $0x1, 0x6b546(%rip)     # 0xa3500
je 0x37fc1
callq 0xb050
jmp 0x37fc3
jmp 0x37fc7
jmp 0x37fc7
jmp 0x37fc9
jmp 0x37fcb
movq -0xa0(%rbp), %rax
movq %rax, -0x90(%rbp)
movq -0x90(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0xf0(%rbp), %rdi
movq -0x150(%rbp), %rsi
callq 0x19ee0
movq -0x120(%rbp), %rax
movq -0x150(%rbp), %rcx
movq 0x50(%rcx), %rcx
leaq 0x6c08f(%rip), %rdx     # 0xa40b0
movq (%rdx), %rdx
xorq $-0x1, %rdx
andq %rdx, %rcx
cmpq %rcx, %rax
je 0x380d1
movq -0x148(%rbp), %rax
movl (%rax), %eax
movl %eax, %ecx
leaq 0x6b57a(%rip), %rax     # 0xa35c0
shlq $0x6, %rcx
addq %rcx, %rax
movq %rax, -0x160(%rbp)
movq -0x160(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x150(%rbp), %rcx
imulq 0xa0(%rcx), %rax
movq %rax, -0x168(%rbp)
movq -0x150(%rbp), %rax
movq 0x78(%rax), %rax
shlq $0x10, %rax
xorl %ecx, %ecx
movl %ecx, %edx
divq -0x168(%rbp)
movl %eax, %ecx
movq -0x108(%rbp), %rax
movl %ecx, (%rax)
movq -0x160(%rbp), %rax
movl 0x20(%rax), %eax
movq -0x148(%rbp), %rcx
subl 0x4(%rcx), %eax
shll $0x10, %eax
movq -0x160(%rbp), %rcx
xorl %edx, %edx
divl 0x20(%rcx)
movl %eax, %ecx
movq -0x110(%rbp), %rax
movl %ecx, (%rax)
movl $0x1, -0x114(%rbp)
movq -0x158(%rbp), %rax
movq %rax, -0xf8(%rbp)
movq -0xf8(%rbp), %rdi
movq -0x150(%rbp), %rsi
callq 0x19fd0
jmp 0x380f4
movl -0x114(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)