Function at 0x51b610
Capabilities:
Check if file exists
Get file size
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5a3488
mov eax, dword fs:[0]
push eax
sub esp, 0x74
mov eax, dword [0x6121d4]
xor eax, ebp
mov dword [ebp - 0x10], eax
push ebx
push esi
push edi
push eax
lea eax, [ebp - 0xc]
mov dword fs:[0], eax
mov dword [ebp - 0x80], edx
mov esi, ecx
mov ebx, dword [ebp + 0xc]
sub esp, 0x18
mov ecx, esp
mov dword [ebp - 0x78], esp
mov dword [ecx + 0x14], 7
mov dword [ecx + 0x10], 0
cmp dword [ecx + 0x14], 8
jb 0x51b663
mov eax, dword [ecx]
jmp 0x51b665
mov eax, ecx
xor edx, edx
push 0xffffffffffffffff
push edx
push esi
mov word [eax], dx
call fcn.004abb60
mov dword [ebp - 4], 0
call fcn.00519e40
mov ecx, eax
mov dword [ebp - 4], 0xffffffff
call fcn.00519ed0
or edi, 0xffffffff
cmp dword [esi + 0x14], 8
jb 0x51b698
mov esi, dword [esi]
push 0
push 0
push 3
push 0
push 7
push 1
push esi
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov dword [ebp - 0x78], eax
cmp eax, 0xffffffff
je 0x51b8a8
push 0
push eax
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov dword [ebp - 0x7c], eax
cmp eax, 0xffffffff
je 0x51b898
add eax, 2
push eax
call fcn.00573126
mov esi, eax
add esp, 4
test esi, esi
je 0x51b898
push 0
lea eax, [ebp - 0x74]
mov dword [ebp - 0x74], 0
push eax
push dword [ebp - 0x7c]
push esi
push dword [ebp - 0x78]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x51b882
mov eax, dword [ebp - 0x74]
cmp eax, dword [ebp - 0x7c]
jne 0x51b882
mov byte [eax + esi], 0
mov eax, dword [ebp - 0x74]
mov byte [eax + esi + 1], 0
mov eax, dword [ebp - 0x80]
mov eax, dword [eax]
test eax, eax
je 0x51b7d0
cmp eax, 2
jne 0x51b77a
push esi
mov ecx, ebx
call fcn.004b2170
cmp byte [ebp + 8], 0
je 0x51b880
push 0xffffffffffffffff
push 1
lea eax, [ebp - 0x28]
mov ecx, ebx
push eax
call fcn.004b9450
push eax
mov ecx, ebx
call fcn.004b21e0
lea ecx, [ebp - 0x28]
call fcn.004ab5f0
push esi
xor edi, edi
call fcn.005730b8
add esp, 4
push dword [ebp - 0x78]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, edi
jmp 0x51b8ce
cmp eax, 1
jne 0x51b7b5
lea eax, [esi + 3]
push eax
lea ecx, [ebp - 0x28]
call fcn.004b22d0
mov dword [ebp - 4], 1
lea edx, [ebp - 0x28]
lea ecx, [ebp - 0x40]
call fcn.00520230
push eax
mov ecx, ebx
call fcn.004b21e0
lea ecx, [ebp - 0x40]
call fcn.004ab5f0
lea ecx, [ebp - 0x28]
jmp 0x51b874
cmp eax, 3
jne 0x51b882
push esi
lea ecx, [ebp - 0x28]
call fcn.004b22d0
mov dword [ebp - 4], 2
jmp 0x51b792
mov al, byte [esi]
cmp al, 0xff
jne 0x51b81e
cmp byte [esi + 1], 0xfe
jne 0x51b81e
push esi
mov ecx, ebx
call fcn.004b2170
push 0xffffffffffffffff
push 1
lea eax, [ebp - 0x40]
mov ecx, ebx
push eax
call fcn.004b9450
push eax
mov ecx, ebx
call fcn.004b21e0
lea ecx, [ebp - 0x40]
call fcn.004ab5f0
push esi
xor edi, edi
call fcn.005730b8
add esp, 4
push dword [ebp - 0x78]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, edi
jmp 0x51b8ce
cmp al, 0xef
jne 0x51b846
cmp byte [esi + 1], 0xbb
jne 0x51b846
cmp byte [esi + 2], 0xbf
jne 0x51b846
lea eax, [esi + 3]
push eax
lea ecx, [ebp - 0x28]
call fcn.004b22d0
mov dword [ebp - 4], 3
jmp 0x51b792
push esi
lea ecx, [ebp - 0x58]
call fcn.004b22d0
lea edx, [ebp - 0x58]
mov dword [ebp - 4], 4
lea ecx, [ebp - 0x70]
call fcn.00520230
push eax
mov ecx, ebx
call fcn.004b21e0
lea ecx, [ebp - 0x70]
call fcn.004ab5f0
lea ecx, [ebp - 0x58]
mov dword [ebp - 4], 0xffffffff
call fcn.004b2290
xor edi, edi
push esi
call fcn.005730b8
add esp, 4
push dword [ebp - 0x78]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, edi
jmp 0x51b8ce
or edi, 0xffffffff
push dword [ebp - 0x78]
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, edi
jmp 0x51b8ce
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 2
jb 0x51b8cb
cmp eax, 3
jbe 0x51b8c4
cmp eax, 5
jne 0x51b8cb
mov eax, 0xffffffea
jmp 0x51b8ce
mov eax, 0xffffffe4
jmp 0x51b8ce
or eax, 0xffffffff
mov ecx, dword [ebp - 0xc]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 0x10]
xor ecx, ebp
call fcn.00540c56
mov esp, ebp
pop ebp
ret