Function at 0x402540
Capabilities:
Read file on windows

Disassembly:
mov eax, dword [0x418780]
sub esp, 0xc
push ebx
mov ebx, dword [esp + 0x14]
push ebp
push esi
cmp ebx, eax
push edi
jae 0x402775
mov eax, ebx
and ebx, 0x1f
sar eax, 5
shl ebx, 3
mov ecx, dword [eax*4 + 0x418680]
lea esi, [eax*4 + 0x418680]
mov dword [esp + 0x14], esi
lea eax, [ebx + ecx]
mov dword [esp + 0x10], eax
mov dl, byte [eax + 4]
test dl, 1
je 0x402775
mov ecx, dword [esp + 0x28]
mov edi, dword [esp + 0x24]
xor ebp, ebp
mov eax, edi
test ecx, ecx
je 0x40276b
test dl, 2
jne 0x40276b
test dl, 0x48
je 0x4025c8
mov edx, dword [esp + 0x10]
mov dl, byte [edx + 5]
cmp dl, 0xa
je 0x4025c8
mov byte [edi], dl
mov edx, dword [esi]
lea eax, [edi + 1]
mov ebp, 1
dec ecx
mov byte [ebx + edx + 5], 0xa
lea edx, [esp + 0x10]
push 0
push edx
push ecx
push eax
mov eax, dword [esi]
mov ecx, dword [ebx + eax]
push ecx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x402629
call dword [sym.imp.KERNEL32.dll_GetLastError]
cmp eax, 5
jne 0x402606
mov dword [0x4183c0], eax
mov dword [0x4183bc], 9
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
cmp eax, 0x6d
jne 0x402615
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
push eax
call fcn.00401cf0
add esp, 4
or eax, 0xffffffff
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
mov eax, dword [esi]
mov edx, dword [esp + 0x10]
add ebp, edx
lea ecx, [ebx + eax + 4]
mov al, byte [ebx + eax + 4]
test al, 0x80
je 0x402761
test edx, edx
je 0x40264e
cmp byte [edi], 0xa
jne 0x40264e
or al, 4
jmp 0x402650
and al, 0xfb
mov byte [ecx], al
mov eax, dword [esp + 0x24]
add ebp, eax
mov esi, edi
cmp eax, ebp
mov dword [esp + 0x18], ebp
jae 0x40275b
mov al, byte [edi]
cmp al, 0x1a
je 0x402745
cmp al, 0xd
je 0x40267d
mov byte [esi], al
inc esi
inc edi
jmp 0x402729
dec ebp
cmp edi, ebp
jae 0x40269d
cmp byte [edi + 1], 0xa
jne 0x402693
add edi, 2
mov byte [esi], 0xa
jmp 0x402728
mov byte [esi], 0xd
inc esi
inc edi
jmp 0x402729
mov eax, dword [esp + 0x14]
xor ebp, ebp
lea ecx, [esp + 0x10]
push ebp
push ecx
mov ecx, dword [eax]
lea edx, [esp + 0x30]
push 1
push edx
mov edx, dword [ebx + ecx]
push edx
inc edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4026c9
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov ebp, eax
test ebp, ebp
jne 0x402725
mov eax, dword [esp + 0x10]
test eax, eax
je 0x402725
mov ecx, dword [esp + 0x14]
mov eax, dword [ecx]
test byte [ebx + eax + 4], 0x48
je 0x4026fa
mov al, byte [esp + 0x28]
cmp al, 0xa
jne 0x4026ee
mov byte [esi], al
jmp 0x402728
mov byte [esi], 0xd
mov ecx, dword [ecx]
inc esi
mov byte [ebx + ecx + 5], al
jmp 0x402729
cmp esi, dword [esp + 0x24]
jne 0x40270c
cmp byte [esp + 0x28], 0xa
jne 0x40270c
mov byte [esi], 0xa
jmp 0x402728
mov edx, dword [esp + 0x20]
push 1
push 0xffffffffffffffff
push edx
call fcn.00402300
mov al, byte [esp + 0x34]
add esp, 0xc
cmp al, 0xa
je 0x402729
mov byte [esi], 0xd
inc esi
mov ebp, dword [esp + 0x18]
cmp edi, ebp
jb 0x402666
sub esi, dword [esp + 0x24]
mov ebp, esi
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
mov eax, dword [esp + 0x14]
mov ecx, dword [eax]
mov al, byte [ebx + ecx + 4]
test al, 0x40
lea ebx, [ebx + ecx + 4]
jne 0x40275b
or al, 2
mov byte [ebx], al
sub esi, dword [esp + 0x24]
mov ebp, esi
mov eax, ebp
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
xor eax, eax
pop edi
pop esi
pop ebp
pop ebx
add esp, 0xc
ret
pop edi
pop esi
pop ebp
mov dword [0x4183bc], 9
mov dword [0x4183c0], 0
or eax, 0xffffffff
pop ebx
add esp, 0xc
ret