Function at 0x51c320
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
push 0xffffffffffffffff
push 0x5a6a70
mov eax, dword fs:[0]
push eax
sub esp, 0x50
mov eax, dword [0x5f300c]
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 edi, ecx
cmp dword [edi + 0x38], 0
je 0x51c54a
push ecx
push 0x20000
lea ecx, [ebp - 0x5c]
call fcn.0040a750
mov dword [ebp - 4], 0
push dword [edi + 0x38]
mov ebx, dword [ebp - 0x5c]
push 0x20000
push 1
push ebx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov esi, eax
push esi
push ebx
call fcn.0050e8a0
add esp, 0x18
mov dword [ebp - 0x50], eax
test esi, esi
jne 0x51c3a8
mov ecx, dword [edi + 0x4c]
cmp ecx, 2
je 0x51c3a0
cmp ecx, 4
jne 0x51c3a8
mov eax, 4
mov dword [ebp - 0x50], eax
mov ecx, dword [edi + 0x4c]
cmp ecx, 1
je 0x51c3e0
cmp ecx, 3
je 0x51c3e0
test eax, eax
jne 0x51c3e7
cmp ecx, 2
je 0x51c3c3
cmp ecx, 4
jne 0x51c3e7
push ecx
mov edx, esi
mov ecx, ebx
call fcn.0055f260
mov ecx, dword [edi + 0x4c]
add esp, 4
test eax, eax
je 0x51c3e7
mov dword [ebp - 0x50], 4
jmp 0x51c3e7
mov dword [ebp - 0x50], 3
cmp ecx, 3
sete al
cmp dword [ebp - 0x50], 0
mov dl, al
jne 0x51c403
cmp ecx, 1
je 0x51c3ff
cmp ecx, 3
jne 0x51c403
mov al, 1
jmp 0x51c405
xor al, al
push edx
push eax
lea ecx, [ebp - 0x4c]
call fcn.0055ef20
mov byte [ebp - 4], 1
test esi, esi
je 0x51c4db
jmp 0x51c420
cmp dword [edi + 0x34], 0
jne 0x51c4db
mov al, byte [edi + 5]
test al, al
jne 0x51c4d8
push dword [edi + 0x48]
call dword [sym.imp.KERNEL32.dll_Sleep]
mov ebx, dword [ebp - 0x5c]
lea ecx, [ebp - 0x4c]
push esi
push ebx
call fcn.0055efc0
mov edx, dword [edi + 0x58]
mov esi, eax
push esi
push dword [ebp - 0x44]
mov ecx, dword [edx]
push edx
call dword [ecx + 4]
mov dword [edi + 0x34], eax
lea eax, [edi + 0xc]
lock xadd dword [eax], esi
push 0
lea ecx, [edi + 0x40]
call fcn.0051c0d0
fcomp qword [edi + 0x50]
fnstsw ax
test ah, 0x41
jne 0x51c495
push 0
lea ecx, [edi + 0x40]
call fcn.0051c0d0
fadd qword [0x5de418]
mov ecx, dword [edi + 0x10]
push edi
push 3
fstp qword [edi + 0x50]
mov eax, dword [ecx]
call dword [eax]
push dword [edi + 0x38]
push 0x20000
push 1
push ebx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
mov esi, eax
add esp, 0x10
test esi, esi
jne 0x51c420
cmp dword [edi + 0x34], eax
jne 0x51c4db
push eax
push eax
lea ecx, [ebp - 0x4c]
call fcn.0055efc0
test eax, eax
je 0x51c4db
mov edx, dword [edi + 0x58]
push eax
push dword [ebp - 0x44]
mov ecx, dword [edx]
push edx
call dword [ecx + 4]
mov dword [edi + 0x34], eax
jmp 0x51c4db
mov ebx, dword [ebp - 0x5c]
push dword [edi + 0x38]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov eax, dword [ebp - 0x4c]
add esp, 4
mov dword [edi + 0x38], 0
mov dword [edi + 0x60], eax
test eax, eax
jne 0x51c500
mov eax, dword [ebp - 0x50]
mov dword [edi + 0x60], eax
jmp 0x51c510
cmp eax, 3
je 0x51c510
push dword [ebp - 0x44]
call fcn.0059e230
add esp, 4
mov dword [ebp - 4], 0xffffffff
test ebx, ebx
je 0x51c54a
mov ecx, dword [ebp - 0x54]
mov eax, ebx
sub ecx, ebx
cmp ecx, 0x1000
jb 0x51c540
mov ebx, dword [ebx - 4]
add ecx, 0x23
sub eax, ebx
add eax, 0xfffffffc
cmp eax, 0x1f
jbe 0x51c540
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__invalid_parameter_noinfo_noreturn]
push ecx
push ebx
call fcn.0059e222
add esp, 8
mov cl, 1
lea eax, [edi + 4]
xchg byte [eax], cl
mov ecx, dword [edi + 0x10]
push edi
push 1
mov eax, dword [ecx]
call dword [eax]
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.0059df64
mov esp, ebp
pop ebp
ret