// File: /workspace/github_c_makefile_star2_O0/gplessis[P]dotdeb-redis/deps/jemalloc/src/chunk.c
// Function: chunk_recycle
static void *
chunk_recycle(arena_t *arena, chunk_hooks_t *chunk_hooks,
    extent_tree_t *chunks_szad, extent_tree_t *chunks_ad, bool cache,
    void *new_addr, size_t size, size_t alignment, bool *zero, bool *commit,
    bool dalloc_node)
{
	void *ret;
	extent_node_t *node;
	size_t alloc_size, leadsize, trailsize;
	bool zeroed, committed;

	assert(new_addr == NULL || alignment == chunksize);
	/*
	 * Cached chunks use the node linkage embedded in their headers, in
	 * which case dalloc_node is true, and new_addr is non-NULL because
	 * we're operating on a specific chunk.
	 */
	assert(dalloc_node || new_addr != NULL);

	alloc_size = CHUNK_CEILING(s2u(size + alignment - chunksize));
	/* Beware size_t wrap-around. */
	if (alloc_size < size)
		return (NULL);
	malloc_mutex_lock(&arena->chunks_mtx);
	chunk_hooks_assure_initialized_locked(arena, chunk_hooks);
	if (new_addr != NULL) {
		extent_node_t key;
		extent_node_init(&key, arena, new_addr, alloc_size, false,
		    false);
		node = extent_tree_ad_search(chunks_ad, &key);
	} else {
		node = chunk_first_best_fit(arena, chunks_szad, chunks_ad,
		    alloc_size);
	}
	if (node == NULL || (new_addr != NULL && extent_node_size_get(node) <
	    size)) {
		malloc_mutex_unlock(&arena->chunks_mtx);
		return (NULL);
	}
	leadsize = ALIGNMENT_CEILING((uintptr_t)extent_node_addr_get(node),
	    alignment) - (uintptr_t)extent_node_addr_get(node);
	assert(new_addr == NULL || leadsize == 0);
	assert(extent_node_size_get(node) >= leadsize + size);
	trailsize = extent_node_size_get(node) - leadsize - size;
	ret = (void *)((uintptr_t)extent_node_addr_get(node) + leadsize);
	zeroed = extent_node_zeroed_get(node);
	if (zeroed)
		*zero = true;
	committed = extent_node_committed_get(node);
	if (committed)
		*commit = true;
	/* Split the lead. */
	if (leadsize != 0 &&
	    chunk_hooks->split(extent_node_addr_get(node),
	    extent_node_size_get(node), leadsize, size, false, arena->ind)) {
		malloc_mutex_unlock(&arena->chunks_mtx);
		return (NULL);
	}
	/* Remove node from the tree. */
	extent_tree_szad_remove(chunks_szad, node);
	extent_tree_ad_remove(chunks_ad, node);
	arena_chunk_cache_maybe_remove(arena, node, cache);
	if (leadsize != 0) {
		/* Insert the leading space as a smaller chunk. */
		extent_node_size_set(node, leadsize);
		extent_tree_szad_insert(chunks_szad, node);
		extent_tree_ad_insert(chunks_ad, node);
		arena_chunk_cache_maybe_insert(arena, node, cache);
		node = NULL;
	}
	if (trailsize != 0) {
		/* Split the trail. */
		if (chunk_hooks->split(ret, size + trailsize, size,
		    trailsize, false, arena->ind)) {
			if (dalloc_node && node != NULL)
				arena_node_dalloc(arena, node);
			malloc_mutex_unlock(&arena->chunks_mtx);
			chunk_record(arena, chunk_hooks, chunks_szad, chunks_ad,
			    cache, ret, size + trailsize, zeroed, committed);
			return (NULL);
		}
		/* Insert the trailing space as a smaller chunk. */
		if (node == NULL) {
			node = arena_node_alloc(arena);
			if (node == NULL) {
				malloc_mutex_unlock(&arena->chunks_mtx);
				chunk_record(arena, chunk_hooks, chunks_szad,
				    chunks_ad, cache, ret, size + trailsize,
				    zeroed, committed);
				return (NULL);
			}
		}
		extent_node_init(node, arena, (void *)((uintptr_t)(ret) + size),
		    trailsize, zeroed, committed);
		extent_tree_szad_insert(chunks_szad, node);
		extent_tree_ad_insert(chunks_ad, node);
		arena_chunk_cache_maybe_insert(arena, node, cache);
		node = NULL;
	}
	if (!committed && chunk_hooks->commit(ret, size, 0, size, arena->ind)) {
		malloc_mutex_unlock(&arena->chunks_mtx);
		chunk_record(arena, chunk_hooks, chunks_szad, chunks_ad, cache,
		    ret, size, zeroed, committed);
		return (NULL);
	}
	malloc_mutex_unlock(&arena->chunks_mtx);

	assert(dalloc_node || node != NULL);
	if (dalloc_node && node != NULL)
		arena_node_dalloc(arena, node);
	if (*zero) {
		if (!zeroed)
			memset(ret, 0, size);
		else if (config_debug) {
			size_t i;
			size_t *p = (size_t *)(uintptr_t)ret;

			JEMALLOC_VALGRIND_MAKE_MEM_DEFINED(ret, size);
			for (i = 0; i < size / sizeof(size_t); i++)
				assert(p[i] == 0);
		}
	}
	return (ret);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x1a0, %rsp            # imm = 0x1A0
movl %r8d, %eax
movq %rcx, -0x160(%rbp)
movq %rdx, %rcx
movq -0x160(%rbp), %rdx
movq %rcx, -0x158(%rbp)
movq %rsi, %rcx
movq -0x158(%rbp), %rsi
movq %rcx, -0x150(%rbp)
movq %rdi, %r8
movq -0x150(%rbp), %rdi
movb %al, %cl
movb 0x30(%rbp), %al
movq 0x28(%rbp), %r10
movq 0x20(%rbp), %r10
movq 0x18(%rbp), %r10
movq 0x10(%rbp), %r10
movq %r8, -0x80(%rbp)
movq %rdi, -0x88(%rbp)
movq %rsi, -0x90(%rbp)
movq %rdx, -0x98(%rbp)
andb $0x1, %cl
movb %cl, -0x99(%rbp)
movq %r9, -0xa8(%rbp)
andb $0x1, %al
movb %al, -0xa9(%rbp)
jmp 0x50609
jmp 0x5060b
jmp 0x5060d
movq 0x10(%rbp), %rax
addq 0x18(%rbp), %rax
subq 0x5210c(%rip), %rax     # 0xa2728
movq %rax, -0x70(%rbp)
cmpq $0x1000, -0x70(%rbp)    # imm = 0x1000
setbe %al
testb $0x1, %al
jne 0x50631
jmp 0x5068c
movq -0x70(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x58(%rbp), %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rcx
subq $0x1, %rcx
shrq $0x3, %rcx
leaq 0x3e62c(%rip), %rax     # 0x8ec80
movzbl (%rax,%rcx), %eax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
movl %eax, -0x14(%rbp)
movl -0x14(%rbp), %eax
movl %eax, %ecx
leaq 0x3de91(%rip), %rax     # 0x8e500
movq (%rax,%rcx,8), %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq %rax, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq %rax, -0x68(%rbp)
jmp 0x50754
movq -0x70(%rbp), %rax
movq %rax, -0x28(%rbp)
cmpq $0x0, -0x28(%rbp)
setl %al
testb $0x1, %al
jne 0x506a2
jmp 0x506c4
movq -0x28(%rbp), %rdx
shlq %rdx
movl $0x3f, %eax
movl $0x40, %ecx
cmpq $0x0, %rdx
cmovneq %rcx, %rax
movq %rax, -0x168(%rbp)
jmp 0x506db
movq -0x28(%rbp), %rdi
shlq %rdi
subq $0x1, %rdi
callq 0x51a00
movq %rax, -0x168(%rbp)
movq -0x168(%rbp), %rax
movq %rax, -0x30(%rbp)
cmpq $0x6, -0x30(%rbp)
jae 0x506fb
movl $0x3, %eax
movq %rax, -0x170(%rbp)
jmp 0x5070e
movq -0x30(%rbp), %rax
subq $0x2, %rax
subq $0x1, %rax
movq %rax, -0x170(%rbp)
movq -0x170(%rbp), %rax
movq %rax, -0x38(%rbp)
movq -0x38(%rbp), %rcx
movl $0x1, %eax
shlq %cl, %rax
movq %rax, -0x40(%rbp)
movq -0x40(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
addq -0x48(%rbp), %rax
movq -0x48(%rbp), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x50(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x68(%rbp), %rax
addq 0x51fd1(%rip), %rax     # 0xa2730
movq 0x51fca(%rip), %rcx     # 0xa2730
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0xc8(%rbp)
movq -0xc8(%rbp), %rax
cmpq 0x10(%rbp), %rax
jae 0x5078e
movq $0x0, -0x78(%rbp)
jmp 0x50da3
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x50070
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
callq 0x51b50
cmpq $0x0, -0xa8(%rbp)
je 0x507f8
movq -0x80(%rbp), %rsi
movq -0xa8(%rbp), %rdx
movq -0xc8(%rbp), %rcx
leaq -0x148(%rbp), %rdi
xorl %r9d, %r9d
movl %r9d, %r8d
callq 0x51b80
movq -0x98(%rbp), %rdi
leaq -0x148(%rbp), %rsi
callq 0x5ddb0
movq %rax, -0xc0(%rbp)
jmp 0x5081d
movq -0x80(%rbp), %rdi
movq -0x90(%rbp), %rsi
movq -0x98(%rbp), %rdx
movq -0xc8(%rbp), %rcx
callq 0x51c30
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
je 0x50843
cmpq $0x0, -0xa8(%rbp)
je 0x50860
movq -0xc0(%rbp), %rdi
callq 0x51c90
cmpq 0x10(%rbp), %rax
jae 0x50860
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
movq $0x0, -0x78(%rbp)
jmp 0x50da3
movq -0xc0(%rbp), %rdi
callq 0x51cb0
movq 0x18(%rbp), %rcx
subq $0x1, %rcx
addq %rcx, %rax
xorl %ecx, %ecx
subq 0x18(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x178(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x51cb0
movq %rax, %rcx
movq -0x178(%rbp), %rax
subq %rcx, %rax
movq %rax, -0xd0(%rbp)
jmp 0x508a9
jmp 0x508ab
jmp 0x508ad
movq -0xc0(%rbp), %rdi
callq 0x51c90
subq -0xd0(%rbp), %rax
subq 0x10(%rbp), %rax
movq %rax, -0xd8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x51cb0
addq -0xd0(%rbp), %rax
movq %rax, -0xb8(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x51cd0
andb $0x1, %al
movb %al, -0xd9(%rbp)
testb $0x1, -0xd9(%rbp)
je 0x50909
movq 0x20(%rbp), %rax
movb $0x1, (%rax)
movq -0xc0(%rbp), %rdi
callq 0x51cf0
andb $0x1, %al
movb %al, -0xda(%rbp)
testb $0x1, -0xda(%rbp)
je 0x5092d
movq 0x28(%rbp), %rax
movb $0x1, (%rax)
cmpq $0x0, -0xd0(%rbp)
je 0x509b3
movq -0x88(%rbp), %rax
movq 0x28(%rax), %rax
movq %rax, -0x180(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x51cb0
movq %rax, -0x188(%rbp)
movq -0xc0(%rbp), %rdi
callq 0x51c90
movq -0x188(%rbp), %rdi
movq %rax, %rsi
movq -0x180(%rbp), %rax
movq -0xd0(%rbp), %rdx
movq 0x10(%rbp), %rcx
movq -0x80(%rbp), %r8
movl (%r8), %r9d
xorl %r8d, %r8d
callq *%rax
testb $0x1, %al
jne 0x50996
jmp 0x509b3
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
movq $0x0, -0x78(%rbp)
jmp 0x50da3
movq -0x90(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5c6d0
movq -0x98(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5e410
movq -0x80(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movb -0x99(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3c140
cmpq $0x0, -0xd0(%rbp)
je 0x50a5d
movq -0xc0(%rbp), %rdi
movq -0xd0(%rbp), %rsi
callq 0x51d10
movq -0x90(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5c270
movq -0x98(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5dfb0
movq -0x80(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movb -0x99(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3bfb0
movq $0x0, -0xc0(%rbp)
cmpq $0x0, -0xd8(%rbp)
je 0x50c88
movq -0x88(%rbp), %rax
movq 0x28(%rax), %rax
movq -0xb8(%rbp), %rdi
movq 0x10(%rbp), %rsi
addq -0xd8(%rbp), %rsi
movq 0x10(%rbp), %rdx
movq -0xd8(%rbp), %rcx
movq -0x80(%rbp), %r8
movl (%r8), %r9d
xorl %r8d, %r8d
callq *%rax
testb $0x1, %al
jne 0x50aa8
jmp 0x50b4e
testb $0x1, -0xa9(%rbp)
je 0x50acb
cmpq $0x0, -0xc0(%rbp)
je 0x50acb
movq -0x80(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x3c3e0
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x98(%rbp), %rcx
movb -0x99(%rbp), %r8b
movq -0xb8(%rbp), %r9
movq 0x10(%rbp), %r11
addq -0xd8(%rbp), %r11
movb -0xd9(%rbp), %r10b
movb -0xda(%rbp), %al
andb $0x1, %r8b
andb $0x1, %r10b
andb $0x1, %al
movzbl %r8b, %r8d
movq %r11, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x50f30
movq $0x0, -0x78(%rbp)
jmp 0x50da3
cmpq $0x0, -0xc0(%rbp)
jne 0x50bff
movq -0x80(%rbp), %rdi
callq 0x3c230
movq %rax, -0xc0(%rbp)
cmpq $0x0, -0xc0(%rbp)
jne 0x50bfd
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x98(%rbp), %rcx
movb -0x99(%rbp), %r8b
movq -0xb8(%rbp), %r9
movq 0x10(%rbp), %r11
addq -0xd8(%rbp), %r11
movb -0xd9(%rbp), %r10b
movb -0xda(%rbp), %al
andb $0x1, %r8b
andb $0x1, %r10b
andb $0x1, %al
movzbl %r8b, %r8d
movq %r11, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x50f30
movq $0x0, -0x78(%rbp)
jmp 0x50da3
jmp 0x50bff
movq -0xc0(%rbp), %rdi
movq -0x80(%rbp), %rsi
movq -0xb8(%rbp), %rdx
addq 0x10(%rbp), %rdx
movq -0xd8(%rbp), %rcx
movb -0xd9(%rbp), %r8b
movb -0xda(%rbp), %al
andb $0x1, %r8b
andb $0x1, %al
movzbl %r8b, %r8d
movzbl %al, %r9d
callq 0x51b80
movq -0x90(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5c270
movq -0x98(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x5dfb0
movq -0x80(%rbp), %rdi
movq -0xc0(%rbp), %rsi
movb -0x99(%rbp), %al
andb $0x1, %al
movzbl %al, %edx
callq 0x3bfb0
movq $0x0, -0xc0(%rbp)
testb $0x1, -0xda(%rbp)
jne 0x50d39
movq -0x88(%rbp), %rax
movq 0x10(%rax), %rax
movq -0xb8(%rbp), %rdi
movq 0x10(%rbp), %rsi
movq 0x10(%rbp), %rcx
movq -0x80(%rbp), %rdx
movl (%rdx), %r8d
xorl %edx, %edx
callq *%rax
testb $0x1, %al
jne 0x50cc0
jmp 0x50d39
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
movq -0x80(%rbp), %rdi
movq -0x88(%rbp), %rsi
movq -0x90(%rbp), %rdx
movq -0x98(%rbp), %rcx
movb -0x99(%rbp), %r8b
movq -0xb8(%rbp), %r9
movq 0x10(%rbp), %r11
movb -0xd9(%rbp), %r10b
movb -0xda(%rbp), %al
andb $0x1, %r8b
andb $0x1, %r10b
andb $0x1, %al
movzbl %r8b, %r8d
movq %r11, (%rsp)
movzbl %r10b, %r10d
movl %r10d, 0x8(%rsp)
movzbl %al, %eax
movl %eax, 0x10(%rsp)
callq 0x50f30
movq $0x0, -0x78(%rbp)
jmp 0x50da3
movq -0x80(%rbp), %rdi
addq $0x3c0, %rdi            # imm = 0x3C0
callq 0x500d0
jmp 0x50d4b
testb $0x1, -0xa9(%rbp)
je 0x50d6e
cmpq $0x0, -0xc0(%rbp)
je 0x50d6e
movq -0x80(%rbp), %rdi
movq -0xc0(%rbp), %rsi
callq 0x3c3e0
movq 0x20(%rbp), %rax
testb $0x1, (%rax)
je 0x50d98
testb $0x1, -0xd9(%rbp)
jne 0x50d94
movq -0xb8(%rbp), %rdi
movq 0x10(%rbp), %rdx
xorl %esi, %esi
callq 0x10250
jmp 0x50d96
jmp 0x50d96
jmp 0x50d98
movq -0xb8(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x78(%rbp), %rax
addq $0x1a0, %rsp            # imm = 0x1A0
popq %rbp
retq