Function at 0x406520
Capabilities:
Read file on windows

Disassembly:
mov eax, dword [esi + 0x28]
sub esp, 8
push ebp
push 0x2000
lea ecx, [eax + 0x20000]
push ecx
push eax
call fcn.0040ad10
mov ebp, dword [esi + 0x28]
mov eax, dword [esi + 0x10]
add esp, 0xc
add ebp, 0x2000
cmp eax, 0x20000
mov dword [esi + 0x30], 0x2000
jae 0x40655e
mov edx, eax
mov dword [esp + 4], edx
jmp 0x40656a
mov dword [esp + 4], 0x20000
mov edx, dword [esp + 4]
sub eax, edx
test edx, edx
mov dword [esi + 0x10], eax
mov dword [esi + 0x2c], edx
je 0x4067db
push ebx
push edi
lea esp, [esp]
cmp dword [esi + 0x20], 0
jne 0x40673f
mov eax, dword [esi + 0x18]
cmp eax, 8
jae 0x4065f6
cmp dword [esi + 0x38], 0
jbe 0x4065f6
test eax, eax
je 0x4065af
mov ecx, dword [esi + 0x14]
mov edx, dword [esi + 0x1c]
push eax
add edx, ecx
push edx
push ecx
call fcn.0040ad10
add esp, 0xc
mov ecx, dword [esi + 0x18]
mov edx, dword [esi + 0x38]
mov eax, 0x10000
sub eax, ecx
cmp eax, edx
mov dword [esp + 0x10], eax
jbe 0x4065ca
mov eax, edx
mov dword [esp + 0x10], eax
push 0
lea edx, [esp + 0x14]
push edx
push eax
mov eax, dword [esi + 0x14]
add eax, ecx
mov ecx, dword [esi]
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esp + 0x10]
add dword [esi + 0x18], eax
sub dword [esi + 0x38], eax
mov edx, dword [esp + 0xc]
mov dword [esi + 0x1c], 0
mov edi, dword [esi + 0x1c]
mov eax, dword [esi + 0x14]
mov cl, byte [eax + edi]
add eax, edi
add eax, 1
cmp cl, 0x20
jae 0x406680
cmp cl, 0x1d
jae 0x406620
movzx ecx, cl
add ecx, 1
mov dword [esi + 0x24], 0
jmp 0x40672f
jne 0x406637
movzx ecx, byte [eax]
add ecx, 0x1e
add eax, 1
mov dword [esi + 0x24], 0
jmp 0x40672f
cmp cl, 0x1e
jne 0x406658
xor ecx, ecx
mov ch, byte [eax]
mov cl, byte [eax + 1]
mov dword [esi + 0x24], 0
add ecx, 0x11e
add eax, 2
jmp 0x40672f
movzx ebx, byte [eax + 2]
xor ecx, ecx
mov ch, byte [eax]
mov cl, byte [eax + 1]
shl ecx, 8
or ecx, ebx
movzx ebx, byte [eax + 3]
shl ecx, 8
or ecx, ebx
add eax, 4
mov dword [esi + 0x24], 0
jmp 0x40672f
test cl, cl
jns 0x4066a2
movzx ebx, byte [eax]
movzx edx, cl
mov ecx, edx
and edx, 0x1f
shr ecx, 5
shl edx, 8
and ecx, 3
or edx, ebx
add eax, 1
jmp 0x406722
mov dl, cl
and dl, 0x60
cmp dl, 0x20
jne 0x4066bc
movzx ecx, cl
mov edx, ecx
shr edx, 2
and edx, 7
and ecx, 3
jmp 0x406722
and ecx, 0x1f
cmp dl, 0x40
movzx edx, byte [eax]
jne 0x4066cf
add ecx, 4
add eax, 1
jmp 0x406722
shl ecx, 8
or ecx, edx
add eax, 1
mov edx, ecx
movzx ecx, byte [eax]
add eax, 1
cmp ecx, 0xfe
jne 0x4066f9
xor ecx, ecx
mov ch, byte [eax]
mov cl, byte [eax + 1]
add ecx, 0x102
add eax, 2
jmp 0x406722
cmp ecx, 0xff
jne 0x40671f
movzx ebx, byte [eax + 2]
xor ecx, ecx
mov ch, byte [eax]
mov cl, byte [eax + 1]
shl ecx, 8
or ecx, ebx
movzx ebx, byte [eax + 3]
shl ecx, 8
or ecx, ebx
add eax, 4
jmp 0x406722
add ecx, 4
add edx, 1
mov dword [esi + 0x24], edx
mov edx, dword [esp + 0xc]
add ecx, 3
sub eax, dword [esi + 0x14]
mov dword [esi + 0x20], ecx
sub eax, edi
sub dword [esi + 0x18], eax
add edi, eax
mov dword [esi + 0x1c], edi
mov eax, dword [esi + 0x20]
cmp eax, edx
mov edi, eax
jb 0x40674a
mov edi, edx
mov ecx, dword [esi + 0x24]
sub eax, edi
sub edx, edi
test ecx, ecx
mov dword [esi + 0x20], eax
mov dword [esp + 0xc], edx
je 0x406778
mov eax, ebp
sub eax, ecx
test edi, edi
je 0x4067d1
mov cl, byte [eax]
sub edi, 1
mov byte [ebp], cl
add ebp, 1
add eax, 1
test edi, edi
jne 0x406764
jmp 0x4067d1
mov eax, dword [esi + 0x18]
cmp eax, edi
lea ebx, [esi + 0x18]
jae 0x4067b5
mov edx, dword [esi + 0x14]
add edx, dword [esi + 0x1c]
push eax
push edx
push ebp
call fcn.0040ad10
mov eax, dword [ebx]
mov ecx, dword [esi]
add esp, 0xc
push 0
push ebx
sub edi, eax
add ebp, eax
mov eax, dword [esi + 0x14]
push 0x10000
push eax
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov dword [esi + 0x1c], 0
mov edx, dword [esi + 0x14]
add edx, dword [esi + 0x1c]
push edi
push edx
push ebp
call fcn.0040ad10
add dword [esi + 0x1c], edi
sub dword [ebx], edi
mov edx, dword [esp + 0x18]
add esp, 0xc
add ebp, edi
test edx, edx
jne 0x406580
pop edi
pop ebx
xor eax, eax
pop ebp
add esp, 8
ret