// File: /workspace/github_cpp_makefile_star2_O3/HQarroum[P]thread-pool/examples/working-with-tokens/./../../includes/concurrent_queue.hpp
// Function: bool moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::ExplicitProducer::enqueue_bulk<(moodycamel::ConcurrentQueue<std::function<void ()>, moodycamel::ConcurrentQueueDefaultTraits>::AllocationMode)0, std::function<void ()> const*>(std::function<void ()> const*, unsigned long)
bool MOODYCAMEL_NO_TSAN 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).
			index_t startTailIndex = this->tailIndex.load(std::memory_order_relaxed);
			auto startBlock = this->tailBlock;
			auto originalBlockIndexFront = pr_blockIndexFront;
			auto originalBlockIndexSlotsUsed = pr_blockIndexSlotsUsed;
			
			Block* firstAllocatedBlock = nullptr;
			
			// 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) {
				// Allocate as many blocks as possible from ahead
				while (blockBaseDiff > 0 && this->tailBlock != nullptr && this->tailBlock->next != firstAllocatedBlock && this->tailBlock->next->ConcurrentQueue::Block::template is_empty<explicit_context>()) {
					blockBaseDiff -= static_cast<index_t>(BLOCK_SIZE);
					currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
					
					this->tailBlock = this->tailBlock->next;
					firstAllocatedBlock = firstAllocatedBlock == nullptr ? this->tailBlock : firstAllocatedBlock;
					
					auto& entry = blockIndex.load(std::memory_order_relaxed)->entries[pr_blockIndexFront];
					entry.base = currentTailIndex;
					entry.block = this->tailBlock;
					pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1);
				}
				
				// Now allocate as many blocks as necessary from the block pool
				while (blockBaseDiff > 0) {
					blockBaseDiff -= static_cast<index_t>(BLOCK_SIZE);
					currentTailIndex += static_cast<index_t>(BLOCK_SIZE);
					
					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 (pr_blockIndexRaw == nullptr || pr_blockIndexSlotsUsed == pr_blockIndexSize || full) {
						MOODYCAMEL_CONSTEXPR_IF (allocMode == CannotAlloc) {
							// Failed to allocate, undo changes (but keep injected blocks)
							pr_blockIndexFront = originalBlockIndexFront;
							pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed;
							this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock;
							return false;
						}
						else if (full || !new_block_index(originalBlockIndexSlotsUsed)) {
							// Failed to allocate, undo changes (but keep injected blocks)
							pr_blockIndexFront = originalBlockIndexFront;
							pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed;
							this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock;
							return false;
						}
						
						// pr_blockIndexFront is updated inside new_block_index, so we need to
						// update our fallback value too (since we keep the new index even if we
						// later fail)
						originalBlockIndexFront = originalBlockIndexSlotsUsed;
					}
					
					// Insert a new block in the circular linked list
					auto newBlock = this->parent->ConcurrentQueue::template requisition_block<allocMode>();
					if (newBlock == nullptr) {
						pr_blockIndexFront = originalBlockIndexFront;
						pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed;
						this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock;
						return false;
					}
					
#ifdef MCDBGQ_TRACKMEM
					newBlock->owner = this;
#endif
					newBlock->ConcurrentQueue::Block::template set_all_empty<explicit_context>();
					if (this->tailBlock == nullptr) {
						newBlock->next = newBlock;
					}
					else {
						newBlock->next = this->tailBlock->next;
						this->tailBlock->next = newBlock;
					}
					this->tailBlock = newBlock;
					firstAllocatedBlock = firstAllocatedBlock == nullptr ? this->tailBlock : firstAllocatedBlock;
					
					++pr_blockIndexSlotsUsed;
					
					auto& entry = blockIndex.load(std::memory_order_relaxed)->entries[pr_blockIndexFront];
					entry.base = currentTailIndex;
					entry.block = this->tailBlock;
					pr_blockIndexFront = (pr_blockIndexFront + 1) & (pr_blockIndexSize - 1);
				}
				
				// Excellent, all allocations succeeded. Reset each block's emptiness before we fill them up, and
				// publish the new block index front
				auto block = firstAllocatedBlock;
				while (true) {
					block->ConcurrentQueue::Block::template reset_empty<explicit_context>();
					if (block == this->tailBlock) {
						break;
					}
					block = block->next;
				}
				
				MOODYCAMEL_CONSTEXPR_IF (MOODYCAMEL_NOEXCEPT_CTOR(T, decltype(*itemFirst), new (static_cast<T*>(nullptr)) T(details::deref_noexcept(itemFirst)))) {
					blockIndex.load(std::memory_order_relaxed)->front.store((pr_blockIndexFront - 1) & (pr_blockIndexSize - 1), std::memory_order_release);
				}
			}
			
			// Enqueue, one block at a time
			index_t newTailIndex = startTailIndex + static_cast<index_t>(count);
			currentTailIndex = startTailIndex;
			auto endBlock = this->tailBlock;
			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) {
							// Must use copy constructor even if move constructor is available
							// because we may have to revert if there's an exception.
							// Sorry about the horrible templated next line, but it was the only way
							// to disable moving *at compile time*, which is important because a type
							// may only define a (noexcept) move constructor, and so calls to the
							// cctor will not compile, even if they are in an if branch that will never
							// be executed
							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 (...) {
						// Oh dear, an exception's been thrown -- destroy the elements that
						// were enqueued so far and revert the entire bulk operation (we'll keep
						// any allocated blocks in our linked list for later, though).
						auto constructedStopIndex = currentTailIndex;
						auto lastBlockEnqueued = this->tailBlock;
						
						pr_blockIndexFront = originalBlockIndexFront;
						pr_blockIndexSlotsUsed = originalBlockIndexSlotsUsed;
						this->tailBlock = startBlock == nullptr ? firstAllocatedBlock : startBlock;
						
						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;
							}
						}
						MOODYCAMEL_RETHROW;
					}
				}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r12
movq %rdi, %r8
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x20(%rdi), %rbp
movq 0x40(%rdi), %r9
movq 0x60(%rdi), %rax
movq %rax, 0x20(%rsp)
movq 0x70(%rdi), %r15
leaq (%rdx,%rbp), %r14
decq %r14
andq $-0x20, %r14
leaq -0x1(%rbp), %rax
andq $-0x20, %rax
subq %rax, %r14
movq %r9, 0x18(%rsp)
movq %rdi, 0x10(%rsp)
je 0x4996
xorl %r10d, %r10d
movq %r15, %rcx
movq %rdx, 0x28(%rsp)
testq %r9, %r9
je 0x4833
movq 0x400(%r9), %r9
cmpq %r10, %r9
je 0x4833
movb 0x410(%r9), %sil
testb $0x1, %sil
je 0x4833
movl $0x411, %esi            # imm = 0x411
cmpq $0x430, %rsi            # imm = 0x430
je 0x47da
movb (%r9,%rsi), %dil
incq %rsi
testb $0x1, %dil
jne 0x47b5
addq $-0x412, %rsi           # imm = 0xFBEE
cmpq $0x1f, %rsi
jae 0x47e9
jmp 0x4833
movq 0x40(%r8), %rsi
movq 0x70(%r8), %rcx
movq 0x400(%rsi), %r9
addq $0x20, %rax
movq %r9, 0x40(%r8)
testq %r10, %r10
cmoveq %r9, %r10
movq 0x58(%r8), %rsi
movq 0x10(%rsi), %rsi
movq %rcx, %rdi
shlq $0x4, %rdi
movq %rax, (%rsi,%rdi)
movq %r9, 0x8(%rsi,%rdi)
incq %rcx
movq 0x68(%r8), %rsi
decq %rsi
andq %rsi, %rcx
movq %rcx, 0x70(%r8)
addq $-0x20, %r14
jne 0x4786
movq %r10, %rdi
jmp 0x495b
movq %r15, %r13
leaq 0x20(%rax), %rbx
movq 0x28(%r8), %rcx
movq %rbx, %rdx
subq %rcx, %rdx
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
cmpq %rsi, %rdx
ja 0x4a40
movq %r10, 0x8(%rsp)
subq %rax, %rcx
addq $-0x40, %rcx
leaq 0x1(%rsi), %rax
cmpq $0x0, 0x80(%r8)
je 0x4885
cmpq %rax, %rcx
jb 0x4885
movq 0x68(%r8), %rdx
cmpq %rdx, 0x60(%r8)
je 0x4885
movq %r13, %r15
jmp 0x48ab
cmpq %rax, %rcx
jb 0x49e6
movq %r8, %rdi
movq 0x20(%rsp), %r15
movq %r15, %rsi
callq 0x3f86
movq 0x10(%rsp), %r8
testb %al, %al
je 0x49e6
movq 0x50(%r8), %rdi
callq 0x4c1a
testq %rax, %rax
je 0x4a12
addq $-0x20, %r14
movl $0x410, %ecx            # imm = 0x410
movq 0x8(%rsp), %rsi
movb $0x1, (%rax,%rcx)
incq %rcx
cmpq $0x430, %rcx            # imm = 0x430
jne 0x48cb
movq 0x10(%rsp), %r8
movq 0x40(%r8), %rcx
testq %rcx, %rcx
je 0x4900
movq 0x400(%rcx), %rdx
addq $0x400, %rcx            # imm = 0x400
movq %rdx, 0x400(%rax)
jmp 0x4907
leaq 0x400(%rax), %rcx
movq %rax, (%rcx)
testq %rsi, %rsi
movq %rax, %rdi
cmovneq %rsi, %rdi
movq %rax, 0x40(%r8)
incq 0x60(%r8)
movq 0x58(%r8), %rcx
movq 0x10(%rcx), %rcx
movq 0x70(%r8), %rdx
movq %rdx, %rsi
shlq $0x4, %rsi
movq %rbx, (%rcx,%rsi)
movq %rax, 0x8(%rcx,%rsi)
incq %rdx
movq 0x68(%r8), %rax
decq %rax
andq %rdx, %rax
movq %rax, 0x70(%r8)
movq %r15, %r13
movq %rdi, %r10
movq %rbx, %rax
testq %r14, %r14
jne 0x4836
movq %rdi, %r14
movq 0x18(%rsp), %r9
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x28(%rsp), %rdx
movl $0x410, %eax            # imm = 0x410
movb $0x0, (%r14,%rax)
incq %rax
cmpq $0x430, %rax            # imm = 0x430
jne 0x4977
cmpq 0x40(%r8), %r14
je 0x499b
movq 0x400(%r14), %r14
jmp 0x4972
xorl %edi, %edi
movq %r9, %r14
movq %r9, 0x40(%r8)
testq %rdx, %rdx
je 0x49b4
movl %ebp, %eax
andl $0x1f, %eax
jne 0x49b4
testq %rdi, %rdi
je 0x4a5f
movq %r15, 0x30(%rsp)
addq %rbp, %rdx
testb $0x1f, %bpl
movq %rdx, 0x28(%rsp)
movq %rdi, 0x8(%rsp)
jne 0x4a0a
movq %rdi, %rcx
movq %r9, %rax
movq %rbp, %r13
movq %rbp, %r15
testq %rdi, %rdi
jne 0x4a7e
jmp 0x4a88
movq %r13, 0x70(%r8)
movq 0x20(%rsp), %rax
movq %rax, 0x60(%r8)
movq 0x18(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %rcx
cmovneq %rax, %rcx
movq %rcx, 0x40(%r8)
jmp 0x4a39
movq %r9, %rax
movq %rbp, %r15
jmp 0x4a88
movq 0x10(%rsp), %rcx
movq %r15, 0x70(%rcx)
movq 0x20(%rsp), %rax
movq %rax, 0x60(%rcx)
movq 0x18(%rsp), %rax
testq %rax, %rax
movq 0x8(%rsp), %rdx
cmovneq %rax, %rdx
movq %rdx, 0x40(%rcx)
xorl %eax, %eax
jmp 0x4b28
leaq 0x107b(%rip), %rdi      # 0x5ac2
leaq 0x6c5(%rip), %rsi       # 0x5113
leaq 0x10ab(%rip), %rcx      # 0x5b00
movl $0x81c, %edx            # imm = 0x81C
callq 0x2100
leaq 0x11bf(%rip), %rdi      # 0x5c25
leaq 0x6a6(%rip), %rsi       # 0x5113
leaq 0x108c(%rip), %rcx      # 0x5b00
movl $0x868, %edx            # imm = 0x868
callq 0x2100
movq %rcx, 0x40(%r8)
movq %rcx, %rax
movq %r13, %r15
movq %r15, %r13
andq $-0x20, %r13
addq $0x20, %r13
movq %rdx, %rcx
subq %r13, %rcx
cmpq %rsi, %rcx
cmovaq %rdx, %r13
cmpq %r13, %r15
jne 0x4aaa
movq %r15, %r13
jmp 0x4aee
movl $0x20, %ebx
subq %r15, %rbx
movl %r15d, %edi
andl $0x1f, %edi
shll $0x5, %edi
addq 0x40(%r8), %rdi
movq %r12, %rsi
callq 0x4d7c
incq %r15
addq $0x20, %r12
decq %rbx
cmpq %r15, %r13
movq 0x10(%rsp), %r8
jne 0x4ab2
movq 0x40(%r8), %rax
movabsq $-0x8000000000000000, %rsi # imm = 0x8000000000000000
movq 0x28(%rsp), %rdx
cmpq %r14, %rax
je 0x4afc
movq 0x400(%rax), %rcx
jmp 0x4a7e
cmpq %rdx, %r13
jne 0x4b37
cmpq $0x0, 0x8(%rsp)
je 0x4b22
movq 0x58(%r8), %rax
movq 0x68(%r8), %rcx
movq 0x70(%r8), %rsi
decq %rsi
decq %rcx
andq %rsi, %rcx
movq %rcx, 0x8(%rax)
movq %rdx, 0x20(%r8)
movb $0x1, %al
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1154(%rip), %rdi      # 0x5c92
leaq 0x5ce(%rip), %rsi       # 0x5113
leaq 0xfb4(%rip), %rcx       # 0x5b00
movl $0x8a9, %edx            # imm = 0x8A9
callq 0x2100
movq %rax, %rdi
callq 0x20a0
movq 0x18(%rsp), %r13
testq %r13, %r13
movq %r13, %rax
movq 0x8(%rsp), %rsi
cmoveq %rsi, %rax
testb $0x1f, %bpl
movq 0x10(%rsp), %rcx
movq 0x40(%rcx), %r14
movq 0x30(%rsp), %rdx
movq %rdx, 0x70(%rcx)
movq 0x20(%rsp), %rdx
movq %rdx, 0x60(%rcx)
movq %rax, 0x40(%rcx)
cmoveq %rsi, %r13
negq %rbx
movq %rbp, %r12
andq $-0x20, %r12
movq %rbx, %rax
subq %r12, %rax
addq $0x20, %r12
movabsq $-0x8000000000000000, %rcx # imm = 0x8000000000000000
cmpq %rcx, %rax
cmovaq %r15, %r12
cmpq %r12, %rbp
je 0x4bed
movl %ebp, %edi
andl $0x1f, %edi
shll $0x5, %edi
movq 0x10(%r13,%rdi), %rax
testq %rax, %rax
je 0x4be2
addq %r13, %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
incq %rbp
cmpq %rbp, %r12
jne 0x4bc3
movq %r12, %rbp
cmpq %r14, %r13
je 0x4bfb
movq 0x400(%r13), %r13
jmp 0x4b9c
callq 0x21e0
movq %rax, %rbx
callq 0x2210
movq %rbx, %rdi
callq 0x2250
jmp 0x4c12
movq %rax, %rdi
callq 0x2771