// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/basic/scrollbar.cpp
// Function: smooth::GUI::Scrollbar::OnMouseDrag(smooth::GUI::Point const&)
S::Void S::GUI::Scrollbar::OnMouseDrag(const Point &mousePos)
{
	Point	 realPos  = GetRealPosition();
	Size	 realSize = GetRealSize();

	Int	 value = 0;

	Surface	*surface	= GetDrawSurface();

	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;

	if (subtype == OR_HORZ)	value = Math::Round((((Float) (endValue - startValue)) / ((Float) realSize.cx - 3 * (hotspotSize + 4))) * ((Float) (mousePos.x - clickOffset - (realPos.x + hotspotSize + 4))));
	else			value = Math::Round((((Float) (endValue - startValue)) / ((Float) realSize.cy - 3 * (hotspotSize + 4))) * ((Float) (mousePos.y - clickOffset - (realPos.y + hotspotSize + 4))));

	SetValue(startValue + value);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x50, %rsp
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x40(%rbp)
movq (%rdi), %rax
callq *0x48(%rax)
movq -0x40(%rbp), %rdi
movq %rax, -0x18(%rbp)
movq (%rdi), %rax
callq *0x50(%rax)
movq -0x40(%rbp), %rdi
movq %rax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %rcx
movq -0x40(%rbp), %rax
movq %rcx, -0x30(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0x9f9ed
movq -0x40(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movb $0x1, %al
cmpl $0x37, %ecx
movb %al, -0x41(%rbp)
jle 0x9fa1a
movq -0x40(%rbp), %rax
movswl 0x1a0(%rax), %ecx
xorl %eax, %eax
cmpl $0x2, %ecx
movb %al, -0x42(%rbp)
jne 0x9fa14
movq -0x40(%rbp), %rdi
callq 0x5b860
cmpl $0x37, %eax
setle %al
movb %al, -0x42(%rbp)
movb -0x42(%rbp), %al
movb %al, -0x41(%rbp)
movb -0x41(%rbp), %al
andb $0x1, %al
movb %al, -0x31(%rbp)
testb $0x1, -0x31(%rbp)
je 0x9fa32
movl $0xa, %eax
movl %eax, -0x48(%rbp)
jmp 0x9fa62
movq -0x40(%rbp), %rax
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0x9fa50
movq -0x40(%rbp), %rdi
callq 0x5b860
movl %eax, -0x4c(%rbp)
jmp 0x9fa5c
movq -0x40(%rbp), %rdi
callq 0x5a210
movl %eax, -0x4c(%rbp)
movl -0x4c(%rbp), %eax
movl %eax, -0x48(%rbp)
movl -0x48(%rbp), %eax
movl %eax, -0x50(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movl -0x50(%rbp), %eax
movswl %cx, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0xe7a37(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movq %rax, %rcx
movq -0x40(%rbp), %rax
subq $0x4, %rcx
movl %ecx, -0x38(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0x9fb03
movq -0x40(%rbp), %rcx
movl 0x5dc(%rcx), %eax
subl 0x5d8(%rcx), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0x20(%rbp), %xmm1
movl -0x38(%rbp), %eax
addl $0x4, %eax
imull $0x3, %eax, %eax
cvtsi2sd %eax, %xmm2
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movl (%rax), %eax
subl 0x63c(%rcx), %eax
movl -0x18(%rbp), %ecx
addl -0x38(%rbp), %ecx
addl $0x4, %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0x24(%rbp)
jmp 0x9fb59
movq -0x40(%rbp), %rcx
movl 0x5dc(%rcx), %eax
subl 0x5d8(%rcx), %eax
cvtsi2sd %eax, %xmm0
cvtsi2sdl -0x1c(%rbp), %xmm1
movl -0x38(%rbp), %eax
addl $0x4, %eax
imull $0x3, %eax, %eax
cvtsi2sd %eax, %xmm2
subsd %xmm2, %xmm1
divsd %xmm1, %xmm0
movq -0x10(%rbp), %rax
movl 0x4(%rax), %eax
subl 0x63c(%rcx), %eax
movl -0x14(%rbp), %ecx
addl -0x38(%rbp), %ecx
addl $0x4, %ecx
subl %ecx, %eax
cvtsi2sd %eax, %xmm1
mulsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0x24(%rbp)
movq -0x40(%rbp), %rdi
movl 0x5d8(%rdi), %esi
addl -0x24(%rbp), %esi
callq 0x5b550
addq $0x50, %rsp
popq %rbp
retq
nopw %cs:(%rax,%rax)