// File: /workspace/github_c_makefile_star2_O0/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/ctl.c
// Function: arena_i_chunk_hooks_ctl
static int
arena_i_chunk_hooks_ctl(tsd_t *tsd, const size_t *mib, size_t miblen,
    void *oldp, size_t *oldlenp, void *newp, size_t newlen)
{
	int ret;
	unsigned arena_ind = (unsigned)mib[1];
	arena_t *arena;

	malloc_mutex_lock(tsd_tsdn(tsd), &ctl_mtx);
	if (arena_ind < narenas_total_get() && (arena =
	    arena_get(tsd_tsdn(tsd), arena_ind, false)) != NULL) {
		if (newp != NULL) {
			chunk_hooks_t old_chunk_hooks, new_chunk_hooks;
			WRITE(new_chunk_hooks, chunk_hooks_t);
			old_chunk_hooks = chunk_hooks_set(tsd_tsdn(tsd), arena,
			    &new_chunk_hooks);
			READ(old_chunk_hooks, chunk_hooks_t);
		} else {
			chunk_hooks_t old_chunk_hooks =
			    chunk_hooks_get(tsd_tsdn(tsd), arena);
			READ(old_chunk_hooks, chunk_hooks_t);
		}
	} else {
		ret = EFAULT;
		goto label_return;
	}
	ret = 0;
label_return:
	malloc_mutex_unlock(tsd_tsdn(tsd), &ctl_mtx);
	return (ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq 0x10(%rbp), %rax
movq %rdi, -0x30(%rbp)
movq %rsi, -0x38(%rbp)
movq %rdx, -0x40(%rbp)
movq %rcx, -0x48(%rbp)
movq %r8, -0x50(%rbp)
movq %r9, -0x58(%rbp)
movq -0x38(%rbp), %rax
movq 0x8(%rax), %rax
movl %eax, -0x60(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rdi
leaq 0x4ba9b(%rip), %rsi     # 0xa40e0
callq 0x54620
movl -0x60(%rbp), %eax
movl %eax, -0x15c(%rbp)
callq 0x19e40
movl %eax, %ecx
movl -0x15c(%rbp), %eax
cmpl %ecx, %eax
jae 0x5883f
movq -0x30(%rbp), %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x60(%rbp), %esi
xorl %edx, %edx
callq 0x54b20
movq %rax, -0x68(%rbp)
cmpq $0x0, %rax
je 0x5883f
cmpq $0x0, -0x58(%rbp)
je 0x58798
jmp 0x58699
cmpq $0x0, -0x58(%rbp)
je 0x586c8
cmpq $0x38, 0x10(%rbp)
je 0x586b3
movl $0x16, -0x5c(%rbp)
jmp 0x5884f
movq -0x58(%rbp), %rsi
leaq -0xd8(%rbp), %rdi
movl $0x38, %edx
callq 0xb310
jmp 0x586ca
movq -0x30(%rbp), %rax
movq %rax, -0x18(%rbp)
movq -0x18(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x110(%rbp), %rdi
leaq -0xd8(%rbp), %rcx
callq 0x51290
leaq -0xa0(%rbp), %rdi
leaq -0x110(%rbp), %rsi
movl $0x38, %edx
callq 0xb310
cmpq $0x0, -0x48(%rbp)
je 0x58791
cmpq $0x0, -0x50(%rbp)
je 0x58791
movq -0x50(%rbp), %rax
cmpq $0x38, (%rax)
je 0x5877c
movq -0x50(%rbp), %rcx
movl $0x38, %eax
cmpq (%rcx), %rax
ja 0x5873d
movl $0x38, %eax
movq %rax, -0x168(%rbp)
jmp 0x5874b
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x48(%rbp), %rdi
movq -0x118(%rbp), %rdx
leaq -0xa0(%rbp), %rsi
callq 0xb310
movl $0x16, -0x5c(%rbp)
jmp 0x5884f
movq -0x48(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
movl $0x38, %edx
callq 0xb310
jmp 0x58793
jmp 0x5883d
movq -0x30(%rbp), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rsi
movq -0x68(%rbp), %rdx
leaq -0x150(%rbp), %rdi
callq 0x51160
cmpq $0x0, -0x48(%rbp)
je 0x58839
cmpq $0x0, -0x50(%rbp)
je 0x58839
movq -0x50(%rbp), %rax
cmpq $0x38, (%rax)
je 0x58824
movq -0x50(%rbp), %rcx
movl $0x38, %eax
cmpq (%rcx), %rax
ja 0x587e8
movl $0x38, %eax
movq %rax, -0x170(%rbp)
jmp 0x587f6
movq -0x50(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x158(%rbp)
movq -0x48(%rbp), %rdi
movq -0x158(%rbp), %rdx
leaq -0x150(%rbp), %rsi
callq 0xb310
movl $0x16, -0x5c(%rbp)
jmp 0x5884f
movq -0x48(%rbp), %rdi
leaq -0x150(%rbp), %rsi
movl $0x38, %edx
callq 0xb310
jmp 0x5883b
jmp 0x5883d
jmp 0x58848
movl $0xe, -0x5c(%rbp)
jmp 0x5884f
movl $0x0, -0x5c(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rdi
leaq 0x4b87e(%rip), %rsi     # 0xa40e0
callq 0x549c0
movl -0x5c(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
nopw %cs:(%rax,%rax)