// File: /workspace/github_cpp_makefile_star2_O3/Nallantli[P]Rossa/main/rossa/global/global.cpp
// Function: dir::findFile(std::filesystem::__cxx11::path const&, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, token_t const*)
const std::filesystem::path dir::findFile(const std::filesystem::path &currentDir, const std::string &filename, const token_t *token)
{
	auto currentDirCheck = currentDir / filename;
	if (std::filesystem::exists(currentDirCheck))
		return currentDirCheck;
	auto libDirCheck = util::getRuntimePath().parent_path() / "lib" / filename;
	if (std::filesystem::exists(libDirCheck))
		return libDirCheck;
	trace_t stack_trace;
	throw rossa_error_t(util::format(_FILE_NOT_FOUND_, {filename}), *token, stack_trace);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rcx, %r14
movq %rdx, %r12
movq %rsi, %r15
movq %rdi, %rbx
leaq 0x30(%rsp), %r13
movq %r13, %rdi
movq %rdx, %rsi
movl $0x2, %edx
callq 0x1d704
leaq 0xd0(%rsp), %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x1d52e
leaq 0x30(%rsp), %rdi
callq 0x1d5ee
leaq 0xd0(%rsp), %rdi
callq 0x10190
testb %al, %al
je 0x55fea
movzbl %al, %eax
cmpl $0xff, %eax
jne 0x5617a
leaq 0x58(%rsp), %rdi
callq 0x483eb
leaq 0x8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
callq 0x10760
leaq 0x2f852(%rip), %rsi     # 0x8585c
leaq 0x80(%rsp), %rdi
movl $0x2, %edx
callq 0x5779e
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0x80(%rsp), %rdx
callq 0x1d52e
leaq 0xa8(%rsp), %rdi
movq %r12, %rsi
movl $0x2, %edx
callq 0x1d704
leaq 0x30(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
movq %rbx, %rdi
callq 0x1d52e
leaq 0xa8(%rsp), %rdi
callq 0x1d5ee
leaq 0x30(%rsp), %rdi
callq 0x1d5ee
leaq 0x80(%rsp), %rdi
callq 0x1d5ee
leaq 0x8(%rsp), %rdi
callq 0x1d5ee
leaq 0x58(%rsp), %rdi
callq 0x1d5ee
movq %rbx, %rdi
callq 0x10190
testb %al, %al
je 0x560af
movzbl %al, %eax
cmpl $0xff, %eax
jne 0x5618a
xorps %xmm0, %xmm0
movaps %xmm0, 0x80(%rsp)
movq $0x0, 0x90(%rsp)
movl $0xa8, %edi
callq 0x101e0
movq %rax, %r15
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
leaq 0x2f77d(%rip), %rsi     # 0x85860
leaq 0x2f790(%rip), %rdx     # 0x8587a
leaq 0x8(%rsp), %rdi
callq 0x1e698
leaq 0x68(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%r12), %rsi
movq 0x8(%r12), %rdx
addq %rsi, %rdx
leaq 0x58(%rsp), %rdi
callq 0x1ded4
leaq 0xa8(%rsp), %rdi
leaq 0x58(%rsp), %rsi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x20b38
leaq 0x30(%rsp), %rdi
leaq 0x8(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x47db4
movb $0x1, %r12b
leaq 0x30(%rsp), %rsi
leaq 0x80(%rsp), %rcx
movq %r15, %rdi
movq %r14, %rdx
callq 0x46e88
xorl %r12d, %r12d
leaq 0x5abb5(%rip), %rsi     # 0xb0d20
leaq -0x1eece(%rip), %rdx    # 0x372a4
movq %r15, %rdi
callq 0x106d0
leaq 0xd0(%rsp), %rsi
movq %rbx, %rdi
callq 0x2459a
leaq 0xd0(%rsp), %rdi
callq 0x1d5ee
movq %rbx, %rax
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x561d2
movq 0x40(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x561d2
movq %rax, %r14
movb $0x1, %r12b
leaq 0xa8(%rsp), %rdi
callq 0x1db60
jmp 0x561e7
movq %rax, %r14
movb $0x1, %r12b
movq 0x58(%rsp), %rdi
cmpq %rbp, %rdi
je 0x561fe
movq 0x68(%rsp), %rsi
incq %rsi
callq 0x103d0
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x56215
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x103d0
testb %r12b, %r12b
jne 0x5623b
jmp 0x56243
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x5623b
movq 0x18(%rsp), %rsi
incq %rsi
callq 0x103d0
jmp 0x5623b
movq %rax, %r14
movq %r15, %rdi
callq 0x102d0
leaq 0x80(%rsp), %rdi
callq 0x1d632
jmp 0x56255
movq %rax, %r14
movq %rbx, %rdi
jmp 0x562a4
movq %rax, %r14
leaq 0xa8(%rsp), %rdi
callq 0x1d5ee
jmp 0x5626f
movq %rax, %r14
leaq 0x30(%rsp), %rdi
callq 0x1d5ee
jmp 0x5627e
movq %rax, %r14
leaq 0x80(%rsp), %rdi
callq 0x1d5ee
jmp 0x56290
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x1d5ee
jmp 0x5629f
movq %rax, %r14
leaq 0x58(%rsp), %rdi
callq 0x1d5ee
jmp 0x562b0
jmp 0x562ad
movq %rax, %r14
leaq 0xd0(%rsp), %rdi
callq 0x1d5ee
movq %r14, %rdi
callq 0x106f0
movq %rax, %r14
leaq 0x30(%rsp), %rdi
jmp 0x562b8