// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/dialogs/tipodaydlg.cpp
// Function: smooth::GUI::Dialogs::TipOfTheDay::ShowDialog()
const Error &S::GUI::Dialogs::TipOfTheDay::ShowDialog()
{
	if (caption != NIL) dlgwnd->SetText(caption);

	/* Compute and set dialog size.
	 */
	Rect	 workArea	= System::Screen::GetActiveScreenWorkArea();
	Float	 scaleFactor	= Surface().GetSurfaceDPI() / 96.0;

	Int	 additionalSize = Math::Max(0, check_showtips->GetWidth() + btn_next->GetWidth() - 234);
	Size	 size		= Size(328 + additionalSize, 182);

	foreach (const String &tip, tips) size = Size(Math::Max(size.cx, font.GetUnscaledTextSizeX(tip) + 12),
						      Math::Max(size.cy, font.GetUnscaledTextSizeY(tip) + 12));

	dlgwnd->SetSize(Size(24, 120) + size);
	dlgwnd->SetPosition(workArea.GetPosition() + Point((workArea.GetWidth()  - Math::Round(dlgwnd->GetWidth()  * scaleFactor)) / 2,
							   (workArea.GetHeight() - Math::Round(dlgwnd->GetHeight() * scaleFactor)) / 2));

	layer_inner->SetSize(size);
	txt_tip->SetSize(size);

	/* Set next tip and display dialog.
	 */
	if (offset >= tips.Length()) offset = 0;

	OnNext();

	if (tips.Length() <= 1) btn_next->Deactivate();

	dlgwnd->Show();
	dlgwnd->WaitUntilClosed();

	return error;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movq %rdi, %rbx
leaq 0x5b8(%rdi), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0x6c81b
movq 0x5e8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0xa0(%rax)
callq 0x57e90
movq %rax, %r15
movq %rdx, %r13
leaq 0x10(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x57150
movq %r14, %rdi
callq 0x58930
cwtl
cvtsi2sd %eax, %xmm0
divsd 0x86e62(%rip), %xmm0    # 0xf36b8
movapd %xmm0, 0x40(%rsp)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x57b20
movq 0x608(%rbx), %rax
movq 0x610(%rbx), %rcx
movl 0xb0(%rax), %eax
addl 0xb0(%rcx), %eax
cmpl $0xeb, %eax
movl $0xea, %r12d
cmovgel %eax, %r12d
addl $0x5e, %r12d
movl %r12d, (%r14)
movl $0xb6, 0x4(%r14)
cmpl $0x0, 0x648(%rbx)
jle 0x6c960
movq %r13, 0x18(%rsp)
movq %r15, 0x20(%rsp)
leaq 0x640(%rbx), %rax
movq %rax, 0x38(%rsp)
leaq 0x140(%rbx), %rax
movq %rax, 0x28(%rsp)
movl $0xffffffff, %r14d      # imm = 0xFFFFFFFF
movl $0xb6, %eax
movq %rbx, 0x30(%rsp)
movq 0x28(%rsp), %rbp
movl %r12d, %ebx
movl %eax, %r13d
incl %r14d
movq 0x38(%rsp), %rdi
movl %r14d, %esi
callq 0x6b5b4
movq %rax, %r15
movq %rbp, %rdi
movq %rax, %rsi
callq 0x57f50
movl %eax, %r12d
addl $0xc, %r12d
cmpl %r12d, %ebx
cmovgl %ebx, %r12d
movq 0x30(%rsp), %rbx
movq %rbp, %rdi
movq %r15, %rsi
callq 0x58a50
addl $0xc, %eax
cmpl %eax, %r13d
cmovgl %r13d, %eax
movq %rax, %rcx
shlq $0x20, %rcx
addq %r12, %rcx
movq %rcx, 0x8(%rsp)
movl 0x648(%rbx), %ecx
decl %ecx
cmpl %ecx, %r14d
jl 0x6c8e5
addl $0x78, %eax
shlq $0x20, %rax
movq 0x20(%rsp), %r15
movq 0x18(%rsp), %r13
jmp 0x6c96a
movabsq $0x12e00000000, %rax    # imm = 0x12E00000000
movq 0x5e8(%rbx), %rdi
addl $0x18, %r12d
orq %rax, %r12
leaq 0x10(%rsp), %rdx
movq %r12, (%rdx)
movl $0xa8, %r12d
leaq (%rdi,%r12), %rsi
movq (%rdi), %rax
callq *0x150(%rax)
movq 0x5e8(%rbx), %rdi
movl %r13d, %eax
subl %r15d, %eax
movslq %eax, %rcx
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
movq %r15, %rdx
cvtdq2pd 0xb0(%rdi), %xmm0
andq %rax, %rdx
subq %rdx, %r13
movapd 0x40(%rsp), %xmm3
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm0, %xmm3
xorpd %xmm0, %xmm0
movapd %xmm3, %xmm1
cmpltpd %xmm0, %xmm1
movmskpd %xmm1, %esi
movsd 0x869ab(%rip), %xmm0    # 0xf3390
movsd 0x869ab(%rip), %xmm1    # 0xf3398
movapd %xmm0, %xmm2
testb $0x1, %sil
jne 0x6c9fb
movapd %xmm1, %xmm2
leaq 0xb0(%rdi), %rdx
sarq $0x20, %r13
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %r8
subq %r8, %rcx
movq %rcx, %r8
shrq $0x3f, %r8
addq %rcx, %r8
shrq %r8
testb $0x2, %sil
jne 0x6ca29
movapd %xmm1, %xmm0
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %rcx
subq %rcx, %r13
movq %r13, %rcx
shrq $0x3f, %rcx
addq %r13, %rcx
addl %r15d, %r8d
andq $-0x2, %rcx
shlq $0x1f, %rcx
addq %r15, %rcx
andq %rax, %rcx
orq %rcx, %r8
leaq 0x10(%rsp), %rsi
movq %r8, (%rsi)
movq (%rdi), %rax
callq *0x150(%rax)
movq 0x630(%rbx), %rdi
leaq (%rdi,%r12), %rsi
movq (%rdi), %rax
leaq 0x8(%rsp), %r14
movq %r14, %rdx
callq *0x150(%rax)
movq 0x628(%rbx), %rdi
addq %rdi, %r12
movq (%rdi), %rax
movq %r12, %rsi
movq %r14, %rdx
callq *0x150(%rax)
movl 0x69c(%rbx), %eax
cmpl 0x648(%rbx), %eax
jl 0x6cab5
movl $0x0, 0x69c(%rbx)
movq %rbx, %rdi
callq 0x59180
cmpl $0x1, 0x648(%rbx)
jg 0x6cad3
movq 0x608(%rbx), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq 0x5e8(%rbx), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movq 0x5e8(%rbx), %rdi
callq 0x563a0
addq $0x5d8, %rbx            # imm = 0x5D8
movq %rbx, %rax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x57b20
movq %rbx, %rdi
callq 0x57090