Function at 0x408540
Capabilities:
Get file size
Read file on windows

Disassembly:
sub esp, 0x28
push ebx
mov ebx, dword [esp + 0x30]
push ebp
push esi
lea eax, [esp + 0x10]
push edi
push eax
mov esi, ecx
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileSize]
mov edi, eax
cmp edi, 0xffffffff
mov dword [esp + 0x24], edi
jne 0x40857b
lea ecx, [esp + 0x3c]
push 0x40e798
push ecx
mov dword [esp + 0x44], 4
call fcn.00409dff
lea edx, [esp + 0x14]
push 0
push edx
lea eax, [esp + 0x30]
push 0xd
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_ReadFile]
test eax, eax
jne 0x4085ab
lea ecx, [esp + 0x3c]
push 0x40e798
push ecx
mov dword [esp + 0x44], 4
call fcn.00409dff
cmp dword [esp + 0x14], 0xd
jne 0x408af6
cmp byte [esp + 0x28], 0x47
jne 0x408af6
cmp byte [esp + 0x29], 0x49
jne 0x408af6
cmp byte [esp + 0x2a], 0x46
jne 0x408af6
cmp byte [esp + 0x2b], 0x38
jne 0x408af6
mov al, byte [esp + 0x2c]
cmp al, 0x37
je 0x4085f2
cmp al, 0x39
jne 0x408af6
cmp byte [esp + 0x2d], 0x61
jne 0x408af6
mov cl, byte [esp + 0x32]
xor ebx, ebx
xor ebp, ebp
test cl, 0x80
mov dword [esi + 0x44], ebp
je 0x408670
and ecx, 7
mov ebp, 1
inc ecx
shl ebp, cl
lea edi, [ebp + ebp*2]
push edi
call fcn.0040923b
add esp, 4
lea edx, [esp + 0x14]
mov ebx, eax
mov eax, dword [esp + 0x3c]
push 0
push edx
push edi
push ebx
push eax
call dword [sym.imp.KERNEL32.dll_ReadFile]
cmp dword [esp + 0x14], edi
je 0x40866c
push ebx
call fcn.00409230
mov ecx, dword [esp + 0x40]
add esp, 4
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea edx, [esp + 0x3c]
push 0x40e798
push edx
mov dword [esp + 0x44], 4
call fcn.00409dff
mov edi, dword [esp + 0x24]
lea ecx, [ebp + ebp*2 + 0xc]
mov eax, edi
sub eax, ecx
push eax
mov dword [esi + 0x44], eax
call fcn.0040923b
mov ecx, dword [esi + 0x44]
mov edi, dword [esp + 0x40]
add esp, 4
lea edx, [esp + 0x14]
mov dword [esi + 0x64], eax
push 0
push edx
push ecx
push eax
push edi
call dword [sym.imp.KERNEL32.dll_ReadFile]
mov eax, dword [esi + 0x64]
mov dword [esi + 0x50], 0
test eax, eax
je 0x4086bc
mov eax, dword [esi + 0x64]
cmp byte [eax], 0x2c
je 0x4086bc
inc eax
test eax, eax
mov dword [esi + 0x64], eax
jne 0x4086ac
mov eax, dword [esi + 0x64]
inc eax
mov dword [esi + 0x64], eax
jne 0x4086e3
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea edx, [esp + 0x3c]
push 0x40e798
push edx
mov dword [esp + 0x44], 3
call fcn.00409dff
xor ecx, ecx
xor edx, edx
mov cx, word [eax]
add eax, 2
mov dword [esi + 0x28], ecx
mov dword [esi + 0x64], eax
mov dx, word [eax]
add eax, 2
xor ecx, ecx
mov dword [esi + 0x24], edx
mov dword [esi + 0x64], eax
mov cx, word [eax]
mov edx, ecx
add eax, 2
dec edx
mov dword [esi + 0x1c], ecx
or edx, 3
xor ecx, ecx
mov dword [esi + 0x64], eax
add eax, 2
lea edi, [edx + 1]
mov dword [esi + 0x3c], edi
mov cx, word [eax - 2]
mov dword [esi + 0x20], ecx
mov dword [esi + 0x64], eax
mov dl, byte [eax]
inc eax
mov dword [esi + 0x64], eax
mov eax, ecx
imul eax, edi
mov ecx, dword [esi + 0x68]
mov byte [esi + 5], dl
push ecx
mov dword [esi + 0x50], 9
mov dword [esi + 0x54], eax
call fcn.00409230
mov edx, dword [esi + 0x54]
add edx, 0x6428
push edx
call fcn.0040923b
mov edi, dword [esi + 0x54]
lea edx, [eax + 0x28]
add esp, 8
mov dword [esi + 0x68], eax
lea ecx, [edx + 0x400]
mov dword [esi + 0x58], ecx
add ecx, edi
mov dword [esp + 0x10], ecx
add ecx, 2
mov edi, 0x1000
mov word [ecx + 2], 0
mov word [ecx], 0
add ecx, 6
dec edi
jne 0x40877b
mov dword [eax], 0x28
mov ecx, dword [esi + 0x1c]
mov dword [eax + 4], ecx
mov ecx, dword [esi + 0x20]
neg ecx
mov dword [eax + 8], ecx
xor edi, edi
mov ecx, 0x100
mov word [eax + 0xc], 1
mov word [eax + 0xe], 8
mov dword [eax + 0x10], edi
mov dword [eax + 0x14], edi
mov dword [eax + 0x18], edi
mov dword [eax + 0x1c], edi
mov dword [eax + 0x20], ecx
mov dword [eax + 0x24], ecx
mov cl, byte [esi + 5]
test cl, 0x80
je 0x40881c
and ecx, 7
mov eax, 1
inc ecx
mov ebx, dword [esi + 0x50]
shl eax, cl
lea ecx, [eax + eax*2]
add ebx, ecx
cmp eax, edi
mov dword [esi + 0x50], ebx
jbe 0x40883c
mov ecx, dword [esi + 0x64]
add edx, 4
mov cl, byte [ecx]
mov byte [edx - 2], cl
mov ebx, dword [esi + 0x64]
inc ebx
mov ecx, ebx
mov dword [esi + 0x64], ebx
mov cl, byte [ecx]
mov byte [edx - 3], cl
mov ecx, dword [esi + 0x64]
inc ecx
mov dword [esi + 0x64], ecx
mov cl, byte [ecx]
mov byte [edx - 4], cl
mov ebp, dword [esi + 0x64]
inc ebp
dec eax
mov dword [esi + 0x64], ebp
mov byte [edx - 1], 0
jne 0x4087e7
jmp 0x40883c
cmp ebp, edi
jle 0x40883c
mov al, byte [ebx]
inc ebx
mov byte [edx + 2], al
add edx, 4
mov cl, byte [ebx]
inc ebx
mov byte [edx - 3], cl
mov al, byte [ebx]
mov byte [edx - 1], 0
mov byte [edx - 4], al
inc ebx
dec ebp
jne 0x408820
mov eax, dword [esi + 0x64]
mov ebp, dword [esi + 0x50]
xor ecx, ecx
mov cl, byte [eax]
inc eax
inc ebp
mov dword [esi + 8], ecx
mov dword [esi + 0x50], ebp
mov ebp, 1
shl ebp, cl
mov dword [esi + 0x64], eax
mov eax, dword [esi + 8]
mov dword [esi + 0xc], ecx
mov dword [esi + 0x10], edi
mov byte [esi + 4], 0
mov dword [esi + 0x18], edi
add ebp, 2
inc ecx
inc eax
mov dword [esi + 0xc], ecx
mov dword [esi + 8], eax
lea ebx, [ebp - 1]
mov eax, 1
mov ecx, esi
mov dword [esp + 0x1c], ebp
mov dword [esp + 0x24], ebx
mov dword [esp + 0x20], ebx
mov dword [esi + 0x14], eax
mov dword [esi + 0x4c], edi
mov dword [esi + 0x48], edi
mov dword [esi + 0x34], eax
mov dword [esi + 0x38], edi
call fcn.00408c50
mov ecx, eax
mov dword [esp + 0x20], eax
and ecx, 0xffff
cmp ecx, ebx
je 0x408a77
jmp 0x4088b7
mov eax, dword [esp + 0x20]
lea edx, [ebx - 1]
cmp ecx, edx
jne 0x4088f2
mov ecx, dword [esi + 0xc]
mov ebp, dword [esp + 0x1c]
mov dword [esi + 8], ecx
mov ecx, esi
call fcn.00408c50
mov edx, eax
mov ecx, ebp
and edx, 0xffff
mov dword [esp + 0x18], eax
cmp edx, ecx
jg 0x408a81
push eax
mov ecx, esi
call 0x408b20
jmp 0x408a5c
cmp ecx, ebp
jge 0x4089a2
mov edx, dword [esp + 0x1c]
mov ebx, eax
cmp ecx, edx
jl 0x408933
mov ecx, dword [esp + 0x10]
mov eax, ebx
and eax, 0xffff
lea eax, [eax + eax*2]
lea eax, [ecx + eax*2]
mov word [eax + 4], di
mov edi, ebx
mov bx, word [eax + 2]
cmp bx, di
jae 0x408ab2
mov eax, ebx
and eax, 0xffff
cmp eax, edx
jge 0x408904
push ebx
mov ecx, esi
call 0x408b20
test di, di
je 0x408964
mov edx, dword [esp + 0x10]
and edi, 0xffff
lea ecx, [edi + edi*2]
mov al, byte [edx + ecx*2]
lea edi, [edx + ecx*2]
push eax
mov ecx, esi
call 0x408b20
mov di, word [edi + 4]
test di, di
jne 0x408940
mov edx, dword [esp + 0x10]
lea ecx, [ebp + ebp*2]
inc ebp
lea eax, [edx + ecx*2]
mov cx, word [esp + 0x18]
mov edx, 1
mov byte [eax], bl
mov word [eax + 2], cx
mov ecx, dword [esi + 8]
shl edx, cl
cmp ebp, edx
jne 0x40898d
inc ecx
mov dword [esi + 8], ecx
mov ecx, dword [esi + 8]
mov eax, 0xc
cmp ecx, eax
jbe 0x408a4e
jmp 0x408a4b
mov eax, dword [esp + 0x18]
mov ecx, dword [esp + 0x1c]
mov ebx, eax
and eax, 0xffff
cmp eax, ecx
jl 0x4089dd
lea edx, [eax + eax*2]
mov eax, dword [esp + 0x10]
lea eax, [eax + edx*2]
mov word [eax + 4], di
mov edi, ebx
mov bx, word [eax + 2]
cmp bx, di
jae 0x408ad4
mov eax, ebx
and eax, 0xffff
cmp eax, ecx
jge 0x4089b5
push ebx
mov ecx, esi
call 0x408b20
test di, di
je 0x408a0e
mov edx, dword [esp + 0x10]
and edi, 0xffff
lea ecx, [edi + edi*2]
mov al, byte [edx + ecx*2]
lea edi, [edx + ecx*2]
push eax
mov ecx, esi
call 0x408b20
mov di, word [edi + 4]
test di, di
jne 0x4089ea
push ebx
mov ecx, esi
call 0x408b20
mov edx, dword [esp + 0x10]
lea ecx, [ebp + ebp*2]
inc ebp
lea eax, [edx + ecx*2]
mov cx, word [esp + 0x18]
mov edx, 1
mov byte [eax], bl
mov word [eax + 2], cx
mov ecx, dword [esi + 8]
shl edx, cl
cmp ebp, edx
jne 0x408a3f
inc ecx
mov dword [esi + 8], ecx
mov ecx, dword [esi + 8]
mov eax, 0xc
cmp ecx, eax
jbe 0x408a4e
mov dword [esi + 8], eax
mov eax, dword [esp + 0x20]
mov ebx, dword [esp + 0x24]
mov dword [esp + 0x18], eax
xor edi, edi
mov ecx, esi
call fcn.00408c50
mov ecx, eax
mov dword [esp + 0x20], eax
and ecx, 0xffff
cmp ecx, ebx
jne 0x4088b3
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x28
ret 4
mov ecx, dword [esi + 0x68]
push ecx
call fcn.00409230
mov edx, dword [esp + 0x40]
add esp, 4
mov dword [esi + 0x68], edi
push edx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea eax, [esp + 0x3c]
push 0x40e798
push eax
mov dword [esp + 0x44], 3
call fcn.00409dff
mov ecx, dword [esp + 0x3c]
push ecx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea edx, [esp + 0x3c]
push 0x40e798
push edx
mov dword [esp + 0x44], 3
call fcn.00409dff
mov eax, dword [esp + 0x3c]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea ecx, [esp + 0x3c]
push 0x40e798
push ecx
mov dword [esp + 0x44], 3
call fcn.00409dff
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
lea edx, [esp + 0x3c]
push 0x40e798
push edx
mov dword [esp + 0x44], 8
call fcn.00409dff
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
nop
mov eax, ecx
push ebx
mov bl, byte [esp + 8]
test byte [eax + 5], 0x40
je 0x408b9d
mov ecx, dword [eax + 0x48]
mov edx, dword [eax + 0x1c]
cmp ecx, edx
push esi
jne 0x408b81
mov ecx, dword [eax + 0x34]
mov dword [eax + 0x48], 0
cmp ecx, 1
mov edx, 8
jne 0x408b4f
add dword [eax + 0x38], edx
cmp ecx, 2
jne 0x408b57
add dword [eax + 0x38], edx
cmp ecx, 3
jne 0x408b60
add dword [eax + 0x38], 4
cmp ecx, 4
jne 0x408b69
add dword [eax + 0x38], 2
mov edx, dword [eax + 0x38]
mov esi, dword [eax + 0x20]
cmp edx, esi
jl 0x408b81
inc ecx
mov edx, 0x10
sar edx, cl
mov dword [eax + 0x34], ecx
mov dword [eax + 0x38], edx
mov ecx, dword [eax + 0x3c]
mov esi, dword [eax + 0x48]
imul ecx, dword [eax + 0x38]
mov edx, dword [eax + 0x58]
add ecx, esi
pop esi
mov byte [edx + ecx], bl
mov edx, dword [eax + 0x48]
inc edx
mov dword [eax + 0x48], edx
jmp 0x408bc5
mov ecx, dword [eax + 0x48]
mov edx, dword [eax + 0x1c]
cmp ecx, edx
jne 0x408bb5
mov ecx, dword [eax + 0x4c]
mov dword [eax + 0x48], 0
inc ecx
mov dword [eax + 0x4c], ecx
mov ecx, dword [eax + 0x4c]
mov edx, dword [eax + 0x48]
imul ecx, dword [eax + 0x3c]
add ecx, edx
inc edx
mov dword [eax + 0x48], edx
cmp ecx, dword [eax + 0x54]
jg 0x408bd0
mov edx, dword [eax + 0x58]
mov byte [edx + ecx], bl
pop ebx
ret 4