// File: /workspace/github_c_makefile_star2_O1/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 0x1d0b2(%rip), %rbp     # 0x4d0d0
movq (%rbp), %rax
notq %rax
andq %rsi, %rax
cmpq %rsi, %rax
je 0x30307
movq %rbx, %rcx
subq %rax, %rcx
shrq $0xc, %rcx
leaq 0x1cf7e(%rip), %rdx     # 0x4cfc0
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 0x3031a
movl %eax, %eax
leaq 0xb5d8(%rip), %rcx      # 0x3b640
movq (%rcx,%rax,8), %r15
movq 0x50(%r14), %r12
testq %r12, %r12
je 0x300e2
movq (%r12), %rax
leaq (%rax,%r15), %rdx
leaq 0x1c4a4(%rip), %rcx     # 0x4c528
movq (%rcx), %rcx
cmpq %rcx, %rdx
jbe 0x300b4
xorl %r13d, %r13d
subq %r15, %rcx
cmovaeq %rcx, %r13
cmpq %r13, %rax
jbe 0x300b4
cmpq $0x0, 0x8(%r12)
je 0x300b4
movq %r14, %rdi
movq %r12, %rsi
callq 0x304f8
cmpq %r13, (%r12)
ja 0x3009b
movq 0x18(%r12), %rcx
movl $0x1, %eax
shlq %cl, %rax
cmpq %rax, 0x8(%r12)
je 0x3018a
movq %r12, %r13
movq (%r13), %rax
addq %r15, %rax
leaq 0x1c44b(%rip), %rcx     # 0x4c528
cmpq (%rcx), %rax
jbe 0x30133
movq (%rbp), %rdx
notq %rdx
andq %rbx, %rdx
cmpq %rbx, %rdx
je 0x30330
movq %rbx, %r8
subq %rdx, %r8
shrq $0xc, %r8
leaq 0x1ceba(%rip), %rax     # 0x4cfc0
movq %r8, %rcx
subq (%rax), %rcx
testb $0x2, 0x78(%rdx,%rcx,8)
movq (%rdx), %rsi
movq %r14, %rdi
movq %rbx, %rcx
jne 0x30349
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdf6b
movq 0x8(%r13), %rdx
movq 0x10(%r13), %rsi
movb 0x18(%r13), %cl
movq $-0x1, %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 0x1c3b0(%rip), %rax     # 0x4c522
cmpb $0x1, (%rax)
je 0x3035c
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
incq %rcx
movq %r14, %rdi
movq %rcx, %rsi
callq 0x1150b
testq %rax, %rax
je 0x30226
movq %rax, %r13
movq (%r12), %rax
movq %rax, (%r13)
movq 0x8(%r12), %rax
movq %rax, 0x8(%r13)
movq 0x8(%r12), %rdx
movq 0x10(%r12), %rax
leaq (%rdx,%rax), %rdi
movb 0x18(%r12), %cl
movl $0x1, %esi
shlq %cl, %rsi
cmpq %rsi, %rdi
jbe 0x30236
subq %rax, %rsi
subq %rsi, %rdx
movq %rdx, 0x10(%rsp)
leaq 0x20(%r13), %rdi
leaq 0x20(%r12), %rcx
movq %rcx, (%rsp)
shlq $0x4, %rax
movq %rsi, %rdx
leaq (%r12,%rax), %rsi
addq $0x20, %rsi
shlq $0x4, %rdx
movq %rdx, 0x8(%rsp)
callq 0xb340
movq 0x8(%rsp), %rax
leaq (%rax,%r13), %rdi
addq $0x20, %rdi
movq 0x10(%rsp), %rdx
shlq $0x4, %rdx
movq (%rsp), %rsi
jmp 0x3024d
movq %r14, %rdi
movq %r12, %rsi
callq 0x304f8
jmp 0x300cc
movq %r13, %rdi
addq $0x20, %rdi
shlq $0x4, %rax
leaq (%r12,%rax), %rsi
addq $0x20, %rsi
shlq $0x4, %rdx
callq 0xb340
movq (%rbp), %rax
notq %rax
andq %r12, %rax
cmpq %rax, %r12
je 0x3036c
movq (%rax), %rsi
movq (%rbp), %rax
notq %rax
andq %r12, %rax
movq %r12, %rcx
subq %rax, %rcx
je 0x3037c
shrq $0xc, %rcx
leaq 0x1cd37(%rip), %rdx     # 0x4cfc0
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 0x303a4
movl %ecx, %eax
leaq 0xb392(%rip), %rcx      # 0x3b640
movq (%rcx,%rax,8), %rax
negq %rax
lock
xaddq %rax, 0x90(%rsi)
movq (%rbp), %rdx
notq %rdx
andq %r12, %rdx
movq %r12, %r8
subq %rdx, %r8
je 0x30394
shrq $0xc, %r8
leaq 0x1cce1(%rip), %rax     # 0x4cfc0
movq %r8, %rcx
subq (%rax), %rcx
testb $0x2, 0x78(%rdx,%rcx,8)
movq (%rdx), %rsi
movq %r14, %rdi
movq %r12, %rcx
jne 0x303b8
callq 0xdf6b
movq %r13, 0x50(%r14)
jmp 0x300cf
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2e4e2
movq %rax, %r15
jmp 0x3006c
shrq %r15
andq $-0x1000, %r15          # imm = 0xF000
addq $-0x1000, %r15          # imm = 0xF000
jmp 0x3006c
movq %r14, %rdi
movq %rbx, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x11227
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0xdfd3
movq %r15, %rdi
movq %rbx, %rsi
callq 0x116c9
jmp 0x3017b
movq %r12, %rdi
callq 0x2e39f
movq %rax, %rsi
jmp 0x30268
movq %r14, %rdi
movq %rsi, (%rsp)
movq %r12, %rsi
callq 0x2e4e2
movq (%rsp), %rsi
jmp 0x302b2
movq %r14, %rdi
movq %r12, %rsi
callq 0x11227
jmp 0x302fe
shrq %rax
andq $-0x1000, %rax          # imm = 0xF000
addq $-0x1000, %rax          # imm = 0xF000
jmp 0x302b2
callq 0xdfd3
jmp 0x302fe