// File: /workspace/github_cpp_makefile_star2_O3/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 0x3043
callq 0x2040
cmpl $0x2, (%rax)
jne 0x3335
movq (%rbx), %rdi
movl $0xc2, %esi
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2260
cmpl $-0x1, %eax
je 0x30ee
movl %eax, %ebp
movq %r14, %rdi
callq 0x3de2
movq %rax, %r13
addq %r14, %r13
movl %ebp, %edi
movq %r13, %rsi
callq 0x2200
testl %eax, %eax
jne 0x317b
xorl %edi, %edi
movq %r13, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %ebp, %r8d
xorl %r9d, %r9d
callq 0x2290
cmpq $-0x1, %rax
je 0x320f
cmpq $0x0, 0x10(%r12)
je 0x32a3
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 0x32a8
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 0x11f8(%rip), %rsi      # 0x42f6
leaq 0x11fb(%rip), %rdx      # 0x4300
leaq 0x8(%rsp), %rdi
callq 0x2bca
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 0x3bf6(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3c1c(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3ba1(%rip), %rsi      # 0x6d08
leaq -0x3a2(%rip), %rdx      # 0x2dcc
movq %rbx, %rdi
callq 0x2270
jmp 0x3421
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x1176(%rip), %rsi      # 0x4301
leaq 0x117a(%rip), %rdx      # 0x430c
leaq 0x8(%rsp), %rdi
callq 0x2bca
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 0x3b62(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3b88(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3b0d(%rip), %rsi      # 0x6d08
leaq -0x436(%rip), %rdx      # 0x2dcc
movq %rbx, %rdi
callq 0x2270
jmp 0x3421
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x10ee(%rip), %rsi      # 0x430d
leaq 0x10ed(%rip), %rdx      # 0x4313
leaq 0x8(%rsp), %rdi
callq 0x2bca
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 0x3ace(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3af4(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3a79(%rip), %rsi      # 0x6d08
leaq -0x4ca(%rip), %rdx      # 0x2dcc
movq %rbx, %rdi
callq 0x2270
jmp 0x3421
callq 0x2090
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0x105c(%rip), %rsi      # 0x4314
leaq 0x105c(%rip), %rdx      # 0x431b
leaq 0x8(%rsp), %rdi
callq 0x2bca
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 0x3a3c(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x3a62(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x39e7(%rip), %rsi      # 0x6d08
leaq -0x55c(%rip), %rdx      # 0x2dcc
movq %rbx, %rdi
callq 0x2270
jmp 0x3421
movq %rax, %r13
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xe76(%rip), %rsi       # 0x41be
leaq 0xe7b(%rip), %rdx       # 0x41ca
leaq 0x8(%rsp), %rdi
callq 0x2bca
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 0x39b7(%rip), %rax      # 0x6d48
movq %rax, (%rbx)
leaq 0x39dd(%rip), %rax      # 0x6d78
movq %rax, 0x8(%rbx)
leaq 0x3962(%rip), %rsi      # 0x6d08
leaq -0x5e1(%rip), %rdx      # 0x2dcc
movq %rbx, %rdi
callq 0x2270
jmp 0x3421
jmp 0x33bf
jmp 0x33bf
jmp 0x33bf
jmp 0x33bf
movq %rax, %r14
movq %rbx, %rdi
callq 0x2160
jmp 0x33d9
jmp 0x33d6
jmp 0x33f8
jmp 0x33d6
jmp 0x33d6
jmp 0x33d6
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3429
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x3429
jmp 0x33f8
jmp 0x33f8
jmp 0x33f8
movq %rax, %r14
jmp 0x3429
movq %rax, %r14
cmpl $0x1, %edx
jne 0x3429
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 0x2bbf
nop