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

	Surface	*surface = GetDrawSurface();
	Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

	surface->StartPaint(frame);

	PopupMenuEntry::Paint(message);

	switch (message)
	{
		case SP_PAINT:
		case SP_MOUSEIN:
		case SP_MOUSEOUT:
			if (*iVar == iCode)
			{
				Float	 scaleFactor = surface->GetSurfaceDPI() / 96.0;

				for (Int j = 0; j < 2; j++)
				{
					Color	 color	= (IsActive() ? Setup::TextColor : Setup::InactiveTextColor);
					Point	 offset	= Point(IsRightToLeft() ? 1 : 0, 0);

					if (message == SP_MOUSEIN) color = Setup::GradientTextColor;

					if (j == 0)
					{
						color  = Color(color.GetRed() + (255 - color.GetRed()) * 0.6, color.GetGreen() + (255 - color.GetGreen()) * 0.6, color.GetBlue() + (255 - color.GetBlue()) * 0.6);
						offset = Point(IsRightToLeft() ? -1 : 1, 1);
					}

					Int	 inset	    = 1 * scaleFactor;

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

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

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

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

			break;
	}

	surface->EndPaint();

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, (%rsp)
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x8e4f6
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
testb %al, %al
je 0x8e4f6
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rax, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
leaq 0x60(%rsp), %rsi
movl %r12d, (%rsi)
movl %ebx, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
addl %ebx, %eax
movl %eax, 0xc(%rsi)
movq %r15, %rdi
callq 0x55160
movq %r14, %rdi
movl (%rsp), %ebx
movl %ebx, %esi
callq 0x578d0
cmpl $0x3, %ebx
ja 0x8e4ec
cmpl $0x1, (%rsp)
je 0x8e4ec
movq 0x5e0(%r14), %rax
movl (%rax), %eax
cmpl 0x5e8(%r14), %eax
jne 0x8e4ec
movq %r15, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm3
divsd 0x6543d(%rip), %xmm3    # 0xf36b8
cvttsd2si %xmm3, %ebx
movsd 0x65119(%rip), %xmm0    # 0xf33a0
mulsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x67899(%rip), %rcx     # 0xf5b38
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
leal (%rbx,%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
cvttpd2dq %xmm3, %xmm1
mulsd 0x67d61(%rip), %xmm3    # 0xf6020
movapd %xmm3, %xmm2
subsd %xmm0, %xmm2
addsd 0x67d49(%rip), %xmm2    # 0xf6018
cvttsd2si %xmm2, %eax
movl %eax, 0x1c(%rsp)
movq %rcx, 0x40(%rsp)
leal 0x2(%rbx,%rcx), %eax
movl %eax, 0x18(%rsp)
cvtdq2pd %xmm1, %xmm0
movapd %xmm3, 0x50(%rsp)
subsd %xmm0, %xmm3
movapd %xmm3, 0x70(%rsp)
movb $0x1, %al
movl %eax, 0x4(%rsp)
movq 0xdd6e3(%rip), %rax     # 0x16b9e8
addq $0x8, %rax
movq %rax, 0x38(%rsp)
movq 0xdd63b(%rip), %rax     # 0x16b950
addq $0x8, %rax
movq %rax, 0x30(%rsp)
leaq 0x10(%rsp), %r12
leaq 0x8(%rsp), %r13
leaq 0x20(%rsp), %rbp
movq %r14, 0x48(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
testb %al, %al
movq 0x30(%rsp), %rax
cmovneq 0x38(%rsp), %rax
movq (%rax), %rax
movq 0xdd5fb(%rip), %rcx     # 0x16b950
cmovneq 0xdd68b(%rip), %rcx     # 0x16b9e8
movq %rax, 0x28(%rsp)
movl (%rcx), %eax
movl %eax, 0x20(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
cmpl $0x2, (%rsp)
jne 0x8e38b
movq 0xdd7af(%rip), %rcx     # 0x16bb30
movupd (%rcx), %xmm0
movapd %xmm0, 0x20(%rsp)
testb $0x1, 0x4(%rsp)
je 0x8e440
movl 0x28(%rsp), %ecx
movl %ecx, %eax
movl $0xff, %esi
andl %esi, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorl %esi, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
movsd 0x68855(%rip), %xmm2    # 0xf6c10
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movl %ecx, %edx
shrl $0x8, %edx
andl %esi, %edx
xorps %xmm0, %xmm0
cvtsi2sd %edx, %xmm0
xorl %esi, %edx
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
shrl $0x10, %ecx
andl %esi, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
xorl %esi, %ecx
xorps %xmm1, %xmm1
cvtsi2sd %ecx, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
shll $0x10, %ecx
shll $0x8, %edx
orl %eax, %edx
orl %ecx, %edx
movslq %edx, %rax
movl $0x0, 0x20(%rsp)
movq %rax, 0x28(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
negl %eax
orl $0x1, %eax
movl $0x1, %ecx
jmp 0x8e445
movzbl %al, %eax
xorl %ecx, %ecx
addl 0x18(%rsp), %eax
addl 0x40(%rsp), %ecx
addl 0x64(%rsp), %ecx
addl 0x60(%rsp), %eax
shlq $0x20, %rcx
leaq (%rax,%rcx), %rdx
addl 0x1c(%rsp), %eax
orq %rcx, %rax
movapd 0x50(%rsp), %xmm0
ucomisd 0x65376(%rip), %xmm0    # 0xf37e8
movq %rdx, 0x10(%rsp)
movq %rax, 0x8(%rsp)
jbe 0x8e4d4
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
cmpl %ebx, %r14d
jle 0x8e49c
ucomisd 0x70(%rsp), %xmm0
jb 0x8e4a4
incl 0x10(%rsp)
decl 0x8(%rsp)
jmp 0x8e4a4
decl 0x10(%rsp)
incl 0x8(%rsp)
incl 0x14(%rsp)
incl 0xc(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x58300
incl %r14d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movapd 0x50(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x8e485
testb $0x1, 0x4(%rsp)
movl $0x0, 0x4(%rsp)
movq 0x48(%rsp), %r14
jne 0x8e332
movq %r15, %rdi
callq 0x58780
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq