Function at 0x406f50
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x444
mov eax, dword [0x59ece0]
xor eax, esp
mov dword [esp + 0x440], eax
push ebx
push esi
mov ebx, ecx
push edi
lea edi, [ebx + 8]
push 0xa
mov ecx, edi
call fcn.00407b20
mov eax, dword [edi]
mov eax, dword [eax + 4]
xor esi, esi
test byte [eax + edi + 0xc], 6
jne 0x406fa0
mov eax, dword [eax + edi + 0x38]
mov edx, dword [eax]
mov ecx, eax
mov eax, dword [edx + 0x34]
call eax
cmp eax, 0xffffffff
jne 0x406fa0
mov esi, 4
mov ecx, dword [edi]
mov ecx, dword [ecx + 4]
add ecx, edi
test esi, esi
je 0x406fc1
mov eax, dword [ecx + 0xc]
or eax, esi
cmp dword [ecx + 0x38], 0
jne 0x406fb9
or eax, 4
push 0
push eax
call fcn.00401550
lea edx, [esp + 0x10]
push edx
lea ecx, [ebx + 0xc]
call fcn.00403410
mov eax, dword [0x623c38]
test eax, eax
je 0x407012
mov edx, dword [ebx + 0xa0]
lea ecx, [esp + 0x10]
push ecx
mov ecx, dword [ebx + 0xa8]
push edx
mov edx, dword [ebx + 0xa4]
push ecx
mov ecx, dword [ebx]
push edx
push ecx
call eax
add esp, 0x14
test al, al
je 0x407012
cmp dword [esp + 0x24], 0x10
jb 0x4071c2
mov edx, dword [esp + 0x10]
push edx
jmp 0x4071ba
cmp dword [ebx], 2
jl 0x40704e
cmp dword [esp + 0x24], 0x10
mov eax, dword [esp + 0x10]
jae 0x407026
lea eax, [esp + 0x10]
push eax
push 0x5978f4
call fcn.0049ee08
add eax, 0x40
push eax
call fcn.0049f1d1
add esp, 0xc
call fcn.0049ee08
add eax, 0x40
push eax
call fcn.0049f147
add esp, 4
call fcn.00406b00
cmp dword [0x623c40], 0
jne 0x40706c
mov eax, dword [0x623c44]
push 0xffffffffffffffff
push eax
call dword [sym.imp.KERNEL32.dll_WaitForSingleObject]
jmp 0x407079
mov ecx, dword [0x623c3c]
push ecx
call dword [sym.imp.KERNEL32.dll_EnterCriticalSection]
call fcn.00406c20
test al, al
je 0x4070bd
mov edx, dword [0x623c28]
push 2
push 0
push 0
push edx
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
cmp dword [esp + 0x24], 0x10
mov eax, dword [esp + 0x10]
jae 0x4070a4
lea eax, [esp + 0x10]
mov edx, dword [esp + 0x20]
push 0
lea ecx, [esp + 0x10]
push ecx
push edx
push eax
mov eax, dword [0x623c28]
push eax
call dword [sym.imp.KERNEL32.dll_WriteFile]
cmp dword [0x623c40], 0
jne 0x4070d5
mov ecx, dword [0x623c44]
push ecx
call dword [sym.imp.KERNEL32.dll_ReleaseMutex]
jmp 0x4070e2
mov edx, dword [0x623c3c]
push edx
call dword [sym.imp.KERNEL32.dll_LeaveCriticalSection]
mov eax, dword [ebx]
cmp eax, 4
jne 0x407164
mov ecx, dword [esp + 0x20]
mov eax, 0x400
cmp ecx, eax
jae 0x4070f8
mov eax, ecx
cmp dword [esp + 0x24], 0x10
mov ecx, dword [esp + 0x10]
jae 0x407107
lea ecx, [esp + 0x10]
push eax
push ecx
lea eax, [esp + 0x50]
push eax
call fcn.0049d0d0
lea ecx, [esp + 0x54]
add esp, 0xc
push ecx
call fcn.00415b00
add esp, 4
call dword [sym.imp.KERNEL32.dll_IsDebuggerPresent]
test eax, eax
je 0x407132
call fcn.00415ae0
cmp dword [0x623c30], 0
je 0x40712d
lea edx, [esp + 0x2c]
push edx
lea ecx, [ebx + 0xc]
call fcn.00403410
lea eax, [esp + 0x2c]
push eax
call dword [0x623c30]
add esp, 4
cmp dword [esp + 0x40], 0x10
jb 0x4071ae
mov ecx, dword [esp + 0x2c]
push ecx
jmp 0x4071a6
cmp eax, 3
jne 0x4071ae
cmp dword [0x623c34], 0
lea edx, [esp + 0x2c]
lea ecx, [ebx + 0xc]
push edx
je 0x40718c
call fcn.00403410
lea eax, [esp + 0x2c]
push eax
call dword [0x623c34]
jmp 0x407153
call fcn.00403410
lea ecx, [esp + 0x2c]
call fcn.00406d40
cmp dword [esp + 0x40], 0x10
jb 0x4071ae
mov eax, dword [esp + 0x2c]
push eax
call fcn.0049d0c3
add esp, 4
cmp dword [esp + 0x24], 0x10
jb 0x4071c2
mov ecx, dword [esp + 0x10]
push ecx
call fcn.0049d0c3
add esp, 4
mov edx, dword [ebx + 0xac]
push edx
call dword [sym.imp.KERNEL32.dll_SetLastError]
mov eax, dword [edi]
mov ecx, dword [eax + 4]
lea esi, [edi + 0x50]
mov dword [ecx + esi - 0x50], 0x597510
lea ecx, [esi - 0x4c]
mov dword [esi - 0x4c], 0x5974d4
call fcn.00402800
lea ecx, [esi - 0x4c]
call fcn.00401b80
mov edx, dword [esi - 0x50]
mov eax, dword [edx + 4]
mov dword [eax + esi - 0x50], 0x51ccdc
push esi
mov dword [esi], vtable.std::ios_base.0
call fcn.0049c873
mov ecx, dword [esp + 0x450]
add esp, 4
pop edi
pop esi
pop ebx
xor ecx, esp
call fcn.0049d4b1
mov esp, ebp
pop ebp
ret