Function at 0x40baf1
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x654
push ebx
push ebp
mov ebp, dword [esp + 0x66c]
xor ebx, ebx
push esi
inc ebx
mov esi, ecx
push edi
cmp ebp, 3
je 0x40bb22
cmp ebp, 2
je 0x40bb19
cmp ebp, ebx
jne 0x40bbf4
cmp ebp, 3
jne 0x40bbd4
mov edi, dword [esp + 0x668]
cmp edi, dword [esi + 4]
je 0x40bb77
cmp dword [esi + 4], 0xffffffff
je 0x40bb3c
push dword [esi]
call fcn.0040a7b1
pop ecx
mov eax, dword [esi]
or dword [esi + 4], 0xffffffff
cmp edi, dword [eax + 4]
jge 0x40bbf4
cmp edi, dword [eax + 0x10]
jge 0x40bb5f
push eax
call fcn.0040a775
jmp 0x40bb5e
push eax
call fcn.0040ad19
pop ecx
mov eax, dword [esi]
cmp dword [eax + 0x10], edi
jl 0x40bb58
push dword [esi + 0x23c]
push eax
call fcn.0040afd7
pop ecx
pop ecx
mov dword [esi + 4], edi
lea eax, [esp + 0x13]
push eax
push dword [esp + 0x674]
push dword [esp + 0x674]
push dword [esi]
call fcn.0040b138
mov edi, eax
add esp, 0x10
test edi, edi
jg 0x40bba6
push dword [esi]
call fcn.0040a7b1
or dword [esi + 4], 0xffffffff
pop ecx
cmp byte [esp + 0x13], 0
jne 0x40bc75
test edi, edi
jle 0x40bbbf
mov eax, 0x600
jmp 0x40be81
cmp edi, 0xffffff96
mov eax, 0x5000000
mov ecx, 0x1000
cmove eax, ecx
jmp 0x40be81
cmp dword [esi + 4], 0xffffffff
je 0x40bbe2
push dword [esi]
call fcn.0040a7b1
pop ecx
mov eax, dword [esi]
or dword [esi + 4], 0xffffffff
mov edi, dword [esp + 0x668]
cmp edi, dword [eax + 4]
jl 0x40bbfe
mov eax, 0x10000
jmp 0x40be81
cmp edi, dword [eax + 0x10]
jge 0x40bc12
push eax
call fcn.0040a775
jmp 0x40bc11
push eax
call fcn.0040ad19
pop ecx
mov eax, dword [esi]
cmp dword [eax + 0x10], edi
jl 0x40bc0b
lea eax, [esp + 0x22c]
mov ecx, esi
push eax
push edi
call fcn.0040b556
test byte [esp + 0x438], 0x10
je 0x40bc7c
cmp ebp, ebx
je 0x40bc75
mov ecx, dword [esp + 0x66c]
movzx eax, word [ecx]
cmp eax, 0x2f
je 0x40bc59
cmp eax, 0x5c
je 0x40bc59
test ax, ax
je 0x40bc57
cmp word [ecx + 2], 0x3a
je 0x40bc59
xor bl, bl
push ecx
xor ecx, ecx
lea eax, [esi + 0x244]
test bl, bl
cmove ecx, eax
push ecx
call fcn.0040bf1f
pop ecx
xor eax, eax
jmp 0x40be80
xor eax, eax
jmp 0x40be81
xor edi, edi
cmp ebp, ebx
jne 0x40bc8e
mov ebx, dword [esp + 0x66c]
jmp 0x40bdbc
mov ecx, dword [esp + 0x66c]
mov ebx, ecx
mov dword [esp + 0x1c], ebx
mov edx, ecx
mov dword [esp + 0x14], 0x2f
mov dword [esp + 0x18], 0x5c
movzx eax, word [ecx]
test ax, ax
je 0x40bcea
mov ecx, dword [esp + 0x18]
mov ebp, eax
mov edi, dword [esp + 0x14]
cmp bp, di
je 0x40bcce
cmp bp, cx
je 0x40bcce
add edx, 2
jmp 0x40bcd3
lea ebx, [edx + 2]
mov edx, ebx
movzx eax, word [edx]
mov ebp, eax
test ax, ax
jne 0x40bcbf
mov ecx, dword [esp + 0x66c]
xor edi, edi
mov dword [esp + 0x1c], ebx
lea eax, [esp + 0x24]
mov edx, ecx
sub eax, ecx
mov dword [esp + 0x20], eax
mov ebp, eax
movzx eax, word [edx]
mov word [edx + ebp], ax
lea edx, [edx + 2]
test ax, ax
jne 0x40bcf8
cmp ebx, ecx
jne 0x40bd14
xor eax, eax
mov word [esp + 0x24], ax
jmp 0x40bd41
mov eax, ebx
sub eax, ecx
xor ecx, ecx
sar eax, 1
mov word [esp + eax*2 + 0x24], cx
mov ax, word [esp + 0x24]
cmp ax, word [esp + 0x14]
je 0x40bd69
cmp ax, word [esp + 0x18]
je 0x40bd69
test ax, ax
je 0x40bd41
cmp word [esp + 0x26], 0x3a
je 0x40bd69
push dword [esp + 0x1c]
lea eax, [esp + 0x28]
push eax
lea ebx, [esi + 0x244]
push ebx
lea eax, [esp + 0x468]
push 0x4bc740
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x14
jmp 0x40bd87
push ebx
lea eax, [esp + 0x28]
push eax
lea eax, [esp + 0x464]
push 0x4bc734
push eax
call dword [sym.imp.USER32.dll_wsprintfW]
add esp, 0x10
mov ebx, edi
lea eax, [esp + 0x24]
push eax
push ebx
call fcn.0040bf1f
pop ecx
pop ecx
push edi
push dword [esp + 0x43c]
lea eax, [esp + 0x464]
push 2
push edi
push edi
push 0x40000000
push eax
call dword [sym.imp.KERNEL32.dll_CreateFileW]
mov ebp, dword [esp + 0x674]
mov ebx, eax
cmp ebx, 0xffffffff
jne 0x40bdcb
mov eax, 0x200
jmp 0x40be81
push dword [esi + 0x23c]
push dword [esi]
call fcn.0040afd7
pop ecx
pop ecx
cmp dword [esi + 0x240], edi
jne 0x40bdf3
push 0x4000
call fcn.0045cf50
pop ecx
mov dword [esi + 0x240], eax
lea eax, [esp + 0x13]
push eax
push 0x4000
push dword [esi + 0x240]
push dword [esi]
call fcn.0040b138
add esp, 0x10
cmp eax, 0xffffff96
je 0x40be66
test eax, eax
js 0x40be5f
jle 0x40be30
push edi
lea ecx, [esp + 0x24]
push ecx
push eax
push dword [esi + 0x240]
push ebx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
je 0x40be58
cmp byte [esp + 0x13], 0
je 0x40bdf3
lea eax, [esp + 0x44c]
push eax
lea eax, [esp + 0x440]
push eax
lea eax, [esp + 0x44c]
push eax
push ebx
call dword [sym.imp.KERNEL32.dll_SetFileTime]
jmp 0x40be6b
mov edi, 0x400
jmp 0x40be6b
mov edi, 0x5000000
jmp 0x40be6b
mov edi, 0x1000
cmp ebp, 1
je 0x40be77
push ebx
call dword [sym.imp.KERNEL32.dll_CloseHandle]
push dword [esi]
call fcn.0040a7b1
mov eax, edi
pop ecx
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x654
ret 0x10