// File: /workspace/github_c_makefile_star2_O0/nilyang[P]redis-tdd-annotation/deps/jemalloc/include/jemalloc/internal/jemalloc_internal.h
// Function: sa2u
JEMALLOC_INLINE size_t
sa2u(size_t size, size_t alignment)
{
	size_t usize;

	assert(alignment != 0 && ((alignment - 1) & alignment) == 0);

	/*
	 * Round size up to the nearest multiple of alignment.
	 *
	 * This done, we can take advantage of the fact that for each small
	 * size class, every object is aligned at the smallest power of two
	 * that is non-zero in the base two representation of the size.  For
	 * example:
	 *
	 *   Size |   Base 2 | Minimum alignment
	 *   -----+----------+------------------
	 *     96 |  1100000 |  32
	 *    144 | 10100000 |  32
	 *    192 | 11000000 |  64
	 */
	usize = ALIGNMENT_CEILING(size, alignment);
	/*
	 * (usize < size) protects against the combination of maximal
	 * alignment and size greater than maximal alignment.
	 */
	if (usize < size) {
		/* size_t overflow. */
		return (0);
	}

	if (usize <= arena_maxclass && alignment <= PAGE) {
		if (usize <= SMALL_MAXCLASS)
			return (arena_bin_info[SMALL_SIZE2BIN(usize)].reg_size);
		return (PAGE_CEILING(usize));
	} else {
		size_t run_size;

		/*
		 * We can't achieve subpage alignment, so round up alignment
		 * permanently; it makes later calculations simpler.
		 */
		alignment = PAGE_CEILING(alignment);
		usize = PAGE_CEILING(size);
		/*
		 * (usize < size) protects against very large sizes within
		 * PAGE of SIZE_T_MAX.
		 *
		 * (usize + alignment < usize) protects against the
		 * combination of maximal alignment and usize large enough
		 * to cause overflow.  This is similar to the first overflow
		 * check above, but it needs to be repeated due to the new
		 * usize value, which may now be *equal* to maximal
		 * alignment, whereas before we only detected overflow if the
		 * original size was *greater* than maximal alignment.
		 */
		if (usize < size || usize + alignment < usize) {
			/* size_t overflow. */
			return (0);
		}

		/*
		 * Calculate the size of the over-size run that arena_palloc()
		 * would need to allocate in order to guarantee the alignment.
		 * If the run wouldn't fit within a chunk, round up to a huge
		 * allocation size.
		 */
		run_size = usize + alignment - PAGE;
		if (run_size <= arena_maxclass)
			return (PAGE_CEILING(usize));
		return (CHUNK_CEILING(usize));
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
jmp 0xb269e
movq -0x10(%rbp), %rax
movq -0x18(%rbp), %rcx
subq $0x1, %rcx
addq %rcx, %rax
xorl %ecx, %ecx
subq -0x18(%rbp), %rcx
andq %rcx, %rax
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jae 0xb26d1
movq $0x0, -0x8(%rbp)
jmp 0xb27e6
movq -0x20(%rbp), %rax
leaq 0x76ba4(%rip), %rcx     # 0x129280
cmpq (%rcx), %rax
ja 0xb2741
cmpq $0x1000, -0x18(%rbp)    # imm = 0x1000
ja 0xb2741
cmpq $0xe00, -0x20(%rbp)     # imm = 0xE00
ja 0xb2728
movq -0x20(%rbp), %rcx
subq $0x1, %rcx
shrq $0x3, %rcx
leaq 0x3af78(%rip), %rax     # 0xed680
movzbl (%rax,%rcx), %eax
movl %eax, %ecx
leaq 0x75e3b(%rip), %rax     # 0x128550
imulq $0x68, %rcx, %rcx
addq %rcx, %rax
movq (%rax), %rax
movq %rax, -0x8(%rbp)
jmp 0xb27e6
movq -0x20(%rbp), %rax
addq $0xfff, %rax            # imm = 0xFFF
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x8(%rbp)
jmp 0xb27e6
movq -0x18(%rbp), %rax
addq $0xfff, %rax            # imm = 0xFFF
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x18(%rbp)
movq -0x10(%rbp), %rax
addq $0xfff, %rax            # imm = 0xFFF
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x20(%rbp)
movq -0x20(%rbp), %rax
cmpq -0x10(%rbp), %rax
jb 0xb2781
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
cmpq -0x20(%rbp), %rax
jae 0xb278b
movq $0x0, -0x8(%rbp)
jmp 0xb27e6
movq -0x20(%rbp), %rax
addq -0x18(%rbp), %rax
subq $0x1000, %rax           # imm = 0x1000
movq %rax, -0x28(%rbp)
movq -0x28(%rbp), %rax
leaq 0x76ad8(%rip), %rcx     # 0x129280
cmpq (%rcx), %rax
ja 0xb27c3
movq -0x20(%rbp), %rax
addq $0xfff, %rax            # imm = 0xFFF
andq $-0x1000, %rax          # imm = 0xF000
movq %rax, -0x8(%rbp)
jmp 0xb27e6
movq -0x20(%rbp), %rax
leaq 0x76a02(%rip), %rcx     # 0x1291d0
addq (%rcx), %rax
leaq 0x769f8(%rip), %rcx     # 0x1291d0
movq (%rcx), %rcx
xorq $-0x1, %rcx
andq %rcx, %rax
movq %rax, -0x8(%rbp)
movq -0x8(%rbp), %rax
popq %rbp
retq
nopl (%rax)