// File: /workspace/github_c_makefile_star2_O3/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, %r15
movq 0x40648(%rdi), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %r12
movq $0x0, 0x8(%rsp)
movq 0x40648(%r15), %rax
movups 0x5ec(%rax), %xmm0
movaps %xmm0, 0x90(%rsp)
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8c2cd(%rip), %xmm0    # 0xf37c0
divsd 0x8c1bd(%rip), %xmm0    # 0xf36b8
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpltsd %xmm2, %xmm1
movsd 0x8be80(%rip), %xmm3    # 0xf3390
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
movsd 0x8be78(%rip), %xmm3    # 0xf3398
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %r13
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8c27f(%rip), %xmm0    # 0xf37c8
divsd 0x8c167(%rip), %xmm0    # 0xf36b8
movapd %xmm0, %xmm1
cmpltsd 0x8c28a(%rip), %xmm1    # 0xf37e8
movapd %xmm1, %xmm2
movsd 0x8be26(%rip), %xmm3    # 0xf3390
andpd %xmm3, %xmm2
movsd 0x8be22(%rip), %xmm3    # 0xf3398
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rbx
addq %r13, %rbx
leaq 0x38(%rsp), %rsi
movl %r13d, (%rsi)
movl %r13d, 0x4(%rsi)
leaq 0x30(%rsp), %rdi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
callq 0x55960
movl %ebx, (%rsp)
movl 0x5fc(%r15), %r14d
movl %r14d, 0x4(%rsp)
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8c20c(%rip), %xmm0    # 0xf37d8
divsd 0x8c0e4(%rip), %xmm0    # 0xf36b8
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8c208(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leal 0x2(%rbx,%rax), %eax
movq %rsp, %rdi
movl %eax, 0x8(%rdi)
leal 0x2(%r13,%r14), %eax
movl %eax, 0xc(%rdi)
leaq 0x90(%rsp), %rsi
callq 0x55970
movq %r12, 0x18(%rsp)
movq %r15, 0x10(%rsp)
movq %r13, 0x60(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r13d, %xmm0
movsd 0x8c1a0(%rip), %xmm1    # 0xf37d0
divsd %xmm0, %xmm1
movsd %xmm1, 0x48(%rsp)
testb %al, %al
je 0x677a1
movq %rsp, %rsi
movq 0x18(%rsp), %rdi
movl $0x1, %edx
callq 0x57890
cmpl $0x0, 0x60(%rsp)
jle 0x677a1
leal 0x1(%rbx), %ebp
movq 0x60(%rsp), %r15
negl %r15d
movl $0x1, %r12d
leaq 0x38(%rsp), %r14
xorpd %xmm0, %xmm0
movsd %xmm0, 0x70(%rsp)
movq 0x10(%rsp), %r13
movl 0x5fc(%r13), %eax
addl %r12d, %eax
movl %ebp, 0x28(%rsp)
movl %eax, 0x2c(%rsp)
movq 0x18(%rsp), %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x8c128(%rip), %xmm0    # 0xf37d8
divsd 0x8c000(%rip), %xmm0    # 0xf36b8
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movapd %xmm1, %xmm2
movsd 0x8bcbf(%rip), %xmm3    # 0xf3390
andpd %xmm3, %xmm2
movsd 0x8bcbb(%rip), %xmm4    # 0xf3398
andnpd %xmm4, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
addl %ebx, %eax
incl %eax
movl 0x5fc(%r13), %ecx
addl %r12d, %ecx
movl %eax, 0x88(%rsp)
movl %ecx, 0x8c(%rsp)
movsd 0x70(%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 %r14, %rdi
leaq 0x50(%rsp), %rsi
xorl %edx, %edx
callq 0x57d10
movq 0x18(%rsp), %rdi
leaq 0x28(%rsp), %rsi
leaq 0x88(%rsp), %rdx
movq %r14, %rcx
callq 0x58300
movsd 0x70(%rsp), %xmm0
addsd 0x48(%rsp), %xmm0
movsd %xmm0, 0x70(%rsp)
leal (%r15,%r12), %eax
incl %eax
movl %r12d, %ecx
incl %ecx
movl %ecx, %r12d
cmpl $0x1, %eax
jne 0x67684
movq 0x60(%rsp), %r13
leal 0x2(%r13), %eax
movq 0x10(%rsp), %r12
movl 0x5f8(%r12), %ecx
movq %rsp, %rsi
movl %ecx, (%rsi)
addl %ecx, %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 0x8bfc4(%rip), %xmm0    # 0xf37e0
divsd 0x8be94(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x8bfb8(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movl %r13d, %ecx
addl %eax, %ecx
leaq 0x38(%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 0x90(%rsp), %rsi
callq 0x55970
testb %al, %al
je 0x67b79
movq %rsp, %rdi
leaq 0x90(%rsp), %rsi
callq 0x58af0
movq %rax, %r15
movq %rax, 0x38(%rsp)
leal 0x5(%rdx), %ebx
movl %ebx, 0x40(%rsp)
shrq $0x20, %rdx
addl $0x5, %edx
movl %edx, 0x44(%rsp)
movl 0x5f8(%r12), %ecx
movl 0x5fc(%r12), %esi
incl %ecx
subl %ecx, %eax
shrq $0x20, %r15
incl %esi
subl %esi, %r15d
subl %ecx, %ebx
subl %esi, %edx
movl %eax, (%rsp)
movl %r15d, 0x4(%rsp)
movl %ebx, 0x8(%rsp)
movl %edx, 0xc(%rsp)
xorl %ecx, %ecx
testl %r15d, %r15d
cmovlel %ecx, %r15d
cmpl %edx, %r13d
cmovll %r13d, %edx
cmpl %edx, %r15d
jge 0x67b5a
movq 0x10(%rsp), %rcx
addq $0x62c, %rcx            # imm = 0x62C
movq %rcx, 0xa8(%rsp)
movsd 0x8ba3c(%rip), %xmm0    # 0xf3368
divsd 0x48(%rsp), %xmm0
testl %eax, %eax
movl $0x0, %ecx
cmovgl %eax, %ecx
movl %ecx, 0x24(%rsp)
cvtsi2sd %ecx, %xmm1
cmpl %ebx, %r13d
cmovll %r13d, %ebx
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)
leaq 0x30(%rsp), %r13
leaq 0x28(%rsp), %rbp
leaq 0x50(%rsp), %r14
movq %rdx, 0xb0(%rsp)
xorps %xmm0, %xmm0
cvtsi2sd %r15d, %xmm0
mulsd 0x48(%rsp), %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %cl
cmpl %ebx, 0x24(%rsp)
jge 0x67b46
movq 0x10(%rsp), %rdx
movslq 0x614(%rdx), %rdx
movb %cl, %al
leaq 0x8be28(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movl $0xff, %ecx
subq %rax, %rcx
shlq $0xa, %rdx
addq 0xa8(%rsp), %rdx
movl (%rdx,%rcx,4), %eax
movl %eax, %ecx
shrl $0x8, %ecx
movd %eax, %xmm0
shrl $0x10, %eax
movd %ecx, %xmm1
punpckldq %xmm0, %xmm1    # xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
pand 0x8bdfb(%rip), %xmm1    # 0xf3800
cvtdq2pd %xmm1, %xmm0
divpd 0xd0(%rsp), %xmm0
movzbl %al, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd 0xf0(%rsp), %xmm1
movapd 0xe0(%rsp), %xmm6
mulsd %xmm1, %xmm6
movsd %xmm1, 0xb8(%rsp)
subsd %xmm1, %xmm6
movapd 0xc0(%rsp), %xmm7
mulpd %xmm0, %xmm7
movapd %xmm0, 0x100(%rsp)
subpd %xmm0, %xmm7
movl 0x24(%rsp), %r12d
addpd 0x100(%rsp), %xmm7
movapd %xmm7, %xmm0
unpckhpd %xmm7, %xmm0            # xmm0 = xmm0[1],xmm7[1]
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movapd %xmm1, %xmm2
movsd 0x8b908(%rip), %xmm3    # 0xf3390
andpd %xmm3, %xmm2
movsd 0x8b904(%rip), %xmm4    # 0xf3398
andnpd %xmm4, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movl %r12d, 0x28(%rsp)
movapd %xmm7, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm4, %xmm0
orpd %xmm1, %xmm0
movapd %xmm7, 0x60(%rsp)
addsd %xmm7, %xmm0
cvttsd2si %xmm0, %rcx
addsd 0xb8(%rsp), %xmm6
movapd %xmm6, %xmm0
cmpltsd %xmm5, %xmm0
movapd %xmm0, %xmm1
andpd %xmm3, %xmm1
andnpd %xmm4, %xmm0
orpd %xmm1, %xmm0
movapd %xmm6, 0x70(%rsp)
addsd %xmm6, %xmm0
cvttsd2si %xmm0, %rdx
movl %r15d, 0x2c(%rsp)
shll $0x10, %edx
shll $0x8, %ecx
orl %eax, %ecx
orl %edx, %ecx
movslq %ecx, %rax
movq %rax, 0x58(%rsp)
movl $0x0, 0x50(%rsp)
movq %r13, %rdi
movq %rbp, %rsi
movq %r14, %rdx
callq 0x56080
incl %r12d
cmpl %r12d, %ebx
movaps 0x70(%rsp), %xmm6
movaps 0x60(%rsp), %xmm7
jne 0x67a5e
incl %r15d
movq 0xb0(%rsp), %rdx
cmpl %edx, %r15d
jne 0x6798e
leaq 0x30(%rsp), %rsi
movq %rsp, %rdx
leaq 0x38(%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 0x50(%rsp), %rsi
movq %rax, 0x8(%rsi)
movl $0x2, (%rsi)
leaq 0x38(%rsp), %rdi
xorl %edx, %edx
callq 0x57d10
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
callq 0x57de0
leaq 0x30(%rsp), %rdi
callq 0x59148
addq $0x118, %rsp            # imm = 0x118
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
jmp 0x67c12
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x59148
movq %rbx, %rdi
callq 0x57090
nop