// File: /workspace/github_c_makefile_star2_O2/gplessis[P]dotdeb-redis/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 $0x18, %rsp
movl %ecx, %r10d
movq %rdx, %rbx
movq %rdi, %rbp
leaq 0x30982(%rip), %rax     # 0x576b0
movq (%rax), %r14
notq %r14
leaq -0x10(%rsi), %rax
andq %r14, %rax
andq %rsi, %r14
addq 0x3081b(%rip), %rax     # 0x57560
negq %rax
addq %rsi, %rax
addq $-0x10, %rax
pushq $0x60
popq %rcx
xorl %edx, %edx
divq %rcx
movq 0x307fa(%rip), %r13     # 0x57558
addq %rax, %r13
movq 0x68(%r14,%rax,8), %r15
movq %r15, %r12
andq $0x4, %r12
je 0x26dba
leaq 0x30932(%rip), %rax     # 0x576a8
movq (%rax), %rsi
movq %r13, %rdx
shlq $0xc, %rdx
movl %r8d, (%rsp)
movl (%rbp), %r8d
movq %r14, %rdi
movq %rbx, %rcx
movq %rbx, 0x8(%rsp)
movq %r13, %rbx
movl %r10d, %r13d
callq *0x428(%rbp)
movl %r13d, %r10d
movq %rbx, %r13
movq 0x8(%rsp), %rbx
movl (%rsp), %r8d
movl %eax, %ecx
movb $0x1, %al
testb %cl, %cl
jne 0x26f32
movq %r15, 0x10(%rsp)
andl $0x10, %r15d
movq %rbx, %rax
shrq $0xc, %rax
movq %rax, (%rsp)
testb %r10b, %r10b
je 0x26df1
movq %rbp, %rdi
movq %r14, %rsi
movq %r13, %rdx
movq %r15, %rcx
movl %r8d, %ebp
movq %r12, %r8
movq (%rsp), %r9
callq 0x26f41
movl %ebp, %r8d
testb %r8b, %r8b
movq %r15, 0x8(%rsp)
je 0x26e76
testq %r12, %r12
jne 0x26e9d
testq %r15, %r15
jne 0x26ec4
movq %r13, %rbp
shlq $0xc, %rbp
addq %r14, %rbp
movq %r13, %r15
movq (%rsp), %r12
subq $0x1, %r12
jb 0x26ed3
movq 0x30729(%rip), %rax     # 0x57558
shlq $0x3, %rax
movq %r14, %rcx
subq %rax, %rcx
testb $0x8, 0x68(%rcx,%r15,8)
jne 0x26e5c
leaq 0x2f83c(%rip), %rax     # 0x56684
cmpb $0x1, (%rax)
jne 0x26e6a
movl $0x1000, %esi           # imm = 0x1000
movq %rbp, %rdi
callq 0x38fac
jmp 0x26e6a
movq %r14, %rdi
movq %r15, %rsi
pushq $0x1
popq %rdx
callq 0x27055
addq $0x1000, %rbp           # imm = 0x1000
incq %r15
jmp 0x26e1e
leaq 0x2f807(%rip), %rax     # 0x56684
cmpb $0x1, (%rax)
jne 0x26ed3
movq %r13, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x38f6a
jmp 0x26ed3
leaq 0x2f7e0(%rip), %rax     # 0x56684
cmpb $0x1, (%rax)
jne 0x26ed3
movq %r13, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x38fac
jmp 0x26ed3
movq %r14, %rdi
movq %r13, %rsi
movq (%rsp), %rdx
callq 0x27055
xorl %eax, %eax
testb $0x14, 0x10(%rsp)
sete %al
shll $0x3, %eax
movq (%rsp), %rdx
addq %r13, %rdx
movq 0x3066a(%rip), %rcx     # 0x57558
notq %rcx
addq %rdx, %rcx
movl 0x68(%r14,%rcx,8), %edx
andl %eax, %edx
movl $0x1fe3, %esi           # imm = 0x1FE3
movq 0x8(%rsp), %r8
movq %r8, %rdi
orq %rsi, %rdi
orq %rdx, %rdi
movq %rdi, 0x68(%r14,%rcx,8)
subq 0x3063e(%rip), %r13     # 0x57558
andl 0x68(%r14,%r13,8), %eax
addq %rbx, %rbx
orq %r8, %rbx
orq %rsi, %rbx
orq %rax, %rbx
movq %rbx, 0x68(%r14,%r13,8)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq