// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
movq %rsi, %r12
testq %rsi, %rsi
je 0x8632
movq %rdi, %r15
movq %rdx, 0x18(%rdi)
leaq 0xa064(%rip), %rsi      # 0x12040
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x77f0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x7050
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7980
testq %rbx, %rbx
je 0x8042
leaq 0xa033(%rip), %rsi      # 0x12040
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
callq 0x77f0
movq %r12, %rdi
movq %rbx, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %r15, %rdi
movq %rax, %rsi
callq 0x7550
leaq 0x48(%rsp), %rdi
callq 0x7980
movq %r15, 0x18(%rsp)
movq %r12, %rdi
callq 0x75f0
testl %eax, %eax
jle 0x85f9
movq 0x18(%rsp), %rax
leaq 0xd0(%rax), %rcx
movq %rcx, 0x20(%rsp)
leaq 0x78(%rax), %rcx
movq %rcx, 0x88(%rsp)
addq $0x20, %rax
movq %rax, 0x90(%rsp)
leaq 0xa0(%rsp), %rbp
leaq 0xf8(%rsp), %r14
leaq 0x28(%rsp), %r15
xorl %esi, %esi
movq %r12, 0x98(%rsp)
movq %r12, %rdi
movl %esi, 0x44(%rsp)
callq 0x7850
movq %rax, %r12
movq %rax, %rdi
callq 0x7830
movq %rax, %rdi
leaq 0xa29f(%rip), %rsi      # 0x1235f
callq 0x7840
testb %al, %al
je 0x82de
movq %r12, (%rsp)
movq 0x10f20(%rip), %r12     # 0x18ff8
movswl (%r12), %edx
movq 0x10e94(%rip), %r13     # 0x18f78
movswl (%r13), %ecx
xorl %ebx, %ebx
movq %rbx, 0xa8(%rsp)
movl %ebx, 0xa0(%rsp)
leaq 0x48(%rsp), %rdi
movq %rbp, %r14
movq 0x10ee7(%rip), %rbp     # 0x18ff0
movq %rbp, %rsi
movl %ecx, %r8d
movq %r14, %r9
callq 0x7770
movswl (%r12), %edx
movswl (%r13), %ecx
movq %rbx, 0x100(%rsp)
movl %ebx, 0xf8(%rsp)
movq %r14, %rbx
movq %r14, %rdi
leaq 0xf8(%rsp), %r14
movq %rbp, %rsi
movl %ecx, %r8d
movq %r14, %r9
callq 0x7770
movswl (%r12), %edx
movswl (%r13), %ecx
movq $0x0, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq %r14, %rdi
movq %rbp, %rsi
movl %ecx, %r8d
movq %r15, %r9
callq 0x7770
leaq 0x48(%rsp), %rdi
movq 0x10e14(%rip), %rsi     # 0x18f98
callq 0x7410
movq %rbx, %rbp
movq $0xff, 0x30(%rsp)
movl $0x0, 0x28(%rsp)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x7410
movq $0x247fff, 0x30(%rsp)   # imm = 0x247FFF
movl $0x0, 0x28(%rsp)
movq %r14, %rdi
movq %r15, %rsi
callq 0x7410
movq %r15, %rdi
leaq 0x9e77(%rip), %rsi      # 0x12045
callq 0x77f0
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rdi
callq 0x71e0
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x9c50
movq (%rax), %rbx
movq %r15, %rdi
callq 0x7980
testq %rbx, %rbx
je 0x83b8
movq %r15, %rdi
leaq 0x9e2c(%rip), %rsi      # 0x12045
callq 0x77f0
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rdi
callq 0x71e0
movq 0x8(%rsp), %rdi
movl %eax, %esi
callq 0x9c50
movq (%rax), %r13
movq %r15, %rdi
callq 0x7980
movq (%rsp), %rdi
callq 0x7030
leaq 0x650(%r13), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x7550
movq %r13, %rdi
callq 0xa956
movq %rbx, %rdi
xorl %esi, %esi
callq 0x74e0
movq %rbp, %rsi
testb %al, %al
jne 0x82cc
movq %r15, %rdi
leaq 0x9db9(%rip), %rsi      # 0x12048
callq 0x77f0
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
leaq 0x638(%r13), %rdi
movq %rax, %rsi
callq 0x7700
movl %eax, %ebx
movq %r15, %rdi
callq 0x7980
testb %bl, %bl
leaq 0x48(%rsp), %rsi
cmovneq %r14, %rsi
movq (%r13), %rax
movq %r13, %rdi
callq *0xe0(%rax)
jmp 0x84cb
movq %r12, %rdi
callq 0x7830
movq %rax, %rdi
leaq 0x9d5f(%rip), %rsi      # 0x1204f
callq 0x7840
testb %al, %al
je 0x84e5
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
leaq 0x9d34(%rip), %rsi      # 0x12040
callq 0x77f0
movq %r12, %rbp
movq %r12, %rdi
movq %rbx, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rdi
callq 0x7560
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0x9f68
movq (%rax), %rbx
leaq 0x48(%rsp), %r12
movq %r12, %rdi
callq 0x7980
testq %rbx, %rbx
je 0x850a
movq %r12, %rdi
leaq 0x9ce2(%rip), %rsi      # 0x12040
callq 0x77f0
movq %rbp, %rdi
movq %r12, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rdi
callq 0x7560
movq 0x20(%rsp), %rdi
movl %eax, %esi
callq 0x9f68
movq (%rax), %rbx
leaq 0x48(%rsp), %rdi
callq 0x7980
movq 0x18(%rbx), %rdx
movq %rbx, %rdi
movq %rbp, %rsi
movq 0x8(%rsp), %rcx
callq 0x7fac
leaq 0xa0(%rsp), %rbp
jmp 0x84e5
movl $0x668, %edi            # imm = 0x668
callq 0x7530
movq %rax, %r13
movq %r15, %rdi
leaq 0x9c76(%rip), %rsi      # 0x12045
callq 0x77f0
movq (%rsp), %rdi
movq %r15, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rdi
callq 0x71e0
movq %rax, %r12
leaq 0xe0(%rsp), %rbx
movq %rbx, %rdi
leaq 0x9c43(%rip), %rsi      # 0x12048
callq 0x77f0
movq (%rsp), %rdi
movq %rbx, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rax, %rbx
movq (%rsp), %rdi
callq 0x7030
movq %r13, %rdi
movl %r12d, %esi
movq %rbx, %rdx
movq %rax, %rcx
callq 0xa878
leaq 0xe0(%rsp), %rdi
callq 0x7980
movq %r15, %rdi
callq 0x7980
movq %r13, 0x10(%rsp)
addq $0x650, %r13            # imm = 0x650
movq %r13, %rdi
xorl %esi, %esi
callq 0x74e0
movq 0x10(%rsp), %rdi
movq (%rdi), %rcx
testb %al, %al
movq %r14, %rsi
cmovneq %rbp, %rsi
callq *0xe0(%rcx)
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0x10(%rsp), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
movq 0x10(%rsp), %rax
movq %rax, 0x28(%rsp)
movl 0x630(%rax), %edx
movq 0x8(%rsp), %rdi
movq %r15, %rsi
callq 0x9d04
movq 0x10(%rsp), %rax
movl 0x630(%rax), %edx
movq 0x90(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x9e36
movq %r14, %rdi
callq 0x7620
movq %rbp, %rdi
callq 0x7620
leaq 0x48(%rsp), %rdi
callq 0x7620
movl 0x44(%rsp), %ebx
incl %ebx
movq 0x98(%rsp), %r12
movq %r12, %rdi
callq 0x75f0
movl %ebx, %esi
cmpl %eax, %ebx
jl 0x809f
jmp 0x85f9
movl $0x128, %edi            # imm = 0x128
callq 0x7530
movq %rax, %r12
movq %rax, %rdi
callq 0x7dd4
movq %r12, 0xa0(%rsp)
movl $0xd60, %edi            # imm = 0xD60
callq 0x7530
movq %rax, %r13
leaq 0x48(%rsp), %rbx
movq %rbx, %rdi
leaq 0x9afd(%rip), %rsi      # 0x12040
callq 0x77f0
movq %rbp, %rdi
movq %rbx, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %r13, %rdi
movq %rax, %rsi
callq 0x7910
leaq 0x48(%rsp), %rdi
callq 0x7980
movq %r13, 0xf8(%rsp)
movq 0xa0(%rsp), %rdi
addq $0x630, %r13            # imm = 0x630
movq %rbp, %rsi
movq %r13, %rdx
movq 0x8(%rsp), %rcx
callq 0x7fac
movq 0xf8(%rsp), %rdi
movl $0x1, %esi
callq 0x7040
movq 0x18(%rsp), %rax
movq 0x18(%rax), %rdi
movq 0xf8(%rsp), %rsi
movq (%rdi), %rax
callq *0x30(%rax)
movq 0xa0(%rsp), %rdi
callq 0x7560
movq 0x20(%rsp), %rdi
leaq 0xa0(%rsp), %rbp
movq %rbp, %rsi
movl %eax, %edx
callq 0xa01c
movq 0x88(%rsp), %rdi
movq %r14, %rsi
callq 0xa14e
jmp 0x84e5
movl $0x688, %ebx            # imm = 0x688
movq 0x18(%rsp), %r15
movq 0x18(%r15), %rdi
addq %rbx, %rdi
leaq 0x117(%rip), %r14       # 0x8728
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x8f2a
addq 0x18(%r15), %rbx
movq %rbx, %rdi
movq %r14, %rsi
xorl %edx, %edx
movq %r15, %rcx
callq 0x8f96
testq %r12, %r12
setne %al
addq $0x138, %rsp            # imm = 0x138
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x86d8
movq %rax, %rbx
jmp 0x867e
movq %rax, %rbx
movl $0x128, %esi            # imm = 0x128
movq %r12, %rdi
jmp 0x8686
jmp 0x86d8
jmp 0x86e9
jmp 0x86a6
movq %rax, %rbx
jmp 0x86c7
jmp 0x86e9
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7980
movl $0xd60, %esi            # imm = 0xD60
movq %r13, %rdi
callq 0x70a0
jmp 0x871f
jmp 0x86e9
jmp 0x86ee
movq %rax, %rbx
jmp 0x8708
jmp 0x86e9
jmp 0x86e9
movq %rax, %rbx
jmp 0x8715
jmp 0x86e9
jmp 0x86e9
movq %rax, %rbx
jmp 0x86bd
jmp 0x86d8
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x7980
leaq 0x28(%rsp), %rdi
callq 0x7980
movl $0x668, %esi            # imm = 0x668
movq %r13, %rdi
callq 0x70a0
jmp 0x86fb
jmp 0x86e9
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7980
jmp 0x871f
jmp 0x86ee
movq %rax, %rbx
jmp 0x86fb
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x7980
leaq 0xf8(%rsp), %rdi
callq 0x7620
leaq 0xa0(%rsp), %rdi
callq 0x7620
leaq 0x48(%rsp), %rdi
callq 0x7620
movq %rbx, %rdi
callq 0x7290
nop