Function at 0x40d830
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x426ba8
mov eax, dword fs:[0]
push eax
sub esp, 0x38
mov eax, dword [0x435300]
xor eax, esp
mov dword [esp + 0x30], eax
push ebx
push esi
push edi
mov eax, dword [0x435300]
xor eax, esp
push eax
lea eax, [esp + 0x48]
mov dword fs:[0], eax
mov esi, dword [ebp + 8]
cmp si, 0xffff
mov edx, ecx
mov dword [esp + 0x10], edx
jne 0x40d87f
xor ax, ax
jmp 0x40dbd4
mov eax, dword [edx + 0x24]
mov ecx, dword [eax]
test ecx, ecx
je 0x40d8ac
mov eax, dword [edx + 0x34]
mov edi, dword [eax]
lea edi, [ecx + edi*2]
cmp ecx, edi
jae 0x40d8ac
add dword [eax], 0xffffffff
mov eax, dword [edx + 0x24]
mov ecx, dword [eax]
lea edx, [ecx + 2]
mov dword [eax], edx
mov word [ecx], si
mov ax, si
jmp 0x40dbd4
mov eax, dword [edx + 0x4c]
test eax, eax
je 0x40dbd0
cmp dword [edx + 0x3c], 0
jne 0x40d8de
push eax
push esi
call fcn.004113ac
add esp, 8
cmp ax, 0xffff
movzx eax, si
jne 0x40dbd4
mov eax, 0xffff
jmp 0x40dbd4
movzx eax, si
lea esi, [esp + 0x24]
mov dword [esp + 0x14], eax
call fcn.0040e4d0
mov dword [esp + 0x50], 0
mov eax, dword [esp + 0x28]
mov edx, dword [esp + 0x3c]
mov edi, edi
cmp edx, 0x10
jb 0x40db59
test eax, eax
mov ebx, eax
mov dword [esp + 0x18], ebx
je 0x40d937
cmp edx, 0x10
mov ecx, eax
jae 0x40d91e
lea ecx, [esp + 0x28]
cmp ecx, ebx
ja 0x40d937
cmp edx, 0x10
mov ecx, eax
jae 0x40d92d
lea ecx, [esp + 0x28]
mov esi, dword [esp + 0x38]
add ecx, esi
cmp ebx, ecx
jbe 0x40d944
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x24]
cmp ecx, 0xfffffffe
je 0x40d96f
cmp edx, 0x10
mov ecx, eax
jae 0x40d958
lea ecx, [esp + 0x28]
mov esi, dword [esp + 0x38]
add ecx, esi
cmp ebx, ecx
jb 0x40d96f
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
cmp edx, 0x10
mov edi, dword [esp + 0x38]
jb 0x40db66
test eax, eax
mov esi, eax
je 0x40d9aa
cmp edx, 0x10
mov ecx, eax
jae 0x40d98d
lea ecx, [esp + 0x28]
cmp ecx, esi
ja 0x40d9aa
cmp edx, 0x10
mov ecx, eax
jae 0x40d99c
lea ecx, [esp + 0x28]
mov ebx, dword [esp + 0x38]
add ecx, ebx
cmp esi, ecx
mov ebx, dword [esp + 0x18]
jbe 0x40d9b7
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x24]
cmp ecx, 0xfffffffe
je 0x40d9d8
cmp edx, 0x10
jae 0x40d9c9
lea eax, [esp + 0x28]
mov edx, dword [esp + 0x38]
add eax, edx
cmp esi, eax
jb 0x40d9d8
call fcn.0041101d
mov eax, dword [esp + 0x10]
mov ecx, dword [eax + 0x3c]
mov edx, dword [ecx]
mov edx, dword [edx + 0x14]
lea eax, [esp + 0x20]
push eax
add ebx, edi
push ebx
push esi
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x26]
push eax
lea eax, [esp + 0x28]
push eax
mov eax, dword [esp + 0x28]
add eax, 0x44
push eax
call edx
test eax, eax
jl 0x40dbc7
cmp eax, 1
jg 0x40db81
mov edx, dword [esp + 0x3c]
cmp edx, 0x10
mov eax, dword [esp + 0x28]
jb 0x40db6f
test eax, eax
mov esi, eax
je 0x40da52
cmp edx, 0x10
mov ecx, eax
jae 0x40da39
lea ecx, [esp + 0x28]
cmp ecx, esi
ja 0x40da52
cmp edx, 0x10
mov ecx, eax
jae 0x40da48
lea ecx, [esp + 0x28]
mov edi, dword [esp + 0x38]
add ecx, edi
cmp esi, ecx
jbe 0x40da5f
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x24]
cmp ecx, 0xfffffffe
je 0x40da8a
cmp edx, 0x10
mov ecx, eax
jae 0x40da73
lea ecx, [esp + 0x28]
mov edi, dword [esp + 0x38]
add ecx, edi
cmp esi, ecx
jb 0x40da8a
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
mov edi, dword [esp + 0x20]
sub edi, esi
je 0x40db1b
cmp edx, 0x10
jb 0x40db78
test eax, eax
mov esi, eax
je 0x40dac9
cmp edx, 0x10
mov ecx, eax
jae 0x40dab0
lea ecx, [esp + 0x28]
cmp ecx, esi
ja 0x40dac9
cmp edx, 0x10
mov ecx, eax
jae 0x40dabf
lea ecx, [esp + 0x28]
mov ebx, dword [esp + 0x38]
add ecx, ebx
cmp esi, ecx
jbe 0x40dad6
call fcn.0041101d
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
lea ecx, [esp + 0x24]
cmp ecx, 0xfffffffe
je 0x40daf7
cmp edx, 0x10
jae 0x40dae8
lea eax, [esp + 0x28]
mov edx, dword [esp + 0x38]
add eax, edx
cmp esi, eax
jb 0x40daf7
call fcn.0041101d
mov eax, dword [esp + 0x10]
mov ecx, dword [eax + 0x4c]
push ecx
push edi
push 1
push esi
call fcn.00412363
add esp, 0x10
cmp edi, eax
jne 0x40dbc7
mov edx, dword [esp + 0x3c]
mov eax, dword [esp + 0x28]
mov ecx, dword [esp + 0x10]
mov byte [ecx + 0x42], 1
lea ecx, [esp + 0x14]
cmp dword [esp + 0x1c], ecx
jne 0x40dbb8
test edi, edi
ja 0x40d900
cmp dword [esp + 0x38], 0x20
jae 0x40dbc7
push 0
mov eax, 8
lea edi, [esp + 0x28]
call fcn.00407430
jmp 0x40d8f6
lea ebx, [esp + 0x28]
mov dword [esp + 0x18], ebx
jmp 0x40d913
lea esi, [esp + 0x28]
jmp 0x40d982
lea esi, [esp + 0x28]
jmp 0x40da2e
lea esi, [esp + 0x28]
jmp 0x40daa5
cmp eax, 3
jne 0x40dbc7
mov edx, dword [esp + 0x10]
mov eax, dword [edx + 0x4c]
push eax
mov eax, dword [esp + 0x18]
push eax
call fcn.004113ac
movzx esi, word [ebp + 8]
add esp, 8
cmp ax, 0xffff
jne 0x40dbaa
mov esi, 0xffff
lea ecx, [esp + 0x24]
call fcn.00403160
mov ax, si
jmp 0x40dbd4
lea ecx, [esp + 0x24]
call fcn.00403160
mov ax, word [ebp + 8]
jmp 0x40dbd4
lea ecx, [esp + 0x24]
call fcn.00403160
or ax, 0xffff
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.00410b9c
mov esp, ebp
pop ebp
ret 4