// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/basic/client.cpp
// Function: smooth::GUI::Client::Paint(int)
S::Int S::GUI::Client::Paint(Int message)
{
	if (!IsRegistered()) return Error();
	if (!IsVisible())    return Success();

	Surface	*surface = GetDrawSurface();
	Rect	 client	 = Rect(GetRealPosition() + Point(2, 2), GetRealSize() - Size(3, 3));

	for (Int i = Object::GetNOfObjects() - 1; i >= 0; i--)
	{
		Object	*object = Object::GetNthObject(i);

		if (object == NIL || object->GetObjectType() != Divider::classID || ((Widget *) object)->GetContainer() != container) continue;

		/* Restrict size to area limited by dividers.
		 */
		Divider	*divider = (Divider *) object;

		if (Binary::IsFlagSet(divider->GetFlags(), OR_VERT))
		{
			Int	 dbPos = Math::Round(divider->GetX() * surface->GetSurfaceDPI() / 96.0);

			if	( Binary::IsFlagSet(divider->GetFlags(), OR_LEFT) && dbPos >= client.left   - 3) client.left   = 			  dbPos + 4;
			else if (!Binary::IsFlagSet(divider->GetFlags(), OR_LEFT) && dbPos <= client.right  + 1) client.right  = container->GetWidth()  - dbPos - 2;
		}
		else if (Binary::IsFlagSet(divider->GetFlags(), OR_HORZ))
		{
			Int	 dbPos = Math::Round(divider->GetY() * surface->GetSurfaceDPI() / 96.0);

			if	( Binary::IsFlagSet(divider->GetFlags(), OR_TOP)  && dbPos >= client.top    - 2) client.top    = 			  dbPos + 4;
			else if (!Binary::IsFlagSet(divider->GetFlags(), OR_TOP)  && dbPos <= client.bottom + 1) client.bottom = container->GetHeight() - dbPos - 2;
		}
	}

	Rect	 updateRect = container->GetContainerWindow()->GetUpdateRect();

	switch (message)
	{
		case SP_PAINT:
			if (Rect::DoRectsOverlap(updateRect, client) || (updateRect.left == 0 && updateRect.top == 0 && updateRect.right == 0 && updateRect.bottom == 0))
			{
				updateRect.right  += 5;
				updateRect.bottom += 5;

				Rect	 intersectRect = Rect::OverlapRect(updateRect, client);

				surface->Box(intersectRect, Setup::ClientColor, Rect::Filled);
				surface->Box(client - Size(1, 1), Setup::DividerDarkColor, Rect::Outlined);

				onPaint.Emit();
			}

			break;
	}

	return Success();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x170, %rsp            # imm = 0x170
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0x110(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0x94414
leaq -0x28(%rbp), %rdi
movq %rdi, -0x120(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0x120(%rbp), %rdi
callq 0x59680
movl %eax, -0x114(%rbp)
jmp 0x943e3
movl -0x114(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0x9498a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x28(%rbp), %rdi
callq 0x5b5b0
jmp 0x94996
movq -0x110(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0x9447d
leaq -0x48(%rbp), %rdi
movq %rdi, -0x130(%rbp)
callq 0x5ca80
movq -0x130(%rbp), %rdi
callq 0x59680
movl %eax, -0x124(%rbp)
jmp 0x9444c
movl -0x124(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0x9498a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5a410
jmp 0x94996
movq -0x110(%rbp), %rdi
movq (%rdi), %rax
callq *0x40(%rax)
movq -0x110(%rbp), %rdi
movq %rax, -0x50(%rbp)
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, -0x70(%rbp)
leaq -0x78(%rbp), %rdi
movl $0x2, %edx
movl %edx, %esi
callq 0x5c2c0
leaq -0x70(%rbp), %rdi
leaq -0x78(%rbp), %rsi
callq 0x5ca20
movq -0x110(%rbp), %rdi
movq %rax, -0x68(%rbp)
movq (%rdi), %rax
callq *0x50(%rax)
movq %rax, -0x88(%rbp)
leaq -0x90(%rbp), %rdi
movl $0x3, %edx
movl %edx, %esi
callq 0x59260
leaq -0x88(%rbp), %rdi
leaq -0x90(%rbp), %rsi
callq 0x5db90
movq %rax, -0x80(%rbp)
leaq -0x60(%rbp), %rdi
leaq -0x68(%rbp), %rsi
leaq -0x80(%rbp), %rdx
callq 0x59ff0
callq 0x5bd10
subl $0x1, %eax
movl %eax, -0x94(%rbp)
cmpl $0x0, -0x94(%rbp)
jl 0x94794
movl -0x94(%rbp), %edi
callq 0x5d300
movq %rax, -0xa0(%rbp)
cmpq $0x0, -0xa0(%rbp)
je 0x94584
movq -0xa0(%rbp), %rdi
callq 0x5bb10
movq %rax, %rdi
movq 0x174574(%rip), %rax    # 0x208ad0
movswl (%rax), %esi
callq 0x5da50
testb $0x1, %al
jne 0x94584
movq -0xa0(%rbp), %rdi
callq 0x5c9c0
movq -0x110(%rbp), %rcx
cmpq 0x190(%rcx), %rax
je 0x94589
jmp 0x94780
movq -0xa0(%rbp), %rax
movq %rax, -0xa8(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x2, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x945b8
jmp 0x9468b
movq -0xa8(%rbp), %rdi
callq 0x5dab0
movl %eax, -0x134(%rbp)
movq -0x50(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movl -0x134(%rbp), %eax
movswl %cx, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0xf2ed2(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0xac(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x10, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x9461b
jmp 0x94639
movl -0xac(%rbp), %eax
movl -0x60(%rbp), %ecx
subl $0x3, %ecx
cmpl %ecx, %eax
jl 0x94639
movl -0xac(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x60(%rbp)
jmp 0x94686
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x10, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x94684
movl -0xac(%rbp), %eax
movl -0x58(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x94684
movq -0x110(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x5a210
subl -0xac(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x58(%rbp)
jmp 0x94686
jmp 0x9477e
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x1, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x946ac
jmp 0x9477c
movq -0xa8(%rbp), %rdi
callq 0x5ddb0
movl %eax, -0x138(%rbp)
movq -0x50(%rbp), %rdi
callq 0x5d470
movw %ax, %cx
movl -0x138(%rbp), %eax
movswl %cx, %ecx
imull %ecx, %eax
cvtsi2sd %eax, %xmm0
movsd 0xf2dde(%rip), %xmm1    # 0x1874c0
divsd %xmm1, %xmm0
callq 0x5a970
movl %eax, -0xb0(%rbp)
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x4, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x9470f
jmp 0x9472d
movl -0xb0(%rbp), %eax
movl -0x5c(%rbp), %ecx
subl $0x2, %ecx
cmpl %ecx, %eax
jl 0x9472d
movl -0xb0(%rbp), %eax
addl $0x4, %eax
movl %eax, -0x5c(%rbp)
jmp 0x9477a
movq -0xa8(%rbp), %rdi
callq 0x5a120
movl %eax, %edi
movl $0x4, %esi
callq 0x5ce30
testb $0x1, %al
jne 0x94778
movl -0xb0(%rbp), %eax
movl -0x54(%rbp), %ecx
addl $0x1, %ecx
cmpl %ecx, %eax
jg 0x94778
movq -0x110(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x5b860
subl -0xb0(%rbp), %eax
subl $0x2, %eax
movl %eax, -0x54(%rbp)
jmp 0x9477a
jmp 0x9477c
jmp 0x9477e
jmp 0x94780
movl -0x94(%rbp), %eax
addl $-0x1, %eax
movl %eax, -0x94(%rbp)
jmp 0x9451d
movq -0x110(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x59bc0
movq %rax, %rdi
callq 0x5c5d0
movups (%rax), %xmm0
movaps %xmm0, -0xc0(%rbp)
movl -0x14(%rbp), %eax
testl %eax, %eax
jne 0x94932
jmp 0x947c6
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x59b30
testb $0x1, %al
jne 0x9480e
cmpl $0x0, -0xc0(%rbp)
jne 0x94930
cmpl $0x0, -0xbc(%rbp)
jne 0x94930
cmpl $0x0, -0xb8(%rbp)
jne 0x94930
cmpl $0x0, -0xb4(%rbp)
jne 0x94930
movl -0xb8(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xb8(%rbp)
movl -0xb4(%rbp), %eax
addl $0x5, %eax
movl %eax, -0xb4(%rbp)
leaq -0xc0(%rbp), %rdi
leaq -0x60(%rbp), %rsi
callq 0x5d6a0
movq %rax, -0xd0(%rbp)
movq %rdx, -0xc8(%rbp)
movq -0x50(%rbp), %rax
movq %rax, -0x158(%rbp)
movq 0x174744(%rip), %rax    # 0x208fa0
movl (%rax), %eax
movl %eax, -0x14c(%rbp)
leaq -0xd8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
movq -0x158(%rbp), %rdi
movl -0x14c(%rbp), %ecx
leaq -0xd0(%rbp), %rsi
movq 0x173db9(%rip), %rdx    # 0x208648
leaq -0xd8(%rbp), %r8
callq 0x5c110
movq -0x50(%rbp), %rax
movq %rax, -0x148(%rbp)
leaq -0xf0(%rbp), %rdi
movl $0x1, %edx
movl %edx, %esi
callq 0x59260
leaq -0x60(%rbp), %rdi
leaq -0xf0(%rbp), %rsi
callq 0x5c040
movq %rax, -0xe8(%rbp)
movq %rdx, -0xe0(%rbp)
movq 0x173f1a(%rip), %rax    # 0x2087f8
movl (%rax), %eax
movl %eax, -0x13c(%rbp)
leaq -0xf8(%rbp), %rdi
xorl %edx, %edx
movl %edx, %esi
callq 0x59260
movq -0x148(%rbp), %rdi
movl -0x13c(%rbp), %ecx
leaq -0xe8(%rbp), %rsi
movq 0x173f4f(%rip), %rdx    # 0x208860
leaq -0xf8(%rbp), %r8
callq 0x5c110
movq -0x110(%rbp), %rdi
addq $0x5b8, %rdi            # imm = 0x5B8
callq 0x8af60
jmp 0x94932
leaq -0x108(%rbp), %rdi
movq %rdi, -0x168(%rbp)
callq 0x5ca80
movq -0x168(%rbp), %rdi
callq 0x59680
movl %eax, -0x15c(%rbp)
jmp 0x94959
movl -0x15c(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x5a410
jmp 0x9498a
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x108(%rbp), %rdi
callq 0x5a410
jmp 0x94996
movl -0x4(%rbp), %eax
addq $0x170, %rsp            # imm = 0x170
popq %rbp
retq
movq -0x30(%rbp), %rdi
callq 0x5b6b0
nop