// File: /workspace/github_c_makefile_star2_O3/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 0x7e299
movq (%r14), %rax
movq %r14, %rdi
callq *0x90(%rax)
movl %eax, %ecx
xorl %eax, %eax
testb %cl, %cl
je 0x7e299
testl %ebx, %ebx
jne 0x7e28f
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
leaq 0x8(%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 0xeda4f(%rip), %rdx     # 0x16b4d0
movl 0x8(%rdx), %ebp
movl $0xff, %eax
movl %ebp, %r15d
andl %eax, %r15d
movl $0xbf, %r13d
cmpl %r13d, %r15d
movl $0xbf, %ecx
cmovbl %r15d, %ecx
movl %ecx, 0x38(%rsp)
movl %ebp, %ecx
shrl $0x8, %ecx
andl %eax, %ecx
cmpl %r13d, %ecx
movl $0xbf, %esi
cmovbl %ecx, %esi
movq %rsi, 0x40(%rsp)
shrl $0x10, %ebp
andl %eax, %ebp
cmpl %r13d, %ebp
cmovbl %ebp, %r13d
cmpl $0x41, %r15d
movl $0x40, %eax
cmovbl %eax, %r15d
cmpl $0x41, %ecx
cmovbl %eax, %ecx
movq %rcx, 0x48(%rsp)
cmpl $0x41, %ebp
cmovbl %eax, %ebp
movq 0xee4bb(%rip), %rax     # 0x16bfa8
movl (%rax), %ecx
leaq 0x18(%rsp), %r8
movq $0x0, (%r8)
movq %r12, %rdi
leaq 0x8(%rsp), %rsi
callq 0x57930
leaq 0x8(%rsp), %rdx
movl (%rdx), %eax
movl 0x4(%rdx), %ecx
addl %ebx, %ecx
shlq $0x20, %rcx
orq %rax, %rcx
movq 0x8(%rdx), %rax
leaq 0x18(%rsp), %rdx
movq %rcx, (%rdx)
movq %rax, 0x8(%rdx)
leaq 0x18(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x57890
leaq 0x8(%rsp), %rcx
movl (%rcx), %eax
movl %eax, 0x8(%rcx)
movl 0x4(%rcx), %eax
movq %rbx, 0x50(%rsp)
addl %ebx, %eax
xorl %ebx, %ebx
movl %eax, 0xc(%rcx)
cmpl $0x0, 0x40(%r14)
jle 0x7e28b
movl 0x38(%rsp), %ecx
addl $0x40, %ecx
shll $0x10, %r13d
addl $0x400000, %r13d        # imm = 0x400000
movq 0x40(%rsp), %rax
shll $0x8, %eax
addl $0x4000, %eax           # imm = 0x4000
orl %ecx, %eax
orl %r13d, %eax
movq %rax, 0x40(%rsp)
addl $-0x40, %r15d
shll $0x10, %ebp
addl $0xffc00000, %ebp       # imm = 0xFFC00000
movq 0x48(%rsp), %rax
shll $0x8, %eax
addl $0xffffc000, %eax       # imm = 0xFFFFC000
orl %r15d, %eax
orl %ebp, %eax
movq %rax, 0x48(%rsp)
leaq 0x38(%r14), %r15
leaq 0x5c0(%r14), %rax
movq %rax, 0x90(%rsp)
movq 0x50(%rsp), %rax
addl $-0x2, %eax
movq %rax, 0x50(%rsp)
movq %r12, 0x80(%rsp)
movq %r15, 0x78(%rsp)
movq %r14, 0x70(%rsp)
movq %r15, %rdi
movl %ebx, %esi
callq 0x5b074
movq (%rax), %r13
testl %ebx, %ebx
movq %rbx, 0xa0(%rsp)
je 0x7dc0b
leal -0x1(%rbx), %esi
movq %r15, %rdi
callq 0x5b074
movq (%rax), %rax
movq %rax, 0x38(%rsp)
jmp 0x7dc14
movq $0x0, 0x38(%rsp)
movl 0x8(%r13), %esi
movq 0x90(%rsp), %rdi
callq 0x7ee3c
movq %rax, %rbx
xorl %ebp, %ebp
movq %rax, %rdi
xorl %esi, %esi
callq 0x57e30
movl $0x0, %ecx
testb %al, %al
jne 0x7dd49
movq %rbx, %rdi
callq 0x58410
cvtsi2sdl (%rax), %xmm0
movapd %xmm0, 0x60(%rsp)
movq %rbx, %rdi
callq 0x58410
xorps %xmm0, %xmm0
cvtsi2sdl 0x4(%rax), %xmm0
divsd 0x7862d(%rip), %xmm0    # 0xf6298
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
movapd 0x78603(%rip), %xmm2    # 0xf62a0
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm2, %xmm0
movapd %xmm0, %xmm1
xorpd %xmm3, %xmm3
cmpltpd %xmm3, %xmm1
movapd %xmm1, %xmm2
andnpd 0x7586e(%rip), %xmm2    # 0xf3530
andpd 0x75876(%rip), %xmm1    # 0xf3540
orpd %xmm2, %xmm1
addpd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movq %rax, %xmm0
unpckhpd %xmm1, %xmm1            # xmm1 = xmm1[1,1]
cvttsd2si %xmm1, %rax
movq %rax, %xmm1
punpckldq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
cvtdq2pd %xmm0, %xmm0
divpd 0x75826(%rip), %xmm0    # 0xf3520
movapd %xmm0, %xmm1
cmpltpd %xmm3, %xmm1
movmskpd %xmm1, %eax
movsd 0x75681(%rip), %xmm1    # 0xf3390
testb $0x2, %al
jne 0x7dd1b
movsd 0x7567d(%rip), %xmm1    # 0xf3398
movsd 0x7566d(%rip), %xmm2    # 0xf3390
testb $0x1, %al
jne 0x7dd2f
movsd 0x75669(%rip), %xmm2    # 0xf3398
movapd %xmm0, %xmm3
unpckhpd %xmm0, %xmm3            # xmm3 = xmm3[1],xmm0[1]
addsd %xmm1, %xmm3
cvttsd2si %xmm3, %rbp
addsd %xmm0, %xmm2
cvttsd2si %xmm2, %rcx
movq %rcx, 0x98(%rsp)
movl 0x10(%rsp), %r12d
leal 0x1(%r12), %eax
movl %eax, 0x8(%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
addl $0x7, %ecx
leal (%rcx,%r15), %edx
testb %al, %al
leal 0x6(%r15,%rcx), %eax
cmovel %edx, %eax
movl %eax, 0x10(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
leaq 0xc(%rsp), %rcx
testb %al, %al
je 0x7ddc3
decl 0x8(%rsp)
leaq 0x10(%rsp), %rcx
incl (%rcx)
cmpq $0x0, 0x38(%rsp)
movq 0x80(%rsp), %r12
movq 0xed6f6(%rip), %r15     # 0x16b4d0
je 0x7ddf2
movq 0x38(%rsp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb %al, %al
je 0x7ddf2
incl 0x8(%rsp)
movq 0x8(%rsp), %rax
movl 0x10(%rsp), %ecx
movl 0x14(%rsp), %edx
incl %ecx
incl %edx
shlq $0x20, %rdx
orq %rdx, %rcx
movq %rax, 0x18(%rsp)
movq %rcx, 0x20(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
xorl %edx, %edx
callq 0x57890
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7de3b
incl 0x8(%rsp)
incl 0x10(%rsp)
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x7ded0
movq (%rdi), %rax
callq *0x90(%rax)
movl 0x8(%rsp), %ecx
testb %al, %al
je 0x7ded4
movl 0xc(%rsp), %eax
movl 0x14(%rsp), %edx
incl %eax
movl %ecx, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
movl %ecx, 0x28(%rsp)
movl %edx, 0x2c(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %r15, %rcx
callq 0x58300
decl 0x8(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7def0
movl 0x8(%rsp), %eax
movl 0xc(%rsp), %ecx
incl %eax
movl %eax, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
jmp 0x7deeb
movl 0x8(%rsp), %ecx
movl 0xc(%rsp), %eax
movl %ecx, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0x55120
movq 0xc(%rsp), %xmm0
pshufd $0xe1, %xmm0, %xmm0     # xmm0 = xmm0[1,0,2,3]
movq %xmm0, 0x18(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %rsi
movq %r15, %rdx
callq 0x55120
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
je 0x7df29
decl 0x8(%rsp)
decl 0x10(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7df3e
decl 0x14(%rsp)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x563f0
testb %al, %al
movq 0x60(%rsp), %r14
je 0x7dfc7
movq %rbx, %rdi
callq 0x58410
movq $0x0, 0x18(%rsp)
movq (%rax), %rax
movq %rax, 0x20(%rsp)
movl 0x8(%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 0xc(%rsp), %edx
leal 0x2(%rdx), %esi
movl %eax, 0x28(%rsp)
movl %esi, 0x2c(%rsp)
leal 0x3(%r14,%rcx), %eax
movl %eax, 0x30(%rsp)
movq 0x98(%rsp), %rax
leal 0x2(%rdx,%rax), %eax
movl %eax, 0x34(%rsp)
movq %r12, %rdi
movq %rbx, %rsi
leaq 0x18(%rsp), %rdx
leaq 0x28(%rsp), %rcx
callq 0x55ba0
leal 0x6(%r14), %r12d
movq (%r13), %rax
movq %r13, %rdi
callq *0xa8(%rax)
movq %rax, %rbx
movq (%r13), %rax
addl 0x8(%rsp), %r12d
movq %r13, %rdi
callq *0x90(%rax)
movzbl %al, %r15d
addl %r12d, %r15d
movl 0xc(%rsp), %r12d
movl 0x14(%rsp), %ebp
movq (%r13), %rax
movq %r13, %rdi
callq *0xe8(%rax)
movq %rax, %rdi
movq 0xedda4(%rip), %rsi     # 0x16bdb8
callq 0x57680
addl %r12d, %eax
subl %eax, %ebp
xorps %xmm0, %xmm0
cvtsi2sd %ebp, %xmm0
mulsd 0x7536b(%rip), %xmm0    # 0xf3398
callq 0x56cb0
movl %r12d, %ebp
addl %eax, %ebp
addl %eax, %r12d
decl %r12d
movq (%r13), %rax
movq %r13, %rdi
callq *0xf8(%rax)
movl %r15d, 0x18(%rsp)
movl %r12d, 0x1c(%rsp)
movq 0x80(%rsp), %r12
addl %r14d, %eax
addl %r15d, %eax
movl %eax, 0x20(%rsp)
movq 0x50(%rsp), %rax
addl %ebp, %eax
decl %eax
leaq 0x18(%rsp), %r14
movl %eax, 0x24(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0xe8(%rax)
movq %r12, %rdi
movq %rbx, %rsi
movq %r14, %rdx
movq %rax, %rcx
xorl %r8d, %r8d
callq 0x57b80
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7e1be
movl 0x14(%rsp), %eax
incl %eax
movl %eax, 0x14(%rsp)
movl 0x8(%rsp), %ecx
movl 0x10(%rsp), %ebx
incl %ecx
movl %ecx, 0x18(%rsp)
movl %eax, 0x1c(%rsp)
movq 0x70(%rsp), %r14
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
movl 0x14(%rsp), %ecx
movl %eax, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
movq %r12, %rdi
leaq 0x18(%rsp), %r13
movq %r13, %rsi
leaq 0x28(%rsp), %r15
movq %r15, %rdx
movq 0xed3ca(%rip), %rcx     # 0x16b4d0
callq 0x58300
movl 0x8(%rsp), %ebx
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
movl 0x14(%rsp), %ecx
movl %eax, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
testb %al, %al
movq 0x40(%rsp), %rax
cmovneq 0x48(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x55120
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
leaq 0x10(%rsp), %rcx
testb %al, %al
movq 0x78(%rsp), %r15
je 0x7e275
movl 0x10(%rsp), %eax
movl 0x14(%rsp), %ecx
incl %eax
movl %eax, 0x28(%rsp)
movl %ecx, 0x2c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x18(%rsp), %rdx
callq 0x55120
leaq 0x10(%rsp), %rcx
jmp 0x7e275
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
movq 0x78(%rsp), %r15
movq 0x70(%rsp), %r14
je 0x7e1eb
movq (%rdi), %rax
callq *0x90(%rax)
movl 0x8(%rsp), %ecx
testb %al, %al
je 0x7e1ef
incl %ecx
movl %ecx, 0x8(%rsp)
jmp 0x7e1ef
movl 0x8(%rsp), %ecx
movl 0x10(%rsp), %ebx
movl 0x14(%rsp), %eax
movl %ecx, 0x28(%rsp)
movl %eax, 0x2c(%rsp)
movq (%r14), %rax
movq %r14, %rdi
callq *0x160(%rax)
movzbl %al, %eax
addl %ebx, %eax
incl %eax
movl 0x14(%rsp), %ecx
movl %eax, 0x88(%rsp)
movl %ecx, 0x8c(%rsp)
movq 0x40(%rsp), %rax
movq %rax, 0x20(%rsp)
movl $0x0, 0x18(%rsp)
movq %r12, %rdi
leaq 0x28(%rsp), %rsi
leaq 0x88(%rsp), %rdx
leaq 0x18(%rsp), %rcx
callq 0x58300
leaq 0xc(%rsp), %rcx
movq 0x38(%rsp), %rdi
testq %rdi, %rdi
je 0x7e275
movq (%rdi), %rax
callq *0x90(%rax)
leaq 0xc(%rsp), %rcx
testb %al, %al
je 0x7e275
decl 0x8(%rsp)
decl (%rcx)
movq 0xa0(%rsp), %rbx
incl %ebx
cmpl 0x40(%r14), %ebx
jl 0x7dbdd
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
nop