// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/gui/widgets/basic/titlebar.cpp
// Function: smooth::GUI::Titlebar::DragHitTest(smooth::GUI::Point const&)
S::Bool S::GUI::Titlebar::DragHitTest(const Point &mousePos)
{
	Surface	*surface    = GetDrawSurface();
	Window	*window	    = container->GetContainerWindow();

#ifdef __WIN32__
	static Bool	 flatStyle = Backends::BackendWin32::IsWindowsVersionAtLeast(VER_PLATFORM_WIN32_NT, 6, 2);
#else
	static Bool	 flatStyle = False;
#endif

	Rect	 titleFrame = Rect(Point(0,0), GetRealSize());
	Rect	 buttonRect = Rect(Point(titleFrame.right - Math::Round(4 * surface->GetSurfaceDPI() / 96.0) - Math::Round((5 + 10 * (Binary::IsFlagSet(flags, TB_MINBUTTON) || Binary::IsFlagSet(flags, TB_MAXBUTTON) ? 3 : 1)) * surface->GetSurfaceDPI() / 96.0) + (flatStyle ? 2 : 0), titleFrame.top + (flatStyle ? 4 : 3)),
				   Size(Math::Round((5 + 10 * (Binary::IsFlagSet(flags, TB_MINBUTTON) || Binary::IsFlagSet(flags, TB_MAXBUTTON) ? 3 : 1)) * surface->GetSurfaceDPI() / 96.0) - (flatStyle ? 5 : 1), titleFrame.GetHeight() - (flatStyle ? 9 : 6)));

	if (!flatStyle && window->GetIcon() != NIL) titleFrame.left += titleFrame.GetHeight() - 1;

	if (flatStyle && (Binary::IsFlagSet(flags, TB_MINBUTTON) || Binary::IsFlagSet(flags, TB_MAXBUTTON))) buttonRect.left -= 2;

	return ((mousePos.x >= titleFrame.left && mousePos.y >= titleFrame.top && mousePos.x <= titleFrame.right && mousePos.y <= titleFrame.bottom) &&
	       !(mousePos.x >= buttonRect.left && mousePos.y >= buttonRect.top && mousePos.x <= buttonRect.right && mousePos.y <= buttonRect.bottom));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, 0x30(%rsp)
movq %rdi, %r13
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, %r12
movq 0x190(%r13), %rdi
callq 0x559e0
movq %rax, %r15
movq (%r13), %rax
movq %r13, %rdi
callq *0x50(%rax)
movq %rax, %rbx
movq %rax, 0x28(%rsp)
shrq $0x20, %rbx
movq %r12, %rdi
callq 0x58930
cwtl
shll $0x2, %eax
cvtsi2sd %eax, %xmm0
divsd 0x74238(%rip), %xmm0    # 0xf44f0
xorpd %xmm1, %xmm1
movsd %xmm0, 0x20(%rsp)
ucomisd %xmm0, %xmm1
seta 0xf(%rsp)
movl 0x30(%r13), %edi
movl $0x1, %esi
callq 0x583f0
movl $0x23, %ebp
movl $0x23, %r14d
testb %al, %al
jne 0x80307
movl 0x30(%r13), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
movl $0x23, %eax
movl $0xf, %r14d
cmovnel %eax, %r14d
movq %r12, %rdi
callq 0x58930
cwtl
imull %r14d, %eax
xorps %xmm0, %xmm0
cvtsi2sd %eax, %xmm0
divsd 0x741cd(%rip), %xmm0    # 0xf44f0
xorl %r14d, %r14d
movsd %xmm0, 0x18(%rsp)
xorpd %xmm1, %xmm1
ucomisd %xmm0, %xmm1
seta 0xe(%rsp)
movl 0x30(%r13), %edi
movl $0x1, %esi
callq 0x583f0
testb %al, %al
jne 0x80368
movl 0x30(%r13), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
movl $0x23, %eax
movl $0xf, %ebp
cmovnel %eax, %ebp
movq %r12, %rdi
callq 0x58930
cwtl
imull %ebp, %eax
xorps %xmm1, %xmm1
cvtsi2sd %eax, %xmm1
divsd 0x7416d(%rip), %xmm1    # 0xf44f0
xorpd %xmm0, %xmm0
xorl %r12d, %r12d
movsd %xmm1, 0x10(%rsp)
ucomisd %xmm1, %xmm0
seta %r13b
addq $0x5d0, %r15            # imm = 0x5D0
xorl %ebp, %ebp
movq %r15, %rdi
xorl %esi, %esi
callq 0x563f0
leal -0x1(%rbx), %ecx
testb %al, %al
cmovel %ebp, %ecx
movq 0x30(%rsp), %rdx
movl (%rdx), %eax
cmpl %ecx, %eax
jl 0x80463
movl 0x4(%rdx), %ecx
testl %ecx, %ecx
sets %dl
movq 0x28(%rsp), %r8
cmpl %r8d, %eax
setg %sil
cmpl %ebx, %ecx
setg %dil
orb %dl, %sil
orb %dil, %sil
je 0x803e8
xorl %ebp, %ebp
jmp 0x80463
xorl %esi, %esi
movb 0xf(%rsp), %dl
movb %dl, %sil
movb 0xe(%rsp), %dl
movb %dl, %r14b
leaq 0x74391(%rip), %rdx     # 0xf4790
movsd 0x20(%rsp), %xmm0
addsd (%rdx,%rsi,8), %xmm0
movsd 0x18(%rsp), %xmm1
addsd (%rdx,%r14,8), %xmm1
cvttsd2si %xmm0, %rsi
cvttsd2si %xmm1, %rdi
addl %edi, %esi
movb %r13b, %r12b
movsd 0x10(%rsp), %xmm0
addsd (%rdx,%r12,8), %xmm0
subl %esi, %r8d
cvttsd2si %xmm0, %rdx
addl %r8d, %edx
decl %edx
addl $-0x3, %ebx
cmpl %r8d, %eax
setl %sil
cmpl $0x3, %ecx
setl %dil
orb %sil, %dil
cmpl %edx, %eax
setg %al
orb %dil, %al
cmpl %ebx, %ecx
setg %bpl
orb %al, %bpl
movl %ebp, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq