// File: /workspace/github_cpp_makefile_star2_O2/dadocolussi[P]gdc-circular_queue/src/gdc_circular_queue_factory.hpp
// Function: gdc::circular_queue_factory<unsigned long, gdc::circular_queue<unsigned long>>::create_shared(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, unsigned long, bool, std::function<int (gdc::circular_queue<unsigned long>&)>)
static void create_shared(
			const std::string& name,
			size_type capacity,
			bool sync,
			mdinit_type metadata_initializer)
		{
			// Unlink any old shared memory object with the same name.
			int status = ::shm_unlink(name.c_str());
			if (status == -1 && errno != ENOENT)
			{
				std::string what("shm_unlink: ");
				what.append(::strerror(errno));
				throw circular_queue_error(what);
			}
			
			// Create a new shared memory object.
			int fd = ::shm_open(name.c_str(), O_RDWR | O_CREAT | O_EXCL, S_IRWXU);
			if (fd == -1)
			{
				std::string what("shm_open: ");
				what.append(::strerror(errno));
				::shm_unlink(name.c_str());
				throw circular_queue_error(what);
			}
			
			size_t len = footprint(capacity) + capacity;
			status = ::ftruncate(fd, len);
			if (status != 0)
			{
				std::string what("ftruncate: ");
				what.append(::strerror(errno));
				::close(fd);
				::shm_unlink(name.c_str());
				throw circular_queue_error(what);
			}
			
			void* p = ::mmap(
				NULL,
				len,
				PROT_READ | PROT_WRITE,
				MAP_SHARED,
				fd,
				0);
			if (p == MAP_FAILED)
			{
				std::string what("mmap: ");
				what.append(::strerror(errno));
				::close(fd);
				::shm_unlink(name.c_str());
				throw circular_queue_error(what);
			}
			
			try
			{
				auto q = new (p) Q();
				metadata_initializer(*q);
				auto qq = reinterpret_cast<circular_queue_control_block*>(p);
				qq->properties.sync = sync;
				qq->properties.capacity.store(capacity, std::memory_order_release);
			}
			catch (const std::exception& ex)
			{
				::close(fd);
				::shm_unlink(name.c_str());
				throw;
			}
			
			if (::close(fd) != 0)
			{
				std::string what("close: ");
				what.append(::strerror(errno));
				::shm_unlink(name.c_str());
				throw circular_queue_error(what);
			}
		}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rcx, %r12
movl %edx, %r15d
movq %rsi, %r14
movq %rdi, %rbx
movq (%rdi), %rdi
callq 0x22a0
cmpl $-0x1, %eax
jne 0x2dab
callq 0x2030
cmpl $0x2, (%rax)
jne 0x2ffc
movq (%rbx), %rdi
movl $0xc2, %esi
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2240
cmpl $-0x1, %eax
je 0x2e46
movl %eax, %ebp
movq %r14, %rdi
callq 0x3878
movq %rax, %r13
addq %r14, %r13
movl %ebp, %edi
movq %r13, %rsi
callq 0x21e0
testl %eax, %eax
jne 0x2eb0
pushq $0x3
popq %rdx
pushq $0x1
popq %rcx
xorl %edi, %edi
movq %r13, %rsi
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x2270
cmpq $-0x1, %rax
je 0x2f21
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
callq 0x3904
movzbl %r15b, %eax
movl %eax, 0x88(%r13)
movq %r14, 0x80(%r13)
movl %ebp, %edi
callq 0x22d0
testl %eax, %eax
jne 0x2f92
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x14a9(%rip), %rsi      # 0x42f6
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movq (%rbx), %rdi
callq 0x22a0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3e6c(%rip), %rsi      # 0x6d08
leaq -0x305(%rip), %rdx      # 0x2b9e
movq %rbx, %rdi
callq 0x2250
jmp 0x30be
leaq 0x144a(%rip), %rsi      # 0x4301
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movl %ebp, %edi
callq 0x22d0
movq (%rbx), %rdi
callq 0x22a0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3dfb(%rip), %rsi      # 0x6d08
leaq -0x376(%rip), %rdx      # 0x2b9e
movq %rbx, %rdi
callq 0x2250
jmp 0x30be
leaq 0x13e5(%rip), %rsi      # 0x430d
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movl %ebp, %edi
callq 0x22d0
movq (%rbx), %rdi
callq 0x22a0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3d8a(%rip), %rsi      # 0x6d08
leaq -0x3e7(%rip), %rdx      # 0x2b9e
movq %rbx, %rdi
callq 0x2250
jmp 0x30be
leaq 0x137b(%rip), %rsi      # 0x4314
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movq (%rbx), %rdi
callq 0x22a0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3d20(%rip), %rsi      # 0x6d08
leaq -0x451(%rip), %rdx      # 0x2b9e
movq %rbx, %rdi
callq 0x2250
jmp 0x30be
movq %rax, %r13
leaq 0x11b8(%rip), %rsi      # 0x41be
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x27aa
movl (%r13), %edi
callq 0x2070
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3cbe(%rip), %rsi      # 0x6d08
leaq -0x4b3(%rip), %rdx      # 0x2b9e
movq %rbx, %rdi
callq 0x2250
jmp 0x30be
jmp 0x3063
jmp 0x3063
jmp 0x3063
jmp 0x3063
movq %rax, %r14
movq %rbx, %rdi
callq 0x2150
jmp 0x307d
jmp 0x307a
jmp 0x308f
jmp 0x307a
jmp 0x307a
jmp 0x307a
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x20c0
jmp 0x3092
jmp 0x308f
jmp 0x308f
jmp 0x308f
movq %rax, %r14
movq %r14, %rdi
callq 0x2260
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3092
movq %r14, %rdi
callq 0x20a0
movl %ebp, %edi
callq 0x22d0
movq (%rbx), %rdi
callq 0x22a0
callq 0x21f0
movq %rax, %r14
callq 0x2230
jmp 0x3092
movq %rax, %rdi
callq 0x2a15