// File: /workspace/github_c_makefile_star2_O2/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 $0x48, %rsp
movq %rdi, %r15
leaq 0x5b8(%rdi), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0x6cc11
movq 0x5e8(%r15), %rdi
movq (%rdi), %rax
movq %r14, %rsi
callq *0xa0(%rax)
callq 0x59120
movq %rax, 0x28(%rsp)
movq %rdx, 0x20(%rsp)
leaq 0x8(%rsp), %rdx
andq $0x0, (%rdx)
xorl %ebx, %ebx
movq %rsp, %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x58340
movq %r14, %rdi
callq 0x59c60
cwtl
cvtsi2sd %eax, %xmm0
movapd %xmm0, 0x10(%rsp)
movq %rsp, %r14
movq %r14, %rdi
callq 0x58d90
movq 0x608(%r15), %rax
movq 0x610(%r15), %rcx
movl 0xb0(%rax), %eax
addl 0xb0(%rcx), %eax
cmpl $0xeb, %eax
movl $0xea, %ebp
cmovgel %eax, %ebp
addl $0x5e, %ebp
movl %ebp, (%r14)
movl $0xb6, 0x4(%r14)
leaq 0x640(%r15), %rax
movq %rax, 0x40(%rsp)
leaq 0x140(%r15), %rax
movq %rax, 0x38(%rsp)
movl $0xb6, %r13d
movq %r15, 0x30(%rsp)
movq 0x38(%rsp), %r12
leal -0x1(%rbx), %eax
movl 0x648(%r15), %ecx
decl %ecx
cmpl %ecx, %eax
jge 0x6cd1a
movq 0x40(%rsp), %rdi
movl %ebx, %esi
callq 0x6bad6
movq %rax, %r15
movq %r12, %rdi
movq %rax, %rsi
callq 0x591e0
movl %eax, %r14d
addl $0xc, %r14d
cmpl %r14d, %ebp
cmovgl %ebp, %r14d
movq %r12, %rdi
movq %r15, %rsi
movq 0x30(%rsp), %r15
callq 0x59d90
addl $0xc, %eax
cmpl %eax, %r13d
cmovgl %r13d, %eax
movl %eax, %r13d
shlq $0x20, %rax
addq %r14, %rax
movq %rax, (%rsp)
incl %ebx
movl %r14d, %ebp
jmp 0x6ccb3
movapd 0x10(%rsp), %xmm0
divsd 0x767e8(%rip), %xmm0    # 0xe3510
movapd %xmm0, 0x10(%rsp)
movq 0x5e8(%r15), %rdi
addl $0x18, %ebp
addl $0x78, %r13d
shlq $0x20, %r13
orq %r13, %rbp
leaq 0x8(%rsp), %rdx
movq %rbp, (%rdx)
movl $0xa8, %r12d
leaq (%rdi,%r12), %rsi
movq (%rdi), %rax
callq *0x150(%rax)
movapd 0x10(%rsp), %xmm3
movq 0x5e8(%r15), %rdi
movq 0x20(%rsp), %rbx
movl %ebx, %eax
movq 0x28(%rsp), %r11
subl %r11d, %eax
cltq
movabsq $-0x100000000, %rsi     # imm = 0xFFFFFFFF00000000
movq %r11, %rcx
cvtdq2pd 0xb0(%rdi), %xmm0
andq %rsi, %rcx
subq %rcx, %rbx
unpcklpd %xmm3, %xmm3            # xmm3 = xmm3[0,0]
mulpd %xmm0, %xmm3
xorpd %xmm0, %xmm0
movapd %xmm3, %xmm1
cmpltpd %xmm0, %xmm1
movmskpd %xmm1, %r9d
movsd 0x765bf(%rip), %xmm0    # 0xe3378
movsd 0x765bf(%rip), %xmm1    # 0xe3380
movapd %xmm0, %xmm2
testb $0x1, %r9b
jne 0x6cdcf
movapd %xmm1, %xmm2
leaq 0xb0(%rdi), %rcx
addsd %xmm3, %xmm2
cvttsd2si %xmm2, %rdx
sarq $0x20, %rbx
subq %rdx, %rax
pushq $0x2
popq %r10
cqto
idivq %r10
movq %rax, %r8
testb $0x2, %r9b
jne 0x6cdfc
movapd %xmm1, %xmm0
unpckhpd %xmm3, %xmm3            # xmm3 = xmm3[1,1]
addsd %xmm0, %xmm3
cvttsd2si %xmm3, %rax
subq %rax, %rbx
movq %rbx, %rax
cqto
idivq %r10
addl %r11d, %r8d
shlq $0x20, %rax
addq %r11, %rax
andq %rsi, %rax
orq %rax, %r8
leaq 0x8(%rsp), %rsi
movq %r8, (%rsi)
movq (%rdi), %rax
movq %rcx, %rdx
callq *0x150(%rax)
movq 0x630(%r15), %rdi
leaq (%rdi,%r12), %rsi
movq (%rdi), %rax
movq %rsp, %r14
movq %r14, %rdx
callq *0x150(%rax)
movq 0x628(%r15), %rdi
addq %rdi, %r12
movq (%rdi), %rax
movq %r12, %rsi
movq %r14, %rdx
callq *0x150(%rax)
movl 0x69c(%r15), %eax
cmpl 0x648(%r15), %eax
jl 0x6ce83
andl $0x0, 0x69c(%r15)
movq %r15, %rdi
callq 0x5a508
cmpl $0x1, 0x648(%r15)
jg 0x6cea2
movq 0x608(%r15), %rdi
movq (%rdi), %rax
callq *0x70(%rax)
movq 0x5e8(%r15), %rdi
movq (%rdi), %rax
callq *0x58(%rax)
movq 0x5e8(%r15), %rdi
callq 0x574a0
addq $0x5d8, %r15            # imm = 0x5D8
movq %r15, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x58d90
movq %rbx, %rdi
callq 0x58260
nop