Function at 0x40d680
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x481468
mov eax, dword fs:[0]
push eax
sub esp, 0x38
mov eax, dword [0x4a6554]
xor eax, esp
mov dword [esp + 0x30], eax
push ebx
push esi
push edi
mov eax, dword [0x4a6554]
xor eax, esp
push eax
lea eax, [esp + 0x48]
mov dword fs:[0], eax
cmp dword [ecx + 0x3c], 0
mov dword [esp + 0x14], ecx
je 0x40d964
cmp byte [ecx + 0x41], 0
je 0x40d964
mov eax, dword [ecx]
mov edx, dword [eax + 4]
push 0xffffffffffffffff
call edx
cmp eax, 0xffffffff
je 0x40d957
mov ecx, 0xf
xor eax, eax
cmp ecx, 0x10
mov byte [esp + 0x28], 0
mov dword [esp + 0x3c], ecx
mov dword [esp + 0x28], eax
mov dword [esp + 0x2c], eax
mov dword [esp + 0x38], 8
jae 0x40d70a
lea eax, [esp + 0x28]
mov byte [eax + 8], 0
mov dword [esp + 0x50], 0
mov ecx, dword [esp + 0x28]
mov edx, dword [esp + 0x3c]
cmp edx, 0x10
jb 0x40d833
test ecx, ecx
mov ebx, ecx
mov dword [esp + 0x10], ebx
je 0x40d755
cmp edx, 0x10
mov eax, ecx
jae 0x40d73c
lea eax, [esp + 0x28]
cmp eax, ebx
ja 0x40d755
cmp edx, 0x10
mov eax, ecx
jae 0x40d74b
lea eax, [esp + 0x28]
mov esi, dword [esp + 0x38]
add eax, esi
cmp ebx, eax
jbe 0x40d762
call fcn.0044782d
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
lea eax, [esp + 0x24]
cmp eax, 0xfffffffe
je 0x40d78d
cmp edx, 0x10
mov eax, ecx
jae 0x40d776
lea eax, [esp + 0x28]
mov esi, dword [esp + 0x38]
add eax, esi
cmp ebx, eax
jb 0x40d78d
call fcn.0044782d
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
cmp edx, 0x10
mov edi, dword [esp + 0x38]
jb 0x40d840
test ecx, ecx
mov esi, ecx
je 0x40d7c8
cmp edx, 0x10
mov eax, ecx
jae 0x40d7ab
lea eax, [esp + 0x28]
cmp eax, esi
ja 0x40d7c8
cmp edx, 0x10
mov eax, ecx
jae 0x40d7ba
lea eax, [esp + 0x28]
mov ebx, dword [esp + 0x38]
add eax, ebx
cmp esi, eax
mov ebx, dword [esp + 0x10]
jbe 0x40d7d5
call fcn.0044782d
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
lea eax, [esp + 0x24]
cmp eax, 0xfffffffe
je 0x40d7f8
cmp edx, 0x10
mov eax, ecx
jae 0x40d7e9
lea eax, [esp + 0x28]
mov ecx, dword [esp + 0x38]
add eax, ecx
cmp esi, eax
jb 0x40d7f8
call fcn.0044782d
mov edx, dword [esp + 0x14]
mov ecx, dword [edx + 0x3c]
mov edx, dword [ecx]
mov edx, dword [edx + 0x18]
lea eax, [esp + 0x18]
push eax
add ebx, edi
push ebx
mov ebx, dword [esp + 0x1c]
push esi
lea eax, [ebx + 0x44]
push eax
call edx
sub eax, 0
je 0x40d849
sub eax, 1
je 0x40d84d
sub eax, 2
lea ecx, [esp + 0x24]
jne 0x40d952
jmp 0x40d95f
lea ebx, [esp + 0x28]
mov dword [esp + 0x10], ebx
jmp 0x40d731
lea esi, [esp + 0x28]
jmp 0x40d7a0
mov byte [ebx + 0x41], 0
mov edx, dword [esp + 0x3c]
cmp edx, 0x10
mov ecx, dword [esp + 0x28]
jb 0x40d8f5
test ecx, ecx
mov esi, ecx
je 0x40d888
cmp edx, 0x10
mov eax, ecx
jae 0x40d86f
lea eax, [esp + 0x28]
cmp eax, esi
ja 0x40d888
cmp edx, 0x10
mov eax, ecx
jae 0x40d87e
lea eax, [esp + 0x28]
mov edi, dword [esp + 0x38]
add eax, edi
cmp esi, eax
jbe 0x40d895
call fcn.0044782d
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
lea eax, [esp + 0x24]
cmp eax, 0xfffffffe
je 0x40d8c0
cmp edx, 0x10
mov eax, ecx
jae 0x40d8a9
lea eax, [esp + 0x28]
mov edi, dword [esp + 0x38]
add eax, edi
cmp esi, eax
jb 0x40d8c0
call fcn.0044782d
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
mov edi, dword [esp + 0x18]
sub edi, esi
je 0x40d92f
lea ecx, [esp + 0x1c]
push ecx
lea ecx, [esp + 0x28]
call fcn.0040d200
mov esi, eax
mov eax, dword [esi]
cmp eax, 0xfffffffe
je 0x40d910
test eax, eax
jne 0x40d8e8
call fcn.0044782d
mov eax, dword [esi]
cmp dword [eax + 0x18], 0x10
jb 0x40d8fe
mov ecx, dword [eax + 4]
jmp 0x40d901
lea esi, [esp + 0x28]
jmp 0x40d864
lea ecx, [eax + 4]
mov edx, dword [eax + 0x14]
add edx, ecx
cmp dword [esi + 4], edx
jb 0x40d910
call fcn.0044782d
mov eax, dword [ebx + 0x4c]
mov esi, dword [esi + 4]
push eax
push edi
push 1
push esi
call fcn.004499c4
add esp, 0x10
cmp edi, eax
jne 0x40d94e
mov edx, dword [esp + 0x3c]
mov ecx, dword [esp + 0x28]
cmp byte [ebx + 0x41], 0
je 0x40d95b
test edi, edi
jne 0x40d71e
push edi
push 8
lea ecx, [esp + 0x2c]
call fcn.004046b0
jmp 0x40d716
lea ecx, [esp + 0x24]
call fcn.004034f0
xor al, al
jmp 0x40d966
lea ecx, [esp + 0x24]
call fcn.004034f0
mov al, 1
mov ecx, dword [esp + 0x48]
mov dword fs:[0], ecx
pop ecx
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x30]
xor ecx, esp
call fcn.00447fc5
mov esp, ebp
pop ebp
ret