Function at 0x10015840
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
push 0xffffffffffffffff
push 0x1018ac18
mov eax, dword fs:[0]
push eax
mov dword fs:[0], esp
sub esp, 0x40
push ebx
push esi
push edi
mov edi, ecx
call fcn.1000efc0
movzx eax, ax
mov dword [esp + 0x1c], eax
lea eax, [ebp + 8]
push eax
lea eax, [esp + 0x20]
push eax
call fcn.1000ef80
add esp, 8
test al, al
je 0x100158cf
call fcn.1000efc0
mov ecx, dword [ebp + 8]
cmp cx, ax
je 0x100158ab
movzx ecx, cx
mov ax, cx
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
call fcn.1000efc0
xor ecx, ecx
test ax, ax
sete cl
mov ax, cx
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
mov ecx, edi
call fcn.1000ef60
test eax, eax
je 0x10015918
mov eax, dword [edi + 0x30]
mov ecx, dword [eax]
mov eax, dword [edi + 0x20]
mov eax, dword [eax]
lea esi, [eax + ecx*2]
mov ecx, edi
call fcn.1000ef60
cmp eax, esi
jae 0x10015918
movzx esi, word [ebp + 8]
mov ecx, edi
call fcn.1000eec0
mov word [eax], si
mov ax, word [ebp + 8]
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
cmp dword [edi + 0x50], 0
jne 0x10015937
call fcn.1000efc0
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
mov ecx, edi
call fcn.1000e0f0
lea ecx, [edi + 0x44]
cmp eax, ecx
jne 0x1001595e
mov eax, dword [edi + 0xc]
mov edx, dword [edi + 0x3c]
mov ecx, dword [edi + 0x38]
mov dword [eax], ecx
mov eax, dword [edi + 0x1c]
mov dword [eax], edx
mov eax, dword [edi + 0x2c]
sub edx, edx
sar edx, 1
mov dword [eax], edx
cmp dword [edi + 0x40], 0
jne 0x100159b0
push dword [edi + 0x50]
push dword [ebp + 8]
call fcn.1016d83f
mov ecx, 0xffff
add esp, 8
cmp ax, cx
je 0x10015994
movzx eax, word [ebp + 8]
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
call fcn.1000efc0
movzx eax, ax
mov ecx, dword [esp + 0x4c]
mov dword fs:[0], ecx
pop edi
pop esi
pop ebx
mov esp, ebp
pop ebp
ret 4
movzx eax, word [ebp + 8]
lea ecx, [esp + 0x13]
mov dword [esp + 0x14], eax
call fcn.10004530
lea ecx, [esp + 0x30]
push eax
call fcn.10004540
lea ecx, [esp + 0x30]
push 0
push 0
call fcn.10004450
push 0
push 8
lea ecx, [esp + 0x38]
call fcn.10004360
test al, al
je 0x10015a03
push 0
push 8
push 0
lea ecx, [esp + 0x3c]
call fcn.1000f460
push 8
lea ecx, [esp + 0x34]
call fcn.10004320
lea eax, [esp + 0x20]
push eax
lea ecx, [esp + 0x34]
mov dword [esp + 0x58], 0
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
lea ecx, [esp + 0x30]
mov esi, eax
call fcn.10003770
add esi, eax
lea eax, [esp + 0x24]
push eax
lea ecx, [esp + 0x34]
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
mov ecx, dword [edi + 0x40]
lea ebx, [edi + 0x48]
mov edx, dword [ecx]
lea ecx, [esp + 0x18]
push ecx
mov ecx, dword [edi + 0x40]
push esi
push eax
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x26]
push eax
lea eax, [esp + 0x28]
push eax
push ebx
call dword [edx + 0x1c]
test eax, eax
js 0x10015b57
nop
cmp eax, 1
jg 0x10015ba8
lea eax, [esp + 0x28]
push eax
lea ecx, [esp + 0x34]
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
mov esi, dword [esp + 0x18]
sub esi, eax
je 0x10015ac2
push dword [edi + 0x50]
lea eax, [esp + 0x30]
push esi
push 1
push eax
lea ecx, [esp + 0x40]
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
push eax
call fcn.101624dc
add esp, 0x10
cmp esi, eax
jne 0x10015b7f
lea eax, [esp + 0x14]
mov byte [edi + 0x46], 1
cmp dword [esp + 0x1c], eax
jne 0x10015b9c
test esi, esi
jne 0x10015af6
lea ecx, [esp + 0x30]
call fcn.10003770
cmp eax, 0x20
jae 0x10015b8f
push esi
push 8
lea ecx, [esp + 0x38]
call fcn.1000dd00
lea eax, [esp + 0x20]
push eax
lea ecx, [esp + 0x34]
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
lea ecx, [esp + 0x30]
mov esi, eax
call fcn.10003770
add esi, eax
lea eax, [esp + 0x24]
push eax
lea ecx, [esp + 0x34]
call fcn.100036f0
mov ecx, eax
call fcn.100049e0
mov ecx, dword [edi + 0x40]
lea ebx, [esp + 0x18]
mov edx, dword [ecx]
push ebx
push esi
push eax
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x26]
push eax
lea eax, [esp + 0x28]
push eax
lea ebx, [edi + 0x48]
push ebx
call dword [edx + 0x1c]
test eax, eax
jns 0x10015a70
call fcn.1000efc0
lea ecx, [esp + 0x30]
movzx esi, ax
call fcn.100034a0
mov ecx, dword [esp + 0x4c]
pop edi
mov ax, si
pop esi
mov dword fs:[0], ecx
pop ebx
mov esp, ebp
pop ebp
ret 4
call fcn.1000efc0
movzx eax, ax
movzx eax, ax
movzx eax, ax
jmp 0x10015b5c
call fcn.1000efc0
movzx eax, ax
movzx eax, ax
jmp 0x10015b5c
movzx eax, word [ebp + 8]
movzx eax, ax
movzx eax, ax
jmp 0x10015b5c
cmp eax, 3
jne 0x10015b57
push dword [edi + 0x50]
push dword [esp + 0x18]
call fcn.100108b0
add esp, 8
test al, al
je 0x10015bc6
movzx eax, word [ebp + 8]
jmp 0x10015b5c
call fcn.1000efc0
movzx eax, ax
jmp 0x10015b5c