Function at 0x509f6b
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x3c
push ebx
push esi
push edi
mov dword [ebp - 0x10], ecx
call fcn.0050a259
mov esi, dword [ebp + 8]
test esi, esi
je 0x509fb8
push esi
call sub.MSVCRT.dll_strlen
test eax, eax
pop ecx
je 0x509fb8
push 0x67eea4
push esi
call dword [sym.imp.MSVCRT.dll_fopen]
pop ecx
mov dword [ebp - 4], eax
test eax, eax
pop ecx
jne 0x509fc1
push 0x3b
push str.E:CQ2ClientRelease_18.26.83DGameMapAoxPuzzle.cpp
push esi
push str.ERROR:_file__s_not_found_at__s___d
call fcn.005950cb
add esp, 0x10
xor al, al
pop edi
pop esi
pop ebx
leave
ret 4
mov esi, str.TqTerrain
lea edi, [ebp - 0x28]
movsd dword es:[edi], dword [esi]
push dword [ebp - 4]
xor eax, eax
movsd dword es:[edi], dword [esi]
movsw word es:[edi], word [esi]
lea edi, [ebp - 0x1e]
mov esi, dword [sym.imp.MSVCRT.dll_fread]
stosd dword es:[edi], eax
push 0x10
push 1
stosw word es:[edi], ax
pop ebx
lea eax, [ebp - 0x28]
push ebx
push eax
call esi
lea eax, [ebp - 0x28]
push eax
lea eax, [ebp - 0x28]
push eax
call sub.MSVCRT.dll_strcmp
add esp, 0x18
test eax, eax
jne 0x509fb8
push dword [ebp - 4]
lea eax, [ebp - 0x14]
mov edi, 0x3e8
push ebx
push 4
push eax
mov dword [ebp - 0x14], edi
call esi
add esp, 0x10
cmp dword [ebp - 0x14], edi
jne 0x509fb8
mov edi, dword [ebp - 0x10]
push dword [ebp - 4]
lea eax, [edi + 8]
push ebx
push 4
push eax
call esi
push dword [ebp - 4]
lea eax, [edi + 0xc]
push ebx
push 4
push eax
call esi
add esp, 0x20
mov ecx, edi
push dword [edi + 0xc]
push dword [edi + 8]
call fcn.0050a405
push dword [ebp - 4]
mov ecx, edi
call fcn.0050a4a8
push dword [ebp - 4]
mov ecx, edi
call fcn.0050a8fc
push dword [ebp - 4]
and dword [ebp - 8], 0
lea eax, [ebp - 8]
push ebx
push 4
push eax
call esi
and dword [ebp - 0xc], 0
add esp, 0x10
cmp dword [ebp - 8], 0
jbe 0x50a110
mov eax, dword [edi + 0x1c]
mov ecx, dword [ebp - 0xc]
cmp dword [eax + ecx*4], 0
jne 0x50a0a4
push 0x51
push str.E:CQ2ClientRelease_18.26.83DGameMapAoxPuzzle.cpp
push str.m_vSetPuzzleUnitData_i_
push str.ASSERT
push 0x6765b8
call fcn.005950cb
add esp, 0x14
push dword [ebp - 4]
and byte [ebp + 0xb], 0
lea eax, [ebp + 0xb]
push ebx
push ebx
push eax
call esi
and dword [ebp - 0x10], 0
add esp, 0x10
cmp byte [ebp + 0xb], 0
jbe 0x50a101
lea ecx, [ebp - 0x3c]
call fcn.0050a19b
push dword [ebp - 4]
lea eax, [ebp - 0x3c]
push ebx
push 2
push eax
call esi
push dword [ebp - 4]
lea eax, [ebp - 0x38]
push ebx
push 4
push eax
call esi
mov ecx, dword [ebp - 0xc]
add esp, 0x20
lea eax, [ebp - 0x3c]
push eax
mov eax, dword [edi + 0x1c]
mov ecx, dword [eax + ecx*4]
call fcn.0050a1b5
movzx eax, byte [ebp + 0xb]
inc dword [ebp - 0x10]
cmp dword [ebp - 0x10], eax
jb 0x50a0c0
inc dword [ebp - 0xc]
mov eax, dword [ebp - 0xc]
cmp eax, dword [ebp - 8]
jb 0x50a07a
push dword [ebp - 4]
and dword [ebp - 8], 0
lea eax, [ebp - 8]
push ebx
push 4
push eax
call esi
and dword [ebp - 0x10], 0
add esp, 0x10
cmp dword [ebp - 8], 0
jbe 0x50a18a
add edi, 0x28
mov dword [ebp - 0x18], edi
mov edi, dword [ebp - 4]
or byte [ebp + 8], 0xff
push edi
push ebx
lea eax, [ebp - 0xc]
push 4
push eax
call esi
push edi
push ebx
lea eax, [ebp + 8]
push ebx
push eax
call esi
push edi
push ebx
lea eax, [ebp + 9]
push ebx
push eax
call esi
push edi
push ebx
lea eax, [ebp + 0xa]
push ebx
push eax
call esi
add esp, 0x40
lea eax, [ebp + 0xb]
push edi
push ebx
push ebx
push eax
call esi
mov ecx, dword [ebp - 0x18]
add esp, 0x10
lea eax, [ebp - 0xc]
push eax
call fcn.0050c0b6
mov ecx, dword [ebp + 8]
inc dword [ebp - 0x10]
mov dword [eax], ecx
mov eax, dword [ebp - 0x10]
cmp eax, dword [ebp - 8]
jb 0x50a133
push dword [ebp - 4]
call dword [sym.imp.MSVCRT.dll_fclose]
pop ecx
mov al, bl
jmp 0x509fba