Function at 0x413686
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x65c
mov eax, dword [0x4d3040]
xor eax, esp
mov dword [esp + 0x658], eax
cmp dword [ebp + 0x14], 3
push ebx
push esi
mov esi, ecx
push edi
mov edi, dword [ebp + 0xc]
mov dword [esp + 0x18], esi
je 0x413979
cmp dword [ebp + 0x14], 2
je 0x4136c6
cmp dword [ebp + 0x14], 1
jne 0x4139fc
cmp dword [esi + 4], 0xffffffff
je 0x4136d3
mov ecx, dword [esi]
call fcn.00412d69
mov ecx, dword [esi]
or dword [esi + 4], 0xffffffff
mov ebx, dword [ebp + 8]
cmp ebx, dword [ecx + 4]
jge 0x4139fc
cmp ebx, dword [ecx + 0x10]
jge 0x4136f8
call fcn.00412716
jmp 0x4136f8
mov ecx, eax
call fcn.0041274d
mov eax, dword [esi]
cmp dword [eax + 0x10], ebx
jl 0x4136f1
lea eax, [esp + 0x20]
mov ecx, esi
push eax
push ebx
call fcn.00412f9e
test byte [esp + 0x22c], 0x10
je 0x413761
cmp dword [ebp + 0x14], 1
je 0x413748
movzx eax, word [edi]
mov ecx, eax
cmp eax, 0x2f
je 0x41373f
cmp ecx, 0x5c
je 0x41373f
test cx, cx
je 0x413737
cmp word [edi + 2], 0x3a
je 0x41373f
lea ecx, [esi + 0x244]
jmp 0x413741
xor ecx, ecx
mov edx, edi
call fcn.0041355a
xor eax, eax
mov ecx, dword [esp + 0x664]
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.004820f4
mov esp, ebp
pop ebp
ret 0x10
xor ebx, ebx
cmp dword [ebp + 0x14], 1
je 0x4138a1
movzx eax, word [edi]
mov edx, edi
mov dword [esp + 0x14], 0x2f
mov esi, eax
mov dword [esp + 0x1c], esi
mov ecx, edi
mov esi, dword [esp + 0x18]
mov dword [esp + 0x10], 0x5c
test ax, ax
je 0x4137b6
movzx eax, ax
cmp ax, word [esp + 0x14]
je 0x4137a9
cmp ax, word [esp + 0x10]
je 0x4137a9
add ecx, 2
jmp 0x4137ae
lea edx, [ecx + 2]
mov ecx, edx
movzx eax, word [ecx]
test ax, ax
jne 0x413796
lea eax, [esp + 0x250]
mov ecx, edi
sub eax, edi
mov ebx, eax
movzx eax, word [ecx]
mov word [ebx + ecx], ax
lea ecx, [ecx + 2]
test ax, ax
jne 0x4137c3
push 0
pop ebx
cmp edx, edi
jne 0x4137e5
xor eax, eax
mov word [esp + 0x250], ax
jmp 0x413829
mov eax, edx
sub eax, edi
and eax, 0xfffffffe
cmp eax, 0x208
jae 0x413a1b
xor ecx, ecx
mov word [esp + eax + 0x250], cx
mov ax, word [esp + 0x250]
push 0x2f
pop ecx
cmp ax, cx
je 0x413851
push 0x5c
pop ecx
cmp ax, cx
je 0x413851
test ax, ax
je 0x413829
cmp word [esp + 0x252], 0x3a
je 0x413851
push edx
lea eax, [esp + 0x254]
push eax
lea edi, [esi + 0x244]
push edi
lea eax, [esp + 0x464]
push str._s_s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
jmp 0x413872
push edx
lea eax, [esp + 0x254]
push eax
lea eax, [esp + 0x460]
push str._s_s
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x10
mov edi, ebx
lea edx, [esp + 0x250]
mov ecx, edi
call fcn.0041355a
push ebx
push dword [esp + 0x230]
lea eax, [esp + 0x460]
push 2
push ebx
push ebx
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov edi, eax
cmp edi, 0xffffffff
jne 0x4138b0
mov eax, 0x200
jmp 0x41374a
mov edx, dword [esi + 0x23c]
mov ecx, dword [esi]
call fcn.004129e9
cmp dword [esi + 0x240], ebx
jne 0x4138d6
push 0x4000
call fcn.004827b9
pop ecx
mov dword [esi + 0x240], eax
mov edx, dword [esi + 0x240]
lea eax, [esp + 0xf]
mov ecx, dword [esi]
push eax
push 0x4000
call fcn.00412b3a
mov dword [esp + 0x18], eax
pop ecx
pop ecx
cmp eax, 0xffffff96
je 0x413954
test eax, eax
js 0x413925
jle 0x41391a
push ebx
lea ecx, [esp + 0x18]
push ecx
push eax
push dword [esi + 0x240]
push edi
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x41392c
mov eax, dword [esp + 0x10]
cmp byte [esp + 0xf], 0
jne 0x413933
test eax, eax
jne 0x4138d6
mov ebx, 0x5000000
jmp 0x413959
mov ebx, 0x400
jmp 0x413959
lea eax, [esp + 0x240]
push eax
lea eax, [esp + 0x234]
push eax
lea eax, [esp + 0x240]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_SetFileTime]
jmp 0x413959
mov ebx, 0x1000
cmp dword [ebp + 0x14], 1
je 0x413966
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov ecx, dword [esi]
call fcn.00412d69
xor eax, eax
test ebx, ebx
cmovne eax, ebx
jmp 0x41374a
mov ebx, dword [ebp + 8]
cmp ebx, dword [esi + 4]
je 0x4139bf
cmp dword [esi + 4], 0xffffffff
je 0x41398e
mov ecx, dword [esi]
call fcn.00412d69
mov ecx, dword [esi]
or dword [esi + 4], 0xffffffff
cmp ebx, dword [ecx + 4]
jge 0x4139fc
cmp ebx, dword [ecx + 0x10]
jge 0x4139aa
call fcn.00412716
jmp 0x4139aa
call fcn.0041274d
mov ecx, dword [esi]
cmp dword [ecx + 0x10], ebx
jl 0x4139a5
mov edx, dword [esi + 0x23c]
call fcn.004129e9
mov dword [esi + 4], ebx
mov ecx, dword [esi]
lea eax, [esp + 0xf]
push eax
push dword [ebp + 0x10]
mov edx, edi
call fcn.00412b3a
mov edi, eax
pop ecx
pop ecx
test edi, edi
jg 0x4139e3
mov ecx, dword [esi]
call fcn.00412d69
or dword [esi + 4], 0xffffffff
cmp byte [esp + 0xf], 0
jne 0x413748
test edi, edi
jle 0x413a06
mov eax, 0x600
jmp 0x41374a
mov eax, 0x10000
jmp 0x41374a
cmp edi, 0xffffff96
mov eax, 0x5000000
mov ecx, 0x1000
cmove eax, ecx
jmp 0x41374a
call fcn.00482229
int3