Function at 0x4051a0
Capabilities:
Read file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x228
mov eax, dword [0x40d004]
xor eax, ebp
mov dword [ebp - 4], eax
push esi
push edi
xor edi, edi
mov dword [ebp - 0x210], ecx
push pe_nt_image_headers32
lea eax, [ebp - 0x104]
mov dword [ebp - 0x20c], edi
push edi
push eax
mov esi, edx
mov dword [ebp - 0x214], edi
call sub.VCRUNTIME140.dll_memset
push pe_nt_image_headers32
lea eax, [ebp - 0x204]
push edi
push eax
call sub.VCRUNTIME140.dll_memset
push 0x40b3e8
lea eax, [ebp - 0x208]
push esi
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen_s]
add esp, 0x24
test eax, eax
je 0x40522a
push eax
push str.File_was_unable_to_open___d__n
call fcn.00401080
add esp, 8
lea eax, [edi + 1]
pop edi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00407427
mov esp, ebp
pop ebp
ret
mov edi, dword [ebp - 0x208]
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
push ebx
push 2
push 0
push edi
call esi
push edi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ftell]
push 0
mov ebx, eax
push 0
push edi
mov dword [ebp - 0x218], ebx
call esi
add esp, 0x1c
cmp ebx, 0x200000
jbe 0x405294
push 0x200000
push ebx
push str.Binary_size_is_Greater_than_flash_size__d__d__n
call fcn.00401080
push dword [ebp - 0x208]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 0x10
mov eax, 1
pop ebx
pop edi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00407427
mov esp, ebp
pop ebp
ret
push ebx
push str._nFlashing_size___dBytes__..._n
call fcn.00401080
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 8
mov eax, pe_nt_image_headers32
test ebx, ebx
jle 0x4055fe
nop word [eax + eax]
push dword [ebp - 0x208]
cmp ebx, 0x100
mov esi, ebx
cmova esi, eax
lea eax, [ebp - 0x104]
push esi
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
add esp, 0x10
cmp eax, esi
jb 0x4055d1
lea eax, [ebp - 0x104]
mov ecx, eax
mov edx, eax
add ecx, esi
cmp edx, ecx
je 0x405551
cmp byte [eax], 0xff
jne 0x40530f
inc eax
cmp eax, ecx
jne 0x405300
jmp 0x405551
mov ecx, dword [ebp - 0x210]
lea eax, [ebp - 0x104]
movzx edi, si
push eax
mov edx, edi
call fcn.00404b40
mov ecx, eax
add esp, 4
mov dword [ebp - 0x20c], ecx
test ecx, ecx
jne 0x4055be
mov eax, 2
mov byte [ebp - 0x228], 0xeb
mov word [0x40e13c], ax
lea edx, [ebp - 0x228]
xor eax, eax
mov word [ebp - 0x223], di
mov word [ebp - 0x221], ax
mov cl, 0xcd
mov dword [ebp - 0x21e], eax
mov byte [ebp - 0x21a], al
movzx eax, al
and al, 0xfd
mov byte [ebp - 0x21f], 2
or al, 5
mov byte [ebp - 0x221], al
mov eax, dword [ebp - 0x210]
mov dword [ebp - 0x227], eax
movzx eax, byte [ebp - 0x220]
and al, 0xf2
or al, 2
mov byte [ebp - 0x220], al
call fcn.004028d0
movzx eax, byte [ebp - 0x221]
mov ecx, 0x40d910
and al, 0xdf
or al, 0x18
mov byte [ebp - 0x221], al
call fcn.00402be0
mov dword [ebp - 0x20c], eax
test eax, eax
jne 0x4053ea
cmp word [0x40d508], ax
je 0x4053ea
push edi
lea eax, [ebp - 0x204]
push 0x40dd18
push eax
call sub.VCRUNTIME140.dll_memcpy
add esp, 0xc
jmp 0x4053fa
mov ecx, eax
mov dword [ebp - 0x20c], ecx
test eax, eax
jne 0x4055be
mov edi, esi
lea ecx, [ebp - 0x204]
lea edx, [ebp - 0x104]
sub edi, 4
jb 0x405421
nop dword [eax]
mov eax, dword [ecx]
cmp eax, dword [edx]
jne 0x40542a
add ecx, 4
add edx, 4
sub edi, 4
jae 0x405410
cmp edi, 0xfffffffc
je 0x405551
mov al, byte [ecx]
cmp al, byte [edx]
jne 0x405467
cmp edi, 0xfffffffd
je 0x405551
mov al, byte [ecx + 1]
cmp al, byte [edx + 1]
jne 0x405467
cmp edi, 0xfffffffe
je 0x405551
mov al, byte [ecx + 2]
cmp al, byte [edx + 2]
jne 0x405467
cmp edi, 0xffffffff
je 0x405551
mov al, byte [ecx + 3]
cmp al, byte [edx + 3]
je 0x405551
push str.Failed_to_write_Flash_data_n
call fcn.00401080
push str.Expected_Data_
call fcn.00401080
add esp, 8
xor ebx, ebx
test esi, esi
je 0x40550f
nop dword [eax + eax]
movzx eax, byte [ebp + ebx - 0x104]
push eax
push 0x40b4d4
call fcn.00401080
add esp, 8
test bl, 7
jne 0x4054b8
push 0x409da8
call fcn.00401080
add esp, 4
inc ebx
cmp ebx, esi
jb 0x405490
push 0x409da8
call fcn.00401080
push str.Actual_Data_
call fcn.00401080
add esp, 8
xor ebx, ebx
nop word [eax + eax]
movzx eax, byte [ebp + ebx - 0x204]
push eax
push 0x40b4d4
call fcn.00401080
add esp, 8
test bl, 7
jne 0x405508
push 0x409da8
call fcn.00401080
add esp, 4
inc ebx
cmp ebx, esi
jb 0x4054e0
jmp 0x405526
push 0x409da8
call fcn.00401080
push str.Actual_Data_
call fcn.00401080
add esp, 8
push 0x409da8
call fcn.00401080
push dword [ebp - 0x208]
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
call edi
mov ebx, dword [ebp - 0x218]
add esp, 8
mov dword [ebp - 0x20c], 1
cmp byte [ebp - 0x214], 0
mov edi, dword [ebp - 0x210]
jne 0x40556e
push edi
push str._n_0x_.6x_:
call fcn.00401080
add esp, 8
push 0x409714
call fcn.00401080
inc dword [ebp - 0x214]
add esp, 4
cmp ebx, 0x100
jbe 0x405591
sub ebx, 0x100
jmp 0x405593
sub ebx, esi
add edi, esi
mov dword [ebp - 0x218], ebx
mov dword [ebp - 0x210], edi
mov eax, pe_nt_image_headers32
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
test ebx, ebx
jg 0x4052c0
mov ecx, dword [ebp - 0x20c]
test ecx, ecx
je 0x4055fe
push ecx
push str._nFlashing_failed___d___n
call fcn.00401080
mov edi, dword [ebp - 0x20c]
jmp 0x405630
push esi
push eax
push str.fread_failed___d__d___n
call fcn.00401080
push dword [ebp - 0x208]
call edi
add esp, 0x10
mov eax, 1
pop ebx
pop edi
pop esi
mov ecx, dword [ebp - 4]
xor ecx, ebp
call fcn.00407427
mov esp, ebp
pop ebp
ret
push str._nFlashing_done_n
call fcn.00401080
push str.Trigger_Processor_Reset.._n
call fcn.00401080
add esp, 8
mov ecx, pe_nt_image_headers32
call fcn.00404420
mov edi, eax
test edi, edi
je 0x405633
push edi
push str.Command_Send_Failed_due_to_ERROR_NO___d_n
call fcn.00401080
add esp, 8
push dword [ebp - 0x208]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
mov ecx, dword [ebp - 4]
add esp, 4
mov eax, edi
xor ecx, ebp
pop ebx
pop edi
pop esi
call fcn.00407427
mov esp, ebp
pop ebp
ret