// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/scrollbar.cpp
// Function: smooth::GUI::Scrollbar::OnValueChange()
S::Void S::GUI::Scrollbar::OnValueChange()
{
	UpdateHotspotPositions();

	if (!IsRegistered() || !IsVisible()) return;

	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	 backFrame	= Rect(realPos + (subtype == OR_HORZ ? Point(hotspotSize + 4, 0) : Point(0, hotspotSize + 4)), realSize - (subtype == OR_HORZ ? Size(2 * (hotspotSize + 4), 0) : Size(0, 2 * (hotspotSize + 4))));
	Rect	 sliderFrame	= Rect(realPos + (subtype == OR_HORZ ? Point(hotspotSize + 4 + (Int) (((Float) realSize.cx - 3 * (hotspotSize + 4)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue))), 0) : Point(0, hotspotSize + 4 + (Int) (((Float) realSize.cy - 3 * (hotspotSize + 4)) / ((Float) (endValue - startValue)) * ((Float) (*variable - startValue))))), subtype == OR_HORZ ? Size(hotspotSize + 4, realSize.cy) : Size(realSize.cx, hotspotSize + 4));

	surface->StartPaint(backFrame);

	surface->Box(backFrame, Setup::LightGrayColor, Rect::Filled);

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

	surface->Frame(sliderFrame, FRAME_UP);

	surface->EndPaint();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
callq 0x58280
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x88(%rax)
testb %al, %al
je 0x7b5e2
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7b5e2
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x40(%rax)
movq %rax, %r14
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x48(%rax)
movq %rax, %r15
movq %rax, %r13
shrq $0x20, %r13
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x50(%rax)
movq %rax, %rbp
shrq $0x20, %rbp
movzwl 0x1a0(%rbx), %ecx
cmpl $0x2, %ecx
movq %rax, 0x8(%rsp)
je 0x7b43b
cmpl $0x1, %ecx
jne 0x7b44a
movl $0xa, %r12d
cmpl $0x38, 0xb0(%rbx)
jl 0x7b451
movl 0xb4(%rbx), %r12d
jmp 0x7b451
movl $0xa, %r12d
cmpl $0x38, 0xb4(%rbx)
jl 0x7b451
movl 0xb0(%rbx), %r12d
movq %r14, %rdi
callq 0x58930
cwtl
imull %r12d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x7824e(%rip), %xmm0    # 0xf36b8
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x78372(%rip), %rcx     # 0xf37f0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rax
movzwl 0x1a0(%rbx), %ecx
cmpw $0x1, %cx
jne 0x7b4a7
movl %r15d, %edi
addl %eax, %edi
movq %rax, %r8
addq %rax, %r8
xorl %esi, %esi
movl %r13d, %edx
jmp 0x7b4b6
leal (%rax,%r13), %edx
leal (%rax,%rax), %esi
negl %esi
xorl %r8d, %r8d
movl %r15d, %edi
movq 0x8(%rsp), %r10
movl %r10d, %r9d
subl %r8d, %r9d
movl %edi, 0x20(%rsp)
movl %edx, 0x24(%rsp)
addl %edi, %r9d
movl %r9d, 0x28(%rsp)
addl %ebp, %edx
addl %esi, %edx
movl %edx, 0x2c(%rsp)
movl 0x5dc(%rbx), %edx
movl 0x5d8(%rbx), %esi
subl %esi, %edx
movq 0x5d0(%rbx), %rdi
movl (%rdi), %edi
leal (%rax,%rax,2), %r8d
cvtsi2sd %r8d, %xmm2
xorps %xmm1, %xmm1
cvtsi2sd %edx, %xmm1
subl %esi, %edi
xorps %xmm0, %xmm0
cvtsi2sd %edi, %xmm0
cmpw $0x1, %cx
jne 0x7b52e
cvtsi2sd %r10d, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %edx
addl %eax, %edx
addl %r15d, %edx
movl %edx, %r15d
jmp 0x7b54d
cvtsi2sd %ebp, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %ecx
addl %eax, %r13d
addl %ecx, %r13d
movl %eax, %ebp
movl %r10d, %eax
movl %r15d, 0x10(%rsp)
movl %r13d, 0x14(%rsp)
addl %r15d, %eax
movl %eax, 0x18(%rsp)
addl %r13d, %ebp
movl %ebp, 0x1c(%rsp)
leaq 0x20(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x55160
movq 0xf0a2c(%rip), %r12     # 0x16bfa8
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
movq $0x0, (%r8)
movq 0xf0215(%rip), %rdx     # 0x16b7a8
movq %r14, %rdi
movq %r15, %rsi
callq 0x57930
cmpb $0x0, 0x638(%rbx)
jne 0x7b5cb
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
movq $0x0, (%r8)
movq 0xeff12(%rip), %rdx     # 0x16b4d0
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
callq 0x57930
leaq 0x10(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x57890
movq %r14, %rdi
callq 0x58780
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop