Function at 0x402886
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x18
mov dword [ebp - 0xc], 0
sub esp, 8
push 0x1c
push 1
call sub.msvcrt.dll_calloc
add esp, 0x10
mov dword [ebp - 0xc], eax
cmp dword [ebp - 0xc], 0
je 0x402abf
sub esp, 4
push 2
push 0
push dword [ebp + 8]
call sub.msvcrt.dll_fseek
add esp, 0x10
test eax, eax
je 0x4028da
sub esp, 0xc
push str.fseek
call sub.msvcrt.dll_perror
add esp, 0x10
jmp 0x402abf
sub esp, 0xc
push dword [ebp + 8]
call sub.msvcrt.dll_ftell
add esp, 0x10
mov edx, eax
mov eax, dword [ebp - 0xc]
mov dword [eax + 4], edx
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 4]
test eax, eax
jne 0x402919
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
push eax
push 0x13
push 1
push str.Key_file_is_empty._n
call sub.msvcrt.dll_fwrite
add esp, 0x10
jmp 0x402abf
sub esp, 0xc
push dword [ebp + 8]
call sub.msvcrt.dll_rewind
add esp, 0x10
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 4]
sub esp, 0xc
push eax
call sub.msvcrt.dll_malloc
add esp, 0x10
mov edx, eax
mov eax, dword [ebp - 0xc]
mov dword [eax], edx
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
test eax, eax
jne 0x40296e
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 4]
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
sub esp, 4
push edx
push str.ERROR:_unable_to_alloc__ld_bytes_n
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x10
jmp 0x402abf
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 4]
mov edx, eax
mov eax, dword [ebp - 0xc]
mov eax, dword [eax]
push dword [ebp + 8]
push edx
push 1
push eax
call sub.msvcrt.dll_fread
add esp, 0x10
mov edx, eax
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 4]
cmp edx, eax
je 0x4029bb
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 4]
mov eax, dword [sym.imp.msvcrt.dll__iob]
add eax, 0x40
sub esp, 4
push edx
push str.ERROR:_unable_to_read__ld_bytes_from_trace_file_n
push eax
call sub.msvcrt.dll_fprintf
add esp, 0x10
jmp 0x402abf
mov dword [ebp - 8], 0
sub esp, 4
push dword [ebp + 0xc]
push dword [ebp - 8]
push dword [ebp - 0xc]
call fcn.00401fe2
add esp, 0x10
mov dword [ebp - 8], eax
sub esp, 8
push dword [ebp - 8]
push dword [ebp - 0xc]
call fcn.00402176
add esp, 0x10
mov dword [ebp - 8], eax
sub esp, 8
push dword [ebp - 8]
push dword [ebp - 0xc]
call fcn.00402311
add esp, 0x10
mov dword [ebp - 8], eax
sub esp, 8
push dword [ebp - 8]
push dword [ebp - 0xc]
call fcn.0040275f
add esp, 0x10
mov dword [ebp - 8], eax
cmp dword [ebp - 8], 0
js 0x402abf
sub esp, 4
push 0
push dword [ebp - 8]
push dword [ebp + 8]
call sub.msvcrt.dll_fseek
add esp, 0x10
sub esp, 0xc
push dword [ebp - 0xc]
call fcn.004027f4
add esp, 0x10
sub esp, 0xc
push dword [ebp - 0xc]
call fcn.0040285f
add esp, 0x10
cmp dword [ebp + 0xc], 0
je 0x402ab7
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 8]
sub esp, 8
push eax
push str.Threads___d_:_n
call sub.msvcrt.dll_printf
add esp, 0x10
mov dword [ebp - 4], 0
jmp 0x402aac
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 0xc]
mov eax, dword [ebp - 4]
shl eax, 4
lea eax, [edx + eax]
mov ecx, dword [eax + 4]
mov eax, dword [ebp - 0xc]
mov edx, dword [eax + 0xc]
mov eax, dword [ebp - 4]
shl eax, 4
lea eax, [edx + eax]
mov eax, dword [eax]
sub esp, 4
push ecx
push eax
push str._2d__s_n
call sub.msvcrt.dll_printf
add esp, 0x10
inc dword [ebp - 4]
mov eax, dword [ebp - 0xc]
mov eax, dword [eax + 8]
cmp eax, dword [ebp - 4]
jg 0x402a74
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x14], eax
jmp 0x402ad4
sub esp, 0xc
push dword [ebp - 0xc]
call fcn.00401e0a
add esp, 0x10
mov dword [ebp - 0x14], 0
mov eax, dword [ebp - 0x14]
leave
ret