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

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

				surface->StartPaint(frame);

				if (message == SP_PAINT)
				{
					Font	 nFont = font;

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

					surface->Box(frame, GetBackgroundColor(), Rect::Filled);
					surface->SetText(text, frame + Point(frame.GetHeight(), Math::Ceil(Float(frame.GetHeight() - scaledTextSize.cy) / 2) - 1), nFont);
				}

				Rect	 valueFrame = Rect(GetRealPosition() + Point(3, 3) * surface->GetSurfaceDPI() / 96.0, Size(frame.GetHeight(), frame.GetHeight()) - (Size(3, 3) * surface->GetSurfaceDPI() / 96.0) * 2);

				if (IsActive())	surface->Box(valueFrame, Setup::ClientColor, Rect::Filled);
				else		surface->Box(valueFrame, Setup::BackgroundColor, Rect::Filled);

				surface->Frame(valueFrame, FRAME_DOWN);

				if (*variable == True)
				{
					Point p1 = Point(valueFrame.left + 3 - (IsRightToLeft() ? 1 : 0), valueFrame.top + 3);
					Point p2 = Point(valueFrame.right - 1 - (IsRightToLeft() ? 1 : 0), valueFrame.bottom - 1);

					for (Int i = 0; i < 2; i++)
					{
						Int	 color = IsActive() ? Setup::DividerDarkColor : Setup::DividerDarkColor.Average(Setup::BackgroundColor);

						if (i == 1)
						{
							color = IsActive() ? Setup::ClientTextColor : Setup::InactiveTextColor;

							p1 -= Point((IsRightToLeft() ? -i : i), i);
							p2 -= Point((IsRightToLeft() ? -i : i), i);
						}

						surface->Line(p1 + Point(0, 0),				p2 - Point(0, 0),			  color);
						surface->Line(p1 + Point(1, 0),				p2 - Point(0, 1),			  color);
						surface->Line(p1 + Point(0, 1),				p2 - Point(1, 0),			  color);
						surface->Line(p1 + Point(valueFrame.GetWidth() - 5, 0), p2 - Point(valueFrame.GetWidth() - 3, 0), color);
						surface->Line(p1 + Point(valueFrame.GetWidth() - 5, 1), p2 - Point(valueFrame.GetWidth() - 4, 0), color);
						surface->Line(p1 + Point(valueFrame.GetWidth() - 6, 0), p2 - Point(valueFrame.GetWidth() - 3, 1), color);
					}
				}

				surface->EndPaint();
			}

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movl %esi, %ebx
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
testb %al, %al
je 0x7386f
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
cmpl $0x1, %ebx
ja 0x73be9
testb %al, %al
je 0x73be9
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, %rbp
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %rax, %r14
shrq $0x20, %r14
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
leal (%rax,%r12), %ecx
shrq $0x20, %rax
leaq 0x48(%rsp), %rsi
movl %r12d, (%rsi)
movl %r14d, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
addl %r14d, %eax
movl %eax, 0xc(%rsi)
movq %rbp, %rdi
callq 0x56160
testl %ebx, %ebx
movq %rbp, 0x28(%rsp)
jne 0x7375f
leaq 0x140(%r15), %rsi
leaq 0x78(%rsp), %rdi
callq 0x56bf0
movq (%r15), %rax
movq %r15, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x736c2
movq 0xee298(%rip), %rsi     # 0x161950
leaq 0x78(%rsp), %rdi
callq 0x59940
movq (%r15), %rax
movq %r15, %rdi
callq *0x140(%rax)
movq 0xee8d3(%rip), %rcx     # 0x161fa8
movl (%rcx), %ecx
leaq 0x10(%rsp), %r8
andq $0x0, (%r8)
leaq 0x48(%rsp), %rsi
movq 0x28(%rsp), %rdi
movq %rax, %rdx
callq 0x58b80
movl 0x54(%rsp), %ebx
subl 0x4c(%rsp), %ebx
movl %ebx, %eax
subl 0x18c(%r15), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x6fc71(%rip), %xmm0    # 0xe3380
callq 0x57e30
decl %eax
movq %rsp, %rsi
movl %ebx, (%rsi)
movl %eax, 0x4(%rsi)
leaq 0x48(%rsp), %rdi
callq 0x58930
leaq 0xf0(%r15), %rsi
leaq 0x10(%rsp), %r8
movq %rax, (%r8)
movq %rdx, 0x8(%r8)
leaq 0x78(%rsp), %rcx
movq 0x28(%rsp), %rdi
movq %r8, %rdx
xorl %r8d, %r8d
callq 0x58df0
leaq 0x78(%rsp), %rdi
callq 0x57860
movq 0x28(%rsp), %rbp
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
movq %r15, 0x58(%rsp)
movq %rax, %r13
shrq $0x20, %r13
movabsq $0x300000003, %r15      # imm = 0x300000003
movq %rsp, %rbx
movq %r15, (%rbx)
movq %rbp, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
movq %rbx, %rdi
callq 0x570c0
leaq 0x10(%rsp), %rdi
movq %rax, (%rdi)
movsd 0x6fd64(%rip), %xmm0    # 0xe3510
callq 0x59600
movq %rax, %rbx
movq %rax, %r14
shrq $0x20, %r14
addl %r12d, %ebx
addl %r13d, %r14d
movq 0x58(%rsp), %r13
movq %rbp, %rdi
movl 0x54(%rsp), %ebp
subl 0x4c(%rsp), %ebp
leaq 0xd0(%rsp), %r12
movq %r15, (%r12)
movq %rdi, %r15
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
movq %r12, %rdi
callq 0x57480
leaq 0xc8(%rsp), %rdi
movq %rax, (%rdi)
movsd 0x6fd0b(%rip), %xmm0    # 0xe3510
callq 0x59050
leaq 0x8(%rsp), %rdi
movq %rax, (%rdi)
movsd 0x6fb76(%rip), %xmm0    # 0xe3390
callq 0x57480
movl %ebx, 0x78(%rsp)
addl %ebp, %ebx
subl %eax, %ebx
shrq $0x20, %rax
movl %r14d, 0x7c(%rsp)
movl %ebx, 0x80(%rsp)
addl %r14d, %ebp
subl %eax, %ebp
movl %ebp, 0x84(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
movq 0xee751(%rip), %rcx     # 0x161fa8
movl (%rcx), %ecx
leaq 0x10(%rsp), %r8
testb %al, %al
je 0x73877
andq $0x0, (%r8)
movq 0xede03(%rip), %rdx     # 0x161670
jmp 0x73882
pushq $-0x1
popq %rcx
jmp 0x73be9
andq $0x0, (%r8)
movq 0xedc4e(%rip), %rdx     # 0x1614d0
leaq 0x78(%rsp), %rsi
movq %r15, %rdi
callq 0x58b80
leaq 0x78(%rsp), %rsi
pushq $0x1
popq %rdx
movq %r15, %rdi
callq 0x58ad0
movq 0x5c0(%r13), %rax
cmpb $0x1, (%rax)
jne 0x73bdd
movl 0x78(%rsp), %ebx
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
negl %eax
addl %ebx, %eax
addl $0x3, %eax
movq %rax, 0x20(%rsp)
movl 0x7c(%rsp), %eax
movl 0x80(%rsp), %ebx
addl $0x3, %eax
movq %rax, 0x60(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
notl %eax
addl %ebx, %eax
movq %rax, 0x30(%rsp)
movl 0x84(%rsp), %eax
decl %eax
movq %rax, 0x38(%rsp)
pushq $0x2
popq %rbx
movq 0xedf75(%rip), %rax     # 0x161888
addq $0x8, %rax
movq %rax, 0xb8(%rsp)
movl %ebx, %eax
subl $0x1, %eax
jb 0x73bdd
movl %eax, 0x44(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
movq 0xb8(%rsp), %rcx
testb %al, %al
jne 0x73964
leaq 0x10(%rsp), %rdi
movq 0xedf35(%rip), %rsi     # 0x161888
movq 0xedb76(%rip), %rdx     # 0x1614d0
callq 0x594a0
leaq 0x18(%rsp), %rcx
cmpl $0x1, %ebx
movq 0x60(%rsp), %r14
jne 0x739dd
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
movq 0xedfce(%rip), %rcx     # 0x161950
testb %al, %al
movq 0x38(%rsp), %rbx
je 0x73992
movq 0xee45e(%rip), %rcx     # 0x161df0
movq 0x8(%rcx), %r15
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
decl %eax
orl $0x1, %eax
movq 0x20(%rsp), %rcx
addl %eax, %ecx
movq %rcx, 0x20(%rsp)
decl %r14d
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movq %r15, %rsi
movzbl %al, %eax
decl %eax
orl $0x1, %eax
movq 0x30(%rsp), %rcx
addl %eax, %ecx
decl %ebx
jmp 0x739ea
movq (%rcx), %rsi
movq 0x30(%rsp), %rcx
movq 0x38(%rsp), %rbx
movq %rcx, 0x30(%rsp)
movq %r14, %r15
shlq $0x20, %r15
movl 0x20(%rsp), %r13d
leaq (%r15,%r13), %rax
movq %r15, 0x70(%rsp)
movq %rax, (%rsp)
movq %rbx, %rbp
shlq $0x20, %rbp
movl %ecx, %r12d
leaq (%r12,%rbp), %rax
movq %rax, 0x8(%rsp)
movslq %esi, %rax
movq %rax, 0x68(%rsp)
movq %rax, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq 0x28(%rsp), %rdi
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x595b0
movq 0x20(%rsp), %rax
incl %eax
orq %r15, %rax
movq %rax, (%rsp)
movq %rbx, 0x38(%rsp)
leal -0x1(%rbx), %eax
shlq $0x20, %rax
movq %rax, 0xc0(%rsp)
orq %rax, %r12
movq %r12, 0x8(%rsp)
movq 0x68(%rsp), %rbx
movq %rbx, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq 0x28(%rsp), %r15
movq %r15, %rdi
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x595b0
movq %r14, 0x60(%rsp)
leal 0x1(%r14), %r12d
shlq $0x20, %r12
orq %r12, %r13
movq %r13, (%rsp)
movq 0x30(%rsp), %r14
leal -0x1(%r14), %eax
orq %rbp, %rax
movq %rax, 0x8(%rsp)
movq %rbx, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x595b0
movl 0x80(%rsp), %eax
subl 0x78(%rsp), %eax
movq 0x20(%rsp), %rcx
addl %eax, %ecx
addl $-0x5, %ecx
addq 0x70(%rsp), %rcx
movq %rcx, (%rsp)
leal 0x3(%r14), %r13d
movq %r14, %rbx
movl %r13d, %ecx
subl %eax, %ecx
orq %rbp, %rcx
movq %rcx, 0x8(%rsp)
movq 0x68(%rsp), %r14
movq %r14, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %rsp, %rsi
leaq 0x8(%rsp), %rdx
leaq 0x10(%rsp), %rcx
callq 0x595b0
movl 0x80(%rsp), %eax
subl 0x78(%rsp), %eax
movq 0x20(%rsp), %rcx
addl %eax, %ecx
addl $-0x5, %ecx
orq %r12, %rcx
movq %rcx, (%rsp)
movl %ebx, %ecx
subl %eax, %ecx
addl $0x4, %ecx
orq %rbp, %rcx
movq %rcx, 0x8(%rsp)
movq %r14, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %rsp, %rbp
movq %rbp, %rsi
leaq 0x8(%rsp), %r12
movq %r12, %rdx
leaq 0x10(%rsp), %rbx
movq %rbx, %rcx
callq 0x595b0
movl 0x80(%rsp), %eax
subl 0x78(%rsp), %eax
movq 0x20(%rsp), %rcx
addl %eax, %ecx
addl $-0x6, %ecx
addq 0x70(%rsp), %rcx
movq %rcx, (%rsp)
subl %eax, %r13d
addq 0xc0(%rsp), %r13
movq %r13, 0x8(%rsp)
movq %r14, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %rbp, %rsi
movq %r12, %rdx
movq %rbx, %rcx
callq 0x595b0
movl 0x44(%rsp), %eax
movl %eax, %ebx
movq 0x58(%rsp), %r13
jmp 0x73921
movq 0x28(%rsp), %rdi
callq 0x59a80
xorl %ecx, %ecx
movl %ecx, %eax
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x73c01
jmp 0x73c01
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x57860
movq %rbx, %rdi
callq 0x58260