// File: /workspace/github_c_makefile_star2_O3/nilyang[P]redis-tdd-annotation/deps/jemalloc/src/jemalloc.c
// Function: je_rallocm
int
je_rallocm(void **ptr, size_t *rsize, size_t size, size_t extra, int flags)
{
	void *p, *q;
	size_t usize;
	size_t old_size;
	size_t old_rzsize JEMALLOC_CC_SILENCE_INIT(0);
	size_t alignment = (ZU(1) << (flags & ALLOCM_LG_ALIGN_MASK)
	    & (SIZE_T_MAX-1));
	bool zero = flags & ALLOCM_ZERO;
	bool no_move = flags & ALLOCM_NO_MOVE;
	unsigned arena_ind = ((unsigned)(flags >> 8)) - 1;
	bool try_tcache_alloc, try_tcache_dalloc;
	arena_t *arena;

	assert(ptr != NULL);
	assert(*ptr != NULL);
	assert(size != 0);
	assert(SIZE_T_MAX - size >= extra);
	assert(malloc_initialized || IS_INITIALIZER);

	if (arena_ind != UINT_MAX) {
		arena_chunk_t *chunk;
		try_tcache_alloc = true;
		chunk = (arena_chunk_t *)CHUNK_ADDR2BASE(*ptr);
		try_tcache_dalloc = (chunk == *ptr || chunk->arena !=
		    arenas[arena_ind]);
		arena = arenas[arena_ind];
	} else {
		try_tcache_alloc = true;
		try_tcache_dalloc = true;
		arena = NULL;
	}

	p = *ptr;
	if (config_prof && opt_prof) {
		prof_thr_cnt_t *cnt;

		/*
		 * usize isn't knowable before iralloc() returns when extra is
		 * non-zero.  Therefore, compute its maximum possible value and
		 * use that in PROF_ALLOC_PREP() to decide whether to capture a
		 * backtrace.  prof_realloc() will use the actual usize to
		 * decide whether to sample.
		 */
		size_t max_usize = (alignment == 0) ? s2u(size+extra) :
		    sa2u(size+extra, alignment);
		prof_ctx_t *old_ctx = prof_ctx_get(p);
		old_size = isalloc(p, true);
		if (config_valgrind && opt_valgrind)
			old_rzsize = p2rz(p);
		PROF_ALLOC_PREP(1, max_usize, cnt);
		if (cnt == NULL)
			goto label_oom;
		/*
		 * Use minimum usize to determine whether promotion may happen.
		 */
		if (prof_promote && (uintptr_t)cnt != (uintptr_t)1U
		    && ((alignment == 0) ? s2u(size) : sa2u(size, alignment))
		    <= SMALL_MAXCLASS) {
			q = irallocx(p, SMALL_MAXCLASS+1, (SMALL_MAXCLASS+1 >=
			    size+extra) ? 0 : size+extra - (SMALL_MAXCLASS+1),
			    alignment, zero, no_move, try_tcache_alloc,
			    try_tcache_dalloc, arena);
			if (q == NULL)
				goto label_err;
			if (max_usize < PAGE) {
				usize = max_usize;
				arena_prof_promoted(q, usize);
			} else
				usize = isalloc(q, config_prof);
		} else {
			q = irallocx(p, size, extra, alignment, zero, no_move,
			    try_tcache_alloc, try_tcache_dalloc, arena);
			if (q == NULL)
				goto label_err;
			usize = isalloc(q, config_prof);
		}
		prof_realloc(q, usize, cnt, old_size, old_ctx);
		if (rsize != NULL)
			*rsize = usize;
	} else {
		if (config_stats) {
			old_size = isalloc(p, false);
			if (config_valgrind && opt_valgrind)
				old_rzsize = u2rz(old_size);
		} else if (config_valgrind && opt_valgrind) {
			old_size = isalloc(p, false);
			old_rzsize = u2rz(old_size);
		}
		q = irallocx(p, size, extra, alignment, zero, no_move,
		    try_tcache_alloc, try_tcache_dalloc, arena);
		if (q == NULL)
			goto label_err;
		if (config_stats)
			usize = isalloc(q, config_prof);
		if (rsize != NULL) {
			if (config_stats == false)
				usize = isalloc(q, config_prof);
			*rsize = usize;
		}
	}

	*ptr = q;
	if (config_stats) {
		thread_allocated_t *ta;
		ta = thread_allocated_tsd_get();
		ta->allocated += usize;
		ta->deallocated += old_size;
	}
	UTRACE(p, size, q);
	JEMALLOC_VALGRIND_REALLOC(q, usize, p, old_size, old_rzsize, zero);
	return (ALLOCM_SUCCESS);
label_err:
	if (no_move) {
		UTRACE(p, size, q);
		return (ALLOCM_ERR_NOT_MOVED);
	}
label_oom:
	if (config_xmalloc && opt_xmalloc) {
		malloc_write("<jemalloc>: Error in rallocm(): "
		    "out of memory\n");
		abort();
	}
	UTRACE(p, size, 0);
	return (ALLOCM_ERR_OOM);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %r8d, %ebx
movq %rcx, %r8
movq %rdx, %r11
movq %rsi, 0x40(%rsp)
movl $0x1, %r13d
movl %ebx, %ecx
shlq %cl, %r13
movq %rdi, 0x48(%rsp)
movq (%rdi), %r15
leaq 0x60e3d(%rip), %r12     # 0xdf880
movq (%r12), %rax
notq %rax
cmpl $0xff, %ebx
ja 0x7ea65
andq %r15, %rax
movb $0x1, 0x7(%rsp)
movq $0x0, 0x10(%rsp)
jmp 0x7ea9e
movl %ebx, %edx
sarl $0x8, %edx
decl %edx
andq %r15, %rax
movq 0x60102(%rip), %rcx     # 0xdeb78
movl %edx, %edx
cmpq %rax, %r15
je 0x7ea90
movq (%rcx,%rdx,8), %rdx
movq %rdx, 0x10(%rsp)
cmpq %rdx, (%rax)
setne 0x7(%rsp)
jmp 0x7ea9e
movq (%rcx,%rdx,8), %rcx
movq %rcx, 0x10(%rsp)
movb $0x1, 0x7(%rsp)
cmpq %rax, %r15
je 0x7eada
movq %r15, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x60e74(%rip), %rdx     # 0xdf928
subq (%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rax,%rcx,8), %r14
movl %r14d, %eax
shrl $0x4, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
jne 0x7eaf3
andq $-0x1000, %r14          # imm = 0xF000
jmp 0x7eb02
movq %r15, %rdi
movq %r11, %r14
movq %r8, %rbp
callq 0x8be94
movq %rbp, %r8
movq %r14, %r11
movq %rax, %r14
jmp 0x7eb02
imulq $0x68, %rax, %rax
leaq 0x60102(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %r14
xorl %eax, %eax
cmpb $0x1, 0x6005f(%rip)     # 0xdeb6a
jne 0x7eb39
cmpq $0xe00, %r14            # imm = 0xE00
ja 0x7eb39
leaq -0x1(%r14), %rax
shrq $0x3, %rax
leaq 0x2469b(%rip), %rcx     # 0xa31c0
movzbl (%rcx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x600cc(%rip), %rcx     # 0xdec00
movq 0x8(%rcx,%rax), %rax
movq %rax, 0x38(%rsp)
andq $-0x2, %r13
movq (%r12), %rax
notq %rax
andq %r15, %rax
movq %r15, %rcx
subq %rax, %rcx
je 0x7eb84
shrq $0xc, %rcx
leaq 0x60dc9(%rip), %rdx     # 0xdf928
subq (%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rax,%rcx,8), %rbp
movl %ebp, %eax
shrl $0x4, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
jne 0x7eb9d
andq $-0x1000, %rbp          # imm = 0xF000
jmp 0x7ebac
movq %r15, %rdi
movq %r11, %r12
movq %r8, %rbp
callq 0x8be94
movq %rbp, %r8
movq %r12, %r11
movq %rax, %rbp
jmp 0x7ebac
imulq $0x68, %rax, %rax
leaq 0x60058(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rbp
testq %r13, %r13
je 0x7ec3b
leaq -0x1(%r13), %rdi
testq %r15, %rdi
je 0x7ec3b
testb %bl, %bl
js 0x7f166
leaq (%r8,%r11), %rcx
leaq (%rcx,%r13), %r12
decq %r12
movq %r13, %r9
negq %r9
andq %r9, %r12
cmpq %rcx, %r12
jb 0x7f166
leaq 0x60d46(%rip), %rax     # 0xdf930
movq (%rax), %rax
cmpq %rax, %r12
seta %dl
cmpq $0x1001, %r13           # imm = 0x1001
setae %sil
orb %dl, %sil
jne 0x7eff5
cmpq $0xe00, %r12            # imm = 0xE00
ja 0x7f044
decq %r12
shrq $0x3, %r12
leaq 0x2459e(%rip), %rcx     # 0xa31c0
movzbl (%rcx,%r12), %ecx
imulq $0x68, %rcx, %rcx
leaq 0x5ffce(%rip), %rdx     # 0xdec00
movq (%rdx,%rcx), %r12
jmp 0x7f052
testb %bl, %bl
js 0x7ec7e
leaq (%r8,%r11), %rax
leaq 0x60ce6(%rip), %rcx     # 0xdf930
cmpq (%rcx), %rax
jbe 0x7ec9d
movl %ebx, %r9d
andl $0x40, %r9d
shrl $0x6, %r9d
subq $0x8, %rsp
movzbl 0xf(%rsp), %eax
movq %r15, %rdi
movq %rbp, %rsi
movq %r11, %rdx
movq %r8, %rcx
movq %r13, %r8
pushq %rax
callq 0x8baa1
addq $0x10, %rsp
jmp 0x7ecec
leaq 0x60cab(%rip), %rax     # 0xdf930
cmpq %r11, (%rax)
jae 0x7ecd0
movq %r15, %rdi
movq %rbp, %rsi
movq %r11, %rdx
movq %r8, %rcx
callq 0x8ba30
jmp 0x7ecec
movl %ebx, %eax
andl $0x40, %eax
shrl $0x6, %eax
subq $0x8, %rsp
movzbl 0xf(%rsp), %r10d
movq 0x18(%rsp), %rdi
movq %r15, %rsi
movq %rbp, %rdx
movq %r11, %rcx
movq %r13, %r9
pushq %r10
pushq $0x1
pushq %rax
callq 0x82021
addq $0x20, %rsp
jmp 0x7ecec
movq %r8, %rcx
movl %ebx, %r8d
andl $0x40, %r8d
shrl $0x6, %r8d
movq %r15, %rdi
movq %rbp, %rsi
movq %r11, %rdx
callq 0x81c86
movq %rax, %r12
testq %rax, %rax
je 0x7f166
leaq 0x60b81(%rip), %rbp     # 0xdf880
movq (%rbp), %rax
notq %rax
andq %r12, %rax
movq %r12, %rcx
subq %rax, %rcx
je 0x7ed42
shrq $0xc, %rcx
leaq 0x60c0c(%rip), %rdx     # 0xdf928
subq (%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rax,%rcx,8), %r13
movl %r13d, %eax
shrl $0x4, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
jne 0x7ed4f
andq $-0x1000, %r13          # imm = 0xF000
jmp 0x7ed5e
movq %r12, %rdi
callq 0x8be94
movq %rax, %r13
jmp 0x7ed5e
imulq $0x68, %rax, %rax
leaq 0x5fea6(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %r13
movq 0x40(%rsp), %rax
testq %rax, %rax
je 0x7ed6b
movq %r13, (%rax)
movq 0x48(%rsp), %rax
movq %r12, (%rax)
addq %r13, %fs:-0x28
addq %r14, %fs:-0x20
xorl %ecx, %ecx
cmpb $0x1, 0x5fddc(%rip)     # 0xdeb6a
jne 0x7f16f
movq (%rbp), %rax
notq %rax
andq %r12, %rax
movq %r12, %rcx
subq %rax, %rcx
je 0x7edd5
shrq $0xc, %rcx
leaq 0x60b77(%rip), %rdx     # 0xdf928
subq (%rdx), %rcx
leaq (%rcx,%rcx,2), %rcx
movq 0x40(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x4, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
jne 0x7eddf
andq $-0x1000, %rax          # imm = 0xF000
jmp 0x7edee
movq %r12, %rdi
callq 0x8be94
jmp 0x7edee
imulq $0x68, %rcx, %rax
leaq 0x5fe16(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rax
cmpq $0xe00, %rax            # imm = 0xE00
ja 0x7ee1a
decq %rax
shrq $0x3, %rax
leaq 0x243bc(%rip), %rcx     # 0xa31c0
movzbl (%rcx,%rax), %eax
imulq $0x68, %rax, %rax
leaq 0x5fded(%rip), %rcx     # 0xdec00
movq 0x8(%rcx,%rax), %rcx
jmp 0x7ee1c
xorl %ecx, %ecx
cmpq %r15, %r12
je 0x7ef55
testq %r15, %r15
je 0x7ee70
leaq 0x50(%rsp), %rax
movq $0x1302, (%rax)         # imm = 0x1302
movq %r15, 0x8(%rax)
movq 0x38(%rsp), %rdx
movq %rdx, 0x10(%rax)
xorl %edx, %edx
movq %rdx, 0x18(%rax)
movq %rdx, 0x20(%rax)
movq %rdx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
cmpq %r13, %r14
movq %r13, %rsi
cmovbq %r14, %rsi
leaq 0x50(%rsp), %rax
movq $0x1301, (%rax)         # imm = 0x1301
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
movq %rcx, 0x18(%rax)
xorl %ecx, %ecx
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
testq %rsi, %rsi
je 0x7ef01
leaq 0x50(%rsp), %rax
movq $0x4d430002, (%rax)     # imm = 0x4D430002
movq %r12, 0x8(%rax)
movq %rsi, 0x10(%rax)
xorl %edx, %edx
movq %rdx, 0x18(%rax)
movq %rdx, 0x20(%rax)
movq %rdx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
testb $0x40, %bl
je 0x7f16f
cmpq %r14, %r13
jbe 0x7f16f
subq %rsi, %r13
leaq 0x50(%rsp), %rax
movq $0x4d430002, (%rax)     # imm = 0x4D430002
addq %rsi, %r12
movq %r12, 0x8(%rax)
movq %r13, 0x10(%rax)
xorl %ecx, %ecx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
jmp 0x7efe6
leaq 0x50(%rsp), %rax
movq $0x130b, (%rax)         # imm = 0x130B
movq %r12, 0x8(%rax)
movq %r14, 0x10(%rax)
movq %r13, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq $0x0, 0x28(%rax)
xorl %ecx, %ecx
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
testb $0x40, %bl
je 0x7f16f
subq %r14, %r13
jbe 0x7f16f
leaq 0x50(%rsp), %rax
movq $0x4d430002, (%rax)     # imm = 0x4D430002
addq %r12, %r14
movq %r14, 0x8(%rax)
movq %r13, 0x10(%rax)
xorl %ecx, %ecx
movq %rcx, 0x18(%rax)
movq %rcx, 0x20(%rax)
movq %rcx, 0x28(%rax)
xorl %edx, %edx
rolq $0x3, %rdi
rolq $0xd, %rdi
rolq $0x3d, %rdi
rolq $0x33, %rdi
xchgq %rbx, %rbx
movq %rdx, 0x8(%rsp)
movq 0x8(%rsp), %rax
jmp 0x7f16f
leaq 0xfff(%rcx), %r12
andq $-0x1000, %r12          # imm = 0xF000
cmpq %rcx, %r12
jb 0x7f166
leaq 0xfff(%r13), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %r12, %rcx
jb 0x7f166
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x7f052
leaq 0x6084a(%rip), %rcx     # 0xdf880
movq (%rcx), %rcx
addq %rcx, %r12
notq %rcx
andq %rcx, %r12
jmp 0x7f052
addq $0xfff, %r12            # imm = 0xFFF
andq $-0x1000, %r12          # imm = 0xF000
testq %r12, %r12
je 0x7f166
cmpq $0x1000, %r13           # imm = 0x1000
movq %r11, 0x30(%rsp)
movq %r8, 0x28(%rsp)
movq %rdi, 0x20(%rsp)
movq %r9, 0x18(%rsp)
ja 0x7f099
cmpq %r12, %rax
jb 0x7f099
movl %ebx, %edx
andl $0x40, %edx
shrl $0x6, %edx
movq 0x10(%rsp), %rdi
movq %r12, %rsi
movl $0x1, %ecx
callq 0x7fb8c
jmp 0x7f107
cmpq %r12, %rax
jb 0x7f0d6
movq 0x10(%rsp), %rax
movq %rax, %rdi
testq %rax, %rax
jne 0x7f0c1
movq %fs:-0x30, %rdi
testq %rdi, %rdi
jne 0x7f0c1
callq 0x7c4da
movq %rax, %rdi
movl %ebx, %ecx
andl $0x40, %ecx
shrl $0x6, %ecx
movq %r12, %rsi
movq %r13, %rdx
callq 0x8104f
jmp 0x7f107
leaq 0x60783(%rip), %rax     # 0xdf860
cmpq %r13, (%rax)
jae 0x7f0f7
movl %ebx, %edx
andl $0x40, %edx
shrl $0x6, %edx
movq %r12, %rdi
movq %r13, %rsi
callq 0x8b92d
jmp 0x7f107
movl %ebx, %esi
andl $0x40, %esi
shrl $0x6, %esi
movq %r12, %rdi
callq 0x8b91c
movq %rax, %r12
testq %rax, %rax
movq 0x30(%rsp), %r9
movq 0x28(%rsp), %rax
movq 0x20(%rsp), %rdi
movq 0x18(%rsp), %rcx
leaq 0x60808(%rip), %rdx     # 0xdf930
je 0x7f156
cmpq %r9, %rbp
cmovbq %rbp, %r9
movq %r12, %rdi
movq %r15, %rsi
movq %r9, %rdx
callq 0x1fbd0
cmpq $0x0, 0x5fa19(%rip)     # 0xdeb60
je 0x7f183
movq %r15, %rdi
callq 0x8da50
jmp 0x7ecf8
testq %rax, %rax
je 0x7f166
addq %r9, %rdi
andq %rcx, %rdi
cmpq %r9, %rdi
jae 0x7f1ad
xorl %ecx, %ecx
testb %bl, %bl
sets %cl
incl %ecx
movl %ecx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x606f6(%rip), %rax     # 0xdf880
movq (%rax), %rsi
notq %rsi
andq %r15, %rsi
cmpq %rsi, %r15
je 0x7f1f4
movq (%rsi), %rdi
movzbl 0x7(%rsp), %ecx
movq %r15, %rdx
callq 0x7f86f
jmp 0x7ecf8
cmpq $0x1001, %r13           # imm = 0x1001
setae %cl
movq (%rdx), %rax
cmpq %rax, %rdi
seta %dl
orb %cl, %dl
jne 0x7f206
cmpq $0xe00, %rdi            # imm = 0xE00
ja 0x7f255
decq %rdi
shrq $0x3, %rdi
leaq 0x23fe1(%rip), %rax     # 0xa31c0
movzbl (%rax,%rdi), %eax
imulq $0x68, %rax, %rax
leaq 0x5fa12(%rip), %rcx     # 0xdec00
movq (%rcx,%rax), %rdi
jmp 0x7f263
movq %r15, %rdi
movl $0x1, %esi
callq 0x8bdfd
jmp 0x7ecf8
leaq 0xfff(%r9), %rdi
andq $-0x1000, %rdi          # imm = 0xF000
cmpq %r9, %rdi
jb 0x7f166
leaq 0xfff(%r13), %rcx
andq $-0x1000, %rcx          # imm = 0xF000
addq %rdi, %rcx
jb 0x7f166
addq $-0x1000, %rcx          # imm = 0xF000
cmpq %rax, %rcx
jbe 0x7f263
leaq 0x60639(%rip), %rax     # 0xdf880
movq (%rax), %rax
addq %rax, %rdi
notq %rax
andq %rax, %rdi
jmp 0x7f263
addq $0xfff, %rdi            # imm = 0xFFF
andq $-0x1000, %rdi          # imm = 0xF000
testq %rdi, %rdi
je 0x7f166
movl %ebx, %edx
andl $0x40, %edx
shrl $0x6, %edx
movq %r13, %rsi
movl $0x1, %ecx
movq 0x10(%rsp), %r8
movq %r9, %r12
callq 0x7ff9c
movq %r12, %r9
movq %rax, %r12
testq %rax, %rax
jne 0x7f12a
jmp 0x7f166