Function at 0x520000
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, dword [0xa1c3c8]
sub esp, 0x10
cmp dword [eax + 0x10], 0
push edi
mov edi, dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func]
je 0x52002d
push str.BEGIN_Checkpoint_Write_n
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 8
push 0x5a9888
push dword [ebp + 8]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fopen]
mov ecx, eax
add esp, 8
mov dword [ebp - 4], ecx
test ecx, ecx
jne 0x52009e
mov dword [0x801438], 1
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
push eax
push str.Cannot_open_checkpoint_file:__.200s
push str.No_error
call fcn.004f9620
mov eax, dword [0xa1c3c8]
add esp, 0x10
cmp dword [eax + 0x10], 0
je 0x520097
push str.No_error
push 0x5a02a8
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 0xc
xor eax, eax
pop edi
mov esp, ebp
pop ebp
ret
mov eax, dword [0xa1c3c8]
push ebx
push esi
mov ebx, 1
mov esi, dword [eax + 0x14]
test esi, esi
je 0x520142
mov eax, dword [esi]
push ecx
mov dword [ebp - 0x10], eax
mov eax, dword [esi + 4]
push 8
mov dword [ebp - 0xc], eax
lea eax, [ebp - 0x10]
push 1
push eax
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
add esp, 0x10
push dword [ebp - 4]
cmp eax, 8
jb 0x520256
push dword [ebp - 0xc]
push 1
push dword [ebp - 0x10]
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fwrite]
add esp, 0x10
mov dword [ebp - 8], eax
cmp eax, dword [ebp - 0xc]
jb 0x5201d2
mov eax, dword [0xa1c3c8]
cmp dword [eax + 0x10], 0
je 0x520133
mov ecx, dword [esi + 0x10]
mov edx, dword [ebp - 0x10]
test ecx, ecx
je 0x520116
mov eax, edx
sub eax, dword [ecx]
jmp 0x520118
xor eax, eax
push eax
push dword [ebp - 0xc]
push edx
push ebx
push str.Arena__3zu_Written:_Address__10p___Size__10zu___Offset__10lu_n
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 0x18
mov esi, dword [esi + 0x10]
inc ebx
mov ecx, dword [ebp - 4]
test esi, esi
jne 0x5200b5
mov esi, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
mov ebx, 2
push ecx
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_fclose]
add esp, 4
test eax, eax
je 0x5201a9
mov dword [0x801438], 3
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll__errno]
push dword [eax]
call esi
push eax
push str.Cannot_close_checkpoint_file:__.200s
push str.No_error
call fcn.004f9620
mov eax, dword [0xa1c3c8]
add esp, 0x10
cmp dword [eax + 0x10], 0
je 0x5201a7
push str.No_error
push 0x5a02a8
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 0xc
xor ebx, ebx
mov eax, dword [0xa1c3c8]
cmp dword [eax + 0x10], 0
je 0x5201c9
push str.END_Checkpoint_Write_n
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 8
pop esi
mov eax, ebx
pop ebx
pop edi
mov esp, ebp
pop ebp
ret
push dword [ebp - 4]
mov dword [0x801438], 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ferror]
mov esi, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
push eax
call esi
push eax
push str.Error_writing_to_checkpoint_file:__.200s
push str.No_error
call fcn.004f9620
mov eax, dword [0xa1c3c8]
add esp, 0x14
cmp dword [eax + 0x10], 0
je 0x52024c
push str.No_error
push 0x5a02a8
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
push str.CheckPoint_arena_write_error
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
add esp, 0x10
push dword [ebp - 0xc]
push dword [ebp - 8]
push str.Number_written___zu_out_of__zu_n
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
add esp, 0x10
mov ecx, dword [ebp - 4]
xor ebx, ebx
jmp 0x52014d
mov dword [0x801438], 2
call dword [sym.imp.api_ms_win_crt_stdio_l1_1_0.dll_ferror]
mov esi, dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_strerror]
push eax
call esi
push eax
push str.Error_writing_to_checkpoint_file:__.200s
push str.No_error
call fcn.004f9620
mov eax, dword [0xa1c3c8]
add esp, 0x14
cmp dword [eax + 0x10], 0
je 0x52024c
push str.No_error
push 0x5a02a8
push 1
call edi
add esp, 4
push eax
call fcn.0049cc60
push str.CheckPoint_header_write_error
call dword [sym.imp.api_ms_win_crt_runtime_l1_1_0.dll_perror]
mov ecx, dword [ebp - 4]
add esp, 0x10
xor ebx, ebx
jmp 0x52014d