// File: /workspace/github_c_makefile_star2_O2/enzo1982[P]smooth/tools/translator/section.cpp
// Function: Section::Parse(smooth::XML::Node*, smooth::GUI::List*, smooth::Array<smooth::GUI::ListEntry*, smooth::GUI::ListEntry*>&)
Bool Section::Parse(XML::Node *section, List *plist, Array<ListEntry *> &entries)
{
	if (section == NIL) return False;

	list = plist;

	if (section->GetAttributeByName("name") != NIL) name = section->GetAttributeByName("name")->GetContent();

	for (Int i = 0; i < section->GetNOfNodes(); i++)
	{
		XML::Node	*entry = section->GetNthNode(i);

		if (entry->GetName() == "entry")
		{
			GUI::Font	 blackFont;
			GUI::Font	 redFont;
			GUI::Font	 orangeFont;

			blackFont.SetColor(Setup::ClientTextColor);
			redFont.SetColor(Color(255, 0, 0));
			orangeFont.SetColor(Color(255, 127, 36));

			if (entries.Get(entry->GetAttributeByName("id")->GetContent().ToInt()) != NIL)
			{
				StringItem	*item = (StringItem *) entries.Get(entry->GetAttributeByName("id")->GetContent().ToInt());

				item->SetTranslation(entry->GetContent());

				if	(item->GetTranslation() == NIL)						   item->SetFont(redFont);
				else if (item->GetOriginal() != entry->GetAttributeByName("string")->GetContent()) item->SetFont(orangeFont);
				else										   item->SetFont(blackFont);
			}
			else
			{
				StringItem	*item = new StringItem(entry->GetAttributeByName("id")->GetContent().ToInt(),
								       entry->GetAttributeByName("string")->GetContent(),
								       entry->GetContent());

				if (item->GetTranslation() == NIL) item->SetFont(redFont);
				else				   item->SetFont(orangeFont);

				list->Add(item);

				entries.Add(item, item->GetID());

				items.Add(item, item->GetID());
			}
		}
		else if (entry->GetName() == "section")
		{
			if (sections.Get(entry->GetAttributeByName("name")->GetContent().ComputeCRC32()) == NIL)
			{
				Section	*section = new Section();
				Tree	*tree	 = new Tree(entry->GetAttributeByName("name")->GetContent());

				section->Parse(entry, tree->GetList(), entries);

				tree->Open();
				list->Add(tree);

				sections.Add(section, section->GetName().ComputeCRC32());

				trees.Add(tree);
			}
			else
			{
				Section	*section = sections.Get(entry->GetAttributeByName("name")->GetContent().ComputeCRC32());

				section->Parse(entry, section->list, entries);
			}
		}
	}

	/* OnSelectEntry may already be connected if we parsed a template
	 * before, so try to disconnect before actually connecting it.
	 */
	list->onSelectEntry.Disconnect(&Section::OnSelectEntry, this);
	list->onSelectEntry.Connect(&Section::OnSelectEntry, this);

	return True;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x138, %rsp            # imm = 0x138
movq %rcx, 0x28(%rsp)
movq %rsi, %r12
testq %rsi, %rsi
je 0x95be
movq %rdi, %r15
movq %rdx, 0x18(%rdi)
leaq 0x90b0(%rip), %rsi      # 0x12030
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x8800
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x8990
testq %rbx, %rbx
je 0x8fe6
leaq 0x907f(%rip), %rsi      # 0x12030
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x8800
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %r15, %rdi
movq %rax, %rsi
callq 0x8550
leaq 0x48(%rsp), %rdi
callq 0x8990
movq %r12, 0x98(%rsp)
leaq 0xd0(%r15), %rax
movq %rax, 0x40(%rsp)
leaq 0x78(%r15), %rax
movq %rax, 0x88(%rsp)
movq %r15, 0x38(%rsp)
leaq 0x20(%r15), %rax
movq %rax, 0x90(%rsp)
xorl %r13d, %r13d
leaq 0xf8(%rsp), %r15
movq 0x98(%rsp), %r12
movq %r12, %rdi
callq 0x85f0
cmpl %eax, %r13d
jge 0x9585
movq %r12, %rdi
movl %r13d, %esi
callq 0x8860
movq %rax, %r14
movq %rax, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x92f4(%rip), %rsi      # 0x1234f
callq 0x8850
testb %al, %al
je 0x927e
movq %r14, 0x8(%rsp)
movq 0xff84(%rip), %rbx      # 0x18ff8
movswl (%rbx), %edx
andq $0x0, 0xa8(%rsp)
movq 0xfef1(%rip), %r14      # 0x18f78
movswl (%r14), %ecx
andl $0x0, 0xa0(%rsp)
leaq 0x48(%rsp), %rdi
movq 0xff51(%rip), %r12      # 0x18ff0
movq %r12, %rsi
movl %ecx, %r8d
movq %r15, %rbp
leaq 0xa0(%rsp), %r15
movq %r15, %r9
callq 0x8780
movswl (%rbx), %edx
andq $0x0, 0x100(%rsp)
movswl (%r14), %ecx
andl $0x0, 0xf8(%rsp)
movq %r15, %rdi
movq %rbp, %r15
movq %r12, %rsi
movl %ecx, %r8d
movq %rbp, %r9
callq 0x8780
movswl (%rbx), %edx
andq $0x0, 0x18(%rsp)
movswl (%r14), %ecx
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %r12, %rsi
movl %ecx, %r8d
leaq 0x10(%rsp), %r9
callq 0x8780
leaq 0x48(%rsp), %rdi
movq 0xfe83(%rip), %rsi      # 0x18f98
callq 0x8410
movq 0x8(%rsp), %r14
movq $0xff, 0x18(%rsp)
andl $0x0, 0x10(%rsp)
leaq 0xa0(%rsp), %rdi
leaq 0x10(%rsp), %rbx
movq %rbx, %rsi
callq 0x8410
movq $0x247fff, 0x18(%rsp)   # imm = 0x247FFF
andl $0x0, 0x10(%rsp)
movq %r15, %rdi
movq %rbx, %rsi
callq 0x8410
movq %rbx, %rdi
leaq 0x8ed0(%rip), %rsi      # 0x12035
callq 0x8800
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rdi
callq 0x81e0
movq 0x28(%rsp), %rdi
movl %eax, %esi
callq 0xab44
movq (%rax), %rbx
leaq 0x10(%rsp), %r14
movq %r14, %rdi
callq 0x8990
testq %rbx, %rbx
je 0x9350
movq %r14, %rdi
leaq 0x8e81(%rip), %rsi      # 0x12035
callq 0x8800
movq 0x8(%rsp), %rdi
movq %r14, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rdi
callq 0x81e0
movq 0x28(%rsp), %rdi
movl %eax, %esi
callq 0xab44
movq (%rax), %r14
leaq 0x10(%rsp), %rdi
callq 0x8990
movq 0x8(%rsp), %rdi
callq 0x8030
movq %r14, %rdi
movq %rax, %rsi
callq 0x9ea8
leaq 0x650(%r14), %rdi
xorl %esi, %esi
callq 0x84e0
leaq 0xa0(%rsp), %rsi
testb %al, %al
jne 0x926d
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8e0b(%rip), %rsi      # 0x12038
callq 0x8800
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
leaq 0x638(%r14), %rdi
movq %rax, %rsi
callq 0x8700
movl %eax, %ebx
leaq 0x10(%rsp), %rdi
callq 0x8990
testb %bl, %bl
leaq 0x48(%rsp), %rsi
cmovneq %r15, %rsi
movq (%r14), %rax
movq %r14, %rdi
callq *0xe0(%rax)
jmp 0x9477
movq %r14, %rdi
callq 0x8840
movq %rax, %rdi
leaq 0x8daf(%rip), %rsi      # 0x1203f
callq 0x8850
testb %al, %al
je 0x9496
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8d84(%rip), %rsi      # 0x12030
callq 0x8800
movq %r14, %r12
movq %r14, %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rdi
callq 0x8560
movq 0x40(%rsp), %rdi
movl %eax, %esi
callq 0xae28
movq (%rax), %rbx
leaq 0x48(%rsp), %r14
movq %r14, %rdi
callq 0x8990
testq %rbx, %rbx
je 0x949e
movq %r14, %rdi
leaq 0x8d32(%rip), %rsi      # 0x12030
callq 0x8800
movq %r12, %rdi
movq %r14, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rdi
callq 0x8560
movq 0x40(%rsp), %rdi
movl %eax, %esi
callq 0xae28
movq (%rax), %rbx
leaq 0x48(%rsp), %rdi
callq 0x8990
movq 0x18(%rbx), %rdx
movq %rbx, %rdi
movq %r12, %rsi
movq 0x28(%rsp), %rcx
callq 0x8f50
jmp 0x9496
movl $0x668, %edi            # imm = 0x668
callq 0x8530
movq %rax, %r14
leaq 0x10(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8cc9(%rip), %rsi      # 0x12035
callq 0x8800
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rdi
callq 0x81e0
movq %rax, %r12
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8c95(%rip), %rsi      # 0x12038
callq 0x8800
movq 0x8(%rsp), %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rax, %rbx
movq 0x8(%rsp), %rdi
callq 0x8030
movq %r14, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0xb6d8
leaq 0xe0(%rsp), %rdi
callq 0x8990
leaq 0x10(%rsp), %rdi
callq 0x8990
movq %r14, 0x30(%rsp)
addq $0x650, %r14            # imm = 0x650
movq %r14, %rdi
xorl %esi, %esi
callq 0x84e0
movq 0x30(%rsp), %rdi
movq (%rdi), %rcx
testb %al, %al
movq %r15, %rsi
leaq 0xa0(%rsp), %rax
cmovneq %rax, %rsi
callq *0xe0(%rcx)
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x30(%rsp), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
movq 0x30(%rsp), %rax
movq %rax, 0x10(%rsp)
movl 0x630(%rax), %edx
movq 0x28(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0xabe4
movq 0x30(%rsp), %rax
movl 0x630(%rax), %edx
movq 0x90(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0xad06
movq %r15, %rdi
callq 0x8620
leaq 0xa0(%rsp), %rdi
callq 0x8620
leaq 0x48(%rsp), %rdi
callq 0x8620
incl %r13d
jmp 0x9022
movl $0x128, %edi            # imm = 0x128
callq 0x8530
movq %rax, %r14
movq %rax, %rdi
callq 0x8de4
movq %r14, 0xa0(%rsp)
movl $0xd60, %edi            # imm = 0xD60
callq 0x8530
movq %rax, %r14
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
leaq 0x8b59(%rip), %rsi      # 0x12030
callq 0x8800
movq %r12, %rdi
movq %rbx, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %r14, %rdi
movq %rax, %rsi
callq 0x8920
leaq 0x48(%rsp), %rdi
callq 0x8990
movq %r14, 0xf8(%rsp)
movq 0xa0(%rsp), %rdi
addq $0x630, %r14            # imm = 0x630
movq %r12, %rsi
movq %r14, %rdx
movq 0x28(%rsp), %rcx
callq 0x8f50
movq 0xf8(%rsp), %rdi
callq 0x9ec2
movq 0x38(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xf8(%rsp), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
movq 0xa0(%rsp), %rdi
callq 0x8560
movq 0x40(%rsp), %rdi
leaq 0xa0(%rsp), %rsi
movl %eax, %edx
callq 0xaec8
movq 0x88(%rsp), %rdi
movq %r15, %rsi
callq 0xafea
jmp 0x9496
movl $0x688, %ebx            # imm = 0x688
movq 0x38(%rsp), %r15
movq 0x18(%r15), %rdi
addq %rbx, %rdi
leaq 0x113(%rip), %r14       # 0x96b0
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x9eca
addq 0x18(%r15), %rbx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x9f34
testq %r12, %r12
setne %al
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9661
jmp 0x9661
movq %rax, %rbx
jmp 0x9607
movq %rax, %rbx
movl $0x128, %esi            # imm = 0x128
jmp 0x960c
jmp 0x9670
movq %rax, %rbx
jmp 0x9650
jmp 0x962f
jmp 0x9670
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x8990
movl $0xd60, %esi            # imm = 0xD60
movq %r14, %rdi
callq 0x80a0
jmp 0x96a8
jmp 0x9670
jmp 0x9677
movq %rax, %rbx
jmp 0x969e
jmp 0x9670
jmp 0x9670
jmp 0x9670
jmp 0x9670
movq %rax, %rbx
jmp 0x9691
movq %rax, %rbx
jmp 0x9646
jmp 0x9661
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x8990
leaq 0x10(%rsp), %rdi
callq 0x8990
movl $0x668, %esi            # imm = 0x668
movq %r14, %rdi
callq 0x80a0
jmp 0x9684
jmp 0x9670
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x8990
jmp 0x96a8
movq %rax, %rbx
jmp 0x9684
jmp 0x9677
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x8990
leaq 0xf8(%rsp), %rdi
callq 0x8620
leaq 0xa0(%rsp), %rdi
callq 0x8620
leaq 0x48(%rsp), %rdi
callq 0x8620
movq %rbx, %rdi
callq 0x8290