Function at 0x40d840
Capabilities:
Write file on windows

Disassembly:
push 0x44
mov eax, 0x44b908
call fcn.00425a64
mov ebx, ecx
mov dword [ebp - 0x3c], ebx
call fcn.00403720
mov si, ax
lea eax, [ebp + 8]
push eax
lea eax, [ebp - 0x36]
mov word [ebp - 0x36], si
push eax
call fcn.00404261
pop ecx
pop ecx
test al, al
je 0x40d87d
lea ecx, [ebp + 8]
call fcn.0040424c
jmp 0x40da31
mov eax, dword [ebx + 0x20]
mov ecx, dword [eax]
test ecx, ecx
je 0x40d8b7
mov edx, dword [ebx + 0x30]
mov edi, dword [edx]
lea eax, [ecx + edi*2]
cmp ecx, eax
jae 0x40d8b7
lea eax, [edi - 1]
mov dword [edx], eax
mov ecx, dword [ebx + 0x20]
mov esi, dword [ecx]
lea eax, [esi + 2]
mov dword [ecx], eax
lea eax, [ebp + 8]
push eax
call fcn.00402b9c
pop ecx
mov word [esi], ax
mov ax, word [ebp + 8]
jmp 0x40da31
xor edi, edi
cmp dword [ebx + 0x4c], edi
je 0x40da2e
mov ecx, ebx
call fcn.0040dcc4
lea eax, [ebp + 8]
push eax
call fcn.00402b9c
pop ecx
cmp dword [ebx + 0x38], edi
jne 0x40d8f5
push dword [ebx + 0x4c]
push eax
call fcn.0042ef2d
pop ecx
pop ecx
mov ecx, 0xffff
cmp ax, cx
jne 0x40d8ae
movzx eax, si
jmp 0x40da31
push edi
push 8
lea ecx, [ebp - 0x2c]
mov word [ebp - 0x14], ax
call fcn.0040e35b
mov dword [ebp - 4], edi
lea eax, [ebp - 0x44]
push eax
lea ecx, [ebp - 0x2c]
call fcn.0040dca2
lea ecx, [ebp - 0x2c]
mov esi, dword [eax]
lea eax, [ebp - 0x48]
push eax
call fcn.0040dca2
lea ecx, [ebp - 0x2c]
mov edi, dword [eax]
call fcn.0040761f
mov ecx, dword [ebp - 0x3c]
lea edx, [ebp - 0x30]
push edx
add eax, esi
add ecx, 0x40
push eax
push edi
lea eax, [ebp - 0x34]
mov dword [ebp - 0x40], ecx
push eax
lea eax, [ebp - 0x12]
push eax
lea eax, [ebp - 0x14]
push eax
push ecx
jmp 0x40da03
cmp eax, 1
jg 0x40da4b
lea eax, [ebp - 0x4c]
push eax
lea ecx, [ebp - 0x2c]
call fcn.0040dca2
mov esi, dword [ebp - 0x30]
sub esi, dword [eax]
je 0x40d999
lea eax, [ebp - 0x50]
push eax
lea ecx, [ebp - 0x2c]
call fcn.0040dca2
mov ebx, dword [ebp - 0x3c]
push dword [ebx + 0x4c]
push esi
push 1
push dword [eax]
call fcn.0042f1b2
add esp, 0x10
cmp esi, eax
je 0x40d99c
movzx eax, word [ebp - 0x36]
mov dword [ebp - 0x40], eax
jmp 0x40da43
mov ebx, dword [ebp - 0x3c]
lea eax, [ebp - 0x14]
mov byte [ebx + 0x3e], 1
cmp dword [ebp - 0x34], eax
jne 0x40da3f
test esi, esi
jne 0x40d9c8
lea ecx, [ebp - 0x2c]
call fcn.0040761f
cmp eax, 0x20
jae 0x40da39
push esi
push 8
lea ecx, [ebp - 0x2c]
call fcn.004078d0
lea eax, [ebp - 0x44]
push eax
lea ecx, [ebp - 0x2c]
call fcn.0040dca2
lea ecx, [ebp - 0x2c]
mov esi, dword [eax]
lea eax, [ebp - 0x48]
push eax
call fcn.0040dca2
lea ecx, [ebp - 0x2c]
mov edi, dword [eax]
call fcn.0040761f
add eax, esi
lea ecx, [ebp - 0x30]
push ecx
push eax
push edi
lea eax, [ebp - 0x34]
push eax
lea eax, [ebp - 0x12]
push eax
lea eax, [ebp - 0x14]
push eax
push dword [ebp - 0x40]
mov ebx, dword [ebx + 0x38]
mov esi, dword [ebx]
mov ecx, dword [esi + 0x1c]
call dword [0x44d198]
mov ecx, ebx
call dword [esi + 0x1c]
test eax, eax
jns 0x40d94e
movzx esi, word [ebp - 0x36]
or dword [ebp - 4], 0xffffffff
lea ecx, [ebp - 0x2c]
call fcn.00407dcd
mov ax, si
call fcn.00425a0e
ret 4
movzx eax, word [ebp - 0x36]
jmp 0x40da46
mov ax, word [ebp + 8]
movzx eax, ax
movzx eax, ax
jmp 0x40da74
cmp eax, 3
jne 0x40da1e
mov ecx, dword [ebp - 0x3c]
push dword [ecx + 0x4c]
push dword [ebp - 0x14]
call fcn.0042ef2d
pop ecx
pop ecx
mov ecx, 0xffff
cmp ax, cx
je 0x40da70
mov ax, word [ebp + 8]
jmp 0x40da77
movzx eax, word [ebp - 0x36]
mov dword [ebp - 0x3c], eax
movzx esi, ax
jmp 0x40da22