Function at 0x4039a0
Capabilities:
Set current directory

Disassembly:
sub rsp, 0x818
mov qword [rsp + 0x810], rbx
mov qword [rsp + 0x808], rbp
mov qword [rsp + 0x800], rsi
mov qword [rsp + 0x7f8], rdi
mov qword [rsp + 0x7f0], r12
mov r12, rdx
mov rbp, rcx
lea rdx, [0x0040c668]
mov rcx, r8
mov qword [rsp + 0x7e8], r13
mov rsi, r8
call qword [sym.imp.msvcrt.dll_fopen]
test rax, rax
mov rdi, rax
jne 0x403a99
call qword [sym.imp.KERNEL32.dll_GetLastError]
mov r8, qword [rbp + 0xa98]
lea rdx, str._s_Error__li_
lea rcx, [rsp + 0x50]
mov r9d, eax
mov ebx, eax
call qword [sym.imp.msvcrt.dll_sprintf]
xor r11d, r11d
lea rax, [rsp + 0x40]
mov qword [rsp + 0x30], r11
mov dword [rsp + 0x28], r11d
mov r9d, 0x400
mov r8d, ebx
xor edx, edx
mov ecx, 0x1300
mov qword [rsp + 0x20], rax
call qword [sym.imp.KERNEL32.dll_FormatMessageA]
mov r8, qword [rsp + 0x40]
lea rdx, str._s_n_s
lea rcx, [rsp + 0x3e0]
mov r9, rsi
call qword [sym.imp.msvcrt.dll_sprintf]
mov rcx, qword [rsp + 0x40]
call qword [sym.imp.KERNEL32.dll_LocalFree]
mov rcx, qword [rbp + 0xab0]
lea r8, [rsp + 0x50]
lea rdx, [rsp + 0x3e0]
xor r9d, r9d
call qword [sym.imp.USER32.dll_MessageBoxA]
xor al, al
jmp 0x403cee
mov r13, qword [rbp + 0xaa8]
lea rdx, str.Current_Script
mov r8, rsi
mov rcx, rbp
mov qword [rbp + 0xaa8], rsi
call fcn.00402ae0
lea r9, [rsp + 0x40]
lea r8, [rsp + 0x50]
mov edx, 0x104
mov rcx, rsi
call qword [sym.imp.KERNEL32.dll_GetFullPathNameA]
lea rcx, [rsp + 0x50]
mov edx, 0x5c
call qword [sym.imp.msvcrt.dll__mbsrchr]
test rax, rax
jne 0x403aed
lea rax, [rsp + 0x50]
jmp 0x403af0
inc rax
lea r8, [rsp + 0x50]
lea rdx, str.Currentdir
mov rcx, rbp
mov byte [rax - 1], 0
call fcn.00402ae0
lea rcx, [rsp + 0x50]
call qword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
lea rdx, str.Current_Section
mov r8, r12
mov rcx, rbp
call fcn.00402ae0
mov rcx, rdi
mov byte [rsp + 0x160], 0
lea rbx, [rsp + 0x1e0]
call qword [sym.imp.msvcrt.dll_fgetc]
mov byte [rsp + 0x1e0], al
test byte [rdi + 0x18], 0x10
jne 0x403b69
nop
nop
cmp byte [rbx], 0xa
je 0x403b69
mov rcx, rdi
inc rbx
call qword [sym.imp.msvcrt.dll_fgetc]
mov byte [rbx], al
test byte [rdi + 0x18], 0x10
je 0x403b50
mov byte [rbx], 0
test byte [rdi + 0x18], 0x10
jne 0x403c68
nop
nop
nop
lea rcx, [rsp + 0x1e0]
mov edx, 0x5b
call qword [sym.imp.msvcrt.dll__mbschr]
test rax, rax
mov rbx, rax
je 0x403bfb
mov edx, 0x5d
mov rcx, rax
call qword [sym.imp.msvcrt.dll__mbschr]
test rax, rax
mov rsi, rax
jne 0x403bb5
xor bl, bl
jmp 0x403bfb
lea rcx, [rsp + 0x1e0]
mov edx, 0x3b
call qword [sym.imp.msvcrt.dll__mbschr]
test rax, rax
je 0x403bd6
cmp rax, rsi
jae 0x403bd6
xor bl, bl
jmp 0x403bfb
lea rcx, [rbx + 1]
lea rdx, [rsp + 0x160]
mov byte [rsi], 0
sub rdx, rcx
movzx eax, byte [rcx]
inc rcx
test al, al
mov byte [rdx + rcx - 1], al
jne 0x403be8
mov byte [rsi], 0x5d
mov bl, 1
lea rcx, [rsp + 0x160]
mov rdx, r12
call qword [sym.imp.msvcrt.dll__mbsicmp]
test eax, eax
jne 0x403c24
test bl, bl
jne 0x403c24
lea rdx, [rsp + 0x1e0]
mov rcx, rbp
call fcn.00403690
mov rcx, rdi
lea rbx, [rsp + 0x1e0]
call qword [sym.imp.msvcrt.dll_fgetc]
mov byte [rsp + 0x1e0], al
test byte [rdi + 0x18], 0x10
jne 0x403c5b
cmp byte [rbx], 0xa
je 0x403c5b
mov rcx, rdi
inc rbx
call qword [sym.imp.msvcrt.dll_fgetc]
mov byte [rbx], al
test byte [rdi + 0x18], 0x10
je 0x403c42
mov byte [rbx], 0
test byte [rdi + 0x18], 0x10
je 0x403b80
mov rcx, rdi
call qword [sym.imp.msvcrt.dll_fclose]
lea rdx, str.Current_Script
mov r8, r13
mov rcx, rbp
mov qword [rbp + 0xaa8], r13
call fcn.00402ae0
lea r9, [rsp + 0x40]
lea r8, [rsp + 0x50]
mov edx, 0x104
mov rcx, r13
call qword [sym.imp.KERNEL32.dll_GetFullPathNameA]
lea rcx, [rsp + 0x50]
mov edx, 0x5c
call qword [sym.imp.msvcrt.dll__mbsrchr]
mov r13, qword [rsp + 0x7e8]
test rax, rax
jne 0x403cc6
lea rax, [rsp + 0x50]
jmp 0x403cc9
inc rax
lea r8, [rsp + 0x50]
lea rdx, str.Currentdir
mov rcx, rbp
mov byte [rax - 1], 0
call fcn.00402ae0
lea rcx, [rsp + 0x50]
call qword [sym.imp.KERNEL32.dll_SetCurrentDirectoryA]
mov al, 1
mov r12, qword [rsp + 0x7f0]
mov rdi, qword [rsp + 0x7f8]
mov rsi, qword [rsp + 0x800]
mov rbp, qword [rsp + 0x808]
mov rbx, qword [rsp + 0x810]
add rsp, 0x818
ret