Function at 0x10040949
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
mov eax, 0x4348
call fcn.1006df00
mov eax, dword [0x100fe2e4]
xor eax, ebp
mov dword [ebp - 4], eax
cmp dword [ebp + 0x14], 3
push ebx
mov ebx, dword [ebp + 0xc]
push esi
push edi
mov edi, ecx
je 0x10040c0b
cmp dword [ebp + 0x14], 2
je 0x10040988
cmp dword [ebp + 0x14], 1
je 0x10040988
mov eax, 0x10000
jmp 0x10040c87
cmp dword [edi + 4], 0xffffffff
je 0x10040996
push dword [edi]
call fcn.10043175
pop ecx
mov eax, dword [edi]
or dword [edi + 4], 0xffffffff
mov esi, dword [ebp + 8]
cmp esi, dword [eax + 4]
jge 0x1004097e
cmp esi, dword [eax + 0x10]
jge 0x100409b9
push eax
call fcn.10043311
jmp 0x100409b8
push dword [edi]
call fcn.10043350
pop ecx
mov eax, dword [edi]
cmp dword [eax + 0x10], esi
jl 0x100409b1
lea eax, [ebp - 0x4338]
mov ecx, edi
push eax
push esi
call fcn.100402e3
test byte [ebp - 0x4230], 0x10
je 0x10040a15
cmp dword [ebp + 0x14], 1
jne 0x100409e5
xor eax, eax
jmp 0x10040c87
push 0x103
lea eax, [ebp - 0x20c]
push eax
lea eax, [ebp - 0x4334]
push eax
call fcn.10040709
lea eax, [ebp - 0x20c]
push eax
lea eax, [edi + 0x138]
push eax
call fcn.1003febc
add esp, 0x14
jmp 0x100409de
xor eax, eax
cmp dword [ebp + 0x14], 1
mov dword [ebp - 0x4340], eax
je 0x10040b47
movzx ecx, word [ebx]
mov esi, ebx
mov edx, ebx
test cx, cx
je 0x10040b2e
mov dword [ebp - 0x4348], 0x2f
mov dword [ebp - 0x4344], 0x5c
cmp cx, word [ebp - 0x4348]
je 0x10040a5d
cmp cx, word [ebp - 0x4344]
jne 0x10040a60
lea esi, [edx + 2]
add edx, 2
movzx ecx, word [edx]
test cx, cx
jne 0x10040a4b
cmp esi, ebx
je 0x10040b2e
lea eax, [ebp - 0x20c]
push ebx
push eax
call fcn.1007d6ee
sub esi, ebx
sar esi, 1
pop ecx
pop ecx
lea esi, [esi*2 - 2]
cmp esi, 0x208
jae 0x10040c9a
xor eax, eax
mov word [ebp + esi - 0x20c], ax
mov eax, dword [ebp - 0x4348]
cmp word [ebp - 0x20c], ax
je 0x10040ad5
mov eax, dword [ebp - 0x4344]
cmp word [ebp - 0x20c], ax
je 0x10040ad5
cmp word [ebp - 0x20a], 0x3a
je 0x10040ad5
xor ecx, ecx
mov byte [ebp - 0x4339], cl
jmp 0x10040adc
mov byte [ebp - 0x4339], 1
lea eax, [ebp - 0x20c]
push 0x100bff54
push eax
call fcn.100702a3
mov esi, eax
lea eax, [ebp - 0x20c]
push 0x100bff5c
push eax
call fcn.100702a3
add esp, 0x10
test eax, eax
setne cl
test esi, esi
setne al
or cl, al
or cl, byte [ebp - 0x4339]
jne 0x10040b2c
lea eax, [ebp - 0x20c]
push eax
lea eax, [edi + 0x138]
push eax
call fcn.1003febc
pop ecx
pop ecx
xor eax, eax
push eax
push dword [ebp - 0x4230]
push 2
push eax
push eax
push 0x40000000
push ebx
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x10040b56
mov eax, 0x200
jmp 0x10040c87
push dword [edi]
call fcn.10043497
mov esi, 0x4000
lea eax, [ebp - 0x420c]
push esi
push eax
push dword [edi]
call fcn.10043701
add esp, 0x10
jmp 0x10040ba6
je 0x10040bb1
push 0
lea ecx, [ebp - 0x4344]
push ecx
push eax
lea eax, [ebp - 0x420c]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x10040baa
push esi
lea eax, [ebp - 0x420c]
push eax
push dword [edi]
call fcn.10043701
add esp, 0xc
test eax, eax
jns 0x10040b76
mov byte [ebp - 0x4340], 1
push ebx
call dword [sym.imp.KERNEL32.dll_GetFileType]
cmp eax, 1
jne 0x10040be2
cmp byte [ebp - 0x4340], 0
jne 0x10040be2
lea eax, [ebp - 0x421c]
push eax
lea eax, [ebp - 0x422c]
push eax
lea eax, [ebp - 0x4224]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileTime]
cmp dword [ebp + 0x14], 1
je 0x10040bef
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [edi]
call fcn.10043175
pop ecx
mov ecx, dword [ebp - 0x4340]
xor eax, eax
test cl, cl
mov edx, 0x400
cmovne eax, edx
jmp 0x10040c87
mov esi, dword [ebp + 8]
cmp esi, dword [edi + 4]
je 0x10040c54
cmp dword [edi + 4], 0xffffffff
je 0x10040c21
push dword [edi]
call fcn.10043175
pop ecx
mov eax, dword [edi]
or dword [edi + 4], 0xffffffff
cmp esi, dword [eax + 4]
jge 0x1004097e
cmp esi, dword [eax + 0x10]
jge 0x10040c43
push eax
call fcn.10043311
jmp 0x10040c42
call fcn.10043350
pop ecx
mov eax, dword [edi]
push eax
cmp dword [eax + 0x10], esi
jl 0x10040c3d
call fcn.10043497
pop ecx
mov dword [edi + 4], esi
push dword [ebp + 0x10]
push ebx
push dword [edi]
call fcn.10043701
mov esi, eax
add esp, 0xc
test esi, esi
jle 0x10040c6f
mov eax, 0x600
jmp 0x10040c87
push dword [edi]
call fcn.10043175
or dword [edi + 4], 0xffffffff
neg esi
pop ecx
sbb esi, esi
and esi, 0x5000000
mov eax, esi
mov ecx, dword [ebp - 4]
pop edi
pop esi
xor ecx, ebp
pop ebx
call fcn.1006d91d
mov esp, ebp
pop ebp
ret 0x10
call fcn.1006e082
int3