// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/gui/dialogs/colordlg.cpp
// Function: smooth::GUI::Dialogs::ColorSelection::ColorDlgPaintProc()
void S::GUI::Dialogs::ColorSelection::ColorDlgPaintProc()
{
	Surface		*surface    = dlgwnd->GetDrawSurface();
	Rect		 rect;
	Rect		 urect	    = dlgwnd->GetUpdateRect();
	Int		 hssize	    = Math::Round(205.0 * surface->GetSurfaceDPI() / 96.0);
	Int		 huexoffset = hssize + Math::Round(14.0 * surface->GetSurfaceDPI() / 96.0);
	double		 huebias    = 256 / (double) hssize;
	Bitmap		 bmp(Size(hssize, hssize));

	rect.left	= huexoffset;
	rect.top	= yoffset;
	rect.right	= rect.left + Math::Round(16.0 * surface->GetSurfaceDPI() / 96.0) + 2;
	rect.bottom	= rect.top + hssize + 2;

	if (Rect::DoRectsOverlap(rect, urect))
	{
		double	 hue = 0;

		surface->Frame(rect, FRAME_DOWN);

		for (Int ypos = 0; ypos < hssize; ypos++)
		{
			Point	 p1(huexoffset							     + 1, yoffset + 1 + ypos);
			Point	 p2(huexoffset + Math::Round(16.0 * surface->GetSurfaceDPI() / 96.0) + 1, yoffset + 1 + ypos);

			surface->Line(p1, p2, Color(255 - Math::Round(hue), 255, 255, Color::HSV).ConvertTo(Color::RGB));

			hue += huebias;
		}
	}

	rect.left	= xoffset;
	rect.right	= rect.left + hssize + 2;

	surface->Frame(rect, FRAME_DOWN);

	rect.left	= xoffset - 4;
	rect.top	= yoffset - 4;
	rect.right	= rect.left + hssize;
	rect.bottom	= rect.top + hssize;

	surface->StartPaint(Rect(Point(xoffset - 4, yoffset - 4), Size(hssize + Math::Round(30.0 * surface->GetSurfaceDPI() / 96.0) + 5, hssize + 5)));

	forcehupdate	= True;
	preventvsupdate = True;

	ColorDlgUpdatePickers();

	if (Rect::DoRectsOverlap(rect, urect))
	{
		Rect	 irect = Rect::OverlapRect(rect, urect);

		irect.right += 5;
		irect.bottom += 5;

		Int	 xmin = irect.left - (xoffset + 1);
		Int	 ymin = irect.top - (yoffset + 1);
		Int	 xmax = irect.right - (xoffset + 1);
		Int	 ymax = irect.bottom - (yoffset + 1);

		rect.left   = xmin;
		rect.top    = ymin;
		rect.right  = xmax;
		rect.bottom = ymax;

		for (int sat = Math::Max(0, ymin); sat < Math::Min(hssize, ymax); sat++)
		{
			int	 normrgb = colortable[acthue][255 - Math::Round(sat * (256.0 / hssize))];

			double	 rbias	 = (double) Color(normrgb).GetRed() / (255.0 / (256.0 / hssize));
			double	 gbias	 = (double) Color(normrgb).GetGreen() / (255.0 / (256.0 / hssize));
			double	 bbias	 = (double) Color(normrgb).GetBlue() / (255.0 / (256.0 / hssize));

			double	 ared	 = -rbias + Math::Max(0, xmin) * rbias;
			double	 agreen	 = -gbias + Math::Max(0, xmin) * gbias;
			double	 ablue	 = -bbias + Math::Max(0, xmin) * bbias;

			for (int val = Math::Max(0, xmin); val < Math::Min(hssize, xmax); val++)
			{
				bmp.SetPixel(Point(val, sat), Color(Math::Round(ared += rbias), Math::Round(agreen += gbias), Math::Round(ablue += bbias)));
			}
		}

		surface->BlitFromBitmap(bmp, rect, irect);
	}

	forcevsupdate  = True;
	preventhupdate = True;

	ColorDlgUpdatePickers();

	surface->EndPaint();

	ncarea->SetColor(Color(acthue, actsat, actval, Color::HSV).ConvertTo(Color::RGB));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xc8, %rsp
movq %rdi, %rbx
movq 0x40648(%rdi), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %r15
xorps %xmm0, %xmm0
movaps %xmm0, (%rsp)
movq 0x40648(%rbx), %rax
movups 0x5ec(%rax), %xmm0
movaps %xmm0, 0x80(%rsp)
movq %r15, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8d29b(%rip), %xmm0    # 0xf4760
divsd 0x8d023(%rip), %xmm0    # 0xf44f0
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpltsd %xmm2, %xmm1
movsd 0x8ceae(%rip), %xmm3    # 0xf4390
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
movsd 0x8cea6(%rip), %xmm3    # 0xf4398
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12
movq %r15, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8d24d(%rip), %xmm0    # 0xf4768
divsd 0x8cfcd(%rip), %xmm0    # 0xf44f0
movapd %xmm0, %xmm1
cmpltsd 0x8d258(%rip), %xmm1    # 0xf4788
movapd %xmm1, %xmm2
movsd 0x8ce54(%rip), %xmm3    # 0xf4390
andpd %xmm3, %xmm2
movsd 0x8ce50(%rip), %xmm3    # 0xf4398
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r14
addq %r12, %r14
leaq 0x30(%rsp), %rsi
movl %r12d, (%rsi)
movl %r12d, 0x4(%rsi)
leaq 0x50(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x55960
movl %r14d, (%rsp)
movl 0x5fc(%rbx), %eax
movl %eax, 0x4(%rsp)
movq %r15, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8d1db(%rip), %xmm0    # 0xf4778
divsd 0x8cf4b(%rip), %xmm0    # 0xf44f0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8d1d7(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leal 0x2(%r14,%rax), %eax
movq %rsp, %rdi
movl %eax, 0x8(%rdi)
movl 0x4(%rdi), %eax
leal 0x2(%r12,%rax), %eax
movl %eax, 0xc(%rdi)
leaq 0x80(%rsp), %rsi
callq 0x55970
movq %r15, 0x18(%rsp)
movq %rbx, 0x10(%rsp)
movq %r12, 0x20(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r12d, %xmm0
movsd 0x8d16b(%rip), %xmm1    # 0xf4770
divsd %xmm0, %xmm1
movsd %xmm1, 0x58(%rsp)
testb %al, %al
je 0x6776d
movq %rsp, %rsi
movq 0x18(%rsp), %rdi
movl $0x1, %edx
callq 0x57890
cmpl $0x0, 0x20(%rsp)
jle 0x6776d
leal 0x1(%r14), %ebx
movq 0x20(%rsp), %r12
negl %r12d
movl $0x1, %r13d
leaq 0x30(%rsp), %r15
xorpd %xmm0, %xmm0
movsd %xmm0, 0x28(%rsp)
movq 0x10(%rsp), %rbp
movl 0x5fc(%rbp), %eax
addl %r13d, %eax
movl %ebx, 0x48(%rsp)
movl %eax, 0x4c(%rsp)
movq 0x18(%rsp), %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8d0f3(%rip), %xmm0    # 0xf4778
divsd 0x8ce63(%rip), %xmm0    # 0xf44f0
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movapd %xmm1, %xmm2
movsd 0x8ccea(%rip), %xmm3    # 0xf4390
andpd %xmm3, %xmm2
movsd 0x8cce6(%rip), %xmm4    # 0xf4398
andnpd %xmm4, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
addl %r14d, %eax
incl %eax
movl 0x5fc(%rbp), %ecx
addl %r13d, %ecx
movl %eax, 0x78(%rsp)
movl %ecx, 0x7c(%rsp)
movsd 0x28(%rsp), %xmm2
movapd %xmm2, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm4, %xmm0
orpd %xmm1, %xmm0
addsd %xmm2, %xmm0
cvttsd2si %xmm0, %rax
movl $0xff, %ecx
subl %eax, %ecx
movslq %ecx, %rax
orq $0xffff00, %rax         # imm = 0xFFFF00
movq %rax, 0x70(%rsp)
movl $0x2, 0x68(%rsp)
movq %r15, %rdi
leaq 0x68(%rsp), %rsi
xorl %edx, %edx
callq 0x57d10
movq 0x18(%rsp), %rdi
leaq 0x48(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r15, %rcx
callq 0x58300
movsd 0x28(%rsp), %xmm0
addsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x28(%rsp)
leal (%r12,%r13), %eax
incl %eax
movl %r13d, %ecx
incl %ecx
movl %ecx, %r13d
cmpl $0x1, %eax
jne 0x6765a
movq 0x10(%rsp), %r12
movl 0x5f8(%r12), %eax
movq %rsp, %rsi
movl %eax, (%rsi)
movq 0x20(%rsp), %r13
leal 0x2(%r13,%rax), %eax
movl %eax, 0x8(%rsi)
movq 0x18(%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
callq 0x57890
movl 0x5f8(%r12), %ebx
leal -0x4(%rbx), %ebp
movl %ebp, (%rsp)
movl 0x5fc(%r12), %eax
leal -0x4(%rax), %r14d
movl %r14d, 0x4(%rsp)
leal -0x4(%rbx,%r13), %ecx
movl %ecx, 0x8(%rsp)
leal -0x4(%rax,%r13), %eax
movl %eax, 0xc(%rsp)
movq %r15, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8cf99(%rip), %xmm0    # 0xf4780
divsd 0x8cd01(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8cf8d(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movl %r13d, %ecx
addl %eax, %ecx
leaq 0x30(%rsp), %rsi
movl %ebp, (%rsi)
movl %r14d, 0x4(%rsi)
leal (%rbx,%rcx), %eax
incl %eax
movl %eax, 0x8(%rsi)
leal 0x5(%r13,%r14), %eax
movl %eax, 0xc(%rsi)
movq %r15, %rdi
callq 0x55160
movb $0x1, %al
movb %al, 0x602(%r12)
movb %al, 0x605(%r12)
movq %r12, %rdi
callq 0x58380
movq %rsp, %rdi
leaq 0x80(%rsp), %rsi
callq 0x55970
testb %al, %al
je 0x67b51
movq %rsp, %rdi
leaq 0x80(%rsp), %rsi
callq 0x58af0
movq %rdx, %r15
movq %rax, 0x30(%rsp)
movq %rdx, 0x38(%rsp)
addl $0x5, %r15d
movl %r15d, 0x38(%rsp)
movl 0x3c(%rsp), %esi
addl $0x5, %esi
movl %esi, 0x3c(%rsp)
movl 0x5f8(%r12), %ecx
movl 0x5fc(%r12), %edx
incl %ecx
subl %ecx, %eax
movl 0x34(%rsp), %r14d
incl %edx
subl %edx, %r14d
subl %ecx, %r15d
subl %edx, %esi
movl %eax, (%rsp)
movl %r14d, 0x4(%rsp)
movl %r15d, 0x8(%rsp)
movl %esi, 0xc(%rsp)
xorl %ecx, %ecx
testl %r14d, %r14d
cmovlel %ecx, %r14d
cmpl %esi, %r13d
cmovll %r13d, %esi
movl %esi, 0x64(%rsp)
cmpl %esi, %r14d
jge 0x67b32
movq 0x10(%rsp), %rcx
addq $0x62c, %rcx            # imm = 0x62C
movq %rcx, 0xa0(%rsp)
movsd 0x8ca63(%rip), %xmm0    # 0xf4368
divsd 0x58(%rsp), %xmm0
movsd %xmm0, 0x98(%rsp)
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, 0x44(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd %xmm0, 0x90(%rsp)
cmpl %r15d, %r13d
cmovll %r13d, %r15d
leaq 0x50(%rsp), %r12
leaq 0x48(%rsp), %r13
leaq 0x68(%rsp), %rbp
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
mulsd 0x58(%rsp), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %cl
cmpl %r15d, 0x44(%rsp)
jge 0x67b24
movb %cl, %al
leaq 0x8ce19(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq 0x10(%rsp), %rcx
movslq 0x614(%rcx), %rcx
movl $0xff, %edx
subq %rax, %rdx
shlq $0xa, %rcx
addq 0xa0(%rsp), %rcx
movl (%rcx,%rdx,4), %eax
movl %eax, %ecx
movl $0xff, %esi
andl %esi, %ecx
movl %eax, %edx
shrl $0x8, %edx
andl %esi, %edx
shrl $0x10, %eax
andl %esi, %eax
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
movsd 0x98(%rsp), %xmm0
divsd %xmm0, %xmm1
cvtsi2sd %edx, %xmm2
cvtsi2sd %eax, %xmm3
divsd %xmm0, %xmm2
divsd %xmm0, %xmm3
movsd 0x90(%rsp), %xmm0
movapd %xmm0, %xmm5
mulsd %xmm3, %xmm5
movsd %xmm3, 0xa8(%rsp)
subsd %xmm3, %xmm5
movapd %xmm0, %xmm6
mulsd %xmm2, %xmm6
movsd %xmm2, 0xb0(%rsp)
subsd %xmm2, %xmm6
movapd %xmm0, %xmm7
mulsd %xmm1, %xmm7
movsd %xmm1, 0xb8(%rsp)
subsd %xmm1, %xmm7
movl 0x44(%rsp), %ebx
movl %ebx, 0x48(%rsp)
addsd 0xb8(%rsp), %xmm7
movapd %xmm7, %xmm0
xorpd %xmm4, %xmm4
cmpltsd %xmm4, %xmm0
movapd %xmm0, %xmm1
movsd 0x8c941(%rip), %xmm2    # 0xf4390
andpd %xmm2, %xmm1
movsd 0x8c93d(%rip), %xmm3    # 0xf4398
andnpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movsd %xmm7, 0xc0(%rsp)
addsd %xmm7, %xmm0
cvttsd2si %xmm0, %rax
addsd 0xb0(%rsp), %xmm6
movapd %xmm6, %xmm0
cmpltsd %xmm4, %xmm0
movapd %xmm0, %xmm1
andpd %xmm2, %xmm1
andnpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movsd %xmm6, 0x20(%rsp)
addsd %xmm6, %xmm0
cvttsd2si %xmm0, %rcx
addsd 0xa8(%rsp), %xmm5
movapd %xmm5, %xmm0
cmpltsd %xmm4, %xmm0
movapd %xmm0, %xmm1
andpd %xmm2, %xmm1
andnpd %xmm3, %xmm0
orpd %xmm1, %xmm0
movsd %xmm5, 0x28(%rsp)
addsd %xmm5, %xmm0
cvttsd2si %xmm0, %rdx
movl %r14d, 0x4c(%rsp)
shll $0x10, %edx
shll $0x8, %ecx
orl %eax, %ecx
orl %edx, %ecx
movslq %ecx, %rax
movq %rax, 0x70(%rsp)
movl $0x0, 0x68(%rsp)
movq %r12, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x56080
incl %ebx
cmpl %ebx, %r15d
movsd 0x28(%rsp), %xmm5
movsd 0x20(%rsp), %xmm6
movsd 0xc0(%rsp), %xmm7
jne 0x67a29
incl %r14d
cmpl 0x64(%rsp), %r14d
jne 0x67948
leaq 0x50(%rsp), %rsi
movq %rsp, %rdx
leaq 0x30(%rsp), %rcx
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x55ba0
movq 0x10(%rsp), %r12
movw $0x101, 0x603(%r12) # imm = 0x101
movq %r12, %rdi
callq 0x58380
movq %r15, %rdi
callq 0x58780
movq 0x40670(%r12), %r14
movl 0x618(%r12), %eax
movl 0x61c(%r12), %ecx
shll $0x10, %ecx
shll $0x8, %eax
orl 0x614(%r12), %eax
orl %ecx, %eax
cltq
leaq 0x68(%rsp), %rsi
movq %rax, 0x8(%rsi)
movl $0x2, (%rsi)
leaq 0x30(%rsp), %rdi
xorl %edx, %edx
callq 0x57d10
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x57de0
leaq 0x50(%rsp), %rdi
callq 0x59148
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
jmp 0x67bea
movq %rax, %rbx
leaq 0x50(%rsp), %rdi
callq 0x59148
movq %rbx, %rdi
callq 0x57090
nop