// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/gui/widgets/basic/tabwidget.cpp
// Function: smooth::GUI::TabWidget::Process(int, int, int)
S::Int S::GUI::TabWidget::Process(Int message, Int wParam, Int lParam)
{
	if (!IsRegistered())		 return Error();
	if (!IsActive() || !IsVisible()) return Success();

	switch (message)
	{
		case SM_LBUTTONDOWN:
			{
				Window	*window	 = container->GetContainerWindow();
				Surface	*surface = GetDrawSurface();
				Point	 realPos = GetRealPosition();
				Int	 offset	 = 19 * surface->GetSurfaceDPI() / 96;
				Rect	 frame	 = Rect(Point(0, realPos.y + 1), Size(realPos.x, offset - 1));

				for (Int i = 0; i < GetNOfObjects(); i++)
				{
					Widget		*widget = GetNthObject(i);

					const Bitmap	&bitmap = bitmaps.Get(widget->GetHandle());
					Size		 sSize	= bitmap == NIL ? Size() : Size(bitmap.GetSize().cx / (bitmap.GetSize().cy / 15.0) , 15) * surface->GetSurfaceDPI() / 96;

					frame.left  = frame.right + 1;
					frame.right = frame.left + widget->GetScaledTextWidth() + sSize.cx + 6 + Int(widget->GetText() != NIL ? 6 : 0);

					if (!widget->IsVisible() && window->IsMouseOn(frame)) { SelectTab(widget); break; }
				}
			}

			break;
	}

	return Widget::Process(message, wParam, lParam);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x100, %rsp            # imm = 0x100
movq %rdi, -0x10(%rbp)
movl %esi, -0x14(%rbp)
movl %edx, -0x18(%rbp)
movl %ecx, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movq %rdi, -0xc0(%rbp)
movq (%rdi), %rax
callq *0x88(%rax)
testb $0x1, %al
jne 0xa56fa
leaq -0x30(%rbp), %rdi
movq %rdi, -0xd0(%rbp)
movl $0xffffffff, %esi       # imm = 0xFFFFFFFF
callq 0x5a9c0
movq -0xd0(%rbp), %rdi
callq 0x59680
movl %eax, -0xc4(%rbp)
jmp 0xa56c9
movl -0xc4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5b5b0
jmp 0xa5a31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5b5b0
jmp 0xa5a3d
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
callq *0x98(%rax)
testb $0x1, %al
jne 0xa5710
jmp 0xa5724
movq -0xc0(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa5779
leaq -0x50(%rbp), %rdi
movq %rdi, -0xe0(%rbp)
callq 0x5ca80
movq -0xe0(%rbp), %rdi
callq 0x59680
movl %eax, -0xd4(%rbp)
jmp 0xa5748
movl -0xd4(%rbp), %eax
movl %eax, -0x4(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5a410
jmp 0xa5a31
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x38(%rbp)
movl %eax, -0x3c(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5a410
jmp 0xa5a3d
movl -0x14(%rbp), %eax
subl $0x7801, %eax           # imm = 0x7801
jne 0xa5a19
jmp 0xa5789
movq -0xc0(%rbp), %rax
movq 0x190(%rax), %rdi
callq 0x59bc0
movq -0xc0(%rbp), %rdi
movq %rax, -0x58(%rbp)
movq (%rdi), %rax
callq *0x40(%rax)
movq -0xc0(%rbp), %rdi
movq %rax, -0x60(%rbp)
movq (%rdi), %rax
callq *0x48(%rax)
movq %rax, -0x68(%rbp)
movq -0x60(%rbp), %rdi
callq 0x5d470
cwtl
imull $0x13, %eax, %eax
movl $0x60, %ecx
cltd
idivl %ecx
movl %eax, -0x6c(%rbp)
movl -0x64(%rbp), %edx
addl $0x1, %edx
leaq -0x84(%rbp), %rdi
xorl %esi, %esi
callq 0x5c2c0
movl -0x68(%rbp), %esi
movl -0x6c(%rbp), %edx
subl $0x1, %edx
leaq -0x8c(%rbp), %rdi
callq 0x59260
leaq -0x7c(%rbp), %rdi
leaq -0x84(%rbp), %rsi
leaq -0x8c(%rbp), %rdx
callq 0x59ff0
movl $0x0, -0x90(%rbp)
movq -0xc0(%rbp), %rdi
movl -0x90(%rbp), %eax
movl %eax, -0xe4(%rbp)
callq 0x5b470
movl %eax, %ecx
movl -0xe4(%rbp), %eax
cmpl %ecx, %eax
jge 0xa5a17
movq -0xc0(%rbp), %rdi
movl -0x90(%rbp), %esi
callq 0x5c230
movq %rax, %rcx
movq -0xc0(%rbp), %rax
movq %rcx, -0x98(%rbp)
addq $0x5c0, %rax            # imm = 0x5C0
movq %rax, -0xf0(%rbp)
movq -0x98(%rbp), %rdi
callq 0x5d050
movq -0xf0(%rbp), %rdi
movl %eax, %esi
callq 0xa63c0
movq %rax, -0xa0(%rbp)
movq -0xa0(%rbp), %rdi
xorl %esi, %esi
callq 0x5c730
testb $0x1, %al
jne 0xa58b1
jmp 0xa58c2
leaq -0xa8(%rbp), %rdi
callq 0x59230
jmp 0xa5954
movq -0xa0(%rbp), %rdi
callq 0x5ce60
cvtsi2sdl (%rax), %xmm0
movsd %xmm0, -0xf8(%rbp)
movq -0xa0(%rbp), %rdi
callq 0x5ce60
movsd -0xf8(%rbp), %xmm0
cvtsi2sdl 0x4(%rax), %xmm1
movsd 0xe47cd(%rip), %xmm2    # 0x18a0c8
divsd %xmm2, %xmm1
divsd %xmm1, %xmm0
cvttsd2si %xmm0, %esi
leaq -0xb8(%rbp), %rdi
movl $0xf, %edx
callq 0x59260
movq -0x60(%rbp), %rdi
callq 0x5d470
cwtl
cvtsi2sd %eax, %xmm0
leaq -0xb8(%rbp), %rdi
callq 0x5a7b0
movq %rax, -0xb0(%rbp)
leaq -0xb0(%rbp), %rdi
movsd 0xe1b78(%rip), %xmm0    # 0x1874c0
callq 0x5c6b0
movq %rax, -0xa8(%rbp)
movl -0x74(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x7c(%rbp)
movl -0x7c(%rbp), %eax
movl %eax, -0x100(%rbp)
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0xf8(%rax)
movl %eax, %ecx
movl -0x100(%rbp), %eax
addl %ecx, %eax
addl -0xa8(%rbp), %eax
addl $0x6, %eax
movl %eax, -0xfc(%rbp)
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0xa8(%rax)
movq %rax, %rdi
xorl %esi, %esi
callq 0x5b110
movb %al, %sil
movl -0xfc(%rbp), %eax
xorl %ecx, %ecx
movl $0x6, %edx
testb $0x1, %sil
cmovnel %edx, %ecx
addl %ecx, %eax
movl %eax, -0x74(%rbp)
movq -0x98(%rbp), %rdi
movq (%rdi), %rax
callq *0x90(%rax)
testb $0x1, %al
jne 0xa5a01
movq -0x58(%rbp), %rdi
leaq -0x7c(%rbp), %rsi
callq 0x5c060
testb $0x1, %al
jne 0xa59ec
jmp 0xa5a01
movq -0xc0(%rbp), %rdi
movq -0x98(%rbp), %rsi
callq 0x5a890
jmp 0xa5a17
jmp 0xa5a03
movl -0x90(%rbp), %eax
addl $0x1, %eax
movl %eax, -0x90(%rbp)
jmp 0xa5824
jmp 0xa5a19
movq -0xc0(%rbp), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
movl -0x1c(%rbp), %ecx
callq 0x5cbf0
movl %eax, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x100, %rsp            # imm = 0x100
popq %rbp
retq
movq -0x38(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)