// File: /workspace/github_c_makefile_star2_O3/gplessis[P]dotdeb-redis/deps/jemalloc/src/ctl.c
// Function: arena_i_chunk_hooks_ctl
static int
arena_i_chunk_hooks_ctl(const size_t *mib, size_t miblen, void *oldp,
    size_t *oldlenp, void *newp, size_t newlen)
{
	int ret;
	unsigned arena_ind = mib[1];
	arena_t *arena;

	malloc_mutex_lock(&ctl_mtx);
	if (arena_ind < narenas_total_get() && (arena =
	    arena_get(tsd_fetch(), arena_ind, false, true)) != 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(arena,
			    &new_chunk_hooks);
			READ(old_chunk_hooks, chunk_hooks_t);
		} else {
			chunk_hooks_t old_chunk_hooks = chunk_hooks_get(arena);
			READ(old_chunk_hooks, chunk_hooks_t);
		}
	} else {
		ret = EFAULT;
		goto label_return;
	}
	ret = 0;
label_return:
	malloc_mutex_unlock(&ctl_mtx);
	return (ret);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %r9, %r12
movq %r8, %r15
movq %rcx, %r14
movq %rdx, %rbx
movq 0x8(%rdi), %r13
leaq 0x29d1c(%rip), %rdi     # 0x5b708
callq 0x106d0
callq 0x21f0f
movl $0xe, %ebp
cmpl %r13d, %eax
jbe 0x31b71
movq %r14, 0x8(%rsp)
movq %rbx, 0x10(%rsp)
movq 0x265db(%rip), %r14     # 0x57ff0
movq %fs:0x0, %rbx
addq %r14, %rbx
movl %fs:(%r14), %eax
testl %eax, %eax
je 0x31bac
cmpl $0x2, %eax
je 0x31bb6
movq %fs:0x30(%r14), %rax
testq %rax, %rax
je 0x31b91
cmpl %r13d, %fs:0x38(%r14)
jbe 0x31b91
movl %r13d, %ecx
movq (%rax,%rcx,8), %rsi
testq %rsi, %rsi
je 0x31b91
testq %r15, %r15
je 0x31af2
cmpq $0x38, %r12
movq 0x10(%rsp), %rbx
movq 0x8(%rsp), %r14
jne 0x31b6c
movq 0x30(%r15), %rax
leaq 0x50(%rsp), %rdx
movq %rax, 0x30(%rdx)
movups (%r15), %xmm0
movups 0x10(%r15), %xmm1
movups 0x20(%r15), %xmm2
movaps %xmm2, 0x20(%rdx)
movaps %xmm1, 0x10(%rdx)
movaps %xmm0, (%rdx)
leaq 0x18(%rsp), %rdi
callq 0x2e3ad
testq %rbx, %rbx
sete %al
testq %r14, %r14
sete %cl
orb %al, %cl
jne 0x31b42
movq (%r14), %rax
cmpq $0x38, %rax
jne 0x31b56
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rbx)
movups 0x18(%rsp), %xmm0
movups 0x28(%rsp), %xmm1
movups 0x38(%rsp), %xmm2
movups %xmm2, 0x20(%rbx)
movups %xmm1, 0x10(%rbx)
movups %xmm0, (%rbx)
jmp 0x31b42
leaq 0x18(%rsp), %rdi
callq 0x2e354
movq 0x10(%rsp), %rdi
testq %rdi, %rdi
sete %al
movq 0x8(%rsp), %rdx
testq %rdx, %rdx
sete %cl
orb %al, %cl
jne 0x31b42
movq (%rdx), %rax
cmpq $0x38, %rax
jne 0x31b46
movq 0x48(%rsp), %rax
movq %rax, 0x30(%rdi)
movups 0x18(%rsp), %xmm0
movups 0x28(%rsp), %xmm1
movups 0x38(%rsp), %xmm2
movups %xmm2, 0x20(%rdi)
movups %xmm1, 0x10(%rdi)
movups %xmm0, (%rdi)
xorl %ebp, %ebp
jmp 0x31b71
movl $0x38, %edx
cmovbq %rax, %rdx
leaq 0x18(%rsp), %rsi
jmp 0x31b67
movl $0x38, %edx
cmovbq %rax, %rdx
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x10400
movl $0x16, %ebp
leaq 0x29b90(%rip), %rdi     # 0x5b708
callq 0x10440
movl %ebp, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
movl %r13d, %esi
xorl %edx, %edx
callq 0x21fbc
movq %rax, %rsi
testq %rax, %rax
jne 0x31a5f
jmp 0x31b71
movl $0x1, %fs:(%r14)
jmp 0x31bbe
movl $0x3, %fs:(%r14)
leaq 0x2a24f(%rip), %rax     # 0x5be14
movl (%rax), %edi
movq %rbx, %rsi
callq 0x106f0
testl %eax, %eax
je 0x31a36
leaq 0x1679b(%rip), %rdi     # 0x48379
callq 0x3d37c
leaq 0x28a36(%rip), %rax     # 0x5a620
cmpb $0x1, (%rax)
jne 0x31a36
callq 0x10090