Function at 0x140005015
Capabilities:
Read file on windows

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0x48
mov rbx, rcx
mov rbp, rdx
mov rsi, r8
test rcx, rcx
je 0x1400050c7
test r8, r8
je 0x1400050fa
cmp qword [rdx], 0
je 0x140005050
cmp qword [r8], 0
je 0x14000512d
lea rdx, [0x140011b6e]
mov rcx, rbx
call sub.msvcrt.dll_fopen
mov r12, rax
test rax, rax
je 0x140005160
mov r8d, 2
mov edx, 0
mov rcx, rax
call sub.msvcrt.dll_fseek
test eax, eax
je 0x140005233
mov rdi, qword [sym.imp.msvcrt.dll__errno]
call rdi
mov r9d, dword [rax]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____fseek_SEEK_END__failed_path_s_errno_d__n
call fcn.140002ef2
call rdi
mov eax, dword [rax]
cmp eax, 0x29
ja case.0x1400050c5.3
mov eax, eax
lea rdx, [0x140011d10]
movsxd rax, dword [rdx + rax*4]
add rax, rdx
jmp rax
mov dword [rsp + 0x20], 0x2bd
lea r9, str.C:_Projects_rdp_bot_codebase_fs.c
lea r8, str._path___NULL_
lea rdx, str.fs_file_read
lea rcx, [0x1400113e0]
call fcn.140002ef2
mov edi, 0x40000004
jmp 0x140005579
mov dword [rsp + 0x20], 0x2be
lea r9, str.C:_Projects_rdp_bot_codebase_fs.c
lea r8, str._buf_sz___NULL_
lea rdx, str.fs_file_read
lea rcx, [0x1400113e0]
call fcn.140002ef2
mov edi, 0x40000004
jmp 0x140005579
mov dword [rsp + 0x20], 0x2bf
lea r9, str.C:_Projects_rdp_bot_codebase_fs.c
lea r8, str.___buf___NULL_____buf_sz____0__
lea rdx, str.fs_file_read
lea rcx, [0x1400113e0]
call fcn.140002ef2
mov edi, 0x40000004
jmp 0x140005579
mov rdi, qword [sym.imp.msvcrt.dll__errno]
call rdi
mov r9d, dword [rax]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____fopen_failed_path_s_errno_d__n
call fcn.140002ef2
call rdi
mov eax, dword [rax]
cmp eax, 0x29
ja case.0x14000519b.3
mov eax, eax
lea rdx, [0x140011db8]
movsxd rax, dword [rdx + rax*4]
add rax, rdx
jmp rax
mov edi, 0
jmp 0x140005568
mov edi, 0x40000009
jmp 0x140005568
mov edi, 0x40000002
jmp 0x140005568
mov edi, 0x40000007
jmp 0x140005568
mov edi, 0x4000000d
jmp 0x140005568
call qword [sym.imp.msvcrt.dll__errno]
mov edi, dword [rax]
and edi, 0x1fffffff
or edi, 0x60000000
jmp 0x140005568
mov edi, 0
jmp 0x140005568
mov edi, 0x40000009
jmp 0x140005568
mov edi, 0x40000002
jmp 0x140005568
mov edi, 0x40000007
jmp 0x140005568
mov edi, 0x4000000d
jmp 0x140005568
call qword [sym.imp.msvcrt.dll__errno]
mov edi, dword [rax]
and edi, 0x1fffffff
or edi, 0x60000000
jmp 0x140005568
mov rcx, r12
call sub.msvcrt.dll_ftell
mov r13d, eax
test eax, eax
js 0x14000526b
je 0x140005563
cmp qword [rbp], 0
je 0x1400052f3
cdqe
cmp qword [rsi], rax
jae 0x1400052f3
mov qword [rsi], rax
mov edi, 0x4000000b
jmp 0x140005568
mov rdi, qword [sym.imp.msvcrt.dll__errno]
call rdi
mov r9d, dword [rax]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____ftell_failed_path_s_errno_d__n
call fcn.140002ef2
call rdi
mov eax, dword [rax]
cmp eax, 0x29
ja case.0x1400052a6.3
mov eax, eax
lea rdx, [0x140011e60]
movsxd rax, dword [rdx + rax*4]
add rax, rdx
jmp rax
mov edi, 0
jmp 0x140005568
mov edi, 0x40000009
jmp 0x140005568
mov edi, 0x40000002
jmp 0x140005568
mov edi, 0x40000007
jmp 0x140005568
mov edi, 0x4000000d
jmp 0x140005568
call qword [sym.imp.msvcrt.dll__errno]
mov edi, dword [rax]
and edi, 0x1fffffff
or edi, 0x60000000
jmp 0x140005568
mov r8d, 0
mov edx, 0
mov rcx, r12
call sub.msvcrt.dll_fseek
mov r14d, eax
test eax, eax
jne 0x140005381
mov rax, qword [rbp]
mov qword [rsp + 0x38], rax
test rax, rax
je 0x140005409
cmp qword [rsp + 0x38], 0
je 0x1400055d2
mov edi, 0
test edi, edi
sete r15b
cmp r14d, r13d
setl al
test r15b, r15b
je 0x1400054de
test al, al
je 0x1400054de
mov r8d, r13d
sub r8d, r14d
movsxd rcx, r14d
mov rax, qword [rsp + 0x38]
add rcx, rax
mov r9, r12
movsxd r8, r8d
mov edx, 1
call sub.msvcrt.dll_fread
test eax, eax
je 0x1400054de
js 0x14000544c
add r14d, eax
jmp 0x140005330
mov rdi, qword [sym.imp.msvcrt.dll__errno]
call rdi
mov r9d, dword [rax]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____fseek_SEEK_SET__failed_path_s_errno_d__n
call fcn.140002ef2
call rdi
mov eax, dword [rax]
cmp eax, 0x29
ja case.0x1400053bc.3
mov eax, eax
lea rdx, [0x140011f08]
movsxd rax, dword [rdx + rax*4]
add rax, rdx
jmp rax
mov edi, 0
jmp 0x140005568
mov edi, 0x40000009
jmp 0x140005568
mov edi, 0x40000002
jmp 0x140005568
mov edi, 0x40000007
jmp 0x140005568
mov edi, 0x4000000d
jmp 0x140005568
call qword [sym.imp.msvcrt.dll__errno]
mov edi, dword [rax]
and edi, 0x1fffffff
or edi, 0x60000000
jmp 0x140005568
movsxd rdi, r13d
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov rcx, rax
mov r8, rdi
mov edx, 8
call qword [sym.imp.KERNEL32.dll_HeapAlloc]
mov qword [rsp + 0x38], rax
test rax, rax
jne 0x14000531f
mov r8, rdi
lea rdx, [0x140011c46]
lea rcx, [0x140011c50]
call fcn.140002ef2
jmp 0x14000531f
mov rdi, qword [sym.imp.msvcrt.dll__errno]
call rdi
mov r9d, dword [rax]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____fread_failed_path_s_errno_d__n
call fcn.140002ef2
call rdi
mov eax, dword [rax]
cmp eax, 0x29
ja case.0x140005487.3
mov eax, eax
lea rdx, [0x140011fb0]
movsxd rax, dword [rdx + rax*4]
add rax, rdx
jmp rax
mov edi, 0
jmp 0x140005330
mov edi, 0x40000009
jmp 0x140005330
mov edi, 0x40000002
jmp 0x140005330
mov edi, 0x40000007
jmp 0x140005330
mov edi, 0x4000000d
jmp 0x140005330
call qword [sym.imp.msvcrt.dll__errno]
mov edi, dword [rax]
and edi, 0x1fffffff
or edi, 0x60000000
jmp 0x140005330
mov edi, 0x40000003
jmp 0x140005330
cmp r14d, r13d
setne al
test r15b, al
jne 0x14000550f
test edi, edi
je 0x140005534
cmp qword [rbp], 0
jne 0x140005568
call qword [sym.imp.KERNEL32.dll_GetProcessHeap]
mov rcx, rax
mov r8, qword [rsp + 0x38]
mov edx, 0
call qword [sym.imp.KERNEL32.dll_HeapFree]
jmp 0x140005568
mov dword [rsp + 0x20], r14d
mov r9d, r13d
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____fread_undone_path_s_l_ld_n_ld__n
call fcn.140002ef2
mov edi, 0x40000001
jmp 0x1400054ed
cmp qword [rbp], 0
je 0x140005543
movsxd r13, r13d
mov qword [rsi], r13
jmp 0x140005568
mov rax, qword [rsp + 0x38]
mov qword [rbp], rax
jmp 0x14000553b
mov edi, 0x40000003
jmp 0x140005568
mov edi, 0x40000003
jmp 0x140005568
mov edi, 0x40000003
jmp 0x140005568
mov edi, 0
test r12, r12
je 0x140005575
mov rcx, r12
call sub.msvcrt.dll_fclose
test edi, edi
je 0x1400055e2
cmp edi, 0x4000000b
setne al
test rsi, rsi
setne dl
test dl, al
je 0x140005593
mov qword [rsi], 0
mov r9d, edi
and r9d, 0x3fffffff
test rbx, rbx
je 0x1400055d9
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._E____s_____Failed_path_s_err_08x__n
call fcn.140002ef2
mov eax, edi
add rsp, 0x48
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret
mov edi, 0x40000003
jmp 0x140005568
mov edi, 0x40000002
jmp 0x140005568
lea rbx, [0x14001139b]
jmp 0x1400055a2
mov r9, qword [rsi]
mov r8, rbx
lea rdx, str.fs_file_read
lea rcx, str._I____s_____Done_path_s_buf_sz_llu__n
call fcn.140002ef2
jmp 0x1400055b8