// 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>>::map_shared(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
static Q* map_shared(const std::string& name)
		{
			// Ignore size. The true size is defined in the mapped memory.
			static long page_size = ::sysconf(_SC_PAGESIZE);
			if (page_size == -1)
			{
				std::string what("sysconf: ");
				what.append(::strerror(errno));
				throw circular_queue_error(what);
			}
			assert(page_size > 0);
			
			int fd = ::shm_open(name.c_str(), O_RDWR, S_IRWXU);
			if (fd == -1)
			{
				std::string what("shm_open: ");
				what.append(::strerror(errno));
				throw circular_queue_error(what);
			}
			
			size_type init_size = footprint(0);
			auto p = ::mmap(
				NULL,
				init_size,
				PROT_READ | PROT_WRITE,
				MAP_SHARED,
				fd,
				0);
			if (p == MAP_FAILED)
			{
				std::string what("mmap: ");
				what.append(::strerror(errno));
				::close(fd);
				throw circular_queue_error(what);
			}
			
			Q* q = new (p) Q();
			size_type capacity = q->capacity();
			
			if (capacity == 0)
			{
				// Not fully initialized yet.
				::munmap(p, init_size);
				::close(fd);
				throw circular_queue_error("Not fully initialized yet.");
			}
			
			if (::munmap(p, init_size) != 0)
			{
				std::string what("munmap: ");
				what.append(::strerror(errno));
				::close(fd);
				throw circular_queue_error(what);
			}
			
			size_type fp = footprint(capacity);
			p = ::mmap(
				NULL,
				fp + capacity,
				PROT_READ | PROT_WRITE,
				MAP_SHARED,
				fd,
				0);
			if (p == MAP_FAILED)
			{
				std::string what("mmap: ");
				what.append(::strerror(errno));
				::close(fd);
				throw circular_queue_error(what);
			}
			
			q = new (p) Q();
			void* pp = reinterpret_cast<char*>(p) + fp;
			void* p2 = ::mmap(
				pp,
				capacity,
				PROT_READ | PROT_WRITE, 
				MAP_SHARED | MAP_FIXED,
				fd,
				page_size);
			if (p2 == MAP_FAILED)
			{
				std::string what("mmap: ");
				what.append(::strerror(errno));
				::munmap(p, fp + capacity);
				::close(fd);
				throw circular_queue_error(what);
			}
			
			if (::close(fd) != 0)
			{
				std::string what("close: ");
				what.append(::strerror(errno));
				::munmap(p, fp + capacity);
				::close(fd);
				throw circular_queue_error(what);
			}
			
			return q;
		}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
movb 0x3d78(%rip), %al       # 0x71c8
testb %al, %al
je 0x3562
movq 0x3d61(%rip), %rax      # 0x71c0
cmpq $-0x1, %rax
je 0x356c
testq %rax, %rax
jle 0x35eb
movq (%rbx), %rdi
movl $0x2, %esi
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2260
cmpl $-0x1, %eax
je 0x360a
movl %eax, %ebx
xorl %edi, %edi
callq 0x3de2
movq %rax, %r14
xorl %edi, %edi
movq %rax, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x2290
cmpq $-0x1, %rax
je 0x3689
movq 0x80(%rax), %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x20f0
testq %r12, %r12
je 0x370f
testl %eax, %eax
jne 0x3748
movq %r12, %rdi
callq 0x3de2
movq %rax, %r13
leaq (%rax,%r12), %r14
xorl %edi, %edi
movq %r14, %rsi
movl $0x3, %edx
movl $0x1, %ecx
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x2290
cmpq $-0x1, %rax
je 0x37ce
movq %rax, %r15
addq %rax, %r13
movq 0x3ca0(%rip), %r9       # 0x71c0
movq %r13, %rdi
movq %r12, %rsi
movl $0x3, %edx
movl $0x11, %ecx
movl %ebx, %r8d
callq 0x2290
cmpq $-0x1, %rax
je 0x3854
movl %ebx, %edi
callq 0x22f0
testl %eax, %eax
jne 0x38e6
movq %r15, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x2310
jmp 0x3458
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xe2e(%rip), %rsi       # 0x43aa
leaq 0xe30(%rip), %rdx       # 0x43b3
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x3786(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x37ac(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x3731(%rip), %rsi      # 0x6d08
leaq -0x812(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
leaq 0xa12(%rip), %rdi       # 0x4004
leaq 0xb0e(%rip), %rsi       # 0x4107
leaq 0xdb4(%rip), %rcx       # 0x43b4
movl $0xd5, %edx
callq 0x2120
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xcdc(%rip), %rsi       # 0x42f6
leaq 0xcdf(%rip), %rdx       # 0x4300
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x36e8(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x370e(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x3693(%rip), %rsi      # 0x6d08
leaq -0x8b0(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xc74(%rip), %rsi       # 0x430d
leaq 0xc73(%rip), %rdx       # 0x4313
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x3662(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x3688(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x360d(%rip), %rsi      # 0x6d08
leaq -0x936(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0xd1c(%rip), %rsi       # 0x4446
movq %rax, %rdi
callq 0x3e4a
leaq 0x35cf(%rip), %rsi      # 0x6d08
leaq -0x974(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xd09(%rip), %rsi       # 0x4461
leaq 0xd0a(%rip), %rdx       # 0x4469
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x35a3(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x35c9(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x354e(%rip), %rsi      # 0x6d08
leaq -0x9f5(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
leaq 0x10(%rsp), %r15
movq %r15, -0x10(%r15)
leaq 0xb2f(%rip), %rsi       # 0x430d
leaq 0xb2e(%rip), %rdx       # 0x4313
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x351d(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x3543(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x34c8(%rip), %rsi      # 0x6d08
leaq -0xa7b(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xaa8(%rip), %rsi       # 0x430d
leaq 0xaa7(%rip), %rdx       # 0x4313
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movq %r15, %rdi
movq %r14, %rsi
callq 0x20f0
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x348b(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x34b1(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x3436(%rip), %rsi      # 0x6d08
leaq -0xb0d(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3973
leaq 0x10(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0xa1d(%rip), %rsi       # 0x4314
leaq 0xa1d(%rip), %rdx       # 0x431b
movq %rsp, %rdi
callq 0x2bca
callq 0x2040
movl (%rax), %edi
callq 0x2080
movq %rsp, %rdi
movq %rax, %rsi
callq 0x22e0
movq %r15, %rdi
movq %r14, %rsi
callq 0x20f0
movl %ebx, %edi
callq 0x22f0
movl $0x18, %edi
callq 0x20e0
movq %rax, %r14
leaq 0x8(%rax), %rdi
movq %rsp, %rsi
callq 0x21f0
leaq 0x33f9(%rip), %rax      # 0x6d48
movq %rax, (%r14)
leaq 0x341f(%rip), %rax      # 0x6d78
movq %rax, 0x8(%r14)
leaq 0x33a4(%rip), %rsi      # 0x6d08
leaq -0xb9f(%rip), %rdx      # 0x2dcc
movq %r14, %rdi
callq 0x2270
jmp 0x3975
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x39a0
jmp 0x398a
jmp 0x398a
jmp 0x398a
jmp 0x398a
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x39b2
jmp 0x39af
jmp 0x39af
jmp 0x399d
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r12, %rdi
jne 0x39bb
jmp 0x39e6
jmp 0x39af
jmp 0x39af
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x39e6
movq 0x10(%rsp), %rsi
incq %rsi
callq 0x21b0
jmp 0x39e6
jmp 0x39e3
jmp 0x39e3
jmp 0x39e3
jmp 0x39e3
movq %rax, %rbx
movq %r14, %rdi
callq 0x2160
jmp 0x39e6
jmp 0x39e3
jmp 0x39e3
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2280