// File: /workspace/github_c_makefile_star2_O3/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 $0x28, %rsp
movl %r8d, 0x10(%rsp)
movq %rdx, %rbx
movq %rdi, %rbp
leaq 0x2f6f4(%rip), %rax     # 0x5b6b0
movq (%rax), %r14
notq %r14
leaq -0x10(%rsi), %rax
andq %r14, %rax
addq 0x2f590(%rip), %rax     # 0x5b560
negq %rax
addq %rsi, %rax
addq $-0x10, %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
andq %rsi, %r14
shrq $0x6, %rdx
movq 0x2f563(%rip), %r15     # 0x5b558
addq %rdx, %r15
movq 0x68(%r14,%rdx,8), %r13
movq %r13, %r12
andq $0x4, %r12
je 0x2c03b
leaq 0x2f69b(%rip), %rax     # 0x5b6a8
movq (%rax), %rsi
movq %r15, %rdx
shlq $0xc, %rdx
movl %ecx, 0x8(%rsp)
movl (%rbp), %r8d
movq %r14, %rdi
movq %rbx, %rcx
callq *0x428(%rbp)
movl 0x8(%rsp), %ecx
movl %eax, %edx
movb $0x1, %al
testb %dl, %dl
jne 0x2c20a
movq %r13, 0x18(%rsp)
andl $0x10, %r13d
movq %rbx, %rax
shrq $0xc, %rax
movq %rax, 0x8(%rsp)
testb %cl, %cl
je 0x2c06d
movq %rbp, %rdi
movq %r14, %rsi
movq %r15, %rdx
movq %r13, %rcx
movq %r12, %r8
movq 0x8(%rsp), %r9
callq 0x2c229
cmpb $0x0, 0x10(%rsp)
movq %r13, 0x20(%rsp)
je 0x2c12f
testq %r12, %r12
jne 0x2c156
testq %r13, %r13
jne 0x2c17d
cmpq $0x1000, %rbx           # imm = 0x1000
jb 0x2c1aa
movq %r15, %rbp
shlq $0xc, %rbp
addq %r14, %rbp
leaq (%r14,%r15,8), %r12
addq $0x68, %r12
leaq 0x2e5cf(%rip), %rdx     # 0x5a684
movq 0x8(%rsp), %r13
movq %r15, 0x10(%rsp)
movq 0x2f492(%rip), %rax     # 0x5b558
shlq $0x3, %rax
movq %r12, %rcx
subq %rax, %rcx
testb $0x8, (%rcx)
movb (%rdx), %al
jne 0x2c0ed
testb %al, %al
je 0x2c10b
movl $0x1000, %esi           # imm = 0x1000
movq %rbp, %rdi
movq %rdx, %r15
callq 0x3e7e8
jmp 0x2c103
movq %rdx, %r15
testb %al, %al
jne 0x2c120
movl $0x1000, %edx           # imm = 0x1000
movq %rbp, %rdi
xorl %esi, %esi
callq 0x10270
movq %r15, %rdx
movq 0x10(%rsp), %r15
addq $0x1000, %rbp           # imm = 0x1000
addq $0x8, %r12
decq %r13
jne 0x2c0bf
jmp 0x2c1aa
movl $0x1000, %esi           # imm = 0x1000
movq %rbp, %rdi
callq 0x3e7a6
jmp 0x2c0f4
leaq 0x2e54e(%rip), %rax     # 0x5a684
cmpb $0x1, (%rax)
jne 0x2c1aa
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x3e7a6
jmp 0x2c1aa
leaq 0x2e527(%rip), %rax     # 0x5a684
cmpb $0x1, (%rax)
jne 0x2c1aa
movq %r15, %rdi
shlq $0xc, %rdi
addq %r14, %rdi
movq %rbx, %rsi
andq $-0x1000, %rsi          # imm = 0xF000
callq 0x3e7e8
jmp 0x2c1aa
leaq 0x2e500(%rip), %rax     # 0x5a684
movq %r15, %r12
shlq $0xc, %r12
addq %r14, %r12
movq %rbx, %rbp
andq $-0x1000, %rbp          # imm = 0xF000
cmpb $0x1, (%rax)
je 0x2c219
movq %r12, %rdi
xorl %esi, %esi
movq %rbp, %rdx
callq 0x10270
xorl %eax, %eax
testb $0x14, 0x18(%rsp)
sete %al
shll $0x3, %eax
movq 0x8(%rsp), %rdx
addq %r15, %rdx
movq 0x2f392(%rip), %rcx     # 0x5b558
notq %rcx
addq %rdx, %rcx
movl 0x68(%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, 0x68(%r14,%rcx,8)
subq 0x2f366(%rip), %r15     # 0x5b558
andl 0x68(%r14,%r15,8), %eax
addq %rbx, %rbx
orq %r8, %rbx
orq %rsi, %rbx
orq %rax, %rbx
movq %rbx, 0x68(%r14,%r15,8)
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, %rdi
movq %rbp, %rsi
callq 0x3e7a6
jmp 0x2c19d