// File: /workspace/github_cpp_makefile_star2_O1/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 0x22c0
cmpl $-0x1, %eax
jne 0x303d
callq 0x2040
cmpl $0x2, (%rax)
jne 0x332f
movq (%rbx), %rdi
movl $0xc2, %esi
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2260
cmpl $-0x1, %eax
je 0x30e8
movl %eax, %ebp
movq %r14, %rdi
callq 0x3ddc
movq %rax, %r13
addq %r14, %r13
movl %ebp, %edi
movq %r13, %rsi
callq 0x2200
testl %eax, %eax
jne 0x3175
xorl %edi, %edi
movq %r13, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x2290
cmpq $-0x1, %rax
je 0x3209
cmpq $0x0, 0x10(%r12)
je 0x329d
movq %rax, %r13
movq %r12, %rdi
movq %rax, %rsi
callq *0x18(%r12)
movzbl %r15b, %eax
movl %eax, 0x88(%r13)
movq %r14, 0x80(%r13)
movl %ebp, %edi
callq 0x22f0
testl %eax, %eax
jne 0x32a2
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x11fe(%rip), %rsi      # 0x42f6
leaq 0x1201(%rip), %rdx      # 0x4300
leaq 0x8(%rsp), %rdi
callq 0x2bc8
callq 0x2040
movl (%rax), %edi
callq 0x2080
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22e0
movq (%rbx), %rdi
callq 0x22c0
movl $0x18, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21f0
leaq 0x3bfc(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3c22(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3ba7(%rip), %rsi      # 0x6d08
leaq -0x3aa(%rip), %rdx      # 0x2dbe
movq %rbx, %rdi
callq 0x2270
jmp 0x341b
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x117c(%rip), %rsi      # 0x4301
leaq 0x1180(%rip), %rdx      # 0x430c
leaq 0x8(%rsp), %rdi
callq 0x2bc8
callq 0x2040
movl (%rax), %edi
callq 0x2080
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22e0
movl %ebp, %edi
callq 0x22f0
movq (%rbx), %rdi
callq 0x22c0
movl $0x18, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21f0
leaq 0x3b68(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3b8e(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3b13(%rip), %rsi      # 0x6d08
leaq -0x43e(%rip), %rdx      # 0x2dbe
movq %rbx, %rdi
callq 0x2270
jmp 0x341b
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10f4(%rip), %rsi      # 0x430d
leaq 0x10f3(%rip), %rdx      # 0x4313
leaq 0x8(%rsp), %rdi
callq 0x2bc8
callq 0x2040
movl (%rax), %edi
callq 0x2080
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22e0
movl %ebp, %edi
callq 0x22f0
movq (%rbx), %rdi
callq 0x22c0
movl $0x18, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21f0
leaq 0x3ad4(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3afa(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3a7f(%rip), %rsi      # 0x6d08
leaq -0x4d2(%rip), %rdx      # 0x2dbe
movq %rbx, %rdi
callq 0x2270
jmp 0x341b
callq 0x2090
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1062(%rip), %rsi      # 0x4314
leaq 0x1062(%rip), %rdx      # 0x431b
leaq 0x8(%rsp), %rdi
callq 0x2bc8
callq 0x2040
movl (%rax), %edi
callq 0x2080
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22e0
movq (%rbx), %rdi
callq 0x22c0
movl $0x18, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21f0
leaq 0x3a42(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3a68(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x39ed(%rip), %rsi      # 0x6d08
leaq -0x564(%rip), %rdx      # 0x2dbe
movq %rbx, %rdi
callq 0x2270
jmp 0x341b
movq %rax, %r13
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xe7c(%rip), %rsi       # 0x41be
leaq 0xe81(%rip), %rdx       # 0x41ca
leaq 0x8(%rsp), %rdi
callq 0x2bc8
movl (%r13), %edi
callq 0x2080
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x22e0
movl $0x18, %edi
callq 0x20e0
movq %rax, %rbx
leaq 0x8(%rax), %rdi
leaq 0x8(%rsp), %rsi
callq 0x21f0
leaq 0x39bd(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x39e3(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3968(%rip), %rsi      # 0x6d08
leaq -0x5e9(%rip), %rdx      # 0x2dbe
movq %rbx, %rdi
callq 0x2270
jmp 0x341b
jmp 0x33b9
jmp 0x33b9
jmp 0x33b9
jmp 0x33b9
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
jmp 0x33d3
jmp 0x33d0
jmp 0x33f2
jmp 0x33d0
jmp 0x33d0
jmp 0x33d0
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3423
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3423
jmp 0x33f2
jmp 0x33f2
jmp 0x33f2
movq %rax, %r14
jmp 0x3423
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3423
movq %r14, %rdi
callq 0x20b0
movl %ebp, %edi
callq 0x22f0
movq (%rbx), %rdi
callq 0x22c0
callq 0x2210
movq %rax, %r14
callq 0x2250
movq %r14, %rdi
callq 0x2280
movq %rax, %rdi
callq 0x2bbd
nop