Function at 0x40a6c0
Capabilities:
Read file on windows

Disassembly:
sub esp, 0x28
push ebp
mov ebp, dword [ebx + 4]
mov dword [esp + 4], 0
mov ecx, dword [ebp + 0x138]
push esi
mov esi, dword [esp + 0x34]
lea eax, [ecx - 1]
test esi, eax
mov dword [esp + 0x24], ebp
jne 0x40ab59
mov edx, dword [esp + 0x3c]
test edx, edx
je 0x40ab59
mov eax, dword [ebx + 0xc]
mov eax, dword [eax + 0xc]
add edx, esi
cmp edx, eax
jbe 0x40a709
mov edx, eax
sub edx, esi
mov dword [esp + 0x3c], edx
sub eax, esi
mov dword [esp + 0x18], eax
xor edx, edx
mov eax, esi
div ecx
push edi
xor edx, edx
mov edi, eax
mov eax, dword [esp + 0x40]
div ecx
mov dword [esp + 0x14], edi
test edx, edx
mov dword [esp + 0x10], eax
je 0x40a731
inc eax
mov dword [esp + 0x10], eax
mov eax, dword [ebx + 0xc]
mov ecx, dword [eax + 0x10]
test ch, 0xff
je 0x40a8b3
mov eax, dword [ebx + 0x30]
test eax, eax
jne 0x40a8b3
mov eax, dword [ebx + 0x18]
cmp eax, dword [ebp + 0x128]
jne 0x40a761
mov ecx, dword [ebx + 0x1c]
cmp ecx, dword [ebp + 0x12c]
je 0x40a778
mov eax, dword [ebx + 0x18]
mov ecx, dword [ebp + 0x108]
push 0
lea edx, [ebx + 0x1c]
push edx
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov esi, dword [ebx + 0x2c]
mov eax, dword [ebx + 0x28]
mov ecx, dword [ebp + 0x108]
push 0
lea edx, [esp + 0x10]
push edx
lea esi, [esi*8 + 8]
push esi
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov ecx, dword [ebx + 0x28]
mov eax, dword [esp + 0xc]
mov edi, dword [ecx]
xor edx, edx
cmp edi, eax
jne 0x40a7b1
mov ecx, dword [ecx + 4]
cmp ecx, edx
je 0x40a7bf
mov eax, dword [ebx + 0xc]
or dword [eax + 0x10], 0x20000
mov eax, dword [esp + 0xc]
mov edx, dword [ebx + 0xc]
test dword [edx + 0x10], 0x20000
je 0x40a88c
mov ecx, dword [ebx + 0x10]
test ecx, ecx
jne 0x40a7ea
push eax
mov eax, dword [ebx + 0x28]
push eax
call fcn.0040edb0
mov dword [ebx + 0x10], eax
mov eax, dword [esp + 0x14]
add esp, 8
mov ecx, dword [ebx + 0x10]
test ecx, ecx
je 0x40a917
dec ecx
push ecx
mov ecx, dword [ebx + 0x28]
push eax
push ecx
call fcn.0040efc0
mov ecx, dword [ebx + 0x28]
mov eax, dword [esp + 0x18]
mov edi, dword [ecx]
add esp, 0xc
xor edx, edx
cmp edi, eax
jne 0x40a81a
mov ecx, dword [ecx + 4]
cmp ecx, edx
je 0x40a88c
mov eax, dword [ebx + 0x18]
mov ecx, dword [ebp + 0x108]
push 0
lea edx, [ebx + 0x1c]
push edx
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov eax, dword [ebx + 0x28]
mov ecx, dword [ebp + 0x108]
push 0
lea edx, [esp + 0x10]
push edx
push esi
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edx, dword [esp + 0xc]
mov eax, dword [ebx + 0x28]
push edx
push eax
call fcn.0040edb0
mov ecx, dword [esp + 0x14]
mov edx, dword [ebx + 0x28]
mov dword [ebx + 0x10], eax
dec eax
push eax
push ecx
push edx
call fcn.0040efc0
mov ecx, dword [ebx + 0x28]
mov eax, dword [esp + 0x20]
mov esi, dword [ecx]
add esp, 0x14
xor edx, edx
cmp esi, eax
jne 0x40a917
mov ecx, dword [ecx + 4]
cmp ecx, edx
jne 0x40a917
mov esi, dword [ebx + 0x18]
mov ecx, dword [ebx + 0x1c]
mov edi, dword [esp + 0x14]
xor edx, edx
add eax, esi
mov esi, dword [esp + 0x38]
adc edx, ecx
mov dword [ebp + 0x128], eax
mov dword [ebp + 0x12c], edx
mov dword [ebx + 0x30], 1
mov eax, dword [ebx + 0xc]
xor edx, edx
test byte [eax + 0x11], 0xff
mov ecx, esi
mov esi, dword [esp + 0x40]
je 0x40a8d9
mov eax, dword [ebx + 0x28]
mov esi, dword [esp + 0x10]
mov ecx, dword [eax + edi*8]
mov edx, dword [eax + edi*8 + 4]
add esi, edi
mov esi, dword [eax + esi*8]
sub esi, ecx
mov eax, dword [ebx + 0x18]
mov edi, dword [esp + 0x3c]
add eax, ecx
mov ecx, dword [ebx + 0x1c]
adc ecx, edx
mov edx, dword [ebx + 0xc]
mov dword [esp + 0x2c], eax
mov dword [esp + 0x30], ecx
test byte [edx + 0x11], 0xff
mov dword [esp + 0x18], edi
je 0x40a93e
push esi
call fcn.0042a10c
mov edi, eax
add esp, 4
test edi, edi
mov dword [esp + 0x18], edi
jne 0x40a920
push 8
call dword [sym.imp.KERNEL32.dll_SetLastError]
pop edi
pop esi
xor eax, eax
pop ebp
add esp, 0x28
ret
mov ecx, esi
mov edx, ecx
shr ecx, 2
xor eax, eax
rep stosd dword es:[edi], eax
mov ecx, edx
and ecx, 3
rep stosb byte es:[edi], al
mov eax, dword [esp + 0x2c]
mov ecx, dword [esp + 0x30]
mov edi, dword [esp + 0x18]
mov edx, dword [ebp + 0x128]
cmp edx, eax
jne 0x40a952
mov edx, dword [ebp + 0x12c]
cmp edx, ecx
je 0x40a967
mov edx, dword [ebp + 0x108]
push 0
lea ecx, [esp + 0x34]
push ecx
push eax
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov ecx, dword [ebp + 0x108]
push 0
lea eax, [esp + 0x10]
push eax
push esi
push edi
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov edx, dword [esp + 0xc]
mov ecx, dword [esp + 0x2c]
mov esi, dword [esp + 0x30]
xor eax, eax
add edx, ecx
adc eax, esi
mov dword [ebp + 0x12c], eax
mov eax, dword [esp + 0x40]
mov dword [ebp + 0x128], edx
mov ebp, dword [ebp + 0x138]
xor esi, esi
cmp eax, ebp
mov dword [esp + 0x20], esi
jae 0x40a9b1
mov ebp, eax
cmp dword [esp + 0x10], esi
mov ecx, dword [esp + 0x14]
mov dword [esp + 0x14], ecx
mov dword [esp + 0xc], esi
mov dword [esp + 0x24], esi
jbe 0x40ab36
jmp 0x40a9d0
mov edx, dword [esp + 0x28]
mov eax, dword [edx + 0x138]
mov ecx, dword [esp + 0x1c]
add esi, edi
cmp ecx, eax
mov dword [esp + 0x38], eax
jae 0x40a9ee
mov eax, ecx
mov dword [esp + 0x38], eax
mov edx, dword [ebx + 0xc]
mov edi, dword [edx + 0x10]
test edi, 0xff00
je 0x40aa0b
mov ebp, dword [esp + 0x14]
mov ecx, dword [ebx + 0x28]
lea ecx, [ecx + ebp*8]
mov ebp, dword [ecx + 8]
sub ebp, dword [ecx]
test edi, 0x20000
je 0x40aa72
mov eax, dword [ebx + 0x10]
test eax, eax
jne 0x40aa52
mov edx, dword [edx + 0xc]
push 0x45564157
sub edx, 8
push edx
push 0x46464952
push 3
push esi
call fcn.0040ee50
add esp, 0x14
test eax, eax
mov dword [ebx + 0x10], eax
jne 0x40aa52
push 3
push 0x905a4d
push 2
push esi
call fcn.0040ee50
add esp, 0x10
mov dword [ebx + 0x10], eax
mov eax, dword [ebx + 0x10]
test eax, eax
je 0x40a917
mov ecx, dword [esp + 0x14]
add eax, ecx
push eax
push ebp
push esi
call fcn.0040efc0
mov eax, dword [esp + 0x44]
add esp, 0xc
cmp ebp, eax
jae 0x40aad2
mov edx, dword [ebx + 0xc]
mov ecx, dword [edx + 0x10]
test ch, 2
je 0x40aa99
mov ecx, dword [esp + 0x3c]
push ebp
push esi
lea eax, [esp + 0x40]
push eax
push ecx
call fcn.0040f450
mov eax, dword [esp + 0x48]
add esp, 0x10
mov edx, dword [ebx + 0xc]
mov ecx, dword [edx + 0x10]
test ch, 1
je 0x40aabc
mov ecx, dword [esp + 0x3c]
push ebp
push esi
lea eax, [esp + 0x40]
push eax
push ecx
call fcn.0040fbf0
mov eax, dword [esp + 0x48]
add esp, 0x10
mov edx, dword [esp + 0xc]
mov ecx, dword [esp + 0x3c]
add edx, eax
add ecx, eax
mov dword [esp + 0xc], edx
mov dword [esp + 0x3c], ecx
jmp 0x40ab00
mov edx, dword [esp + 0x3c]
cmp edx, esi
je 0x40aaf0
mov ecx, ebp
mov eax, ecx
shr ecx, 2
mov edi, edx
rep movsd dword es:[edi], dword [esi]
mov ecx, eax
and ecx, 3
rep movsb byte es:[edi], byte [esi]
mov eax, dword [esp + 0x38]
mov esi, dword [esp + 0xc]
add esi, ebp
add edx, ebp
mov dword [esp + 0xc], esi
mov dword [esp + 0x3c], edx
mov ecx, dword [esp + 0x1c]
mov esi, dword [esp + 0x20]
mov edx, dword [esp + 0x14]
mov edi, dword [esp + 0x18]
sub ecx, eax
mov eax, dword [esp + 0x24]
add esi, ebp
inc eax
mov dword [esp + 0x1c], ecx
mov ecx, dword [esp + 0x10]
inc edx
cmp eax, ecx
mov dword [esp + 0x20], esi
mov dword [esp + 0x24], eax
mov dword [esp + 0x14], edx
jb 0x40a9d0
mov ecx, dword [ebx + 0xc]
mov eax, dword [ecx + 0x10]
test ah, 0xff
je 0x40ab4e
test edi, edi
je 0x40ab4e
push edi
call fcn.0042a11e
add esp, 4
mov eax, dword [esp + 0xc]
pop edi
pop esi
pop ebp
add esp, 0x28
ret
pop esi
xor eax, eax
pop ebp
add esp, 0x28
ret