Function at 0x402020
Capabilities:
Read file on windows

Disassembly:
lea ecx, [esp + 4]
and esp, 0xfffffff0
push dword [ecx - 4]
push ebp
mov ebp, esp
push edi
push esi
push ebx
push ecx
mov ebx, ecx
sub esp, 0x48
call fcn.00401320
push ecx
push ecx
push 0x40b5e2
push 2
call sub.msvcrt.dll_setlocale
pop eax
lea eax, [ebx + 4]
pop edx
push eax
push ebx
call fcn.00404aa0
mov esi, dword [sym.imp.msvcrt.dll__iob]
add esp, 0x10
add esi, 0x40
sub esp, 0xc
push 0
push 0x40a060
push 0x40b5e3
mov eax, dword [ebx + 4]
push eax
mov edi, dword [ebx]
push edi
call fcn.00404d50
add esp, 0x20
cmp eax, 0xffffffff
je 0x4021ad
sub eax, 0x68
cmp eax, 0x33
jbe switch.0x004020a0
mov edx, 1
mov eax, esi
call fcn.004015c0
jmp 0x402061
jmp dword [eax*4 + 0x40b688]
mov eax, dword [sym.imp.msvcrt.dll__iob]
xor edx, edx
add eax, 0x20
call fcn.004015c0
sub esp, 0xc
mov eax, dword [str.elfedit]
push eax
call fcn.00402400
add esp, 0x10
jmp 0x402061
mov eax, dword [0x40d0f8]
call fcn.00401540
mov dword [0x40a040], eax
test eax, eax
jns 0x402061
mov dword [ebp - 0x44], 1
mov eax, dword [ebp - 0x44]
lea esp, [ebp - 0x10]
pop ecx
pop ebx
pop esi
pop edi
pop ebp
lea esp, [ecx - 4]
ret
mov eax, dword [0x40d0f8]
call fcn.00401540
mov dword [0x40a03c], eax
test eax, eax
jns 0x402061
jmp 0x4020dc
mov eax, dword [0x40d0f8]
call fcn.004013e0
mov dword [0x40a038], eax
test eax, eax
jns 0x402061
jmp 0x4020dc
mov eax, dword [0x40d0f8]
call fcn.004013e0
mov dword [0x40a034], eax
test eax, eax
jns 0x402061
jmp 0x4020dc
mov eax, dword [0x40d0f8]
call fcn.00401470
mov dword [0x40a02c], eax
test eax, eax
js 0x4020dc
call fcn.004013a0
mov dword [0x40a030], eax
inc eax
jne 0x402061
jmp 0x4020dc
mov eax, dword [0x40d0f8]
call fcn.00401470
mov dword [0x40a024], eax
test eax, eax
js 0x4020dc
call fcn.004013a0
mov dword [0x40a028], eax
inc eax
jne 0x402061
jmp 0x4020dc
mov eax, dword [0x40a100]
cmp eax, dword [ebx]
je 0x402373
cmp dword [0x40a02c], 0xffffffff
je 0x402359
mov edx, eax
mov dword [ebp - 0x44], 0
cmp eax, dword [ebx]
jge 0x4020e3
lea eax, [ebp - 0x18]
mov dword [ebp - 0x50], eax
jmp 0x40220e
push eax
push eax
mov eax, dword [ebp - 0x58]
push eax
push str._s_is_not_an_ordinary_file_n
call fcn.004025d0
add esp, 0x10
mov edi, 1
mov eax, dword [ebp - 0x44]
mov edx, dword [0x40a100]
or eax, edi
cmp edx, dword [ebx]
mov dword [ebp - 0x44], eax
jge 0x4020e3
mov eax, dword [ebx + 4]
lea esi, [ebp - 0x3c]
mov eax, dword [eax + edx*4]
mov dword [ebp - 0x58], eax
lea eax, [edx + 1]
mov dword [0x40a100], eax
push ecx
push ecx
push esi
mov edx, dword [ebp - 0x58]
push edx
call sub.msvcrt.dll__stat
add esp, 0x10
test eax, eax
js 0x4022a1
mov ax, word [ebp - 0x36]
and eax, 0xf000
cmp eax, 0x8000
jne 0x4021e0
push edi
push edi
push 0x40b594
mov esi, dword [ebp - 0x58]
push esi
call sub.msvcrt.dll_fopen
add esp, 0x10
mov dword [ebp - 0x54], eax
test eax, eax
je 0x40232b
mov ecx, dword [ebp - 0x54]
lea edi, [ebp - 0x18]
push ecx
push 1
push 8
push edi
call sub.msvcrt.dll_fread
add esp, 0x10
dec eax
je 0x4022d9
push edx
push edx
mov eax, dword [ebp - 0x58]
mov edi, 1
push eax
push str._s:_Failed_to_read_files_magic_number_n
call fcn.004025d0
pop eax
mov eax, dword [ebp - 0x54]
push eax
call sub.msvcrt.dll_fclose
add esp, 0x10
jmp 0x4021f8
call sub.msvcrt.dll__errno
cmp dword [eax], 2
je 0x40238f
call sub.msvcrt.dll__errno
sub esp, 0xc
mov eax, dword [eax]
push eax
call sub.msvcrt.dll_strerror
add esp, 0xc
push eax
mov eax, dword [ebp - 0x58]
push eax
push str.Could_not_locate__s.__System_error_message:__s_n
call fcn.004025d0
add esp, 0x10
jmp 0x4021f3
mov eax, str.__arch__n
mov ecx, 8
cld
mov esi, dword [ebp - 0x50]
mov edi, eax
repe cmpsb byte [esi], byte es:[edi]
je 0x402348
mov eax, str.__thin__n
mov ecx, 8
cld
mov esi, dword [ebp - 0x50]
mov edi, eax
repe cmpsb byte [esi], byte es:[edi]
jne 0x4023a7
mov ecx, 1
mov edx, dword [ebp - 0x54]
mov eax, dword [ebp - 0x58]
call fcn.00401c80
mov edi, eax
sub esp, 0xc
mov eax, dword [ebp - 0x54]
push eax
call sub.msvcrt.dll_fclose
add esp, 0x10
jmp 0x4021f8
push edi
push edi
mov esi, dword [ebp - 0x58]
mov edi, 1
push esi
push str.Input_file__s_is_not_readable_n
call fcn.004025d0
add esp, 0x10
jmp 0x4021f8
xor ecx, ecx
mov edx, dword [ebp - 0x54]
mov eax, dword [ebp - 0x58]
call fcn.00401c80
mov edi, eax
jmp 0x402317
cmp dword [0x40a038], 0xffffffff
jne 0x4021c7
cmp dword [0x40a040], 0xffffffff
jne 0x4021c7
mov eax, dword [sym.imp.msvcrt.dll__iob]
mov edx, 1
add eax, 0x40
call fcn.004015c0
mov eax, dword [0x40a100]
jmp 0x4021c7
push eax
push eax
mov eax, dword [ebp - 0x58]
push eax
push str._s:_No_such_file_n
call fcn.004025d0
add esp, 0x10
jmp 0x4021f3
sub esp, 0xc
mov eax, dword [ebp - 0x54]
push eax
call sub.msvcrt.dll_rewind
mov edx, dword [ebp - 0x54]
mov eax, dword [ebp - 0x58]
mov dword [0x40d008], 0
mov dword [0x40d018], 0
call fcn.00401640
add esp, 0x10
mov edi, eax
jmp 0x402317