// File: /workspace/github_cpp_makefile_star2_O1/walker-xian[P]teisye/src/teisye.cpp
// Function: teisye::heap::alloc(unsigned long)
inline void* alloc(size_t size) noexcept
    {
        auto key = _book.key(size + sizeof(memory_unit::header));
        memory_unit* unit{};
        if (key <= _book.key_max_small())
        {
            unit = _thread_cache.alloc(key);
            if (unit)
            {
                unit->_header._idle = false;
                unit->_header._size = static_cast<uint32_t>(size);
                assert(validate(unit));
                return &unit->_next;
            }
        }

        if (key <= _book.key_max_medium())
        {
            unit = _shared_cache.alloc(key);
            if (unit)
            {
                unit->_header._idle = false;
                unit->_header._size = static_cast<uint32_t>(size);
                assert(validate(unit));
                return &unit->_next;
            }

            unit = _slabs.alloc(_book.value(key));
        }
        else if (key <= _book.key_max_large())
        {
            unit = _large.alloc(size);
        }
        else
        {
            size_t adjusted_size = size + sizeof(huge_unit) + sizeof(huge_unit::_raw_ptr);
            void *raw_ptr = ::malloc(adjusted_size);
            if (raw_ptr)
            {
                auto hu = align<huge_unit*>(raw_ptr, sizeof(huge_unit)) - 1;
                assert(hu >= raw_ptr);
                hu->_raw_ptr = raw_ptr;
                unit = reinterpret_cast<memory_unit*>(&hu->_unit);
            }
        }

        assert(unit);
        if (unit)
        {
            unit->_header._size = static_cast<uint32_t>(size);
            unit->_header._signature = _unit_signature;
            unit->_header._key = key;
            unit->_header._idle = false;
            assert(is_aligned(&unit->_next));
            assert(validate(unit));
            return &unit->_next;
        }

        return nullptr;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsi), %rcx
cmpq $0x11, %rcx
jae 0x14629
xorl %r12d, %r12d
jmp 0x1467d
leaq 0x7(%rbx), %r12
cmpq $0x80, %rcx
ja 0x1463c
shrl $0x4, %r12d
jmp 0x1467d
movq %r12, %rax
shrq $0x5, %rax
addq $-0x4, %rax
cmpq $0x3, %rax
ja 0x14654
orb $0x8, %al
movl %eax, %r12d
jmp 0x1467d
leaq 0x27(%rbx), %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq $0x5, %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14921
orb $0xc, %dl
movl %edx, %r12d
cmpb 0xc234(%rip), %r12b     # 0x208b8
jg 0x14703
cmpb $0x0, %fs:-0x8
je 0x14cb0
cmpb $0x32, %r12b
jge 0x14cba
movq %fs:0x0, %rax
leaq -0x1a0(%rax), %rcx
movsbq %r12b, %rax
movq (%rcx,%rax,8), %rcx
testq %rcx, %rcx
je 0x14703
movq 0x8(%rcx), %rdx
movq %rdx, %fs:-0x1a0(,%rax,8)
leaq 0xc058(%rip), %rdx      # 0x20728
movq (%rdx,%rax,8), %rax
subq %rax, %fs:-0x10
movb $0x0, 0x3(%rcx)
movl %ebx, 0x4(%rcx)
cmpw $0x6871, (%rcx)         # imm = 0x6871
jne 0x14bd8
movb 0x2(%rcx), %sil
cmpl $0x9, %ebx
jae 0x147eb
xorl %edi, %edi
jmp 0x14bd3
cmpb 0xc1af(%rip), %r12b     # 0x208b9
jle 0x1474d
cmpb 0xc1a7(%rip), %r12b     # 0x208ba
jle 0x147b3
leaq 0x18(%rbx), %rdi
callq 0x4550
testq %rax, %rax
je 0x148a2
leaq 0x1f(%rax), %rcx
andq $-0x10, %rcx
leaq -0x10(%rcx), %rdx
cmpq %rax, %rdx
jb 0x14d6c
movq %rax, -0x10(%rcx)
addq $-0x8, %rcx
jmp 0x149ff
cmpb $0x32, %r12b
jge 0x14d2e
movsbq %r12b, %rdx
movq %rdx, %rcx
shlq $0x4, %rcx
leaq 0xc157(%rip), %rax      # 0x208c0
addq %rcx, %rax
movb $0x1, %cl
xchgb %cl, 0x8(%rax)
testb %cl, %cl
jne 0x1476c
movq (%rax), %rcx
testq %rcx, %rcx
je 0x14802
movq 0x8(%rcx), %rdx
movq %rdx, (%rax)
xorl %edx, %edx
xchgb %dl, 0x8(%rax)
movb $0x0, 0x3(%rcx)
movl %ebx, 0x4(%rcx)
cmpw $0x6871, (%rcx)         # imm = 0x6871
jne 0x14d0f
movb 0x2(%rcx), %sil
cmpl $0x9, %ebx
jae 0x1486a
xorl %edi, %edi
jmp 0x14c36
movq 0x8(%r14), %r15
testq %r15, %r15
sete %al
je 0x148a9
movq %r15, %rdi
movq %rbx, %rsi
callq 0x15214
movq %rax, %rdx
testq %rax, %rax
jne 0x14881
movq 0x10(%r15), %r15
testq %r15, %r15
sete %al
jne 0x147c3
jmp 0x148a9
movl %ebx, %eax
leaq 0x7(%rax), %rdi
cmpl $0x78, %ebx
ja 0x14885
shrl $0x4, %edi
jmp 0x14bd3
xorl %ecx, %ecx
xchgb %cl, 0x8(%rax)
leaq 0xbf1a(%rip), %rax      # 0x20728
movq (%rax,%rdx,8), %r15
movq (%r14), %rdx
testq %rdx, %rdx
sete %sil
je 0x1495a
testb $0xf, %r15b
jne 0x14d4d
xorl %esi, %esi
movq 0x18(%rdx), %rcx
leaq (%r15,%rcx), %rdi
cmpq %rdi, 0x8(%rdx)
jbe 0x1484d
movq %rcx, %rax
lock
cmpxchgq %rdi, 0x18(%rdx)
cmovneq %rax, %rcx
jne 0x14832
jmp 0x1484f
xorl %ecx, %ecx
testq %rcx, %rcx
jne 0x1495a
movq 0x10(%rdx), %rdx
testq %rdx, %rdx
sete %sil
jne 0x1482e
jmp 0x1495a
movl %ebx, %eax
leaq 0x7(%rax), %rdi
cmpl $0x78, %ebx
ja 0x1493d
shrl $0x4, %edi
jmp 0x14c36
xorl %eax, %eax
jmp 0x148a9
movq %rdi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x149bf
orb $0x8, %dl
jmp 0x149e1
xorl %ecx, %ecx
jmp 0x149ff
testb %al, %al
je 0x14911
movl $0x200000, %edi         # imm = 0x200000
callq 0x4550
movq %rax, %r15
addq $0x200000, %rax         # imm = 0x200000
movq %rax, 0x8(%r15)
xorl %ecx, %ecx
movq %rcx, 0x10(%r15)
leaq 0x37(%r15), %rdx
andq $-0x10, %rdx
leaq 0x8(%rdx), %rsi
movq %rsi, (%r15)
movq %rcx, 0x10(%rdx)
movq %rax, 0x8(%rdx)
subq %rsi, %rax
xchgq %rax, 0x18(%r15)
xchgb %cl, 0x20(%r15)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x15214
movq %rax, %rdx
movq 0x8(%r14), %rcx
movq %rcx, 0x10(%r15)
movq %rcx, %rax
lock
cmpxchgq %r15, 0x8(%r14)
cmovneq %rax, %rcx
jne 0x148fe
leaq 0x10(%rdx), %rcx
testq %rdx, %rdx
cmoveq %rdx, %rcx
jmp 0x149ff
movq %r12, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x14a7f
orb $0x10, %al
jmp 0x1464f
movq %rdi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x14aaf
orb $0x8, %dl
jmp 0x14acd
testb $0x1, %sil
je 0x149ff
movl $0x100000, %edi         # imm = 0x100000
callq 0x4550
movq %rax, %rdx
addq $0x100000, %rax         # imm = 0x100000
movq %rax, 0x8(%rdx)
movq $0x0, 0x10(%rdx)
leaq 0x2f(%rdx), %rax
andq $-0x10, %rax
orq $0x8, %rax
movq %rax, (%rdx)
xchgq %rax, 0x18(%rdx)
testb $0xf, %r15b
jne 0x14d4d
movq 0x18(%rdx), %rcx
leaq (%r15,%rcx), %rsi
cmpq %rsi, 0x8(%rdx)
jbe 0x149e8
movq %rcx, %rax
lock
cmpxchgq %rsi, 0x18(%rdx)
cmovneq %rax, %rcx
jne 0x149a4
jmp 0x149ea
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14ad4
orb $0xc, %dl
movl %edx, %edi
jmp 0x14bd3
xorl %ecx, %ecx
movq (%r14), %rsi
movq %rsi, 0x10(%rdx)
movq %rsi, %rax
lock
cmpxchgq %rdx, (%r14)
cmovneq %rax, %rsi
jne 0x149ed
testq %rcx, %rcx
je 0x14cd1
movl %ebx, 0x4(%rcx)
movw $0x6871, (%rcx)         # imm = 0x6871
movb %r12b, 0x2(%rcx)
movb $0x0, 0x3(%rcx)
addq $0x8, %rcx
testb $0xf, %cl
jne 0x14cf0
cmpl $0x9, %ebx
jae 0x14a31
xorl %esi, %esi
jmp 0x14b7d
movl %ebx, %eax
leaq 0x7(%rax), %rsi
cmpl $0x78, %ebx
ja 0x14a44
shrl $0x4, %esi
jmp 0x14b7d
movq %rsi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x14a5a
orb $0x8, %dl
jmp 0x14a78
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14a97
orb $0xc, %dl
movl %edx, %esi
jmp 0x14b7d
movq %r12, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14aec
addb $0x19, %al
jmp 0x1464f
movq %rsi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x14b04
orb $0x10, %al
jmp 0x14b7b
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14b19
orb $0xc, %dl
movl %edx, %edi
jmp 0x14c36
movq %rdi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x14b31
orb $0x10, %al
jmp 0x14bd1
movq %r12, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14b49
addb $0x21, %al
jmp 0x1464f
movq %rsi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14b64
addb $0x19, %al
jmp 0x14b7b
movq %rdi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x14ba5
orb $0x10, %al
jmp 0x14c34
movq %rdi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14bba
addb $0x19, %al
jmp 0x14bd1
shrq $0x9, %r12
addq $-0x8, %r12
cmpq $0x7, %r12
ja 0x14bf7
addb $0x29, %r12b
jmp 0x1467d
movq %rsi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14c0a
addb $0x21, %al
movl %eax, %esi
cmpb %sil, %r12b
je 0x14c43
leaq 0x2c93(%rip), %rdi      # 0x17820
leaq 0x2c9b(%rip), %rsi      # 0x1782f
leaq 0x2ca3(%rip), %rcx      # 0x1783e
movl $0x2c2, %edx            # imm = 0x2C2
callq 0x4210
movq %rdi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14c21
addb $0x19, %al
jmp 0x14c34
movq %rdi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14c52
addb $0x21, %al
movl %eax, %edi
cmpb %dil, %sil
je 0x14c3f
leaq 0x2c41(%rip), %rdi      # 0x17820
leaq 0x2c49(%rip), %rsi      # 0x1782f
leaq 0x2c51(%rip), %rcx      # 0x1783e
movl $0x297, %edx            # imm = 0x297
callq 0x4210
cmpq $0x100001, %rcx         # imm = 0x100001
movb $0x31, %r12b
sbbb $-0x1, %r12b
jmp 0x1467d
shrq $0x9, %rsi
addq $-0x8, %rsi
cmpq $0x7, %rsi
ja 0x14c69
addb $0x29, %sil
jmp 0x14b7d
movq %rdi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14c7b
addb $0x21, %al
movl %eax, %edi
cmpb %dil, %sil
jne 0x14d0f
addq $0x8, %rcx
movq %rcx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
shrq $0x9, %rdi
addq $-0x8, %rdi
cmpq $0x7, %rdi
ja 0x14c8f
addb $0x29, %dil
jmp 0x14bd3
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %sil
sbbb $-0x1, %sil
jmp 0x14b7d
shrq $0x9, %rdi
addq $-0x8, %rdi
cmpq $0x7, %rdi
ja 0x14ca1
addb $0x29, %dil
jmp 0x14c36
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %dil
sbbb $-0x1, %dil
jmp 0x14bd3
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %dil
sbbb $-0x1, %dil
jmp 0x14c36
callq 0x46e1
jmp 0x14695
leaq 0x2bcb(%rip), %rdi      # 0x1788c
leaq 0x2b67(%rip), %rsi      # 0x1782f
leaq 0x2bd6(%rip), %rcx      # 0x178a5
jmp 0x14d43
leaq 0x2b96(%rip), %rdi      # 0x1786e
leaq 0x2b50(%rip), %rsi      # 0x1782f
leaq 0x2b58(%rip), %rcx      # 0x1783e
movl $0x2ba, %edx            # imm = 0x2BA
callq 0x4210
leaq 0x2b7c(%rip), %rdi      # 0x17873
leaq 0x2b31(%rip), %rsi      # 0x1782f
leaq 0x2b39(%rip), %rcx      # 0x1783e
movl $0x2c1, %edx            # imm = 0x2C1
callq 0x4210
leaq 0x2b0a(%rip), %rdi      # 0x17820
leaq 0x2b12(%rip), %rsi      # 0x1782f
leaq 0x2b1a(%rip), %rcx      # 0x1783e
movl $0x2a3, %edx            # imm = 0x2A3
callq 0x4210
leaq 0x2b57(%rip), %rdi      # 0x1788c
leaq 0x2af3(%rip), %rsi      # 0x1782f
leaq 0x2be1(%rip), %rcx      # 0x17924
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x4210
leaq 0x2c55(%rip), %rdi      # 0x179a9
leaq 0x2ad4(%rip), %rsi      # 0x1782f
leaq 0x2c58(%rip), %rcx      # 0x179ba
movl $0x242, %edx            # imm = 0x242
callq 0x4210
leaq 0x2aed(%rip), %rdi      # 0x17860
leaq 0x2ab5(%rip), %rsi      # 0x1782f
leaq 0x2abd(%rip), %rcx      # 0x1783e
movl $0x2b4, %edx            # imm = 0x2B4
callq 0x4210
nop