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

	Surface	*surface	= GetDrawSurface();
	Point	 realPos	= GetRealPosition();
	Size	 realSize	= GetRealSize();

	Bool	 smallHotspots	= (subtype == OR_HORZ && (GetWidth() <= 55)) || (subtype == OR_VERT && (GetHeight() <= 55));
	Int	 hotspotSize	= Math::Round((smallHotspots ? 10 : (subtype == OR_HORZ ? GetHeight() : GetWidth())) * surface->GetSurfaceDPI() / 96.0) - 4;

	Rect	 arrow1Frame	= Rect(realPos + Point(subtype == OR_HORZ ? realSize.cx - (hotspotSize + 4) : 0, subtype == OR_VERT ? realSize.cy - (hotspotSize + 4) : 0), subtype == OR_HORZ ? Size(hotspotSize + 4, realSize.cy) : Size(realSize.cx, hotspotSize + 4));
	Rect	 arrow2Frame	= Rect(realPos + Point(0, 0), subtype == OR_HORZ ? Size(hotspotSize + 4, realSize.cy) : Size(realSize.cx, hotspotSize + 4));
	Int	 arrowColor	= Setup::TextColor;

	if (!IsActive()) arrowColor = Setup::InactiveTextColor;

	switch (message)
	{
		case SP_PAINT:
			surface->StartPaint(Rect(realPos, realSize));

			OnValueChange();

			surface->Box(arrow1Frame, Setup::BackgroundColor, Rect::Filled);
			surface->Box(arrow2Frame, Setup::BackgroundColor, Rect::Filled);

			surface->Frame(arrow1Frame, FRAME_UP);
			surface->Frame(arrow2Frame, FRAME_UP);

			if (subtype == OR_HORZ)
			{
				Int	 size = Math::Round(3 * surface->GetSurfaceDPI() / 96.0);

				for (Int i = 0; i < size; i++)
				{
					Point	 lineStart = Point(realPos.x + (hotspotSize + 4) / 2 - size / 2 + i, realPos.y + realSize.cy / 2 - i);
					Point	 lineEnd   = lineStart + Point(0, 2 * i + 1);

					surface->Line(lineStart, lineEnd, arrowColor);
				}

				for (Int i = 0; i < size; i++)
				{
					Point	 lineStart = Point(realPos.x + realSize.cx - (hotspotSize + 4) / 2 - (size + 1) / 2 + i, realPos.y + realSize.cy / 2 - size + 1 + i);
					Point	 lineEnd   = lineStart + Point(0, 2 * (size - i) - 1);

					surface->Line(lineStart, lineEnd, arrowColor);
				}
			}
			else if (subtype == OR_VERT)
			{
				Int	 size = Math::Round(3 * surface->GetSurfaceDPI() / 96.0);

				for (Int i = 0; i < size; i++)
				{
					Point	 lineStart = Point(realPos.x + realSize.cx / 2 + (IsRightToLeft() ? 1 : 0) - i, (realPos.y + (hotspotSize + 4) / 2) - size / 2 + i);
					Point	 lineEnd   = lineStart + Point(2 * i + 1, 0);

					surface->Line(lineStart, lineEnd, arrowColor);
				}

				for (Int i = 0; i < size; i++)
				{
					Point	 lineStart = Point(realPos.x + realSize.cx / 2 + (IsRightToLeft() ? 1 : 0) - size + 1 + i, (realPos.y + realSize.cy - (hotspotSize + 4) / 2) - (size + 1) / 2 + i);
					Point	 lineEnd   = lineStart + Point(2 * (size - i) - 1, 0);

					surface->Line(lineStart, lineEnd, arrowColor);
				}
			}

			surface->EndPaint();

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x280, %rsp            # imm = 0x280
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x1b8(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xa07c4
leaq -0x28(%rbp), %rdi
movq %rdi, -0x1c8(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x1c8(%rbp), %rdi
callq 0x59680
movl %eax, -0x1bc(%rbp)
jmp 0xa0793
movl -0x1bc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa11ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xa11c6
movq -0x1b8(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa082d
leaq -0x48(%rbp), %rdi
movq %rdi, -0x1d8(%rbp)
callq 0x5ca80
movq -0x1d8(%rbp), %rdi
callq 0x59680
movl %eax, -0x1cc(%rbp)
jmp 0xa07fc
movl -0x1cc(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa11ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xa11c6
movq -0x1b8(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x1b8(%rbp), %rdi
movq %rax, -0x50(%rbp)
movq (%rdi), %rax
callq *0x48(%rax)
movq -0x1b8(%rbp), %rdi
movq %rax, -0x58(%rbp)
movq (%rdi), %rax
callq *0x50(%rax)
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x60(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa0891
movq -0x1b8(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movb $0x1, %al
cmpl $0x37, %ecx
movb %al, -0x1d9(%rbp)
jle 0xa08d0
movq -0x1b8(%rbp), %rax
movswl 0x1a0(%rax), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x1da(%rbp)
jne 0xa08c4
movq -0x1b8(%rbp), %rdi
callq 0x5b860
cmpl $0x37, %eax
setle %al
movb %al, -0x1da(%rbp)
movb -0x1da(%rbp), %al
movb %al, -0x1d9(%rbp)
movb -0x1d9(%rbp), %al
andb $0x1, %al
movb %al, -0x61(%rbp)
testb $0x1, -0x61(%rbp)
je 0xa08ee
movl $0xa, %eax
movl %eax, -0x1e0(%rbp)
jmp 0xa0933
movq -0x1b8(%rbp), %rax
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa0915
movq -0x1b8(%rbp), %rdi
callq 0x5b860
movl %eax, -0x1e4(%rbp)
jmp 0xa0927
movq -0x1b8(%rbp), %rdi
callq 0x5a210
movl %eax, -0x1e4(%rbp)
movl -0x1e4(%rbp), %eax
movl %eax, -0x1e0(%rbp)
movl -0x1e0(%rbp), %eax
movl %eax, -0x1e8(%rbp)
movq -0x50(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movl -0x1e8(%rbp), %eax
movswl %cx, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe6b5d(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
subq $0x4, %rcx
movl %ecx, -0x68(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa099c
movl -0x60(%rbp), %eax
movl -0x68(%rbp), %ecx
addl $0x4, %ecx
subl %ecx, %eax
movl %eax, -0x1ec(%rbp)
jmp 0xa09a6
xorl %eax, %eax
movl %eax, -0x1ec(%rbp)
jmp 0xa09a6
movq -0x1b8(%rbp), %rax
movl -0x1ec(%rbp), %ecx
movl %ecx, -0x1f0(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x2, %eax
jne 0xa09d8
movl -0x5c(%rbp), %eax
movl -0x68(%rbp), %ecx
addl $0x4, %ecx
subl %ecx, %eax
movl %eax, -0x1f4(%rbp)
jmp 0xa09e2
xorl %eax, %eax
movl %eax, -0x1f4(%rbp)
jmp 0xa09e2
movl -0x1f0(%rbp), %esi
movl -0x1f4(%rbp), %edx
leaq -0x88(%rbp), %rdi
callq 0x5c2c0
leaq -0x58(%rbp), %rdi
leaq -0x88(%rbp), %rsi
callq 0x5ca20
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0x80(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa0a3b
movl -0x68(%rbp), %esi
addl $0x4, %esi
movl -0x5c(%rbp), %edx
leaq -0x90(%rbp), %rdi
callq 0x59260
jmp 0xa0a50
movl -0x60(%rbp), %esi
movl -0x68(%rbp), %edx
addl $0x4, %edx
leaq -0x90(%rbp), %rdi
callq 0x59260
leaq -0x78(%rbp), %rdi
leaq -0x80(%rbp), %rsi
leaq -0x90(%rbp), %rdx
callq 0x59ff0
leaq -0xb0(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x5c2c0
leaq -0x58(%rbp), %rdi
leaq -0xb0(%rbp), %rsi
callq 0x5ca20
movq %rax, %rcx
movq -0x1b8(%rbp), %rax
movq %rcx, -0xa8(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa0ab8
movl -0x68(%rbp), %esi
addl $0x4, %esi
movl -0x5c(%rbp), %edx
leaq -0xb8(%rbp), %rdi
callq 0x59260
jmp 0xa0acd
movl -0x60(%rbp), %esi
movl -0x68(%rbp), %edx
addl $0x4, %edx
leaq -0xb8(%rbp), %rdi
callq 0x59260
leaq -0xa0(%rbp), %rdi
leaq -0xa8(%rbp), %rsi
leaq -0xb8(%rbp), %rdx
callq 0x59ff0
movq 0x167eda(%rip), %rdi    # 0x2089c8
callq 0x59210
movq -0x1b8(%rbp), %rdi
movl %eax, -0xbc(%rbp)
movq (%rdi), %rax
callq *0x98(%rax)
testb $0x1, %al
jne 0xa0b1f
movq 0x167e1c(%rip), %rdi    # 0x208930
callq 0x59210
movl %eax, -0xbc(%rbp)
movl -0x14(%rbp), %eax
testl %eax, %eax
jne 0xa1162
jmp 0xa0b2c
movq -0x50(%rbp), %rax
movq %rax, -0x218(%rbp)
leaq -0xcc(%rbp), %rdi
leaq -0x58(%rbp), %rsi
leaq -0x60(%rbp), %rdx
callq 0x59ff0
movq -0x218(%rbp), %rdi
leaq -0xcc(%rbp), %rsi
callq 0x591b0
movq -0x1b8(%rbp), %rdi
callq 0x5dea0
movq -0x50(%rbp), %rax
movq %rax, -0x210(%rbp)
movq 0x168424(%rip), %rax    # 0x208fa0
movl (%rax), %eax
movl %eax, -0x204(%rbp)
leaq -0xd4(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
movq -0x210(%rbp), %rdi
movl -0x204(%rbp), %ecx
leaq -0x78(%rbp), %rsi
movq 0x1678fc(%rip), %rdx    # 0x2084a8
leaq -0xd4(%rbp), %r8
callq 0x5c110
movq -0x50(%rbp), %rax
movq %rax, -0x200(%rbp)
movq 0x1683d6(%rip), %rax    # 0x208fa0
movl (%rax), %eax
movl %eax, -0x1f8(%rbp)
leaq -0xdc(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
movq -0x200(%rbp), %rdi
movl -0x1f8(%rbp), %ecx
leaq -0xa0(%rbp), %rsi
movq 0x1678ab(%rip), %rdx    # 0x2084a8
leaq -0xdc(%rbp), %r8
callq 0x5c110
movq -0x50(%rbp), %rdi
leaq -0x78(%rbp), %rsi
xorl %edx, %edx
callq 0x5c050
movq -0x50(%rbp), %rdi
leaq -0xa0(%rbp), %rsi
xorl %edx, %edx
callq 0x5c050
movq -0x1b8(%rbp), %rax
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xa0e79
movq -0x50(%rbp), %rdi
callq 0x5d470
cwtl
imull $0x3, %eax, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe6866(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0xe0(%rbp)
movl $0x0, -0xe4(%rbp)
movl -0xe4(%rbp), %eax
cmpl -0xe0(%rbp), %eax
jge 0xa0d64
movl -0x58(%rbp), %esi
movl -0x68(%rbp), %eax
addl $0x4, %eax
movl $0x2, %ecx
cltd
idivl %ecx
addl %eax, %esi
movl -0xe0(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %esi
addl -0xe4(%rbp), %esi
movl -0x54(%rbp), %eax
movl %eax, -0x224(%rbp)
movl -0x5c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl -0x224(%rbp), %edx
addl %eax, %edx
subl -0xe4(%rbp), %edx
leaq -0xec(%rbp), %rdi
callq 0x5c2c0
movl -0xe4(%rbp), %edx
shll %edx
addl $0x1, %edx
leaq -0xfc(%rbp), %rdi
xorl %esi, %esi
callq 0x5c2c0
leaq -0xec(%rbp), %rdi
leaq -0xfc(%rbp), %rsi
callq 0x5ca20
movq %rax, -0xf4(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x220(%rbp)
movslq -0xbc(%rbp), %rsi
leaq -0x110(%rbp), %rdi
xorl %edx, %edx
callq 0x59be0
movq -0x220(%rbp), %rdi
leaq -0xec(%rbp), %rsi
leaq -0xf4(%rbp), %rdx
leaq -0x110(%rbp), %rcx
callq 0x5cce0
movl -0xe4(%rbp), %eax
addl $0x1, %eax
movl %eax, -0xe4(%rbp)
jmp 0xa0c73
movl $0x0, -0x114(%rbp)
movl -0x114(%rbp), %eax
cmpl -0xe0(%rbp), %eax
jge 0xa0e74
movl -0x58(%rbp), %esi
addl -0x60(%rbp), %esi
movl -0x68(%rbp), %eax
addl $0x4, %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %esi
movl -0xe0(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
subl %eax, %esi
addl -0x114(%rbp), %esi
movl -0x54(%rbp), %eax
movl %eax, -0x234(%rbp)
movl -0x5c(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl -0x234(%rbp), %edx
addl %eax, %edx
subl -0xe0(%rbp), %edx
addl $0x1, %edx
addl -0x114(%rbp), %edx
leaq -0x11c(%rbp), %rdi
callq 0x5c2c0
movl -0xe0(%rbp), %edx
subl -0x114(%rbp), %edx
shll %edx
subl $0x1, %edx
leaq -0x12c(%rbp), %rdi
xorl %esi, %esi
callq 0x5c2c0
leaq -0x11c(%rbp), %rdi
leaq -0x12c(%rbp), %rsi
callq 0x5ca20
movq %rax, -0x124(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x230(%rbp)
movslq -0xbc(%rbp), %rsi
leaq -0x140(%rbp), %rdi
xorl %edx, %edx
callq 0x59be0
movq -0x230(%rbp), %rdi
leaq -0x11c(%rbp), %rsi
leaq -0x124(%rbp), %rdx
leaq -0x140(%rbp), %rcx
callq 0x5cce0
movl -0x114(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x114(%rbp)
jmp 0xa0d6e
jmp 0xa1159
movq -0x1b8(%rbp), %rax
movswl 0x1a0(%rax), %eax
cmpl $0x2, %eax
jne 0xa1157
movq -0x50(%rbp), %rdi
callq 0x5d470
cwtl
imull $0x3, %eax, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe6617(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0x144(%rbp)
movl $0x0, -0x148(%rbp)
movl -0x148(%rbp), %eax
cmpl -0x144(%rbp), %eax
jge 0xa0ffc
movq -0x1b8(%rbp), %rdi
movl -0x58(%rbp), %eax
movl %eax, -0x250(%rbp)
movl -0x60(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x250(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x24c(%rbp)
movq (%rdi), %rax
callq *0x160(%rax)
movl -0x24c(%rbp), %esi
movb %al, %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
addl %eax, %esi
subl -0x148(%rbp), %esi
movl -0x54(%rbp), %eax
movl %eax, -0x248(%rbp)
movl -0x68(%rbp), %eax
addl $0x4, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x248(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x244(%rbp)
movl -0x144(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl -0x244(%rbp), %edx
subl %eax, %edx
addl -0x148(%rbp), %edx
leaq -0x150(%rbp), %rdi
callq 0x5c2c0
movl -0x148(%rbp), %esi
shll %esi
addl $0x1, %esi
leaq -0x160(%rbp), %rdi
xorl %edx, %edx
callq 0x5c2c0
leaq -0x150(%rbp), %rdi
leaq -0x160(%rbp), %rsi
callq 0x5ca20
movq %rax, -0x158(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x240(%rbp)
movslq -0xbc(%rbp), %rsi
leaq -0x170(%rbp), %rdi
xorl %edx, %edx
callq 0x59be0
movq -0x240(%rbp), %rdi
leaq -0x150(%rbp), %rsi
leaq -0x158(%rbp), %rdx
leaq -0x170(%rbp), %rcx
callq 0x5cce0
movl -0x148(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x148(%rbp)
jmp 0xa0ec2
movl $0x0, -0x174(%rbp)
movl -0x174(%rbp), %eax
cmpl -0x144(%rbp), %eax
jge 0xa1155
movq -0x1b8(%rbp), %rdi
movl -0x58(%rbp), %eax
movl %eax, -0x268(%rbp)
movl -0x60(%rbp), %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x268(%rbp), %eax
addl %ecx, %eax
movl %eax, -0x264(%rbp)
movq (%rdi), %rax
callq *0x160(%rax)
movl -0x264(%rbp), %esi
movb %al, %dl
xorl %eax, %eax
movl $0x1, %ecx
testb $0x1, %dl
cmovnel %ecx, %eax
addl %eax, %esi
subl -0x144(%rbp), %esi
addl $0x1, %esi
addl -0x174(%rbp), %esi
movl -0x54(%rbp), %eax
addl -0x5c(%rbp), %eax
movl %eax, -0x260(%rbp)
movl -0x68(%rbp), %eax
addl $0x4, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl %eax, %ecx
movl -0x260(%rbp), %eax
subl %ecx, %eax
movl %eax, -0x25c(%rbp)
movl -0x144(%rbp), %eax
addl $0x1, %eax
movl $0x2, %ecx
cltd
idivl %ecx
movl -0x25c(%rbp), %edx
subl %eax, %edx
addl -0x174(%rbp), %edx
leaq -0x17c(%rbp), %rdi
callq 0x5c2c0
movl -0x144(%rbp), %esi
subl -0x174(%rbp), %esi
shll %esi
subl $0x1, %esi
leaq -0x18c(%rbp), %rdi
xorl %edx, %edx
callq 0x5c2c0
leaq -0x17c(%rbp), %rdi
leaq -0x18c(%rbp), %rsi
callq 0x5ca20
movq %rax, -0x184(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x258(%rbp)
movslq -0xbc(%rbp), %rsi
leaq -0x1a0(%rbp), %rdi
xorl %edx, %edx
callq 0x59be0
movq -0x258(%rbp), %rdi
leaq -0x17c(%rbp), %rsi
leaq -0x184(%rbp), %rdx
leaq -0x1a0(%rbp), %rcx
callq 0x5cce0
movl -0x174(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x174(%rbp)
jmp 0xa1006
jmp 0xa1157
jmp 0xa1159
movq -0x50(%rbp), %rdi
callq 0x5d270
leaq -0x1b0(%rbp), %rdi
movq %rdi, -0x278(%rbp)
callq 0x5ca80
movq -0x278(%rbp), %rdi
callq 0x59680
movl %eax, -0x26c(%rbp)
jmp 0xa1189
movl -0x26c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x5a410
jmp 0xa11ba
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x1b0(%rbp), %rdi
callq 0x5a410
jmp 0xa11c6
movl -0x4(%rbp), %eax
addq $0x280, %rsp            # imm = 0x280
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nop