// File: /workspace/github_c_makefile_star2_O1/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 $0x38, %rsp
movq %rdi, %rbx
leaq 0x5b8(%rdi), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0x6c8bf
movq 0x5e8(%rbx), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0xa0(%rax)
callq 0x57e90
movq %rax, %r15
movq %rdx, %r12
leaq 0x10(%rsp), %rdx
movq $0x0, (%rdx)
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x57150
movq %r14, %rdi
callq 0x58930
movq %r12, 0x20(%rsp)
movq %r15, 0x28(%rsp)
cwtl
cvtsi2sd %eax, %xmm0
divsd 0x87bec(%rip), %xmm0    # 0xf44f0
movsd %xmm0, 0x18(%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, %ecx
cmovgel %eax, %ecx
addl $0x5e, %ecx
movl %ecx, (%r14)
movl $0xb6, 0x4(%r14)
cmpl $0x0, 0x648(%rbx)
jle 0x6c9d3
leaq 0x640(%rbx), %rax
movq %rax, 0x30(%rsp)
leaq 0x140(%rbx), %r13
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
movq %rbx, %r12
incl %ebp
movq 0x30(%rsp), %rdi
movl %ebp, %esi
callq 0x6b64a
movq %rax, %r15
movl 0x8(%rsp), %ebx
movq %r13, %rdi
movq %rax, %rsi
callq 0x57f50
movl %eax, %r14d
addl $0xc, %r14d
cmpl %r14d, %ebx
cmovgl %ebx, %r14d
movl 0xc(%rsp), %ebx
movq %r13, %rdi
movq %r15, %rsi
callq 0x58a50
addl $0xc, %eax
cmpl %eax, %ebx
jg 0x6c9b6
movl %eax, %ebx
shlq $0x20, %rbx
orq %rbx, %r14
movq %r14, 0x8(%rsp)
movq %r12, %rbx
movl 0x648(%r12), %eax
decl %eax
cmpl %eax, %ebp
jl 0x6c96d
movq 0x5e8(%rbx), %rdi
leaq 0x8(%rsp), %r12
movl (%r12), %eax
movl 0x4(%r12), %ecx
addl $0x18, %eax
addl $0x78, %ecx
shlq $0x20, %rcx
orq %rcx, %rax
leaq 0x10(%rsp), %rbp
movq %rax, (%rbp)
movl $0xa8, %r13d
leaq (%rdi,%r13), %rsi
movq (%rdi), %rax
movq %rbp, %rdx
callq *0x150(%rax)
movq 0x5e8(%rbx), %rdi
movq 0x20(%rsp), %r9
movl %r9d, %eax
movq 0x28(%rsp), %r8
subl %r8d, %eax
movslq %eax, %rcx
leaq 0xb0(%rdi), %rdx
cvtsi2sdl 0xb0(%rdi), %xmm2
movsd 0x18(%rsp), %xmm6
mulsd %xmm6, %xmm2
xorpd %xmm1, %xmm1
movapd %xmm2, %xmm3
cmpltsd %xmm1, %xmm3
movsd 0x87934(%rip), %xmm0    # 0xf4390
movapd %xmm3, %xmm4
andpd %xmm0, %xmm4
movsd 0x8792c(%rip), %xmm5    # 0xf4398
andnpd %xmm5, %xmm3
orpd %xmm4, %xmm3
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %rax
subq %rax, %rcx
movq %rcx, %rax
shrq $0x3f, %rax
addq %rcx, %rax
shrq %rax
movabsq $-0x100000000, %rcx     # imm = 0xFFFFFFFF00000000
movq %r8, %rsi
andq %rcx, %rsi
subq %rsi, %r9
sarq $0x20, %r9
xorps %xmm2, %xmm2
cvtsi2sdl 0xb4(%rdi), %xmm2
mulsd %xmm6, %xmm2
movapd %xmm2, %xmm3
cmpltsd %xmm1, %xmm3
andpd %xmm3, %xmm0
andnpd %xmm5, %xmm3
orpd %xmm0, %xmm3
addsd %xmm2, %xmm3
cvttsd2si %xmm3, %rsi
subq %rsi, %r9
movq %r9, %rsi
shrq $0x3f, %rsi
addq %r9, %rsi
addl %r8d, %eax
andq $-0x2, %rsi
shlq $0x1f, %rsi
addq %r8, %rsi
andq %rcx, %rsi
orq %rsi, %rax
movq %rax, (%rbp)
movq (%rdi), %rax
leaq 0x10(%rsp), %rsi
callq *0x150(%rax)
movq 0x630(%rbx), %rdi
leaq (%rdi,%r13), %rsi
movq (%rdi), %rax
movq %r12, %rdx
callq *0x150(%rax)
movq 0x628(%rbx), %rdi
addq %rdi, %r13
movq (%rdi), %rax
movq %r13, %rsi
movq %r12, %rdx
callq *0x150(%rax)
movl 0x69c(%rbx), %eax
cmpl 0x648(%rbx), %eax
jl 0x6cb4c
movl $0x0, 0x69c(%rbx)
movq %rbx, %rdi
callq 0x59180
cmpl $0x1, 0x648(%rbx)
jg 0x6cb6a
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 $0x38, %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
nop