// File: 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
movq %rsp, %rbp
subq $0x270, %rsp            # imm = 0x270
movq %rdi, -0x228(%rbp)
movq %rdi, %rax
movq %rax, -0x220(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0x218(%rbp)
movq -0x18(%rbp), %rsi
leaq -0x70(%rbp), %rdi
movq %rdi, -0x210(%rbp)
movl $0x2, %edx
callq 0x25050
movq -0x218(%rbp), %rsi
movq -0x210(%rbp), %rdx
leaq -0x48(%rbp), %rdi
callq 0x249c0
jmp 0xc7609
leaq -0x70(%rbp), %rdi
callq 0x24b40
leaq -0x48(%rbp), %rdi
callq 0xc9a00
movb %al, -0x229(%rbp)
jmp 0xc7623
movb -0x229(%rbp), %al
testb $0x1, %al
jne 0xc762f
jmp 0xc7676
movq -0x228(%rbp), %rdi
leaq -0x48(%rbp), %rsi
callq 0x37440
movl $0x1, -0x80(%rbp)
jmp 0xc7a99
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x70(%rbp), %rdi
callq 0x24b40
jmp 0xc7abb
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc7ab2
movb $0x0, -0x81(%rbp)
leaq -0x100(%rbp), %rdi
callq 0x9e690
jmp 0xc768b
leaq -0xd8(%rbp), %rdi
leaq -0x100(%rbp), %rsi
callq 0x11a70
jmp 0xc76a0
leaq 0x8bb8d(%rip), %rsi     # 0x153234
leaq -0x128(%rbp), %rdi
movl $0x2, %edx
callq 0xc9a30
jmp 0xc76ba
leaq -0xb0(%rbp), %rdi
leaq -0xd8(%rbp), %rsi
leaq -0x128(%rbp), %rdx
callq 0x249c0
jmp 0xc76d6
movq -0x18(%rbp), %rsi
leaq -0x150(%rbp), %rdi
movl $0x2, %edx
callq 0x25050
jmp 0xc76ed
movq -0x228(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
leaq -0x150(%rbp), %rdx
callq 0x249c0
jmp 0xc7709
leaq -0x150(%rbp), %rdi
callq 0x24b40
leaq -0xb0(%rbp), %rdi
callq 0x24b40
leaq -0x128(%rbp), %rdi
callq 0x24b40
leaq -0xd8(%rbp), %rdi
callq 0x24b40
leaq -0x100(%rbp), %rdi
callq 0x24b40
movq -0x228(%rbp), %rdi
callq 0xc9a00
movb %al, -0x22a(%rbp)
jmp 0xc7759
movb -0x22a(%rbp), %al
testb $0x1, %al
jne 0xc7768
jmp 0xc781e
movb $0x1, -0x81(%rbp)
movl $0x1, -0x80(%rbp)
testb $0x1, -0x81(%rbp)
jne 0xc7a89
jmp 0xc7a7d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc77fc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc77f0
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc77e4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc77d8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x150(%rbp), %rdi
callq 0x24b40
leaq -0xb0(%rbp), %rdi
callq 0x24b40
leaq -0x128(%rbp), %rdi
callq 0x24b40
leaq -0xd8(%rbp), %rdi
callq 0x24b40
leaq -0x100(%rbp), %rdi
callq 0x24b40
jmp 0xc7ab2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc7a8b
leaq -0x168(%rbp), %rdi
callq 0x24b80
movb $0x1, -0x202(%rbp)
movl $0xa8, %edi
callq 0x112b0
movq %rax, -0x240(%rbp)
leaq -0x1a9(%rbp), %rdi
movq %rdi, -0x238(%rbp)
callq 0x119d0
movq -0x238(%rbp), %rdx
leaq 0x8b9d5(%rip), %rsi     # 0x153238
leaq -0x1a8(%rbp), %rdi
callq 0x24740
jmp 0xc7871
leaq -0x1f8(%rbp), %rdi
movq %rdi, -0x200(%rbp)
movq -0x18(%rbp), %rsi
callq 0x11250
jmp 0xc788a
leaq -0x1f8(%rbp), %rax
movq %rax, -0x1d8(%rbp)
movq $0x1, -0x1d0(%rbp)
leaq -0x201(%rbp), %rdi
movq %rdi, -0x248(%rbp)
callq 0x26e30
movq -0x248(%rbp), %rcx
movq -0x1d8(%rbp), %rsi
movq -0x1d0(%rbp), %rdx
leaq -0x1c8(%rbp), %rdi
callq 0x2d6a0
jmp 0xc78d9
leaq -0x188(%rbp), %rdi
leaq -0x1a8(%rbp), %rsi
leaq -0x1c8(%rbp), %rdx
callq 0x9e250
jmp 0xc78f5
movq -0x240(%rbp), %rdi
movq -0x20(%rbp), %rdx
leaq -0x188(%rbp), %rsi
leaq -0x168(%rbp), %rcx
callq 0x9c360
jmp 0xc7915
movq -0x240(%rbp), %rdi
movb $0x0, -0x202(%rbp)
leaq 0x119356(%rip), %rsi    # 0x1e0c80
leaq -0x6cf91(%rip), %rdx    # 0x5a9a0
callq 0x11970
jmp 0xc7ac4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc7a4c
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
movq -0x200(%rbp), %rax
leaq -0x1f8(%rbp), %rcx
cmpq %rax, %rcx
movq %rax, -0x250(%rbp)
je 0xc79a3
movq -0x250(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x258(%rbp)
callq 0x11360
movq -0x258(%rbp), %rax
leaq -0x1f8(%rbp), %rcx
cmpq %rcx, %rax
movq %rax, -0x250(%rbp)
jne 0xc7972
jmp 0xc7a40
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc79e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
jmp 0xc79dc
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x78(%rbp)
movl %eax, -0x7c(%rbp)
leaq -0x188(%rbp), %rdi
callq 0x11360
leaq -0x1c8(%rbp), %rdi
callq 0x25b00
leaq -0x201(%rbp), %rdi
callq 0x279c0
leaq -0x1f8(%rbp), %rax
movq %rax, -0x268(%rbp)
addq $0x20, %rax
movq %rax, -0x260(%rbp)
movq -0x260(%rbp), %rdi
addq $-0x20, %rdi
movq %rdi, -0x270(%rbp)
callq 0x11360
movq -0x268(%rbp), %rcx
movq -0x270(%rbp), %rax
cmpq %rcx, %rax
movq %rax, -0x260(%rbp)
jne 0xc7a0d
jmp 0xc7a40
leaq -0x1a8(%rbp), %rdi
callq 0x11360
leaq -0x1a9(%rbp), %rdi
callq 0x11600
testb $0x1, -0x202(%rbp)
jne 0xc7a63
jmp 0xc7a6f
movq -0x240(%rbp), %rdi
callq 0x11420
leaq -0x168(%rbp), %rdi
callq 0x24e60
jmp 0xc7a8b
movq -0x228(%rbp), %rdi
callq 0x24b40
jmp 0xc7a99
movq -0x228(%rbp), %rdi
callq 0x24b40
jmp 0xc7ab2
leaq -0x48(%rbp), %rdi
callq 0x24b40
movq -0x220(%rbp), %rax
addq $0x270, %rsp            # imm = 0x270
popq %rbp
retq
leaq -0x48(%rbp), %rdi
callq 0x24b40
movq -0x78(%rbp), %rdi
callq 0x119c0
nopw %cs:(%rax,%rax)