Function at 0x408690
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x208
mov al, byte [0x4131b9]
push ebp
push esi
push edi
test al, al
mov dword [esp + 0x10], ecx
jne 0x408783
mov esi, dword [0x418168]
cmp esi, 2
je 0x408783
mov ebp, dword [sym.imp.KERNEL32.dll_WriteFile]
cmp esi, 3
je 0x4086c9
cmp esi, 4
jne 0x408720
mov eax, dword [0x412d14]
mov edx, dword [0x4166c0]
test eax, eax
je 0x408717
test edx, edx
je 0x408717
mov edi, str.exit_n
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
test edx, edx
je 0x408717
push eax
lea eax, [esp + 0x10]
push eax
push ecx
mov ecx, dword [edx + 0xc]
push str.exit_n
push ecx
call ebp
test eax, eax
jne 0x40870b
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, dword [0x418168]
mov edx, dword [0x4166c0]
mov byte [0x417d0c], 0
jmp 0x408726
mov edx, dword [0x4166c0]
mov ecx, dword [0x418124]
cmp esi, 6
mov eax, ecx
je 0x408738
mov eax, dword [0x418128]
and eax, 0x80000001
jns 0x408744
dec eax
or eax, 0xfffffffe
inc eax
jne 0x40878f
test edx, edx
mov dword [0x418168], 2
je 0x408783
mov edi, str.cho_n
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
test edx, edx
je 0x408783
push eax
lea eax, [esp + 0x10]
push eax
push ecx
mov ecx, dword [edx + 0xc]
push str.cho_n
push ecx
call ebp
test eax, eax
jne 0x408783
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
xor al, al
pop ebp
add esp, 0x208
ret
cmp esi, 6
jne 0x40879a
mov dword [0x418128], ecx
mov eax, dword [0x4176f0]
mov dword [0x418168], 2
test eax, eax
mov dword [0x41814c], 0
je 0x408846
mov ecx, dword [0x414c84]
mov eax, 0x66666667
imul ecx
sar edx, 2
mov eax, edx
mov esi, 1
shr eax, 0x1f
add edx, eax
mov eax, 0x66666667
mov ecx, edx
mov edx, dword [0x414c88]
imul edx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
test ecx, ecx
jg 0x4087f6
mov ecx, esi
test edx, edx
jg 0x4087fc
mov edx, esi
push edx
push ecx
lea ecx, [esp + 0x1c]
push str.ctr__ld_notr__ld_n
push ecx
call dword [sym.imp.MSVCRT.dll_sprintf]
mov edx, dword [0x4166c0]
add esp, 0x10
test edx, edx
je 0x40887e
lea eax, [esp + 0xc]
lea edi, [esp + 0x14]
push eax
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
push ecx
lea ecx, [esp + 0x1c]
push ecx
mov ecx, dword [esp + 0x1c]
push edx
call fcn.00408190
mov edx, dword [0x4166c0]
jmp 0x40884b
mov esi, 1
test edx, edx
je 0x40887e
mov edi, str.han_ngo_n
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
test edx, edx
je 0x40887e
push eax
lea eax, [esp + 0x10]
push eax
push ecx
mov ecx, dword [edx + 0xc]
push str.han_ngo_n
push ecx
call ebp
test eax, eax
jne 0x40887e
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [0x418114]
mov dword [edx + 0x304], 0
mov eax, dword [0x418114]
mov dword [eax + 0x308], esi
mov ecx, dword [0x418114]
mov edx, dword [ecx + 0x314]
push edx
call dword [sym.imp.USER32.dll_SetCursor]
mov ecx, dword [0x418114]
mov dword [0x4166bc], esi
call fcn.00402c70
mov ecx, dword [0x418114]
call fcn.00402d60
mov eax, dword [0x414c88]
test eax, eax
jg 0x4088e0
mov eax, dword [0x418154]
test eax, eax
jne 0x4088e0
mov dword [0x418154], esi
mov eax, dword [0x414c84]
test eax, eax
jg 0x4088f8
mov eax, dword [0x418158]
test eax, eax
jne 0x4088f8
mov dword [0x418158], esi
mov al, byte [0x4131c2]
test al, al
je 0x40895b
mov eax, dword [0x418168]
cmp eax, 3
je 0x40895b
cmp eax, 4
je 0x40895b
cmp eax, 2
je 0x40895b
mov esi, dword [esp + 0x10]
push 0x413aa0
mov ecx, esi
call fcn.0040a1e0
mov eax, dword [0x418128]
and eax, 0x80000001
jns 0x408936
dec eax
or eax, 0xfffffffe
inc eax
mov eax, dword [0x414c88]
je 0x408942
mov eax, dword [0x414c84]
push eax
mov ecx, esi
call fcn.0040a210
mov ecx, dword [0x418114]
push eax
mov dword [0x413a98], eax
call fcn.00402c50
pop edi
pop esi
mov al, 1
pop ebp
add esp, 0x208
ret