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

	switch (message)
	{
		case SP_PAINT:
			{
				Surface	*surface = GetDrawSurface();
				Point	 realPos = GetRealPosition();
				Rect	 frame	 = Rect(GetRealPosition(), GetRealSize());

				surface->Box(frame, Setup::BackgroundColor, Rect::Filled);
				surface->Frame(frame, FRAME_UP);

				for (Int i = 0; i < tabWidths.Length(); i++)
				{
					frame.right = (Int) Math::Min(frame.left + Math::Abs(Math::Round(tabWidths.GetNth(i) * surface->GetSurfaceDPI() / 96.0)), realPos.x + GetRealSize().cx);

					surface->Box(frame, Setup::BackgroundColor, Rect::Filled);
					surface->Frame(frame, FRAME_UP);

					Font	 nFont = font;

					if (!IsActive()) nFont.SetColor(Setup::InactiveTextColor);

					surface->SetText(tabNames.GetNth(i), frame + Point(3, Math::Ceil(Float(frame.GetHeight() - font.GetScaledTextSizeY()) / 2) - 1) - Size(5, 0), nFont);

					frame.left += (Int) Math::Abs(Math::Round(tabWidths.GetNth(i) * surface->GetSurfaceDPI() / 96.0));
				}
			}

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x88, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x85895
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
testl %ebp, %ebp
jne 0x85895
testb %al, %al
je 0x85895
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, 0x30(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %r13
shrq $0x20, %r13
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
leal (%rax,%r15), %ecx
shrq $0x20, %rax
movq %rsp, %r12
movl %r15d, (%r12)
movl %r13d, 0x4(%r12)
movl %ecx, 0x8(%r12)
addl %r13d, %eax
movl %eax, 0xc(%r12)
movq 0xe6982(%rip), %rax     # 0x16bfa8
movl (%rax), %ecx
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
movq 0xe5e95(%rip), %rdx     # 0x16b4d0
movq %r14, %rdi
movq %r12, %rsi
callq 0x57930
movq %r14, 0x10(%rsp)
movq %r14, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x57890
cmpl $0x0, 0x638(%rbx)
jle 0x85893
leaq 0x630(%rbx), %rax
movq %rax, 0x18(%rsp)
leaq 0x140(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x5d8(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x6e160(%rip), %r13     # 0xf37f0
xorl %r15d, %r15d
movslq (%rsp), %r12
movq 0x18(%rsp), %rdi
movl %r15d, %esi
callq 0x8661e
movl (%rax), %ebp
movq %rbx, %r14
movq 0x10(%rsp), %rbx
movq %rbx, %rdi
callq 0x58930
cwtl
imull %ebp, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x6dfef(%rip), %xmm0    # 0xf36b8
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
addsd (%r13,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %r13
sarq $0x3f, %r13
orq $0x1, %r13
testq %rax, %rax
cmoveq %rax, %r13
imulq %rax, %r13
addq %r12, %r13
movq (%r14), %rax
movq %r14, %rdi
callq *0x50(%rax)
addl 0x30(%rsp), %eax
cltq
cmpq %r13, %rax
cmovlq %rax, %r13
movl %r13d, 0x8(%rsp)
movq 0xe688b(%rip), %rax     # 0x16bfa8
movl (%rax), %ecx
movq $0x0, 0x48(%rsp)
movq %rbx, %rdi
movq %rsp, %r12
movq %r12, %rsi
movq 0xe5d98(%rip), %rdx     # 0x16b4d0
leaq 0x48(%rsp), %r8
callq 0x57930
movq %rbx, %rdi
movq %r14, %rbx
leaq 0x48(%rsp), %r14
movq %r12, %rsi
xorl %edx, %edx
callq 0x57890
movq %r14, %rdi
movq 0x20(%rsp), %rsi
callq 0x55b70
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x85783
movq %r14, %rdi
movq 0xe61d2(%rip), %rsi     # 0x16b950
callq 0x58650
movq 0x28(%rsp), %rdi
movl %r15d, %esi
callq 0x6b610
movq %rax, %r12
movl 0x4(%rsp), %r13d
movl 0xc(%rsp), %ebp
movq 0x20(%rsp), %rdi
movq 0xe6610(%rip), %rsi     # 0x16bdb8
callq 0x57680
addl %eax, %r13d
subl %r13d, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x6dbd6(%rip), %xmm0    # 0xf3398
callq 0x56cb0
decl %eax
movl (%rsp), %ecx
movl 0x8(%rsp), %edx
addl $0x3, %ecx
movl 0x4(%rsp), %esi
addl %eax, %esi
shlq $0x20, %rsi
addl 0xc(%rsp), %eax
shlq $0x20, %rax
addl $-0x2, %edx
orq %rsi, %rcx
orq %rax, %rdx
movq %rcx, 0x38(%rsp)
movq %rdx, 0x40(%rsp)
movq 0x10(%rsp), %rdi
movq %r12, %rsi
leaq 0x38(%rsp), %rdx
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x57b80
movq 0x18(%rsp), %rdi
movl %r15d, %esi
callq 0x8661e
movl (%rax), %ebp
movq 0x10(%rsp), %rdi
callq 0x58930
cwtl
imull %eax, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
movsd 0x6de7c(%rip), %xmm1    # 0xf36b8
divsd %xmm1, %xmm0
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x6df9c(%rip), %r13     # 0xf37f0
addsd (%r13,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %rcx
sarq $0x3f, %rcx
orl $0x1, %ecx
testq %rax, %rax
movl $0x0, %edx
cmovel %edx, %ecx
imull %ecx, %eax
addl %eax, (%rsp)
movq %r14, %rdi
callq 0x56720
incl %r15d
cmpl 0x638(%rbx), %r15d
jl 0x85693
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x858ad
jmp 0x858ad
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x56720
movq %rbx, %rdi
callq 0x57090