// File: /workspace/github_c_makefile_star2_O1/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 $0x98, %rsp
movl %esi, 0xc(%rsp)
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x8ea77
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
testb %al, %al
je 0x8ea77
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 0x70(%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 0xc(%rsp), %ebx
movl %ebx, %esi
callq 0x578d0
cmpl $0x3, %ebx
ja 0x8ea6d
cmpl $0x1, 0xc(%rsp)
je 0x8ea6d
movq 0x5e0(%r14), %rax
movl (%rax), %eax
cmpl 0x5e8(%r14), %eax
jne 0x8ea6d
movq %r15, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm3
divsd 0x65d06(%rip), %xmm3    # 0xf44f0
cvttsd2si %xmm3, %ebx
movsd 0x65baa(%rip), %xmm0    # 0xf43a0
mulsd %xmm3, %xmm0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x65f82(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
leal (%rbx,%rbx), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
cvttpd2dq %xmm3, %xmm1
mulsd 0x68752(%rip), %xmm3    # 0xf6f80
movapd %xmm3, %xmm2
subsd %xmm0, %xmm2
addsd 0x6873a(%rip), %xmm2    # 0xf6f78
cvttsd2si %xmm2, %eax
movl %eax, 0x2c(%rsp)
movq %rcx, 0x50(%rsp)
leal 0x2(%rbx,%rcx), %eax
movl %eax, 0x28(%rsp)
cvtdq2pd %xmm1, %xmm0
movapd %xmm3, 0x60(%rsp)
subsd %xmm0, %xmm3
movapd %xmm3, 0x80(%rsp)
movq $0x0, 0x20(%rsp)
movq 0xde16e(%rip), %rax     # 0x16c9e8
addq $0x8, %rax
movq %rax, 0x48(%rsp)
movq 0xde0c6(%rip), %rax     # 0x16c950
addq $0x8, %rax
movq %rax, 0x40(%rsp)
leaq 0x10(%rsp), %r12
leaq 0x18(%rsp), %r13
leaq 0x30(%rsp), %rbp
movq %r14, 0x58(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x98(%rax)
testb %al, %al
movq 0x40(%rsp), %rax
cmovneq 0x48(%rsp), %rax
movq (%rax), %rax
movq 0xde086(%rip), %rcx     # 0x16c950
cmovneq 0xde116(%rip), %rcx     # 0x16c9e8
movq %rax, 0x38(%rsp)
movl (%rcx), %eax
movl %eax, 0x30(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
cmpl $0x2, 0xc(%rsp)
jne 0x8e901
movq 0xde239(%rip), %rcx     # 0x16cb30
movupd (%rcx), %xmm0
movapd %xmm0, 0x30(%rsp)
cmpl $0x0, 0x20(%rsp)
je 0x8e912
movzbl %al, %eax
xorl %ecx, %ecx
jmp 0x8e9ba
movl 0x38(%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 0x69151(%rip), %xmm2    # 0xf7a88
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, 0x30(%rsp)
movq %rax, 0x38(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
negl %eax
orl $0x1, %eax
movl $0x1, %ecx
addl 0x28(%rsp), %eax
addl 0x50(%rsp), %ecx
addl 0x74(%rsp), %ecx
shlq $0x20, %rcx
addl 0x70(%rsp), %eax
addq %rax, %rcx
movq %rcx, 0x10(%rsp)
addl 0x2c(%rsp), %eax
movl 0x14(%rsp), %ecx
shlq $0x20, %rcx
orq %rcx, %rax
movapd 0x60(%rsp), %xmm0
ucomisd 0x65d95(%rip), %xmm0    # 0xf4788
movq %rax, 0x18(%rsp)
jbe 0x8ea53
xorl %r14d, %r14d
xorpd %xmm0, %xmm0
cmpl %ebx, %r14d
jle 0x8ea1b
ucomisd 0x80(%rsp), %xmm0
jb 0x8ea23
incl 0x10(%rsp)
decl 0x18(%rsp)
jmp 0x8ea23
decl 0x10(%rsp)
incl 0x18(%rsp)
incl 0x14(%rsp)
incl 0x1c(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
movq %rbp, %rcx
callq 0x58300
incl %r14d
xorps %xmm0, %xmm0
cvtsi2sd %r14d, %xmm0
movapd 0x60(%rsp), %xmm1
ucomisd %xmm0, %xmm1
ja 0x8ea01
movq 0x20(%rsp), %rcx
leal 0x1(%rcx), %eax
testl %ecx, %ecx
movq %rax, 0x20(%rsp)
movq 0x58(%rsp), %r14
je 0x8e8a7
movq %r15, %rdi
callq 0x58780
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop