Function at 0x521450
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push ebx
push edi
push esi
and esp, 0xfffffff0
sub esp, 0x30
mov esi, esp
cmp byte [0x585f34], 0
jne 0x5211cf
mov byte [0x585f34], 1
call fcn.00522070
shl eax, 2
lea eax, [eax + eax*4]
call fcn.005222a0
mov eax, esp
and eax, 0xfffffff0
mov esp, eax
mov dword [0x585f38], eax
mov dword [0x585f3c], 0
mov ecx, dword [0x565ab4]
mov eax, ecx
sub eax, dword [0x565ab8]
cmp eax, 7
jle 0x5211cf
mov ebx, dword [0x565ab8]
mov eax, ecx
sub eax, ebx
cmp eax, 0xc
jl 0x521138
cmp dword [ebx], 0
jne 0x521147
cmp dword [ebx + 4], 0
jne 0x521147
mov eax, dword [0x565ab8]
lea ebx, [eax + 0xc]
cmp dword [eax + 8], 0
cmovne ebx, eax
cmp dword [ebx], 0
jne 0x521147
cmp dword [ebx + 4], 0
je 0x5211d7
cmp ebx, dword [0x565ab4]
jae 0x521185
mov edi, dword [0x523004]
nop word cs:[eax + eax]
mov eax, dword [ebx]
mov ecx, dword [ebx + 4]
add eax, dword [ecx + edi]
add ecx, edi
mov dword [esi + 0x14], eax
lea edx, [esi + 0x14]
push 4
call 0x5212f0
add esp, 4
add ebx, 8
cmp ebx, dword [0x565ab4]
jb 0x521160
mov eax, dword [0x585f3c]
test eax, eax
jle 0x5211cf
xor edi, edi
mov ebx, 8
mov ecx, dword [0x585f38]
jmp 0x5211a8
inc edi
add ebx, 0x14
cmp edi, eax
jge 0x5211cf
mov edx, dword [ecx + ebx - 8]
test edx, edx
je 0x5211a0
lea eax, [esi + 0x1c]
push eax
push edx
push dword [ecx + ebx]
push dword [ecx + ebx - 4]
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
mov ecx, dword [0x585f38]
mov eax, dword [0x585f3c]
jmp 0x5211a0
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
mov eax, dword [ebx + 8]
cmp eax, 1
je 0x5211fb
push eax
push str.__Unknown_pseudo_relocation_protocol_version__d._n
call 0x521450
mov eax, 4
lea edx, [esi + 0x18]
push eax
call 0x5212f0
add esp, 4
add ebx, 0xc
cmp ebx, dword [0x565ab4]
jae 0x521185
mov edi, dword [ebx + 4]
mov edx, dword [0x523004]
add edi, edx
mov ecx, dword [ebx]
mov eax, dword [ebx + 8]
mov edx, dword [ecx + edx]
mov dword [esi + 0x10], edx
movzx edx, al
cmp al, 0x20
mov dword [esi + 0xc], edi
mov dword [esi + 8], edx
je 0x521248
cmp edx, 0x10
je 0x52124c
cmp edx, 8
jne 0x5212e3
movzx edx, byte [edi]
lea edi, [edx - 0x100]
test dl, dl
jmp 0x521258
mov edi, dword [edi]
jmp 0x52125e
movzx edx, word [edi]
lea edi, [edx - 0x10000]
test dx, dx
cmovns edi, edx
mov edx, dword [esi + 8]
add ecx, dword [0x523004]
sub edi, ecx
add edi, dword [esi + 0x10]
mov dword [esi + 0x18], edi
cmp edx, 0x1f
ja 0x52129c
mov edx, 0xffffffff
mov ecx, dword [esi + 8]
shl edx, cl
test cl, 0x20
mov ecx, 0
cmovne edx, ecx
not edx
cmp edi, edx
jg 0x5212cf
mov ecx, dword [esi + 8]
dec cl
mov edx, 0xffffffff
shl edx, cl
cmp edi, edx
jl 0x5212cf
cmp al, 8
je 0x5212c2
movzx eax, al
cmp eax, 0x20
mov ecx, dword [esi + 0xc]
je 0x5211ea
cmp eax, 0x10
jne 0x5211fb
mov eax, 2
jmp 0x5211ef
mov eax, 1
mov ecx, dword [esi + 0xc]
jmp 0x5211ef
push edi
push dword [esi + 0x10]
push dword [esi + 0xc]
push dword [esi + 8]
push str._d_bit_pseudo_relocation_at__p_out_of_range__targeting__p__yielding_the_value__p._n
call 0x521450
push dword [esi + 8]
push str.__Unknown_pseudo_relocation_bit_size__d._n
call 0x521450
push ebp
push ebx
push edi
push esi
sub esp, 0x20
mov dword [esp], edx
mov esi, ecx
mov ebp, dword [0x585f3c]
test ebp, ebp
jle 0x52133b
mov eax, dword [0x585f38]
add eax, 0x10
mov ecx, ebp
jmp 0x521326
add eax, 0x14
dec ecx
je 0x52133d
mov edx, dword [eax - 4]
cmp edx, esi
ja 0x521320
mov ebx, dword [eax]
add edx, dword [ebx + 8]
cmp edx, esi
jbe 0x521320
jmp 0x5213f8
xor ebp, ebp
push esi
call fcn.00522000
add esp, 4
test eax, eax
je 0x52140e
mov ebx, eax
mov eax, dword [0x585f38]
lea ecx, [ebp*4]
lea edi, [ecx + ecx*4]
mov dword [eax + edi + 0x10], ebx
mov dword [eax + edi], 0
call fcn.00522120
add eax, dword [ebx + 0xc]
mov ecx, dword [0x585f38]
mov dword [ecx + edi + 0xc], eax
lea ecx, [esp + 4]
push 0x1c
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_VirtualQuery]
test eax, eax
je 0x521419
mov eax, dword [esp + 0x18]
cmp eax, 7
jle 0x5213ae
cmp eax, 8
je 0x5213f2
cmp eax, 0x40
je 0x5213f2
cmp eax, 0x80
je 0x5213f2
jmp 0x5213bd
mov ecx, 4
cmp eax, 2
je 0x5213c2
cmp eax, 4
je 0x5213f2
mov ecx, 0x40
mov eax, dword [esp + 4]
mov edx, dword [0x585f38]
lea edi, [ebp*4]
add edi, ebp
lea ebx, [edx + edi*4]
mov dword [edx + edi*4 + 4], eax
mov ebp, dword [esp + 0x10]
mov dword [edx + edi*4 + 8], ebp
push ebx
push ecx
push ebp
push eax
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
test eax, eax
je 0x521438
inc dword [0x585f3c]
push dword [esp + 0x34]
push dword [esp + 4]
push esi
call sub.api_ms_win_crt_private_l1_1_0.dll_memcpy
add esp, 0x2c
pop esi
pop edi
pop ebx
pop ebp
ret
push esi
push str.Address__p_has_no_image_section
call 0x521450
mov eax, dword [0x585f38]
lea ecx, [ebp*4]
add ecx, ebp
push dword [eax + ecx*4 + 0xc]
push dword [ebx + 8]
push str.__VirtualQuery_failed_for__d_bytes_at_address__p
call 0x521450
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.__VirtualProtect_failed_with_code_0x_x
call 0x521450
nop dword [eax]
push esi
push eax
mov esi, dword [esp + 0xc]
lea eax, [esp + 0x10]
mov dword [esp], eax
push 2
call sub.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func
add esp, 4
push eax
push 1
push 0x1b
push str.Mingw_w64_runtime_failure:_n
call sub.api_ms_win_crt_stdio_l1_1_0.dll_fwrite
add esp, 0x10
push 2
call sub.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func
add esp, 4
push dword [esp]
push esi
push eax
call fcn.005222e0
add esp, 0xc
call sub.api_ms_win_crt_runtime_l1_1_0.dll_abort
int3