// File: /workspace/github_c_makefile_star2_O3/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, %ecx       # imm = 0xFFFFFFFF
testb %al, %al
je 0x7d09f
movq (%r15), %rax
movq %r15, %rdi
callq *0x90(%rax)
xorl %ecx, %ecx
testb %al, %al
je 0x7d09f
movq (%r15), %rax
movq %r15, %rdi
callq *0x40(%rax)
movq %rax, %r13
movq (%r15), %rax
movq %r15, %rdi
callq *0x48(%rax)
movq %rax, %r12
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 0x76aa1(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %cl
xorpd %xmm1, %xmm1
movapd %xmm1, 0x10(%rsp)
testl %ebp, %ebp
jne 0x7d09d
movq %r13, %rsi
movq %r12, %r13
shrq $0x20, %r13
movq %rbx, %rdx
movb %cl, %al
leaq 0x76ba4(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movq %rax, 0x38(%rsp)
shrq $0x20, %rdx
leaq 0x50(%rsp), %rbp
movl %r12d, (%rbp)
movl %r13d, 0x4(%rbp)
movq %rbx, 0x60(%rsp)
addl %r12d, %ebx
movl %ebx, 0x8(%rbp)
movq %rsi, %rdi
movq %rsi, 0x30(%rsp)
movq %rdx, 0x28(%rsp)
leal (%rdx,%r13), %r14d
movl %r14d, 0xc(%rbp)
movq %rbp, %rsi
callq 0x55160
movq %r12, 0x8(%rsp)
movl %r12d, (%rbp)
movq %r13, 0x40(%rsp)
movl %r13d, 0x4(%rbp)
movl %ebx, 0x8(%rbp)
movl %r14d, 0xc(%rbp)
movq (%r15), %rax
movq %r15, %rdi
callq *0x140(%rax)
movq 0xef2e8(%rip), %rcx     # 0x16bfa8
movl (%rcx), %ecx
leaq 0x48(%rsp), %r8
movq $0x0, (%r8)
leaq 0x50(%rsp), %rsi
movq 0x30(%rsp), %rdi
movq %rax, %rdx
callq 0x57930
cmpw $0x1, 0x1a0(%r15)
jne 0x7cd53
movq 0x38(%rsp), %rbp
leal -0x1(%rbp), %eax
shrl $0x1f, %eax
addl %ebp, %eax
decl %eax
sarl %eax
movq 0x28(%rsp), %rdx
leal -0x2(%rdx), %ecx
shrl $0x1f, %ecx
addl %edx, %ecx
addl $-0x2, %ecx
sarl %ecx
movq 0x8(%rsp), %rdx
addl %eax, %edx
movq 0x40(%rsp), %r13
addl %r13d, %ecx
shlq $0x20, %rcx
orq %rcx, %rdx
leaq 0x50(%rsp), %rsi
movq %rdx, (%rsi)
subl %eax, %ebx
orq %rcx, %rbx
leaq 0x48(%rsp), %rdx
movq %rbx, (%rdx)
movq 0x30(%rsp), %r12
movq %r12, %rdi
movl $0x1, %ecx
callq 0x58fc0
movq %r13, %rdx
movq %rbp, %r13
jmp 0x7cdba
movq 0x28(%rsp), %rcx
leal -0x2(%rcx), %eax
shrl $0x1f, %eax
addl %ecx, %eax
addl $-0x2, %eax
sarl %eax
movq 0x38(%rsp), %r13
leal -0x1(%r13), %ecx
shrl $0x1f, %ecx
addl %r13d, %ecx
decl %ecx
sarl %ecx
addl 0x8(%rsp), %eax
movq 0x40(%rsp), %rbx
leal (%rcx,%rbx), %edx
shlq $0x20, %rdx
orq %rax, %rdx
leaq 0x50(%rsp), %rsi
movq %rdx, (%rsi)
subl %ecx, %r14d
shlq $0x20, %r14
orq %rax, %r14
leaq 0x48(%rsp), %rdx
movq %r14, (%rdx)
movq 0x30(%rsp), %r12
movq %r12, %rdi
movl $0x2, %ecx
callq 0x58fc0
movq %rbx, %rdx
cmpw $0x1, 0x1a0(%r15)
movq 0x60(%rsp), %rax
jne 0x7cef9
subl %r13d, %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, %r14d
addl 0x8(%rsp), %r14d
movq %rdx, %rbp
movq %r12, %r13
movl 0x5c8(%r15), %r12d
decl %r12d
movq %r13, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
movapd 0x793ae(%rip), %xmm1    # 0xf61e0
cvtsi2sd %r12d, %xmm1
movq %r13, %r12
movq %rbp, %rcx
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm1, %xmm0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpltpd %xmm1, %xmm2
movapd 0x766d6(%rip), %xmm3    # 0xf3530
movapd 0x766de(%rip), %xmm4    # 0xf3540
movapd %xmm4, %xmm5
andpd %xmm2, %xmm5
andnpd %xmm3, %xmm2
orpd %xmm5, %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, %xmm0
divpd 0x76682(%rip), %xmm0    # 0xf3520
movapd %xmm0, %xmm2
cmpltpd %xmm1, %xmm2
andpd %xmm2, %xmm4
andnpd %xmm3, %xmm2
orpd %xmm4, %xmm2
addpd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %xmm0
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
pshufd $0xe8, %xmm0, %xmm1     # xmm1 = xmm0[0,2,2,3]
movd %r14d, %xmm0
movd %ecx, %xmm2
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
paddd %xmm1, %xmm0
pcmpeqd %xmm1, %xmm1
psubd %xmm1, %xmm0
movl %r14d, %ebp
jmp 0x7d025
notl %r13d
addl 0x28(%rsp), %r13d
cvtsi2sd %r13d, %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, %r13d
addl %edx, %r13d
movl 0x5c8(%r15), %r14d
decl %r14d
movq %r12, %rdi
callq 0x58930
cwtl
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
xorps %xmm1, %xmm1
cvtsi2sd %r14d, %xmm1
movapd 0x7925b(%rip), %xmm2    # 0xf61c0
unpcklpd %xmm1, %xmm2            # xmm2 = xmm2[0],xmm1[0]
unpcklpd %xmm0, %xmm0            # xmm0 = xmm0[0,0]
mulpd %xmm2, %xmm0
xorpd %xmm1, %xmm1
movapd %xmm0, %xmm2
cmpltpd %xmm1, %xmm2
movapd 0x765aa(%rip), %xmm3    # 0xf3530
movapd 0x765b2(%rip), %xmm4    # 0xf3540
movapd %xmm4, %xmm5
andpd %xmm2, %xmm5
andnpd %xmm3, %xmm2
orpd %xmm5, %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, %xmm0
divpd 0x76556(%rip), %xmm0    # 0xf3520
movapd %xmm0, %xmm2
cmpltpd %xmm1, %xmm2
andpd %xmm2, %xmm4
andnpd %xmm3, %xmm2
orpd %xmm4, %xmm2
addpd %xmm0, %xmm2
cvttsd2si %xmm2, %rax
movq %rax, %xmm0
unpckhpd %xmm2, %xmm2            # xmm2 = xmm2[1,1]
cvttsd2si %xmm2, %rax
movq %rax, %xmm1
punpcklqdq %xmm1, %xmm0    # xmm0 = xmm0[0],xmm1[0]
pshufd $0xe8, %xmm0, %xmm1     # xmm1 = xmm0[0,2,2,3]
movd %r13d, %xmm2
movq 0x8(%rsp), %rbp
movd %ebp, %xmm0
punpckldq %xmm2, %xmm0    # xmm0 = xmm0[0],xmm2[0],xmm0[1],xmm2[1]
paddd %xmm1, %xmm0
paddd 0x791ae(%rip), %xmm0    # 0xf61d0
movl %r13d, %ecx
movl %ebp, 0x10(%rsp)
movl %ecx, 0x14(%rsp)
movd %xmm0, 0x18(%rsp)
pshufd $0x55, %xmm0, %xmm0     # xmm0 = xmm0[1,1,1,1]
movd %xmm0, 0x1c(%rsp)
movq 0xeef63(%rip), %rax     # 0x16bfa8
movl (%rax), %ecx
cmpb $0x0, 0x5c4(%r15)
je 0x7d066
leaq 0x50(%rsp), %r8
movq $0x0, (%r8)
movq 0xee744(%rip), %rdx     # 0x16b7a8
jmp 0x7d079
leaq 0x50(%rsp), %r8
movq $0x0, (%r8)
movq 0xee457(%rip), %rdx     # 0x16b4d0
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
callq 0x57930
leaq 0x10(%rsp), %rsi
movq %r12, %rdi
xorl %edx, %edx
callq 0x57890
movq %r12, %rdi
callq 0x58780
xorl %ecx, %ecx
movl %ecx, %eax
addq $0x68, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq