// File: /workspace/github_c_makefile_star2_O3/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, %r12
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x7449f
movq (%r12), %rax
movq %r12, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
cmpl $0x1, %ebp
ja 0x7449f
testb %al, %al
je 0x7449f
movq (%r12), %rax
movq %r12, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r12), %rax
movq %r12, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %rbx
shrq $0x20, %rbx
movq (%r12), %rax
movq %r12, %rdi
callq *0x50(%rax)
leal (%rax,%r15), %ecx
shrq $0x20, %rax
leaq 0x38(%rsp), %rsi
movl %r15d, (%rsi)
movl %ebx, 0x4(%rsi)
movl %ecx, 0x8(%rsi)
addl %ebx, %eax
movl %eax, 0xc(%rsi)
movq %r13, %rdi
callq 0x55160
testl %ebp, %ebp
movq %r13, 0x20(%rsp)
jne 0x73fbb
leaq 0x140(%r12), %rsi
leaq 0x70(%rsp), %rdi
callq 0x55b70
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
testb %al, %al
jne 0x73f11
movq 0xf7a49(%rip), %rsi     # 0x16b950
leaq 0x70(%rsp), %rdi
callq 0x58650
movq (%r12), %rax
movq %r12, %rdi
callq *0x140(%rax)
movq 0xf8083(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
movq %rsp, %r8
movq $0x0, (%r8)
leaq 0x38(%rsp), %rsi
movq %r13, %rdi
movq %rax, %rdx
callq 0x57930
movl 0x44(%rsp), %ebx
subl 0x3c(%rsp), %ebx
movl %ebx, %eax
subl 0x18c(%r12), %eax
cvtsi2sd %eax, %xmm0
mulsd 0x7f439(%rip), %xmm0    # 0xf3398
callq 0x56cb0
leaq 0xf0(%r12), %rsi
decl %eax
movl 0x38(%rsp), %ecx
addl %ebx, %ecx
movl 0x3c(%rsp), %edx
addl %eax, %edx
shlq $0x20, %rdx
addl 0x40(%rsp), %ebx
addl 0x44(%rsp), %eax
orq %rdx, %rcx
shlq $0x20, %rax
orq %rax, %rbx
movq %rsp, %rdx
movq %rcx, (%rdx)
movq %rbx, 0x8(%rdx)
leaq 0x70(%rsp), %rcx
movq 0x20(%rsp), %rdi
xorl %r8d, %r8d
callq 0x57b80
leaq 0x70(%rsp), %rdi
callq 0x56720
movq 0x20(%rsp), %r13
movq (%r12), %rax
movq %r12, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %rbx
shrq $0x20, %rbx
movq %r13, %rdi
callq 0x58930
movl %eax, %ebp
movl 0x44(%rsp), %r14d
subl 0x3c(%rsp), %r14d
movq %r13, %rdi
callq 0x58930
xorpd %xmm0, %xmm0
pinsrw $0x1, %eax, %xmm0
pinsrw $0x3, %ebp, %xmm0
psrad $0x10, %xmm0
cvtdq2pd %xmm0, %xmm0
xorpd %xmm1, %xmm1
mulpd 0x81c32(%rip), %xmm0    # 0xf5c40
movapd %xmm0, %xmm2
cmpltpd %xmm1, %xmm2
movapd %xmm2, %xmm3
andnpd 0x7f50d(%rip), %xmm3    # 0xf3530
andpd 0x7f515(%rip), %xmm2    # 0xf3540
orpd %xmm3, %xmm2
addpd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %xmm0
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm2
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
cvtdq2pd %xmm0, %xmm2
divpd 0x7f4c5(%rip), %xmm2    # 0xf3520
movapd %xmm2, %xmm0
cmpltpd %xmm1, %xmm0
movmskpd %xmm0, %eax
movsd 0x7f320(%rip), %xmm0    # 0xf3390
movsd 0x7f320(%rip), %xmm1    # 0xf3398
movapd %xmm0, %xmm3
testb $0x2, %al
jne 0x74084
movapd %xmm1, %xmm3
movapd %xmm2, %xmm4
unpckhpd %xmm2, %xmm4            # xmm4 = xmm4[1],xmm2[1]
addsd %xmm3, %xmm4
cvttsd2si %xmm4, %rcx
addl %ecx, %r15d
addl %ecx, %ebx
movapd %xmm0, %xmm3
testb $0x1, %al
jne 0x740a6
movapd %xmm1, %xmm3
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %rax
xorps %xmm2, %xmm2
cvtsi2sd %eax, %xmm2
addsd %xmm2, %xmm2
xorpd %xmm3, %xmm3
movapd %xmm2, %xmm4
cmpltsd %xmm3, %xmm4
andpd %xmm4, %xmm0
andnpd %xmm1, %xmm4
orpd %xmm0, %xmm4
addsd %xmm2, %xmm4
cvttsd2si %xmm4, %rax
movl %r15d, 0x70(%rsp)
movl %ebx, 0x74(%rsp)
addl %r14d, %r15d
subl %eax, %r15d
movl %r15d, 0x78(%rsp)
addl %r14d, %ebx
subl %eax, %ebx
movl %ebx, 0x7c(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
movq 0xf7e9b(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
movq %rsp, %r8
testb %al, %al
je 0x74126
movq $0x0, (%r8)
movq 0xf754c(%rip), %rdx     # 0x16b670
jmp 0x74134
movq $0x0, (%r8)
movq 0xf739c(%rip), %rdx     # 0x16b4d0
leaq 0x70(%rsp), %rsi
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x57930
leaq 0x70(%rsp), %rsi
movq %rbx, %rdi
movl $0x1, %edx
callq 0x57890
movq 0x5c0(%r12), %rax
cmpb $0x1, (%rax)
jne 0x74493
movl 0x70(%rsp), %ebx
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movzbl %al, %eax
negl %eax
addl %ebx, %eax
addl $0x3, %eax
movq %rax, 0x30(%rsp)
movl 0x74(%rsp), %eax
movl 0x78(%rsp), %ebx
addl $0x3, %eax
movq %rax, 0x50(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movzbl %al, %eax
notl %eax
addl %ebx, %eax
movq %rax, 0x28(%rsp)
movl 0x7c(%rsp), %eax
decl %eax
movq %rax, 0x48(%rsp)
movb $0x1, %al
xorl %ebx, %ebx
movq 0xf76c0(%rip), %rcx     # 0x16b888
addq $0x8, %rcx
movq %rcx, 0xb0(%rsp)
movq %r12, 0xb8(%rsp)
movl %eax, 0x5c(%rsp)
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
movq 0xb0(%rsp), %rcx
testb %al, %al
jne 0x74214
movq %rsp, %rdi
movq 0xf7685(%rip), %rsi     # 0x16b888
movq 0xf72c6(%rip), %rdx     # 0x16b4d0
callq 0x58200
leaq 0x8(%rsp), %rcx
testb $0x1, %bl
movq 0x50(%rsp), %r15
je 0x74288
movq (%r12), %rax
movq %r12, %rdi
callq *0x98(%rax)
movq 0xf771e(%rip), %rcx     # 0x16b950
testb %al, %al
je 0x7423d
movq 0xf7bb3(%rip), %rcx     # 0x16bdf0
movq 0x8(%rcx), %r14
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movzbl %al, %ebx
decl %ebx
orl $0x1, %ebx
addl 0x30(%rsp), %ebx
decl %r15d
movq (%r12), %rax
movq %r12, %rdi
callq *0x160(%rax)
movq %r14, %rsi
movzbl %al, %eax
decl %eax
orl $0x1, %eax
addl 0x28(%rsp), %eax
movq 0x48(%rsp), %r12
decl %r12d
movl %eax, %edi
movl %ebx, %r14d
jmp 0x7429a
movq (%rcx), %rsi
movq 0x28(%rsp), %rdi
movq 0x48(%rsp), %r12
movq 0x30(%rsp), %r14
movq %rdi, 0x28(%rsp)
movq %r15, 0x50(%rsp)
movq %r15, %rdx
shlq $0x20, %rdx
movl %r14d, %ebp
movq %r14, 0x30(%rsp)
leaq (%rdx,%rbp), %rax
movq %rdx, %r13
movq %rdx, 0x68(%rsp)
movq %rax, 0x18(%rsp)
movq %r12, %r15
shlq $0x20, %r15
movl %edi, %ebx
leaq (%r15,%rbx), %rax
movq %rax, 0x10(%rsp)
movslq %esi, %rax
movq %rax, 0x60(%rsp)
movq %rax, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq 0x20(%rsp), %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
callq 0x58300
leal 0x1(%r14), %eax
orq %r13, %rax
movq %rax, 0x18(%rsp)
movq %r12, 0x48(%rsp)
leal -0x1(%r12), %eax
shlq $0x20, %rax
movq %rax, 0xc0(%rsp)
orq %rax, %rbx
movq %rbx, 0x10(%rsp)
movq 0x60(%rsp), %r12
movq %r12, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq 0x20(%rsp), %r14
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
callq 0x58300
movq 0x50(%rsp), %rax
leal 0x1(%rax), %ebx
shlq $0x20, %rbx
orq %rbx, %rbp
movq %rbp, 0x18(%rsp)
movq 0x28(%rsp), %r13
leal -0x1(%r13), %eax
orq %r15, %rax
movq %rax, 0x10(%rsp)
movq %r12, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
callq 0x58300
movl 0x78(%rsp), %eax
subl 0x70(%rsp), %eax
movq 0x30(%rsp), %r12
leal (%r12,%rax), %ecx
addl $-0x5, %ecx
addq 0x68(%rsp), %rcx
movq %rcx, 0x18(%rsp)
leal 0x3(%r13), %ebp
movl %ebp, %ecx
subl %eax, %ecx
orq %r15, %rcx
movq %rcx, 0x10(%rsp)
movq 0x60(%rsp), %r13
movq %r13, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq %r14, %rdi
leaq 0x18(%rsp), %rsi
leaq 0x10(%rsp), %rdx
movq %rsp, %rcx
callq 0x58300
movl 0x78(%rsp), %eax
subl 0x70(%rsp), %eax
leal (%r12,%rax), %ecx
addl $-0x5, %ecx
orq %rbx, %rcx
movq %rcx, 0x18(%rsp)
movq 0x28(%rsp), %rcx
subl %eax, %ecx
addl $0x4, %ecx
orq %r15, %rcx
movq %rcx, 0x10(%rsp)
movq %r13, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq %r14, %rdi
leaq 0x18(%rsp), %rbx
movq %rbx, %rsi
leaq 0x10(%rsp), %r15
movq %r15, %rdx
movq %rsp, %rcx
callq 0x58300
movl 0x78(%rsp), %eax
subl 0x70(%rsp), %eax
leal (%r12,%rax), %ecx
addl $-0x6, %ecx
addq 0x68(%rsp), %rcx
movq %rcx, 0x18(%rsp)
subl %eax, %ebp
addq 0xc0(%rsp), %rbp
movq %rbp, 0x10(%rsp)
movq %r13, 0x8(%rsp)
xorl %eax, %eax
movl %eax, (%rsp)
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
movq %rsp, %rcx
callq 0x58300
movb $0x1, %bl
testb $0x1, 0x5c(%rsp)
movl $0x0, %eax
movq 0xb8(%rsp), %r12
jne 0x741dc
movq 0x20(%rsp), %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 0x744b7
jmp 0x744b7
movq %rax, %rbx
leaq 0x70(%rsp), %rdi
callq 0x56720
movq %rbx, %rdi
callq 0x57090