// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/multi/menu/micromenu.cpp
// Function: smooth::GUI::MicroMenu::OpenPopupMenu()
S::Void S::GUI::MicroMenu::OpenPopupMenu()
{
	if (popup == NIL) return;

	Widget	*window	     = container->GetContainerWindow();
	Surface	*surface     = GetDrawSurface();

	if (window == NIL) return;

	hotspot->Deactivate();

	Rect	 monitor     = System::Screen::GetActiveScreenWorkArea();
	Float	 scaleFactor = surface->GetSurfaceDPI() / 96.0;

	popup->CalculateSize();

	Point	 realPos     = GetRealPosition();
	Size	 realSize    = GetRealSize();

	Point	 popupPos    = realPos + Point(subtype == OR_HORZ ? realSize.cx : 0, subtype == OR_VERT ? realSize.cy : 0);
	Size	 popupSize   = popup->GetSize();

	if (!IsRightToLeft()) { if (window->GetX() + popupPos.x			       + Math::Round(popupSize.cx * scaleFactor) >= monitor.right) popupPos.x = realPos.x - Math::Round(popupSize.cx * scaleFactor) + (subtype == OR_VERT ? realSize.cx : 0); }
	else		      { if (window->GetX() + (window->GetWidth() - popupPos.x) - Math::Round(popupSize.cx * scaleFactor) <  monitor.left)  popupPos.x = realPos.x - Math::Round(popupSize.cx * scaleFactor) + (subtype == OR_VERT ? realSize.cx : 0); }

	if (window->GetY() + popupPos.y + Math::Round(popupSize.cy * scaleFactor) >= monitor.bottom) popupPos.y = realPos.y - Math::Round(popupSize.cy * scaleFactor) + (subtype == OR_HORZ ? GetHeight() : 0);

	popup->SetPosition(popupPos);
	popup->internalRequestClose.Connect(&MicroMenu::ClosePopupMenu, this);

	onOpenPopupMenu.Emit();

	Add(popup);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xf0, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rax
movq %rax, -0x70(%rbp)
cmpq $0x0, 0x690(%rax)
jne 0xbf106
jmp 0xbf4ae
movq -0x70(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x59bc0
movq -0x70(%rbp), %rdi
movq %rax, -0x10(%rbp)
movq (%rdi), %rax
callq *0x40(%rax)
movq %rax, -0x18(%rbp)
cmpq $0x0, -0x10(%rbp)
jne 0xbf134
jmp 0xbf4ae
movq -0x70(%rbp), %rax
movq 0x688(%rax), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
callq 0x5c790
movq %rax, -0x28(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x18(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movq -0x70(%rbp), %rax
movswl %cx, %ecx
cvtsi2sd %ecx, %xmm0
movsd 0xc834f(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
movsd %xmm0, -0x30(%rbp)
movq 0x690(%rax), %rdi
callq 0x5dbb0
movq -0x70(%rbp), %rdi
movq (%rdi), %rax
callq *0x48(%rax)
movq -0x70(%rbp), %rdi
movq %rax, -0x38(%rbp)
movq (%rdi), %rax
callq *0x50(%rax)
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x40(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xbf1bd
movl -0x40(%rbp), %eax
movl %eax, -0x74(%rbp)
jmp 0xbf1c4
xorl %eax, %eax
movl %eax, -0x74(%rbp)
jmp 0xbf1c4
movq -0x70(%rbp), %rax
movl -0x74(%rbp), %ecx
movl %ecx, -0x78(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x2, %eax
jne 0xbf1e2
movl -0x3c(%rbp), %eax
movl %eax, -0x7c(%rbp)
jmp 0xbf1e9
xorl %eax, %eax
movl %eax, -0x7c(%rbp)
jmp 0xbf1e9
movl -0x78(%rbp), %esi
movl -0x7c(%rbp), %edx
leaq -0x50(%rbp), %rdi
callq 0x5c2c0
leaq -0x38(%rbp), %rdi
leaq -0x50(%rbp), %rsi
callq 0x5ca20
movq %rax, %rcx
movq -0x70(%rbp), %rax
movq %rcx, -0x48(%rbp)
movq 0x690(%rax), %rdi
callq 0x5bf70
movq -0x70(%rbp), %rdi
movq (%rax), %rax
movq %rax, -0x58(%rbp)
movq (%rdi), %rax
callq *0x160(%rax)
testb $0x1, %al
jne 0xbf2e0
movq -0x10(%rbp), %rdi
callq 0x5dab0
addl -0x48(%rbp), %eax
cltq
movq %rax, -0x88(%rbp)
cvtsi2sdl -0x58(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq %rax, %rcx
movq -0x88(%rbp), %rax
addq %rcx, %rax
movslq -0x20(%rbp), %rcx
cmpq %rcx, %rax
jl 0xbf2db
movslq -0x38(%rbp), %rax
movq %rax, -0x98(%rbp)
cvtsi2sdl -0x58(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq -0x98(%rbp), %rcx
movq %rax, %rdx
movq -0x70(%rbp), %rax
subq %rdx, %rcx
movq %rcx, -0x90(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x2, %eax
jne 0xbf2bb
movl -0x40(%rbp), %eax
movl %eax, -0x9c(%rbp)
jmp 0xbf2c5
xorl %eax, %eax
movl %eax, -0x9c(%rbp)
jmp 0xbf2c5
movq -0x90(%rbp), %rax
movl -0x9c(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x48(%rbp)
jmp 0xbf39e
movq -0x10(%rbp), %rdi
callq 0x5dab0
movl %eax, -0xac(%rbp)
movq -0x10(%rbp), %rdi
callq 0x5a210
movl %eax, %ecx
movl -0xac(%rbp), %eax
subl -0x48(%rbp), %ecx
addl %ecx, %eax
cltq
movq %rax, -0xa8(%rbp)
cvtsi2sdl -0x58(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq %rax, %rcx
movq -0xa8(%rbp), %rax
subq %rcx, %rax
movslq -0x28(%rbp), %rcx
cmpq %rcx, %rax
jge 0xbf39c
movslq -0x38(%rbp), %rax
movq %rax, -0xc0(%rbp)
cvtsi2sdl -0x58(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq -0xc0(%rbp), %rcx
movq %rax, %rdx
movq -0x70(%rbp), %rax
subq %rdx, %rcx
movq %rcx, -0xb8(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x2, %eax
jne 0xbf37c
movl -0x40(%rbp), %eax
movl %eax, -0xc4(%rbp)
jmp 0xbf386
xorl %eax, %eax
movl %eax, -0xc4(%rbp)
jmp 0xbf386
movq -0xb8(%rbp), %rax
movl -0xc4(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x48(%rbp)
jmp 0xbf39e
movq -0x10(%rbp), %rdi
callq 0x5ddb0
addl -0x44(%rbp), %eax
cltq
movq %rax, -0xd0(%rbp)
cvtsi2sdl -0x54(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq %rax, %rcx
movq -0xd0(%rbp), %rax
addq %rcx, %rax
movslq -0x1c(%rbp), %rcx
cmpq %rcx, %rax
jl 0xbf447
movslq -0x34(%rbp), %rax
movq %rax, -0xe0(%rbp)
cvtsi2sdl -0x54(%rbp), %xmm0
mulsd -0x30(%rbp), %xmm0
callq 0x5a970
movq -0xe0(%rbp), %rcx
movq %rax, %rdx
movq -0x70(%rbp), %rax
subq %rdx, %rcx
movq %rcx, -0xd8(%rbp)
movswl 0x1a0(%rax), %eax
cmpl $0x1, %eax
jne 0xbf427
movq -0x70(%rbp), %rdi
callq 0x5b860
movl %eax, -0xe4(%rbp)
jmp 0xbf431
xorl %eax, %eax
movl %eax, -0xe4(%rbp)
jmp 0xbf431
movq -0xd8(%rbp), %rax
movl -0xe4(%rbp), %ecx
movslq %ecx, %rcx
addq %rcx, %rax
movl %eax, -0x44(%rbp)
movq -0x70(%rbp), %rax
movq 0x690(%rax), %rdi
leaq -0x48(%rbp), %rsi
callq 0x5d8c0
movq -0x70(%rbp), %rcx
movq 0x690(%rcx), %rdi
addq $0x698, %rdi            # imm = 0x698
movq 0x1495d4(%rip), %rax    # 0x208a48
movq %rax, -0x68(%rbp)
movq $0x0, -0x60(%rbp)
movq -0x68(%rbp), %rsi
movq -0x60(%rbp), %rdx
callq 0xc0040
movq -0x70(%rbp), %rdi
addq $0x698, %rdi            # imm = 0x698
callq 0x8af60
movq -0x70(%rbp), %rdi
movq 0x690(%rdi), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
addq $0xf0, %rsp
popq %rbp
retq
nopw (%rax,%rax)