// File: /workspace/github_c_makefile_star2_O1/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 $0xc8, %rsp
movl %esi, %ebp
movq %rdi, %r13
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x747c2
movq (%r13), %rax
movq %r13, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
cmpl $0x1, %ebp
ja 0x747c2
testb %al, %al
je 0x747c2
movq (%r13), %rax
movq %r13, %rdi
callq *0x40(%rax)
movq %rax, %r12
movq (%r13), %rax
movq %r13, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r13), %rax
movq %r13, %rdi
callq *0x50(%rax)
leal (%rax,%r15), %ecx
shrq $0x20, %rax
leaq 0x40(%rsp), %rsi
movl %r15d, (%rsi)
movl %ebx, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
addl %ebx, %eax
movl %eax, 0xc(%rsi)
movq %r12, %rdi
callq 0x55160
testl %ebp, %ebp
jne 0x742a4
leaq 0x140(%r13), %rsi
leaq 0x68(%rsp), %rdi
callq 0x55b70
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x741ff
movq 0xf875b(%rip), %rsi     # 0x16c950
leaq 0x68(%rsp), %rdi
callq 0x58650
movq (%r13), %rax
movq %r13, %rdi
callq *0x140(%rax)
movq 0xf8d95(%rip), %rcx     # 0x16cfa8
movl (%rcx), %ecx
leaq 0x8(%rsp), %r8
movq $0x0, (%r8)
leaq 0x40(%rsp), %rsi
movq %r12, %rdi
movq %rax, %rdx
callq 0x57930
movl 0x4c(%rsp), %ebx
subl 0x44(%rsp), %ebx
movl %ebx, %eax
subl 0x18c(%r13), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x8014a(%rip), %xmm0    # 0xf4398
callq 0x56cb0
leaq 0xf0(%r13), %rsi
decl %eax
movl 0x40(%rsp), %ecx
addl %ebx, %ecx
movl 0x44(%rsp), %edx
addl %eax, %edx
shlq $0x20, %rdx
addl 0x48(%rsp), %ebx
addl 0x4c(%rsp), %eax
orq %rdx, %rcx
shlq $0x20, %rax
orq %rax, %rbx
leaq 0x8(%rsp), %rdx
movq %rcx, (%rdx)
movq %rbx, 0x8(%rdx)
leaq 0x68(%rsp), %rcx
movq %r12, %rdi
xorl %r8d, %r8d
callq 0x57b80
leaq 0x68(%rsp), %rdi
callq 0x56720
movq (%r13), %rax
movq %r13, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %rbx
shrq $0x20, %rbx
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x80290(%rip), %xmm0    # 0xf4560
xorpd %xmm2, %xmm2
movapd %xmm0, %xmm1
cmpltsd %xmm2, %xmm1
xorpd %xmm4, %xmm4
movsd 0x800a7(%rip), %xmm3    # 0xf4390
movapd %xmm1, %xmm2
andpd %xmm3, %xmm2
movapd %xmm3, %xmm5
movsd 0x8009b(%rip), %xmm3    # 0xf4398
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x801d3(%rip), %xmm0    # 0xf44f0
movapd %xmm0, %xmm1
cmpltsd %xmm4, %xmm1
movapd %xmm1, %xmm2
andpd %xmm5, %xmm2
andnpd %xmm3, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
addl %eax, %r15d
addl %eax, %ebx
movl 0x4c(%rsp), %ebp
subl 0x44(%rsp), %ebp
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
mulsd 0x801fc(%rip), %xmm0    # 0xf4560
movapd %xmm0, %xmm1
xorpd %xmm3, %xmm3
cmpltsd %xmm3, %xmm1
movapd %xmm1, %xmm2
movsd 0x80013(%rip), %xmm4    # 0xf4390
andpd %xmm4, %xmm2
movsd 0x8000f(%rip), %xmm5    # 0xf4398
andnpd %xmm5, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x80147(%rip), %xmm0    # 0xf44f0
movapd %xmm0, %xmm1
cmpltsd %xmm3, %xmm1
movapd %xmm1, %xmm2
andpd %xmm4, %xmm2
andnpd %xmm5, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
addsd %xmm0, %xmm0
movapd %xmm0, %xmm1
cmpltsd %xmm3, %xmm1
movapd %xmm4, %xmm2
andpd %xmm1, %xmm2
andnpd %xmm5, %xmm1
orpd %xmm2, %xmm1
addsd %xmm0, %xmm1
cvttsd2si %xmm1, %rax
movl %r15d, 0x68(%rsp)
movl %ebx, 0x6c(%rsp)
addl %ebp, %r15d
subl %eax, %r15d
movl %r15d, 0x70(%rsp)
addl %ebx, %ebp
subl %eax, %ebp
movl %ebp, 0x74(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
movq 0xf8b80(%rip), %rcx     # 0x16cfa8
movl (%rcx), %ecx
leaq 0x8(%rsp), %r8
testb %al, %al
je 0x74443
movq $0x0, (%r8)
movq 0xf822f(%rip), %rdx     # 0x16c670
jmp 0x74451
movq $0x0, (%r8)
movq 0xf807f(%rip), %rdx     # 0x16c4d0
leaq 0x68(%rsp), %rsi
movq %r12, %rdi
callq 0x57930
leaq 0x68(%rsp), %rsi
movl $0x1, %ebp
movq %r12, %rdi
movl $0x1, %edx
callq 0x57890
movq 0x5c0(%r13), %rax
cmpb $0x1, (%rax)
jne 0x747b8
movl 0x68(%rsp), %ebx
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
negl %eax
leal (%rbx,%rax), %r15d
addl $0x3, %r15d
movl 0x6c(%rsp), %eax
movl 0x70(%rsp), %ebx
addl $0x3, %eax
movq %rax, 0x30(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
notl %eax
addl %ebx, %eax
movq %rax, 0x28(%rsp)
movq %r15, %rbx
movl 0x74(%rsp), %eax
decl %eax
movq %rax, 0x50(%rsp)
movq %r13, 0xb0(%rsp)
movq %r12, 0xa8(%rsp)
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
testb %al, %al
je 0x74513
movq 0xf8386(%rip), %rcx     # 0x16c888
movq 0x8(%rcx), %rax
movq %rax, 0x10(%rsp)
movl (%rcx), %eax
movl %eax, 0x8(%rsp)
jmp 0x7452b
leaq 0x8(%rsp), %rdi
movq 0xf8369(%rip), %rsi     # 0x16c888
movq 0xf7faa(%rip), %rdx     # 0x16c4d0
callq 0x58200
movq 0x30(%rsp), %r15
subl $0x1, %ebp
movl %ebp, 0x5c(%rsp)
jae 0x7459e
movq (%r13), %rax
movq %r13, %rdi
callq *0x98(%rax)
movq 0xf8403(%rip), %rcx     # 0x16c950
testb %al, %al
je 0x74558
movq 0xf8898(%rip), %rcx     # 0x16cdf0
movq 0x8(%rcx), %r12
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %ebp
decl %ebp
orl $0x1, %ebp
addl %ebx, %ebp
decl %r15d
movq (%r13), %rax
movq %r13, %rdi
callq *0x160(%rax)
movzbl %al, %eax
decl %eax
orl $0x1, %eax
addl 0x28(%rsp), %eax
movq 0x50(%rsp), %r13
decl %r13d
movl %eax, %r14d
movl %ebp, %ebx
jmp 0x745ad
movq 0x10(%rsp), %r12
movq 0x28(%rsp), %r14
movq 0x50(%rsp), %r13
movq %r15, 0x30(%rsp)
movq %rbx, 0x38(%rsp)
movq %r15, %rbp
shlq $0x20, %rbp
movl %ebx, %r15d
leaq (%r15,%rbp), %rax
movq %rbp, 0x60(%rsp)
movq %rax, 0x20(%rsp)
movq %r13, %rbx
shlq $0x20, %rbx
movq %r14, 0x28(%rsp)
movl %r14d, %r14d
leaq (%rbx,%r14), %rax
movq %rax, 0x18(%rsp)
movslq %r12d, %rax
movq %rax, 0xb8(%rsp)
movq %rax, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq 0xa8(%rsp), %r12
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movq 0x38(%rsp), %rax
incl %eax
orq %rbp, %rax
movq %rax, 0x20(%rsp)
movq %r13, 0x50(%rsp)
leal -0x1(%r13), %eax
shlq $0x20, %rax
movq %rax, 0xc0(%rsp)
orq %rax, %r14
movq %r14, 0x18(%rsp)
movq 0xb8(%rsp), %r13
movq %r13, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movq 0x30(%rsp), %rax
leal 0x1(%rax), %r14d
shlq $0x20, %r14
orq %r14, %r15
movq %r15, 0x20(%rsp)
movq 0x28(%rsp), %rbp
leal -0x1(%rbp), %eax
orq %rbx, %rax
movq %rax, 0x18(%rsp)
movq %r13, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movl 0x70(%rsp), %eax
subl 0x68(%rsp), %eax
movq 0x38(%rsp), %rcx
addl %eax, %ecx
addl $-0x5, %ecx
addq 0x60(%rsp), %rcx
movq %rcx, 0x20(%rsp)
leal 0x3(%rbp), %r15d
movl %r15d, %ecx
subl %eax, %ecx
orq %rbx, %rcx
movq %rcx, 0x18(%rsp)
movq %r13, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %rsi
leaq 0x18(%rsp), %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movl 0x70(%rsp), %eax
subl 0x68(%rsp), %eax
movq 0x38(%rsp), %rcx
addl %eax, %ecx
addl $-0x5, %ecx
orq %r14, %rcx
movq %rcx, 0x20(%rsp)
movl %ebp, %ecx
subl %eax, %ecx
addl $0x4, %ecx
orq %rbx, %rcx
movq 0x38(%rsp), %rbx
movq %rcx, 0x18(%rsp)
movq %r13, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
leaq 0x20(%rsp), %r14
movq %r14, %rsi
leaq 0x18(%rsp), %rbp
movq %rbp, %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movl 0x70(%rsp), %eax
subl 0x68(%rsp), %eax
leal (%rbx,%rax), %ecx
addl $-0x6, %ecx
addq 0x60(%rsp), %rcx
movq %rcx, 0x20(%rsp)
subl %eax, %r15d
addq 0xc0(%rsp), %r15
movq %r15, 0x18(%rsp)
movq %r13, 0x10(%rsp)
xorl %eax, %eax
movl %eax, 0x8(%rsp)
movq %r12, %rdi
movq %r14, %rsi
movq %rbp, %rdx
leaq 0x8(%rsp), %rcx
callq 0x58300
movl 0x5c(%rsp), %ebp
testl %ebp, %ebp
movq 0xb0(%rsp), %r13
je 0x744ea
movq %r12, %rdi
callq 0x58780
xorl %ecx, %ecx
movl %ecx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x747da
jmp 0x747da
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x56720
movq %rbx, %rdi
callq 0x57090
nop