// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/window/window.cpp
// Function: smooth::GUI::Window::Add(smooth::GUI::Widget*)
S::Int S::GUI::Window::Add(Widget *widget)
{
	if (widget == NIL) return Error();

	if (widget->GetOrientation() == OR_UPPERLEFT || widget->GetOrientation() == OR_UPPERRIGHT || widget->GetOrientation() == OR_LOWERLEFT || widget->GetOrientation() == OR_LOWERRIGHT)
	{
		if (mainLayer->Add(widget) == Success())
		{
			/* Enable drag & drop if the added widget is a target.
			 */
			if (IsDropTarget()) backend->EnableDropFiles(True);

			return Success();
		}

		return Error();
	}

	if (Widget::Add(widget) == Success())
	{
		/* Special handling for title and status bars.
		 */
		if (widget->GetObjectType() == Titlebar::classID)
		{
			if (!Binary::IsFlagSet(widget->GetFlags(), TB_MAXBUTTON)) flags |= WF_NORESIZE;

			if (widget->GetHeight() == 0) backend->SetSizeModifier(backend->GetSizeModifier() - Size(0, 19) * Surface().GetSurfaceDPI() / 96.0);
		}
		else if (widget->GetObjectType() == Statusbar::classID)
		{
			SetDefaultStatusText(widget->GetText());
		}

		/* Recalculate offsets unless the added widget has free orientation.
		 */
		if (widget->GetOrientation() != OR_FREE) CalculateOffsets();

		/* Enable drag & drop if the added widget is a target.
		 */
		if (IsDropTarget()) backend->EnableDropFiles(True);

		return Success();
	}

	return Error();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x190, %rsp            # imm = 0x190
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rax
movq %rax, -0xd0(%rbp)
cmpq $0x0, -0x18(%rbp)
jne 0xd9bff
leaq -0x28(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0xe0(%rbp), %rdi
callq 0x59680
movl %eax, -0xd4(%rbp)
jmp 0xd9bce
movl -0xd4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xda0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0xda104
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x14, %eax
je 0xd9c4b
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x24, %eax
je 0xd9c4b
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x18, %eax
je 0xd9c4b
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x28, %eax
jne 0xd9da3
movq -0xd0(%rbp), %rax
movq 0x620(%rax), %rdi
movq -0x18(%rbp), %rsi
movq (%rdi), %rax
movq 0x30(%rax), %rax
callq *%rax
movl %eax, -0xf4(%rbp)
leaq -0x48(%rbp), %rdi
movq %rdi, -0xf0(%rbp)
callq 0x5ca80
movq -0xf0(%rbp), %rdi
callq 0x59680
movl %eax, -0xe4(%rbp)
jmp 0xd9c90
leaq -0x48(%rbp), %rdi
callq 0x5a410
movl -0xe4(%rbp), %ecx
movl -0xf4(%rbp), %eax
cmpl %ecx, %eax
jne 0xd9d49
movq -0xd0(%rbp), %rdi
callq 0x5c6f0
testb $0x1, %al
jne 0xd9cbf
jmp 0xd9cf4
movq -0xd0(%rbp), %rax
movq 0x5c0(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x58(%rax)
jmp 0xd9cf4
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0xda104
leaq -0x58(%rbp), %rdi
movq %rdi, -0x100(%rbp)
callq 0x5ca80
movq -0x100(%rbp), %rdi
callq 0x59680
movl %eax, -0xf8(%rbp)
jmp 0xd9d18
movl -0xf8(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5a410
jmp 0xda0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0x5a410
jmp 0xda104
leaq -0x68(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x110(%rbp), %rdi
callq 0x59680
movl %eax, -0x104(%rbp)
jmp 0xd9d72
movl -0x104(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5b5b0
jmp 0xda0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5b5b0
jmp 0xda104
movq -0xd0(%rbp), %rdi
movq -0x18(%rbp), %rsi
callq 0x5c510
movl %eax, -0x124(%rbp)
leaq -0x78(%rbp), %rdi
movq %rdi, -0x120(%rbp)
callq 0x5ca80
movq -0x120(%rbp), %rdi
callq 0x59680
movl %eax, -0x114(%rbp)
jmp 0xd9ddd
leaq -0x78(%rbp), %rdi
callq 0x5a410
movl -0x114(%rbp), %ecx
movl -0x124(%rbp), %eax
cmpl %ecx, %eax
jne 0xda09b
movq -0x18(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x12ea13(%rip), %rax    # 0x208820
movswl (%rax), %esi
callq 0x5bc10
testb $0x1, %al
jne 0xd9e1e
jmp 0xd9fb9
movq -0x18(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x2, %esi
callq 0x5ce30
testb $0x1, %al
jne 0xd9e63
movq -0xd0(%rbp), %rax
movl 0x30(%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x30(%rax)
jmp 0xd9e63
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x78(%rbp), %rdi
callq 0x5a410
jmp 0xda104
movq -0x18(%rbp), %rdi
callq 0x5b860
cmpl $0x0, %eax
jne 0xd9fb7
movq -0xd0(%rbp), %rax
movq 0x5c0(%rax), %rdi
movq %rdi, -0x150(%rbp)
callq 0xdcdb0
movq %rax, -0x148(%rbp)
leaq -0x98(%rbp), %rdi
xorl %esi, %esi
movl %esi, -0x13c(%rbp)
movl $0x13, %edx
callq 0x59260
leaq -0xa8(%rbp), %rdi
movq %rdi, -0x138(%rbp)
callq 0x59230
movl -0x13c(%rbp), %eax
movq -0x138(%rbp), %rdx
movl %eax, %esi
leaq -0xa0(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x5b7d0
movq -0x130(%rbp), %rdi
callq 0x5d470
movw %ax, -0x126(%rbp)
jmp 0xd9ef9
movw -0x126(%rbp), %ax
cwtl
cvtsi2sd %eax, %xmm0
leaq -0x98(%rbp), %rdi
callq 0x5a7b0
movq %rax, -0x158(%rbp)
jmp 0xd9f1a
movq -0x158(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x90(%rbp), %rdi
movsd 0xad589(%rip), %xmm0    # 0x1874c0
callq 0x5c6b0
movq %rax, -0x160(%rbp)
jmp 0xd9f45
movq -0x148(%rbp), %rdi
movq -0x160(%rbp), %rax
movq %rax, -0x88(%rbp)
leaq -0x88(%rbp), %rsi
callq 0x5db90
movq %rax, -0x168(%rbp)
jmp 0xd9f6f
movq -0x150(%rbp), %rdi
movq -0x168(%rbp), %rax
movq %rax, -0x80(%rbp)
leaq -0x80(%rbp), %rsi
callq 0xdcdd0
jmp 0xd9f8c
leaq -0xa0(%rbp), %rdi
callq 0x5c380
jmp 0xd9fb7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xa0(%rbp), %rdi
callq 0x5c380
jmp 0xda104
jmp 0xd9ff8
movq -0x18(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x12e49c(%rip), %rax    # 0x208468
movswl (%rax), %esi
callq 0x5bc10
testb $0x1, %al
jne 0xd9fda
jmp 0xd9ff6
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
movq -0xd0(%rbp), %rdi
movq %rax, %rsi
callq 0x5ce50
jmp 0xd9ff8
movq -0x18(%rbp), %rdi
movq (%rdi), %rax
callq *0x128(%rax)
cmpl $0x80, %eax
je 0xda018
movq -0xd0(%rbp), %rdi
callq 0x5a1d0
movq -0xd0(%rbp), %rdi
callq 0x5c6f0
testb $0x1, %al
jne 0xda02a
jmp 0xda043
movq -0xd0(%rbp), %rax
movq 0x5c0(%rax), %rdi
movq (%rdi), %rax
movl $0x1, %esi
callq *0x58(%rax)
leaq -0xb8(%rbp), %rdi
movq %rdi, -0x178(%rbp)
callq 0x5ca80
movq -0x178(%rbp), %rdi
callq 0x59680
movl %eax, -0x16c(%rbp)
jmp 0xda06a
movl -0x16c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x5a410
jmp 0xda0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xb8(%rbp), %rdi
callq 0x5a410
jmp 0xda104
leaq -0xc8(%rbp), %rdi
movq %rdi, -0x188(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x188(%rbp), %rdi
callq 0x59680
movl %eax, -0x17c(%rbp)
jmp 0xda0c7
movl -0x17c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x5b5b0
jmp 0xda0f8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0x5b5b0
jmp 0xda104
movl -0x4(%rbp), %eax
addq $0x190, %rsp            # imm = 0x190
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nopl (%rax)