// File: /workspace/github_c_makefile_star2_O1/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/arena.c
// Function: arena_run_split_large_helper
static bool
arena_run_split_large_helper(arena_t *arena, arena_run_t *run, size_t size,
    bool remove, bool zero)
{
	arena_chunk_t *chunk;
	arena_chunk_map_misc_t *miscelm;
	size_t flag_dirty, flag_decommitted, run_ind, need_pages;
	size_t flag_unzeroed_mask;

	chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(run);
	miscelm = arena_run_to_miscelm(run);
	run_ind = arena_miscelm_to_pageind(miscelm);
	flag_dirty = arena_mapbits_dirty_get(chunk, run_ind);
	flag_decommitted = arena_mapbits_decommitted_get(chunk, run_ind);
	need_pages = (size >> LG_PAGE);
	assert(need_pages > 0);

	if (flag_decommitted != 0 && arena->chunk_hooks.commit(chunk, chunksize,
	    run_ind << LG_PAGE, size, arena->ind))
		return (true);

	if (remove) {
		arena_run_split_remove(arena, chunk, run_ind, flag_dirty,
		    flag_decommitted, need_pages);
	}

	if (zero) {
		if (flag_decommitted != 0) {
			/* The run is untouched, and therefore zeroed. */
			JEMALLOC_VALGRIND_MAKE_MEM_DEFINED((void
			    *)((uintptr_t)chunk + (run_ind << LG_PAGE)),
			    (need_pages << LG_PAGE));
		} else if (flag_dirty != 0) {
			/* The run is dirty, so all pages must be zeroed. */
			arena_run_zero(chunk, run_ind, need_pages);
		} else {
			/*
			 * The run is clean, so some pages may be zeroed (i.e.
			 * never before touched).
			 */
			size_t i;
			for (i = 0; i < need_pages; i++) {
				if (arena_mapbits_unzeroed_get(chunk, run_ind+i)
				    != 0)
					arena_run_zero(chunk, run_ind+i, 1);
				else if (config_debug) {
					arena_run_page_validate_zeroed(chunk,
					    run_ind+i);
				} else {
					arena_run_page_mark_zeroed(chunk,
					    run_ind+i);
				}
			}
		}
	} else {
		JEMALLOC_VALGRIND_MAKE_MEM_UNDEFINED((void *)((uintptr_t)chunk +
		    (run_ind << LG_PAGE)), (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).
	 */
	flag_unzeroed_mask = (flag_dirty | flag_decommitted) == 0 ?
	    CHUNK_MAP_UNZEROED : 0;
	arena_mapbits_large_set(chunk, run_ind+need_pages-1, 0, flag_dirty |
	    (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk,
	    run_ind+need_pages-1)));
	arena_mapbits_large_set(chunk, run_ind, size, flag_dirty |
	    (flag_unzeroed_mask & arena_mapbits_unzeroed_get(chunk, run_ind)));
	return (false);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %r8d, 0x10(%rsp)
movq %rdx, %rbx
movq %rdi, %rbp
leaq 0x280ad(%rip), %rax     # 0x4d0d0
movq (%rax), %r14
notq %r14
leaq -0x18(%rsi), %rax
andq %r14, %rax
addq 0x27f91(%rip), %rax     # 0x4cfc8
negq %rax
addq %rsi, %rax
addq $-0x18, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %rsi, %r14
shrq $0x6, %rdx
movq 0x27f64(%rip), %r15     # 0x4cfc0
addq %rdx, %r15
movq 0x78(%r14,%rdx,8), %r13
movq %r13, %r12
andq $0x4, %r12
je 0x250a2
leaq 0x28054(%rip), %rax     # 0x4d0c8
movq (%rax), %rsi
movq %r15, %rdx
shlq $0xc, %rdx
movl %ecx, 0x8(%rsp)
movl (%rbp), %r8d
movq %r14, %rdi
movq %rbx, %rcx
callq *0x958(%rbp)
movl 0x8(%rsp), %ecx
movl %eax, %edx
movb $0x1, %al
testb %dl, %dl
jne 0x2526f
movq %r13, 0x18(%rsp)
andl $0x10, %r13d
movq %rbx, %rax
shrq $0xc, %rax
movq %rax, 0x8(%rsp)
testb %cl, %cl
je 0x250d4
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %r12, %r8
movq 0x8(%rsp), %r9
callq 0x2529c
cmpb $0x0, 0x10(%rsp)
movq %r13, 0x20(%rsp)
je 0x25196
testq %r12, %r12
jne 0x251bd
testq %r13, %r13
jne 0x251e4
cmpq $0x1000, %rbx           # imm = 0x1000
jb 0x2520f
movq %r15, %rbp
shlq $0xc, %rbp
addq %r14, %rbp
leaq (%r14,%r15,8), %r12
addq $0x78, %r12
leaq 0x27480(%rip), %rdx     # 0x4c59c
movq 0x8(%rsp), %r13
movq %r15, 0x10(%rsp)
movq 0x27e93(%rip), %rax     # 0x4cfc0
shlq $0x3, %rax
movq %r12, %rcx
subq %rax, %rcx
testb $0x8, (%rcx)
movb (%rdx), %al
jne 0x25154
testb %al, %al
je 0x25172
movl $0x1000, %esi           # imm = 0x1000
movq %rbp, %rdi
movq %rdx, %r15
callq 0x37158
jmp 0x2516a
movq %rdx, %r15
testb %al, %al
jne 0x25187
movl $0x1000, %edx           # imm = 0x1000
movq %rbp, %rdi
xorl %esi, %esi
callq 0xb230
movq %r15, %rdx
movq 0x10(%rsp), %r15
addq $0x1000, %rbp           # imm = 0x1000
addq $0x8, %r12
decq %r13
jne 0x25126
jmp 0x2520f
movl $0x1000, %esi           # imm = 0x1000
movq %rbp, %rdi
callq 0x37116
jmp 0x2515b
leaq 0x273ff(%rip), %rax     # 0x4c59c
cmpb $0x1, (%rax)
jne 0x2520f
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x37116
jmp 0x2520f
leaq 0x273d8(%rip), %rax     # 0x4c59c
cmpb $0x1, (%rax)
jne 0x2520f
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x37158
jmp 0x2520f
leaq 0x273b1(%rip), %rax     # 0x4c59c
cmpb $0x1, (%rax)
je 0x2527e
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rdx
andq $-0x1000, %rdx          # imm = 0xF000
xorl %esi, %esi
callq 0xb230
xorl %eax, %eax
testb $0x14, 0x18(%rsp)
sete %al
shll $0x3, %eax
movq 0x8(%rsp), %rdx
addq %r15, %rdx
movq 0x27d95(%rip), %rcx     # 0x4cfc0
notq %rcx
addq %rdx, %rcx
movl 0x78(%r14,%rcx,8), %edx
andl %eax, %edx
movl $0x1fe3, %esi           # imm = 0x1FE3
movq 0x20(%rsp), %r8
movq %r8, %rdi
orq %rsi, %rdi
orq %rdx, %rdi
movq %rdi, 0x78(%r14,%rcx,8)
subq 0x27d69(%rip), %r15     # 0x4cfc0
andl 0x78(%r14,%r15,8), %eax
addq %rbx, %rbx
orq %r8, %rbx
orq %rsi, %rbx
orq %rax, %rbx
movq %rbx, 0x78(%r14,%r15,8)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x37116
jmp 0x251f4