Function at 0x51585c
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
add esp, 0xfffffff4
push ebx
push esi
push edi
mov dword [ebp - 4], edx
mov edi, eax
mov eax, dword [ebp - 4]
call fcn.004040c8
xor eax, eax
push ebp
push 0x515aac
push dword fs:[eax]
mov dword fs:[eax], esp
xor ebx, ebx
mov eax, dword [ebp - 4]
call fcn.00408adc
test al, al
je 0x515a96
cmp byte [edi + 0x4c], 0
je 0x51589f
mov eax, edi
call fcn.00515b54
push 0
push 0x80
push 3
push 0
push 3
push 0x80000000
mov eax, dword [ebp - 4]
call fcn.004040d8
push eax
call sub.kernel32.dll_CreateFileA_1
mov esi, eax
cmp esi, 0xffffffff
je 0x515a96
push 0
lea eax, [ebp - 8]
push eax
push 4
lea eax, [ebp - 0xc]
push eax
push esi
call sub.kernel32.dll_ReadFile_1
test eax, eax
jne 0x515908
lea eax, [edi + 0x1054]
mov edx, 0x515ac4
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
push esi
call sub.kernel32.dll_CloseHandle_1
jmp 0x515a96
cmp dword [ebp - 8], 4
je 0x515936
lea eax, [edi + 0x1054]
mov edx, 0x515ae8
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
push esi
call sub.kernel32.dll_CloseHandle_1
jmp 0x515a96
push esi
call sub.kernel32.dll_CloseHandle_1
xor eax, eax
mov dword [ebp - 8], eax
push 0
push 0x8000080
push 3
push 0
push 3
push 0x80000000
mov eax, dword [ebp - 4]
call fcn.004040d8
push eax
call sub.kernel32.dll_CreateFileA_1
mov esi, eax
mov dword [edi + 0x3c], esi
cmp esi, 0xffffffff
jne 0x51598d
lea eax, [edi + 0x1054]
mov edx, 0x515b14
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
jmp 0x515a96
lea eax, [ebp - 0xc]
push eax
movsx eax, byte [edi + 0x34]
push eax
call sub.XPlayDLL.dll_X_PlayM4_GetFileHeadLength
mov dword [edi + 0x44], eax
push 0
push edi
mov eax, 0x51570c
push eax
push 0x2800
movsx eax, byte [edi + 0x34]
push eax
call sub.XPlayDLL.dll_X_PlayM4_SetSourceBufCallBack
push 1
movsx eax, byte [edi + 0x34]
push eax
call sub.XPlayDLL.dll_X_PlayM4_SetStreamOpenMode
push 0
lea eax, [ebp - 8]
push eax
mov eax, dword [edi + 0x44]
push eax
lea eax, [edi + 0x54]
push eax
mov eax, dword [edi + 0x3c]
push eax
call sub.kernel32.dll_ReadFile_1
test eax, eax
jne 0x515a08
lea eax, [edi + 0x1054]
mov edx, 0x515ac4
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
mov eax, dword [edi + 0x3c]
push eax
call sub.kernel32.dll_CloseHandle_1
jmp 0x515a96
mov eax, dword [ebp - 8]
cmp eax, dword [edi + 0x44]
je 0x515a2f
lea eax, [edi + 0x1054]
mov edx, 0x515ae8
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
jmp 0x515a96
mov eax, dword [edi + 0x44]
push eax
lea eax, [edi + 0x54]
push eax
movsx eax, byte [edi + 0x34]
push eax
call sub.XPlayDLL.dll_X_PlayM4_OpenStream
test eax, eax
jne 0x515a6d
lea eax, [edi + 0x1054]
mov edx, 0x515b38
call fcn.00403ce8
push edi
push fcn.005157bc
mov eax, edi
call fcn.00417db0
mov eax, dword [edi + 0x3c]
push eax
call sub.kernel32.dll_CloseHandle_1
jmp 0x515a96
push 0
movsx eax, byte [edi + 0x34]
push eax
call sub.XPlayDLL.dll_X_PlayM4_ThrowBFrameNum
mov byte [edi + 0x4c], 4
push 0
push 0
push 0xffffffffffffffff
push 0
call sub.kernel32.dll_CreateEventA
mov dword [edi + 0x50], eax
mov eax, edi
call fcn.00515ba8
mov bl, 1
xor eax, eax
pop edx
pop ecx
pop ecx
mov dword fs:[eax], edx
push 0x515ab3
lea eax, [ebp - 4]
call fcn.00403c94
ret