Function at 0x40e9bf
Capabilities:
Read file on windows
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
mov esi, edx
xor edx, edx
push ebx
sub esp, 0x9c
mov dword [ebp - 0x40], eax
mov eax, dword [0x4df224]
mov dword [ebp - 0x20], edx
mov dword [ebp - 0x1c], edx
mov edx, dword [0x4df220]
test esi, esi
jne 0x40e9ff
mov edi, dword [0x510750]
mov ecx, dword [0x510754]
cmp edi, edx
mov ebx, ecx
sbb ebx, eax
cmovb edx, edi
cmovb eax, ecx
mov dword [ebp - 0x24], eax
mov eax, dword [0x4df230]
mov dword [ebp - 0x28], edx
cmp eax, 0x1ff
ja 0x40ea26
mov dword [esp + 4], eax
mov dword [esp], str.Unexpected_sector_size___d____Aborting
call fcn.0043d9e0
jmp 0x40f793
xor eax, eax
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], eax
mov dword [esp + 4], eax
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_SetFilePointerEx]
sub esp, 0x14
test eax, eax
jne 0x40ea57
mov dword [esp], str.Warning:_Unable_to_rewind_image_position___wrong_data_might_be_copied_
call fcn.0043d9e0
xor eax, eax
mov dword [esp], 0xffffffff
mov dword [esp + 0x18], eax
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], eax
mov dword [esp + 8], eax
mov dword [esp + 0xc], eax
mov dword [esp + 4], eax
call fcn.0044a2e0
test esi, esi
je 0x40ef2d
cmp dword [0x5240f8], 0
mov edx, str.Fast_zeroing_drive:
mov eax, str.Zeroing_drive:
cmovne eax, edx
mov dword [esp], eax
call fcn.0043d9e0
mov esi, dword [0x4df230]
xor edx, edx
mov ebx, edx
mov dword [esp + 0xc], edx
mov ecx, esi
mov dword [esp + 8], esi
add ecx, 0x1ffffff
adc ebx, 0
mov dword [esp], ecx
mov dword [esp + 4], ebx
call fcn.00484da0
mov edx, esi
imul eax, esi
mov ebx, eax
call fcn.0040e572
mov dword [ebp - 0x3c], eax
test eax, eax
jne 0x40eaff
mov dword [0x4dfd80], 0xc0030008
xor esi, esi
mov dword [esp], str.Could_not_allocate_disk_zeroing_buffer
call fcn.0043d9e0
xor eax, eax
mov dword [ebp - 0x48], eax
jmp 0x40f734
mov eax, dword [ebp - 0x3c]
xor edx, edx
div dword [0x4df230]
test edx, edx
je 0x40eb1b
mov dword [esp + 8], 0x49f
jmp 0x40f326
mov eax, dword [0x5240f8]
test eax, eax
je 0x40eb29
mov eax, 0xff
mov edi, dword [ebp - 0x3c]
mov ecx, ebx
xor esi, esi
rep stosb byte es:[edi], al
cmp dword [0x5240f8], 0
je 0x40eb92
mov edx, dword [0x4df230]
mov eax, ebx
call fcn.0040e572
mov esi, eax
test eax, eax
jne 0x40eb69
mov dword [0x4dfd80], 0xc0030008
mov dword [esp], str.Could_not_allocate_disk_comparison_buffer
call fcn.0043d9e0
jmp 0x40ed29
xor edx, edx
div dword [0x4df230]
test edx, edx
je 0x40eb92
mov dword [esp + 8], 0x4ab
mov dword [esp + 4], str.format.c
mov dword [esp], str._uintptr_t_cmp_buffer___SelectedDrive.SectorSize__0
call dword [0x491228]
xor eax, eax
mov dword [ebp - 0x20], ebx
xor ebx, ebx
mov dword [ebp - 0x30], eax
xor eax, eax
mov dword [ebp - 0x50], eax
mov dword [ebp - 0x4c], eax
mov dword [ebp - 0x48], eax
mov dword [ebp - 0x44], eax
jmp 0x40ec18
lea eax, [ebp - 0x2c]
xor edi, edi
mov dword [esp + 0x10], edi
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 4], esi
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_ReadFile]
sub esp, 0x14
test eax, eax
je 0x40ed6a
mov edx, dword [ebp - 0x20]
cmp edx, dword [ebp - 0x2c]
jne 0x40ed6a
mov ecx, dword [esi]
lea eax, [ecx - 1]
cmp eax, 0xfffffffd
jbe 0x40ed8c
mov ebx, edx
mov eax, 1
shr ebx, 2
cmp eax, ebx
jb 0x40ed81
mov dword [ebp - 0x30], edx
xor edi, edi
mov eax, dword [ebp - 0x30]
add dword [ebp - 0x48], eax
mov ebx, edi
adc dword [ebp - 0x44], 0
mov edx, dword [ebp - 0x24]
mov eax, dword [ebp - 0x44]
mov ecx, dword [ebp - 0x28]
cmp dword [ebp - 0x48], ecx
sbb eax, edx
jae 0x40ef14
cmp dword [0x5240f8], 1
mov dword [esp + 0x10], ecx
sbb eax, eax
xor edi, edi
mov dword [esp + 0x14], edx
mov dword [esp + 0x18], edi
and eax, 0xffffffec
mov edx, dword [ebp - 0x48]
mov ecx, dword [ebp - 0x44]
add eax, 0xcea
mov dword [esp], 4
mov dword [esp + 8], edx
mov dword [esp + 0xc], ecx
mov dword [esp + 4], eax
call fcn.0044a2e0
mov eax, 0x50
mul dword [ebp - 0x48]
imul ecx, dword [ebp - 0x44], 0x50
mov dword [ebp - 0x54], edx
mov edx, dword [ebp - 0x24]
mov dword [ebp - 0x58], eax
mov eax, dword [ebp - 0x28]
add dword [ebp - 0x54], ecx
mov dword [esp + 8], eax
mov dword [esp + 0xc], edx
mov eax, dword [ebp - 0x58]
mov edx, dword [ebp - 0x54]
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.00485080
mov edi, edx
mov ecx, dword [ebp - 0x4c]
cmp dword [ebp - 0x50], eax
sbb ecx, edi
jb 0x40ed33
mov eax, dword [ebp - 0x48]
mov edx, dword [ebp - 0x44]
add eax, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x28]
mov dword [ebp - 0x58], eax
mov eax, dword [ebp - 0x58]
adc edx, 0
mov dword [ebp - 0x54], edx
cmp ecx, eax
mov eax, dword [ebp - 0x24]
sbb eax, dword [ebp - 0x54]
jae 0x40ecd8
mov eax, dword [ebp - 0x48]
sub ecx, eax
mov dword [ebp - 0x20], ecx
mov edi, dword [ebp - 0x20]
mov ecx, dword [0x4df230]
xor edx, edx
mov eax, edi
div ecx
test edx, edx
je 0x40ecf9
lea eax, [edi + ecx - 1]
xor edx, edx
div ecx
imul eax, ecx
mov dword [ebp - 0x20], eax
mov eax, dword [0x4dfd80]
lea edi, [ebx - 1]
test ebx, ebx
jne 0x40edce
mov edi, dword [0x5240f8]
test edi, edi
je 0x40edce
test eax, eax
jns 0x40ebac
cmp ax, 0x4c7
jne 0x40ebac
xor ebx, ebx
mov dword [ebp - 0x48], ebx
jmp 0x40f734
mov ecx, dword [ebp - 0x50]
mov edx, 0x4f
cmp edx, ecx
mov edx, 0
sbb edx, dword [ebp - 0x4c]
jb 0x40ecae
mov dword [ebp - 0x58], eax
mov dword [esp], 0x497f25
call fcn.0043db09
add dword [ebp - 0x50], 1
mov eax, dword [ebp - 0x58]
adc dword [ebp - 0x4c], 0
jmp 0x40eca0
call fcn.0043df77
mov dword [esp], str._r_nRead_error:_Could_not_read_data_for_fast_zeroing_comparison____s
mov dword [esp + 4], eax
call fcn.0043d9e0
jmp 0x40ed29
cmp ecx, dword [esi + eax*4]
jne 0x40ed8c
inc eax
jmp 0x40ebff
xor ecx, ecx
mov dword [esp + 0x10], ecx
mov dword [esp + 0xc], ecx
mov eax, dword [ebp - 0x48]
mov edx, dword [ebp - 0x44]
mov dword [esp + 4], eax
mov dword [esp + 8], edx
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_SetFilePointerEx]
sub esp, 0x14
test eax, eax
jne 0x40edc9
call fcn.0043df77
mov dword [esp], str._r_nError:_Could_not_reset_position____s
mov dword [esp + 4], eax
jmp 0x40ed7a
mov edi, 0xf
mov dword [ebp - 0x58], 4
mov eax, dword [0x4dfd80]
test eax, eax
jns 0x40ede8
cmp ax, 0x4c7
je 0x40ed29
xor edx, edx
lea eax, [ebp - 0x30]
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x20]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x3c]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_WriteFile]
sub esp, 0x14
test eax, eax
je 0x40ee3a
mov edx, dword [ebp - 0x20]
mov eax, dword [ebp - 0x30]
cmp edx, eax
je 0x40ec0c
mov dword [esp + 8], edx
mov dword [esp + 4], eax
mov dword [esp], str._r_nWrite_error:_Wrote__d_bytes__expected__d_bytes
call fcn.0043d9e0
jmp 0x40ee8d
call fcn.0043df77
mov ecx, dword [esp + 8]
mov dword [esp + 0xc], eax
mov eax, dword [0x4df230]
mov ebx, dword [esp + 0xc]
mov dword [ebp - 0x60], ecx
mov dword [ebp - 0x5c], ebx
mov dword [esp + 8], eax
xor eax, eax
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x48]
mov edx, dword [ebp - 0x44]
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.00485080
mov ebx, dword [ebp - 0x5c]
mov dword [esp], str._r_nWrite_error_at_sector__lld:__s
mov dword [esp + 4], eax
mov dword [esp + 0xc], ebx
mov dword [esp + 8], edx
call fcn.0043d9e0
dec dword [ebp - 0x58]
je 0x40eef6
mov dword [esp + 4], 5
mov dword [esp], 0x498234
call fcn.0043d9e0
mov dword [esp], 0x1388
mov ebx, dword [sym.imp.KERNEL32.DLL_Sleep]
call ebx
push eax
xor eax, eax
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x48]
mov edx, dword [ebp - 0x44]
mov dword [esp + 4], eax
mov dword [esp + 8], edx
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_SetFilePointerEx]
sub esp, 0x14
test eax, eax
jne 0x40ef05
call fcn.0043df77
mov dword [esp], 0x49824e
mov dword [esp + 4], eax
jmp 0x40ed7a
mov dword [0x4dfd80], 0xc003001d
jmp 0x40ed29
mov dword [esp], 0xc8
call ebx
push eax
jmp 0x40edd5
mov dword [esp], 0x498279
or edi, 0xffffffff
call fcn.0043db09
xor eax, eax
mov dword [ebp - 0x48], eax
jmp 0x40f720
mov al, byte [0x51078c]
lea edx, [eax - 1]
cmp dl, 7
ja 0x40f144
mov dword [esp], str.Writing_compressed_image:
xor esi, esi
xor edi, edi
call fcn.0043d9e0
mov eax, dword [0x522ec8]
call fcn.0040e5da
mov dword [esp + 0x18], esi
mov dword [esp + 0xc], edi
mov ebx, eax
mov dword [esp + 0x14], 0x8000000
mov dword [esp + 0x10], 3
mov dword [esp + 8], 1
mov dword [esp + 4], 0x80000000
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_CreateFileW]
sub esp, 0x1c
mov edi, eax
call dword [sym.imp.KERNEL32.DLL_GetLastError]
mov esi, eax
test ebx, ebx
je 0x40efa4
mov dword [esp], ebx
call sub.msvcrt.dll_free
mov dword [esp], esi
call dword [sym.imp.KERNEL32.DLL_SetLastError]
push ecx
cmp edi, 0xffffffff
jne 0x40efe0
call fcn.0043df77
mov dword [esp + 8], eax
mov eax, dword [0x522ec8]
mov dword [esp], 0x498296
mov dword [esp + 4], eax
call fcn.0043d9e0
mov dword [0x4dfd80], 0xc003006e
jmp 0x40f133
mov eax, dword [0x4df230]
mov edx, eax
call fcn.0040e572
mov dword [0x4dfd64], eax
test eax, eax
jne 0x40f010
mov dword [0x4dfd80], 0xc0030008
mov dword [esp], str.Could_not_allocate_disk_write_buffer
call fcn.0043d9e0
jmp 0x40f133
xor edx, edx
div dword [0x4df230]
test edx, edx
je 0x40f038
mov dword [esp + 8], 0x50d
mov dword [esp + 4], str.format.c
mov dword [esp], str._uintptr_t_sec_buf___SelectedDrive.SectorSize__0
jmp 0x40eb8c
xor eax, eax
xor edx, edx
mov dword [0x4dfd90], eax
xor eax, eax
mov dword [esp + 8], edx
mov dword [esp + 0x18], 0x4dfd80
mov dword [esp + 0x14], eax
mov dword [esp + 0x10], 0x40e35b
mov dword [esp + 0xc], 0x40e424
mov dword [esp + 4], fcn.0043d9e0
mov dword [esp], 0x40000
call fcn.0045253d
movzx eax, byte [0x51078c]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], edi
mov dword [esp + 4], eax
call fcn.00452011
mov ebx, edx
mov esi, eax
call fcn.004525c3
mov dword [esp], 0x498279
call fcn.0043db09
test ebx, ebx
js 0x40f0ed
cmp dword [0x4dfd90], 0
je 0x40f0ed
mov dword [esp], str.Notice:_Compressed_image_data_didnt_end_on_block_boundary.
call fcn.0043d9e0
xor eax, eax
mov dword [esp + 0x10], eax
lea eax, [ebp - 0x30]
mov dword [esp + 0xc], eax
mov eax, dword [0x4df230]
mov dword [esp + 8], eax
mov eax, dword [0x4dfd64]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_WriteFile]
sub esp, 0x14
mov eax, dword [0x4dfd64]
call fcn.0040e5c2
xor eax, eax
mov dword [0x4dfd64], eax
test ebx, ebx
jns 0x40f714
cmp word [0x4dfd80], 0x4c7
je 0x40f714
mov dword [esp + 4], esi
mov dword [esp + 8], ebx
mov dword [esp], str.Could_not_write_compressed_image:__lld
call fcn.0043d9e0
mov dword [0x4dfd80], 0xc003001d
xor ebx, ebx
xor eax, eax
xor esi, esi
mov dword [ebp - 0x48], ebx
mov dword [ebp - 0x3c], eax
jmp 0x40f737
cmp al, 9
jne 0x40f164
mov dword [esp + 8], 0x523
mov dword [esp + 4], str.format.c
mov dword [esp], str.img_report.compression_type___IMG_COMPRESSION_FFU
jmp 0x40eb8c
xor ecx, ecx
sub eax, 0xa
mov ebx, dword [0x522ec8]
mov dword [ebp - 0x48], ecx
cmp al, 1
ja 0x40f1a3
lea eax, [ebp - 0x28]
mov dword [esp], ebx
mov dword [esp + 4], eax
call fcn.0044e201
mov dword [ebp - 0x48], eax
test eax, eax
je 0x40f72d
cmp dword [ebp - 0x24], 0
jne 0x40f1a0
cmp dword [ebp - 0x28], 0
je 0x40f72d
mov ebx, dword [ebp - 0x48]
mov dword [esp + 4], 1
mov dword [esp], 0x20
call sub.msvcrt.dll_calloc
mov edi, eax
test eax, eax
jne 0x40f1d0
mov dword [esp], 8
call dword [sym.imp.KERNEL32.DLL_SetLastError]
push edx
jmp 0x40f2d9
xor eax, eax
mov dword [esp + 4], 1
mov dword [esp + 0xc], eax
mov dword [esp + 8], eax
xor eax, eax
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_CreateEventA]
mov dword [edi + 0x18], eax
sub esp, 0x10
mov eax, ebx
call fcn.0040e5da
mov dword [esp + 0x14], 0x48000000
mov edx, eax
xor eax, eax
mov dword [esp + 0x10], 3
mov dword [esp + 0x18], eax
xor eax, eax
mov dword [esp], edx
mov dword [esp + 0xc], eax
mov dword [esp + 8], 1
mov dword [esp + 4], 0x80000000
mov dword [ebp - 0x3c], edx
call dword [sym.imp.KERNEL32.DLL_CreateFileW]
sub esp, 0x1c
mov ebx, eax
call dword [sym.imp.KERNEL32.DLL_GetLastError]
mov edx, dword [ebp - 0x3c]
test edx, edx
je 0x40f254
mov dword [ebp - 0x3c], eax
mov dword [esp], edx
call sub.msvcrt.dll_free
mov eax, dword [ebp - 0x3c]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_SetLastError]
push eax
mov dword [edi], ebx
inc ebx
jne 0x40f27a
mov eax, dword [edi + 0x18]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
push ebx
mov dword [esp], edi
call sub.msvcrt.dll_free
jmp 0x40f2d9
mov eax, dword [0x4df230]
xor edx, edx
mov ebx, edx
mov ecx, eax
mov dword [ebp - 0x3c], eax
add ecx, 0x1ffffff
mov dword [esp + 8], eax
adc ebx, 0
mov dword [esp], ecx
mov dword [esp + 4], ebx
mov dword [esp + 0xc], edx
call fcn.00484da0
mov ebx, dword [ebp - 0x3c]
imul eax, ebx
mov edx, ebx
mov dword [ebp - 0x58], eax
add eax, eax
call fcn.0040e572
mov dword [ebp - 0x3c], eax
test eax, eax
jne 0x40f30f
mov dword [0x4dfd80], 0xc0030008
mov dword [esp], str.Could_not_allocate_disk_write_buffer
call fcn.0043d9e0
jmp 0x40f44e
call fcn.0043df77
xor esi, esi
xor edi, edi
mov dword [esp + 8], eax
mov eax, dword [0x522ec8]
mov dword [esp], 0x498296
mov dword [esp + 4], eax
call fcn.0043d9e0
xor ecx, ecx
mov dword [0x4dfd80], 0xc003006e
mov dword [ebp - 0x3c], ecx
jmp 0x40f737
mov eax, dword [ebp - 0x3c]
xor edx, edx
div dword [0x4df230]
test edx, edx
je 0x40f33a
mov dword [esp + 8], 0x53d
mov dword [esp + 4], str.format.c
mov dword [esp], str._uintptr_t_buffer___SelectedDrive.SectorSize__0
jmp 0x40eb8c
mov eax, dword [ebp - 0x58]
mov ecx, dword [ebp - 0x28]
xor ebx, ebx
mov dword [ebp - 0x64], ebx
mov edx, dword [ebp - 0x3c]
cmp eax, ecx
mov dword [ebp - 0x68], eax
mov eax, dword [ebp - 0x64]
sbb eax, dword [ebp - 0x24]
cmovb ecx, dword [ebp - 0x58]
mov eax, edi
call fcn.0040e901
xor edx, edx
mov eax, 1
mov dword [ebp - 0x1c], 1
mov dword [ebp - 0x60], edx
mov dword [ebp - 0x5c], edx
mov dword [ebp - 0x50], edx
mov dword [ebp - 0x4c], edx
jmp 0x40f386
add dword [ebp - 0x50], eax
mov eax, esi
mov esi, dword [ebp - 0x6c]
adc dword [ebp - 0x4c], 0
cmp dword [ebp + eax*4 - 0x20], 0
je 0x40f488
xor ecx, ecx
mov dword [esp + 0x18], ecx
mov eax, dword [ebp - 0x28]
mov edx, dword [ebp - 0x24]
mov dword [esp + 0x10], eax
mov dword [esp + 0x14], edx
mov eax, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
mov dword [esp + 4], 0xcbd
mov dword [esp + 8], eax
mov dword [esp + 0xc], edx
mov dword [esp], 4
call fcn.0044a2e0
imul ecx, dword [ebp - 0x4c], 0x50
mov eax, 0x50
mov ebx, dword [ebp - 0x24]
mul dword [ebp - 0x50]
add edx, ecx
mov ecx, dword [ebp - 0x28]
mov dword [esp + 0xc], ebx
mov dword [esp], eax
mov dword [esp + 8], ecx
mov dword [esp + 4], edx
call fcn.00485080
mov ebx, edx
mov edx, eax
mov eax, dword [ebp - 0x5c]
cmp dword [ebp - 0x60], edx
sbb eax, ebx
jb 0x40f455
mov eax, dword [ebp - 0x50]
cmp eax, dword [ebp - 0x28]
mov eax, dword [ebp - 0x4c]
sbb eax, dword [ebp - 0x24]
jae 0x40f488
cmp dword [edi + 4], 0
jg 0x40f49b
mov dword [esp + 4], 0x3a98
mov eax, dword [edi + 0x18]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_WaitForSingleObject]
push edx
push edx
test eax, eax
je 0x40f49b
call fcn.0043df77
mov dword [esp], str._r_nRead_error:__s
mov dword [esp + 4], eax
call fcn.0043d9e0
mov dword [0x4dfd80], 0xc003001e
xor esi, esi
jmp 0x40f737
mov ecx, dword [ebp - 0x60]
mov eax, 0x4f
cmp eax, ecx
mov eax, 0
sbb eax, dword [ebp - 0x5c]
jb 0x40f3fd
mov dword [ebp - 0x6c], edx
mov dword [esp], 0x497f25
call fcn.0043db09
add dword [ebp - 0x60], 1
mov edx, dword [ebp - 0x6c]
adc dword [ebp - 0x5c], 0
jmp 0x40f3f3
mov dword [esp], 0x498279
xor esi, esi
call fcn.0043db09
jmp 0x40f720
mov eax, dword [edi + 4]
test eax, eax
jne 0x40f4aa
xor ebx, ebx
mov dword [ebp + esi*4 - 0x20], ebx
jmp 0x40f42f
cmp dword [edi + 0x1c], 0
je 0x40f4c3
mov dword [esp], 0x103
call dword [sym.imp.KERNEL32.DLL_SetLastError]
push ecx
jmp 0x40f42f
shr eax, 0x1f
mov dword [edi + 0x1c], 1
mov dword [esp + 0xc], eax
lea eax, [ebp + esi*4 - 0x20]
mov dword [esp + 8], eax
lea eax, [edi + 8]
mov dword [esp + 4], eax
mov eax, dword [edi]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_GetOverlappedResult]
sub esp, 0x10
test eax, eax
jne 0x40f50c
mov ebx, dword [sym.imp.KERNEL32.DLL_GetLastError]
call ebx
cmp eax, 0x26
je 0x40f518
call ebx
cmp eax, 0x1b
jne 0x40f42f
jmp 0x40f518
xor edx, edx
mov eax, dword [ebp + esi*4 - 0x20]
add dword [edi + 0x10], eax
adc dword [edi + 0x14], edx
mov ecx, dword [ebp + esi*4 - 0x20]
mov ebx, dword [0x4df230]
xor edx, edx
mov eax, ecx
div ebx
test edx, edx
je 0x40f55d
lea ecx, [ecx + ebx - 1]
xor edx, edx
mov eax, ecx
div ebx
sub ecx, edx
cmp dword [ebp - 0x58], ecx
jae 0x40f559
mov dword [esp + 8], 0x558
mov dword [esp + 4], str.format.c
mov dword [esp], str.HI_ALIGN_X_TO_Y_read_size_read_bufnum___SelectedDrive.SectorSize____buf_size
jmp 0x40eb8c
mov dword [ebp + esi*4 - 0x20], ecx
lea eax, [esi + 1]
mov edx, dword [ebp - 0x24]
and eax, 1
mov dword [ebp - 0x6c], eax
mov eax, dword [ebp - 0x28]
mov dword [ebp - 0x74], edx
mov edx, dword [ebp - 0x64]
mov dword [ebp - 0x78], eax
mov eax, dword [ebp + esi*4 - 0x20]
mov ecx, dword [ebp - 0x78]
sub ecx, dword [ebp - 0x50]
mov ebx, dword [ebp - 0x74]
sbb ebx, dword [ebp - 0x4c]
sub ecx, eax
sbb ebx, 0
cmp dword [ebp - 0x68], ecx
mov ecx, dword [ebp - 0x58]
sbb edx, ebx
jb 0x40f59e
mov ebx, dword [ebp - 0x50]
mov ecx, dword [ebp - 0x78]
add eax, ebx
sub ecx, eax
mov eax, dword [ebp - 0x58]
mov edx, dword [ebp - 0x6c]
imul edx, eax
mov eax, dword [ebp - 0x3c]
add edx, eax
mov eax, edi
call fcn.0040e901
mov eax, dword [ebp - 0x58]
mov ebx, dword [ebp - 0x3c]
mov dword [ebp - 0x70], 4
imul eax, esi
add eax, ebx
mov dword [ebp - 0x78], eax
mov eax, dword [0x4dfd80]
test eax, eax
jns 0x40f5db
cmp ax, 0x4c7
je 0x40f44e
xor edx, edx
lea eax, [ebp - 0x30]
mov dword [esp + 0x10], edx
mov dword [esp + 0xc], eax
mov eax, dword [ebp + esi*4 - 0x20]
mov dword [esp + 8], eax
mov eax, dword [ebp - 0x78]
mov dword [esp + 4], eax
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_WriteFile]
sub esp, 0x14
test eax, eax
je 0x40f62f
mov eax, dword [ebp + esi*4 - 0x20]
mov edx, dword [ebp - 0x30]
cmp eax, edx
je 0x40f37a
mov dword [esp + 8], eax
mov dword [esp + 4], edx
mov dword [esp], str._r_nWrite_error:_Wrote__d_bytes__expected__d_bytes
call fcn.0043d9e0
jmp 0x40f682
call fcn.0043df77
mov dword [esp + 0xc], eax
mov eax, dword [esp + 8]
mov edx, dword [esp + 0xc]
mov dword [ebp - 0x80], eax
mov eax, dword [0x4df230]
mov dword [ebp - 0x7c], edx
mov dword [esp + 8], eax
xor eax, eax
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
mov dword [esp], eax
mov dword [esp + 4], edx
call fcn.00485080
mov ebx, dword [ebp - 0x7c]
mov dword [esp], str._r_nWrite_error_at_sector__lld:__s
mov dword [esp + 4], eax
mov dword [esp + 0xc], ebx
mov dword [esp + 8], edx
call fcn.0043d9e0
dec dword [ebp - 0x70]
je 0x40f6f6
mov dword [esp + 4], 5
mov dword [esp], 0x498234
call fcn.0043d9e0
mov edx, dword [sym.imp.KERNEL32.DLL_Sleep]
mov dword [esp], 0x1388
mov dword [ebp - 0x80], edx
call edx
push eax
xor eax, eax
mov dword [esp + 0x10], eax
mov dword [esp + 0xc], eax
mov eax, dword [ebp - 0x50]
mov edx, dword [ebp - 0x4c]
mov dword [esp + 4], eax
mov dword [esp + 8], edx
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call dword [sym.imp.KERNEL32.DLL_SetFilePointerEx]
mov edx, dword [ebp - 0x80]
sub esp, 0x14
test eax, eax
jne 0x40f705
call fcn.0043df77
mov dword [esp], 0x49824e
mov dword [esp + 4], eax
call fcn.0043d9e0
jmp 0x40f44e
mov dword [0x4dfd80], 0xc003001d
jmp 0x40f44e
mov dword [esp], 0xc8
call edx
push eax
jmp 0x40f5c8
xor eax, eax
xor esi, esi
mov dword [ebp - 0x3c], eax
mov dword [ebp - 0x48], esi
xor esi, esi
mov eax, dword [ebp - 0x40]
mov dword [esp], eax
call fcn.0040b472
jmp 0x40f737
xor ebx, ebx
xor esi, esi
mov dword [ebp - 0x3c], ebx
or edi, 0xffffffff
mov al, byte [0x51078c]
lea edx, [edi - 1]
dec eax
cmp al, 7
ja 0x40f755
cmp edx, 0xfffffffd
ja 0x40f779
mov dword [esp], edi
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
push ecx
jmp 0x40f779
cmp edx, 0xfffffffd
ja 0x40f779
mov eax, dword [edi]
mov ebx, dword [sym.imp.KERNEL32.DLL_CloseHandle]
mov dword [esp], eax
call ebx
push eax
mov eax, dword [edi + 0x18]
mov dword [esp], eax
call ebx
push edx
mov dword [esp], edi
call sub.msvcrt.dll_free
cmp dword [ebp - 0x48], 0
je 0x40f784
call fcn.0044e156
mov eax, dword [ebp - 0x3c]
call fcn.0040e5c2
mov eax, esi
call fcn.0040e5c2
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret