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

	Surface	*surface = GetDrawSurface();
	Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());
	Window	*window	 = container->GetContainerWindow();

	CalculateHeight();

	switch (message)
	{
		case SP_PAINT:
			surface->StartPaint(GetVisibleArea());

			if (!IsMarked()) list.Hide();

			if (window->IsMouseOn(Rect(Point(frame.left, frame.top), Size(frame.GetWidth(),  Math::Round(16 * surface->GetSurfaceDPI() / 96.0))))) PaintText(Setup::GradientTextColor, True);
			else																       PaintText(active ? font.GetColor() : Setup::InactiveTextColor, False);

			if (IsMarked())
			{
				list.SetVisibleDirect(False);
				list.SetMetrics(Point(12, 16), GetSize() - Size(12, 15));

				Rect	 visibleArea	   = list.GetVisibleArea() - list.GetRealPosition();

				Point	 entryPosition	   = Point(0, 0);
				Point	 entryRealPosition = Point(0, 0);

				for (Int i = 0; i < Length(); i++)
				{
					ListEntry	*entry	       = GetNthEntry(i);
					Size		 entryRealSize = entry->GetRealSize();

					entry->SetVisibleDirect(False);

					if (entryRealPosition.y + entryRealSize.cy >= visibleArea.top && entryRealPosition.y <= visibleArea.bottom)
					{
						entry->SetMetrics(entryPosition, Size(list.GetWidth(), entry->GetHeight()));
						entry->SetVisibleDirect(True);

						/* Draw horizontal branch line.
						 */
						Point	 startPos = GetRealPosition() + Point(Math::Round(6 * surface->GetSurfaceDPI() / 96.0) + (IsRightToLeft() ? 1 : 0), entryRealPosition.y + Math::Round(8 * surface->GetSurfaceDPI() / 96.0) + Math::Round(16 * surface->GetSurfaceDPI() / 96.0));

						for (Int x = 0; x < Math::Round(5 * surface->GetSurfaceDPI() / 96.0); x += 2)
						{
							surface->SetPixel(startPos + Point(x, 0), Setup::InactiveTextColor);
						}
					}

					/* Compute next entry position.
					 */
					if (i < Length() - 1)
					{
						entryPosition.y	    += entry->GetHeight();
						entryRealPosition.y  = Math::Round(entryPosition.y * surface->GetSurfaceDPI() / 96.0);
					}
				}

				list.SetVisibleDirect(True);
				list.Paint(SP_PAINT);

				/* Draw vertical dotted line.
				 */
				Point	 startPos = frame.GetPosition() + Point(Math::Round(6 * surface->GetSurfaceDPI() / 96.0) + (IsRightToLeft() ? 1 : 0), Math::Round(16 * surface->GetSurfaceDPI() / 96.0));

				for (Int i = visibleArea.top - visibleArea.top % 2; i < Math::Min(entryRealPosition.y, visibleArea.bottom) + Math::Round(9 * surface->GetSurfaceDPI() / 96.0); i += 2)
				{
					surface->SetPixel(startPos + Point(0, i), Setup::InactiveTextColor);
				}
			}

			surface->EndPaint();

			break;
		case SP_MOUSEIN:
			if (window->IsMouseOn(Rect(Point(frame.left, frame.top), Size(frame.GetWidth(), Math::Round(16 * surface->GetSurfaceDPI() / 96.0))))) PaintText(Setup::GradientTextColor, True);

			break;
		case SP_MOUSEOUT:
			PaintText(font.GetColor(), False);

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %r13d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x8f29a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
xorl %r13d, %r13d
testb %al, %al
je 0x8f29a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
movq %rax, %r15
movq 0x190(%rbx), %rdi
callq 0x559e0
movq %rax, 0x8(%rsp)
movq %rbx, (%rsp)
movq %rbx, %rdi
callq 0x58830
cmpl $0x3, %ebp
je 0x8ecc9
addl %r12d, %r15d
cmpl $0x2, %ebp
je 0x8ec53
testl %ebp, %ebp
jne 0x8f29a
movq (%rsp), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x130(%rax)
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r14, %rdi
callq 0x55160
cmpb $0x0, 0x5b8(%rbx)
jne 0x8ebd8
movq (%rsp), %rax
leaq 0x630(%rax), %rdi
callq 0x55600
movq %r12, %rbp
shrq $0x20, %rbp
movq %r14, %rdi
callq 0x58930
cwtl
shll $0x4, %eax
cvtsi2sd %eax, %xmm0
divsd 0x64ac1(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x64be5(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leaq 0x20(%rsp), %rsi
movl %r12d, (%rsi)
movl %ebp, 0x4(%rsi)
movl %r15d, 0x8(%rsi)
addl %ebp, %eax
movl %eax, 0xc(%rsi)
movq 0x8(%rsp), %rdi
callq 0x578a0
testb %al, %al
je 0x8ecee
movq 0xdceee(%rip), %rsi     # 0x16bb30
movq (%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
jmp 0x8ed19
movq %r12, %rbp
shrq $0x20, %r12
movq %r14, %rdi
callq 0x58930
cwtl
shll $0x4, %eax
cvtsi2sd %eax, %xmm0
divsd 0x64a46(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x64b6a(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leaq 0x20(%rsp), %rsi
movl %ebp, (%rsi)
movl %r12d, 0x4(%rsi)
movl %r15d, 0x8(%rsi)
addl %r12d, %eax
movl %eax, 0xc(%rsi)
movq 0x8(%rsp), %rdi
callq 0x578a0
testb %al, %al
je 0x8f29a
movq 0xdce72(%rip), %rsi     # 0x16bb30
movq (%rsp), %rdi
movl $0x1, %edx
jmp 0x8ece4
movq (%rsp), %rbx
leaq 0x140(%rbx), %rdi
callq 0x57550
xorl %r13d, %r13d
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x58010
jmp 0x8f29a
movq (%rsp), %r15
cmpb $0x1, 0xcc(%r15)
jne 0x8ed0d
leaq 0x140(%r15), %rdi
callq 0x57550
movq %rax, %rsi
jmp 0x8ed14
movq 0xdcc3c(%rip), %rsi     # 0x16b950
movq %r15, %rdi
xorl %edx, %edx
callq 0x58010
cmpb $0x1, 0x5b8(%r15)
jne 0x8f292
movq %rbp, 0x58(%rsp)
movq %r12, 0x48(%rsp)
leaq 0x630(%r15), %r12
movb $0x0, 0x6fb(%r15)
movabsq $0x100000000c, %rax     # imm = 0x100000000C
leaq 0x20(%rsp), %rbx
movq %rax, (%rbx)
movl 0xb0(%r15), %eax
movl 0xb4(%r15), %ecx
addl $-0xc, %eax
addl $-0xf, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
movq %r12, %rdi
movq %rbx, %rsi
callq 0x57080
movq %r12, %rdi
callq 0x59090
movq %rax, %rbp
movq %rdx, %r13
movq %r12, 0x50(%rsp)
movq %r12, %rdi
callq 0x57400
shrq $0x20, %rax
shrq $0x20, %rbp
subl %eax, %ebp
movq %rbp, 0x38(%rsp)
shrq $0x20, %r13
subl %eax, %r13d
movq %r13, 0x30(%rsp)
movq $0x0, (%rbx)
cmpl $0x0, 0xc48(%r15)
movq %r15, %r12
jle 0x8f0ca
leaq 0xc40(%r12), %rax
movq %rax, 0x60(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq 0x60(%rsp), %rdi
movl %ebp, %esi
callq 0x5b074
movq (%rax), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
shrq $0x20, %rax
movq %rbx, 0x40(%rsp)
movb $0x0, 0xcb(%rbx)
addl 0x8(%rsp), %eax
cmpl 0x38(%rsp), %eax
leaq 0x18(%rsp), %rbx
jl 0x8f04a
movq 0x8(%rsp), %rax
cmpl 0x30(%rsp), %eax
jg 0x8f04a
movq (%rsp), %r15
movl 0x6e0(%r15), %eax
movq 0x40(%rsp), %r12
movl 0xb4(%r12), %ecx
movl %eax, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movq (%r12), %rax
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
movq %rbx, %rdx
callq *0x150(%rax)
movb $0x1, 0xcb(%r12)
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %r14, %rdi
callq 0x58930
movl %eax, %r13d
movq (%r15), %rax
movq %r15, %rdi
callq *0x160(%rax)
movl %eax, %r15d
movq %r14, %rdi
callq 0x58930
movw %ax, 0x14(%rsp)
movq %r14, %rdi
callq 0x58930
movw %ax, 0x16(%rsp)
movq %r14, %rdi
callq 0x58930
leaq 0x6492e(%rip), %rdx     # 0xf37f0
xorpd %xmm4, %xmm4
movsd 0x647ea(%rip), %xmm3    # 0xf36b8
cwtl
leal (%rax,%rax,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm3, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
movsd 0x6449e(%rip), %xmm5    # 0xf3390
andpd %xmm5, %xmm2
movsd 0x6449a(%rip), %xmm5    # 0xf3398
andnpd %xmm5, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
testq %rax, %rax
jle 0x8f04a
movq %rbx, %rsi
movswl 0x14(%rsp), %eax
shll $0x3, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm3, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
movsd 0x6444d(%rip), %xmm5    # 0xf3390
andpd %xmm5, %xmm2
movsd 0x64449(%rip), %xmm6    # 0xf3398
andnpd %xmm6, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movswl 0x16(%rsp), %ecx
shll $0x4, %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm3, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm6, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
movl %r13d, %ecx
cvttsd2si %xmm1, %r13
addl 0x8(%rsp), %eax
addl %eax, %r13d
shlq $0x20, %r13
addq %r12, %r13
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
andq %rax, %r13
movzbl %r15b, %eax
addq %r12, %rax
movswl %cx, %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm3, %xmm0
xorl %ecx, %ecx
ucomisd %xmm0, %xmm4
seta %cl
addsd (%rdx,%rcx,8), %xmm0
cvttsd2si %xmm0, %r15
addq %rax, %r15
xorl %r12d, %r12d
leal (%r15,%r12), %eax
orq %r13, %rax
movq %rax, 0x18(%rsp)
movq %r14, %rdi
movq 0xdc954(%rip), %rdx     # 0x16b950
callq 0x55120
addq $0x2, %r12
movq %r14, %rdi
callq 0x58930
movq %rbx, %rsi
xorpd %xmm2, %xmm2
movsd 0x6469c(%rip), %xmm1    # 0xf36b8
cwtl
leal (%rax,%rax,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm2
seta %al
leaq 0x647b5(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
cmpq %rax, %r12
jl 0x8efe6
movq (%rsp), %r12
movl 0xc48(%r12), %eax
leal -0x1(%rax), %ecx
cmpl %ecx, %ebp
jge 0x8f0be
movl 0x24(%rsp), %r15d
movq 0x40(%rsp), %rax
addl 0xb4(%rax), %r15d
movl %r15d, 0x24(%rsp)
movq %r14, %rdi
callq 0x58930
xorpd %xmm2, %xmm2
movsd 0x64631(%rip), %xmm1    # 0xf36b8
cwtl
imull %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm2
seta %al
leaq 0x64749(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x8(%rsp)
movl 0xc48(%r12), %eax
incl %ebp
cmpl %eax, %ebp
jl 0x8edeb
jmp 0x8f0d3
movq $0x0, 0x8(%rsp)
movb $0x1, 0x6fb(%r12)
movq 0x50(%rsp), %rdi
xorl %esi, %esi
callq 0x567d0
movq %r14, %rdi
callq 0x58930
movw %ax, (%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movl %eax, %ebp
movq %r14, %rdi
callq 0x58930
movl %eax, %r15d
movq 0x38(%rsp), %rax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
andl $-0x2, %ebx
movq 0x30(%rsp), %rax
movq 0x8(%rsp), %rcx
cmpl %eax, %ecx
cmovll %ecx, %eax
movslq %eax, %r12
movslq %ebx, %r13
movq %r14, %rdi
callq 0x58930
movq %r12, %rsi
cwtl
leal (%rax,%rax,8), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x64568(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x6468c(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
addq %r12, %rax
cmpq %r13, %rax
movq 0x58(%rsp), %r12
jle 0x8f28f
movswl %r15w, %eax
shll $0x4, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x64523(%rip), %xmm6    # 0xf36b8
divsd %xmm6, %xmm0
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movsd 0x641e2(%rip), %xmm2    # 0xf3390
movapd %xmm1, %xmm3
andpd %xmm2, %xmm3
movsd 0x641da(%rip), %xmm4    # 0xf3398
andnpd %xmm4, %xmm1
orpd %xmm3, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movzbl %bpl, %ecx
movq 0x48(%rsp), %rdx
addl %ecx, %edx
movswl (%rsp), %ecx
addl %ecx, %ecx
leal (%rcx,%rcx,2), %ecx
xorps %xmm0, %xmm0
cvtsi2sd %ecx, %xmm0
divsd %xmm6, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm5, %xmm1
andpd %xmm1, %xmm2
andnpd %xmm4, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
addl %edx, %ecx
addl %ebx, %r12d
addl %eax, %r12d
shlq $0x20, %r12
orq %rcx, %r12
leaq 0x18(%rsp), %r15
movabsq $0x200000000, %rbp      # imm = 0x200000000
movq %r12, 0x18(%rsp)
movq %r14, %rdi
movq %rsi, %rbx
movq %r15, %rsi
movq 0xdc711(%rip), %rdx     # 0x16b950
callq 0x55120
addq $0x2, %r13
movq %r14, %rdi
callq 0x58930
movq %rbx, %rsi
cwtl
leal (%rax,%rax,8), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x64452(%rip), %xmm0    # 0xf36b8
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x64576(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
addq %rbx, %rax
addq %rbp, %r12
cmpq %r13, %rax
jg 0x8f22a
xorl %r13d, %r13d
movq %r14, %rdi
callq 0x58780
movl %r13d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq