Function at 0x401850
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x344
push esi
push edi
mov eax, dword [ebp + 8]
push eax
call fcn.00401560
add esp, 4
and eax, 0xff
test eax, eax
je 0x40187a
mov eax, 1
jmp 0x401b2d
mov ecx, dword [str.D________v]
add ecx, 0x600
mov dword [ebp - 0x33c], ecx
mov byte [ebp - 0x334], 0
mov ecx, 0x40
xor eax, eax
lea edi, [ebp - 0x333]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov byte [ebp - 0x214], 0
mov ecx, 0x40
xor eax, eax
lea edi, [ebp - 0x213]
rep stosd dword es:[edi], eax
stosw word es:[edi], ax
stosb byte es:[edi], al
mov edx, dword [ebp - 0x33c]
mov dword [ebp - 4], edx
mov eax, dword [ebp - 4]
xor ecx, ecx
mov cx, word [eax]
cmp ecx, 0x5a4d
je 0x4018e4
call fcn.00403b00
mov edx, dword [ebp - 4]
mov word [edx], 0x5a4d
mov dword [ebp - 0x218], 0
jmp 0x4018ff
mov eax, dword [ebp - 0x218]
add eax, 1
mov dword [ebp - 0x218], eax
cmp dword [ebp - 0x218], 0xa
jge 0x401927
push 0xffff
push 0
call fcn.00401790
add esp, 8
mov ecx, dword [ebp - 0x218]
mov edx, dword [ebp - 4]
mov word [edx + ecx*2 + 0x28], ax
jmp 0x4018f0
lea eax, [ebp - 0x10c]
push eax
push 0x104
call fcn.00402d10
add esp, 8
mov byte [ebp - 0x334], 0x5c
push 0xa
lea ecx, [ebp - 0x333]
push ecx
call fcn.00401230
add esp, 8
push 0x406138
lea edx, [ebp - 0x334]
push edx
call fcn.00402cc0
add esp, 8
lea eax, [ebp - 0x334]
push eax
lea ecx, [ebp - 0x10c]
push ecx
call fcn.00402cc0
add esp, 8
push 0
push 0x80
push 2
push 0
push 0
push 0x40000000
lea edx, [ebp - 0x10c]
push edx
call dword [sym.imp.KERNEL32.dll_CreateFileA]
mov dword [ebp - 0x338], eax
cmp dword [ebp - 0x338], 0
jne 0x4019b2
xor eax, eax
jmp 0x401b2d
mov eax, dword [0x40612c]
mov dword [ebp - 0x224], eax
mov ecx, dword [0x406130]
mov dword [ebp - 0x220], ecx
mov dx, word [0x406134]
mov word [ebp - 0x21c], dx
lea eax, [ebp - 0x224]
push eax
call fcn.004027c0
add esp, 4
movsx ecx, byte [ebp - 0x220]
neg ecx
sbb ecx, ecx
neg ecx
mov byte [ebp - 8], cl
push 0x19
push 0x13
call fcn.00401790
add esp, 8
mov esi, eax
shl esi, 0x14
push 0x61a8
push 0
call fcn.00401790
add esp, 8
lea edx, [esi + eax + 0x46]
mov dword [ebp - 0x230], edx
mov eax, dword [str.D________v]
mov ecx, dword [eax + 0x5fc]
mov dword [ebp - 0x340], ecx
mov edx, dword [ebp - 8]
and edx, 0xff
test edx, edx
jne 0x401a99
push 0
push 0
mov eax, dword [ebp - 0x230]
push eax
mov ecx, dword [ebp - 0x338]
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edx, dword [ebp - 0x340]
shr edx, 1
push edx
push 0x46
call fcn.00401790
add esp, 8
mov dword [ebp - 0x22c], eax
push 0
lea eax, [ebp - 0x22c]
push eax
mov ecx, dword [ebp - 0x22c]
push ecx
mov edx, dword [ebp - 0x33c]
add edx, dword [ebp - 0x22c]
push edx
mov eax, dword [ebp - 0x338]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
push 0
push 0
push 0
mov ecx, dword [ebp - 0x338]
push ecx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push 0
lea edx, [ebp - 0x228]
push edx
mov eax, dword [ebp - 0x340]
push eax
mov ecx, dword [ebp - 0x33c]
push ecx
mov edx, dword [ebp - 0x338]
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
mov eax, dword [ebp - 0x338]
push eax
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [ebp + 8]
movsx edx, byte [ecx]
test edx, edx
je 0x401b0f
mov eax, dword [ebp + 8]
push eax
lea ecx, [ebp - 0x10c]
push ecx
call dword [0x42ed04]
mov dword [ebp - 0x344], eax
lea edx, [ebp - 0x10c]
push edx
call fcn.00402750
add esp, 4
jmp 0x401b28
lea eax, [ebp - 0x10c]
push eax
push 0x406128
mov ecx, dword [ebp + 8]
push ecx
call dword [sym.imp.USER32.dll_wsprintfA]
add esp, 0xc
mov eax, 1
pop edi
pop esi
mov esp, ebp
pop ebp
ret