// File: /workspace/github_c_makefile_star2_O2/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 $0x118, %rsp            # imm = 0x118
movq %rdi, %rbx
movq 0x40648(%rdi), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
andq $0x0, 0x8(%rsp)
movq %rax, %r14
movq 0x40648(%rbx), %rax
movups 0x5ec(%rax), %xmm0
movaps %xmm0, 0x90(%rsp)
movq %r14, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
mulsd 0x7b875(%rip), %xmm0    # 0xe3780
divsd 0x7b5fd(%rip), %xmm0    # 0xe3510
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpltsd %xmm2, %xmm1
movsd 0x7b450(%rip), %xmm3    # 0xe3378
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
movsd 0x7b448(%rip), %xmm3    # 0xe3380
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r15
movq %r14, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
mulsd 0x7b82a(%rip), %xmm0    # 0xe3788
divsd 0x7b5aa(%rip), %xmm0    # 0xe3510
movapd %xmm0, %xmm1
cmpltsd 0x7b835(%rip), %xmm1    # 0xe37a8
movapd %xmm1, %xmm2
movsd 0x7b3f9(%rip), %xmm3    # 0xe3378
andpd %xmm3, %xmm2
movsd 0x7b3f5(%rip), %xmm3    # 0xe3380
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r12
addq %r15, %r12
leaq 0x30(%rsp), %rsi
movl %r15d, (%rsi)
movl %r15d, 0x4(%rsi)
leaq 0x28(%rsp), %rdi
pushq $-0x1
popq %rdx
callq 0x569c0
movl %r12d, (%rsp)
movq %rbx, 0x10(%rsp)
movl 0x5fc(%rbx), %ebx
movl %ebx, 0x4(%rsp)
movq %r14, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
mulsd 0x7b7b8(%rip), %xmm0    # 0xe3798
divsd 0x7b528(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x7b7b4(%rip), %rcx     # 0xe37b0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leal 0x2(%r12,%rax), %eax
movq %rsp, %rdi
movl %eax, 0x8(%rdi)
leal 0x2(%r15,%rbx), %eax
movl %eax, 0xc(%rdi)
leaq 0x90(%rsp), %rsi
callq 0x569d0
movq %r14, 0x18(%rsp)
movq %r15, 0x80(%rsp)
cvtsi2sd %r15d, %xmm0
movsd 0x7b750(%rip), %xmm1    # 0xe3790
divsd %xmm0, %xmm1
movsd %xmm1, 0x40(%rsp)
testb %al, %al
movq 0x10(%rsp), %rbx
je 0x6819f
movq %rsp, %rsi
pushq $0x1
popq %r14
movq 0x18(%rsp), %rdi
movl %r14d, %edx
callq 0x58ad0
leal 0x1(%r12), %r13d
xorl %ebp, %ebp
movq 0x80(%rsp), %rax
testl %eax, %eax
cmovgl %eax, %ebp
negl %ebp
leaq 0x30(%rsp), %r15
xorpd %xmm0, %xmm0
movsd %xmm0, 0x60(%rsp)
leal (%r14,%rbp), %eax
cmpl $0x1, %eax
je 0x6819f
movl 0x5fc(%rbx), %eax
addl %r14d, %eax
movl %r13d, 0x20(%rsp)
movl %eax, 0x24(%rsp)
movq 0x18(%rsp), %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
mulsd 0x7b6d2(%rip), %xmm0    # 0xe3798
divsd 0x7b442(%rip), %xmm0    # 0xe3510
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movapd %xmm1, %xmm2
movsd 0x7b291(%rip), %xmm3    # 0xe3378
andpd %xmm3, %xmm2
movsd 0x7b28d(%rip), %xmm4    # 0xe3380
andnpd %xmm4, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
addl %r12d, %eax
incl %eax
movl 0x5fc(%rbx), %ecx
addl %r14d, %ecx
movl %eax, 0x78(%rsp)
movl %ecx, 0x7c(%rsp)
movsd 0x60(%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, 0x58(%rsp)
movl $0x2, 0x50(%rsp)
movq %r15, %rdi
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
callq 0x58f90
movq 0x18(%rsp), %rdi
leaq 0x20(%rsp), %rsi
leaq 0x78(%rsp), %rdx
movq %r15, %rcx
callq 0x595b0
movsd 0x60(%rsp), %xmm0
addsd 0x40(%rsp), %xmm0
movsd %xmm0, 0x60(%rsp)
incl %r14d
jmp 0x68090
movq 0x80(%rsp), %r13
leal 0x2(%r13), %eax
movl 0x5f8(%rbx), %ecx
movq %rsp, %rsi
movl %ecx, (%rsi)
addl %ecx, %eax
movl %eax, 0x8(%rsi)
pushq $0x1
popq %rdx
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x58ad0
movq 0x10(%rsp), %rax
movl 0x5f8(%rax), %ebx
leal -0x4(%rbx), %ebp
movl %ebp, (%rsp)
movl 0x5fc(%rax), %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 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
mulsd 0x7b58e(%rip), %xmm0    # 0xe37a0
divsd 0x7b2f6(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x7b582(%rip), %rcx     # 0xe37b0
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 0x56160
movb $0x1, %al
movq 0x10(%rsp), %rdi
movb %al, 0x602(%rdi)
movb %al, 0x605(%rdi)
callq 0x59640
movq %rsp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x569d0
testb %al, %al
movq 0x10(%rsp), %rbx
je 0x6855e
movq %rsp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x59e30
movq %rax, %r15
movq %rax, 0x30(%rsp)
leal 0x5(%rdx), %r12d
movl %r12d, 0x38(%rsp)
shrq $0x20, %rdx
addl $0x5, %edx
movl %edx, 0x3c(%rsp)
movl 0x5f8(%rbx), %eax
movl 0x5fc(%rbx), %ecx
incl %eax
movl %r15d, %esi
subl %eax, %esi
shrq $0x20, %r15
incl %ecx
subl %ecx, %r15d
subl %eax, %r12d
subl %ecx, %edx
movl %esi, (%rsp)
movl %r15d, 0x4(%rsp)
movl %r12d, 0x8(%rsp)
xorl %eax, %eax
testl %r15d, %r15d
cmovlel %eax, %r15d
movl %edx, 0xc(%rsp)
cmpl %edx, %r13d
cmovll %r13d, %edx
leaq 0x62c(%rbx), %rcx
movq %rcx, 0xb0(%rsp)
movsd 0x7b036(%rip), %xmm0    # 0xe3350
testl %esi, %esi
cmovlel %eax, %esi
movl %esi, 0x4c(%rsp)
cvtsi2sd %esi, %xmm1
divsd 0x40(%rsp), %xmm0
cmpl %r12d, %r13d
cmovll %r13d, %r12d
movapd %xmm0, 0xf0(%rsp)
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
movapd %xmm0, 0xd0(%rsp)
movapd %xmm1, 0xe0(%rsp)
unpcklpd %xmm1, %xmm1            # xmm1 = xmm1[0,0]
movapd %xmm1, 0xc0(%rsp)
movsd 0x7b010(%rip), %xmm3    # 0xe3378
movsd 0x7b010(%rip), %xmm4    # 0xe3380
leaq 0x28(%rsp), %r13
leaq 0x20(%rsp), %rbp
leaq 0x50(%rsp), %r14
movq %rdx, 0xa8(%rsp)
cmpl %edx, %r15d
jge 0x68544
movslq 0x614(%rbx), %rax
cvtsi2sd %r15d, %xmm0
mulsd 0x40(%rsp), %xmm0
xorl %ecx, %ecx
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %cl
leaq 0x7b3fa(%rip), %rdx     # 0xe37b0
addsd (%rdx,%rcx,8), %xmm0
cvttsd2si %xmm0, %rcx
movl $0xff, %edx
subq %rcx, %rdx
shlq $0xa, %rax
addq 0xb0(%rsp), %rax
movl (%rax,%rdx,4), %eax
movl %eax, %ecx
shrl $0x8, %ecx
movd %eax, %xmm0
shrl $0x10, %eax
movzbl %al, %eax
cvtsi2sd %eax, %xmm2
divsd 0xf0(%rsp), %xmm2
movd %ecx, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
pand 0x7b3bd(%rip), %xmm1    # 0xe37c0
cvtdq2pd %xmm1, %xmm0
divpd 0xd0(%rsp), %xmm0
movapd 0xc0(%rsp), %xmm5
mulpd %xmm0, %xmm5
movapd %xmm0, 0x100(%rsp)
subpd %xmm0, %xmm5
movapd 0xe0(%rsp), %xmm6
mulsd %xmm2, %xmm6
movsd %xmm2, 0xb8(%rsp)
subsd %xmm2, %xmm6
movl 0x4c(%rsp), %ebx
cmpl %r12d, %ebx
jge 0x6852f
movl %ebx, 0x20(%rsp)
movl %r15d, 0x24(%rsp)
addpd 0x100(%rsp), %xmm5
movapd %xmm5, %xmm0
cmpltpd 0x7b360(%rip), %xmm0    # 0xe37d0
movmskpd %xmm0, %eax
movapd %xmm3, %xmm0
testb $0x2, %al
jne 0x68480
movapd %xmm4, %xmm0
movapd %xmm3, %xmm1
testb $0x1, %al
jne 0x6848c
movapd %xmm4, %xmm1
movapd %xmm5, %xmm2
unpckhpd %xmm5, %xmm2            # xmm2 = xmm2[1],xmm5[1]
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movapd %xmm5, 0x60(%rsp)
addsd %xmm5, %xmm1
cvttsd2si %xmm1, %rcx
addsd 0xb8(%rsp), %xmm6
movapd %xmm6, %xmm0
cmpltsd 0x7b2e6(%rip), %xmm0    # 0xe37a8
movapd %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm4, %xmm0
orpd %xmm1, %xmm0
movapd %xmm6, 0x80(%rsp)
addsd %xmm6, %xmm0
cvttsd2si %xmm0, %rdx
shll $0x10, %edx
shll $0x8, %ecx
orl %eax, %ecx
orl %edx, %ecx
movslq %ecx, %rax
movq %rax, 0x58(%rsp)
andl $0x0, 0x50(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x57160
incl %ebx
movsd 0x7ae65(%rip), %xmm3    # 0xe3378
movsd 0x7ae65(%rip), %xmm4    # 0xe3380
movapd 0x60(%rsp), %xmm5
movapd 0x80(%rsp), %xmm6
jmp 0x68448
incl %r15d
movq 0x10(%rsp), %rbx
movq 0xa8(%rsp), %rdx
jmp 0x68387
leaq 0x28(%rsp), %rsi
movq %rsp, %rdx
leaq 0x30(%rsp), %rcx
movq 0x18(%rsp), %r15
movq %r15, %rdi
callq 0x56c20
movw $0x101, 0x603(%rbx)     # imm = 0x101
movq %rbx, %rdi
callq 0x59640
movq %r15, %rdi
callq 0x59a80
movq 0x10(%rsp), %rdx
movq 0x40670(%rdx), %r14
movl 0x618(%rdx), %eax
movl 0x61c(%rdx), %ecx
shll $0x10, %ecx
shll $0x8, %eax
orl 0x614(%rdx), %eax
orl %ecx, %eax
cltq
leaq 0x50(%rsp), %rsi
movq %rax, 0x8(%rsi)
movl $0x2, (%rsi)
leaq 0x30(%rsp), %rdi
xorl %edx, %edx
callq 0x58f90
leaq 0x30(%rsp), %rsi
movq %r14, %rdi
callq 0x59070
leaq 0x28(%rsp), %rdi
callq 0x5a4c8
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
jmp 0x685f3
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x5a4c8
movq %rbx, %rdi
callq 0x58260