// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_ralloc_large_grow
static bool
arena_ralloc_large_grow(arena_t *arena, arena_chunk_t *chunk, void *ptr,
    size_t oldsize, size_t size, size_t extra, bool zero)
{
	size_t pageind = ((uintptr_t)ptr - (uintptr_t)chunk) >> LG_PAGE;
	size_t npages = oldsize >> LG_PAGE;
	size_t followsize;

	assert(oldsize == arena_mapbits_large_size_get(chunk, pageind));

	/* Try to extend the run. */
	assert(size + extra > oldsize);
	malloc_mutex_lock(&arena->lock);
	if (pageind + npages < chunk_npages &&
	    arena_mapbits_allocated_get(chunk, pageind+npages) == 0 &&
	    (followsize = arena_mapbits_unallocated_size_get(chunk,
	    pageind+npages)) >= size - oldsize) {
		/*
		 * The next run is available and sufficiently large.  Split the
		 * following run, then merge the first part with the existing
		 * allocation.
		 */
		size_t flag_dirty;
		size_t splitsize = (oldsize + followsize <= size + extra)
		    ? followsize : size + extra - oldsize;
		arena_run_split(arena, (arena_run_t *)((uintptr_t)chunk +
		    ((pageind+npages) << LG_PAGE)), splitsize, true,
		    BININD_INVALID, zero);

		size = oldsize + splitsize;
		npages = size >> LG_PAGE;

		/*
		 * Mark the extended run as dirty if either portion of the run
		 * was dirty before allocation.  This is rather pedantic,
		 * because there's not actually any sequence of events that
		 * could cause the resulting run to be passed to
		 * arena_run_dalloc() with the dirty argument set to false
		 * (which is when dirty flag consistency would really matter).
		 */
		flag_dirty = arena_mapbits_dirty_get(chunk, pageind) |
		    arena_mapbits_dirty_get(chunk, pageind+npages-1);
		arena_mapbits_large_set(chunk, pageind, size, flag_dirty);
		arena_mapbits_large_set(chunk, pageind+npages-1, 0, flag_dirty);

		if (config_stats) {
			arena->stats.ndalloc_large++;
			arena->stats.allocated_large -= oldsize;
			arena->stats.lstats[(oldsize >> LG_PAGE) - 1].ndalloc++;
			arena->stats.lstats[(oldsize >> LG_PAGE) - 1].curruns--;

			arena->stats.nmalloc_large++;
			arena->stats.nrequests_large++;
			arena->stats.allocated_large += size;
			arena->stats.lstats[(size >> LG_PAGE) - 1].nmalloc++;
			arena->stats.lstats[(size >> LG_PAGE) - 1].nrequests++;
			arena->stats.lstats[(size >> LG_PAGE) - 1].curruns++;
		}
		malloc_mutex_unlock(&arena->lock);
		return (false);
	}
	malloc_mutex_unlock(&arena->lock);

	return (true);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movb 0x10(%rbp), %al
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq %rcx, -0x28(%rbp)
movq %r8, -0x30(%rbp)
movq %r9, -0x38(%rbp)
andb $0x1, %al
movb %al, -0x39(%rbp)
movq -0x20(%rbp), %rax
movq -0x18(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movq %rax, -0x48(%rbp)
movq -0x28(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x50(%rbp)
jmp 0xbec9c
jmp 0xbec9e
jmp 0xbeca0
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xb5d20
movq -0x48(%rbp), %rax
addq -0x50(%rbp), %rax
leaq 0x6a51c(%rip), %rcx     # 0x1291d8
cmpq (%rcx), %rax
jae 0xbef16
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq -0x50(%rbp), %rsi
callq 0xb9a60
cmpq $0x0, %rax
jne 0xbef16
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq -0x50(%rbp), %rsi
callq 0xb9a90
movq %rax, -0x58(%rbp)
movq -0x30(%rbp), %rcx
subq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jb 0xbef16
movq -0x28(%rbp), %rax
addq -0x58(%rbp), %rax
movq -0x30(%rbp), %rcx
addq -0x38(%rbp), %rcx
cmpq %rcx, %rax
ja 0xbed25
movq -0x58(%rbp), %rax
movq %rax, -0x70(%rbp)
jmp 0xbed35
movq -0x30(%rbp), %rax
addq -0x38(%rbp), %rax
subq -0x28(%rbp), %rax
movq %rax, -0x70(%rbp)
movq -0x70(%rbp), %rax
movq %rax, -0x68(%rbp)
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movq -0x48(%rbp), %rax
addq -0x50(%rbp), %rax
shlq $0xc, %rax
addq %rax, %rsi
movq -0x68(%rbp), %rdx
movb -0x39(%rbp), %al
movl $0x1, %ecx
movl $0xff, %r8d
andb $0x1, %al
movzbl %al, %r9d
callq 0xb9b50
movq -0x28(%rbp), %rax
addq -0x68(%rbp), %rax
movq %rax, -0x30(%rbp)
movq -0x30(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x50(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
callq 0xb9ad0
movq %rax, -0x78(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq -0x50(%rbp), %rsi
subq $0x1, %rsi
callq 0xb9ad0
movq %rax, %rcx
movq -0x78(%rbp), %rax
orq %rcx, %rax
movq %rax, -0x60(%rbp)
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq -0x30(%rbp), %rdx
movq -0x60(%rbp), %rcx
callq 0xbbdd0
movq -0x18(%rbp), %rdi
movq -0x48(%rbp), %rsi
addq -0x50(%rbp), %rsi
subq $0x1, %rsi
movq -0x60(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0xbbdd0
movq -0x10(%rbp), %rax
movq 0x60(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x60(%rax)
movq -0x28(%rbp), %rdx
movq -0x10(%rbp), %rax
movq 0x50(%rax), %rcx
subq %rdx, %rcx
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x28(%rbp), %rcx
shrq $0xc, %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x8(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x8(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x28(%rbp), %rcx
shrq $0xc, %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
addq $-0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rax
movq 0x58(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x58(%rax)
movq -0x10(%rbp), %rax
movq 0x68(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x68(%rax)
movq -0x30(%rbp), %rcx
movq -0x10(%rbp), %rax
addq 0x50(%rax), %rcx
movq %rcx, 0x50(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x30(%rbp), %rcx
shrq $0xc, %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq (%rax), %rcx
addq $0x1, %rcx
movq %rcx, (%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x30(%rbp), %rcx
shrq $0xc, %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x10(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x10(%rax)
movq -0x10(%rbp), %rax
movq 0x70(%rax), %rax
movq -0x30(%rbp), %rcx
shrq $0xc, %rcx
subq $0x1, %rcx
shlq $0x5, %rcx
addq %rcx, %rax
movq 0x18(%rax), %rcx
addq $0x1, %rcx
movq %rcx, 0x18(%rax)
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xb5ee0
movb $0x0, -0x1(%rbp)
jmp 0xbef27
movq -0x10(%rbp), %rdi
addq $0x8, %rdi
callq 0xb5ee0
movb $0x1, -0x1(%rbp)
movb -0x1(%rbp), %al
andb $0x1, %al
addq $0x80, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)