Function at 0x407030
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x58
mov eax, dword [0x590a50]
xor eax, ebp
mov dword [ebp - 8], eax
push ebx
push esi
mov esi, dword [ebp + 0xc]
mov ebx, edx
push edi
mov edi, dword [ebp + 0x10]
mov dword [ebp - 0x48], 0
cmp ebx, 8
jne 0x40705e
mov dword [ebp - 0x48], 0x400
mov eax, esi
imul eax, ebx
cdq
and edx, 7
add eax, edx
sar eax, 3
add eax, 3
cdq
and edx, 3
add eax, edx
sar eax, 2
add eax, eax
add eax, eax
push 0x568f68
push ecx
mov dword [ebp - 0x50], eax
call fcn.00514f50
add esp, 8
mov dword [ebp - 0x58], eax
test eax, eax
jne 0x4070a9
xor al, al
pop edi
pop esi
pop ebx
mov ecx, dword [ebp - 8]
xor ecx, ebp
call fcn.00514add
mov esp, ebp
pop ebp
ret 0xc
mov edx, dword [ebp - 0x48]
mov ecx, 0x4d42
mov word [ebp - 0x18], cx
mov ecx, edi
imul ecx, dword [ebp - 0x50]
mov dword [ebp - 0x50], ecx
lea ecx, [ecx + edx + 0x36]
push eax
add edx, 0x36
push 1
mov dword [ebp - 0xe], edx
mov dword [ebp - 0x16], ecx
xor ecx, ecx
lea edx, [ebp - 0x18]
push 0xe
push edx
mov word [ebp - 0x12], cx
mov word [ebp - 0x10], cx
call fcn.005150be
mov edx, dword [ebp - 0x50]
xor eax, eax
mov dword [ebp - 0x1c], eax
mov dword [ebp - 0x20], eax
mov dword [ebp - 0x30], eax
mov dword [ebp - 0x28], eax
mov dword [ebp - 0x24], eax
mov eax, dword [ebp - 0x58]
push eax
mov ecx, 1
push ecx
mov word [ebp - 0x34], cx
lea ecx, [ebp - 0x40]
push 0x28
push ecx
mov word [ebp - 0x32], bx
mov dword [ebp - 0x38], edi
mov dword [ebp - 0x40], 0x28
mov dword [ebp - 0x2c], edx
mov dword [ebp - 0x3c], esi
call fcn.005150be
push 0x400
call fcn.00515138
add esp, 0x24
mov edx, eax
mov dword [ebp - 0x44], edx
cmp ebx, 8
jne 0x40716e
xor eax, eax
lea ecx, [edx + 2]
mov byte [ecx - 2], al
mov byte [ecx - 1], al
mov byte [ecx], al
mov byte [ecx + 1], 0
inc eax
add ecx, 4
cmp eax, 0x100
jl 0x407140
mov eax, dword [ebp - 0x58]
push eax
push pe_nt_image_headers32
push 4
push edx
call fcn.005150be
mov edx, dword [ebp - 0x44]
add esp, 0x10
push edx
call fcn.005151cc
mov eax, edi
imul eax, esi
lea eax, [eax + eax*2]
push eax
mov dword [ebp - 0x44], eax
call fcn.00515138
mov ecx, dword [ebp - 0x44]
push ecx
push 0
push eax
mov dword [ebp - 0x48], eax
call fcn.00516ee0
add esp, 0x14
cmp ebx, 0x18
jne 0x4071ee
test edi, edi
jle 0x407237
mov edx, dword [ebp - 0x48]
lea ecx, [edi + edi*2 - 3]
imul ecx, esi
lea eax, [esi*4]
sub eax, esi
neg eax
add ecx, dword [ebp + 8]
lea ebx, [esi + esi*2]
mov dword [ebp - 0x54], ebx
mov dword [ebp - 0x44], eax
mov dword [ebp - 0x4c], edi
test ebx, ebx
jle 0x4071e3
mov esi, ecx
mov eax, edx
sub esi, edx
mov edi, ebx
mov bl, byte [esi + eax]
mov byte [eax], bl
inc eax
dec edi
jne 0x4071d4
mov eax, dword [ebp - 0x44]
mov ebx, dword [ebp - 0x54]
add edx, ebx
add ecx, eax
dec dword [ebp - 0x4c]
jne 0x4071c8
jmp 0x407237
cmp ebx, 8
jne 0x407237
test edi, edi
jle 0x407237
mov edx, dword [ebp - 0x48]
lea ecx, [edi - 1]
imul ecx, esi
mov eax, esi
neg eax
add ecx, dword [ebp + 8]
mov dword [ebp - 0x54], eax
mov dword [ebp - 0x44], edi
test esi, esi
jle 0x40722e
mov edi, ecx
mov eax, edx
sub edi, edx
mov dword [ebp - 0x4c], esi
lea ebx, [ebx]
mov bl, byte [edi + eax]
mov byte [eax], bl
inc eax
dec dword [ebp - 0x4c]
jne 0x407220
mov eax, dword [ebp - 0x54]
add edx, esi
add ecx, eax
dec dword [ebp - 0x44]
jne 0x40720d
mov edi, dword [ebp - 0x58]
mov edx, dword [ebp - 0x50]
mov esi, dword [ebp - 0x48]
push edi
push 1
push edx
push esi
call fcn.005150be
push edi
call fcn.00515273
push esi
call fcn.005151cc
mov ecx, dword [ebp - 8]
add esp, 0x18
pop edi
pop esi
xor ecx, ebp
mov al, 1
pop ebx
call fcn.00514add
mov esp, ebp
pop ebp
ret 0xc