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

Disassembly:
push ebp
mov ebp, esp
add esp, 0xffffff44
push ebx
push esi
push edi
mov ebx, eax
lea esi, [ebp - 0x9c]
mov eax, 0x49cb1c
call fcn.0047a12c
xor edx, edx
xor ecx, ecx
mov dword [ebp - 0xa0], edx
mov dword [ebp - 0xac], ecx
xor eax, eax
mov edx, str.Starting_flash_write
mov dword [ebp - 0xb0], eax
lea eax, [ebp - 4]
mov word [esi + 0x10], 8
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 4]
mov edx, 2
call fcn.00485dbc
push 0
push 0x8000000
push 3
push 0
push 1
push 0x80000000
cmp dword [0x4a598c], 0
je 0x4095a0
mov ecx, dword [0x4a598c]
jmp 0x4095a5
mov ecx, 0x49beb2
push ecx
call sub.KERNEL32.DLL_CreateFileA
mov edi, eax
mov dword [ebx + 0x10050], edi
push 0
push edi
call sub.KERNEL32.DLL_GetFileSize
mov ecx, eax
cmp dword [0x489be8], 0
jne 0x4095c9
sub ecx, 8
mov edi, 0x8000
mov dword [ebp - 0xb8], 8
mov eax, ecx
xor edx, edx
div edi
mov dword [ebp - 0xb4], eax
mov eax, ecx
xor edx, edx
div edi
test edx, edx
je 0x4095f4
inc dword [ebp - 0xb4]
push 2
call sub.KERNEL32.DLL_Sleep
mov ecx, dword [0x4a5984]
mov edx, dword [ebp - 0xb4]
mov eax, dword [ecx + 0x2f4]
call fcn.00456998
cmp dword [0x489be8], 0
jne 0x409657
lea ecx, [ebp - 0xb0]
push 0
push ecx
lea eax, [ebp - 0xa4]
push 4
push eax
mov edx, dword [ebx + 0x10050]
push edx
call sub.KERNEL32.DLL_ReadFile
lea ecx, [ebp - 0xb0]
push 0
push ecx
lea eax, [ebp - 0xa4]
push 4
push eax
mov edx, dword [ebx + 0x10050]
push edx
call sub.KERNEL32.DLL_ReadFile
mov ecx, dword [ebp - 0xb4]
lea edx, [ebx + 0x30]
shr ecx, 8
and cl, 0xff
mov byte [ebx + 0x30], cl
mov ecx, 2
mov al, byte [ebp - 0xb4]
and al, 0xff
mov byte [ebx + 0x31], al
mov eax, ebx
call fcn.0040b65c
mov edx, edi
mov dword [ebx + 0x100cc], eax
shr edx, 0x18
mov ecx, edi
shr ecx, 0x10
mov eax, edi
shr eax, 8
and dl, 0xff
mov byte [ebx + 0x30], dl
and cl, 0xff
mov byte [ebx + 0x31], cl
mov edx, edi
and al, 0xff
and dl, 0xff
mov byte [ebx + 0x32], al
mov byte [ebx + 0x33], dl
lea edx, [ebx + 0x30]
mov eax, ebx
mov ecx, 4
call fcn.0040b65c
mov dword [ebx + 0x100cc], eax
mov eax, dword [0x4a5984]
mov eax, dword [eax + 0x3f0]
mov edx, dword [eax]
call dword [edx + 0xb4]
mov byte [ebx + 0x30], al
lea edx, [ebx + 0x30]
mov ecx, 1
mov eax, ebx
call fcn.0040b65c
mov dword [ebx + 0x100cc], eax
xor eax, eax
mov dword [ebp - 0xb0], eax
cmp dword [ebp - 0xac], 2
jne 0x40972e
mov word [esi + 0x10], 0x14
mov edx, 0x49beb3
lea eax, [ebp - 8]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 8]
mov edx, 2
call fcn.00485dbc
mov byte [ebx + 0x8038], 0xde
lea edx, [ebx + 0x8038]
mov ecx, 1
mov eax, ebx
call fcn.0040b6dc
mov dword [ebx + 0x100c8], eax
mov al, byte [ebx + 0x8038]
cmp al, 0x21
je 0x409764
cmp al, 0x15
je 0x409764
cmp dword [ebx + 0x100d8], 0
je 0x409735
cmp dword [ebx + 0x100d8], 0
jne 0x409add
cmp al, 0x21
jne 0x4099a5
mov edx, dword [ebp - 0xb0]
lea ecx, [ebp - 0xb0]
add dword [ebp - 0xa0], edx
push 0
push ecx
push edi
mov eax, dword [ebp - 0xb8]
add eax, ebx
add eax, 0x30
push eax
mov edx, dword [ebx + 0x10050]
push edx
call sub.KERNEL32.DLL_ReadFile
test eax, eax
jne 0x4097da
mov word [esi + 0x10], 0x20
mov edx, 0x49bece
lea eax, [ebp - 0xc]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.00407798
dec dword [esi + 0x1c]
lea eax, [ebp - 0xc]
mov edx, 2
call fcn.00485dbc
cmp dword [ebp - 0xb0], 0
je 0x409aa8
mov ecx, dword [ebp - 0xb0]
shr ecx, 8
and cl, 0xff
mov byte [ebx + 0x30], cl
mov al, byte [ebp - 0xb0]
and al, 0xff
mov byte [ebx + 0x31], al
mov edx, dword [ebp - 0xa0]
shr edx, 0x18
and dl, 0xff
mov byte [ebx + 0x34], dl
mov ecx, dword [ebp - 0xa0]
shr ecx, 0x10
and cl, 0xff
mov byte [ebx + 0x35], cl
mov eax, dword [ebp - 0xa0]
shr eax, 8
and al, 0xff
mov byte [ebx + 0x36], al
lea eax, [ebx + 0x34]
mov dl, byte [ebp - 0xa0]
and dl, 0xff
mov byte [ebx + 0x37], dl
mov edx, 4
mov word [ebp - 0xa6], 0
jmp 0x409859
xor ecx, ecx
inc edx
mov cl, byte [eax]
add word [ebp - 0xa6], cx
inc eax
mov ecx, dword [ebp - 0xb0]
add ecx, 8
cmp edx, ecx
jb 0x40984c
movzx eax, word [ebp - 0xa6]
sar eax, 8
and al, 0xff
mov byte [ebx + 0x32], al
mov dl, byte [ebp - 0xa6]
and dl, 0xff
mov byte [ebx + 0x33], dl
inc dword [ebp - 0xac]
mov eax, dword [0x4a5984]
mov eax, dword [eax + 0x2f4]
mov edx, dword [ebp - 0xac]
call fcn.004569a8
mov word [esi + 0x10], 0x2c
lea eax, [ebp - 0x14]
mov edx, dword [ebp - 0xac]
call fcn.00485d34
push eax
inc dword [esi + 0x1c]
mov edx, 0x49beeb
lea eax, [ebp - 0x10]
call fcn.00485c64
inc dword [esi + 0x1c]
xor ecx, ecx
mov dword [ebp - 0x18], ecx
lea ecx, [ebp - 0x18]
inc dword [esi + 0x1c]
pop edx
call fcn.00485e14
lea eax, [ebp - 0x18]
push eax
mov edx, 0x49befa
lea eax, [ebp - 0x1c]
call fcn.00485c64
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x20], eax
lea edx, [ebp - 0x1c]
inc dword [esi + 0x1c]
lea ecx, [ebp - 0x20]
pop eax
call fcn.00485e14
lea edx, [ebp - 0x20]
push edx
lea eax, [ebp - 0x24]
mov edx, dword [ebp - 0xb4]
call fcn.00485d34
mov edx, eax
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x28], eax
lea ecx, [ebp - 0x28]
inc dword [esi + 0x1c]
pop eax
call fcn.00485e14
lea edx, [ebp - 0x28]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 0x28]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x24]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x20]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x1c]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x18]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x14]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x10]
mov edx, 2
call fcn.00485dbc
jmp 0x409aa8
mov word [esi + 0x10], 0x38
lea eax, [ebp - 0x30]
mov edx, dword [ebp - 0xac]
call fcn.00485d34
push eax
inc dword [esi + 0x1c]
mov edx, 0x49beff
lea eax, [ebp - 0x2c]
call fcn.00485c64
inc dword [esi + 0x1c]
xor ecx, ecx
mov dword [ebp - 0x34], ecx
lea ecx, [ebp - 0x34]
inc dword [esi + 0x1c]
pop edx
call fcn.00485e14
lea eax, [ebp - 0x34]
push eax
mov edx, str._of
lea eax, [ebp - 0x38]
call fcn.00485c64
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x3c], eax
lea edx, [ebp - 0x38]
inc dword [esi + 0x1c]
lea ecx, [ebp - 0x3c]
pop eax
call fcn.00485e14
lea edx, [ebp - 0x3c]
push edx
lea eax, [ebp - 0x40]
mov edx, dword [ebp - 0xb4]
call fcn.00485d34
mov edx, eax
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x44], eax
lea ecx, [ebp - 0x44]
inc dword [esi + 0x1c]
pop eax
call fcn.00485e14
lea edx, [ebp - 0x44]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 0x44]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x40]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x3c]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x38]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x34]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x30]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x2c]
mov edx, 2
call fcn.00485dbc
cmp byte [ebx + 0x100d4], 5
jne 0x409ab8
push 0x64
call sub.KERNEL32.DLL_Sleep
cmp dword [ebp - 0xb0], 0
je 0x409add
mov ecx, dword [ebp - 0xb0]
add ecx, dword [ebp - 0xb8]
lea edx, [ebx + 0x30]
mov eax, ebx
call fcn.0040b65c
mov dword [ebx + 0x100cc], eax
cmp edi, dword [ebp - 0xb0]
jne 0x409b09
mov ecx, dword [ebp - 0xac]
cmp ecx, dword [ebp - 0xb4]
jae 0x409b09
cmp dword [ebx + 0x100d0], 0
jne 0x409b09
cmp dword [ebx + 0x100d8], 0
je 0x4096f6
cmp dword [ebx + 0x100d0], 0
jne 0x409df9
cmp dword [ebx + 0x100d8], 0
jne 0x409df9
cmp dword [ebp - 0xac], 2
je 0x409b3e
cmp dword [ebp - 0xb4], 1
jne 0x409b6d
cmp dword [ebp - 0xac], 1
jne 0x409b6d
mov word [esi + 0x10], 0x44
mov edx, str.Waiting_for_FLASH_to_erase
lea eax, [ebp - 0x48]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 0x48]
mov edx, 2
call fcn.00485dbc
mov byte [ebx + 0x8038], 0xde
lea edx, [ebx + 0x8038]
mov ecx, 1
mov eax, ebx
call fcn.0040b6dc
mov dword [ebx + 0x100c8], eax
mov al, byte [ebx + 0x8038]
cmp al, 0x21
je 0x409ba3
cmp al, 0x15
je 0x409ba3
cmp dword [ebx + 0x100d8], 0
je 0x409b74
cmp al, 0x21
jne 0x409bdb
mov word [esi + 0x10], 0x50
mov edx, 0x49bf31
lea eax, [ebp - 0x4c]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 0x4c]
mov edx, 2
call fcn.00485dbc
jmp 0x409df9
cmp byte [ebx + 0x8038], 0x15
jne 0x409df9
mov word [esi + 0x10], 0x5c
mov edx, str.FLASH_programming_error
lea eax, [ebp - 0x50]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.0040758c
dec dword [esi + 0x1c]
lea eax, [ebp - 0x50]
mov edx, 2
call fcn.00485dbc
lea edx, [ebx + 0x8038]
mov ecx, 8
mov eax, ebx
call fcn.0040b6dc
mov dword [ebx + 0x100c8], eax
cmp dword [ebx + 0x100c8], 8
je 0x409c41
cmp dword [ebx + 0x100d8], 0
je 0x409c17
movzx edi, byte [ebx + 0x8038]
xor eax, eax
xor edx, edx
mov al, byte [ebx + 0x8039]
mov dl, byte [ebx + 0x803a]
shl eax, 0x10
xor ecx, ecx
shl edi, 0x18
mov cl, byte [ebx + 0x803b]
shl edx, 8
or edi, eax
or edi, edx
xor edx, edx
xor eax, eax
mov dl, byte [ebx + 0x803d]
mov al, byte [ebx + 0x803c]
or edi, ecx
shl edx, 0x10
xor ecx, ecx
shl eax, 0x18
mov cl, byte [ebx + 0x803e]
or eax, edx
xor edx, edx
shl ecx, 8
mov dl, byte [ebx + 0x803f]
or eax, ecx
lea ecx, [ebp - 0x68]
or eax, edx
mov edx, 8
mov dword [ebp - 0xbc], eax
xor eax, eax
mov word [esi + 0x10], 0x68
mov dword [ebp - 0x68], eax
inc dword [esi + 0x1c]
mov eax, dword [ebp - 0xbc]
call fcn.0047111c
lea ecx, [ebp - 0x68]
push ecx
lea eax, [ebp - 0x58]
mov edx, edi
call fcn.00485d78
inc dword [esi + 0x1c]
lea ecx, [ebp - 0x58]
push ecx
mov edx, str.FLASH_programming_error__C:
lea eax, [ebp - 0x54]
call fcn.00485c64
inc dword [esi + 0x1c]
xor ecx, ecx
mov dword [ebp - 0x5c], ecx
lea ecx, [ebp - 0x5c]
inc dword [esi + 0x1c]
pop edx
call fcn.00485e14
lea eax, [ebp - 0x5c]
push eax
mov edx, str.__S:0x
lea eax, [ebp - 0x60]
call fcn.00485c64
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x64], eax
lea edx, [ebp - 0x60]
inc dword [esi + 0x1c]
lea ecx, [ebp - 0x64]
pop eax
call fcn.00485e14
lea eax, [ebp - 0x64]
xor edx, edx
mov dword [ebp - 0x6c], edx
lea ecx, [ebp - 0x6c]
inc dword [esi + 0x1c]
pop edx
call fcn.00485e14
lea eax, [ebp - 0x6c]
push eax
mov edx, 0x49bf7e
lea eax, [ebp - 0x70]
call fcn.00485c64
inc dword [esi + 0x1c]
xor eax, eax
mov dword [ebp - 0x74], eax
lea edx, [ebp - 0x70]
inc dword [esi + 0x1c]
lea ecx, [ebp - 0x74]
pop eax
call fcn.00485e14
lea edx, [ebp - 0x74]
mov eax, ebx
call fcn.00407798
dec dword [esi + 0x1c]
lea eax, [ebp - 0x74]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x70]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x6c]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x68]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x64]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x60]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x5c]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x58]
mov edx, 2
call fcn.00485dbc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x54]
mov edx, 2
call fcn.00485dbc
mov eax, dword [ebx + 0x10050]
cmp eax, 0xffffffff
je 0x409e0c
push eax
call sub.KERNEL32.DLL_CloseHandle
jmp 0x409e3b
mov word [esi + 0x10], 0x74
mov edx, 0x49bf80
lea eax, [ebp - 0x78]
call fcn.00485c64
mov edx, eax
inc dword [esi + 0x1c]
mov eax, ebx
call fcn.004075bc
dec dword [esi + 0x1c]
lea eax, [ebp - 0x78]
mov edx, 2
call fcn.00485dbc
mov ecx, dword [esi]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret