// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/tools/translator/translator.cpp
// Function: Translator::OpenFileName(smooth::String const&)
Void Translator::OpenFileName(const String &openFile)
{
	/* Open document and check format.
	 */
	XML::Document	 doc;

	if (doc.LoadFile(openFile) == Error())
	{
		QuickMessage(String("Invalid file format: ").Append(GetShortFileName(openFile)), "smooth Translator", Message::Buttons::Ok, Message::Icon::Error);

		return;
	}

	/* Setup new file and load document.
	 */
	NewFile();

	fileName = openFile;

	wnd->SetText(String("smooth Translator v").Append(SMOOTH_VERSION).Append(" - ").Append(GetShortFileName(fileName)));

	XML::Node	*info = doc.GetRootNode()->GetNodeByName("info");

	for (Int k = 0; k < info->GetNOfNodes(); k++)
	{
		String		 property = info->GetNthNode(k)->GetAttributeByName("name")->GetContent();
		InfoItem	*entry = NULL;

		if	(property == "program")	    entry = (InfoItem *) entries.GetNth(0);
		else if (property == "version")	    entry = (InfoItem *) entries.GetNth(1);
		else if (property == "language")    entry = (InfoItem *) entries.GetNth(2);
		else if (property == "righttoleft") entry = (InfoItem *) entries.GetNth(3);

		else if (property == "template")
		{
			templateName = info->GetNthNode(k)->GetContent();

			if (OpenTemplate(File(fileName).GetFilePath().Append(Directory::GetDirectoryDelimiter()).Append(templateName)) != Success())
			{
				templateName = NIL;
			}

			entry = (InfoItem *) entries.GetNth(4);
		}

		else if (property == "author")	    entry = (InfoItem *) entries.GetNth(5);
		else if (property == "url")	    entry = (InfoItem *) entries.GetNth(6);

		if (entry != NIL)
		{
			entry->SetValue(info->GetNthNode(k)->GetContent());
		}
	}

	XML::Node	*data = doc.GetRootNode()->GetNodeByName("data");

	dataSection->Parse(data, list_entries, entries);

	/* Look for entries with the same original text and suggest a translation.
	 */
	for (Int i = 0; i < entries.Length(); i++)
	{
		if (entries.GetNthIndex(i) < 0) continue;

		StringItem	*item = (StringItem *) entries.GetNth(i);

		if (item->GetTranslation() != NIL) continue;

		for (Int j = 0; j < entries.Length(); j++)
		{
			if (entries.GetNthIndex(j) < 0 || i == j) continue;

			StringItem	*item2 = (StringItem *) entries.GetNth(j);

			if (item->GetOriginal() == item2->GetOriginal() && item2->GetTranslation() != NIL)
			{
				item->SetTranslation(item2->GetTranslation());

				break;
			}
		}
	}

	list_entries->SelectNthEntry(0);

	SelectEntry(entries.GetFirst());
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xd8, %rsp
movq %rsi, %rbx
movq %rdi, %r15
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x7310
movq %r14, %rdi
movq %rbx, %rsi
callq 0x70c0
movq %r15, (%rsp)
cmpl $-0x1, %eax
je 0xec9a
movq (%rsp), %r14
movq %r14, %rdi
callq 0xd7ec
leaq 0x688(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7550
movq 0x5b8(%r14), %r14
leaq 0x3afe(%rip), %rsi      # 0x12309
leaq 0x48(%rsp), %rdi
callq 0x77f0
leaq 0x3b01(%rip), %rsi      # 0x1231d
leaq 0x30(%rsp), %rdi
callq 0x77f0
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7170
movq %rax, %rbx
leaq 0x3c80(%rip), %rsi      # 0x124bf
leaq 0x10(%rsp), %rdi
callq 0x77f0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0x7170
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
movq %r15, %rdx
callq 0xf1f6
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
callq 0x7170
movq (%r14), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *0xa0(%rcx)
leaq 0x78(%rsp), %rdi
callq 0x7980
leaq 0x10(%rsp), %rdi
callq 0x7980
leaq 0x30(%rsp), %rdi
callq 0x7980
leaq 0x48(%rsp), %rdi
callq 0x7980
leaq 0xb0(%rsp), %rdi
callq 0x7260
movq %rax, %rbx
leaq 0x3c02(%rip), %rsi      # 0x124c3
leaq 0x48(%rsp), %rdi
callq 0x77f0
movq %r15, 0x90(%rsp)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x76a0
movq %rax, %r12
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x7980
movq (%rsp), %rax
leaq 0x6b8(%rax), %r14
addq $0x6a0, %rax            # imm = 0x6A0
movq %rax, 0x8(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %rbp
movq %r12, %rdi
callq 0x75f0
cmpl %eax, %r15d
jge 0xeb3b
movq %r12, %rdi
movl %r15d, %esi
callq 0x7850
movq %rax, %rbx
movq %r13, %rdi
leaq 0x3709(%rip), %rsi      # 0x12040
callq 0x77f0
movq %rbx, %rdi
movq %r13, %rsi
callq 0x7050
movq %rax, %rdi
callq 0x7110
movq %rbp, %rdi
movq %rax, %rsi
callq 0x7720
movq %r13, %rdi
callq 0x7980
movq %rbp, %rdi
leaq 0x3b5c(%rip), %rsi      # 0x124c8
callq 0x7840
xorl %ebx, %ebx
testb %al, %al
jne 0xeaef
movq %rbp, %rdi
leaq 0x3b4b(%rip), %rsi      # 0x124d0
callq 0x7840
movl $0x1, %ebx
testb %al, %al
jne 0xeaef
movq %rbp, %rdi
leaq 0x3b37(%rip), %rsi      # 0x124d8
callq 0x7840
movl $0x2, %ebx
testb %al, %al
jne 0xeaef
movq %rbp, %rdi
leaq 0x3b24(%rip), %rsi      # 0x124e1
callq 0x7840
movl $0x3, %ebx
testb %al, %al
jne 0xeaef
movq %rbp, %rdi
leaq 0x3b14(%rip), %rsi      # 0x124ed
callq 0x7840
testb %al, %al
je 0xeabf
movq %r12, %rdi
movl %r15d, %esi
callq 0x7850
movq %rax, %rdi
callq 0x7030
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x7550
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x7480
movq %r13, %rdi
movq 0x90(%rsp), %rsi
movq %rbx, %rdx
callq 0x7660
movq %r13, %rdi
callq 0x73b0
movq %rax, %rbx
callq 0x70d0
leaq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x77f0
leaq 0x98(%rsp), %rdx
leaq 0x10(%rsp), %rdi
movq %rbx, %rsi
callq 0x78a0
leaq 0x10(%rsp), %rdi
movq 0x8(%rsp), %rsi
callq 0x7170
movq (%rsp), %rdi
movq %rax, %rsi
callq 0xf2f0
movl %eax, 0x2c(%rsp)
leaq 0x10(%rsp), %rdi
callq 0x7980
leaq 0x98(%rsp), %rdi
callq 0x7980
movq %r13, %rdi
callq 0x7250
leaq 0x78(%rsp), %rdi
callq 0x7980
movl $0x4, %ebx
cmpl $0x0, 0x2c(%rsp)
je 0xeaef
movq 0x8(%rsp), %rdi
xorl %esi, %esi
callq 0x77c0
jmp 0xeaef
movq %rbp, %rdi
leaq 0x3a2d(%rip), %rsi      # 0x124f6
callq 0x7840
movl $0x5, %ebx
testb %al, %al
jne 0xeaef
movq %rbp, %rdi
leaq 0x3a1c(%rip), %rsi      # 0x124fd
callq 0x7840
movl $0x6, %ebx
testb %al, %al
je 0xeb2b
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c68
movq (%rax), %rbx
testq %rbx, %rbx
je 0xeb2b
movq %r12, %rdi
movl %r15d, %esi
callq 0x7850
movq %rax, %rdi
callq 0x7030
leaq 0x648(%rbx), %rdi
movq %rax, %rsi
callq 0x7550
movq %rbx, %rdi
callq 0x7bf6
movq %rbp, %rdi
callq 0x7980
incl %r15d
jmp 0xe90e
leaq 0xb0(%rsp), %rdi
callq 0x7260
movq %rax, %rbx
leaq 0x3952(%rip), %rsi      # 0x124a4
leaq 0x48(%rsp), %rdi
callq 0x77f0
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x76a0
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7980
movq (%rsp), %rax
movq 0x600(%rax), %rdx
movq 0x768(%rax), %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x7fac
movq (%rsp), %rax
cmpl $0x0, 0x6c0(%rax)
jle 0xec72
xorl %ebp, %ebp
movq %r14, %rdi
movl %ebp, %esi
callq 0x72c0
testl %eax, %eax
js 0xec60
movq %r14, %rdi
movl %ebp, %esi
callq 0x9c68
movq (%rax), %r15
leaq 0x650(%r15), %rdi
movq %rdi, 0x8(%rsp)
xorl %esi, %esi
callq 0x76f0
movq (%rsp), %rcx
cmpl $0x0, 0x6c0(%rcx)
setle %cl
orb %cl, %al
jne 0xec60
leaq 0x638(%r15), %r13
xorl %ebx, %ebx
movq %r14, %rdi
movl %ebx, %esi
callq 0x72c0
cmpl %ebx, %ebp
je 0xec3b
testl %eax, %eax
js 0xec3b
movq %r14, %rdi
movl %ebx, %esi
callq 0x9c68
movq (%rax), %r12
leaq 0x638(%r12), %rsi
movq %r13, %rdi
callq 0x7580
testb %al, %al
je 0xec3b
addq $0x650, %r12            # imm = 0x650
movq %r12, %rdi
xorl %esi, %esi
callq 0x76f0
testb %al, %al
jne 0xec4b
incl %ebx
movq (%rsp), %rax
cmpl 0x6c0(%rax), %ebx
jl 0xebf3
jmp 0xec60
movq 0x8(%rsp), %rdi
movq %r12, %rsi
callq 0x7550
movq %r15, %rdi
callq 0xa902
incl %ebp
movq (%rsp), %rax
cmpl 0x6c0(%rax), %ebp
jl 0xeba6
movq (%rsp), %rax
movq 0x600(%rax), %rdi
xorl %esi, %esi
callq 0x7740
movq %r14, %rdi
callq 0x110da
movq (%rax), %rsi
movq (%rsp), %rdi
callq 0xc2de
jmp 0xed0d
leaq 0x3808(%rip), %rsi      # 0x124a9
leaq 0x48(%rsp), %rdi
callq 0x77f0
leaq 0x30(%rsp), %rdi
movq %rbx, %rdx
callq 0xf1f6
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7170
movq %rax, %rbx
leaq 0x3626(%rip), %rsi      # 0x122f7
leaq 0x10(%rsp), %rdi
callq 0x77f0
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movl $0x7f01, %ecx           # imm = 0x7F01
callq 0x7350
leaq 0x10(%rsp), %rdi
callq 0x7980
leaq 0x30(%rsp), %rdi
callq 0x7980
leaq 0x48(%rsp), %rdi
callq 0x7980
leaq 0xb0(%rsp), %rdi
callq 0x7500
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xed68
jmp 0xed6f
jmp 0xed6f
jmp 0xede3
jmp 0xedfe
movq %rax, %rbx
jmp 0xed88
jmp 0xed97
jmp 0xedef
movq %rax, %rbx
jmp 0xeda4
jmp 0xede3
jmp 0xedfe
jmp 0xede3
jmp 0xedfe
jmp 0xedfe
jmp 0xed68
movq %rax, %rbx
jmp 0xedbd
jmp 0xed6f
movq %rax, %rbx
jmp 0xedc7
jmp 0xede3
jmp 0xedfe
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x7980
leaq 0x98(%rsp), %rdi
callq 0x7980
jmp 0xed9a
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x7250
leaq 0x78(%rsp), %rdi
callq 0x7980
jmp 0xedf2
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x7980
leaq 0x10(%rsp), %rdi
callq 0x7980
leaq 0x30(%rsp), %rdi
callq 0x7980
jmp 0xede6
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
jmp 0xedfe
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xedf7
jmp 0xedfe
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x7980
jmp 0xee01
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x7500
movq %rbx, %rdi
callq 0x7290