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

Disassembly:
sub esp, 0x5c
push ebx
push ebp
mov ebp, dword [esp + 0x68]
push esi
push edi
xor ebx, ebx
mov edi, ecx
cmp ebp, ebx
mov dword [esp + 0x10], edi
je 0x4134d3
call fcn.004136a0
test al, al
je 0x41332b
mov ecx, edi
call fcn.004135a0
cmp byte [esp + 0x74], bl
je 0x4133bf
push 0x430340
push ebp
call dword [sym.imp.MSVCRT.dll__wfopen]
mov esi, eax
add esp, 8
cmp esi, ebx
je 0x4134d3
push esi
push 0x2c
lea eax, [esp + 0x48]
push 1
push eax
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x10
cmp eax, 0x2c
jne 0x4134c9
push 2
push ebx
push esi
call dword [sym.imp.MSVCRT.dll_fseek]
add esp, 0xc
test eax, eax
push esi
jne 0x4134ca
call dword [sym.imp.MSVCRT.dll_ftell]
lea edx, [esp + 0x44]
mov ecx, str.LGZ
add esp, 4
mov edx, dword [edx]
cmp edx, dword [ecx]
jne 0x4134c9
mov ecx, dword [esp + 0x5c]
add eax, 0xffffffd4
cmp ecx, eax
ja 0x4134c9
cmp byte [esp + 0x44], 1
jne 0x4134c9
cmp byte [esp + 0x45], bl
jmp 0x4134c7
push ebp
call fcn.0040f290
add esp, 4
test al, al
je 0x413453
push 0x430c3c
push ebp
call dword [sym.imp.MSVCRT.dll__wfopen]
mov esi, eax
add esp, 8
cmp esi, ebx
je 0x4134d3
push esi
push 0x2c
lea eax, [esp + 0x48]
push 1
push eax
call dword [sym.imp.MSVCRT.dll_fread]
add esp, 0x10
cmp eax, 0x2c
jne 0x4134c9
push 2
push ebx
push esi
call dword [sym.imp.MSVCRT.dll_fseek]
add esp, 0xc
test eax, eax
push esi
jne 0x4134ca
call dword [sym.imp.MSVCRT.dll_ftell]
lea edx, [esp + 0x44]
mov ecx, str.LGZ
add esp, 4
mov edx, dword [edx]
cmp edx, dword [ecx]
jne 0x4134c9
mov ecx, dword [esp + 0x5c]
add eax, 0xffffffd4
cmp ecx, eax
ja 0x4134c9
cmp byte [esp + 0x44], 1
jne 0x4134c9
cmp byte [esp + 0x45], bl
jmp 0x4134c7
push 0x430c2c
push ebp
call dword [sym.imp.MSVCRT.dll__wfopen]
mov esi, eax
add esp, 8
cmp esi, ebx
jne 0x413474
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x5c
ret 8
mov eax, dword [str.LGZ]
xor ecx, ecx
mov dword [esp + 0x1c], ecx
push esi
mov dword [esp + 0x24], ecx
push 0x2c
mov dword [esp + 0x2c], ecx
lea edx, [esp + 0x1c]
mov dword [esp + 0x30], ecx
push 1
push edx
mov dword [esp + 0x24], eax
mov byte [esp + 0x28], 1
mov byte [esp + 0x29], bl
mov word [esp + 0x2a], bx
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x40], ebx
mov dword [esp + 0x44], ebx
mov dword [esp + 0x48], ebx
mov dword [esp + 0x4c], ebx
call dword [sym.imp.MSVCRT.dll_fwrite]
add esp, 0x10
cmp eax, 0x2c
je 0x4134df
push esi
call dword [sym.imp.MSVCRT.dll_fclose]
add esp, 4
pop edi
pop esi
pop ebp
xor al, al
pop ebx
add esp, 0x5c
ret 8
mov dword [edi + 4], esi
push ebp
lea esi, [edi + 0x34]
call dword [sym.imp.MSVCRT.dll_wcslen]
mov edi, eax
add esp, 4
cmp edi, 0x7ffffffd
jbe 0x4134ff
call dword [sym.imp.MSVCP60.dll_void___cdecl_std::_Xlen_void_]
mov ecx, dword [esi + 4]
cmp ecx, ebx
je 0x413525
mov al, byte [ecx - 1]
cmp al, bl
je 0x413525
cmp al, 0xff
je 0x413525
cmp edi, ebx
jne 0x41354b
dec al
mov byte [ecx - 1], al
mov dword [esi + 4], ebx
mov dword [esi + 8], ebx
mov dword [esi + 0xc], ebx
jmp 0x413578
cmp edi, ebx
jne 0x413535
push 1
mov ecx, esi
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_unsigned_short_int__struct_std::char_traits_unsigned_short_int___class_std::allocator_unsigned_short_int__::_Tidy_bool_]
jmp 0x413578
mov eax, dword [esi + 0xc]
cmp eax, 0x1f
ja 0x413541
cmp eax, edi
jae 0x413554
push 1
mov ecx, esi
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_unsigned_short_int__struct_std::char_traits_unsigned_short_int___class_std::allocator_unsigned_short_int__::_Tidy_bool_]
push edi
mov ecx, esi
call dword [sym.imp.MSVCP60.dll_private:_void___thiscall_std::basic_string_unsigned_short_int__struct_std::char_traits_unsigned_short_int___class_std::allocator_unsigned_short_int__::_Copy_unsigned_int_]
mov eax, dword [esi + 4]
cmp edi, ebx
mov ecx, ebp
jbe 0x41356e
mov edx, edi
mov bp, word [ecx]
add ecx, 2
mov word [eax], bp
add eax, 2
dec edx
jne 0x41355f
mov eax, dword [esi + 4]
mov dword [esi + 8], edi
mov word [eax + edi*2], bx
mov eax, dword [esp + 0x10]
mov cl, byte [esp + 0x74]
lea esi, [esp + 0x40]
mov byte [eax + 0x44], cl
lea edi, [eax + 8]
mov ecx, 0xb
mov al, 1
rep movsd dword es:[edi], dword [esi]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x5c
ret 8