// File: /workspace/github_cpp_makefile_star2_O3/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, %r14
movl %edx, %r15d
movq %rsi, %r13
movq %rdi, %rbx
callq 0x2180
movq %rax, %r12
movl $0x0, (%r14)
movq %rax, 0x8(%r14)
movl (%rbx), %edi
testl %edi, %edi
js 0xe207
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
js 0xe26b
leaq 0x8(%rsp), %rsi
movl %r13d, %edi
callq 0x23b0
testl %eax, %eax
js 0xe27b
movl $0xf000, %eax           # imm = 0xF000
andl 0x20(%rsp), %eax
cmpl $0x4000, %eax           # imm = 0x4000
je 0xe287
cmpl $0x8000, %eax           # imm = 0x8000
je 0xe2a6
movl $0x1d, %ebp
jmp 0xe28c
callq 0x2040
movl (%rax), %eax
movl %eax, (%r14)
movq %r12, 0x8(%r14)
jmp 0xe2a9
callq 0x2040
movl (%rax), %ebp
movq %r12, %rax
jmp 0xe291
movl $0x15, %ebp
callq 0x2140
movl %ebp, (%r14)
movq %rax, 0x8(%r14)
movl %r13d, %edi
callq 0x2460
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
movl (%r14), %eax
movl %r13d, (%rbx)
testl %eax, %eax
je 0xe2c6
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 %r15d, %eax
orl $0x2, %eax
cmpl $0x3, %eax
jne 0xe2b2
leaq 0xc(%rbx), %rax
leaq 0x1781(%rip), %rsi      # 0xfa60
movl $0x20, %ecx
movl %r13d, %edi
movq %rax, %r13
movq %rax, %rdx
callq 0xe801
testq %rax, %rax
jns 0xe305
callq 0x2040
movl (%rax), %eax
movl %eax, (%r14)
movq %r12, 0x8(%r14)
cmpl $0x1, %r15d
jne 0xe324
movl (%rbx), %edi
testl %edi, %edi
js 0xe316
callq 0x2460
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
cmpl $0x0, (%r14)
jne 0xe2b0
jmp 0xe340
cmpl $0x5f, (%r14)
jne 0xe340
movl (%rbx), %edi
testl %edi, %edi
js 0xe335
callq 0x2460
movl $0xffffffff, (%rbx)     # imm = 0xFFFFFFFF
jmp 0xe2b0
cmpl $0x736f6470, 0x10(%rbx) # imm = 0x736F6470
jne 0xe36c
movzbl (%r13), %r14d
cmpl $0x70, %r14d
jne 0xe390
movzbl 0xd(%rbx), %eax
movw %ax, 0x4(%rbx)
movzwl 0xe(%rbx), %eax
rolw $0x8, %ax
movzwl %ax, %eax
jmp 0xe4e4
movq %r13, %r15
movl (%r13), %r13d
cmpl $0x414e4942, %r13d      # imm = 0x414E4942
je 0xe3b4
cmpl $0x54584554, %r13d      # imm = 0x54584554
jne 0xe3bf
movw $0x4, 0x4(%rbx)
jmp 0xe4e2
movq %r13, %r15
movl (%r13), %r13d
cmpl $0x36315350, %r13d      # imm = 0x36315350
je 0xe404
cmpl $0x53595350, %r13d      # imm = 0x53595350
jne 0xe40f
movw $0xff, 0x4(%rbx)
jmp 0xe4e2
movw $0x0, 0x4(%rbx)
jmp 0xe4e2
movabsq $0x79704364676d4964, %rax # imm = 0x79704364676D4964
cmpq %rax, (%r15)
je 0xe464
cmpl $0x43464941, %r13d      # imm = 0x43464941
je 0xe479
cmpl $0x46464941, %r13d      # imm = 0x46464941
je 0xe471
cmpl $0x4944494d, %r13d      # imm = 0x4944494D
jne 0xe2b2
movw $0xd7, 0x4(%rbx)
jmp 0xe4e2
movw $0xb3, 0x4(%rbx)
jmp 0xe4e2
movl %r14d, %edi
callq 0x20b0
testl %eax, %eax
jne 0xe373
movl %r13d, %r12d
shrl $0x8, %r12d
movzbl %r12b, %edi
movl %edi, 0x4(%rsp)
callq 0x20b0
testl %eax, %eax
sete %al
movl %r13d, %ecx
andl $0xffff0000, %ecx       # imm = 0xFFFF0000
cmpl $0x20200000, %ecx       # imm = 0x20200000
setne %cl
orb %al, %cl
jne 0xe373
leal -0x30(%r14), %eax
cmpb $0x9, %al
ja 0xe486
addl $-0x30, %r14d
movl 0x4(%rsp), %edx
jmp 0xe4ab
movw $0xe0, 0x4(%rbx)
movl $0x5, %eax
jmp 0xe4e4
movw $0xd8, 0x4(%rbx)
jmp 0xe4e2
movw $0xd8, 0x4(%rbx)
movl $0x1, %eax
jmp 0xe4e4
leal -0x61(%r14), %eax
cmpb $0x5, %al
movl 0x4(%rsp), %edx
ja 0xe498
addl $-0x57, %r14d
jmp 0xe4ab
leal -0x41(%r14), %eax
addl $-0x37, %r14d
xorl %ecx, %ecx
cmpb $0x6, %al
cmovbl %r14d, %ecx
movl %ecx, %r14d
shll $0x8, %r14d
leal -0x30(%r12), %eax
cmpb $0x9, %al
ja 0xe4bd
addl $-0x30, %edx
jmp 0xe4db
leal -0x61(%r12), %eax
cmpb $0x5, %al
ja 0xe4cb
addl $-0x57, %edx
jmp 0xe4db
addb $-0x41, %r12b
addl $-0x37, %edx
xorl %eax, %eax
cmpb $0x6, %r12b
cmovael %eax, %edx
addl %r14d, %edx
movw %dx, 0x4(%rbx)
xorl %eax, %eax
addq $0x8, %rbx
movl %eax, (%rbx)
jmp 0xe2b2
nop