Function at 0x406960
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x477d78
mov eax, dword fs:[0]
push eax
sub esp, 0x30
mov eax, dword [0x4af0a0]
xor eax, esp
mov dword [esp + 0x28], eax
push ebx
push esi
push edi
mov eax, dword [0x4af0a0]
xor eax, esp
push eax
lea eax, [esp + 0x40]
mov dword fs:[0], eax
mov ebx, ecx
mov ecx, dword [ebp + 8]
cmp ecx, 0xffffffff
jne 0x4069a8
xor eax, eax
jmp 0x406b61
mov eax, dword [ebx + 0x20]
mov edx, dword [eax]
test edx, edx
je 0x4069d6
mov esi, dword [ebx + 0x30]
mov edi, dword [esi]
lea eax, [edi + edx]
cmp edx, eax
jae 0x4069d6
lea eax, [edi - 1]
mov dword [esi], eax
mov ecx, dword [ebx + 0x20]
mov edx, dword [ecx]
lea eax, [edx + 1]
mov dword [ecx], eax
mov eax, dword [ebp + 8]
mov byte [edx], al
jmp 0x406b61
cmp dword [ebx + 0x50], 0
jne 0x4069e4
or eax, 0xffffffff
jmp 0x406b61
mov edx, dword [ebx + 0xc]
lea eax, [ebx + 0x44]
cmp dword [edx], eax
jne 0x406a05
mov eax, dword [ebx + 0x38]
mov ecx, dword [ebx + 0x3c]
mov dword [edx], eax
mov eax, dword [ebx + 0x1c]
mov dword [eax], ecx
mov eax, dword [ebx + 0x2c]
sub ecx, ecx
mov dword [eax], ecx
mov ecx, dword [ebp + 8]
cmp dword [ebx + 0x40], 0
jne 0x406a2a
push dword [ebx + 0x50]
movsx eax, cl
push eax
call fcn.0043c942
or ecx, 0xffffffff
add esp, 8
cmp eax, ecx
cmovne ecx, dword [ebp + 8]
mov eax, ecx
jmp 0x406b61
mov byte [esp + 0x1c], cl
mov ecx, 0xf
mov byte [esp + 0x20], 0
xorps xmm0, xmm0
movq qword [esp + 0x20], xmm0
lea eax, [esp + 0x20]
cmp ecx, 0x10
cmovae eax, dword [esp + 0x20]
mov dword [esp + 0x34], ecx
mov dword [esp + 0x30], 8
mov byte [eax + 8], 0
mov dword [esp + 0x48], 0
jmp 0x406a70
cmp dword [esp + 0x34], 0x10
mov esi, dword [ebx + 0x40]
lea eax, [esp + 0x14]
mov edi, dword [esi]
push eax
mov eax, dword [esp + 0x34]
lea ecx, [esp + 0x24]
cmovae ecx, dword [esp + 0x24]
lea edx, [esp + 0x24]
cmovae edx, dword [esp + 0x24]
add eax, ecx
push eax
push edx
lea eax, [esp + 0x24]
push eax
lea eax, [esp + 0x2d]
push eax
lea eax, [esp + 0x30]
push eax
lea eax, [ebx + 0x48]
push eax
mov ecx, esi
call dword [edi + 0x1c]
test eax, eax
js 0x406b49
cmp eax, 1
jg 0x406b28
mov edi, dword [esp + 0x34]
mov ecx, dword [esp + 0x20]
mov esi, dword [esp + 0x14]
cmp edi, 0x10
lea eax, [esp + 0x20]
cmovae eax, ecx
sub esi, eax
je 0x406af5
push dword [ebx + 0x50]
lea eax, [esp + 0x24]
push esi
cmp edi, 0x10
cmovae eax, ecx
push 1
push eax
call fcn.0043ed2c
add esp, 0x10
cmp esi, eax
jne 0x406b49
lea eax, [esp + 0x1c]
mov byte [ebx + 0x45], 1
cmp dword [esp + 0x18], eax
jne 0x406b23
test esi, esi
jne 0x406a70
cmp dword [esp + 0x30], 0x20
jae 0x406b49
push esi
push 8
lea ecx, [esp + 0x28]
call fcn.004050f0
jmp 0x406a70
mov ebx, dword [ebp + 8]
jmp 0x406b4c
cmp eax, 3
jne 0x406b49
push dword [ebx + 0x50]
push dword [esp + 0x20]
call fcn.004021f0
or ecx, 0xffffffff
add esp, 8
test al, al
cmovne ecx, dword [ebp + 8]
mov ebx, ecx
jmp 0x406b4c
or ebx, 0xffffffff
cmp dword [esp + 0x34], 0x10
jb 0x406b5f
push dword [esp + 0x20]
call fcn.0043e4b8
add esp, 4
mov eax, ebx
mov ecx, dword [esp + 0x40]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x28]
xor ecx, esp
call fcn.0043c933
mov esp, ebp
pop ebp
ret 4