Function at 0x140036aa8
Capabilities:
Get file size
Read file on windows
Write file on windows

Disassembly:
push r15
push r14
push r13
push r12
push rbp
push rdi
push rsi
push rbx
sub rsp, 0xa8
xor eax, eax
mov ebx, ecx
mov r12, rdx
mov rbp, r8
mov rdi, r9
mov qword [rsp + 0x60], rax
mov qword [rsp + 0x78], rax
call qword [sym.imp.KERNEL32.DLL_GetCurrentProcess]
lea r8, [rsp + 0x58]
mov edx, 8
mov rcx, rax
call qword [sym.imp.ADVAPI32.dll_OpenProcessToken]
mov r14, qword [sym.imp.KERNEL32.DLL_GetLastError]
test eax, eax
jne 0x140036b07
call fcn.140038579
lea rcx, str.OpenProcessToken_failed:__s
mov rdx, rax
jmp 0x140036b4a
lea r15, [rsp + 0x54]
xor r9d, r9d
xor r8d, r8d
mov rcx, qword [rsp + 0x58]
mov qword [rsp + 0x20], r15
mov r13, qword [sym.imp.ADVAPI32.dll_GetTokenInformation]
mov edx, 1
call r13
test eax, eax
jne 0x140036c6f
call r14
cmp eax, 0x7a
je 0x140036b54
call fcn.140038579
lea rcx, str.GetTokenInformation__pre__failed:__s
mov rdx, rax
call fcn.1400380b9
jmp 0x140036c6f
mov edx, dword [rsp + 0x54]
mov ecx, 1
mov dword [rsp + 0x48], edx
call sub.msvcrt.dll_calloc
mov rsi, rax
test rax, rax
je 0x140036c6f
mov qword [rsp + 0x20], r15
mov r9d, dword [rsp + 0x48]
mov r8, rax
mov edx, 1
mov rcx, qword [rsp + 0x58]
call r13
test eax, eax
je 0x140036bfb
mov rcx, qword [rsi]
lea rdx, [rsp + 0x78]
call qword [sym.imp.ADVAPI32.dll_ConvertSidToStringSidA]
test eax, eax
jne 0x140036bbf
call fcn.140038579
lea rcx, str.Unable_to_convert_SID_to_string:__s
mov rdx, rax
call fcn.1400380b9
xor eax, eax
mov qword [rsp + 0x60], rax
jmp 0x140036c17
mov rcx, qword [rsp + 0x78]
lea rdx, [rsp + 0x60]
call qword [sym.imp.ADVAPI32.dll_ConvertStringSidToSidA]
test eax, eax
jne 0x140036bee
call fcn.140038579
lea rcx, str.Unable_to_convert_string_back_to_SID:__s
mov rdx, rax
call fcn.1400380b9
xor eax, eax
mov qword [rsp + 0x60], rax
mov rcx, qword [rsp + 0x78]
call qword [sym.imp.KERNEL32.DLL_LocalFree]
jmp 0x140036c17
xor r15d, r15d
mov qword [rsp + 0x60], r15
call fcn.140038579
lea rcx, str.GetTokenInformation__real__failed:__s
mov rdx, rax
call fcn.1400380b9
mov rcx, rsi
call sub.msvcrt.dll_free
mov r13, qword [rsp + 0x60]
test r13, r13
je 0x140036c6f
lea rsi, [rsp + 0x78]
mov edx, 1
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x140036c6f
xor r8d, r8d
mov rdx, r13
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorOwner]
test eax, eax
je 0x140036c6f
xor r13d, r13d
mov qword [rsp + 0x68], rsi
lea r9, [rsp + 0x60]
mov dword [rsp + 0x60], 0x18
mov dword [rsp + 0x70], r13d
jmp 0x140036c86
call fcn.140038579
lea rcx, str.Could_not_set_security_descriptor:__s
mov rdx, rax
call fcn.1400380b9
xor r9d, r9d
cmp ebx, 1
je 0x140036cc2
cmp ebx, 2
je 0x140036ccf
test ebx, ebx
jne 0x140036ca8
xor r11d, r11d
mov r15d, 3
mov esi, 0x80000000
mov qword [rbp], r11
jmp 0x140036cda
mov r8d, 0x2ab
lea rdx, str.stdfn.c
lea rcx, str.FALSE
call qword [sym.imp.msvcrt.dll__wassert]
mov r15d, 2
mov esi, 0x40000000
jmp 0x140036cda
mov r15d, 4
mov esi, 4
mov rcx, r12
mov qword [rsp + 0x48], r9
call fcn.14003585b
xor r10d, r10d
mov edx, esi
mov r9, qword [rsp + 0x48]
mov qword [rsp + 0x30], r10
mov rcx, rax
mov r13, rax
mov r8d, 1
mov dword [rsp + 0x28], pe_nt_image_headers64
mov dword [rsp + 0x20], r15d
call qword [sym.imp.KERNEL32.DLL_CreateFileW]
mov rsi, rax
call r14
mov r14d, eax
test r13, r13
je 0x140036d2b
mov rcx, r13
call sub.msvcrt.dll_free
mov ecx, r14d
call qword [sym.imp.KERNEL32.DLL_SetLastError]
cmp rsi, 0xffffffffffffffff
jne 0x140036d53
call fcn.140038579
mov rdx, r12
lea rcx, str.Could_not_open__s:__s
mov r8, rax
call fcn.1400380b9
jmp 0x140036d96
cmp ebx, 1
je 0x140036de6
cmp ebx, 2
je 0x140036dd2
xor edx, edx
mov rcx, rsi
call qword [sym.imp.KERNEL32.DLL_GetFileSize]
mov ecx, eax
mov dword [rdi], ecx
mov dword [rsp + 0x48], ecx
call sub.msvcrt.dll_malloc
mov r8d, dword [rsp + 0x48]
test rax, rax
mov qword [rbp], rax
mov rdx, rax
jne 0x140036d9e
lea rcx, str.Could_not_allocate_buffer_for_reading_file
call fcn.1400380b9
xor r12d, r12d
jmp 0x140036e27
xor r9d, r9d
mov rcx, rsi
mov qword [rsp + 0x20], r9
mov r9, rdi
call qword [sym.imp.KERNEL32.DLL_ReadFile]
mov r9d, 0xc8f
test eax, eax
jne 0x140036e0a
call fcn.140038579
lea rcx, str.I_O_Error:__s
mov rdx, rax
call fcn.1400380b9
jmp 0x140036d96
mov r9d, 2
xor r8d, r8d
xor edx, edx
mov rcx, rsi
call qword [sym.imp.KERNEL32.DLL_SetFilePointerEx]
xor ecx, ecx
mov r9, rdi
mov qword [rsp + 0x20], rcx
mov rcx, rsi
mov r8d, dword [rdi]
mov rdx, qword [rbp]
call qword [sym.imp.KERNEL32.DLL_WriteFile]
test eax, eax
je 0x140036dbc
mov r9d, 0xc90
mov qword [rsp + 0x20], r12
xor r8d, r8d
mov edx, 1
mov ecx, 1
mov r12d, 1
call fcn.14001e4cb
mov rcx, rsi
call qword [sym.imp.KERNEL32.DLL_CloseHandle]
or ebx, r12d
jne 0x140036e48
mov rcx, qword [rbp]
call sub.msvcrt.dll_free
xor eax, eax
xor edx, edx
mov qword [rbp], rax
mov dword [rdi], edx
mov eax, r12d
add rsp, 0xa8
pop rbx
pop rsi
pop rdi
pop rbp
pop r12
pop r13
pop r14
pop r15
ret