// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/optionbox.cpp
// Function: smooth::GUI::OptionBox::Paint(int)
S::Int S::GUI::OptionBox::Paint(Int message)
{
	if (!IsRegistered()) return Error();
	if (!IsVisible())    return Success();

	switch (message)
	{
		case SP_PAINT:
		case SP_UPDATE:
			{
				Surface	*surface = GetDrawSurface();
				Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

				surface->StartPaint(frame);

				if (message == SP_PAINT)
				{
					Font	 nFont = font;

					if (!IsActive()) nFont.SetColor(Setup::InactiveTextColor);

					surface->Box(frame, GetBackgroundColor(), Rect::Filled);
					surface->SetText(text, frame + Point(frame.GetHeight(), Math::Ceil(Float(frame.GetHeight() - scaledTextSize.cy) / 2) - 1), nFont);
				}

				Float	 scaleFactor = surface->GetSurfaceDPI() / 96.0;
				Int	 inset	     = 3 * scaleFactor;

				Point	 lineStart   = Point(frame.left, frame.top) + Point(3, 3) * scaleFactor + Point(inset + (IsRightToLeft() ? 1 : 0), 0);
				Point	 lineEnd     = lineStart + Point(11 * scaleFactor - 2 * inset, 0);

				Int	 lightColor  = Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255));
				Int	 darkColor   = Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0));

				Int	 innerColor  = (IsActive() ? Setup::ClientColor : Setup::BackgroundColor);

				surface->Line(lineStart, lineEnd, darkColor);

				for (Int i = 0; i < Int(11 * scaleFactor) - 2; i++)
				{
					if	(i <			      inset) { lineStart.x--; lineEnd.x++; }
					else if (i > (11 * scaleFactor) - 2 - inset) { lineStart.x++; lineEnd.x--; }

					lineStart.y++;
					lineEnd.y++;

					surface->Line(lineStart, lineEnd, innerColor);

					Int	 leftColor  = (i > (11 * scaleFactor) - 2 - inset) ? lightColor : (IsRightToLeft() ? lightColor : darkColor);
					Int	 rightColor = (i > (11 * scaleFactor) - 2 - inset) ? lightColor : (IsRightToLeft() ? darkColor : lightColor);

					surface->SetPixel(lineStart, leftColor);
					surface->SetPixel(lineEnd - Point(1, 0), rightColor);
				}

				lineStart.x++;
				lineStart.y++;
				lineEnd.x--;
				lineEnd.y++;

				surface->Line(lineStart, lineEnd, lightColor);

				if (*variable == code)
				{
					for (Int i = 0; i < 2; i++)
					{
						Int	 color	= IsActive() ? Setup::DividerDarkColor : Setup::DividerDarkColor.Average(Setup::BackgroundColor);
						Point	 offset	= Point(IsRightToLeft() ? 0 : 1, 0);

						if (i == 1)
						{
							color	= IsActive() ? Setup::ClientTextColor : Setup::InactiveTextColor;
							offset -= Point(IsRightToLeft() ? -i : i, i);
						}

						Int	 inset	    = 2 * scaleFactor;

						Point	 lineStart  = Point(frame.left, frame.top) + Point(6, 6) * scaleFactor + offset + Point(inset, 0);
						Point	 lineEnd    = lineStart + Point(5 * scaleFactor - 2 * inset, 0);

						for (Int j = 0; j < Int(5 * scaleFactor); j++)
						{
							if	(j <			 inset) { lineStart.x--; lineEnd.x++; }
							else if (j > (5 * scaleFactor) - inset) { lineStart.x++; lineEnd.x--; }

							lineStart.y++;
							lineEnd.y++;

							surface->Line(lineStart, lineEnd, color);
						}
					}
				}

				surface->EndPaint();
			}

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebp
movq %rdi, %r12
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x79b56
movq (%r12), %rax
movq %r12, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
cmpl $0x1, %ebp
ja 0x79b56
testb %al, %al
je 0x79b56
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%r12), %rax
movq %r12, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r12), %rax
movq %r12, %rdi
callq *0x50(%rax)
leal (%rax,%r15), %ecx
shrq $0x20, %rax
leaq 0x38(%rsp), %rsi
movl %r15d, (%rsi)
movl %ebx, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
addl %ebx, %eax
movl %eax, 0xc(%rsi)
movq %r14, %rdi
callq 0x55160
testl %ebp, %ebp
jne 0x79589
leaq 0x140(%r12), %rsi
leaq 0x88(%rsp), %rdi
callq 0x55b70
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x794dc
movq 0xf2481(%rip), %rsi     # 0x16b950
leaq 0x88(%rsp), %rdi
callq 0x58650
movq (%r12), %rax
movq %r12, %rdi
callq *0x140(%rax)
movq 0xf2ab8(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
leaq 0x68(%rsp), %r8
movq $0x0, (%r8)
leaq 0x38(%rsp), %rsi
movq %r14, %rdi
movq %rax, %rdx
callq 0x57930
movl 0x44(%rsp), %ebx
subl 0x3c(%rsp), %ebx
movl %ebx, %eax
subl 0x18c(%r12), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x79e6c(%rip), %xmm0    # 0xf3398
callq 0x56cb0
leaq 0xf0(%r12), %rsi
decl %eax
movl 0x38(%rsp), %ecx
addl %ebx, %ecx
movl 0x3c(%rsp), %edx
addl %eax, %edx
shlq $0x20, %rdx
addl 0x40(%rsp), %ebx
addl 0x44(%rsp), %eax
orq %rdx, %rcx
shlq $0x20, %rax
orq %rax, %rbx
leaq 0x68(%rsp), %rdx
movq %rcx, (%rdx)
movq %rbx, 0x8(%rdx)
leaq 0x88(%rsp), %rcx
movq %r14, %rdi
xorl %r8d, %r8d
callq 0x57b80
leaq 0x88(%rsp), %rdi
callq 0x56720
movq %r14, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm1
divsd 0x7a11a(%rip), %xmm1    # 0xf36b8
movsd %xmm1, 0x58(%rsp)
movsd 0x7a00c(%rip), %xmm0    # 0xf35b8
mulsd %xmm1, %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
cvttsd2si %xmm0, %r15d
leaq 0x7a227(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
movq %r14, 0xc8(%rsp)
cvttsd2si %xmm0, %r14
movl 0x3c(%rsp), %ebx
addl %r14d, %ebx
shlq $0x20, %rbx
movq (%r12), %rax
movl 0x38(%rsp), %ebp
addl %r15d, %ebp
movq %r12, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebp, %eax
addl %r14d, %eax
leaq (%rax,%rbx), %rsi
leaq 0x68(%rsp), %rbp
movq %r15, 0x48(%rsp)
leal (%r15,%r15), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
movsd 0x7c9ed(%rip), %xmm1    # 0xf6010
mulsd 0x58(%rsp), %xmm1
movsd %xmm1, 0x18(%rsp)
subsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
addl %eax, %ecx
orq %rbx, %rcx
movq 0xf1e8d(%rip), %r14     # 0x16b4d0
movl 0x8(%r14), %eax
movl $0xff, %r8d
movl %eax, %edx
andl %r8d, %edx
movl $0xbf, %r10d
cmpl %r10d, %edx
movl $0xbf, %r9d
cmovbl %edx, %r9d
addl $0x40, %r9d
movq %r12, %rdi
movl %eax, %r13d
shrl $0x8, %r13d
andl %r8d, %r13d
cmpl %r10d, %r13d
movl $0xbf, %r11d
cmovbl %r13d, %r11d
movq %rsi, (%rbp)
shrl $0x10, %eax
andl %r8d, %eax
cmpl %r10d, %eax
cmovbl %eax, %r10d
shll $0x10, %r10d
addl $0x400000, %r10d        # imm = 0x400000
shll $0x8, %r11d
addl $0x4000, %r11d          # imm = 0x4000
orl %r9d, %r11d
orl %r10d, %r11d
movq %r11, 0x30(%rsp)
cmpl $0x41, %edx
movl $0x40, %esi
cmovbl %esi, %edx
addl $-0x40, %edx
cmpl $0x41, %r13d
cmovbl %esi, %r13d
movq 0xc8(%rsp), %r12
leaq 0x10(%rsp), %rbx
cmpl $0x41, %eax
cmovbl %esi, %eax
movq %rcx, (%rbx)
shll $0x10, %eax
addl $0xffc00000, %eax       # imm = 0xFFC00000
shll $0x8, %r13d
addl $0xffffc000, %r13d      # imm = 0xFFFFC000
orl %edx, %r13d
orl %eax, %r13d
movq (%rdi), %rax
movq %rdi, 0x80(%rsp)
callq *0x98(%rax)
movl %eax, %r15d
movq 0xf1f5b(%rip), %rax     # 0x16b670
movq 0x8(%rax), %rbp
movq 0x8(%r14), %r14
leaq 0x88(%rsp), %rcx
movq %r13, 0xd0(%rsp)
movq %r13, 0x8(%rcx)
movl $0x0, (%rcx)
movq %r12, %r13
movq %r12, %rdi
leaq 0x68(%rsp), %rsi
movq %rbx, %rdx
callq 0x58300
xorpd %xmm1, %xmm1
movsd 0x18(%rsp), %xmm2
cvttsd2si %xmm2, %eax
movl %eax, 0xc(%rsp)
cmpl $0x3, %eax
jl 0x798db
testb %r15b, %r15b
cmovneq %rbp, %r14
addsd 0x7c8a4(%rip), %xmm2    # 0xf6018
cvtsi2sdl 0x48(%rsp), %xmm0
subsd %xmm0, %xmm2
movsd %xmm2, 0x18(%rsp)
movslq %r14d, %rax
movq %rax, 0x78(%rsp)
addl $-0x2, 0xc(%rsp)
xorl %r15d, %r15d
cmpl 0x48(%rsp), %r15d
movsd %xmm1, 0x20(%rsp)
jge 0x797b1
decl 0x68(%rsp)
incl 0x10(%rsp)
movsd %xmm1, 0x50(%rsp)
jmp 0x797cf
xorps %xmm2, %xmm2
cvtsi2sd %r15d, %xmm2
ucomisd 0x18(%rsp), %xmm2
movsd %xmm2, 0x50(%rsp)
jbe 0x797cf
incl 0x68(%rsp)
decl 0x10(%rsp)
incl 0x6c(%rsp)
incl 0x14(%rsp)
movq 0x78(%rsp), %rax
movq %rax, 0x90(%rsp)
movl $0x0, 0x88(%rsp)
movq %r13, %rdi
leaq 0x68(%rsp), %rsi
leaq 0x10(%rsp), %rdx
leaq 0x88(%rsp), %rcx
callq 0x58300
movsd 0x50(%rsp), %xmm0
ucomisd 0x18(%rsp), %xmm0
movq 0x30(%rsp), %r14
movq %r14, %rbp
ja 0x7985e
movq 0x80(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
movq 0xd0(%rsp), %r12
movq %r12, %rbp
movq 0x30(%rsp), %rbx
cmovneq %rbx, %rbp
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
movq %rbx, %r14
cmovneq %r12, %r14
movq %rbp, 0x90(%rsp)
xorl %r12d, %r12d
movl %r12d, 0x88(%rsp)
movq %r13, %rdi
leaq 0x68(%rsp), %rsi
leaq 0x88(%rsp), %rbx
movq %rbx, %rdx
callq 0x55120
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %ecx
decl %eax
shlq $0x20, %rcx
orq %rcx, %rax
movq %rax, 0x28(%rsp)
movq %r14, 0x90(%rsp)
movl %r12d, 0x88(%rsp)
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
movq %rbx, %rdx
callq 0x55120
movsd 0x20(%rsp), %xmm1
addsd 0x79abb(%rip), %xmm1    # 0xf3388
incl %r15d
cmpl %r15d, 0xc(%rsp)
jne 0x79794
leaq 0x68(%rsp), %rsi
movq (%rsi), %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movq %xmm0, (%rsi)
leaq 0x10(%rsp), %rdx
movq (%rdx), %xmm0
paddd 0x7c72f(%rip), %xmm0    # 0xf6030
movq %xmm0, (%rdx)
leaq 0x88(%rsp), %rcx
movq 0x30(%rsp), %rax
movq %rax, 0x8(%rcx)
movl $0x0, (%rcx)
movq %r13, %rdi
callq 0x58300
movq 0x80(%rsp), %r12
movq 0x5b8(%r12), %rax
movl (%rax), %eax
cmpl 0x5c0(%r12), %eax
jne 0x79b4c
movsd 0x58(%rsp), %xmm3
movapd %xmm3, %xmm0
addsd %xmm3, %xmm0
cvttsd2si %xmm0, %r15d
movsd 0x7c579(%rip), %xmm1    # 0xf5ed8
mulsd %xmm3, %xmm1
xorpd %xmm2, %xmm2
xorl %eax, %eax
ucomisd %xmm1, %xmm2
seta %al
leaq 0x79e79(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm1
cvttsd2si %xmm1, %rcx
movq %rcx, 0x30(%rsp)
leal (%rcx,%r15), %eax
movl %eax, 0x48(%rsp)
leal (%r15,%r15), %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
mulsd 0x7c67f(%rip), %xmm3    # 0xf6020
movapd %xmm3, %xmm2
subsd %xmm1, %xmm2
cvttsd2si %xmm2, %eax
movl %eax, 0xc(%rsp)
cvttsd2si %xmm3, %ebx
cvttpd2dq %xmm0, %xmm0
cvtdq2pd %xmm0, %xmm0
subsd %xmm0, %xmm3
movsd %xmm3, 0x58(%rsp)
movb $0x1, %al
xorl %edx, %edx
movq 0xf1eb6(%rip), %rcx     # 0x16b888
addq $0x8, %rcx
movq %rcx, 0x78(%rsp)
leaq 0x88(%rsp), %rbp
movl %edx, 0x18(%rsp)
movl %eax, 0x50(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
movq 0x78(%rsp), %rcx
testb %al, %al
jne 0x79a1f
movq %rbp, %rdi
movq 0xf1e7d(%rip), %rsi     # 0x16b888
movq 0xf1abe(%rip), %rdx     # 0x16b4d0
callq 0x58200
leaq 0x90(%rsp), %rcx
movq (%rcx), %rax
movq %rax, 0x20(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
xorb $0x1, %al
movzbl %al, %r14d
xorl %eax, %eax
testb $0x1, 0x18(%rsp)
je 0x79a8b
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
movq 0xf1ef9(%rip), %rcx     # 0x16b950
testb %al, %al
je 0x79a62
movq 0xf238e(%rip), %rcx     # 0x16bdf0
movq 0x8(%rcx), %rax
movq %rax, 0x20(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movzbl %al, %ecx
decl %ecx
orl $0x1, %ecx
addl %r14d, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
movl %ecx, %r14d
addl 0x48(%rsp), %r14d
addl 0x30(%rsp), %eax
addl 0x3c(%rsp), %eax
shlq $0x20, %rax
addl 0x38(%rsp), %r14d
leaq (%r14,%rax), %rcx
addl 0xc(%rsp), %r14d
orq %rax, %r14
movq %rcx, 0x28(%rsp)
movq %r14, 0x60(%rsp)
testl %ebx, %ebx
jle 0x79b32
movslq 0x20(%rsp), %r14
xorl %r12d, %r12d
xorpd %xmm0, %xmm0
cmpl %r15d, %r12d
movsd %xmm0, 0x20(%rsp)
jge 0x79adc
decl 0x28(%rsp)
incl 0x60(%rsp)
jmp 0x79aec
ucomisd 0x58(%rsp), %xmm0
jbe 0x79aec
incl 0x28(%rsp)
decl 0x60(%rsp)
incl 0x2c(%rsp)
incl 0x64(%rsp)
movq %r14, 0x90(%rsp)
movl $0x0, 0x88(%rsp)
movq %r13, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x60(%rsp), %rdx
movq %rbp, %rcx
callq 0x58300
movsd 0x20(%rsp), %xmm0
addsd 0x7985e(%rip), %xmm0    # 0xf3388
incl %r12d
cmpl %r12d, %ebx
jne 0x79ac7
movb $0x1, %dl
testb $0x1, 0x50(%rsp)
movl $0x0, %eax
movq 0x80(%rsp), %r12
jne 0x799e3
movq %r13, %rdi
callq 0x58780
xorl %ecx, %ecx
movl %ecx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x79b6e
jmp 0x79b6e
movq %rax, %rbx
leaq 0x88(%rsp), %rdi
callq 0x56720
movq %rbx, %rdi
callq 0x57090