Function at 0x40be10
Capabilities:
Write file on windows

Disassembly:
push ebp
mov ebp, esp
push edi
push esi
push ebx
sub esp, 0x3c
mov eax, dword [ebp + 0x14]
mov edi, dword [ebp + 0xc]
shl eax, 2
mov dword [esp], eax
call fcn.0040a0c0
mov dword [ebp - 0x14], eax
mov eax, dword [ebp + 0x10]
xor ecx, ecx
mov dword [ebp - 0x18], 0
fldz
test eax, eax
setle dl
cmp dword [ebp + 0x14], 1
setle al
or eax, edx
test al, 1
jne 0x40c05b
xor ebx, ebx
jmp 0x40be60
mov edx, dword [ebp - 0x14]
mov dword [edx + ebx*4], 0
inc ebx
cmp ebx, dword [ebp + 0x14]
jl 0x40be55
xor ebx, ebx
jmp 0x40be76
mov esi, dword [edi + ebx*4]
inc ebx
add ecx, esi
cmp ebx, dword [ebp + 0x10]
jl 0x40be70
mov ebx, dword [ebp + 0x10]
lea eax, [ebx*4 + 0x1e]
and eax, 0xfffffff0
call fcn.0040ffb8
lea eax, [esp + 0x2f]
and eax, 0xfffffff0
dec ebx
mov dword [ebp - 0x1c], eax
je 0x40c04b
xor ebx, ebx
mov eax, dword [ebp + 0x14]
cmp ebx, dword [ebp + 0x10]
lea esi, [eax - 1]
jge 0x40befb
push ecx
fild dword [esp]
add esp, 4
fnstcw word [ebp - 0xe]
movzx eax, word [ebp - 0xe]
fld dword [0x412768]
or ax, 0xc00
mov word [ebp - 0x10], ax
mov esi, esi
lea edi, [edi]
mov eax, dword [edi + ebx*4]
imul eax, esi
push eax
mov edx, dword [ebp - 0x1c]
fild dword [esp]
add esp, 4
fdiv st(2)
faddp st(3)
fld st(0)
fadd st(3)
fldcw word [ebp - 0x10]
fistp dword [edx + ebx*4]
fldcw word [ebp - 0xe]
inc ebx
cmp ebx, dword [ebp + 0x10]
jl 0x40bed0
fstp st(0)
fstp st(0)
fstp st(0)
mov ecx, dword [ebp + 0x10]
mov ebx, dword [ebp - 0x1c]
cmp dword [ebx + ecx*4 - 4], esi
jg 0x40c0a3
mov ebx, dword [ebp + 0x10]
mov eax, dword [ebp - 0x1c]
mov dword [eax + ebx*4 - 4], esi
xor ebx, ebx
jmp 0x40bf44
mov ecx, dword [ebp - 0x1c]
mov esi, dword [ecx + ebx*4 - 4]
mov eax, dword [ecx + ebx*4]
sub eax, esi
lea esi, [eax + 1]
cmp esi, 1
jg 0x40bf68
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x18]
cmp dword [eax + ebx*4], ecx
jne 0x40bff6
inc ebx
cmp ebx, dword [ebp + 0x10]
jge 0x40c040
xor eax, eax
cmp dword [ebp - 0x18], 0
setne al
test ebx, ebx
mov dword [ebp - 0x20], eax
jne 0x40bf20
mov edx, dword [ebp - 0x1c]
mov esi, dword [edx]
inc esi
cmp esi, 1
jle 0x40bf34
mov eax, dword [ebp - 0x20]
mov dword [esp + 8], esi
mov dword [esp + 0xc], eax
mov edx, dword [ebp + 8]
mov eax, dword [edx + ebx*4 + 4]
mov dword [esp + 4], eax
mov eax, dword [edx + ebx*4]
mov dword [esp], eax
call fcn.0040bb40
test eax, eax
mov edi, eax
sete dl
xor eax, eax
cmp esi, dword [ebp - 0x20]
setne al
test eax, edx
jne 0x40c096
mov ecx, dword [ebp - 0x20]
cmp ecx, esi
jge 0x40bfcd
mov edx, dword [ebp - 0x18]
mov eax, dword [ebp - 0x14]
add edx, ecx
lea edx, [eax + edx*4]
lea esi, [esi]
lea edi, [edi]
mov eax, dword [edi + ecx*4]
inc ecx
mov dword [edx], eax
add edx, 4
cmp ecx, esi
jl 0x40bfc0
mov edx, dword [ebp - 0x18]
test edi, edi
lea edx, [esi + edx - 1]
mov dword [ebp - 0x18], edx
je 0x40bf34
mov dword [esp], edi
call sub.cygwin1.dll_free
mov eax, dword [ebp - 0x1c]
mov ecx, dword [ebp - 0x18]
cmp dword [eax + ebx*4], ecx
je 0x40bf43
call sub.cygwin1.dll___getreent
mov dword [esp + 0x1c], esi
mov edi, 0x412658
mov edx, dword [ebp + 0x14]
mov dword [esp + 0x18], edx
mov ecx, dword [ebp - 0x1c]
mov edx, dword [ecx + ebx*4]
mov dword [esp + 0x14], edx
mov edx, dword [ebp - 0x18]
mov dword [esp + 0xc], ebx
mov dword [esp + 0x10], edx
mov ecx, dword [ebp + 0x10]
mov dword [esp + 4], edi
mov dword [esp + 8], ecx
mov eax, dword [eax + 0xc]
mov dword [esp], eax
call sub.cygwin1.dll_fprintf
xor eax, eax
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
mov eax, dword [ebp - 0x14]
lea esp, [ebp - 0xc]
pop ebx
pop esi
pop edi
pop ebp
ret
fstp st(0)
mov eax, dword [ebp + 0x14]
mov edx, dword [ebp - 0x1c]
dec eax
mov dword [edx], eax
jmp 0x40bf17
fstp st(0)
call sub.cygwin1.dll___getreent
mov eax, dword [eax + 0xc]
mov edi, 1
mov dword [esp + 4], edi
mov dword [esp], str.Gradients_must_specify_at_least_one_segment_and_two_colors_n
mov dword [esp + 0xc], eax
mov eax, 0x3b
mov dword [esp + 8], eax
call sub.cygwin1.dll_fwrite
mov eax, dword [ebp - 0x14]
mov dword [esp], eax
call sub.cygwin1.dll_free
xor eax, eax
jmp 0x40c038
mov ebx, dword [ebp - 0x14]
mov dword [esp], ebx
call sub.cygwin1.dll_free
jmp 0x40c092
call sub.cygwin1.dll___getreent
mov dword [esp + 0xc], esi
mov ecx, dword [ebp + 0x10]
mov edx, dword [ebx + ecx*4 - 4]
mov dword [esp + 8], edx
mov edx, str.BUG:__AllocNonlinearGradient_:_seg_end_colors_nsegs___1____d____npixels___1___d_._Gradient_drawing_aborted_n
mov dword [esp + 4], edx
mov eax, dword [eax + 0xc]
mov dword [esp], eax
call sub.cygwin1.dll_fprintf
xor eax, eax
jmp 0x40c038