Function at 0x402fa0
Capabilities:
Read file on windows
Terminate process

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x24
push ebx
push esi
push edi
push 0x406510
push dword [ebp + 8]
mov dword [ebp - 0x1c], edx
mov ebx, ecx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov edi, eax
add esp, 8
mov dword [ebp - 0x20], edi
test edi, edi
jne 0x402fe9
push str.fopen_load__failed_n
push 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
add esp, 4
push eax
call fcn.00401050
add esp, 8
push 1
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fseek]
push 2
push 0
push edi
call esi
add esp, 0xc
push edi
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll__ftelli64]
add esp, 4
mov dword [ebp - 4], eax
mov dword [ebp - 0x14], edx
push 0
push 0
push edi
call esi
mov edi, dword [ebp - 0x14]
add esp, 0xc
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push edi
push dword [ebp - 4]
push str.file_size_:_0x_llx_n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
mov ecx, str.write_partition
call fcn.00401b10
mov edx, dword [ebp - 0x1c]
mov ecx, ebx
push 1
push edi
push edi
push dword [ebp - 4]
call fcn.00402240
add esp, 0x20
mov ecx, ebx
call fcn.00401680
mov ecx, ebx
call fcn.00401790
test eax, eax
jne 0x40307f
push str.timeout_reached_n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
add esp, 8
push 1
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
cmp dword [ebx + 0x20], 6
jge 0x40308a
or ecx, 0xffffffff
jmp 0x4030a0
mov eax, dword [ebx]
movzx ecx, byte [eax + 1]
movzx eax, byte [eax]
shl eax, 8
or ecx, eax
cmp ecx, 0x80
je 0x4030be
push ecx
push str.unexpected_response__0x_04x__n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
add esp, 0xc
push 1
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
mov eax, dword [ebp - 4]
xorps xmm0, xmm0
mov ecx, dword [ebp - 0x14]
mov edi, eax
or eax, ecx
movlpd qword [ebp - 0x10], xmm0
je 0x4031ce
mov eax, dword [ebp - 0xc]
mov dword [ebp - 0x18], eax
mov eax, dword [ebp - 0x10]
mov dword [ebp - 0xc], eax
mov edx, dword [ebp + 0xc]
test ecx, ecx
jb 0x4030f1
ja 0x4030ef
cmp edi, edx
jbe 0x4030f1
mov edi, edx
push dword [ebp - 0x20]
push edi
push 1
push dword [ebx + 0xc]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fread]
add esp, 0x10
cmp eax, edi
jne 0x4031c7
push edi
push dword [ebx + 0xc]
mov edx, 2
mov ecx, ebx
call fcn.00401550
add esp, 8
mov ecx, ebx
call fcn.00401680
mov esi, dword [ebx + 0x2c]
mov eax, 0x3a98
cmp esi, eax
mov ecx, ebx
cmovg eax, esi
mov dword [ebx + 0x2c], eax
call fcn.00401790
mov dword [ebx + 0x2c], esi
test eax, eax
je 0x4031a5
mov ecx, ebx
call fcn.00401af0
cmp eax, 0x80
jne 0x403181
mov esi, dword [ebp - 0xc]
mov edx, dword [ebp - 0x18]
add esi, edi
mov edi, dword [ebp - 4]
mov ecx, dword [ebp - 0x14]
adc edx, 0
sub edi, esi
mov dword [ebp - 0xc], esi
mov eax, edi
mov dword [ebp - 0x18], edx
sbb ecx, edx
or eax, ecx
jne 0x4030e2
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
mov eax, dword [ebp - 0xc]
jmp 0x4031d4
mov esi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push eax
push str.unexpected_response__0x_04x__n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
mov edx, dword [ebp - 0x18]
add esp, 0xc
mov eax, dword [ebp - 0xc]
jmp 0x4031d4
push str.timeout_reached_n
mov eax, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
push 2
call eax
add esp, 4
push eax
call fcn.00401050
add esp, 8
push 1
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_exit]
push str.fread_load__failed_n
jmp 0x4031aa
mov edx, dword [ebp - 0xc]
mov eax, dword [ebp - 0x10]
push edx
push eax
push dword [ebp - 0x14]
push dword [ebp - 4]
push dword [ebp - 0x1c]
push str.load_partition:__s__target:_0x_llx__written:_0x_llx_n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
add esp, 0x1c
push dword [ebp - 0x20]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
mov edx, 3
mov ecx, ebx
push 0
push 0
call fcn.00401550
add esp, 8
mov ecx, ebx
call fcn.00401680
mov ecx, ebx
call fcn.00401790
test eax, eax
je 0x403062
cmp dword [ebx + 0x20], 6
jge 0x403234
or ecx, 0xffffffff
jmp 0x40324a
mov eax, dword [ebx]
movzx ecx, byte [eax + 1]
movzx eax, byte [eax]
shl eax, 8
or ecx, eax
cmp ecx, 0x80
je 0x403265
push ecx
push str.unexpected_response__0x_04x__n
push 2
call esi
add esp, 4
push eax
call fcn.00401050
add esp, 0xc
jmp 0x403077
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret