// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/jemalloc/src/chunk.c
// Function: chunk_record
static void
chunk_record(arena_t *arena, chunk_hooks_t *chunk_hooks,
    extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, bool cache,
    void *chunk, size_t size, bool zeroed, bool committed)
{
	bool unzeroed;
	extent_node_t *node, *prev;
	extent_node_t key;

	assert(!cache || !zeroed);
	unzeroed = cache || !zeroed;
	JEMALLOC_VALGRIND_MAKE_MEM_NOACCESS(chunk, size);

	malloc_mutex_lock(&arena->chunks_mtx);
	chunk_hooks_assure_initialized_locked(arena, chunk_hooks);
	extent_node_init(&key, arena, (void *)((uintptr_t)chunk + size), 0,
	    false, false);
	node = extent_tree_ad_nsearch(chunks_ad, &key);
	/* Try to coalesce forward. */
	if (node != NULL && extent_node_addr_get(node) ==
	    extent_node_addr_get(&key) && extent_node_committed_get(node) ==
	    committed && !chunk_hooks->merge(chunk, size,
	    extent_node_addr_get(node), extent_node_size_get(node), false,
	    arena->ind)) {
		/*
		 * Coalesce chunk with the following address range.  This does
		 * not change the position within chunks_ad, so only
		 * remove/insert from/into chunks_szad.
		 */
		extent_tree_szad_remove(chunks_szad, node);
		arena_chunk_cache_maybe_remove(arena, node, cache);
		extent_node_addr_set(node, chunk);
		extent_node_size_set(node, size + extent_node_size_get(node));
		extent_node_zeroed_set(node, extent_node_zeroed_get(node) &&
		    !unzeroed);
		extent_tree_szad_insert(chunks_szad, node);
		arena_chunk_cache_maybe_insert(arena, node, cache);
	} else {
		/* Coalescing forward failed, so insert a new node. */
		node = arena_node_alloc(arena);
		if (node == NULL) {
			/*
			 * Node allocation failed, which is an exceedingly
			 * unlikely failure.  Leak chunk after making sure its
			 * pages have already been purged, so that this is only
			 * a virtual memory leak.
			 */
			if (cache) {
				chunk_purge_wrapper(arena, chunk_hooks, chunk,
				    size, 0, size);
			}
			goto label_return;
		}
		extent_node_init(node, arena, chunk, size, !unzeroed,
		    committed);
		extent_tree_ad_insert(chunks_ad, node);
		extent_tree_szad_insert(chunks_szad, node);
		arena_chunk_cache_maybe_insert(arena, node, cache);
	}

	/* Try to coalesce backward. */
	prev = extent_tree_ad_prev(chunks_ad, node);
	if (prev != NULL && (void *)((uintptr_t)extent_node_addr_get(prev) +
	    extent_node_size_get(prev)) == chunk &&
	    extent_node_committed_get(prev) == committed &&
	    !chunk_hooks->merge(extent_node_addr_get(prev),
	    extent_node_size_get(prev), chunk, size, false, arena->ind)) {
		/*
		 * Coalesce chunk with the previous address range.  This does
		 * not change the position within chunks_ad, so only
		 * remove/insert node from/into chunks_szad.
		 */
		extent_tree_szad_remove(chunks_szad, prev);
		extent_tree_ad_remove(chunks_ad, prev);
		arena_chunk_cache_maybe_remove(arena, prev, cache);
		extent_tree_szad_remove(chunks_szad, node);
		arena_chunk_cache_maybe_remove(arena, node, cache);
		extent_node_addr_set(node, extent_node_addr_get(prev));
		extent_node_size_set(node, extent_node_size_get(prev) +
		    extent_node_size_get(node));
		extent_node_zeroed_set(node, extent_node_zeroed_get(prev) &&
		    extent_node_zeroed_get(node));
		extent_tree_szad_insert(chunks_szad, node);
		arena_chunk_cache_maybe_insert(arena, node, cache);

		arena_node_dalloc(arena, prev);
	}

label_return:
	malloc_mutex_unlock(&arena->chunks_mtx);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x150, %rsp            # imm = 0x150
movl %r8d, %eax
movq %rcx, -0xc0(%rbp)
movq %rdx, -0xb8(%rbp)
movq %rsi, %r8
movq -0xc0(%rbp), %rsi
movq %rdi, %r10
movq -0xb8(%rbp), %rdi
movb %al, %dl
movb 0x20(%rbp), %al
movb 0x18(%rbp), %cl
movq 0x10(%rbp), %r11
movq %r10, -0x8(%rbp)
movq %r8, -0x10(%rbp)
movq %rdi, -0x18(%rbp)
movq %rsi, -0x20(%rbp)
andb $0x1, %dl
movb %dl, -0x21(%rbp)
movq %r9, -0x30(%rbp)
andb $0x1, %cl
movb %cl, -0x31(%rbp)
andb $0x1, %al
movb %al, -0x32(%rbp)
jmp 0x50f93
movb $0x1, %al
testb $0x1, -0x21(%rbp)
movb %al, -0xc1(%rbp)
jne 0x50fac
movb -0x31(%rbp), %al
xorb $-0x1, %al
movb %al, -0xc1(%rbp)
movb -0xc1(%rbp), %al
andb $0x1, %al
movb %al, -0x33(%rbp)
leaq 0x50746(%rip), %rax     # 0xa1704
movb (%rax), %al
xorb $-0x1, %al
xorb $-0x1, %al
andb $0x1, %al
movzbl %al, %eax
cltq
cmpq $0x0, %rax
je 0x50fde
movq -0x30(%rbp), %rdi
movq 0x10(%rbp), %rsi
callq 0x7fa30
jmp 0x50fe0
movq -0x8(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x50070
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x51b50
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
addq 0x10(%rbp), %rdx
leaq -0xb0(%rbp), %rdi
xorl %eax, %eax
movl %eax, %ecx
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x51b80
movq -0x20(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x5de50
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
je 0x511d0
movq -0x40(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xd0(%rbp)
leaq -0xb0(%rbp), %rdi
callq 0x51cb0
movq %rax, %rcx
movq -0xd0(%rbp), %rax
cmpq %rcx, %rax
jne 0x511d0
movq -0x40(%rbp), %rdi
callq 0x51cf0
andb $0x1, %al
movzbl %al, %eax
movb -0x32(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x511d0
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0xd8(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0xe8(%rbp)
movq -0x40(%rbp), %rdi
callq 0x51cb0
movq %rax, -0xe0(%rbp)
movq -0x40(%rbp), %rdi
callq 0x51c90
movq -0xf0(%rbp), %rdi
movq -0xe8(%rbp), %rsi
movq -0xe0(%rbp), %rdx
movq %rax, %rcx
movq -0xd8(%rbp), %rax
movq -0x8(%rbp), %r8
movl (%r8), %r9d
xorl %r8d, %r8d
callq *%rax
testb $0x1, %al
jne 0x511d0
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c6d0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3c140
movq -0x40(%rbp), %rdi
movq -0x30(%rbp), %rsi
callq 0x51df0
movq -0x40(%rbp), %rax
movq %rax, -0x108(%rbp)
movq 0x10(%rbp), %rax
movq %rax, -0x110(%rbp)
movq -0x40(%rbp), %rdi
callq 0x51c90
movq -0x110(%rbp), %rsi
movq -0x108(%rbp), %rdi
addq %rax, %rsi
callq 0x51d10
movq -0x40(%rbp), %rax
movq %rax, -0x100(%rbp)
movq -0x40(%rbp), %rdi
callq 0x51cd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0xf1(%rbp)
jne 0x51186
jmp 0x51191
movb -0x33(%rbp), %al
xorb $-0x1, %al
movb %al, -0xf1(%rbp)
movq -0x100(%rbp), %rdi
movb -0xf1(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x51e10
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c270
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3bfb0
jmp 0x5126c
movq -0x8(%rbp), %rdi
callq 0x3c230
movq %rax, -0x40(%rbp)
cmpq $0x0, -0x40(%rbp)
jne 0x5120d
testb $0x1, -0x21(%rbp)
je 0x51208
movq -0x8(%rbp), %rdi
movq -0x10(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq 0x10(%rbp), %r9
xorl %eax, %eax
movl %eax, %r8d
callq 0x516b0
jmp 0x51457
movq -0x40(%rbp), %rdi
movq -0x8(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
movb -0x33(%rbp), %r8b
xorb $-0x1, %r8b
movb -0x32(%rbp), %al
movzbl %r8b, %r8d
andl $0x1, %r8d
movzbl %al, %r9d
andl $0x1, %r9d
callq 0x51b80
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5dfb0
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c270
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3bfb0
movq -0x20(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5dca0
movq %rax, -0x48(%rbp)
cmpq $0x0, -0x48(%rbp)
je 0x51455
movq -0x48(%rbp), %rdi
callq 0x51cb0
movq %rax, -0x118(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51c90
movq %rax, %rcx
movq -0x118(%rbp), %rax
addq %rcx, %rax
cmpq -0x30(%rbp), %rax
jne 0x51455
movq -0x48(%rbp), %rdi
callq 0x51cf0
andb $0x1, %al
movzbl %al, %eax
movb -0x32(%rbp), %cl
andb $0x1, %cl
movzbl %cl, %ecx
cmpl %ecx, %eax
jne 0x51455
movq -0x10(%rbp), %rax
movq 0x30(%rax), %rax
movq %rax, -0x120(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51cb0
movq %rax, -0x128(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51c90
movq -0x128(%rbp), %rdi
movq %rax, %rsi
movq -0x120(%rbp), %rax
movq -0x30(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq -0x8(%rbp), %r8
movl (%r8), %r9d
xorl %r8d, %r8d
callq *%rax
testb $0x1, %al
jne 0x51455
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x5c6d0
movq -0x20(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x5e410
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3c140
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c6d0
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3c140
movq -0x40(%rbp), %rax
movq %rax, -0x150(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51cb0
movq -0x150(%rbp), %rdi
movq %rax, %rsi
callq 0x51df0
movq -0x40(%rbp), %rax
movq %rax, -0x140(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51c90
movq %rax, -0x148(%rbp)
movq -0x40(%rbp), %rdi
callq 0x51c90
movq -0x148(%rbp), %rsi
movq -0x140(%rbp), %rdi
addq %rax, %rsi
callq 0x51d10
movq -0x40(%rbp), %rax
movq %rax, -0x138(%rbp)
movq -0x48(%rbp), %rdi
callq 0x51cd0
movb %al, %cl
xorl %eax, %eax
testb $0x1, %cl
movb %al, -0x129(%rbp)
jne 0x513ff
jmp 0x5140e
movq -0x40(%rbp), %rdi
callq 0x51cd0
movb %al, -0x129(%rbp)
movq -0x138(%rbp), %rdi
movb -0x129(%rbp), %al
movzbl %al, %esi
andl $0x1, %esi
callq 0x51e10
movq -0x18(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0x5c270
movq -0x8(%rbp), %rdi
movq -0x40(%rbp), %rsi
movb -0x21(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3bfb0
movq -0x8(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0x3c3e0
jmp 0x51457
movq -0x8(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
addq $0x150, %rsp            # imm = 0x150
popq %rbp
retq