// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/arena.c
// Function: arena_run_split
static void
arena_run_split(arena_t *arena, arena_run_t *run, size_t size, bool large,
    size_t binind, bool zero)
{
	arena_chunk_t *chunk;
	size_t run_ind, total_pages, need_pages, rem_pages, i;
	size_t flag_dirty;

	assert((large && binind == BININD_INVALID) || (large == false && binind
	    != BININD_INVALID));

	chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
	run_ind = (unsigned)(((uintptr_t)run - (uintptr_t)chunk) >> LG_PAGE);
	flag_dirty = arena_mapbits_dirty_get(chunk, run_ind);
	total_pages = arena_mapbits_unallocated_size_get(chunk, run_ind) >>
	    LG_PAGE;
	assert(arena_mapbits_dirty_get(chunk, run_ind+total_pages-1) ==
	    flag_dirty);
	need_pages = (size >> LG_PAGE);
	assert(need_pages > 0);
	assert(need_pages <= total_pages);
	rem_pages = total_pages - need_pages;

	arena_avail_remove(arena, chunk, run_ind, total_pages, true, true);
	if (config_stats) {
		/*
		 * Update stats_cactive if nactive is crossing a chunk
		 * multiple.
		 */
		size_t cactive_diff = CHUNK_CEILING((arena->nactive +
		    need_pages) << LG_PAGE) - CHUNK_CEILING(arena->nactive <<
		    LG_PAGE);
		if (cactive_diff != 0)
			stats_cactive_add(cactive_diff);
	}
	arena->nactive += need_pages;

	/* Keep track of trailing unused pages for later use. */
	if (rem_pages > 0) {
		if (flag_dirty != 0) {
			arena_mapbits_unallocated_set(chunk, run_ind+need_pages,
			    (rem_pages << LG_PAGE), CHUNK_MAP_DIRTY);
			arena_mapbits_unallocated_set(chunk,
			    run_ind+total_pages-1, (rem_pages << LG_PAGE),
			    CHUNK_MAP_DIRTY);
		} else {
			arena_mapbits_unallocated_set(chunk, run_ind+need_pages,
			    (rem_pages << LG_PAGE),
			    arena_mapbits_unzeroed_get(chunk,
			    run_ind+need_pages));
			arena_mapbits_unallocated_set(chunk,
			    run_ind+total_pages-1, (rem_pages << LG_PAGE),
			    arena_mapbits_unzeroed_get(chunk,
			    run_ind+total_pages-1));
		}
		arena_avail_insert(arena, chunk, run_ind+need_pages, rem_pages,
		    false, true);
	}

	/*
	 * Update the page map separately for large vs. small runs, since it is
	 * possible to avoid iteration for large mallocs.
	 */
	if (large) {
		if (zero) {
			if (flag_dirty == 0) {
				/*
				 * The run is clean, so some pages may be
				 * zeroed (i.e. never before touched).
				 */
				for (i = 0; i < need_pages; i++) {
					if (arena_mapbits_unzeroed_get(chunk,
					    run_ind+i) != 0) {
						VALGRIND_MAKE_MEM_UNDEFINED(
						    (void *)((uintptr_t)
						    chunk + ((run_ind+i) <<
						    LG_PAGE)), PAGE);
						memset((void *)((uintptr_t)
						    chunk + ((run_ind+i) <<
						    LG_PAGE)), 0, PAGE);
					} else if (config_debug) {
						VALGRIND_MAKE_MEM_DEFINED(
						    (void *)((uintptr_t)
						    chunk + ((run_ind+i) <<
						    LG_PAGE)), PAGE);
						arena_chunk_validate_zeroed(
						    chunk, run_ind+i);
					}
				}
			} else {
				/*
				 * The run is dirty, so all pages must be
				 * zeroed.
				 */
				VALGRIND_MAKE_MEM_UNDEFINED((void
				    *)((uintptr_t)chunk + (run_ind <<
				    LG_PAGE)), (need_pages << LG_PAGE));
				memset((void *)((uintptr_t)chunk + (run_ind <<
				    LG_PAGE)), 0, (need_pages << LG_PAGE));
			}
		}

		/*
		 * Set the last element first, in case the run only contains one
		 * page (i.e. both statements set the same element).
		 */
		arena_mapbits_large_set(chunk, run_ind+need_pages-1, 0,
		    flag_dirty);
		arena_mapbits_large_set(chunk, run_ind, size, flag_dirty);
	} else {
		assert(zero == false);
		/*
		 * Propagate the dirty and unzeroed flags to the allocated
		 * small run, so that arena_dalloc_bin_run() has the ability to
		 * conditionally trim clean pages.
		 */
		arena_mapbits_small_set(chunk, run_ind, 0, binind, flag_dirty);
		/*
		 * The first page will always be dirtied during small run
		 * initialization, so a validation failure here would not
		 * actually cause an observable failure.
		 */
		if (config_debug && flag_dirty == 0 &&
		    arena_mapbits_unzeroed_get(chunk, run_ind) == 0)
			arena_chunk_validate_zeroed(chunk, run_ind);
		for (i = 1; i < need_pages - 1; i++) {
			arena_mapbits_small_set(chunk, run_ind+i, i, binind, 0);
			if (config_debug && flag_dirty == 0 &&
			    arena_mapbits_unzeroed_get(chunk, run_ind+i) == 0)
				arena_chunk_validate_zeroed(chunk, run_ind+i);
		}
		arena_mapbits_small_set(chunk, run_ind+need_pages-1,
		    need_pages-1, binind, flag_dirty);
		if (config_debug && flag_dirty == 0 &&
		    arena_mapbits_unzeroed_get(chunk, run_ind+need_pages-1) ==
		    0) {
			arena_chunk_validate_zeroed(chunk,
			    run_ind+need_pages-1);
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movb %r9b, %al
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
andb $0x1, %cl
movb %cl, -0x19(%rbp)
movq %r8, -0x28(%rbp)
andb $0x1, %al
movb %al, -0x29(%rbp)
jmp 0xb9b7b
movq -0x10(%rbp), %rax
leaq 0x6f64a(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x38(%rbp)
movq -0x10(%rbp), %rax
movq -0x38(%rbp), %rcx
subq %rcx, %rax
shrq $0xc, %rax
movl %eax, %eax
movq %rax, -0x40(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xb9ad0
movq %rax, -0x68(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
callq 0xb9a90
shrq $0xc, %rax
movq %rax, -0x48(%rbp)
jmp 0xb9bd1
movq -0x18(%rbp), %rax
shrq $0xc, %rax
movq %rax, -0x50(%rbp)
jmp 0xb9bdf
jmp 0xb9be1
jmp 0xb9be3
movq -0x48(%rbp), %rax
subq -0x50(%rbp), %rax
movq %rax, -0x58(%rbp)
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
movq -0x48(%rbp), %rcx
movl $0x1, %r9d
movl %r9d, %r8d
callq 0xbbc00
movq -0x8(%rbp), %rax
movq 0xe8(%rax), %rax
addq -0x50(%rbp), %rax
shlq $0xc, %rax
leaq 0x6f5a9(%rip), %rcx     # 0x1291d0
addq (%rcx), %rax
leaq 0x6f59f(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq -0x8(%rbp), %rcx
movq 0xe8(%rcx), %rcx
shlq $0xc, %rcx
leaq 0x6f57f(%rip), %rdx     # 0x1291d0
addq (%rdx), %rcx
leaq 0x6f575(%rip), %rdx     # 0x1291d0
movq (%rdx), %rdx
xorq $-0x1, %rdx
andq %rdx, %rcx
subq %rcx, %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, -0x70(%rbp)
je 0xb9c7c
movq -0x70(%rbp), %rdi
callq 0xbbd70
movq -0x50(%rbp), %rcx
movq -0x8(%rbp), %rax
addq 0xe8(%rax), %rcx
movq %rcx, 0xe8(%rax)
cmpq $0x0, -0x58(%rbp)
jbe 0xb9dc1
cmpq $0x0, -0x68(%rbp)
je 0xb9ce9
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
movq -0x58(%rbp), %rdx
shlq $0xc, %rdx
movl $0x8, %ecx
callq 0xba100
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x48(%rbp), %rsi
subq $0x1, %rsi
movq -0x58(%rbp), %rdx
shlq $0xc, %rdx
movl $0x8, %ecx
callq 0xba100
jmp 0xb9d9f
movq -0x38(%rbp), %rax
movq %rax, -0x120(%rbp)
movq -0x40(%rbp), %rax
addq -0x50(%rbp), %rax
movq %rax, -0x118(%rbp)
movq -0x58(%rbp), %rax
shlq $0xc, %rax
movq %rax, -0x110(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
callq 0xbbda0
movq -0x120(%rbp), %rdi
movq -0x118(%rbp), %rsi
movq -0x110(%rbp), %rdx
movq %rax, %rcx
callq 0xba100
movq -0x38(%rbp), %rax
movq %rax, -0x108(%rbp)
movq -0x40(%rbp), %rax
addq -0x48(%rbp), %rax
subq $0x1, %rax
movq %rax, -0x100(%rbp)
movq -0x58(%rbp), %rax
shlq $0xc, %rax
movq %rax, -0xf8(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x48(%rbp), %rsi
subq $0x1, %rsi
callq 0xbbda0
movq -0x108(%rbp), %rdi
movq -0x100(%rbp), %rsi
movq -0xf8(%rbp), %rdx
movq %rax, %rcx
callq 0xba100
movq -0x8(%rbp), %rdi
movq -0x38(%rbp), %rsi
movq -0x40(%rbp), %rdx
addq -0x50(%rbp), %rdx
movq -0x58(%rbp), %rcx
xorl %r8d, %r8d
movl $0x1, %r9d
callq 0xba150
testb $0x1, -0x19(%rbp)
je 0xb9fa5
testb $0x1, -0x29(%rbp)
je 0xb9f6e
cmpq $0x0, -0x68(%rbp)
jne 0xb9eca
movq $0x0, -0x60(%rbp)
movq -0x60(%rbp), %rax
cmpq -0x50(%rbp), %rax
jae 0xb9ec5
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x60(%rbp), %rsi
callq 0xbbda0
cmpq $0x0, %rax
je 0xb9eb0
movq $0x4d430001, -0xa0(%rbp) # imm = 0x4D430001
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
addq -0x60(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movq %rax, -0x98(%rbp)
movq $0x1000, -0x90(%rbp) # imm = 0x1000
movq $0x0, -0x88(%rbp)
movq $0x0, -0x80(%rbp)
movq $0x0, -0x78(%rbp)
leaq -0xa0(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, -0xa8(%rbp)
movq -0xa8(%rbp), %rax
movq %rax, -0xb0(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rax
addq -0x60(%rbp), %rax
shlq $0xc, %rax
addq %rax, %rdi
xorl %esi, %esi
movl $0x1000, %edx           # imm = 0x1000
callq 0x1f110
jmp 0xb9eb2
jmp 0xb9eb2
jmp 0xb9eb4
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xb9de8
jmp 0xb9f6c
movq $0x4d430001, -0xe0(%rbp) # imm = 0x4D430001
movq -0x38(%rbp), %rax
movq -0x40(%rbp), %rcx
shlq $0xc, %rcx
addq %rcx, %rax
movq %rax, -0xd8(%rbp)
movq -0x50(%rbp), %rax
shlq $0xc, %rax
movq %rax, -0xd0(%rbp)
movq $0x0, -0xc8(%rbp)
movq $0x0, -0xc0(%rbp)
movq $0x0, -0xb8(%rbp)
leaq -0xe0(%rbp), %rax
xorl %ecx, %ecx
movl %ecx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, -0xe8(%rbp)
movq -0xe8(%rbp), %rax
movq %rax, -0xf0(%rbp)
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rax
shlq $0xc, %rax
addq %rax, %rdi
movq -0x50(%rbp), %rdx
shlq $0xc, %rdx
xorl %esi, %esi
callq 0x1f110
jmp 0xb9f6e
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
subq $0x1, %rsi
movq -0x68(%rbp), %rcx
xorl %eax, %eax
movl %eax, %edx
callq 0xbbdd0
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x18(%rbp), %rdx
movq -0x68(%rbp), %rcx
callq 0xbbdd0
jmp 0xba02c
jmp 0xb9fa7
jmp 0xb9fa9
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
movq -0x28(%rbp), %rcx
movq -0x68(%rbp), %r8
xorl %eax, %eax
movl %eax, %edx
callq 0xbbe40
movq $0x1, -0x60(%rbp)
movq -0x60(%rbp), %rax
movq -0x50(%rbp), %rcx
subq $0x1, %rcx
cmpq %rcx, %rax
jae 0xba007
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x60(%rbp), %rsi
movq -0x60(%rbp), %rdx
movq -0x28(%rbp), %rcx
xorl %eax, %eax
movl %eax, %r8d
callq 0xbbe40
movq -0x60(%rbp), %rax
addq $0x1, %rax
movq %rax, -0x60(%rbp)
jmp 0xb9fca
movq -0x38(%rbp), %rdi
movq -0x40(%rbp), %rsi
addq -0x50(%rbp), %rsi
subq $0x1, %rsi
movq -0x50(%rbp), %rdx
subq $0x1, %rdx
movq -0x28(%rbp), %rcx
movq -0x68(%rbp), %r8
callq 0xbbe40
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
nopw %cs:(%rax,%rax)