Function at 0x401318
Capabilities:
Read file on windows

Disassembly:
push ebp
push edi
push esi
push ebx
sub esp, 0x2c
cmp eax, 0xc800000
mov ebp, eax
mov dword [esp + 0x28], edx
mov dword [esp + 0x24], 0
mov dword [esp + 0x20], 1
jbe 0x401341
mov ebp, 0xc800000
mov edx, dword [0x40e1f8]
mov ebx, dword [0x40e1c8]
mov esi, dword [0x40e1b8]
mov ecx, edx
sub ecx, ebp
lea eax, [esi + ebx]
mov edi, ecx
mov dword [esp + 8], ebx
sub eax, edx
mov ebx, dword [0x40e208]
sub edi, esi
cmp eax, ebx
mov dword [esp + 0x18], edi
jb 0x401478
mov dword [esp + 0x1c], edx
mov dword [0x40e1e8], ecx
mov ebp, dword [esp + 8]
lea ecx, [esi + ebp]
sub ecx, dword [esp + 0x1c]
mov eax, ecx
xor edx, edx
div ebx
mov ebx, ecx
sub ebx, edx
push ecx
push ebx
push dword [esp + 0x24]
push dword [0x40e1d8]
call sub.msvcrt.dll__read
add esp, 0x10
test eax, eax
jns 0x401555
call sub.msvcrt.dll__errno
cmp dword [eax], 4
je 0x401395
mov dword [esp + 0x20], 0
mov esi, dword [esp + 0x24]
add dword [0x40e218], esi
test esi, esi
je 0x40145c
mov edx, dword [0x40e31c]
mov ebx, dword [0x40e318]
mov edi, edx
or edi, ebx
mov esi, dword [esp + 0x1c]
mov dword [esp + 0xc], 0
jne 0x401560
mov eax, dword [0x40e038]
mov dword [0x40e098], 0
mov dword [0x40b0d0], 1
mov dword [0x40e088], 0
mov dword [0x40e078], 0
mov dword [0x40e068], eax
test eax, eax
jne 0x40144b
mov edx, dword [esp + 0x24]
dec edx
xor ebx, ebx
cmp edx, 0xffffffff
mov ecx, dword [esp + 0x1c]
jne 0x401584
mov eax, 3
mov dword [0x40e068], eax
cmp eax, 2
mov edx, dword [esp + 0x24]
je 0x4015ab
mov dword [esp + 0x24], edx
mov esi, dword [esp + 0x1c]
add esi, dword [esp + 0x24]
mov dword [0x40e1f8], esi
mov eax, dword [esp + 0x20]
add esp, 0x2c
pop ebx
pop esi
pop edi
pop ebp
ret
mov ecx, dword [esp + 8]
sub ecx, ebx
lea edi, [ebp + ebx]
lea edx, [ecx - 1]
jmp 0x4014a1
lea ecx, [edx + edx]
cmp ecx, edx
jb 0x401721
lea edx, [ecx + ebx + 1]
cmp edx, ecx
jb 0x401721
mov edx, ecx
cmp edx, edi
jb 0x401488
mov ecx, dword [esp + 0x28]
movzx eax, word [ecx + 0xe]
and eax, 0xf000
cmp eax, 0x8000
je 0x4016ed
lea eax, [edx + ebx + 1]
cmp dword [esp + 8], eax
mov edi, esi
jb 0x4016c9
lea ecx, [edi + ebp]
lea eax, [ecx + 1]
xor edx, edx
mov dword [esp + 4], eax
div ebx
test edx, edx
mov eax, dword [esp + 4]
mov dword [esp + 0x1c], eax
je 0x4014f1
sub ebx, edx
lea ecx, [ecx + ebx + 1]
mov dword [esp + 0x1c], ecx
mov edx, dword [esp + 0x1c]
push ebx
push ebp
sub edx, ebp
mov ebp, esi
add ebp, dword [esp + 0x20]
push ebp
push edx
mov dword [0x40e1e8], edx
call sub.msvcrt.dll_memmove
mov esi, dword [0x40e1e8]
mov bl, byte [0x40e6a8]
mov byte [esi - 1], bl
mov esi, dword [0x40e1b8]
add esp, 0x10
cmp edi, esi
je 0x4016bb
sub esp, 0xc
push esi
call sub.msvcrt.dll_free
mov esi, edi
mov dword [0x40e1b8], edi
add esp, 0x10
mov edi, dword [0x40e1c8]
mov dword [esp + 8], edi
mov ebx, dword [0x40e208]
jmp 0x401380
mov dword [esp + 0x24], eax
jmp 0x4013c3
mov eax, dword [0x40e068]
jmp 0x401429
test edx, edx
je 0x40157c
cmp byte [ecx + 1], 0xa
jne 0x40157c
mov ebx, 1
nop
dec edx
inc ecx
cmp edx, 0xffffffff
je 0x401599
nop
mov al, byte [ecx]
test al, al
je 0x401726
cmp al, 0xd
je 0x40156c
dec edx
inc ecx
cmp edx, 0xffffffff
jne 0x401584
test ebx, ebx
mov eax, 2
jne 0x401446
jmp 0x401441
mov edi, dword [esp + 0x1c]
mov ebx, edx
lea esi, [esi]
dec ebx
cmp ebx, 0xffffffff
je 0x4015ce
mov al, byte [esi]
cmp al, 0xd
je 0x4015dc
mov byte [edi], al
dec ebx
inc esi
inc edi
inc dword [esp + 0xc]
cmp ebx, 0xffffffff
jne 0x4015ba
mov edx, dword [esp + 0xc]
mov dword [esp + 0x24], edx
jmp 0x40145c
mov ecx, dword [0x40e298]
inc esi
test ecx, ecx
je 0x4015b4
mov eax, dword [0x40e028]
test eax, eax
jne 0x4015b4
inc dword [0x40e078]
test ebx, ebx
je 0x401609
cmp byte [esi], 0xd
jne 0x401609
inc dword [0x40e078]
inc esi
dec ebx
jne 0x4015fa
mov ebp, dword [0x40e058]
dec ebp
mov edx, dword [0x40e098]
cmp ebp, edx
jg 0x40164b
test edx, edx
mov eax, 0x3e8
je 0x401626
lea eax, [edx + edx]
sub esp, 8
mov dword [0x40e058], eax
shl eax, 3
push eax
push dword [0x40e398]
call fcn.00406b28
mov dword [0x40e398], eax
add esp, 0x10
mov edx, dword [0x40e098]
test edx, edx
jne 0x401730
mov ebp, dword [0x40e398]
mov dword [ebp], 0
mov dword [ebp + 4], 0
mov dword [0x40e098], 1
mov dword [ebp + 0xc], 0
mov dl, 1
lea ecx, [edx + 1]
mov edx, edi
sub edx, dword [0x40e1e8]
mov dword [0x40e098], ecx
add edx, dword [0x40e318]
cmp byte [esi], 0xa
mov eax, edx
je 0x40173b
mov dword [ebp + ecx*8 - 8], eax
mov eax, dword [0x40e078]
mov dword [ebp + ecx*8 + 4], eax
lea eax, [edx + 1]
mov dword [0x40e088], ecx
mov dword [ebp + ecx*8], eax
jmp 0x4015b4
mov eax, dword [0x40e1c8]
mov dword [esp + 8], eax
jmp 0x40154a
sub esp, 0xc
push eax
mov dword [0x40e1c8], eax
call fcn.00406ad4
mov edi, eax
add esp, 0x10
mov esi, dword [0x40e1b8]
mov ebx, dword [0x40e208]
jmp 0x4014cd
mov eax, dword [ecx + 0x20]
sub eax, dword [0x40e218]
test eax, eax
lea ecx, [ebp + eax]
js 0x4014bd
cmp eax, ecx
jg 0x4014bd
cmp ecx, edi
jb 0x4014bd
cmp ecx, edx
jae 0x4014bd
mov edx, ecx
jmp 0x4014bd
call fcn.00406a94
mov eax, 1
jmp 0x401446
mov ebp, dword [0x40e398]
jmp 0x40167a
lea eax, [edx + 1]
jmp 0x40169c