// File: /workspace/github_c_makefile_star2_O1/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, %r12d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x8f81b
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
xorl %r12d, %r12d
testb %al, %al
je 0x8f81b
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r13
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 0x8f252
movq %r13, %rax
shrq $0x20, %r13
movq %rax, 0x20(%rsp)
addl %eax, %r15d
cmpl $0x2, %ebp
je 0x8f1de
testl %ebp, %ebp
jne 0x8f81b
movq (%rsp), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x130(%rax)
leaq 0x28(%rsp), %rsi
movq %rax, (%rsi)
movq %rdx, 0x8(%rsi)
movq %r14, %rdi
callq 0x55160
cmpb $0x0, 0x5b8(%rbx)
jne 0x8f164
movq (%rsp), %rax
leaq 0x630(%rax), %rdi
callq 0x55600
movq %r14, %rdi
callq 0x58930
cwtl
shll $0x4, %eax
cvtsi2sd %eax, %xmm0
divsd 0x65374(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x65600(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leaq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rcx
movl %ecx, (%rsi)
movl %r13d, 0x4(%rsi)
movl %r15d, 0x8(%rsi)
addl %r13d, %eax
movl %eax, 0xc(%rsi)
movq 0x8(%rsp), %rdi
callq 0x578a0
testb %al, %al
je 0x8f277
movq 0xdd963(%rip), %rsi     # 0x16cb30
movq (%rsp), %r15
movq %r15, %rdi
movl $0x1, %edx
jmp 0x8f2a2
movq %r14, %rdi
callq 0x58930
cwtl
shll $0x4, %eax
cvtsi2sd %eax, %xmm0
divsd 0x652fa(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x65586(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
leaq 0x28(%rsp), %rsi
movq 0x20(%rsp), %rcx
movl %ecx, (%rsi)
movl %r13d, 0x4(%rsi)
movl %r15d, 0x8(%rsi)
addl %r13d, %eax
movl %eax, 0xc(%rsi)
movq 0x8(%rsp), %rdi
callq 0x578a0
testb %al, %al
je 0x8f81b
movq 0xdd8e9(%rip), %rsi     # 0x16cb30
movq (%rsp), %rdi
movl $0x1, %edx
jmp 0x8f26d
movq (%rsp), %rbx
leaq 0x140(%rbx), %rdi
callq 0x57550
xorl %r12d, %r12d
movq %rbx, %rdi
movq %rax, %rsi
xorl %edx, %edx
callq 0x58010
jmp 0x8f81b
movq (%rsp), %r15
cmpb $0x1, 0xcc(%r15)
jne 0x8f296
leaq 0x140(%r15), %rdi
callq 0x57550
movq %rax, %rsi
jmp 0x8f29d
movq 0xdd6b3(%rip), %rsi     # 0x16c950
movq %r15, %rdi
xorl %edx, %edx
callq 0x58010
cmpb $0x1, 0x5b8(%r15)
jne 0x8f813
movq %r13, 0x58(%rsp)
leaq 0x630(%r15), %r12
movb $0x0, 0x6fb(%r15)
movabsq $0x100000000c, %rax     # imm = 0x100000000C
leaq 0x28(%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, 0x40(%rsp)
shrq $0x20, %r13
subl %eax, %r13d
movq %r13, 0x38(%rsp)
movq $0x0, (%rbx)
cmpl $0x0, 0xc48(%r15)
movq %r15, %r12
jle 0x8f64b
leaq 0xc40(%r12), %rax
movq %rax, 0x60(%rsp)
xorl %ebp, %ebp
movq $0x0, 0x8(%rsp)
movq 0x60(%rsp), %rdi
movl %ebp, %esi
callq 0x5b0a4
movq (%rax), %rbx
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
shrq $0x20, %rax
movq %rbx, 0x48(%rsp)
movb $0x0, 0xcb(%rbx)
addl 0x8(%rsp), %eax
cmpl 0x40(%rsp), %eax
leaq 0x18(%rsp), %rbx
jl 0x8f5ce
movq 0x8(%rsp), %rax
cmpl 0x38(%rsp), %eax
jg 0x8f5ce
movq (%rsp), %r15
movl 0x6e0(%r15), %eax
movq 0x48(%rsp), %r12
movl 0xb4(%r12), %ecx
movl %eax, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movq (%r12), %rax
movq %r12, %rdi
leaq 0x28(%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 0x6534a(%rip), %rdx     # 0xf4790
xorpd %xmm4, %xmm4
movsd 0x6509e(%rip), %xmm3    # 0xf44f0
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 0x64f1a(%rip), %xmm5    # 0xf4390
andpd %xmm5, %xmm2
movsd 0x64f16(%rip), %xmm5    # 0xf4398
andnpd %xmm5, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
testq %rax, %rax
jle 0x8f5ce
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 0x64ec9(%rip), %xmm5    # 0xf4390
andpd %xmm5, %xmm2
movsd 0x64ec5(%rip), %xmm6    # 0xf4398
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 0xdd3d0(%rip), %rdx     # 0x16c950
callq 0x55120
addq $0x2, %r12
movq %r14, %rdi
callq 0x58930
movq %rbx, %rsi
xorpd %xmm2, %xmm2
movsd 0x64f50(%rip), %xmm1    # 0xf44f0
cwtl
leal (%rax,%rax,4), %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm2
seta %al
leaq 0x651d1(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
cmpq %rax, %r12
jl 0x8f56a
movq (%rsp), %r12
movl 0xc48(%r12), %eax
decl %eax
cmpl %eax, %ebp
jge 0x8f639
movl 0x2c(%rsp), %r15d
movq 0x48(%rsp), %rax
addl 0xb4(%rax), %r15d
movl %r15d, 0x2c(%rsp)
movq %r14, %rdi
callq 0x58930
xorpd %xmm2, %xmm2
movsd 0x64ee6(%rip), %xmm1    # 0xf44f0
cwtl
imull %r15d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd %xmm1, %xmm0
xorl %eax, %eax
ucomisd %xmm0, %xmm2
seta %al
leaq 0x65166(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x8(%rsp)
incl %ebp
cmpl 0xc48(%r12), %ebp
jl 0x8f36f
jmp 0x8f654
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 0x40(%rsp), %rax
movl %eax, %ebx
shrl $0x1f, %ebx
addl %eax, %ebx
andl $-0x2, %ebx
movq 0x38(%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 0x64e1f(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x650ab(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
addq %r12, %rax
cmpq %r13, %rax
movq 0x58(%rsp), %r12
jle 0x8f810
movswl %r15w, %eax
shll $0x4, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x64dda(%rip), %xmm6    # 0xf44f0
divsd %xmm6, %xmm0
movapd %xmm0, %xmm1
xorpd %xmm5, %xmm5
cmpltsd %xmm5, %xmm1
movsd 0x64c61(%rip), %xmm2    # 0xf4390
movapd %xmm1, %xmm3
andpd %xmm2, %xmm3
movsd 0x64c59(%rip), %xmm4    # 0xf4398
andnpd %xmm4, %xmm1
orpd %xmm3, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movzbl %bpl, %ecx
movq 0x20(%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 0xdd190(%rip), %rdx     # 0x16c950
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 0x64d09(%rip), %xmm0    # 0xf44f0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x64f95(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
addq %rbx, %rax
addq %rbp, %r12
cmpq %r13, %rax
jg 0x8f7ab
xorl %r12d, %r12d
movq %r14, %rdi
callq 0x58780
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop