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

	switch (message)
	{
		case SP_PAINT:
			{
				Surface	*surface    = GetDrawSurface();

				Rect	 frame	    = Rect(GetRealPosition(), GetRealSize());
				Int	 offset	    = 19 * surface->GetSurfaceDPI() / 96;

				Long	 lightColor = Color(Math::Min(Setup::BackgroundColor.GetRed() + 64, 255), Math::Min(Setup::BackgroundColor.GetGreen() + 64, 255), Math::Min(Setup::BackgroundColor.GetBlue() + 64, 255));
				Long	 darkColor  = Color(Math::Max(Setup::BackgroundColor.GetRed() - 64, 0), Math::Max(Setup::BackgroundColor.GetGreen() - 64, 0), Math::Max(Setup::BackgroundColor.GetBlue() - 64, 0));

				surface->Box(frame, Setup::BackgroundColor, Rect::Filled);
				surface->Frame(frame + Point(0, offset) - Size(0, offset), FRAME_UP);

				frame.right  = frame.left;
				frame.bottom = frame.top + offset;

				for (Int i = 0; i < GetNOfObjects(); i++)
				{
					Widget		*widget = GetNthObject(i);
					Widget		*prev	= (i > 0) ? GetNthObject(i - 1) : NIL;

					const Bitmap	&bitmap = bitmaps.Get(widget->GetHandle());
					Size		 sSize	= bitmap == NIL ? Size() : Size(bitmap.GetSize().cx / (bitmap.GetSize().cy / 15.0) , 15) * surface->GetSurfaceDPI() / 96;

					frame.left  = frame.right + 1;
					frame.right = frame.left + widget->GetScaledTextWidth() + sSize.cx + 6 + Int(widget->GetText() != NIL ? 6 : 0);

					if (widget->IsVisible())
					{
						frame.left--;
						frame.right++;
					}
					else
					{
						frame.top++;
					}

					if (prev != NIL && prev->IsVisible()) frame.left++;

					surface->Frame(frame + Size(1, 1), FRAME_UP);

					if (IsRightToLeft()) { frame.left++; frame.right++; }

					if (prev != NIL && prev->IsVisible())
					{
						surface->Line(Point(frame.left, frame.top + 1), Point(frame.left, frame.bottom), Setup::BackgroundColor); frame.left--;

						if (IsRightToLeft()) surface->SetPixel(Point(frame.left + 1, frame.top), lightColor);
					}
					else
					{
						surface->SetPixel(Point(frame.left, frame.top), Setup::BackgroundColor);
					}

					surface->SetPixel(Point(frame.right, frame.top), Setup::BackgroundColor);

					if (IsRightToLeft()) { frame.left--; frame.right--; }

					if (widget->IsVisible()) frame.bottom--;

					if (bitmap != NIL)
					{
						surface->BlitFromBitmap(bitmap, Rect(Point(0, 0), bitmap.GetSize()), Rect(Point(frame.left + 3 + (widget->IsVisible() ? 1 : 0), frame.top + 2), sSize));
					}

					surface->SetText(widget->GetText(), Rect(Point(frame.left + sSize.cx + 6 + (widget->IsVisible() ? 1 : 0), frame.top + Math::Ceil(Float(frame.GetHeight() - widget->GetFont().GetScaledTextSizeY()) / 2) - 1), Size(widget->GetScaledTextWidth() + sSize.cx, offset - 2)), widget->GetFont());

					if (widget->IsVisible())
					{
						frame.bottom++;

						surface->Line(Point(frame.left + 1, frame.bottom), Point(frame.right + (IsRightToLeft() ? 1 : 0), frame.bottom), Setup::BackgroundColor);
						surface->SetPixel(Point(frame.left + (IsRightToLeft() ? 1 : 0), frame.bottom), (IsRightToLeft() ? darkColor : lightColor));

						if (IsRightToLeft()) surface->SetPixel(Point(frame.right + 1, frame.bottom), lightColor);

						frame.right--;
					}
					else
					{
						if (prev != NIL && prev->IsVisible()) frame.left++;

						surface->Line(Point(frame.left, frame.bottom), Point(frame.right + (IsRightToLeft() ? 2 : 1), frame.bottom), lightColor);

						if (prev != NIL && prev->IsVisible()) frame.left--;

						frame.top--;
					}
				}
			}

			break;
	}

	return Widget::Paint(message);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xa8, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq (%rdi), %rax
callq *0x88(%rax)
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb %cl, %cl
je 0x7e676
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0x7e676
testl %ebx, %ebx
jne 0x7e66c
movl %ebx, 0x5c(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x40(%rax)
movq %rax, %rbx
movq (%r14), %rax
movq %r14, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %r15
shrq $0x20, %r15
movq (%r14), %rax
movq %r14, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
movq %rsp, %rdx
movl %r12d, (%rdx)
movl %r15d, 0x4(%rdx)
movl %ecx, 0x8(%rdx)
addl %r15d, %eax
movl %eax, 0xc(%rdx)
movq %rbx, %rdi
movq %rbx, %r12
callq 0x58930
cwtl
leal (%rax,%rax,8), %ecx
leal (%rax,%rcx,2), %eax
cltq
imulq $0x2aaaaaab, %rax, %rbx # imm = 0x2AAAAAAB
movq %rbx, %rax
shrq $0x3f, %rax
shrq $0x20, %rbx
sarl $0x4, %ebx
addl %eax, %ebx
movq 0xee67d(%rip), %rdx     # 0x16c4d0
movl 0x8(%rdx), %ebp
movl $0xff, %eax
movl %ebp, %r15d
andl %eax, %r15d
movl $0xbf, %r13d
cmpl %r13d, %r15d
movl $0xbf, %ecx
cmovll %r15d, %ecx
movl %ecx, 0x30(%rsp)
movl %ebp, %ecx
shrl $0x8, %ecx
andl %eax, %ecx
cmpl %r13d, %ecx
movl $0xbf, %esi
cmovll %ecx, %esi
movq %rsi, 0x38(%rsp)
shrl $0x10, %ebp
andl %eax, %ebp
cmpl %r13d, %ebp
cmovll %ebp, %r13d
cmpl $0x41, %r15d
movl $0x40, %eax
cmovll %eax, %r15d
cmpl $0x41, %ecx
cmovll %eax, %ecx
movq %rcx, 0x40(%rsp)
cmpl $0x41, %ebp
cmovll %eax, %ebp
movq 0xef0e9(%rip), %rax     # 0x16cfa8
movl (%rax), %ecx
leaq 0x10(%rsp), %r8
movq $0x0, (%r8)
movq %r12, %rdi
movq %rsp, %rsi
callq 0x57930
movq %rsp, %rdx
movl (%rdx), %eax
movl 0x4(%rdx), %ecx
addl %ebx, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq 0x8(%rdx), %rax
leaq 0x10(%rsp), %rdx
movq %rcx, (%rdx)
movq %rax, 0x8(%rdx)
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x57890
movq %rsp, %rcx
movl (%rcx), %eax
movl %eax, 0x8(%rcx)
movl 0x4(%rcx), %eax
movq %rbx, 0x48(%rsp)
addl %ebx, %eax
xorl %ebx, %ebx
movl %eax, 0xc(%rcx)
cmpl $0x0, 0x40(%r14)
jle 0x7e668
movl 0x30(%rsp), %ecx
addl $0x40, %ecx
shll $0x10, %r13d
addl $0x400000, %r13d        # imm = 0x400000
movq 0x38(%rsp), %rax
shll $0x8, %eax
addl $0x4000, %eax           # imm = 0x4000
orl %ecx, %eax
orl %r13d, %eax
movq %rax, 0x38(%rsp)
addl $-0x40, %r15d
shll $0x10, %ebp
addl $0xffc00000, %ebp       # imm = 0xFFC00000
movq 0x40(%rsp), %rax
shll $0x8, %eax
addl $0xffffc000, %eax       # imm = 0xFFFFC000
orl %r15d, %eax
orl %ebp, %eax
movq %rax, 0x40(%rsp)
leaq 0x38(%r14), %r15
leaq 0x5c0(%r14), %rax
movq %rax, 0x98(%rsp)
movq 0x48(%rsp), %rax
addl $-0x2, %eax
movq %rax, 0x48(%rsp)
movq %r14, 0x80(%rsp)
movq %r12, 0x88(%rsp)
movq %r15, 0x78(%rsp)
movq %r15, %rdi
movl %ebx, %esi
callq 0x5b0a4
movq (%rax), %r13
testl %ebx, %ebx
movq %rbx, 0xa0(%rsp)
je 0x7dfda
leal -0x1(%rbx), %esi
movq %r15, %rdi
callq 0x5b0a4
movq (%rax), %rax
movq %rax, 0x30(%rsp)
jmp 0x7dfe3
movq $0x0, 0x30(%rsp)
movl 0x8(%r13), %esi
movq 0x98(%rsp), %rdi
callq 0x7f230
movq %rax, %rbx
xorl %ebp, %ebp
movq %rax, %rdi
xorl %esi, %esi
callq 0x57e30
movl $0x0, %ecx
testb %al, %al
jne 0x7e12e
movq %rbx, %rdi
callq 0x58410
cvtsi2sdl (%rax), %xmm0
movapd %xmm0, 0x60(%rsp)
movq %rbx, %rdi
callq 0x58410
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rax), %xmm0
movsd 0x79136(%rip), %xmm1    # 0xf7170
divsd %xmm1, %xmm0
movapd 0x60(%rsp), %xmm1
divsd %xmm0, %xmm1
movapd %xmm1, 0x60(%rsp)
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
cvttpd2dq 0x60(%rsp), %xmm1
cvtdq2pd %xmm1, %xmm1
mulsd %xmm0, %xmm1
movapd %xmm1, %xmm2
xorpd %xmm4, %xmm4
cmpltsd %xmm4, %xmm2
movapd %xmm2, %xmm3
movsd 0x7630b(%rip), %xmm5    # 0xf4390
andpd %xmm5, %xmm3
movsd 0x76307(%rip), %xmm6    # 0xf4398
andnpd %xmm6, %xmm2
orpd %xmm3, %xmm2
addsd %xmm1, %xmm2
cvttsd2si %xmm2, %rax
mulsd 0x790c6(%rip), %xmm0    # 0xf7170
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm6, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rcx
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movsd 0x76415(%rip), %xmm3    # 0xf44f0
divsd %xmm3, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm6, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rbp
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
cvttsd2si %xmm1, %rcx
movq %rcx, 0x50(%rsp)
movl 0x8(%rsp), %r12d
leal 0x1(%r12), %eax
movl %eax, (%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0xf8(%rax)
movl %eax, %r15d
movq (%r13), %rax
movq %r13, %rdi
callq *0xa8(%rax)
movq %rax, %rdi
xorl %esi, %esi
callq 0x56bd0
movq %rbp, 0x60(%rsp)
leal (%r12,%rbp), %ecx
incl %ecx
leal (%rcx,%r15), %edx
testb %al, %al
leal 0x6(%r15,%rcx), %eax
cmovel %edx, %eax
addl $0x6, %eax
movl %eax, 0x8(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
leaq 0x4(%rsp), %rcx
testb %al, %al
je 0x7e1a5
decl (%rsp)
leaq 0x8(%rsp), %rcx
incl (%rcx)
cmpq $0x0, 0x30(%rsp)
movq 0x88(%rsp), %r12
movq 0xee314(%rip), %r15     # 0x16c4d0
je 0x7e1d3
movq 0x30(%rsp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb %al, %al
je 0x7e1d3
incl (%rsp)
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
incl %eax
incl %ecx
movq (%rsp), %rdx
shlq $0x20, %rcx
orq %rcx, %rax
movq %rdx, 0x10(%rsp)
movq %rax, 0x18(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
xorl %edx, %edx
callq 0x57890
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7e21a
incl (%rsp)
incl 0x8(%rsp)
movq 0x30(%rsp), %rdi
testq %rdi, %rdi
je 0x7e2ac
movq (%rdi), %rax
callq *0x90(%rax)
testb %al, %al
je 0x7e2ac
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
incl %ecx
movl %eax, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movl 0xc(%rsp), %ecx
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
leaq 0x20(%rsp), %rdx
movq %r15, %rcx
callq 0x58300
decl (%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7e2c5
movl (%rsp), %eax
movl 0x4(%rsp), %ecx
incl %eax
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
jmp 0x7e2c0
movq (%rsp), %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x55120
movq 0x4(%rsp), %rax
rolq $0x20, %rax
movq %rax, 0x10(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %rsi
movq %r15, %rdx
callq 0x55120
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7e2fa
decl (%rsp)
decl 0x8(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7e30f
decl 0xc(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x563f0
testb %al, %al
movq 0x60(%rsp), %r14
je 0x7e399
movq %rbx, %rdi
callq 0x58410
movq $0x0, 0x10(%rsp)
movl (%rax), %ecx
movl %ecx, 0x18(%rsp)
movl 0x4(%rax), %eax
movl %eax, 0x1c(%rsp)
movl (%rsp), %r15d
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
movzbl %al, %eax
movl %r15d, %ecx
addl %eax, %ecx
addl %r15d, %eax
addl $0x3, %eax
movl 0x4(%rsp), %edx
leal 0x2(%rdx), %esi
movl %eax, 0x20(%rsp)
movl %esi, 0x24(%rsp)
leal 0x3(%r14,%rcx), %eax
movl %eax, 0x28(%rsp)
movq 0x50(%rsp), %rax
leal 0x2(%rdx,%rax), %eax
movl %eax, 0x2c(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x10(%rsp), %rdx
leaq 0x20(%rsp), %rcx
callq 0x55ba0
movq (%r13), %rax
movq %r13, %rdi
callq *0xa8(%rax)
movq %rax, 0x50(%rsp)
movq (%r13), %rax
movl (%rsp), %r12d
addl %r14d, %r12d
movq %r13, %rdi
callq *0x90(%rax)
movzbl %al, %eax
movl %r12d, %r15d
addl %eax, %r15d
addl %eax, %r12d
addl $0x6, %r12d
movl 0x4(%rsp), %ebp
movl 0xc(%rsp), %r14d
movq (%r13), %rax
movq %r13, %rdi
callq *0xe8(%rax)
movq %rax, %rdi
movq 0xee9c9(%rip), %rsi     # 0x16cdb8
callq 0x57680
addl %ebp, %eax
subl %eax, %r14d
cvtsi2sd %r14d, %xmm0
mulsd 0x75f92(%rip), %xmm0    # 0xf4398
callq 0x56cb0
movl %ebp, %r14d
addl %eax, %r14d
addl %eax, %ebp
decl %ebp
movq (%r13), %rax
movq %r13, %rdi
callq *0xf8(%rax)
movl %r12d, 0x10(%rsp)
movq 0x88(%rsp), %r12
movl %ebp, 0x14(%rsp)
leaq 0x10(%rsp), %rbx
movq 0x60(%rsp), %rcx
addl %r15d, %ecx
addl $0x6, %ecx
addl %eax, %ecx
movl %ecx, 0x18(%rsp)
movq 0x48(%rsp), %rax
addl %r14d, %eax
decl %eax
movl %eax, 0x1c(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0xe8(%rax)
movq %r12, %rdi
movq 0x50(%rsp), %rsi
movq %rbx, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x57b80
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7e5a0
movl 0xc(%rsp), %eax
incl %eax
movl %eax, 0xc(%rsp)
movl (%rsp), %ecx
movl 0x8(%rsp), %ebx
incl %ecx
movl %ecx, 0x10(%rsp)
movl %eax, 0x14(%rsp)
movq 0x80(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
movl 0xc(%rsp), %ecx
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq %r12, %rdi
leaq 0x10(%rsp), %r13
movq %r13, %rsi
leaq 0x20(%rsp), %r15
movq %r15, %rdx
movq 0xedfe7(%rip), %rcx     # 0x16c4d0
callq 0x58300
movl (%rsp), %ebx
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
movl 0xc(%rsp), %ecx
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
movq 0x38(%rsp), %rax
cmovneq 0x40(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x55120
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
leaq 0x8(%rsp), %rcx
testb %al, %al
movq 0x78(%rsp), %r15
je 0x7e652
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
incl %eax
movl %eax, 0x20(%rsp)
movl %ecx, 0x24(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x10(%rsp), %rdx
callq 0x55120
leaq 0x8(%rsp), %rcx
jmp 0x7e652
movq 0x30(%rsp), %r13
testq %r13, %r13
movq 0x80(%rsp), %r14
movq 0x78(%rsp), %r15
je 0x7e5cb
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7e5cb
incl (%rsp)
movl 0xc(%rsp), %eax
movl (%rsp), %ecx
movl 0x8(%rsp), %ebx
movl %ecx, 0x20(%rsp)
movl %eax, 0x24(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
incl %eax
movl 0xc(%rsp), %ecx
movl %eax, 0x90(%rsp)
movl %ecx, 0x94(%rsp)
movq 0x38(%rsp), %rax
movq %rax, 0x18(%rsp)
movl $0x0, 0x10(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x90(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x58300
leaq 0x4(%rsp), %rcx
testq %r13, %r13
je 0x7e652
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
leaq 0x4(%rsp), %rcx
testb %al, %al
je 0x7e652
decl (%rsp)
decl (%rcx)
movq 0xa0(%rsp), %rbx
incl %ebx
cmpl 0x40(%r14), %ebx
jl 0x7dfac
movl 0x5c(%rsp), %ebx
movq %r14, %rdi
movl %ebx, %esi
callq 0x567d0
addq $0xa8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq