Function at 0x10016820
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
and esp, 0xfffffff8
sub esp, 0x65c
mov eax, dword [0x100810f0]
xor eax, esp
mov dword [esp + 0x658], eax
push ebx
push esi
mov ebx, ecx
cmp dword [ebx + 4], 0xffffffff
mov esi, edx
push edi
mov dword [esp + 0x10], esi
je 0x10016852
mov edi, dword [ebx]
call fcn.10015f00
mov eax, dword [ebx]
mov edi, dword [ebp + 8]
mov dword [ebx + 4], 0xffffffff
cmp edi, dword [eax + 4]
jl 0x1001687f
mov eax, 0x10000
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x658]
xor ecx, esp
call fcn.1004ea1f
mov esp, ebp
pop ebp
ret 4
cmp edi, dword [eax + 0x10]
jge 0x1001688f
mov esi, eax
call fcn.100157e0
mov esi, dword [esp + 0x10]
mov eax, dword [ebx]
cmp dword [eax + 0x10], edi
jge 0x100168e7
mov esi, dword [ebx]
test esi, esi
je 0x100168dc
cmp dword [esi + 0x18], 0
je 0x100168dc
mov eax, dword [esi + 0x10]
inc eax
cmp eax, dword [esi + 4]
je 0x100168dc
mov ecx, dword [esi + 0x50]
add ecx, dword [esi + 0x4c]
mov edx, dword [esi + 0x48]
push 0
lea ecx, [ecx + edx + 0x2e]
add dword [esi + 0x14], ecx
mov dword [esi + 0x10], eax
push 0
lea edx, [esi + 0x78]
push edx
lea eax, [esi + 0x28]
push eax
mov eax, esi
call fcn.10015390
add esp, 0x10
neg eax
sbb eax, eax
inc eax
mov dword [esi + 0x18], eax
mov ecx, dword [ebx]
cmp dword [ecx + 0x10], edi
jl 0x10016896
mov esi, dword [esp + 0x10]
push edi
lea edx, [esp + 0x24]
mov ecx, ebx
call fcn.10016090
mov edx, dword [esp + 0x22c]
shr edx, 4
test dl, 1
je 0x1001696a
movzx eax, word [esi]
cmp ax, 0x2f
je 0x1001691d
cmp ax, 0x5c
je 0x1001691d
test ax, ax
je 0x10016941
cmp word [esi + 2], 0x3a
jne 0x10016941
push esi
push 0
call fcn.10016670
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x658]
xor ecx, esp
call fcn.1004ea1f
mov esp, ebp
pop ebp
ret 4
push esi
add ebx, 0x244
push ebx
call fcn.10016670
add esp, 8
xor eax, eax
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x658]
xor ecx, esp
call fcn.1004ea1f
mov esp, ebp
pop ebp
ret 4
xor eax, eax
mov word [esp + 0x458], ax
movzx eax, word [esi]
mov edi, esi
mov ecx, esi
test ax, ax
je 0x1001699e
movzx eax, ax
cmp ax, 0x2f
je 0x1001698f
cmp ax, 0x5c
jne 0x10016992
lea edi, [ecx + 2]
movzx eax, word [ecx + 2]
add ecx, 2
test ax, ax
jne 0x10016983
push 0x104
push esi
lea ecx, [esp + 0x258]
push 0x104
push ecx
call fcn.10055134
add esp, 0x10
cmp edi, esi
jne 0x10016a4b
xor edx, edx
mov word [esp + 0x250], dx
push edi
lea ecx, [esp + 0x254]
push ecx
lea esi, [ebx + 0x244]
push esi
push str._s_s_s
lea edx, [esp + 0x468]
call fcn.10016d30
lea edx, [esp + 0x260]
push edx
push esi
call fcn.10016670
add esp, 0x18
mov eax, dword [esp + 0x22c]
push 0
push eax
push 2
push 0
push 0
push 0x40000000
lea ecx, [esp + 0x470]
push ecx
call dword [sym.imp.KERNEL32.DLL_CreateFileW]
mov edi, eax
mov dword [esp + 0x18], edi
cmp edi, 0xffffffff
jne 0x10016abb
mov eax, 0x200
pop edi
pop esi
pop ebx
mov ecx, dword [esp + 0x658]
xor ecx, esp
call fcn.1004ea1f
mov esp, ebp
pop ebp
ret 4
mov eax, edi
sub eax, esi
sar eax, 1
xor ecx, ecx
mov word [esp + eax*2 + 0x250], cx
mov ax, word [esp + 0x250]
cmp ax, 0x2f
je 0x10016a87
cmp ax, 0x5c
je 0x10016a87
test ax, ax
je 0x100169cb
cmp word [esp + 0x252], 0x3a
jne 0x100169cb
push edi
lea edx, [esp + 0x254]
push edx
push str._s_s
lea edx, [esp + 0x464]
call fcn.10016d30
add esp, 0xc
lea eax, [esp + 0x250]
push eax
push 0
call fcn.10016670
add esp, 8
jmp 0x100169fd
mov edx, dword [ebx + 0x23c]
mov eax, dword [ebx]
push edx
call fcn.10015b10
add esp, 4
cmp dword [ebx + 0x240], 0
jne 0x10016ae8
push 0x4000
call fcn.1004e8b8
add esp, 4
mov dword [ebx + 0x240], eax
mov dword [esp + 0x10], 0
mov ecx, dword [ebx + 0x240]
lea eax, [esp + 0x17]
push eax
mov eax, dword [ebx]
push ecx
mov ecx, 0x4000
call fcn.10015c90
mov esi, eax
add esp, 8
cmp esi, 0xffffff96
je 0x10016b9f
test esi, esi
jl 0x10016b41
jle 0x10016b36
mov eax, dword [ebx + 0x240]
push 0
lea edx, [esp + 0x20]
push edx
push esi
push eax
push edi
call dword [sym.imp.KERNEL32.DLL_WriteFile]
test eax, eax
je 0x10016ba9
cmp byte [esp + 0x17], 0
jne 0x10016b49
test esi, esi
jne 0x10016af0
mov dword [esp + 0x10], 0x5000000
mov edi, dword [ebx]
call fcn.10015f00
mov esi, dword [esp + 0x10]
test esi, esi
jne 0x10016b7b
lea ecx, [esp + 0x240]
push ecx
mov ecx, dword [esp + 0x1c]
lea edx, [esp + 0x234]
push edx
lea eax, [esp + 0x240]
push eax
push ecx
call dword [sym.imp.KERNEL32.DLL_SetFileTime]
mov edx, dword [esp + 0x18]
push edx
call dword [sym.imp.KERNEL32.DLL_CloseHandle]
mov ecx, dword [esp + 0x664]
pop edi
mov eax, esi
pop esi
pop ebx
xor ecx, esp
call fcn.1004ea1f
mov esp, ebp
pop ebp
ret 4
mov dword [esp + 0x10], 0x1000
jmp 0x10016b49
mov dword [esp + 0x10], 0x400
jmp 0x10016b49