Function at 0x405040
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 [0x418198], 0
jne 0x404e0f
mov byte [0x418198], 1
call fcn.004150d0
shl eax, 2
lea eax, [eax + eax*4]
call fcn.00405dc0
mov eax, esp
and eax, 0xfffffff0
mov esp, eax
mov dword [0x41819c], eax
mov dword [0x4181a0], 0
mov ecx, dword [0x4163bc]
mov eax, ecx
sub eax, dword [0x4163c0]
cmp eax, 7
jle 0x404e0f
mov ebx, dword [0x4163c0]
mov eax, ecx
sub eax, ebx
cmp eax, 0xc
jl 0x404d74
mov ebx, dword [0x4163c0]
cmp dword [ebx], 0
jne 0x404d74
mov ebx, dword [0x4163c0]
cmp dword [ebx + 4], 0
jne 0x404d74
mov eax, dword [0x4163c0]
lea ebx, [eax + 0xc]
cmp dword [eax + 8], 0
cmovne ebx, eax
cmp dword [ebx], 0
jne 0x404d83
cmp dword [ebx + 4], 0
je 0x404e17
cmp ebx, dword [0x4163bc]
jae 0x404dc5
mov edi, dword [0x41615c]
nop word cs:[eax + eax]
nop dword [eax + eax]
mov eax, dword [ebx]
mov ecx, dword [ebx + 4]
add eax, dword [ecx + edi]
add ecx, edi
mov dword [esi + 0x18], eax
lea edx, [esi + 0x18]
push 4
call 0x404ee0
add esp, 4
add ebx, 8
cmp ebx, dword [0x4163bc]
jb 0x404da0
mov eax, dword [0x4181a0]
test eax, eax
jle 0x404e0f
xor edi, edi
mov ebx, 8
mov ecx, dword [0x41819c]
jmp 0x404de8
inc edi
add ebx, 0x14
cmp edi, eax
jge 0x404e0f
mov edx, dword [ecx + ebx - 8]
test edx, edx
je 0x404de0
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 [0x41819c]
mov eax, dword [0x4181a0]
jmp 0x404de0
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
mov eax, dword [ebx + 8]
cmp eax, 1
je 0x404e41
push eax
push str.__Unknown_pseudo_relocation_protocol_version__d._n
call 0x405040
sub eax, edi
mov ecx, dword [esi + 0x10]
add eax, dword [ecx]
mov dword [esi + 0xc], eax
lea edx, [esi + 0xc]
push 4
call 0x404ee0
add esp, 4
add ebx, 0xc
cmp ebx, dword [0x4163bc]
jae 0x404dc5
mov ecx, dword [ebx + 4]
mov edx, dword [0x41615c]
add ecx, edx
mov dword [esi + 0x10], ecx
mov edi, dword [ebx]
mov ecx, dword [ebx + 8]
mov eax, dword [edi + edx]
add edi, edx
cmp cl, 0x20
je 0x404e2a
cmp cl, 0x10
je 0x404ea1
cmp cl, 8
jne 0x404ec7
mov edx, dword [esi + 0x10]
movzx ecx, byte [edx]
mov dword [esi + 0x14], ecx
mov ecx, dword [esi + 0x14]
add ecx, 0xffffff00
cmp byte [esi + 0x14], 0
cmovns ecx, dword [esi + 0x14]
sub eax, edi
add eax, ecx
mov dword [esi + 0xc], eax
mov ecx, edx
lea edx, [esi + 0xc]
push 1
jmp 0x404e39
mov ecx, dword [esi + 0x10]
movzx edx, word [ecx]
lea ecx, [edx - 0x10000]
test dx, dx
cmovns ecx, edx
sub eax, edi
add eax, ecx
mov dword [esi + 0xc], eax
mov ecx, dword [esi + 0x10]
lea edx, [esi + 0xc]
push 2
jmp 0x404e39
movzx eax, cl
push eax
push str.__Unknown_pseudo_relocation_bit_size__d._n
call 0x405040
nop word cs:[eax + eax]
nop
push ebp
mov ebp, esp
push ebx
push edi
push esi
sub esp, 0x28
mov dword [ebp - 0x18], edx
mov esi, ecx
mov edi, dword [0x4181a0]
test edi, edi
jle 0x404f2b
mov eax, dword [0x41819c]
add eax, 0x10
mov ecx, edi
jmp 0x404f16
add eax, 0x14
dec ecx
je 0x404f2d
mov edx, dword [eax - 4]
cmp edx, esi
ja 0x404f10
mov ebx, dword [eax]
add edx, dword [ebx + 8]
cmp edx, esi
jbe 0x404f10
jmp 0x404fe9
xor edi, edi
push esi
call fcn.00415060
add esp, 4
test eax, eax
je 0x404ffd
mov ebx, eax
mov eax, dword [0x41819c]
mov dword [ebp - 0x10], edi
lea ecx, [edi*4]
lea edi, [ecx + ecx*4]
mov dword [eax + edi + 0x10], ebx
mov dword [eax + edi], 0
call fcn.00415180
add eax, dword [ebx + 0xc]
mov ecx, dword [0x41819c]
mov dword [ecx + edi + 0xc], eax
lea ecx, [ebp - 0x34]
push 0x1c
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_VirtualQuery]
test eax, eax
je 0x405008
mov eax, dword [ebp - 0x20]
cmp eax, 7
mov ecx, dword [ebp - 0x10]
jle 0x404fa2
cmp eax, 8
je 0x404fe3
cmp eax, 0x40
je 0x404fe3
cmp eax, 0x80
je 0x404fe3
jmp 0x404fb1
mov edx, 4
cmp eax, 2
je 0x404fb6
cmp eax, 4
je 0x404fe3
mov edx, 0x40
mov dword [ebp - 0x14], edx
mov eax, dword [ebp - 0x34]
mov edx, dword [0x41819c]
lea edi, [ecx + ecx*4]
lea ebx, [edx + edi*4]
mov dword [edx + edi*4 + 4], eax
mov ecx, dword [ebp - 0x28]
mov dword [edx + edi*4 + 8], ecx
push ebx
push dword [ebp - 0x14]
push ecx
push eax
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
test eax, eax
je 0x405024
inc dword [0x4181a0]
push dword [ebp + 8]
push dword [ebp - 0x18]
push esi
call sub.msvcrt.dll_memcpy
add esp, 0x34
pop esi
pop edi
pop ebx
pop ebp
ret
push esi
push str.Address__p_has_no_image_section
call 0x405040
mov eax, dword [0x41819c]
mov ecx, dword [ebp - 0x10]
lea ecx, [ecx + ecx*4]
push dword [eax + ecx*4 + 0xc]
push dword [ebx + 8]
push str.__VirtualQuery_failed_for__d_bytes_at_address__p
call 0x405040
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.__VirtualProtect_failed_with_code_0x_x
call 0x405040
nop word cs:[eax + eax]
nop
push ebp
mov ebp, esp
push esi
push eax
mov esi, dword [ebp + 8]
lea eax, [ebp + 0xc]
mov dword [ebp - 8], eax
push 2
call fcn.00414f20
add esp, 4
push eax
push 1
push 0x1b
push str.Mingw_w64_runtime_failure:_n
call sub.msvcrt.dll_fwrite
add esp, 0x10
push 2
call fcn.00414f20
add esp, 4
push dword [ebp - 8]
push esi
push eax
call sub.msvcrt.dll_vfprintf
add esp, 0xc
call sub.msvcrt.dll_abort
int3