// File: /workspace/github_c_makefile_star2_O2/zhou-yuxin[P]redis-aof-no-cow/deps/jemalloc/src/quarantine.c
// Function: je_quarantine
void
quarantine(tsd_t *tsd, void *ptr)
{
	quarantine_t *quarantine;
	size_t usize = isalloc(tsd_tsdn(tsd), ptr, config_prof);

	cassert(config_fill);
	assert(opt_quarantine);

	if ((quarantine = tsd_quarantine_get(tsd)) == NULL) {
		idalloctm(tsd_tsdn(tsd), ptr, NULL, false, true);
		return;
	}
	/*
	 * Drain one or more objects if the quarantine size limit would be
	 * exceeded by appending ptr.
	 */
	if (quarantine->curbytes + usize > opt_quarantine) {
		size_t upper_bound = (opt_quarantine >= usize) ? opt_quarantine
		    - usize : 0;
		quarantine_drain(tsd_tsdn(tsd), quarantine, upper_bound);
	}
	/* Grow the quarantine ring buffer if it's full. */
	if (quarantine->curobjs == (ZU(1) << quarantine->lg_maxobjs))
		quarantine = quarantine_grow(tsd, quarantine);
	/* quarantine_grow() must free a slot if it fails to grow. */
	assert(quarantine->curobjs < (ZU(1) << quarantine->lg_maxobjs));
	/* Append ptr if its size doesn't exceed the quarantine size. */
	if (quarantine->curbytes + usize <= opt_quarantine) {
		size_t offset = (quarantine->first + quarantine->curobjs) &
		    ((ZU(1) << quarantine->lg_maxobjs) - 1);
		quarantine_obj_t *obj = &quarantine->objs[offset];
		obj->ptr = ptr;
		obj->usize = usize;
		quarantine->curbytes += usize;
		quarantine->curobjs++;
		if (config_fill && unlikely(opt_junk_free)) {
			/*
			 * Only do redzone validation if Valgrind isn't in
			 * operation.
			 */
			if ((!config_valgrind || likely(!in_valgrind))
			    && usize <= SMALL_MAXCLASS)
				arena_quarantine_junk_small(ptr, usize);
			else
				memset(ptr, JEMALLOC_FREE_JUNK, usize);
		}
	} else {
		assert(quarantine->curbytes == 0);
		idalloctm(tsd_tsdn(tsd), ptr, NULL, false, true);
	}
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x1e16a(%rip), %r13     # 0x490d0
movq (%r13), %rax
notq %rax
andq %rsi, %rax
cmpq %rsi, %rax
je 0x2b238
movq %rbx, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1e036(%rip), %rdx     # 0x48fc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %r15
movl %r15d, %eax
shrl $0x5, %eax
movl $0xff, %ecx
andl %ecx, %eax
cmpl %ecx, %eax
je 0x2b24b
movl %eax, %eax
leaq 0xb290(%rip), %rcx      # 0x36240
movq (%rcx,%rax,8), %r15
movq 0x50(%r14), %r12
testq %r12, %r12
je 0x2b088
movq (%r12), %rcx
addq %r15, %rcx
leaq 0x1d559(%rip), %rax     # 0x48528
movq (%rax), %rax
cmpq %rax, %rcx
jbe 0x2afeb
xorl %edx, %edx
subq %r15, %rax
cmovaeq %rax, %rdx
movq %r14, %rdi
movq %r12, %rsi
callq 0x2b339
movq 0x18(%r12), %rcx
pushq $0x1
popq %rbp
movq %rbp, %rax
shlq %cl, %rax
cmpq %rax, 0x8(%r12)
jne 0x2b09c
incq %rcx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x2ad9a
testq %rax, %rax
je 0x2b091
movq %rax, %r13
movq %r14, 0x10(%rsp)
movq (%r12), %rax
movq %rax, (%r13)
movq 0x8(%r12), %r14
movq %r14, 0x8(%r13)
movq 0x10(%r12), %rax
leaq (%rax,%r14), %rdx
movb 0x18(%r12), %cl
shlq %cl, %rbp
cmpq %rbp, %rdx
jbe 0x2b0ab
subq %rax, %rbp
subq %rbp, %r14
leaq 0x20(%r13), %rdi
leaq 0x20(%r12), %rcx
movq %rcx, 0x8(%rsp)
shlq $0x4, %rax
leaq (%r12,%rax), %rsi
addq $0x20, %rsi
shlq $0x4, %rbp
movq %rbp, %rdx
callq 0xb340
leaq 0x20(,%rbp), %rdi
addq %r13, %rdi
shlq $0x4, %r14
movq 0x8(%rsp), %rsi
jmp 0x2b0c2
movq (%r13), %rdx
jmp 0x2b19c
movq %r14, %rdi
movq %r12, %rsi
callq 0x2b48c
movq %r12, %r13
leaq 0x1e02a(%rip), %rbp     # 0x490d0
jmp 0x2b185
movq %r13, %rdi
addq $0x20, %rdi
shlq $0x4, %rax
leaq (%r12,%rax), %rsi
addq $0x20, %rsi
shlq $0x4, %r14
movq %r14, %rdx
callq 0xb340
leaq 0x1dfff(%rip), %rax     # 0x490d0
movq (%rax), %rax
notq %rax
andq %r12, %rax
cmpq %rax, %r12
movq 0x10(%rsp), %r14
je 0x2b2bf
movq (%rax), %rbp
cmpq %r12, %rax
je 0x2b2df
movq %r12, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1debb(%rip), %rdx     # 0x48fc0
subq (%rdx), %rcx
movq 0x78(%rax,%rcx,8), %rax
movl %eax, %ecx
shrl $0x5, %ecx
movl $0xff, %edx
andl %edx, %ecx
cmpl %edx, %ecx
je 0x2b2ff
movl %ecx, %eax
leaq 0xb116(%rip), %rcx      # 0x36240
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x90(%rbp)
leaq 0x1df8f(%rip), %rbp     # 0x490d0
movq (%rbp), %rdx
notq %rdx
andq %r12, %rdx
movq %r12, %r8
subq %rdx, %r8
je 0x2b2ef
shrq $0xc, %r8
leaq 0x1de5e(%rip), %rax     # 0x48fc0
movq %r8, %rcx
subq (%rax), %rcx
testb $0x2, 0x78(%rdx,%rcx,8)
movq (%rdx), %rsi
movq %r14, %rdi
movq %r12, %rcx
jne 0x2b313
callq 0x1ca94
movq %r13, 0x50(%r14)
movq (%r13), %rax
addq %r15, %rax
leaq 0x1d395(%rip), %rcx     # 0x48528
cmpq (%rcx), %rax
jbe 0x2b1e9
movq (%rbp), %rdx
notq %rdx
andq %rbx, %rdx
cmpq %rbx, %rdx
je 0x2b261
movq %rbx, %r8
subq %rdx, %r8
shrq $0xc, %r8
leaq 0x1de04(%rip), %rax     # 0x48fc0
movq %r8, %rcx
subq (%rax), %rcx
testb $0x2, 0x78(%rdx,%rcx,8)
movq (%rdx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
jne 0x2b27a
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1ca94
movq 0x8(%r13), %rdx
movq 0x10(%r13), %rsi
movb 0x18(%r13), %cl
pushq $-0x1
popq %rdi
shlq %cl, %rdi
addq %rdx, %rsi
notq %rdi
andq %rsi, %rdi
shlq $0x4, %rdi
movq %rbx, 0x20(%r13,%rdi)
movq %r15, 0x28(%r13,%rdi)
movq %rax, (%r13)
incq %rdx
movq %rdx, 0x8(%r13)
leaq 0x1d2fe(%rip), %rax     # 0x48522
cmpb $0x1, (%rax)
je 0x2b28d
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r14, %rdi
movq %rbx, %rsi
callq 0x292e1
movq %rax, %r15
jmp 0x2afb4
shrq %r15
andq $-0x1000, %r15          # imm = 0xF000
addq $-0x1000, %r15          # imm = 0xF000
jmp 0x2afb4
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x28fb2
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1cc1f
leaq 0x1d308(%rip), %rax     # 0x4859c
cmpb $0x0, (%rax)
jne 0x2b31d
cmpq $0x3800, %r15           # imm = 0x3800
ja 0x2b31d
movq %rbx, %rdi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1b994
movq %r12, %rdi
callq 0x28ce3
movq %rax, %rbp
leaq 0x1ddff(%rip), %rax     # 0x490d0
movq (%rax), %rax
notq %rax
andq %r12, %rax
jmp 0x2b0eb
movq %r14, %rdi
movq %r12, %rsi
callq 0x292e1
jmp 0x2b12e
movq %r14, %rdi
movq %r12, %rsi
callq 0x28fb2
jmp 0x2b181
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x2b12e
callq 0x1cc1f
jmp 0x2b181
pushq $0x5a
popq %rsi
movq %rbx, %rdi
movq %r15, %rdx
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xb230