// File: /workspace/github_cpp_makefile_star2_O3/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 %rbx
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x8(%rsi), %rcx
cmpq $0x11, %rcx
jae 0x14566
xorl %r15d, %r15d
jmp 0x145ba
leaq 0x7(%rbx), %r15
cmpq $0x80, %rcx
ja 0x14579
shrl $0x4, %r15d
jmp 0x145ba
movq %r15, %rax
shrq $0x5, %rax
addq $-0x4, %rax
cmpq $0x3, %rax
ja 0x14591
orb $0x8, %al
movl %eax, %r15d
jmp 0x145ba
leaq 0x27(%rbx), %rax
movabsq $-0x5555555555555555, %rdx # imm = 0xAAAAAAAAAAAAAAAB
mulq %rdx
shrq $0x5, %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x147c3
orb $0xc, %dl
movl %edx, %r15d
cmpb 0xc2f7(%rip), %r15b     # 0x208b8
jg 0x14642
cmpb $0x0, %fs:-0x8
je 0x14a62
cmpb $0x32, %r15b
jae 0x14a6c
movq %fs:0x0, %rax
leaq -0x1a0(%rax), %rcx
movzbl %r15b, %eax
movq (%rcx,%rax,8), %rcx
testq %rcx, %rcx
je 0x14642
movq 0x8(%rcx), %rdx
shll $0x3, %eax
movq %rdx, %fs:-0x1a0(%rax)
leaq 0xc119(%rip), %rdx      # 0x20728
movq (%rax,%rdx), %rax
subq %rax, %fs:-0x10
movb $0x0, 0x3(%rcx)
movl %ebx, 0x4(%rcx)
cmpw $0x6871, (%rcx)         # imm = 0x6871
jne 0x14990
movb 0x2(%rcx), %sil
cmpl $0x9, %ebx
jae 0x1470d
xorl %edi, %edi
jmp 0x1498b
cmpb 0xc270(%rip), %r15b     # 0x208b9
jle 0x1468c
cmpb 0xc268(%rip), %r15b     # 0x208ba
jle 0x146ec
leaq 0x18(%rbx), %rdi
callq 0x4550
testq %rax, %rax
je 0x14a83
leaq 0x1f(%rax), %rcx
andq $-0x10, %rcx
leaq -0x10(%rcx), %rdx
cmpq %rax, %rdx
jb 0x14aff
movq %rax, -0x10(%rcx)
addq $-0x8, %rcx
jmp 0x14748
cmpb $0x32, %r15b
jae 0x14ae0
movzbl %r15b, %eax
movl %eax, %ecx
shll $0x4, %ecx
leaq 0xc21a(%rip), %rdx      # 0x208c0
addq %rcx, %rdx
movb $0x1, %cl
xchgb %cl, 0x8(%rdx)
testb %cl, %cl
jne 0x146a9
movq (%rdx), %rcx
testq %rcx, %rcx
je 0x14724
movq 0x8(%rcx), %rax
movq %rax, (%rdx)
xorl %eax, %eax
xchgb %al, 0x8(%rdx)
movb $0x0, 0x3(%rcx)
movl %ebx, 0x4(%rcx)
cmpw $0x6871, (%rcx)         # imm = 0x6871
jne 0x14ac1
movb 0x2(%rcx), %sil
cmpl $0x9, %ebx
jae 0x1479a
xorl %edi, %edi
jmp 0x149ee
addq $0x8, %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x150d0
testq %rax, %rax
je 0x14a83
movq %rax, %rcx
addq $0x10, %rcx
jmp 0x14748
movl %ebx, %eax
leaq 0x7(%rax), %rdi
cmpl $0x78, %ebx
ja 0x147ad
shrl $0x4, %edi
jmp 0x1498b
xorl %ecx, %ecx
xchgb %cl, 0x8(%rdx)
leaq 0xbff8(%rip), %rcx      # 0x20728
movq (%rcx,%rax,8), %rsi
movq %r14, %rdi
callq 0x14fd4
movq %rax, %rcx
testq %rax, %rax
je 0x14a83
movl %ebx, 0x4(%rcx)
movw $0x6871, (%rcx)         # imm = 0x6871
movb %r15b, 0x2(%rcx)
movb $0x0, 0x3(%rcx)
addq $0x8, %rcx
testb $0xf, %cl
jne 0x14aa2
cmpl $0x9, %ebx
jae 0x14771
xorl %esi, %esi
jmp 0x14939
movl %ebx, %eax
leaq 0x7(%rax), %rsi
cmpl $0x78, %ebx
ja 0x14784
shrl $0x4, %esi
jmp 0x14939
movq %rsi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x147db
orb $0x8, %dl
jmp 0x147f9
movl %ebx, %eax
leaq 0x7(%rax), %rdi
cmpl $0x78, %ebx
ja 0x14800
shrl $0x4, %edi
jmp 0x149ee
movq %rdi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x14816
orb $0x8, %dl
jmp 0x14834
movq %r15, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x1483b
orb $0x10, %al
jmp 0x1458c
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14853
orb $0xc, %dl
movl %edx, %esi
jmp 0x14939
movq %rdi, %rdx
shrq $0x5, %rdx
addq $-0x4, %rdx
cmpq $0x3, %rdx
ja 0x1486b
orb $0x8, %dl
jmp 0x14889
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x14890
orb $0xc, %dl
movl %edx, %edi
jmp 0x1498b
movq %r15, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x148a8
addb $0x19, %al
jmp 0x1458c
movq %rsi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x148c0
orb $0x10, %al
jmp 0x14937
addq $0x27, %rax
movabsq $0x555555555555556, %rdx # imm = 0x555555555555556
mulq %rdx
addq $-0x6, %rdx
cmpq $0x3, %rdx
ja 0x148d5
orb $0xc, %dl
movl %edx, %edi
jmp 0x149ee
movq %rdi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x148ed
orb $0x10, %al
jmp 0x14989
movq %r15, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14905
addb $0x21, %al
jmp 0x1458c
movq %rsi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14920
addb $0x19, %al
jmp 0x14937
movq %rdi, %rax
shrq $0x6, %rax
addq $-0x7, %rax
cmpq $0x8, %rax
ja 0x14961
orb $0x10, %al
jmp 0x149ec
movq %rdi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14976
addb $0x19, %al
jmp 0x14989
shrq $0x9, %r15
addq $-0x8, %r15
cmpq $0x7, %r15
ja 0x149af
addb $0x29, %r15b
jmp 0x145ba
movq %rsi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x149c2
addb $0x21, %al
movl %eax, %esi
cmpb %sil, %r15b
je 0x149fb
leaq 0x2ed7(%rip), %rdi      # 0x17820
leaq 0x2edf(%rip), %rsi      # 0x1782f
leaq 0x2ee7(%rip), %rcx      # 0x1783e
movl $0x2c2, %edx            # imm = 0x2C2
callq 0x4210
movq %rdi, %rax
shrq $0x7, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x149d9
addb $0x19, %al
jmp 0x149ec
movq %rdi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14a04
addb $0x21, %al
movl %eax, %edi
cmpb %dil, %sil
je 0x149f7
leaq 0x2e89(%rip), %rdi      # 0x17820
leaq 0x2e91(%rip), %rsi      # 0x1782f
leaq 0x2e99(%rip), %rcx      # 0x1783e
movl $0x297, %edx            # imm = 0x297
callq 0x4210
cmpq $0x100001, %rcx         # imm = 0x100001
movb $0x31, %r15b
sbbb $-0x1, %r15b
jmp 0x145ba
shrq $0x9, %rsi
addq $-0x8, %rsi
cmpq $0x7, %rsi
ja 0x14a1b
addb $0x29, %sil
jmp 0x14939
movq %rdi, %rax
shrq $0x8, %rax
addq $-0x8, %rax
cmpq $0x7, %rax
ja 0x14a2d
addb $0x21, %al
movl %eax, %edi
cmpb %dil, %sil
jne 0x14ac1
addq $0x8, %rcx
movq %rcx, %rax
popq %rbx
popq %r14
popq %r15
retq
shrq $0x9, %rdi
addq $-0x8, %rdi
cmpq $0x7, %rdi
ja 0x14a41
addb $0x29, %dil
jmp 0x1498b
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %sil
sbbb $-0x1, %sil
jmp 0x14939
shrq $0x9, %rdi
addq $-0x8, %rdi
cmpq $0x7, %rdi
ja 0x14a53
addb $0x29, %dil
jmp 0x149ee
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %dil
sbbb $-0x1, %dil
jmp 0x1498b
cmpl $0xffff9, %ebx          # imm = 0xFFFF9
movb $0x31, %dil
sbbb $-0x1, %dil
jmp 0x149ee
callq 0x46df
jmp 0x145d2
leaq 0x2e19(%rip), %rdi      # 0x1788c
leaq 0x2db5(%rip), %rsi      # 0x1782f
leaq 0x2e24(%rip), %rcx      # 0x178a5
jmp 0x14af5
leaq 0x2de4(%rip), %rdi      # 0x1786e
leaq 0x2d9e(%rip), %rsi      # 0x1782f
leaq 0x2da6(%rip), %rcx      # 0x1783e
movl $0x2ba, %edx            # imm = 0x2BA
callq 0x4210
leaq 0x2dca(%rip), %rdi      # 0x17873
leaq 0x2d7f(%rip), %rsi      # 0x1782f
leaq 0x2d87(%rip), %rcx      # 0x1783e
movl $0x2c1, %edx            # imm = 0x2C1
callq 0x4210
leaq 0x2d58(%rip), %rdi      # 0x17820
leaq 0x2d60(%rip), %rsi      # 0x1782f
leaq 0x2d68(%rip), %rcx      # 0x1783e
movl $0x2a3, %edx            # imm = 0x2A3
callq 0x4210
leaq 0x2da5(%rip), %rdi      # 0x1788c
leaq 0x2d41(%rip), %rsi      # 0x1782f
leaq 0x2e2f(%rip), %rcx      # 0x17924
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x4210
leaq 0x2d5a(%rip), %rdi      # 0x17860
leaq 0x2d22(%rip), %rsi      # 0x1782f
leaq 0x2d2a(%rip), %rcx      # 0x1783e
movl $0x2b4, %edx            # imm = 0x2B4
callq 0x4210