// File: /workspace/github_c_makefile_star2_O2/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 0x59530
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x88(%rax)
testb %al, %al
je 0x7a0b8
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x90(%rax)
testb %al, %al
je 0x7a0b8
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, %r12
movq %rax, %rbp
shrq $0x20, %rbp
movzwl 0x1a0(%rbx), %eax
cmpl $0x2, %eax
movq %r15, 0x28(%rsp)
je 0x79f10
cmpl $0x1, %eax
jne 0x79f1f
cmpl $0x38, 0xb0(%rbx)
jl 0x79f19
movl 0xb4(%rbx), %r15d
jmp 0x79f26
cmpl $0x38, 0xb4(%rbx)
jge 0x79f1f
pushq $0xa
popq %r15
jmp 0x79f26
movl 0xb0(%rbx), %r15d
movq %r14, %rdi
callq 0x59c60
cwtl
imull %r15d, %eax
cvtsi2sd %eax, %xmm0
divsd 0x695d1(%rip), %xmm0    # 0xe3510
xorpd %xmm1, %xmm1
xorl %eax, %eax
ucomisd %xmm0, %xmm1
seta %al
leaq 0x6985d(%rip), %rcx     # 0xe37b0
addsd (%rcx,%rax,8), %xmm0
cvttsd2si %xmm0, %rcx
movzwl 0x1a0(%rbx), %edx
leal (%rcx,%rcx), %esi
xorl %eax, %eax
cmpw $0x1, %dx
movl $0x0, %edi
cmovel %esi, %edi
negl %esi
cmpw $0x1, %dx
movl %ecx, %r8d
cmovel %eax, %r8d
movl $0x0, %r9d
cmovel %ecx, %r9d
cmovel %eax, %esi
movq 0x28(%rsp), %r11
addl %r11d, %r9d
addl %r13d, %r8d
movl %r12d, %r10d
subl %edi, %r10d
movl %r9d, 0x18(%rsp)
movl %r8d, 0x1c(%rsp)
addl %r9d, %r10d
movl %r10d, 0x20(%rsp)
addl %ebp, %r8d
addl %esi, %r8d
movl %r8d, 0x24(%rsp)
movl 0x5dc(%rbx), %esi
movl 0x5d8(%rbx), %edi
subl %edi, %esi
movq 0x5d0(%rbx), %r8
movl (%r8), %r8d
leal (%rcx,%rcx,2), %r9d
cvtsi2sd %r9d, %xmm2
cvtsi2sd %esi, %xmm1
subl %edi, %r8d
cvtsi2sd %r8d, %xmm0
cmpw $0x1, %dx
jne 0x7a00e
cvtsi2sd %r12d, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %eax
addl %ecx, %eax
xorl %edx, %edx
movl %ecx, %r12d
jmp 0x7a026
cvtsi2sd %ebp, %xmm3
subsd %xmm2, %xmm3
divsd %xmm1, %xmm3
mulsd %xmm0, %xmm3
cvttsd2si %xmm3, %edx
addl %ecx, %edx
movl %ecx, %ebp
addl %r11d, %eax
addl %r13d, %edx
movl %eax, 0x8(%rsp)
movl %edx, 0xc(%rsp)
addl %r12d, %eax
movl %eax, 0x10(%rsp)
addl %ebp, %edx
movl %edx, 0x14(%rsp)
leaq 0x18(%rsp), %r15
movq %r14, %rdi
movq %r15, %rsi
callq 0x56160
movq 0xe7f50(%rip), %r12     # 0x161fa8
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
andq $0x0, (%r8)
movq 0xe773c(%rip), %rdx     # 0x1617a8
movq %r14, %rdi
movq %r15, %rsi
callq 0x58b80
cmpb $0x0, 0x638(%rbx)
jne 0x7a0a1
movl (%r12), %ecx
leaq 0x30(%rsp), %r8
andq $0x0, (%r8)
movq 0xe743c(%rip), %rdx     # 0x1614d0
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
callq 0x58b80
leaq 0x8(%rsp), %rsi
movq %r14, %rdi
xorl %edx, %edx
callq 0x58ad0
movq %r14, %rdi
callq 0x59a80
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop