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

	Surface	*surface  = GetDrawSurface();
	Point	 realPos  = GetRealPosition();
	Size	 realSize = GetRealSize();
	Int	 realGripSize = Math::Round(gripSize * surface->GetSurfaceDPI() / 96.0);
	Rect	 sliderRect;

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

			surface->Box(Rect(realPos, realSize), GetBackgroundColor(), Rect::Filled);

			if (subtype == OR_HORZ)	surface->Bar(realPos + Point((realGripSize - 1) / 2, (realSize.cy - 2) / 2), realPos + Point(realSize.cx - (realGripSize - 1) / 2, (realSize.cy - 2) / 2), OR_HORZ);
			else			surface->Bar(realPos + Point((realSize.cy - 2) / 2, (realGripSize - 1) / 2), realPos + Point((realSize.cy - 2) / 2, realSize.cy - (realGripSize - 1) / 2), OR_VERT);

			if (subtype == OR_HORZ)	sliderRect = Rect(realPos + Point((Int) (((Float) (realSize.cx - realGripSize)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue))), 0), Size(gripSize - 1, 16) * surface->GetSurfaceDPI() / 96.0 + Size(1, 1));
			else			sliderRect = Rect(realPos + Point(0, (realSize.cy - realGripSize - 1) - (Int) (((Float) (realSize.cy - realGripSize - 1)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue)))), Size(16, gripSize - 1) * surface->GetSurfaceDPI() / 96.0 + Size(2, 2));

			if (!dragging)	surface->Box(sliderRect, Setup::BackgroundColor, Rect::Filled);
			else		surface->Box(sliderRect, Setup::LightGrayColor, Rect::Filled);

			surface->Frame(sliderRect, FRAME_UP);

			surface->EndPaint();

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x68, %rsp
movl %esi, %ebp
movq %rdi, %r15
movq (%rdi), %rax
callq *0x88(%rax)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
testb %al, %al
je 0x7d43e
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %r12d, %r12d
testb %al, %al
je 0x7d43e
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, 0x8(%rsp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x50(%rax)
movq %rax, %rbx
movl 0x5c8(%r15), %r14d
movq %r13, %rdi
callq 0x58930
cwtl
imull %r14d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x7754b(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %cl
xorpd %xmm1, %xmm1
movapd %xmm1, 0x10(%rsp)
testl %ebp, %ebp
jne 0x7d43e
movq %r13, %rsi
movq 0x8(%rsp), %r12
movq %r12, %r13
shrq $0x20, %r13
movq %rbx, %rdx
movb %cl, %al
leaq 0x777b1(%rip), %rcx     # 0xf4790
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x28(%rsp)
shrq $0x20, %rdx
leaq 0x48(%rsp), %rbp
movl %r12d, (%rbp)
movl %r13d, 0x4(%rbp)
movq %rbx, 0x60(%rsp)
leal (%rbx,%r12), %eax
movq %rax, 0x58(%rsp)
movl %eax, 0x8(%rbp)
movq %rsi, %rbx
movq %rdx, 0x30(%rsp)
leal (%rdx,%r13), %r14d
movl %r14d, 0xc(%rbp)
movq %rsi, %rdi
movq %rbp, %rsi
callq 0x55160
movl %r12d, (%rbp)
movq %r14, %r12
movq 0x58(%rsp), %r14
movl %r13d, 0x4(%rbp)
movl %r14d, 0x8(%rbp)
movl %r12d, 0xc(%rbp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x140(%rax)
movq 0xeff52(%rip), %rcx     # 0x16cfa8
movl (%rcx), %ecx
leaq 0x40(%rsp), %r8
movq $0x0, (%r8)
leaq 0x48(%rsp), %rsi
movq %rbx, 0x20(%rsp)
movq %rbx, %rdi
movq %rax, %rdx
callq 0x57930
cmpw $0x1, 0x1a0(%r15)
movq %r13, 0x38(%rsp)
jne 0x7d0ed
movq 0x28(%rsp), %r12
leal -0x1(%r12), %eax
shrl $0x1f, %eax
addl %r12d, %eax
decl %eax
sarl %eax
movq 0x30(%rsp), %rbp
leal -0x2(%rbp), %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
addl $-0x2, %ecx
sarl %ecx
movq 0x8(%rsp), %rdx
addl %eax, %edx
addl %r13d, %ecx
shlq $0x20, %rcx
orq %rcx, %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, (%rsi)
subl %eax, %r14d
orq %rcx, %r14
leaq 0x40(%rsp), %rdx
movq %r14, (%rdx)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl $0x1, %ecx
callq 0x58fc0
movq %r12, %rdx
jmp 0x7d153
movq 0x30(%rsp), %r14
leal -0x2(%r14), %eax
shrl $0x1f, %eax
addl %r14d, %eax
addl $-0x2, %eax
sarl %eax
movq 0x28(%rsp), %rbp
leal -0x1(%rbp), %ecx
shrl $0x1f, %ecx
addl %ebp, %ecx
decl %ecx
sarl %ecx
addl 0x8(%rsp), %eax
leal (%rcx,%r13), %edx
shlq $0x20, %rdx
orq %rax, %rdx
leaq 0x48(%rsp), %rsi
movq %rdx, (%rsi)
subl %ecx, %r12d
shlq $0x20, %r12
orq %rax, %r12
leaq 0x40(%rsp), %rdx
movq %r12, (%rdx)
movq 0x20(%rsp), %rbx
movq %rbx, %rdi
movl $0x2, %ecx
callq 0x58fc0
movq %rbp, %rdx
movq %r14, %rbp
cmpw $0x1, 0x1a0(%r15)
movl $0x0, %r12d
movq 0x60(%rsp), %rax
jne 0x7d299
subl %edx, %eax
cvtsi2sd %eax, %xmm0
movl 0x5dc(%r15), %eax
movl 0x5d8(%r15), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm1
movq 0x5d0(%r15), %rax
movl (%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm2
divsd %xmm1, %xmm0
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %r13d
addl 0x8(%rsp), %r13d
movl 0x5c8(%r15), %r14d
decl %r14d
movq %rbx, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm3
cvtsi2sd %r14d, %xmm4
mulsd %xmm3, %xmm4
xorpd %xmm1, %xmm1
movapd %xmm4, %xmm5
cmpltsd %xmm1, %xmm5
movsd 0x771b3(%rip), %xmm0    # 0xf4390
movapd %xmm5, %xmm6
andpd %xmm0, %xmm6
movsd 0x771ab(%rip), %xmm2    # 0xf4398
andnpd %xmm2, %xmm5
orpd %xmm6, %xmm5
addsd %xmm4, %xmm5
cvttsd2si %xmm5, %rax
mulsd 0x77572(%rip), %xmm3    # 0xf4778
movapd %xmm3, %xmm4
cmpltsd %xmm1, %xmm4
movapd %xmm4, %xmm5
andpd %xmm0, %xmm5
andnpd %xmm2, %xmm4
orpd %xmm5, %xmm4
addsd %xmm3, %xmm4
cvttsd2si %xmm4, %rcx
xorps %xmm3, %xmm3
cvtsi2sd %eax, %xmm3
movsd 0x772b9(%rip), %xmm4    # 0xf44f0
divsd %xmm4, %xmm3
movapd %xmm3, %xmm5
cmpltsd %xmm1, %xmm5
movapd %xmm5, %xmm6
andpd %xmm0, %xmm6
andnpd %xmm2, %xmm5
orpd %xmm6, %xmm5
addsd %xmm3, %xmm5
cvttsd2si %xmm5, %rax
xorps %xmm3, %xmm3
cvtsi2sd %ecx, %xmm3
divsd %xmm4, %xmm3
movapd %xmm3, %xmm4
cmpltsd %xmm1, %xmm4
andpd %xmm4, %xmm0
andnpd %xmm2, %xmm4
orpd %xmm0, %xmm4
addsd %xmm3, %xmm4
cvttsd2si %xmm4, %rcx
addl %r13d, %eax
incl %eax
movq 0x38(%rsp), %rbp
addl %ebp, %ecx
incl %ecx
jmp 0x7d3ce
notl %edx
addl %ebp, %edx
cvtsi2sd %edx, %xmm0
movl 0x5dc(%r15), %eax
movl 0x5d8(%r15), %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm1
movq 0x5d0(%r15), %rax
movl (%rax), %eax
subl %ecx, %eax
cvtsi2sd %eax, %xmm2
divsd %xmm1, %xmm0
mulsd %xmm0, %xmm2
cvttsd2si %xmm2, %eax
subl %eax, %edx
addl 0x38(%rsp), %edx
movq %rdx, %rbp
movl 0x5c8(%r15), %r14d
decl %r14d
movq %rbx, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm3
movsd 0x77480(%rip), %xmm4    # 0xf4778
mulsd %xmm3, %xmm4
xorpd %xmm1, %xmm1
movapd %xmm4, %xmm5
cmpltsd %xmm1, %xmm5
movsd 0x7707f(%rip), %xmm0    # 0xf4390
movapd %xmm5, %xmm6
andpd %xmm0, %xmm6
movsd 0x77077(%rip), %xmm2    # 0xf4398
andnpd %xmm2, %xmm5
orpd %xmm6, %xmm5
addsd %xmm4, %xmm5
cvttsd2si %xmm5, %rax
xorps %xmm4, %xmm4
cvtsi2sd %r14d, %xmm4
mulsd %xmm3, %xmm4
movapd %xmm4, %xmm3
cmpltsd %xmm1, %xmm3
movapd %xmm3, %xmm5
andpd %xmm0, %xmm5
andnpd %xmm2, %xmm3
orpd %xmm5, %xmm3
addsd %xmm4, %xmm3
cvttsd2si %xmm3, %rcx
xorps %xmm3, %xmm3
cvtsi2sd %eax, %xmm3
movsd 0x77181(%rip), %xmm4    # 0xf44f0
divsd %xmm4, %xmm3
movapd %xmm3, %xmm5
cmpltsd %xmm1, %xmm5
movapd %xmm5, %xmm6
andpd %xmm0, %xmm6
andnpd %xmm2, %xmm5
orpd %xmm6, %xmm5
addsd %xmm3, %xmm5
cvttsd2si %xmm5, %rax
xorps %xmm3, %xmm3
cvtsi2sd %ecx, %xmm3
divsd %xmm4, %xmm3
movapd %xmm3, %xmm4
cmpltsd %xmm1, %xmm4
andpd %xmm4, %xmm0
andnpd %xmm2, %xmm4
orpd %xmm0, %xmm4
addsd %xmm3, %xmm4
cvttsd2si %xmm4, %rcx
movq 0x8(%rsp), %r13
addl %r13d, %eax
addl $0x2, %eax
addl %ebp, %ecx
addl $0x2, %ecx
movl %r13d, 0x10(%rsp)
movl %ebp, 0x14(%rsp)
movl %eax, 0x18(%rsp)
movl %ecx, 0x1c(%rsp)
movq 0xefbc2(%rip), %rax     # 0x16cfa8
movl (%rax), %ecx
cmpb $0x0, 0x5c4(%r15)
je 0x7d407
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
movq 0xef3a3(%rip), %rdx     # 0x16c7a8
jmp 0x7d41a
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
movq 0xef0b6(%rip), %rdx     # 0x16c4d0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x57930
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
callq 0x57890
movq %rbx, %rdi
callq 0x58780
movl %r12d, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq