// File: /workspace/github_c_makefile_star2_O2/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, 0x4(%rsp)
movq %rdi, %r13
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x8b45e
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
testb %al, %al
je 0x8b46d
movq (%r13), %rax
movq %r13, %rdi
callq *0x40(%rax)
movq %rax, %r15
movq (%r13), %rax
movq %r13, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r13), %rax
movq %r13, %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 0x56160
movq %r13, %rdi
movl 0x4(%rsp), %ebx
movl %ebx, %esi
callq 0x58b20
cmpl $0x3, %ebx
ja 0x8b463
cmpl $0x1, 0x4(%rsp)
je 0x8b463
movq 0x5e0(%r13), %rax
movl (%rax), %eax
cmpl 0x5e8(%r13), %eax
jne 0x8b463
movq %r15, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm2
divsd 0x58303(%rip), %xmm2    # 0xe3510
cvttsd2si %xmm2, %ebx
leal (%rbx,%rbx), %eax
cvtsi2sd %eax, %xmm0
movsd 0x5ada8(%rip), %xmm3    # 0xe5fc8
mulsd %xmm2, %xmm3
movapd %xmm3, %xmm1
subsd %xmm0, %xmm1
addsd 0x5ad8c(%rip), %xmm1    # 0xe5fc0
cvttsd2si %xmm1, %eax
movl %eax, 0x28(%rsp)
movapd %xmm2, 0x80(%rsp)
cvttpd2dq %xmm2, %xmm0
cvtdq2pd %xmm0, %xmm0
leal 0x2(%rbx), %eax
movl %eax, 0x24(%rsp)
movsd %xmm3, 0x68(%rsp)
subsd %xmm0, %xmm3
movsd %xmm3, 0x60(%rsp)
xorl %eax, %eax
movq 0xd677b(%rip), %rcx     # 0x1619e8
addq $0x8, %rcx
movq %rcx, 0x50(%rsp)
movq 0xd66d3(%rip), %rcx     # 0x161950
addq $0x8, %rcx
movq %rcx, 0x48(%rsp)
leaq 0x8(%rsp), %r12
leaq 0x30(%rsp), %rbp
movq %r13, 0x58(%rsp)
cmpl $0x2, %eax
je 0x8b463
movl %eax, 0x14(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
testb %al, %al
movq 0x48(%rsp), %rax
cmovneq 0x50(%rsp), %rax
movq (%rax), %rax
movq 0xd668a(%rip), %rcx     # 0x161950
cmovneq 0xd671a(%rip), %rcx     # 0x1619e8
movq %rax, 0x38(%rsp)
movl (%rcx), %eax
movl %eax, 0x30(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
cmpl $0x2, 0x4(%rsp)
jne 0x8b2fe
movq 0xd683c(%rip), %rcx     # 0x161b30
movupd (%rcx), %xmm0
movapd %xmm0, 0x30(%rsp)
xorl %r14d, %r14d
cmpl $0x0, 0x14(%rsp)
je 0x8b313
movzbl %al, %r13d
xorl %eax, %eax
jmp 0x8b3a8
movl 0x38(%rsp), %ecx
movl %ecx, %eax
movl $0xff, %esi
andl %esi, %eax
cvtsi2sd %eax, %xmm0
xorl %esi, %eax
cvtsi2sd %eax, %xmm1
movsd 0x5b7de(%rip), %xmm2    # 0xe6b10
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
movl %ecx, %edx
shrl $0x8, %edx
andl %esi, %edx
cvtsi2sd %edx, %xmm0
xorl %esi, %edx
cvtsi2sd %edx, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %edx
shrl $0x10, %ecx
andl %esi, %ecx
cvtsi2sd %ecx, %xmm0
xorl %esi, %ecx
cvtsi2sd %ecx, %xmm1
mulsd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %ecx
shll $0x10, %ecx
shll $0x8, %edx
orl %eax, %edx
andl $0x0, 0x30(%rsp)
orl %ecx, %edx
movslq %edx, %rax
movq %rax, 0x38(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %r13d
negl %r13d
orl $0x1, %r13d
pushq $0x1
popq %rax
addl 0x74(%rsp), %eax
movl %eax, 0x2c(%rsp)
addl 0x24(%rsp), %r13d
addl 0x70(%rsp), %r13d
movabsq $0x400000004, %rax      # imm = 0x400000004
movq %rax, 0x8(%rsp)
movq %r12, %rdi
movaps 0x80(%rsp), %xmm0
callq 0x570c0
leal (%rax,%r13), %ecx
shrq $0x20, %rax
addl 0x2c(%rsp), %eax
shlq $0x20, %rax
leaq (%rcx,%rax), %rdx
movq %rdx, 0x18(%rsp)
addl 0x28(%rsp), %ecx
orq %rax, %rcx
movq %rcx, 0x8(%rsp)
movq 0x58(%rsp), %r13
cvtsi2sd %r14d, %xmm0
movsd 0x68(%rsp), %xmm1
ucomisd %xmm0, %xmm1
jbe 0x8b453
cmpl %ebx, %r14d
jle 0x8b42b
ucomisd 0x60(%rsp), %xmm0
jb 0x8b433
incl 0x18(%rsp)
decl 0x8(%rsp)
jmp 0x8b433
decl 0x18(%rsp)
incl 0x8(%rsp)
incl 0x1c(%rsp)
incl 0xc(%rsp)
movq %r15, %rdi
leaq 0x18(%rsp), %rsi
movq %r12, %rdx
movq %rbp, %rcx
callq 0x595b0
incl %r14d
jmp 0x8b403
movl 0x14(%rsp), %eax
incl %eax
jmp 0x8b295
pushq $-0x1
popq %rcx
jmp 0x8b46d
movq %r15, %rdi
callq 0x59a80
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop