Function at 0x509664
Capabilities:
Read file on windows

Disassembly:
push ebp
lea ebp, [esp - 0xfa8]
mov eax, 0x1028
call fcn.004fb060
mov eax, dword [0x5628b4]
xor eax, ebp
mov dword [ebp + 0xfa4], eax
push ebx
push esi
mov esi, dword [ebp + 0xfb0]
push edi
push esi
call fcn.00508e44
mov edi, eax
xor eax, eax
cmp dword [esi + 4], eax
pop ecx
mov dword [ebp - 0x70], edi
jge 0x5096a2
mov dword [esi + 4], eax
push 1
push eax
push eax
push edi
call fcn.00510224
mov ebx, edx
add esp, 0x10
test ebx, ebx
mov dword [ebp - 0x6c], eax
mov dword [ebp - 0x68], ebx
jg 0x5096cb
jl 0x5096c1
test eax, eax
jae 0x5096cb
or eax, 0xffffffff
or edx, eax
jmp 0x509928
mov eax, edi
and edi, 0x1f
imul edi, edi, 0x38
sar eax, 5
lea eax, [eax*4 + 0x5b2a20]
mov dword [ebp - 0x74], eax
mov eax, dword [eax]
add eax, edi
mov cl, byte [eax + 0x24]
add cl, cl
sar cl, 1
test word [esi + 0xc], 0x108
mov byte [ebp - 0x5d], cl
jne 0x50970a
mov eax, dword [esi + 4]
mov ecx, dword [ebp - 0x6c]
cdq
sub ecx, eax
sbb ebx, edx
mov eax, ecx
mov edx, ebx
jmp 0x509928
mov ecx, dword [esi]
mov ebx, dword [esi + 8]
mov edx, ecx
sub edx, ebx
mov ebx, dword [esi + 0xc]
test bl, 3
mov dword [ebp - 0x64], edx
je 0x509840
cmp byte [ebp - 0x5d], 1
jne 0x509818
xor ebx, ebx
cmp dword [eax + 0x30], ebx
je 0x509818
shr edx, 1
cmp dword [esi + 4], ebx
mov dword [ebp - 0x78], edx
jne 0x50974c
mov eax, dword [ebp - 0x6c]
mov edx, dword [ebp - 0x68]
jmp 0x509928
push ebx
push dword [eax + 0x2c]
push dword [eax + 0x28]
push dword [ebp - 0x70]
call fcn.00510224
mov esi, eax
mov eax, dword [ebp - 0x74]
mov eax, dword [eax]
add edi, eax
add esp, 0x10
cmp esi, dword [edi + 0x28]
mov dword [ebp - 0x7c], edx
jne 0x5096c1
cmp edx, dword [edi + 0x2c]
jne 0x5096c1
push ebx
lea eax, [ebp - 0x64]
push eax
push 0x1000
lea eax, [ebp - 0x5c]
push eax
push dword [edi]
call dword [sym.imp.KERNEL32.DLL_ReadFile]
test eax, eax
je 0x5096c1
push ebx
push dword [ebp - 0x68]
push dword [ebp - 0x6c]
push dword [ebp - 0x70]
call fcn.00510224
add esp, 0x10
cmp edx, ebx
jg 0x5097be
jl 0x5096c1
cmp eax, ebx
jb 0x5096c1
mov ecx, dword [ebp - 0x64]
mov edi, dword [ebp - 0x78]
cmp edi, ecx
ja 0x5096c1
cmp edi, ebx
lea eax, [ebp - 0x5c]
je 0x509807
lea edx, [ebp + ecx - 0x5c]
dec edi
cmp eax, edx
jae 0x509807
mov cl, byte [eax]
cmp cl, 0xd
jne 0x5097f6
lea ecx, [edx - 1]
cmp eax, ecx
jae 0x509802
lea ecx, [eax + 1]
cmp byte [ecx], 0xa
jne 0x509802
mov eax, ecx
jmp 0x509802
movzx ecx, cl
movsx ecx, byte [ecx + 0x563700]
add eax, ecx
inc eax
cmp edi, ebx
jne 0x5097d7
lea ecx, [ebp - 0x5c]
sub eax, ecx
xor edx, edx
add eax, esi
adc edx, dword [ebp - 0x7c]
jmp 0x509928
test byte [eax + 4], 0x80
je 0x509830
mov edx, dword [esi + 8]
jmp 0x50982c
cmp byte [edx], 0xa
jne 0x50982b
inc dword [ebp - 0x64]
inc edx
cmp edx, ecx
jb 0x509823
mov edx, dword [ebp - 0x6c]
or edx, dword [ebp - 0x68]
jne 0x509854
mov eax, dword [ebp - 0x64]
jmp 0x509928
test bl, bl
js 0x509830
call fcn.004fdea4
mov dword [eax], 0x16
jmp 0x5096c1
mov edx, dword [esi + 0xc]
test dl, 1
je 0x509914
mov edx, dword [esi + 4]
test edx, edx
jne 0x50986f
and dword [ebp - 0x64], edx
jmp 0x509914
sub ecx, dword [esi + 8]
add ecx, edx
test byte [eax + 4], 0x80
mov ebx, ecx
je 0x509905
push 2
push 0
push 0
push dword [ebp - 0x70]
call fcn.00510224
add esp, 0x10
cmp eax, dword [ebp - 0x6c]
jne 0x5098b6
cmp edx, dword [ebp - 0x68]
jne 0x5098b6
mov eax, dword [esi + 8]
lea ecx, [eax + ebx]
jmp 0x5098aa
cmp byte [eax], 0xa
jne 0x5098a9
inc ebx
inc eax
cmp eax, ecx
jb 0x5098a3
test word [esi + 0xc], 0x2000
jmp 0x509902
push 0
push dword [ebp - 0x68]
push dword [ebp - 0x6c]
push dword [ebp - 0x70]
call fcn.00510224
add esp, 0x10
test edx, edx
jg 0x5098db
jl 0x5096c1
test eax, eax
jb 0x5096c1
mov eax, 0x200
cmp ebx, eax
ja 0x5098f5
mov ecx, dword [esi + 0xc]
test cl, 8
je 0x5098f5
test cx, 0x400
mov ebx, eax
je 0x5098f8
mov ebx, dword [esi + 0x18]
mov eax, dword [ebp - 0x74]
mov eax, dword [eax]
test byte [eax + edi + 4], 4
je 0x509905
inc ebx
cmp byte [ebp - 0x5d], 1
jne 0x50990d
shr ebx, 1
sub dword [ebp - 0x6c], ebx
sbb dword [ebp - 0x68], 0
cmp byte [ebp - 0x5d], 1
jne 0x50991d
shr dword [ebp - 0x64], 1
mov eax, dword [ebp - 0x64]
xor edx, edx
add eax, dword [ebp - 0x6c]
adc edx, dword [ebp - 0x68]
mov ecx, dword [ebp + 0xfa4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.004fa95f
add ebp, 0xfa8
leave
ret