// File: /workspace/github_cpp_makefile_star2_O1/f18m[P]boost-intrusive-pool/include/boost_intrusive_pool.hpp
// Function: memorypool::boost_intrusive_pool<DummyClass>::impl::allocate_safe_get_recycled_item()
Item* allocate_safe_get_recycled_item()
        {
#if BOOST_INTRUSIVE_POOL_DEBUG_THREAD_ACCESS
            if (m_allowed_thread == 0)
                m_allowed_thread = pthread_self();
            else
                assert(m_allowed_thread == pthread_self());
#endif

            if (m_free_count == 0) {
                assert(m_first_free_item == nullptr);
                size_t enlarge_step = get_effective_enlarge_step();
                if (enlarge_step == 0 || !enlarge(enlarge_step)) {
                    m_memory_exhausted = true;
                    return nullptr; // allocation by enlarge() failed or this is a fixed-size memory pool!
                }
            }

            // get first item from free list
            assert(m_first_free_item != nullptr);
            Item* recycled_item = dynamic_cast<Item*>(m_first_free_item); // downcast (base class -> derived class)
            assert(recycled_item != nullptr); // we always allocate all items of the same type,
                                              // so the dynamic cast cannot fail
            assert(
                recycled_item->_refcounted_item_get_pool().get() == this); // this was set during arena initialization
                                                                           // and must be valid at all times

            // update stats
            m_free_count--;
            m_inuse_count++;

            // update the pointer to the next free item available
            m_first_free_item = m_first_free_item->_refcounted_item_get_next();
            if (m_first_free_item == nullptr && m_enlarge_step > 0) {
                size_t enlarge_step = get_effective_enlarge_step();
                if (enlarge_step == 0) { // enlarge_step can be zero if we reach the max_size
                    m_memory_exhausted = true;
                } else {
                    // this is a memory pool which can be still enlarged:
                    // exit the function leaving the m_first_free_item as a valid pointer to a free item!
                    // this is just to simplify debugging and make more effective the check() function implementation!

                    assert(m_free_count == 0);
                    if (!enlarge(enlarge_step)) {
                        m_memory_exhausted = true;
                        // We tried to fetch memory from the O.S. but we failed. However we succeeded in getting the
                        // last available item. So fallback and provide that last item to the caller.
                    }
                }
            }

            // unlink the item to return
            recycled_item->_refcounted_item_set_next(nullptr);
            return recycled_item;
        }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %r14
callq 0x20d0
testq %r14, %r14
je 0x47d5
cmpq %rax, %r14
je 0x47dc
leaq 0x2505(%rip), %rdi      # 0x6cc2
leaq 0x1edf(%rip), %rsi      # 0x66a3
leaq 0x2718(%rip), %rcx      # 0x6ee3
movl $0x253, %edx            # imm = 0x253
callq 0x2080
movq %rax, 0x80(%rbx)
cmpq $0x0, 0x60(%rbx)
je 0x48ae
movq 0x50(%rbx), %rdi
testq %rdi, %rdi
je 0x4907
leaq 0x6315(%rip), %rsi      # 0xab10
leaq 0x631e(%rip), %rdx      # 0xab20
xorl %ecx, %ecx
callq 0x20f0
testq %rax, %rax
je 0x4926
movq %rax, %r14
movq 0x18(%rax), %rdi
testq %rdi, %rdi
je 0x4821
incl 0x8(%rdi)
cmpq %rbx, %rdi
jne 0x4945
testq %rdi, %rdi
je 0x483a
decl 0x8(%rdi)
jne 0x483a
movq (%rdi), %rax
callq *0x8(%rax)
movq 0x60(%rbx), %rax
decq %rax
movq %rax, 0x60(%rbx)
incq 0x68(%rbx)
movq 0x30(%rbx), %rsi
movq 0x50(%rbx), %rcx
movq 0x10(%rcx), %rcx
movq %rcx, 0x50(%rbx)
testq %rcx, %rcx
setne %cl
testq %rsi, %rsi
sete %dl
orb %cl, %dl
jne 0x48a4
movq 0x38(%rbx), %rcx
testq %rcx, %rcx
je 0x4886
movq 0x70(%rbx), %rdx
movq %rcx, %rdi
subq %rdx, %rdi
addq %rsi, %rdx
cmpq %rcx, %rdx
cmovaq %rdi, %rsi
testq %rsi, %rsi
je 0x48a0
testq %rax, %rax
jne 0x4983
movq %rbx, %rdi
callq 0x3fe4
testb %al, %al
jne 0x48a4
movb $0x1, 0x58(%rbx)
movq $0x0, 0x10(%r14)
jmp 0x48ff
cmpq $0x0, 0x50(%rbx)
jne 0x4964
movq 0x30(%rbx), %rsi
testq %rsi, %rsi
je 0x48e1
movq 0x38(%rbx), %rax
testq %rax, %rax
je 0x48e3
movq 0x70(%rbx), %rcx
movq %rax, %rdx
subq %rcx, %rdx
addq %rsi, %rcx
cmpq %rax, %rcx
cmovaq %rdx, %rsi
jmp 0x48e3
xorl %esi, %esi
testq %rsi, %rsi
je 0x48f8
movq %rbx, %rdi
callq 0x3fe4
testb %al, %al
jne 0x47e7
movb $0x1, 0x58(%rbx)
xorl %r14d, %r14d
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x2662(%rip), %rdi      # 0x6f70
leaq 0x1d8e(%rip), %rsi      # 0x66a3
leaq 0x25c7(%rip), %rcx      # 0x6ee3
movl $0x260, %edx            # imm = 0x260
callq 0x2080
leaq 0x2660(%rip), %rdi      # 0x6f8d
leaq 0x1d6f(%rip), %rsi      # 0x66a3
leaq 0x25a8(%rip), %rcx      # 0x6ee3
movl $0x262, %edx            # imm = 0x262
callq 0x2080
leaq 0x265a(%rip), %rdi      # 0x6fa6
leaq 0x1d50(%rip), %rsi      # 0x66a3
leaq 0x2589(%rip), %rcx      # 0x6ee3
movl $0x265, %edx            # imm = 0x265
callq 0x2080
leaq 0x25e8(%rip), %rdi      # 0x6f53
leaq 0x1d31(%rip), %rsi      # 0x66a3
leaq 0x256a(%rip), %rcx      # 0x6ee3
movl $0x257, %edx            # imm = 0x257
callq 0x2080
leaq 0x2655(%rip), %rdi      # 0x6fdf
leaq 0x1d12(%rip), %rsi      # 0x66a3
leaq 0x254b(%rip), %rcx      # 0x6ee3
movl $0x277, %edx            # imm = 0x277
callq 0x2080