// 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>>::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 $0x30, %rsp
movq %rdi, %rbx
movb 0x40d2(%rip), %al       # 0x71b8
testb %al, %al
je 0x31ea
movq 0x40bb(%rip), %rax      # 0x71b0
cmpq $-0x1, %rax
je 0x321e
testq %rax, %rax
jle 0x3280
movq (%rbx), %rdi
pushq $0x2
popq %rsi
movl $0x1c0, %edx            # imm = 0x1C0
callq 0x2240
cmpl $-0x1, %eax
je 0x329f
movl %eax, %ebx
xorl %edi, %edi
callq 0x3878
movq %rax, %r14
pushq $0x3
popq %rdx
pushq $0x1
popq %rcx
xorl %edi, %edi
movq %rax, %rsi
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x2270
cmpq $-0x1, %rax
je 0x3301
movq 0x80(%rax), %r12
movq %rax, %rdi
movq %r14, %rsi
callq 0x20f0
testq %r12, %r12
je 0x336a
testl %eax, %eax
jne 0x33a1
movq %r12, %rdi
callq 0x3878
movq %rax, %r13
leaq (%rax,%r12), %r14
pushq $0x3
popq %rdx
pushq $0x1
popq %rcx
xorl %edi, %edi
movq %r14, %rsi
movl %ebx, %r8d
xorl %r9d, %r9d
callq 0x2270
cmpq $-0x1, %rax
je 0x340a
movq %rax, %r15
addq %rax, %r13
movq 0x4004(%rip), %r9       # 0x71b0
pushq $0x3
popq %rdx
pushq $0x11
popq %rcx
movq %r13, %rdi
movq %r12, %rsi
movl %ebx, %r8d
callq 0x2270
cmpq $-0x1, %rax
je 0x3473
movl %ebx, %edi
callq 0x22d0
testl %eax, %eax
jne 0x34e4
movq %r15, %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x3fc7(%rip), %rdi      # 0x71b8
callq 0x2290
testl %eax, %eax
je 0x30ee
pushq $0x1e
popq %rdi
callq 0x2110
movq %rax, 0x3fa3(%rip)      # 0x71b0
leaq 0x3fa4(%rip), %rdi      # 0x71b8
callq 0x2100
jmp 0x30ee
leaq 0x1185(%rip), %rsi      # 0x43aa
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3a9c(%rip), %rsi      # 0x6d08
leaq -0x6d5(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
leaq 0xd7d(%rip), %rdi       # 0x4004
leaq 0xe79(%rip), %rsi       # 0x4107
leaq 0x111f(%rip), %rcx      # 0x43b4
movl $0xd5, %edx
callq 0x2120
leaq 0x1050(%rip), %rsi      # 0x42f6
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3a1b(%rip), %rsi      # 0x6d08
leaq -0x756(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
leaq 0x1005(%rip), %rsi      # 0x430d
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x39b2(%rip), %rsi      # 0x6d08
leaq -0x7bf(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10c3(%rip), %rsi      # 0x4446
movq %rax, %rdi
callq 0x3918
leaq 0x3976(%rip), %rsi      # 0x6d08
leaq -0x7fb(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
leaq 0x10b9(%rip), %rsi      # 0x4461
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3912(%rip), %rsi      # 0x6d08
leaq -0x85f(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
leaq 0xefc(%rip), %rsi       # 0x430d
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x38a9(%rip), %rsi      # 0x6d08
leaq -0x8c8(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
leaq 0xe93(%rip), %rsi       # 0x430d
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movq %r15, %rdi
movq %r14, %rsi
callq 0x20f0
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x3835(%rip), %rsi      # 0x6d08
leaq -0x93c(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x3553
leaq 0xe29(%rip), %rsi       # 0x4314
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x27aa
callq 0x2030
movl (%rax), %edi
callq 0x2070
leaq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x22c0
movq %r15, %rdi
movq %r14, %rsi
callq 0x20f0
movl %ebx, %edi
callq 0x22d0
pushq $0x18
popq %rdi
callq 0x20e0
movq %rax, %r14
leaq 0x10(%rsp), %rsi
movq %rax, %rdi
callq 0x2b7a
leaq 0x37c4(%rip), %rsi      # 0x6d08
leaq -0x9ad(%rip), %rdx      # 0x2b9e
movq %r14, %rdi
callq 0x2250
jmp 0x355f
jmp 0x355f
jmp 0x355f
jmp 0x355f
jmp 0x355f
jmp 0x355f
movq %rax, %rbx
movq %r14, %rdi
callq 0x2150
jmp 0x357b
jmp 0x3578
jmp 0x3578
jmp 0x3578
jmp 0x3578
jmp 0x3578
jmp 0x3578
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x20c0
jmp 0x35a3
jmp 0x35a0
jmp 0x35a0
jmp 0x35a0
jmp 0x35a0
movq %rax, %rbx
movq %r14, %rdi
callq 0x2150
jmp 0x35a3
jmp 0x35a0
jmp 0x35a0
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2260
nop