Function at 0x4057c1
Capabilities:
Enumerate pe sections
Parse pe header
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 [0x40a078], 0
jne 0x4056a2
mov byte [0x40a078], 1
mov edx, dword [0x407004]
movzx ecx, word [edx]
xor eax, eax
cmp ecx, 0x5a4d
jne 0x4055ba
mov ecx, dword [edx + 0x3c]
cmp dword [edx + ecx], 0x4550
jne 0x4055ba
movzx edx, word [edx + ecx + 0x18]
cmp edx, 0x10b
mov edx, dword [0x407004]
jne 0x4055ba
movzx eax, word [edx + ecx + 6]
shl eax, 2
lea eax, [eax + eax*4]
add eax, 3
and eax, 0xfffffffc
call fcn.004014ee
mov eax, esp
and eax, 0xfffffff0
mov esp, eax
mov dword [0x40a4f8], eax
mov dword [0x40a4ac], 0
mov ebx, 0x409720
mov eax, 0x409720
sub eax, ebx
cmp eax, 7
jle 0x4056a2
cmp eax, 0xc
jl 0x40561b
cmp dword [0x409720], 0
jne 0x40562a
cmp dword [0x409724], 0
jne 0x40562a
cmp dword [0x409728], 0
mov eax, 0x409720
mov ebx, 0x40972c
cmovne ebx, eax
cmp dword [ebx], 0
jne 0x40562a
cmp dword [ebx + 4], 0
je 0x4056aa
cmp ebx, 0x409720
jae 0x40565f
lea edi, [esi + 0x14]
mov eax, dword [ebx]
mov ecx, dword [ebx + 4]
add eax, dword [ecx + edx]
add ecx, edx
mov dword [esi + 0x14], eax
mov edx, edi
push 4
call 0x4057c1
mov edx, dword [0x407004]
add esp, 4
add ebx, 8
cmp ebx, 0x409720
jb 0x405635
mov eax, dword [0x40a4ac]
test eax, eax
jle 0x4056a2
xor edi, edi
mov ebx, 8
mov ecx, dword [0x40a4f8]
mov edx, dword [ecx + ebx - 8]
test edx, edx
je 0x40569a
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 [0x40a4f8]
mov eax, dword [0x40a4ac]
inc edi
add ebx, 0x14
cmp edi, eax
jl 0x405675
lea esp, [ebp - 0xc]
pop esi
pop edi
pop ebx
pop ebp
ret
mov eax, dword [ebx + 8]
cmp eax, 1
jne 0x4057b6
add ebx, 0xc
cmp ebx, 0x409720
jae 0x40565f
mov eax, dword [ebx + 4]
add eax, edx
mov edi, dword [ebx]
mov ecx, dword [ebx + 8]
mov edx, dword [edi + edx]
mov dword [esi + 0xc], edx
cmp cl, 0x20
mov dword [esi + 0x10], ecx
movzx edx, cl
mov dword [esi + 8], eax
je 0x40570f
cmp edx, 0x10
je 0x4056fc
cmp edx, 8
jne 0x4057ab
mov ecx, edi
movzx eax, byte [eax]
lea edi, [eax - 0x100]
test al, al
jmp 0x40570a
mov ecx, edi
movzx eax, word [eax]
lea edi, [eax - 0x10000]
test ax, ax
cmovns edi, eax
jmp 0x405713
mov ecx, edi
mov edi, dword [eax]
add ecx, dword [0x407004]
sub edi, ecx
add edi, dword [esi + 0xc]
mov dword [esi + 0x18], edi
cmp edx, 0x1f
ja 0x40574b
xor eax, eax
dec eax
mov ecx, edx
shl eax, cl
test dl, 0x20
mov ecx, 0
cmovne eax, ecx
not eax
cmp edi, eax
jg 0x405799
mov ecx, edx
dec cl
xor eax, eax
dec eax
shl eax, cl
cmp edi, eax
jl 0x405799
mov eax, dword [esi + 0x10]
cmp al, 8
mov edi, 1
je 0x405770
movzx eax, al
cmp eax, 0x20
je 0x40576b
cmp eax, 0x10
jne 0x40577f
mov edi, 2
jmp 0x405770
mov edi, 4
mov ecx, dword [esi + 8]
lea edx, [esi + 0x18]
push edi
call 0x4057c1
add esp, 4
add ebx, 0xc
cmp ebx, 0x409720
mov edx, dword [0x407004]
jb 0x4056c1
jmp 0x40565f
push edi
push dword [esi + 0xc]
push dword [esi + 8]
push edx
push str._d_bit_pseudo_relocation_at__p_out_of_range__targeting__p__yielding_the_value__p._n
call 0x405933
push edx
push str.__Unknown_pseudo_relocation_bit_size__d._n
call 0x405933
push eax
push str.__Unknown_pseudo_relocation_protocol_version__d._n
call 0x405933
push ebp
push ebx
push edi
push esi
sub esp, 0x20
mov ebp, edx
mov esi, ecx
mov eax, dword [0x40a4ac]
test eax, eax
jle 0x4057ff
mov ecx, dword [0x40a4f8]
add ecx, 0x10
mov edx, eax
mov edi, dword [ecx - 4]
cmp edi, esi
ja 0x4057f4
mov ebx, dword [ecx]
add edi, dword [ebx + 8]
cmp edi, esi
ja 0x4058f9
add ecx, 0x14
dec edx
jne 0x4057e0
mov dword [esp], ebp
jmp 0x405804
mov dword [esp], ebp
xor eax, eax
mov ebx, dword [0x407004]
movzx ecx, word [ebx]
cmp ecx, 0x5a4d
jne 0x40585d
mov ecx, dword [ebx + 0x3c]
cmp dword [ebx + ecx], 0x4550
jne 0x40585d
add ebx, ecx
movzx ecx, word [ebx + 0x18]
cmp ecx, 0x10b
jne 0x40585d
movzx ecx, word [ebx + 6]
test ecx, ecx
je 0x40585d
mov edx, esi
sub edx, dword [0x407004]
movzx edi, word [ebx + 0x14]
lea ebp, [ebx + edi + 0x18]
mov edi, dword [ebp + 0xc]
cmp edi, edx
ja 0x405857
mov ebx, dword [ebp + 8]
add ebx, edi
cmp ebx, edx
ja 0x405868
add ebp, 0x28
dec ecx
jne 0x405847
push esi
push str.Address__p_has_no_image_section
call 0x405933
mov ecx, dword [0x40a4f8]
lea ebx, [eax + eax*4]
mov dword [ecx + ebx*4 + 0x10], ebp
mov dword [ecx + ebx*4], 0
add edi, dword [0x407004]
mov dword [ecx + ebx*4 + 0xc], edi
lea eax, [esp + 4]
push 0x1c
push eax
push edi
call dword [sym.imp.KERNEL32.dll_VirtualQuery]
test eax, eax
je 0x40590c
mov eax, dword [esp + 0x18]
cmp eax, 7
jle 0x4058b7
cmp eax, 8
mov ebp, dword [esp]
je 0x4058f3
cmp eax, 0x40
je 0x4058f3
cmp eax, 0x80
je 0x4058f3
jmp 0x4058c9
mov ecx, 4
cmp eax, 2
mov ebp, dword [esp]
je 0x4058ce
cmp eax, 4
je 0x4058f3
mov ecx, 0x40
mov eax, dword [esp + 4]
mov edx, dword [0x40a4f8]
lea edx, [edx + ebx*4]
mov dword [edx + 4], eax
mov edi, dword [esp + 0x10]
mov dword [edx + 8], edi
push edx
push ecx
push edi
push eax
call dword [sym.imp.KERNEL32.dll_VirtualProtect]
test eax, eax
je 0x405922
inc dword [0x40a4ac]
push dword [esp + 0x34]
push ebp
push esi
call fcn.0040354f
add esp, 0x2c
pop esi
pop edi
pop ebx
pop ebp
ret
mov eax, dword [0x40a4f8]
push dword [eax + ebx*4 + 0xc]
push dword [ebp + 8]
push str.__VirtualQuery_failed_for__d_bytes_at_address__p
call 0x405933
call dword [sym.imp.KERNEL32.dll_GetLastError]
push eax
push str.__VirtualProtect_failed_with_code_0x_x
call 0x405933
push edi
push esi
push eax
mov esi, dword [esp + 0x10]
lea eax, [esp + 0x14]
mov dword [esp], eax
mov edi, 2
push edi
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 edi
call sub.api_ms_win_crt_stdio_l1_1_0.dll___acrt_iob_func
add esp, 4
mov ecx, eax
mov edx, esi
push dword [esp]
call fcn.00405bcc
add esp, 4
call sub.api_ms_win_crt_runtime_l1_1_0.dll_abort
push ebx
mov eax, dword [esp + 8]
mov eax, dword [eax]
mov eax, dword [eax]
lea ecx, [eax + 0x3fffff73]
cmp ecx, 9
ja case.default.0x405994
mov bl, 1
jmp dword [ecx*4 + 0x4096e8]
xor ebx, ebx
push 0
push 8
call sub.api_ms_win_crt_runtime_l1_1_0.dll_signal
add esp, 8
test eax, eax
je case.0x405994.1073741678
cmp eax, 1
jne 0x4059f2
push 1
push 8
call sub.api_ms_win_crt_runtime_l1_1_0.dll_signal
add esp, 8
xor eax, eax
dec eax
test bl, bl
jne 0x405a37
fninit
jmp 0x405a37
cmp eax, 0xc000001d
je case.0x405994.1073741674
cmp eax, 0xc0000005
jne case.0x405994.1073741678
push 0
push 0xb
call sub.api_ms_win_crt_runtime_l1_1_0.dll_signal
add esp, 8
test eax, eax
je case.0x405994.1073741678
cmp eax, 1
jne 0x405a2d
push 1
push 0xb
jmp 0x405a0f
push 8
jmp 0x405a2f
push 0
push 4
call sub.api_ms_win_crt_runtime_l1_1_0.dll_signal
add esp, 8
test eax, eax
je case.0x405994.1073741678
cmp eax, 1
jne 0x405a29
push 1
push 4
call sub.api_ms_win_crt_runtime_l1_1_0.dll_signal
add esp, 8
jmp 0x405a34
mov eax, dword [0x40a040]
test eax, eax
je 0x405a25
pop ebx
jmp eax
xor eax, eax
jmp 0x405a37
push 4
jmp 0x405a2f
push 0xb
call eax
add esp, 4
xor eax, eax
dec eax
pop ebx
ret 4