Function at 0x40e3f0
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
sub esp, 0x28
mov dword [ebp - 0xc], str._Id:_fbwrite.cpp_7003_2011_05_16_16:32:53Z_jsturton___WORKNC
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x320]
and ecx, 0xfffffffb
mov edx, dword [ebp + 8]
mov dword [edx + 0x320], ecx
call fcn.0040db50
mov dword [ebp - 8], eax
mov eax, dword [ebp - 8]
cmp dword [eax + 0x2b8], 1
je 0x40e45b
mov ecx, dword [ebp - 8]
cmp dword [ecx + 0x2b8], 2
je 0x40e45b
push 0
mov edx, dword [ebp - 8]
mov eax, dword [edx + 0x2b0]
push eax
mov ecx, dword [ebp - 8]
mov edx, dword [ecx + 0xc]
push edx
call dword [sym.imp.MSVCR90.dll_fseek]
add esp, 0xc
mov eax, dword [ebp - 8]
mov dword [eax + 0x2b8], 2
mov ecx, dword [ebp + 8]
movsx edx, byte [ecx + 0x2aa]
test edx, edx
je 0x40e70f
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 8]
mov edx, dword [eax + 0x2c8]
sub edx, dword [ecx + 0x2c4]
mov word [ebp - 4], dx
mov eax, dword [ebp + 8]
mov ecx, dword [ebp + 8]
mov dx, word [ecx + 0x2c2]
mov word [eax + 0x2be], dx
mov eax, dword [ebp + 8]
mov cx, word [ebp - 4]
mov word [eax + 0x2bc], cx
mov edx, dword [ebp + 8]
movsx eax, byte [edx + 0x2ab]
test eax, eax
je 0x40e55d
mov ecx, dword [ebp + 8]
movsx edx, word [ecx + 0x31a]
test edx, edx
je 0x40e53b
mov eax, dword [ebp + 8]
movsx ecx, word [eax + 0x316]
add ecx, 5
cmp ecx, 0x3f
jle 0x40e4e1
mov eax, 0xffffffe1
jmp 0x40e818
mov edx, dword [ebp + 8]
movsx eax, word [edx + 0x316]
add eax, 5
mov ecx, dword [ebp + 8]
mov word [ecx + 0x316], ax
mov edx, dword [ebp + 8]
movsx eax, byte [edx + 0x318]
push eax
mov ecx, dword [ebp + 8]
movsx edx, word [ecx + 0x31a]
push edx
push 0x442810
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x310]
push ecx
call dword [sym.imp.MSVCR90.dll_sprintf]
add esp, 0x10
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x310]
add eax, 5
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x310], eax
mov edx, dword [ebp + 8]
movsx eax, word [edx + 0x316]
mov ecx, dword [ebp + 8]
movsx edx, word [ecx + 0x2bc]
lea eax, [edx + eax + 1]
mov ecx, dword [ebp + 8]
mov word [ecx + 0x2bc], ax
mov edx, dword [ebp + 8]
mov eax, dword [ebp + 8]
mov cx, word [eax + 0x2bc]
mov word [edx + 0x2c2], cx
xor edx, edx
mov eax, dword [ebp + 8]
mov word [eax + 0x2c0], dx
mov ecx, dword [ebp + 8]
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2b0]
mov dword [ecx + 0x218], eax
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0x2bc]
mov dword [ebp - 0x10], edx
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x320]
shr ecx, 1
and ecx, 1
je 0x40e5fd
lea edx, [ebp - 0xe]
mov dword [ebp - 0x1c], edx
mov eax, dword [ebp - 0x1c]
add eax, 1
mov dword [ebp - 0x14], eax
mov ecx, dword [ebp - 0x14]
mov dl, byte [ecx]
mov byte [ebp - 0x15], dl
mov eax, dword [ebp - 0x14]
mov ecx, dword [ebp - 0x1c]
mov dl, byte [ecx]
mov byte [eax], dl
mov eax, dword [ebp - 0x1c]
mov cl, byte [ebp - 0x15]
mov byte [eax], cl
lea edx, [ebp - 0x10]
mov dword [ebp - 0x28], edx
mov eax, dword [ebp - 0x28]
add eax, 1
mov dword [ebp - 0x20], eax
mov ecx, dword [ebp - 0x20]
mov dl, byte [ecx]
mov byte [ebp - 0x21], dl
mov eax, dword [ebp - 0x20]
mov ecx, dword [ebp - 0x28]
mov dl, byte [ecx]
mov byte [eax], dl
mov eax, dword [ebp - 0x28]
mov cl, byte [ebp - 0x21]
mov byte [eax], cl
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0xc]
push eax
push 4
push 1
lea ecx, [ebp - 0x10]
push ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
cmp eax, 4
je 0x40e624
mov eax, 0xffffffe6
jmp 0x40e818
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2b0]
add eax, 4
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x2b0], eax
mov edx, dword [ebp + 8]
movsx eax, byte [edx + 0x2ab]
test eax, eax
je 0x40e6ac
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0xc]
push edx
mov eax, dword [ebp + 8]
movsx ecx, word [eax + 0x316]
add ecx, 1
push ecx
push 1
mov edx, dword [ebp + 8]
add edx, 0x2d0
push edx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
mov ecx, dword [ebp + 8]
movsx edx, word [ecx + 0x316]
add edx, 1
cmp eax, edx
je 0x40e68c
mov eax, 0xffffffe6
jmp 0x40e818
mov eax, dword [ebp + 8]
movsx ecx, word [eax + 0x316]
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2b0]
lea ecx, [ecx + eax + 1]
mov edx, dword [ebp + 8]
mov dword [edx + 0x2b0], ecx
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0xc]
push ecx
movzx edx, word [ebp - 4]
push edx
push 1
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x2c4]
push ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
movzx edx, word [ebp - 4]
cmp eax, edx
je 0x40e6df
mov eax, 0xffffffe6
jmp 0x40e818
movzx eax, word [ebp - 4]
mov ecx, dword [ebp + 8]
add eax, dword [ecx + 0x2b0]
mov edx, dword [ebp + 8]
mov dword [edx + 0x2b0], eax
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x220]
add ecx, 1
mov edx, dword [ebp + 8]
mov dword [edx + 0x220], ecx
jmp 0x40e809
mov eax, dword [ebp + 8]
cmp dword [eax + 0x2b4], 0
jne 0x40e769
mov ecx, dword [ebp + 8]
mov edx, dword [ecx + 0xc]
push edx
push 0x80
push 1
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x2c4]
push ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
cmp eax, 0x80
je 0x40e74d
mov eax, 0xffffffe6
jmp 0x40e818
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0x2b0]
add eax, 0x80
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x2b0], eax
jmp 0x40e809
mov edx, dword [ebp + 8]
mov eax, dword [edx + 0xc]
push eax
mov ecx, dword [ebp + 8]
movsx edx, word [ecx + 0x31c]
push edx
push 1
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x2c4]
push ecx
call dword [sym.imp.MSVCR90.dll_fwrite]
add esp, 0x10
mov edx, dword [ebp + 8]
movsx ecx, word [edx + 0x31c]
cmp eax, ecx
je 0x40e7a5
mov eax, 0xffffffe6
jmp 0x40e818
mov edx, dword [ebp + 8]
movsx eax, word [edx + 0x31c]
mov ecx, dword [ebp + 8]
add eax, dword [ecx + 0x2b0]
mov edx, dword [ebp + 8]
mov dword [edx + 0x2b0], eax
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x220]
add ecx, 1
mov edx, dword [ebp + 8]
cmp dword [edx + 0x2b4], ecx
jne 0x40e809
mov eax, dword [ebp + 8]
mov ecx, dword [eax + 0x220]
add ecx, 1
mov edx, dword [ebp + 8]
mov dword [edx + 0x220], ecx
mov eax, dword [ebp + 8]
movsx ecx, word [eax + 0x31c]
mov edx, dword [ebp + 8]
add ecx, dword [edx + 0x218]
mov eax, dword [ebp + 8]
mov dword [eax + 0x218], ecx
mov ecx, dword [ebp + 8]
mov dword [ecx + 0x2b8], 1
xor eax, eax
mov esp, ebp
pop ebp
ret