// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/xml/xul/box.cpp
// Function: smooth::XML::XUL::Box::CalculateChildMetrics()
S::Void	 S::XML::XUL::Box::CalculateChildMetrics()
{
	if (widgets.Length() == 0) return;

	Int	 xOffset = 0;
	Int	 yOffset = 0;

	Int	 maxWidth = 0;
	Int	 maxHeight = 0;

	Int	 elementWidth = width / widgets.Length();
	Int	 elementHeight = height / widgets.Length();

	for (Int i = 0; i < widgets.Length(); i++)
	{
		XUL::Widget	*widget = widgets.GetNth(i);

		maxWidth = Math::Max(maxWidth, widget->GetWidth());
		maxHeight = Math::Max(maxHeight, widget->GetHeight());

		Int	 usedElementWidth = widget->GetWidth();
		Int	 usedElementHeight = widget->GetHeight();

		if (usedElementWidth == 0) usedElementWidth = (orient == HORIZONTAL) ? elementWidth : widget->GetDefaultWidth();
		if (usedElementHeight == 0) usedElementHeight = (orient == VERTICAL) ? elementHeight : widget->GetDefaultHeight();

		widget->SetMetrics(GUI::Point(xOffset, yOffset), GUI::Size(usedElementWidth, usedElementHeight));

		if (orient == HORIZONTAL)	xOffset += usedElementWidth;
		else if (orient == VERTICAL)	yOffset += usedElementHeight;
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x8(%rbp)
movq -0x8(%rbp), %rdi
movq %rdi, -0x50(%rbp)
addq $0x88, %rdi
callq 0x5c990
cmpl $0x0, %eax
jne 0x110bdd
jmp 0x110dc4
movq -0x50(%rbp), %rdi
movl $0x0, -0xc(%rbp)
movl $0x0, -0x10(%rbp)
movl $0x0, -0x14(%rbp)
movl $0x0, -0x18(%rbp)
movl 0x2c(%rdi), %eax
movl %eax, -0x58(%rbp)
addq $0x88, %rdi
callq 0x5c990
movq -0x50(%rbp), %rdi
movl %eax, %ecx
movl -0x58(%rbp), %eax
cltd
idivl %ecx
movl %eax, -0x1c(%rbp)
movl 0x30(%rdi), %eax
movl %eax, -0x54(%rbp)
addq $0x88, %rdi
callq 0x5c990
movl %eax, %ecx
movl -0x54(%rbp), %eax
cltd
idivl %ecx
movl %eax, -0x20(%rbp)
movl $0x0, -0x24(%rbp)
movq -0x50(%rbp), %rdi
movl -0x24(%rbp), %eax
movl %eax, -0x5c(%rbp)
addq $0x88, %rdi
callq 0x5c990
movl %eax, %ecx
movl -0x5c(%rbp), %eax
cmpl %ecx, %eax
jge 0x110dc4
movq -0x50(%rbp), %rdi
addq $0x88, %rdi
movl -0x24(%rbp), %esi
callq 0x110fa0
movq (%rax), %rax
movq %rax, -0x30(%rbp)
movl -0x14(%rbp), %eax
movl %eax, -0x64(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5bc40
movl -0x64(%rbp), %edi
movl %eax, %esi
callq 0x5aae0
movl %eax, -0x14(%rbp)
movl -0x18(%rbp), %eax
movl %eax, -0x60(%rbp)
movq -0x30(%rbp), %rdi
callq 0x590f0
movl -0x60(%rbp), %edi
movl %eax, %esi
callq 0x5aae0
movl %eax, -0x18(%rbp)
movq -0x30(%rbp), %rdi
callq 0x5bc40
movl %eax, -0x34(%rbp)
movq -0x30(%rbp), %rdi
callq 0x590f0
movl %eax, -0x38(%rbp)
cmpl $0x0, -0x34(%rbp)
jne 0x110d05
movq -0x50(%rbp), %rax
movswl 0x20(%rax), %eax
movq 0xf800c(%rip), %rcx     # 0x208cf0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x110cf3
movl -0x1c(%rbp), %eax
movl %eax, -0x68(%rbp)
jmp 0x110cff
movq -0x30(%rbp), %rdi
callq 0x5a430
movl %eax, -0x68(%rbp)
movl -0x68(%rbp), %eax
movl %eax, -0x34(%rbp)
cmpl $0x0, -0x38(%rbp)
jne 0x110d3b
movq -0x50(%rbp), %rax
movswl 0x20(%rax), %eax
movq 0xf7ec6(%rip), %rcx     # 0x208be0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x110d29
movl -0x20(%rbp), %eax
movl %eax, -0x6c(%rbp)
jmp 0x110d35
movq -0x30(%rbp), %rdi
callq 0x5c960
movl %eax, -0x6c(%rbp)
movl -0x6c(%rbp), %eax
movl %eax, -0x38(%rbp)
movq -0x30(%rbp), %rax
movq %rax, -0x78(%rbp)
movl -0xc(%rbp), %esi
movl -0x10(%rbp), %edx
leaq -0x40(%rbp), %rdi
callq 0x5c2c0
movl -0x34(%rbp), %esi
movl -0x38(%rbp), %edx
leaq -0x48(%rbp), %rdi
callq 0x59260
movq -0x78(%rbp), %rdi
leaq -0x40(%rbp), %rsi
leaq -0x48(%rbp), %rdx
callq 0x5be20
movq -0x50(%rbp), %rax
movswl 0x20(%rax), %eax
movq 0xf7f6f(%rip), %rcx     # 0x208cf0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x110d93
movl -0x34(%rbp), %eax
addl -0xc(%rbp), %eax
movl %eax, -0xc(%rbp)
jmp 0x110db4
movq -0x50(%rbp), %rax
movswl 0x20(%rax), %eax
movq 0xf7e3e(%rip), %rcx     # 0x208be0
movswl (%rcx), %ecx
cmpl %ecx, %eax
jne 0x110db2
movl -0x38(%rbp), %eax
addl -0x10(%rbp), %eax
movl %eax, -0x10(%rbp)
jmp 0x110db4
jmp 0x110db6
movl -0x24(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x24(%rbp)
jmp 0x110c42
addq $0x80, %rsp
popq %rbp
retq
nopl (%rax)