Function at 0x1400353cf
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 0x14003542e
call fcn.140036bd7
lea rcx, str.OpenProcessToken_failed:__s_n
mov rdx, rax
jmp 0x140035471
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 0x140035596
call r14
cmp eax, 0x7a
je 0x14003547b
call fcn.140036bd7
lea rcx, str.GetTokenInformation__pre__failed:__s_n
mov rdx, rax
call fcn.140036717
jmp 0x140035596
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 0x140035596
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 0x140035522
mov rcx, qword [rsi]
lea rdx, [rsp + 0x78]
call qword [sym.imp.ADVAPI32.dll_ConvertSidToStringSidA]
test eax, eax
jne 0x1400354e6
call fcn.140036bd7
lea rcx, str.Unable_to_convert_SID_to_string:__s_n
mov rdx, rax
call fcn.140036717
xor eax, eax
mov qword [rsp + 0x60], rax
jmp 0x14003553e
mov rcx, qword [rsp + 0x78]
lea rdx, [rsp + 0x60]
call qword [sym.imp.ADVAPI32.dll_ConvertStringSidToSidA]
test eax, eax
jne 0x140035515
call fcn.140036bd7
lea rcx, str.Unable_to_convert_string_back_to_SID:__s_n
mov rdx, rax
call fcn.140036717
xor eax, eax
mov qword [rsp + 0x60], rax
mov rcx, qword [rsp + 0x78]
call qword [sym.imp.KERNEL32.DLL_LocalFree]
jmp 0x14003553e
xor r15d, r15d
mov qword [rsp + 0x60], r15
call fcn.140036bd7
lea rcx, str.GetTokenInformation__real__failed:__s_n
mov rdx, rax
call fcn.140036717
mov rcx, rsi
call sub.msvcrt.dll_free
mov r13, qword [rsp + 0x60]
test r13, r13
je 0x140035596
lea rsi, [rsp + 0x78]
mov edx, 1
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_InitializeSecurityDescriptor]
test eax, eax
je 0x140035596
xor r8d, r8d
mov rdx, r13
mov rcx, rsi
call qword [sym.imp.ADVAPI32.dll_SetSecurityDescriptorOwner]
test eax, eax
je 0x140035596
xor r13d, r13d
mov qword [rsp + 0x68], rsi
lea r9, [rsp + 0x60]
mov dword [rsp + 0x60], 0x18
mov dword [rsp + 0x70], r13d
jmp 0x1400355ad
call fcn.140036bd7
lea rcx, str.Could_not_set_security_descriptor:__s_n
mov rdx, rax
call fcn.140036717
xor r9d, r9d
cmp ebx, 1
je 0x1400355e9
cmp ebx, 2
je 0x1400355f6
test ebx, ebx
jne 0x1400355cf
xor r11d, r11d
mov r15d, 3
mov esi, 0x80000000
mov qword [rbp], r11
jmp 0x140035601
mov r8d, 0x262
lea rdx, str.stdfn.c
lea rcx, str.FALSE
call qword [sym.imp.msvcrt.dll__wassert]
mov r15d, 2
mov esi, 0x40000000
jmp 0x140035601
mov r15d, 4
mov esi, 4
mov rcx, r12
mov qword [rsp + 0x48], r9
call fcn.1400342ad
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 0x140035652
mov rcx, r13
call sub.msvcrt.dll_free
mov ecx, r14d
call qword [sym.imp.KERNEL32.DLL_SetLastError]
cmp rsi, 0xffffffffffffffff
jne 0x14003567a
call fcn.140036bd7
mov rdx, r12
lea rcx, str.Could_not_open__s:__s
mov r8, rax
call fcn.140036717
jmp 0x1400356bd
cmp ebx, 1
je 0x14003570d
cmp ebx, 2
je 0x1400356f9
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 0x1400356c5
lea rcx, str.Could_not_allocate_buffer_for_reading_file_n
call fcn.140036717
xor r12d, r12d
jmp 0x14003574e
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 0x140035731
call fcn.140036bd7
lea rcx, str.I_O_Error:__s
mov rdx, rax
call fcn.140036717
jmp 0x1400356bd
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 0x1400356e3
mov r9d, 0xc90
mov qword [rsp + 0x20], r12
xor r8d, r8d
mov edx, 1
mov ecx, 1
mov r12d, 1
call fcn.14001d77b
mov rcx, rsi
call qword [sym.imp.KERNEL32.DLL_CloseHandle]
or ebx, r12d
jne 0x14003576f
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