Function at 0x40bb80
Capabilities:
Write file on windows

Disassembly:
sub esp, 0x50
push ebx
push ebp
push esi
mov esi, ecx
push edi
cmp dword [esi + 0x258], 3
je 0x40bbdd
mov eax, dword [esi + 0x164]
cmp eax, 0x1000
jg 0x40bba4
mov eax, 0x1000
mov ebp, dword [esp + 0x68]
cdq
mov ecx, dword [ebp + 0x24]
mov edi, dword [ebp + 0x20]
cmp ecx, edx
jg 0x40bbcd
jl 0x40bbb9
cmp edi, eax
jae 0x40bbcd
mov eax, dword [esi + 0x248]
cdq
push edx
push eax
push ecx
push edi
call fcn.0041b010
or eax, edx
jne 0x40bbe1
test byte [esi + 0xec], 4
jne 0x40bbe1
mov ebx, 1
jmp 0x40bbe3
mov ebp, dword [esp + 0x68]
xor ebx, ebx
mov eax, ebx
mov ecx, dword [esp + 0x64]
neg eax
sbb eax, eax
push 0
and eax, 0x20000000
or eax, 0x8000000
push eax
push 3
push 0
push 3
push 0x40000000
push ecx
call dword [0x41b3cc]
mov edi, eax
mov dword [esp + 0x14], 1
cmp edi, 0xffffffff
mov dword [esp + 0x10], edi
jne 0x40bc4d
mov edx, dword [esi + 0x154]
mov edi, dword [esp + 0x64]
imul edx, dword [0x41b3f0]
add edx, edi
push 1
push edx
push 0x40488c
mov ecx, esi
call fcn.0040da40
pop edi
pop esi
pop ebp
xor eax, eax
pop ebx
add esp, 0x50
ret 0xc
mov eax, dword [esp + 0x6c]
test eax, eax
je 0x40bc70
lea eax, [esp + 0x2c]
push eax
push edi
call dword [sym.imp.KERNEL32.dll_GetFileInformationByHandle]
test eax, eax
je 0x40bc70
cmp dword [esp + 0x54], 1
ja 0x40bdfc
mov ecx, dword [esi + 0x194]
test ebx, ebx
mov dword [esp + 0x64], ecx
je 0x40bcb1
mov eax, dword [esi + 0x248]
mov ecx, dword [ebp + 0x24]
cdq
mov edi, eax
mov eax, dword [ebp + 0x20]
mov ebx, edx
mov edx, edi
add edx, eax
mov eax, ebx
adc eax, ecx
sub edx, 1
sbb eax, 0
push ebx
push edi
push eax
push edx
call fcn.0041b0d0
push ebx
push edi
push edx
push eax
call fcn.0041afd0
jmp 0x40bcb7
mov eax, dword [ebp + 0x20]
mov edx, dword [ebp + 0x24]
mov ecx, dword [esp + 0x64]
mov dword [esp + 0x24], eax
mov dword [esp + 0x28], edx
mov dword [esp + 0x1c], 0
mov ebp, dword [ecx]
neg ebp
sbb ebp, ebp
and ebp, 2
inc ebp
test ebp, ebp
jle 0x40bde2
mov edx, ecx
add edx, 0xc
mov dword [esp + 0x6c], edx
mov eax, dword [esp + 0x14]
test eax, eax
je 0x40bde2
mov eax, dword [esp + 0x10]
push 0
push 0
push 0
push eax
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
mov edi, dword [esp + 0x28]
mov ebx, dword [esp + 0x24]
mov eax, edi
test eax, eax
jl 0x40bd89
jg 0x40bd19
mov eax, ebx
test eax, eax
jbe 0x40bd89
mov ecx, dword [esp + 0x64]
mov eax, dword [ecx + 8]
cdq
cmp edi, edx
jl 0x40bd31
jg 0x40bd2b
cmp ebx, eax
jbe 0x40bd31
mov dword [esp + 0x18], edx
jmp 0x40bd37
mov eax, ebx
mov dword [esp + 0x18], edi
lea edx, [esp + 0x20]
push 0
push edx
mov edx, dword [esp + 0x18]
push eax
mov eax, dword [esp + 0x78]
mov ecx, dword [eax]
push ecx
push edx
call dword [sym.imp.KERNEL32.dll_WriteFile]
test eax, eax
mov dword [esp + 0x14], eax
je 0x40bd89
mov eax, dword [esp + 0x20]
mov edx, dword [esi + 0x3a0]
xor ecx, ecx
add edx, eax
mov dword [esi + 0x3a0], edx
mov edx, dword [esi + 0x3a4]
adc edx, ecx
sub ebx, eax
sbb edi, ecx
mov dword [esi + 0x3a4], edx
test edi, edi
jg 0x40bd19
jl 0x40bd89
test ebx, ebx
ja 0x40bd19
mov eax, dword [esp + 0x68]
mov edx, dword [esp + 0x24]
mov ebx, dword [esp + 0x28]
mov edi, dword [esi + 0x3a0]
mov ecx, dword [eax + 0x20]
sub ecx, edx
mov edx, dword [eax + 0x24]
sbb edx, ebx
add edi, ecx
mov dword [esi + 0x3a0], edi
mov eax, dword [esi + 0x3a4]
adc eax, edx
mov dword [esi + 0x3a4], eax
mov eax, dword [esp + 0x10]
push eax
call dword [sym.imp.KERNEL32.dll_FlushFileBuffers]
mov eax, dword [esp + 0x1c]
mov edx, dword [esp + 0x6c]
inc eax
add edx, 4
cmp eax, ebp
mov dword [esp + 0x1c], eax
mov dword [esp + 0x6c], edx
jl 0x40bce6
mov esi, dword [esp + 0x10]
push 0
push 0
push 0
push esi
call dword [sym.imp.KERNEL32.dll_SetFilePointer]
push esi
call dword [sym.imp.KERNEL32.dll_SetEndOfFile]
mov edi, esi
push edi
call dword [sym.imp.KERNEL32.dll_CloseHandle]
mov eax, dword [esp + 0x14]
pop edi
pop esi
pop ebp
pop ebx
add esp, 0x50
ret 0xc