Function at 0x408970
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 0x408a63
mov esi, dword [0x418168]
cmp esi, 1
je 0x408a63
mov ebp, dword [sym.imp.KERNEL32.dll_WriteFile]
cmp esi, 3
je 0x4089a9
cmp esi, 4
jne 0x408a00
mov eax, dword [0x412d14]
mov edx, dword [0x4166c0]
test eax, eax
je 0x4089f7
test edx, edx
je 0x4089f7
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 0x4089f7
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 0x4089eb
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov esi, dword [0x418168]
mov edx, dword [0x4166c0]
mov byte [0x417d0c], 0
jmp 0x408a06
mov edx, dword [0x4166c0]
mov ecx, dword [0x418124]
cmp esi, 6
mov eax, ecx
je 0x408a18
mov eax, dword [0x418128]
and eax, 0x80000001
jns 0x408a24
dec eax
or eax, 0xfffffffe
inc eax
je 0x408a6f
test edx, edx
mov dword [0x418168], 1
je 0x408a63
mov edi, str.han_n
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
test edx, edx
je 0x408a63
push eax
lea eax, [esp + 0x10]
push eax
push ecx
mov ecx, dword [edx + 0xc]
push str.han_n
push ecx
call ebp
test eax, eax
jne 0x408a63
call dword [sym.imp.KERNEL32.dll_GetLastError]
pop edi
pop esi
xor al, al
pop ebp
add esp, 0x208
ret
cmp esi, 6
jne 0x408a7a
mov dword [0x418128], ecx
mov eax, dword [0x4176f0]
mov dword [0x418168], 1
test eax, eax
mov dword [0x41814c], 0
je 0x408b25
mov ecx, dword [0x414c88]
mov eax, 0x66666667
imul ecx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
mov eax, 0x66666667
mov ecx, edx
mov edx, dword [0x414c84]
imul edx
sar edx, 2
mov eax, edx
shr eax, 0x1f
add edx, eax
test ecx, ecx
jg 0x408ad4
mov ecx, 1
test edx, edx
jg 0x408add
mov edx, 1
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 0x408b58
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]
test edx, edx
je 0x408b58
mov edi, str.cho_ngo_n
or ecx, 0xffffffff
xor eax, eax
repne scasb al, byte es:[edi]
not ecx
dec ecx
test edx, edx
je 0x408b58
push eax
lea eax, [esp + 0x10]
push eax
push ecx
mov ecx, dword [edx + 0xc]
push str.cho_ngo_n
push ecx
call ebp
test eax, eax
jne 0x408b58
call dword [sym.imp.KERNEL32.dll_GetLastError]
mov edx, dword [0x418114]
mov esi, 1
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 0x408bbf
mov eax, dword [0x418154]
test eax, eax
jne 0x408bbf
mov dword [0x418154], esi
mov eax, dword [0x414c84]
test eax, eax
jg 0x408bd7
mov eax, dword [0x418158]
test eax, eax
jne 0x408bd7
mov dword [0x418158], esi
mov al, byte [0x4131c2]
test al, al
je 0x408c3a
mov eax, dword [0x418168]
cmp eax, 3
je 0x408c3a
cmp eax, 4
je 0x408c3a
cmp eax, 2
je 0x408c3a
mov esi, dword [esp + 0x10]
push 0x413aa0
mov ecx, esi
call fcn.0040a1e0
mov eax, dword [0x418128]
and eax, 0x80000001
jns 0x408c15
dec eax
or eax, 0xfffffffe
inc eax
mov eax, dword [0x414c88]
je 0x408c21
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