// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/gui/widgets/basic/divider.cpp
// Function: smooth::GUI::Divider::UpdateMetrics()
S::Void S::GUI::Divider::UpdateMetrics()
{
	Window	*wnd = GetContainerWindow();
	Rect	 rect;

	if (wnd == NIL) return;

	if (Binary::IsFlagSet(flags, OR_VERT))
	{
		Bool	 afterMe = False;

		if (container->GetObjectType() == Window::classID)
		{
			if (Binary::IsFlagSet(flags, OR_RIGHT))	rect.left = ((Window *) container)->GetClientRect().right - position;
			else					rect.left = ((Window *) container)->GetClientRect().left + position;

			rect.top	= wnd->GetClientRect().top;
			rect.bottom	= wnd->GetClientRect().bottom;
		}
		else
		{
			if (Binary::IsFlagSet(flags, OR_RIGHT))	rect.left = container->GetWidth() - position;
			else					rect.left = position;

			rect.top	= 3;
			rect.bottom	= container->GetHeight() - 3;
		}

		rect.right = rect.left + 2;

		for (Int i = container->GetNOfObjects() - 1; i >= 0; i--)
		{
			if (container->GetNthObject(i)->GetObjectType() != classID) continue;

			Divider	*divider = (Divider *) container->GetNthObject(i);

			if (afterMe && !Binary::IsFlagSet(divider->flags, OR_VERT))
			{
				if (Binary::IsFlagSet(divider->flags, OR_BOTTOM))
				{
					if (container->GetHeight() - divider->GetY() <= rect.bottom + 1) rect.bottom = container->GetHeight() - divider->GetY() - 2;
				}
				else
				{
					if (divider->GetY() >= rect.top - 2) rect.top = divider->GetY() + 3;
				}
			}

			if (divider == this) afterMe = True;
		}
	}
	else
	{
		Bool	 afterMe = False;

		if (container->GetObjectType() == Window::classID)
		{
			if (Binary::IsFlagSet(flags, OR_BOTTOM)) rect.top = ((Window *) container)->GetClientRect().bottom - position;
			else					 rect.top = ((Window *) container)->GetClientRect().top	   + position;

			rect.left	= wnd->GetClientRect().left;
			rect.right	= wnd->GetClientRect().right;
		}
		else
		{
			if (Binary::IsFlagSet(flags, OR_BOTTOM)) rect.top = container->GetHeight() - position;
			else					 rect.top = 			     position;

			rect.left	= 3;
			rect.right	= container->GetWidth() - 3;
		}

		rect.bottom = rect.top + 2;

		for (Int i = container->GetNOfObjects() - 1; i >= 0; i--)
		{
			if (container->GetNthObject(i)->GetObjectType() != classID) continue;

			Divider	*divider = (Divider *) container->GetNthObject(i);

			if (afterMe && Binary::IsFlagSet(divider->flags, OR_VERT))
			{
				if (Binary::IsFlagSet(divider->flags, OR_RIGHT))
				{
					if (container->GetWidth() - divider->GetX() <= rect.right + 1) rect.right = container->GetWidth() - divider->GetX() - 2;
				}
				else
				{
					if (divider->GetX() >= rect.left - 2) rect.left = divider->GetX() + 3;
				}
			}

			if (divider == this) afterMe = True;
		}
	}

	SetMetrics(rect.GetPosition(), rect.GetSize());

	if (Binary::IsFlagSet(flags, OR_VERT))	dragHotspot->SetMetrics(Point(-1, 0), rect.GetSize() + Size(2, 1));
	else					dragHotspot->SetMetrics(Point(0, -1), rect.GetSize() + Size(1, 2));
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
callq 0x559e0
testq %rax, %rax
je 0x75672
movq %rax, %r12
movl 0x30(%rbx), %edi
movl $0x2, %esi
callq 0x583f0
movl %eax, %ebp
movq 0x190(%rbx), %rdi
addq $0x20, %rdi
movq 0xf658b(%rip), %rax     # 0x16b828
movswl (%rax), %esi
callq 0x57520
movl %eax, %r14d
movl 0x30(%rbx), %edi
testb %bpl, %bpl
je 0x7530e
movl $0x20, %esi
callq 0x583f0
movl %eax, %ebp
testb %r14b, %r14b
je 0x7536a
movq 0x190(%rbx), %rdi
callq 0x56330
movl 0x5c8(%rbx), %ecx
addl %ecx, %eax
subl %ecx, %edx
testb %bpl, %bpl
movq %rdx, %rbp
cmovel %eax, %ebp
movq %r12, %rdi
callq 0x56330
movq %rax, %r14
shrq $0x20, %r14
movq %r12, %rdi
callq 0x56330
movq %rdx, %r13
shrq $0x20, %r13
movq 0x190(%rbx), %rax
jmp 0x753c5
movl $0x8, %esi
callq 0x583f0
movl %eax, %ebp
testb %r14b, %r14b
je 0x75384
movq 0x190(%rbx), %rdi
callq 0x56330
movq %rax, %r14
movl 0x5c8(%rbx), %eax
shrq $0x20, %rdx
subl %eax, %edx
shrq $0x20, %r14
addl %eax, %r14d
testb %bpl, %bpl
cmovnel %edx, %r14d
movq %r12, %rdi
callq 0x56330
movq %rax, %rbp
movq %r12, %rdi
callq 0x56330
movq %rdx, %r12
movq 0x190(%rbx), %rax
jmp 0x754d8
testb %bpl, %bpl
je 0x753a7
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %ebp
subl 0x5c8(%rbx), %ebp
jmp 0x753b4
testb %bpl, %bpl
je 0x754ba
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %r14d
subl 0x5c8(%rbx), %r14d
jmp 0x754c8
movl 0x5c8(%rbx), %ebp
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %r13d
addl $-0x3, %r13d
movl $0x3, %r14d
leal 0x2(%rbp), %r12d
movl 0x40(%rax), %r15d
testl %r15d, %r15d
jle 0x755db
movq %r12, (%rsp)
movq %rbp, 0x8(%rsp)
movq %r14, 0x10(%rsp)
incl %r15d
xorl %r14d, %r14d
movq 0xf66f7(%rip), %r12     # 0x16bae8
leal -0x2(%r15), %ebp
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b074
movq (%rax), %rdi
addq $0x20, %rdi
movswl (%r12), %esi
callq 0x57520
testb %al, %al
je 0x754a8
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b074
movq (%rax), %rbp
testb $0x1, %r14b
je 0x7549f
movl 0x30(%rbp), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
jne 0x7549f
movl 0x30(%rbp), %edi
movl $0x8, %esi
callq 0x583f0
testb %al, %al
je 0x75482
movq 0x190(%rbx), %rax
movl 0xb4(%rax), %eax
subl 0xac(%rbp), %eax
leal 0x1(%r13), %ecx
leal -0x2(%rax), %edx
cmpl %ecx, %eax
cmovgl %r13d, %edx
movl %edx, %r13d
jmp 0x7549f
movl 0xac(%rbp), %eax
movq 0x10(%rsp), %rsi
leal -0x2(%rsi), %ecx
leal 0x3(%rax), %edx
cmpl %ecx, %eax
cmovll %esi, %edx
movl %edx, %eax
movq %rax, 0x10(%rsp)
cmpq %rbx, %rbp
sete %al
orb %al, %r14b
decl %r15d
cmpl $0x1, %r15d
ja 0x753f1
jmp 0x755cd
movl 0x5c8(%rbx), %r14d
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %r12d
addl $-0x3, %r12d
movl $0x3, %ebp
leal 0x2(%r14), %r13d
movl 0x40(%rax), %r15d
testl %r15d, %r15d
jle 0x755db
movq %r12, (%rsp)
movq %rbp, 0x8(%rsp)
movq %r14, 0x10(%rsp)
incl %r15d
xorl %r14d, %r14d
movq 0xf65e4(%rip), %r12     # 0x16bae8
leal -0x2(%r15), %ebp
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b074
movq (%rax), %rdi
addq $0x20, %rdi
movswl (%r12), %esi
callq 0x57520
testb %al, %al
je 0x755c0
movq 0x190(%rbx), %rdi
addq $0x38, %rdi
movl %ebp, %esi
callq 0x5b074
movq (%rax), %rbp
testb $0x1, %r14b
je 0x755b7
movl 0x30(%rbp), %edi
movl $0x2, %esi
callq 0x583f0
testb %al, %al
je 0x755b7
movl 0x30(%rbp), %edi
movl $0x20, %esi
callq 0x583f0
testb %al, %al
je 0x7559a
movq 0x190(%rbx), %rax
movl 0xb0(%rax), %eax
subl 0xa8(%rbp), %eax
movq (%rsp), %rsi
leal 0x1(%rsi), %ecx
leal -0x2(%rax), %edx
cmpl %ecx, %eax
cmovgl %esi, %edx
movl %edx, %eax
movq %rax, (%rsp)
jmp 0x755b7
movl 0xa8(%rbp), %eax
movq 0x8(%rsp), %rsi
leal -0x2(%rsi), %ecx
leal 0x3(%rax), %edx
cmpl %ecx, %eax
cmovll %esi, %edx
movl %edx, %eax
movq %rax, 0x8(%rsp)
cmpq %rbx, %rbp
sete %al
orb %al, %r14b
decl %r15d
cmpl $0x1, %r15d
ja 0x75504
movq 0x10(%rsp), %r14
movq 0x8(%rsp), %rbp
movq (%rsp), %r12
movq %r14, %rax
shlq $0x20, %rax
movl %ebp, %ecx
orq %rax, %rcx
leaq 0x20(%rsp), %rsi
movq %rcx, (%rsi)
subl %ebp, %r12d
subl %r14d, %r13d
movq %r13, %rax
shlq $0x20, %rax
addq %r12, %rax
leaq 0x18(%rsp), %rdx
movq %rax, (%rdx)
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x150(%rax)
movl 0x30(%rbx), %edi
movl $0x2, %esi
callq 0x583f0
movq 0x5d0(%rbx), %rdi
testb %al, %al
je 0x75641
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
addl $0x2, %r12d
incl %r13d
jmp 0x7565a
movabsq $-0x100000000, %rax     # imm = 0xFFFFFFFF00000000
leaq 0x20(%rsp), %rsi
movq %rax, (%rsi)
incl %r12d
addl $0x2, %r13d
shlq $0x20, %r13
orq %r13, %r12
leaq 0x18(%rsp), %rdx
movq %r12, (%rdx)
movq (%rdi), %rax
callq *0x150(%rax)
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop