Function at 0x40cd53
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov eax, dword [ebp + 8]
push ebx
push esi
mov esi, dword [ebp + 0x10]
push edi
push 0xfffffffffffffffe
pop ecx
xor edi, edi
mov dword [ebp - 0x20], edi
mov dword [ebp - 0x18], ecx
mov dword [ebp - 0x28], esi
cmp eax, ecx
jne 0x40cd8b
call fcn.00405b47
mov dword [eax], edi
call fcn.00405b7b
mov dword [eax], 9
jmp 0x40d4da
test eax, eax
js 0x40d4c3
cmp eax, dword [0x50dd14]
jae 0x40d4c3
mov ecx, eax
sar ecx, 5
mov ebx, eax
mov edx, dword [ecx*4 + 0x50d310]
and ebx, 0x1f
shl ebx, 6
mov dword [ebp - 0xc], ecx
mov al, byte [edx + ebx + 4]
mov dword [ebp - 0x24], ebx
test al, 1
je 0x40d4c3
cmp esi, 0x7fffffff
jbe 0x40cde4
call fcn.00405b47
mov dword [eax], edi
call fcn.00405b7b
mov dword [eax], 0x16
jmp 0x40d4d5
test esi, esi
je 0x40d4bf
test al, 2
jne 0x40d4bf
cmp dword [ebp + 0xc], edi
jne 0x40ce02
call fcn.00405b47
and dword [eax], edi
jmp 0x40cdd4
mov al, byte [edx + ebx + 0x24]
add al, al
sar al, 1
mov byte [ebp + 0x13], al
movsx eax, al
dec eax
je 0x40ce29
dec eax
jne 0x40ce21
mov eax, esi
not eax
test al, 1
je 0x40cdf9
and esi, 0xfffffffe
mov eax, dword [ebp + 0xc]
mov dword [ebp - 0x10], eax
jmp 0x40ce8d
mov eax, esi
not eax
test al, 1
je 0x40cdf9
shr esi, 1
cmp esi, 4
jae 0x40ce3b
push 4
pop esi
push esi
call fcn.004092f2
pop ecx
mov dword [ebp - 0x10], eax
test eax, eax
jne 0x40ce64
call fcn.00405b7b
mov dword [eax], 0xc
call fcn.00405b47
mov dword [eax], 8
jmp 0x40d4da
push 1
push 0
push 0
push dword [ebp + 8]
call fcn.00409c27
mov ecx, dword [ebp - 0xc]
add esp, 0x10
mov ecx, dword [ecx*4 + 0x50d310]
mov dword [ecx + ebx + 0x28], eax
mov eax, dword [ebp - 0x10]
mov dword [ecx + ebx + 0x2c], edx
mov ecx, dword [ebp - 0xc]
mov edx, dword [ecx*4 + 0x50d310]
mov ecx, dword [ebp - 0xc]
test byte [edx + ebx + 4], 0x48
mov dword [ebp - 0x1c], eax
je 0x40cf2a
mov dl, byte [edx + ebx + 5]
cmp dl, 0xa
je 0x40cf2a
test esi, esi
je 0x40cf2a
mov byte [eax], dl
xor edi, edi
lea edx, [eax + 1]
mov eax, dword [ecx*4 + 0x50d310]
inc edi
dec esi
cmp byte [ebp + 0x13], 0
mov dword [ebp - 0x1c], edx
mov byte [eax + ebx + 5], 0xa
je 0x40cf2a
mov eax, dword [ecx*4 + 0x50d310]
mov al, byte [eax + ebx + 0x25]
cmp al, 0xa
je 0x40cf2a
test esi, esi
je 0x40cf2a
mov byte [edx], al
mov eax, dword [ecx*4 + 0x50d310]
inc edx
push 2
dec esi
cmp byte [ebp + 0x13], 1
mov dword [ebp - 0x1c], edx
pop edi
mov byte [eax + ebx + 0x25], 0xa
jne 0x40cf2a
mov eax, dword [ecx*4 + 0x50d310]
mov al, byte [eax + ebx + 0x26]
cmp al, 0xa
je 0x40cf2a
test esi, esi
je 0x40cf2a
push 3
pop edi
mov byte [edx], al
mov eax, dword [ecx*4 + 0x50d310]
push 0xa
inc edx
pop ecx
mov dword [ebp - 0x1c], edx
dec esi
mov byte [eax + ebx + 0x26], cl
push dword [ebp + 8]
call fcn.00409ad7
test eax, eax
mov eax, dword [ebp - 0xc]
pop ecx
je 0x40cfab
mov ecx, dword [eax*4 + 0x50d310]
test byte [ecx + ebx + 4], 0x80
je 0x40cfab
lea eax, [ebp - 0x20]
push eax
push dword [ecx + ebx]
call dword [sym.imp.KERNEL32.dll_GetConsoleMode]
mov dword [ebp - 0x20], eax
test eax, eax
je 0x40cfa8
cmp byte [ebp + 0x13], 2
jne 0x40cfa8
push 0
lea eax, [ebp - 0x14]
push eax
mov eax, dword [ebp - 0xc]
shr esi, 1
mov eax, dword [eax*4 + 0x50d310]
push esi
push dword [ebp - 0x1c]
push dword [eax + ebx]
call dword [sym.imp.KERNEL32.dll_ReadConsoleW]
test eax, eax
jne 0x40cf9d
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
call fcn.00405b5a
pop ecx
or ebx, 0xffffffff
mov eax, dword [ebp - 0x10]
jmp 0x40d255
mov eax, dword [ebp - 0x14]
lea ecx, [eax + eax]
mov dword [ebp - 0x14], ecx
jmp 0x40cfe0
mov eax, dword [ebp - 0xc]
mov eax, dword [eax*4 + 0x50d310]
push 0
lea ecx, [ebp - 0x14]
push ecx
push esi
push dword [ebp - 0x1c]
push dword [eax + ebx]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
je 0x40d48b
mov ecx, dword [ebp - 0x14]
test ecx, ecx
js 0x40d48b
cmp ecx, esi
ja 0x40d48b
mov edx, dword [ebp - 0xc]
add edi, ecx
mov esi, dword [edx*4 + 0x50d310]
mov al, byte [esi + ebx + 4]
test al, al
jns 0x40d24f
cmp byte [ebp + 0x13], 2
je 0x40d26f
test ecx, ecx
je 0x40d012
mov ecx, dword [ebp - 0x10]
cmp byte [ecx], 0xa
jne 0x40d012
or al, 4
jmp 0x40d014
and al, 0xfb
mov byte [esi + ebx + 4], al
mov eax, dword [ebp - 0x10]
mov esi, eax
lea ecx, [eax + edi]
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x1c], ecx
cmp eax, ecx
jae 0x40d13c
push 0xd
pop ecx
mov edi, eax
mov al, byte [edi]
cmp al, 0x1a
je 0x40d120
cmp al, cl
je 0x40d04a
mov byte [esi], al
inc esi
inc edi
jmp 0x40d0e6
mov eax, dword [ebp - 0x1c]
dec eax
cmp edi, eax
jae 0x40d06e
lea eax, [edi + 1]
cmp byte [eax], 0xa
jne 0x40d067
push 0xa
pop eax
add edi, 2
mov byte [esi], al
jmp 0x40d112
mov byte [esi], cl
inc esi
mov edi, eax
jmp 0x40d0e6
push 0
lea eax, [ebp - 0x14]
push eax
push 1
lea eax, [ebp - 1]
push eax
mov eax, dword [edx*4 + 0x50d310]
inc edi
push dword [eax + ebx]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40d099
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x40d115
cmp dword [ebp - 0x14], 0
je 0x40d115
mov edx, dword [ebp - 0xc]
mov eax, dword [edx*4 + 0x50d310]
test byte [eax + ebx + 4], 0x48
je 0x40d0d3
push 0xa
pop eax
push 0xd
cmp byte [ebp - 1], al
jne 0x40d0bf
mov byte [esi], al
inc esi
jmp 0x40d0e5
mov byte [esi], 0xd
mov ecx, dword [edx*4 + 0x50d310]
mov al, byte [ebp - 1]
inc esi
mov byte [ecx + ebx + 5], al
jmp 0x40d0e5
cmp esi, dword [ebp - 0x10]
jne 0x40d0f1
push 0xa
pop eax
cmp byte [ebp - 1], al
jne 0x40d0f1
mov byte [esi], al
inc esi
push 0xd
pop ecx
cmp edi, dword [ebp - 0x1c]
jb 0x40d033
jmp 0x40d13c
push 1
push 0xffffffffffffffff
push 0xffffffffffffffff
push dword [ebp + 8]
call fcn.00409c27
mov edx, dword [ebp - 0xc]
add esp, 0x10
push 0xa
pop eax
cmp byte [ebp - 1], al
je 0x40d0e3
push 0xd
pop ecx
mov byte [esi], cl
inc esi
jmp 0x40d0e6
mov edx, dword [ebp - 0xc]
push 0xd
pop ecx
mov byte [esi], cl
inc esi
jmp 0x40d0e6
mov ecx, dword [edx*4 + 0x50d310]
mov al, byte [ecx + ebx + 4]
test al, 0x40
jne 0x40d137
or al, 2
mov byte [ecx + ebx + 4], al
jmp 0x40d13c
mov al, byte [edi]
mov byte [esi], al
inc esi
mov eax, dword [ebp - 0x10]
mov edi, esi
sub edi, eax
cmp byte [ebp + 0x13], 1
jne 0x40d252
test edi, edi
je 0x40d252
dec esi
mov al, byte [esi]
test al, al
js 0x40d162
inc esi
jmp 0x40d211
movzx eax, al
xor edx, edx
inc edx
cmp byte [eax + 0x50c548], 0
jne 0x40d18e
mov ebx, dword [ebp - 0x10]
cmp edx, 4
jg 0x40d18b
cmp esi, ebx
jb 0x40d18b
dec esi
inc edx
movzx eax, byte [esi]
cmp byte [eax + 0x50c548], 0
je 0x40d174
mov ebx, dword [ebp - 0x24]
movzx eax, byte [esi]
movsx eax, byte [eax + 0x50c548]
test eax, eax
jne 0x40d1ac
call fcn.00405b7b
mov dword [eax], 0x2a
jmp 0x40cf92
inc eax
cmp eax, edx
jne 0x40d1b5
add esi, edx
jmp 0x40d211
mov eax, dword [ebp - 0xc]
mov ecx, dword [eax*4 + 0x50d310]
test byte [ecx + ebx + 4], 0x48
je 0x40d1fd
mov al, byte [esi]
inc esi
mov byte [ecx + ebx + 5], al
mov eax, dword [ebp - 0xc]
cmp edx, 2
jl 0x40d1e6
mov ecx, dword [eax*4 + 0x50d310]
mov al, byte [esi]
mov byte [ecx + ebx + 0x25], al
mov eax, dword [ebp - 0xc]
inc esi
cmp edx, 3
jne 0x40d1f9
mov ecx, dword [eax*4 + 0x50d310]
mov al, byte [esi]
mov byte [ecx + ebx + 0x26], al
inc esi
sub esi, edx
jmp 0x40d211
neg edx
mov eax, edx
cdq
push 1
push edx
push eax
push dword [ebp + 8]
call fcn.00409c27
add esp, 0x10
mov eax, dword [ebp - 0x28]
mov edi, dword [ebp - 0x10]
shr eax, 1
push eax
push dword [ebp + 0xc]
sub esi, edi
push esi
push edi
push 0
push 0xfde9
call dword [sym.imp.KERNEL32.dll_MultiByteToWideChar]
mov edi, eax
test edi, edi
je 0x40cf85
mov eax, dword [ebp - 0xc]
xor ecx, ecx
mov eax, dword [eax*4 + 0x50d310]
cmp edi, esi
setne cl
add edi, edi
mov dword [eax + ebx + 0x30], ecx
mov eax, dword [ebp - 0x10]
mov ebx, dword [ebp - 0x18]
cmp eax, dword [ebp + 0xc]
je 0x40d261
push eax
call fcn.00404fe0
pop ecx
cmp ebx, 0xfffffffe
je 0x40d268
mov edi, ebx
mov eax, edi
jmp 0x40d4dd
cmp dword [ebp - 0x20], 0
je 0x40d2ee
mov esi, dword [ebp - 0x10]
mov eax, edi
cdq
sub eax, edx
sar eax, 1
mov edi, esi
mov ecx, esi
lea edx, [edi + eax*2]
cmp edi, edx
jae 0x40d2df
push 0xd
mov dword [ebp + 0x10], 0x1a
pop edi
movzx eax, word [ecx]
cmp ax, word [ebp + 0x10]
je 0x40d2d0
cmp ax, di
je 0x40d2ad
mov word [esi], ax
add esi, 2
add ecx, 2
jmp 0x40d2ca
lea eax, [edx - 2]
cmp ecx, eax
jae 0x40d2ca
push 0xa
add ecx, 2
pop eax
cmp word [ecx], ax
je 0x40d2c4
push 0xd
pop eax
push eax
pop edi
mov word [esi], ax
add esi, 2
cmp ecx, edx
jb 0x40d294
jmp 0x40d2df
mov eax, dword [ebp - 0xc]
mov eax, dword [eax*4 + 0x50d310]
or byte [eax + ebx + 4], 2
mov eax, dword [ebp - 0x10]
mov edi, esi
sub edi, eax
and edi, 0xfffffffe
jmp 0x40d252
test ecx, ecx
je 0x40d304
mov ecx, dword [ebp - 0x10]
push 0xa
pop edx
cmp word [ecx], dx
mov edx, dword [ebp - 0xc]
jne 0x40d304
or al, 4
jmp 0x40d306
and al, 0xfb
mov byte [esi + ebx + 4], al
mov eax, dword [ebp - 0x10]
mov esi, eax
lea ecx, [eax + edi]
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x20], ecx
cmp eax, ecx
jae 0x40d47f
push 0xd
pop ecx
mov dword [ebp + 0x10], 0x1a
mov edi, eax
movzx eax, word [edi]
cmp ax, word [ebp + 0x10]
je 0x40d45f
cmp ax, cx
je 0x40d343
mov word [esi], ax
jmp 0x40d36a
mov eax, dword [ebp - 0x20]
add eax, 0xfffffffe
cmp edi, eax
jae 0x40d375
push 0xa
pop edx
cmp word [edi + 2], dx
mov edx, dword [ebp - 0xc]
jne 0x40d367
push 0xa
pop eax
add edi, 4
mov word [esi], ax
jmp 0x40d44c
mov word [esi], cx
add esi, 2
add edi, 2
jmp 0x40d408
push 0
lea eax, [ebp - 0x14]
push eax
push 2
lea eax, [ebp - 8]
push eax
mov eax, dword [edx*4 + 0x50d310]
add edi, 2
push dword [eax + ebx]
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x40d3a6
call dword [sym.imp.KERNEL32.dll_GetLastError]
test eax, eax
jne 0x40d451
cmp dword [ebp - 0x14], 0
je 0x40d451
mov edx, dword [ebp - 0xc]
mov eax, dword [edx*4 + 0x50d310]
test byte [eax + ebx + 4], 0x48
je 0x40d413
push 0xa
pop eax
push 0xd
cmp word [ebp - 8], ax
jne 0x40d3d4
mov word [esi], ax
add esi, 2
jmp 0x40d407
pop eax
mov word [esi], ax
mov ecx, dword [edx*4 + 0x50d310]
mov al, byte [ebp - 8]
mov byte [ecx + ebx + 5], al
mov ecx, dword [edx*4 + 0x50d310]
mov al, byte [ebp - 7]
mov byte [ecx + ebx + 0x25], al
mov eax, dword [edx*4 + 0x50d310]
push 0xa
pop ecx
add esi, 2
mov byte [eax + ebx + 0x26], cl
push 0xd
pop ecx
cmp edi, dword [ebp - 0x20]
jb 0x40d32c
jmp 0x40d47f
cmp esi, dword [ebp - 0x10]
jne 0x40d429
push 0xa
pop eax
cmp word [ebp - 8], ax
jne 0x40d429
mov word [esi], ax
add esi, 2
jmp 0x40d405
push 1
push 0xffffffffffffffff
push 0xfffffffffffffffe
push dword [ebp + 8]
call fcn.00409c27
mov edx, dword [ebp - 0xc]
add esp, 0x10
push 0xa
pop eax
cmp word [ebp - 8], ax
je 0x40d405
push 0xd
pop ecx
mov word [esi], cx
add esi, 2
jmp 0x40d408
mov edx, dword [ebp - 0xc]
push 0xd
pop ecx
mov word [esi], cx
add esi, 2
jmp 0x40d408
mov ecx, dword [edx*4 + 0x50d310]
mov al, byte [ecx + ebx + 4]
test al, 0x40
jne 0x40d476
or al, 2
mov byte [ecx + ebx + 4], al
jmp 0x40d47f
mov ax, word [edi]
mov word [esi], ax
add esi, 2
mov eax, dword [ebp - 0x10]
mov edi, esi
sub edi, eax
jmp 0x40d252
call dword [sym.imp.KERNEL32.dll_GetLastError]
push 5
pop esi
cmp eax, esi
jne 0x40d4af
call fcn.00405b7b
mov dword [eax], 9
call fcn.00405b47
mov dword [eax], esi
jmp 0x40cf92
cmp eax, 0x6d
jne 0x40cf8b
xor ebx, ebx
jmp 0x40cf95
xor eax, eax
jmp 0x40d4dd
call fcn.00405b47
mov dword [eax], edi
call fcn.00405b7b
mov dword [eax], 9
call fcn.00405db9
or eax, 0xffffffff
pop edi
pop esi
pop ebx
leave
ret