// File: /workspace/github_cpp_makefile_star2_O1/ksherlock[P]wdc-utils/afp/src/finder_info.cpp
// Function: afp::finder_info::open(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, afp::finder_info::open_mode, std::error_code&)
bool finder_info::open(const std::string &path, open_mode mode, std::error_code &ec) {
	ec.clear();
	close();
	clear();

	_fd = openX(path, ec);
	if (ec) return false;

	if (mode == read_only || mode == read_write) {
		auto ok = _(::read_xattr(_fd, XATTR_FINDERINFO_NAME, _finder_info, 32), ec);
		if (mode == read_only) close();
		if (ec) {
			remap_enoattr(ec);
			if (mode == read_only) return false;
			if (ec.value() == EOPNOTSUPP) {
				close();
				return false;
			}
		}
		finder_info_to_filetype(_finder_info, &_prodos_file_type, &_prodos_aux_type);
	}
	return true;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movq %rcx, %r15
movl %edx, %r14d
movq %rsi, %r13
movq %rdi, %rbx
callq 0x2180
movq %rax, %r12
movl $0x0, (%r15)
movq %rax, 0x8(%r15)
movl (%rbx), %edi
testl %edi, %edi
js 0xe23b
callq 0x2460
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movw $0x0, 0x4(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, 0x8(%rbx)
movups %xmm0, 0x18(%rbx)
movl $0x0, 0x28(%rbx)
movq (%r13), %rdi
movl $0x800, %esi            # imm = 0x800
xorl %eax, %eax
callq 0x21f0
movl %eax, %r13d
testl %eax, %eax
jns 0xe27e
callq 0x2040
movl (%rax), %eax
movl %eax, (%r15)
movq %r12, 0x8(%r15)
testl %r13d, %r13d
js 0xe2dd
leaq 0x8(%rsp), %rsi
movl %r13d, %edi
callq 0x23b0
testl %eax, %eax
js 0xe2b2
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
movl %eax, %ecx
negw %cx
jo 0xe2dd
cmpl $0x4000, %eax           # imm = 0x4000
jne 0xe2be
movl $0x15, %ebp
jmp 0xe2c3
callq 0x2040
movl (%rax), %ebp
movq %r12, %rax
jmp 0xe2c8
movl $0x1d, %ebp
callq 0x2140
movl %ebp, (%r15)
movq %rax, 0x8(%r15)
movl %r13d, %edi
callq 0x2460
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl %r13d, (%rbx)
cmpl $0x0, (%r15)
je 0xe2fc
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movb $0x1, %bpl
movl %r14d, %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0xe2e8
leaq 0xc(%rbx), %rax
leaq 0x16e8(%rip), %rsi      # 0xf9fd
movl $0x20, %ecx
movl %r13d, %edi
movq %rax, %r13
movq %rax, %rdx
callq 0xe821
testq %rax, %rax
jns 0xe33b
callq 0x2040
movl (%rax), %eax
movl %eax, (%r15)
movq %r12, 0x8(%r15)
cmpl $0x1, %r14d
jne 0xe352
movl (%rbx), %edi
testl %edi, %edi
js 0xe34c
callq 0x2460
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
movl (%r15), %eax
testl %eax, %eax
je 0xe37a
cmpl $0x1, %r14d
je 0xe2e6
cmpl $0x5f, %eax
jne 0xe37a
movl (%rbx), %edi
testl %edi, %edi
js 0xe36f
callq 0x2460
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
jmp 0xe2e6
cmpl $0x736f6470, 0x10(%rbx) # imm = 0x736F6470
jne 0xe3df
movzbl (%r13), %r14d
cmpl $0x70, %r14d
jne 0xe3a9
movzbl 0xd(%rbx), %eax
movw %ax, 0x4(%rbx)
movzwl 0xe(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
movl %eax, 0x8(%rbx)
jmp 0xe2e8
cmpl $0x53595350, (%r13)     # imm = 0x53595350
jne 0xe3be
movw $0xff, 0x4(%rbx)
jmp 0xe508
cmpl $0x36315350, (%r13)     # imm = 0x36315350
jne 0xe3d3
movw $0xb3, 0x4(%rbx)
jmp 0xe508
movl %r14d, %edi
callq 0x20b0
testl %eax, %eax
je 0xe455
cmpl $0x54584554, (%r13)     # imm = 0x54584554
jne 0xe3f4
movw $0x4, 0x4(%rbx)
jmp 0xe508
cmpl $0x414e4942, (%r13)     # imm = 0x414E4942
jne 0xe409
movw $0x0, 0x4(%rbx)
jmp 0xe508
movabsq $0x79704364676d4964, %rax # imm = 0x79704364676D4964
cmpq %rax, (%r13)
je 0xe42e
cmpl $0x4944494d, (%r13)     # imm = 0x4944494D
jne 0xe440
movw $0xd7, 0x4(%rbx)
jmp 0xe508
movw $0xe0, 0x4(%rbx)
movl $0x5, 0x8(%rbx)
jmp 0xe2e8
cmpl $0x46464941, (%r13)     # imm = 0x46464941
jne 0xe48c
movw $0xd8, 0x4(%rbx)
jmp 0xe508
movzbl 0xd(%rbx), %r15d
movl %r15d, %edi
callq 0x20b0
testl %eax, %eax
je 0xe3df
cmpb $0x20, 0xe(%rbx)
jne 0xe3df
cmpb $0x20, 0xf(%rbx)
jne 0xe3df
leal -0x30(%r14), %eax
cmpb $0x9, %al
ja 0xe4ac
addl $-0x30, %r14d
jmp 0xe4cd
cmpl $0x43464941, (%r13)     # imm = 0x43464941
jne 0xe2e8
movw $0xd8, 0x4(%rbx)
movl $0x1, 0x8(%rbx)
jmp 0xe2e8
leal -0x61(%r14), %eax
cmpb $0x5, %al
ja 0xe4ba
addl $-0x57, %r14d
jmp 0xe4cd
leal -0x41(%r14), %eax
addl $-0x37, %r14d
xorl %ecx, %ecx
cmpb $0x6, %al
cmovbl %r14d, %ecx
movl %ecx, %r14d
shll $0x8, %r14d
leal -0x30(%r15), %eax
cmpb $0x9, %al
ja 0xe4df
addl $-0x30, %r15d
jmp 0xe500
leal -0x61(%r15), %eax
cmpb $0x5, %al
ja 0xe4ed
addl $-0x57, %r15d
jmp 0xe500
leal -0x41(%r15), %eax
addl $-0x37, %r15d
xorl %ecx, %ecx
cmpb $0x6, %al
cmovbl %r15d, %ecx
movl %ecx, %r15d
addl %r14d, %r15d
movw %r15w, 0x4(%rbx)
movl $0x0, 0x8(%rbx)
jmp 0xe2e8