// File: /workspace/github_c_makefile_star2_O2/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 $0x98, %rsp
movl %esi, %ebp
movq %rdi, %rbx
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x83423
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
movl %eax, %ecx
xorl %eax, %eax
testl %ebp, %ebp
jne 0x8342a
testb %cl, %cl
je 0x8342a
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, 0x40(%rsp)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %r12
shrq $0x20, %r12
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
leal (%rax,%r15), %ecx
shrq $0x20, %rax
leaq 0x10(%rsp), %r13
movl %r15d, (%r13)
movl %r12d, 0x4(%r13)
movl %ecx, 0x8(%r13)
addl %r12d, %eax
movl %eax, 0xc(%r13)
movq 0xdede6(%rip), %rax     # 0x161fa8
movl (%rax), %ecx
leaq 0x58(%rsp), %r15
andq $0x0, (%r15)
movq 0xde2fc(%rip), %rdx     # 0x1614d0
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %r8
callq 0x58b80
movq %r14, 0x8(%rsp)
movq %r14, %rdi
movq %r13, %rsi
movq %r15, %r13
xorl %edx, %edx
callq 0x58ad0
leaq 0x630(%rbx), %rax
movq %rax, 0x20(%rsp)
leaq 0x140(%rbx), %rax
movq %rax, 0x28(%rsp)
leaq 0x5d8(%rbx), %rax
movq %rax, 0x38(%rsp)
xorl %r12d, %r12d
cmpl 0x638(%rbx), %r12d
jge 0x83428
movslq 0x10(%rsp), %rbp
movq 0x20(%rsp), %rdi
movl %r12d, %esi
callq 0x840de
movl (%rax), %r15d
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x59c60
cwtl
imull %r15d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x602b2(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x606fe(%rip), %rcx     # 0xe3970
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, %r15
sarq $0x3f, %r15
orq $0x1, %r15
testq %rax, %rax
cmoveq %rax, %r15
imulq %rax, %r15
addq %rbp, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
addl 0x40(%rsp), %eax
cltq
cmpq %r15, %rax
cmovlq %rax, %r15
movl %r15d, 0x18(%rsp)
movq 0xdecf1(%rip), %rax     # 0x161fa8
movl (%rax), %ecx
andq $0x0, 0x58(%rsp)
movq %r14, %rdi
leaq 0x10(%rsp), %r15
movq %r15, %rsi
movq 0xde1ff(%rip), %rdx     # 0x1614d0
movq %r13, %r8
callq 0x58b80
movq %r14, %rdi
movq %r15, %rsi
xorl %edx, %edx
callq 0x58ad0
movq %r13, %rdi
movq 0x28(%rsp), %rsi
callq 0x56bf0
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x83312
movq %r13, %rdi
movq 0xde643(%rip), %rsi     # 0x161950
callq 0x59940
movq 0x38(%rsp), %rdi
movl %r12d, %esi
callq 0x6bb28
movq %rax, %rbp
movq %r13, %r14
movl 0x14(%rsp), %r15d
movl 0x1c(%rsp), %r13d
movq 0x28(%rsp), %rdi
movq 0xdea7d(%rip), %rsi     # 0x161db8
callq 0x588a0
addl %eax, %r15d
subl %r15d, %r13d
cvtsi2sd %r13d, %xmm0
mulsd 0x6002d(%rip), %xmm0    # 0xe3380
callq 0x57e30
decl %eax
movl $0x3, 0x30(%rsp)
movl %eax, 0x34(%rsp)
leaq 0x10(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x58930
movq %rdx, %rcx
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
andq %rsi, %rcx
addl $-0x5, %edx
orq %rcx, %rdx
movq %rax, 0x48(%rsp)
movq %rdx, 0x50(%rsp)
movq 0x8(%rsp), %rdi
movq %rbp, %rsi
leaq 0x48(%rsp), %rdx
movq %r14, %r13
movq %r14, %rcx
xorl %r8d, %r8d
callq 0x58df0
movq 0x20(%rsp), %rdi
movl %r12d, %esi
callq 0x840de
movl (%rax), %ebp
movq 0x8(%rsp), %rdi
callq 0x59c60
cwtl
imull %eax, %ebp
cvtsi2sd %ebp, %xmm0
divsd 0x60137(%rip), %xmm0    # 0xe3510
xorl %eax, %eax
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta %al
leaq 0x60583(%rip), %rcx     # 0xe3970
addsd (%rcx,%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, 0x10(%rsp)
movq %r13, %rdi
callq 0x57860
incl %r12d
jmp 0x8321e
pushq $-0x1
popq %rax
jmp 0x8342a
xorl %eax, %eax
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x83440
jmp 0x83440
movq %rax, %rbx
leaq 0x58(%rsp), %rdi
callq 0x57860
movq %rbx, %rdi
callq 0x58260
nop