// File: /workspace/github_cpp_makefile_star2_O2/HQarroum[P]thread-pool/examples/many-producers-many-consumers/./../../includes/concurrent_queue.hpp
// Function: bool moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::ImplicitProducer::enqueue_bulk<(moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::AllocationMode)0, std::function<void ()> const*>(std::function<void ()> const*, unsigned long)
bool enqueue_bulk(It itemFirst, size_t count)
		{
			// First, we need to make sure we have enough room to enqueue all of the elements;
			// this means pre-allocating blocks and putting them in the block index (but only if
			// all the allocations succeeded).
			
			// Note that the tailBlock we start off with may not be owned by us any more;
			// this happens if it was filled up exactly to the top (setting tailIndex to
			// the first index of the next block which is not yet allocated), then dequeued
			// completely (putting it on the free list) before we enqueue again.
			
			index_t startTailIndex = this->tailIndex.load(std::memory_order_relaxed);
			auto startBlock = this->tailBlock;
			Block* firstAllocatedBlock = nullptr;
			auto endBlock = this->tailBlock;
			
			// Figure out how many blocks we'll need to allocate, and do so
			size_t blockBaseDiff = ((startTailIndex + count - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1)) - ((startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1));
			index_t currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
			if (blockBaseDiff > 0) {
#ifdef MCDBGQ_NOLOCKFREE_IMPLICITPRODBLOCKINDEX
				debug::DebugLock lock(mutex);
#endif
				do {
					blockBaseDiff -= static_cast<index_t>(BLOCK_SIZE);
					currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
					
					// Find out where we'll be inserting this block in the block index
					BlockIndexEntry* idxEntry = nullptr;  // initialization here unnecessary but compiler can't always tell
					Block* newBlock;
					bool indexInserted = false;
					auto head = this->headIndex.load(std::memory_order_relaxed);
					assert(!details::circular_less_than<index_t>(currentTailIndex, head));
					bool full = !details::circular_less_than<index_t>(head, currentTailIndex + BLOCK_SIZE) || (MAX_SUBQUEUE_SIZE != details::const_numeric_max<size_t>::value && (MAX_SUBQUEUE_SIZE == 0 || MAX_SUBQUEUE_SIZE - BLOCK_SIZE < currentTailIndex - head));

					if (full || !(indexInserted = insert_block_index_entry<allocMode>(idxEntry, currentTailIndex)) || (newBlock = this->parent->ConcurrentQueue::template requisition_block<allocMode>()) == nullptr) {
						// Index allocation or block allocation failed; revert any other allocations
						// and index insertions done so far for this operation
						if (indexInserted) {
							rewind_block_index_tail();
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
						}
						currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
						for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) {
							currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
							idxEntry = get_block_index_entry_for_index(currentTailIndex);
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
							rewind_block_index_tail();
						}
						this->parent->add_blocks_to_free_list(firstAllocatedBlock);
						this->tailBlock = startBlock;
						
						return false;
					}
					
#ifdef MCDBGQ_TRACKMEM
					newBlock->owner = this;
#endif
					newBlock->ConcurrentQueue::Block::template reset_empty<implicit_context>();
					newBlock->next = nullptr;
					
					// Insert the new block into the index
					idxEntry->value.store(newBlock, std::memory_order_relaxed);
					
					// Store the chain of blocks so that we can undo if later allocations fail,
					// and so that we can find the blocks when we do the actual enqueueing
					if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr) {
						assert(this->tailBlock != nullptr);
						this->tailBlock->next = newBlock;
					}
					this->tailBlock = newBlock;
					endBlock = newBlock;
					firstAllocatedBlock = firstAllocatedBlock == nullptr ? newBlock : firstAllocatedBlock;
				} while (blockBaseDiff > 0);
			}
			
			// Enqueue, one block at a time
			index_t newTailIndex = startTailIndex + static_cast<index_t>(count);
			currentTailIndex = startTailIndex;
			this->tailBlock = startBlock;
			assert((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) != 0 || firstAllocatedBlock != nullptr || count == 0);
			if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) == 0 && firstAllocatedBlock != nullptr) {
				this->tailBlock = firstAllocatedBlock;
			}
			while (true) {
				index_t stopIndex = (currentTailIndex & ~static_cast<index_t>(BLOCK_SIZE - 1)) + static_cast<index_t>(BLOCK_SIZE);
				if (details::circular_less_than<index_t>(newTailIndex, stopIndex)) {
					stopIndex = newTailIndex;
				}
				MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
					while (currentTailIndex != stopIndex) {
						new ((*this->tailBlock)[currentTailIndex++]) T(*itemFirst++);
					}
				}
				else {
					MOODYCAMEL_TRY {
						while (currentTailIndex != stopIndex) {
							new ((*this->tailBlock)[currentTailIndex]) T(details::nomove_if<!MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))>::eval(*itemFirst));
							++currentTailIndex;
							++itemFirst;
						}
					}
					MOODYCAMEL_CATCH (...) {
						auto constructedStopIndex = currentTailIndex;
						auto lastBlockEnqueued = this->tailBlock;
						
						if (!details::is_trivially_destructible<T>::value) {
							auto block = startBlock;
							if ((startTailIndex & static_cast<index_t>(BLOCK_SIZE - 1)) == 0) {
								block = firstAllocatedBlock;
							}
							currentTailIndex = startTailIndex;
							while (true) {
								stopIndex = (currentTailIndex & ~static_cast<index_t>(BLOCK_SIZE - 1)) + static_cast<index_t>(BLOCK_SIZE);
								if (details::circular_less_than<index_t>(constructedStopIndex, stopIndex)) {
									stopIndex = constructedStopIndex;
								}
								while (currentTailIndex != stopIndex) {
									(*block)[currentTailIndex++]->~T();
								}
								if (block == lastBlockEnqueued) {
									break;
								}
								block = block->next;
							}
						}
						
						currentTailIndex = (startTailIndex - 1) & ~static_cast<index_t>(BLOCK_SIZE - 1);
						for (auto block = firstAllocatedBlock; block != nullptr; block = block->next) {
							currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
							auto idxEntry = get_block_index_entry_for_index(currentTailIndex);
							idxEntry->value.store(nullptr, std::memory_order_relaxed);
							rewind_block_index_tail();
						}
						this->parent->add_blocks_to_free_list(firstAllocatedBlock);
						this->tailBlock = startBlock;
						MOODYCAMEL_RETHROW;
					}
				}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r13
movq %rdi, %rbx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x20(%rdi), %rbp
movq 0x40(%rdi), %rax
leaq (%rdx,%rbp), %r14
decq %r14
andq $-0x20, %r14
leaq -0x1(%rbp), %rcx
andq $-0x20, %rcx
cmpq %rcx, %r14
movq %rax, 0x18(%rsp)
movq %rcx, 0x30(%rsp)
je 0x6c5a
movq %rdx, 0x8(%rsp)
movl %ebp, %eax
andl $0x1f, %eax
movq %rax, 0x10(%rsp)
movq %rsi, %r12
subq %rcx, %r12
addq $-0x41, %r12
leaq 0x20(%rcx), %r15
negq %r14
movq $0x0, (%rsp)
leaq -0x1(%rsi), %rax
movq %rax, 0x20(%rsp)
andq $0x0, 0x28(%rsp)
movq 0x28(%rbx), %rax
movq %r15, %rcx
subq %rax, %rcx
movabsq $-0x8000000000000000, %rdx # imm = 0x8000000000000000
cmpq %rdx, %rcx
ja 0x6d52
addq %r12, %rax
cmpq 0x20(%rsp), %rax
jae 0x6ce1
movq %rbx, %rdi
leaq 0x28(%rsp), %rsi
movq %r15, %rdx
callq 0x553a
testb %al, %al
je 0x6ce1
movq 0x50(%rbx), %rdi
callq 0x55e2
testq %rax, %rax
je 0x6cbc
movq %rax, %rcx
movq $0x0, 0x408(%rax)
andq $0x0, 0x400(%rax)
movq 0x28(%rsp), %rax
movq %rcx, 0x8(%rax)
cmpq $0x0, 0x10(%rsp)
jne 0x6bfe
cmpq $0x0, (%rsp)
je 0x6c12
movq 0x40(%rbx), %rax
testq %rax, %rax
je 0x6d71
movq %rcx, 0x400(%rax)
movq %rcx, 0x40(%rbx)
movq (%rsp), %rax
testq %rax, %rax
cmoveq %rcx, %rax
movq %rax, (%rsp)
addq $-0x20, %r12
leaq (%r14,%r15), %rax
addq $0x20, %rax
addq $0x20, %r15
cmpq $0x20, %rax
jne 0x6b75
movq %rcx, 0x20(%rsp)
movq 0x18(%rsp), %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x8(%rsp), %rdx
jmp 0x6c71
movl %ebp, %edi
andl $0x1f, %edi
movq %rdi, 0x10(%rsp)
movq $0x0, (%rsp)
movq %rax, 0x20(%rsp)
movq %rax, 0x40(%rbx)
testq %rdx, %rdx
je 0x6c8d
cmpq $0x0, 0x10(%rsp)
jne 0x6c8d
cmpq $0x0, (%rsp)
je 0x6d90
addq %rbp, %rdx
cmpq $0x0, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
jne 0x6d4d
movq (%rsp), %rcx
movq %rcx, %rax
movq %rbp, %r14
movq %rbp, %r15
testq %rcx, %rcx
jne 0x6daf
jmp 0x6db6
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rcx
decq %rcx
movq (%rax), %rdx
decq %rdx
andq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq 0x28(%rsp), %rax
movq $0x0, 0x8(%rax)
movq 0x30(%rsp), %r15
addq $0x20, %r15
movq (%rsp), %r14
testq %r14, %r14
je 0x6d30
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5486
movq %rax, 0x28(%rsp)
movq $0x0, 0x8(%rax)
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rcx
decq %rcx
movq (%rax), %rdx
decq %rdx
andq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq 0x400(%r14), %r14
addq $0x20, %r15
jmp 0x6cee
movq 0x50(%rbx), %rdi
movq (%rsp), %rsi
callq 0x6f52
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rbx)
xorl %eax, %eax
jmp 0x6e2d
movq %rbp, %r15
jmp 0x6db6
leaq 0x88a(%rip), %rdi       # 0x75e3
leaq 0x337(%rip), %rsi       # 0x7097
leaq 0x12df(%rip), %rcx      # 0x8046
movl $0xa53, %edx            # imm = 0xA53
callq 0x3180
leaq 0x13f3(%rip), %rdi      # 0x816b
leaq 0x318(%rip), %rsi       # 0x7097
leaq 0x12c0(%rip), %rcx      # 0x8046
movl $0xa76, %edx            # imm = 0xA76
callq 0x3180
leaq 0x13ef(%rip), %rdi      # 0x8186
leaq 0x2f9(%rip), %rsi       # 0x7097
leaq 0x12a1(%rip), %rcx      # 0x8046
movl $0xa83, %edx            # imm = 0xA83
callq 0x3180
movq %rax, 0x40(%rbx)
movq %r14, %r15
movq %r15, %r14
andq $-0x20, %r14
addq $0x20, %r14
movq %rdx, %rax
subq %r14, %rax
cmpq %rsi, %rax
cmovaq %rdx, %r14
pushq $0x20
popq %r12
subq %r15, %r12
movq 0x40(%rbx), %rdi
cmpq %r15, %r14
je 0x6dfe
movl %r15d, %eax
andl $0x1f, %eax
shll $0x5, %eax
addq %rax, %rdi
movq %r13, %rsi
callq 0x6f7e
incq %r15
addq $0x20, %r13
decq %r12
jmp 0x6dd5
cmpq 0x20(%rsp), %rdi
je 0x6e1d
movq 0x400(%rdi), %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x8(%rsp), %rdx
jmp 0x6daf
movq 0x8(%rsp), %rax
cmpq %rax, %r14
jne 0x6e3c
movq %rax, 0x20(%rbx)
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x13b0(%rip), %rdi      # 0x81f3
leaq 0x24d(%rip), %rsi       # 0x7097
leaq 0x11f5(%rip), %rcx      # 0x8046
movl $0xac0, %edx            # imm = 0xAC0
callq 0x3180
movq %rax, %rdi
callq 0x30e0
cmpq $0x0, 0x10(%rsp)
movq %rbx, %r14
movq 0x40(%rbx), %rax
movq %rax, 0x8(%rsp)
movq 0x18(%rsp), %r13
cmoveq (%rsp), %r13
negq %r12
movq %rbp, %rdi
andq $-0x20, %rbp
movq %r12, %rax
subq %rbp, %rax
addq $0x20, %rbp
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
cmpq %rcx, %rax
cmovaq %r15, %rbp
cmpq %rdi, %rbp
je 0x6ec0
leaq 0x1(%rdi), %rbx
andl $0x1f, %edi
shll $0x5, %edi
addq %r13, %rdi
callq 0x4158
movq %rbx, %rdi
jmp 0x6ea4
cmpq 0x8(%rsp), %r13
je 0x6ed0
movq 0x400(%r13), %r13
jmp 0x6e82
movq %r14, %rbx
movq 0x30(%rsp), %r15
addq $0x20, %r15
movq (%rsp), %r14
testq %r14, %r14
je 0x6f1d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5486
movq $0x0, 0x8(%rax)
movq 0x60(%rbx), %rax
movq 0x8(%rax), %rcx
decq %rcx
movq (%rax), %rdx
decq %rdx
andq %rcx, %rdx
movq %rdx, 0x8(%rax)
movq 0x400(%r14), %r14
addq $0x20, %r15
jmp 0x6ee0
movq 0x50(%rbx), %rdi
movq (%rsp), %rsi
callq 0x6f52
movq 0x18(%rsp), %rax
movq %rax, 0x40(%rbx)
callq 0x32f0
jmp 0x6f3a
movq %rax, %rbx
callq 0x3330
movq %rbx, %rdi
callq 0x3380
movq %rax, %rdi
callq 0x3a5f