// File: /workspace/github_c_makefile_star2_O2/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, %r14
movq %rdi, %r15
leaq 0xb0(%rsp), %rbx
movq %rbx, %rdi
callq 0x8310
movq %rbx, %rdi
movq %r14, %rsi
callq 0x80c0
movq %r15, 0x8(%rsp)
cmpl $-0x1, %eax
je 0xf8e4
movq 0x8(%rsp), %rbx
movq %rbx, %rdi
callq 0xe4ca
leaq 0x688(%rbx), %r15
movq %r15, %rdi
movq %r14, %rsi
callq 0x8550
movq 0x5b8(%rbx), %r14
leaq 0x2e66(%rip), %rsi      # 0x122f9
leaq 0x48(%rsp), %rdi
callq 0x8800
leaq 0x2e69(%rip), %rsi      # 0x1230d
leaq 0x30(%rsp), %rdi
callq 0x8800
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x8170
movq %rax, %rbx
leaq 0x2fe8(%rip), %rsi      # 0x124af
leaq 0x18(%rsp), %rdi
callq 0x8800
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x8170
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
movq %r15, %rdx
callq 0xfe32
leaq 0x78(%rsp), %rsi
movq %rbx, %rdi
callq 0x8170
movq (%r14), %rcx
movq %r14, %rdi
movq %rax, %rsi
callq *0xa0(%rcx)
leaq 0x78(%rsp), %rdi
callq 0x8990
leaq 0x18(%rsp), %rdi
callq 0x8990
leaq 0x30(%rsp), %rdi
callq 0x8990
leaq 0x48(%rsp), %rdi
callq 0x8990
leaq 0xb0(%rsp), %rdi
callq 0x8260
movq %rax, %rbx
leaq 0x2f6a(%rip), %rsi      # 0x124b3
leaq 0x48(%rsp), %rdi
callq 0x8800
movq %r15, 0x90(%rsp)
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x86a0
movq %rax, %r12
leaq 0x48(%rsp), %r13
movq %r13, %rdi
callq 0x8990
movq 0x8(%rsp), %rax
leaq 0x6b8(%rax), %r14
addq $0x6a0, %rax            # imm = 0x6A0
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %rbp
movq %r12, %rdi
callq 0x85f0
cmpl %eax, %r15d
jge 0xf7a9
movq %r12, %rdi
movl %r15d, %esi
callq 0x8860
movq %rax, %rbx
movq %r13, %rdi
leaq 0x2a70(%rip), %rsi      # 0x12030
callq 0x8800
movq %rbx, %rdi
movq %r13, %rsi
callq 0x8050
movq %rax, %rdi
callq 0x8110
movq %rbp, %rdi
movq %rax, %rsi
callq 0x8720
movq %r13, %rdi
callq 0x8990
movq %rbp, %rdi
leaq 0x2ec3(%rip), %rsi      # 0x124b8
callq 0x8850
xorl %esi, %esi
testb %al, %al
jne 0xf76b
movq %rbp, %rdi
leaq 0x2eb2(%rip), %rsi      # 0x124c0
callq 0x8850
pushq $0x1
popq %rsi
testb %al, %al
jne 0xf76b
movq %rbp, %rdi
leaq 0x2ea0(%rip), %rsi      # 0x124c8
callq 0x8850
pushq $0x2
popq %rsi
testb %al, %al
jne 0xf76b
movq %rbp, %rdi
leaq 0x2e8f(%rip), %rsi      # 0x124d1
callq 0x8850
pushq $0x3
popq %rsi
testb %al, %al
jne 0xf76b
movq %rbp, %rdi
leaq 0x2e81(%rip), %rsi      # 0x124dd
callq 0x8850
testb %al, %al
je 0xf73f
movq %r12, %rdi
movl %r15d, %esi
callq 0x8860
movq %rax, %rdi
callq 0x8030
movq 0x10(%rsp), %rdi
movq %rax, %rsi
callq 0x8550
leaq 0x78(%rsp), %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x8480
movq %r13, %rdi
movq 0x90(%rsp), %rsi
movq %rbx, %rdx
callq 0x8660
movq %r13, %rdi
callq 0x83b0
movq %rax, %rbx
callq 0x80d0
leaq 0x98(%rsp), %rdi
movq %rax, %rsi
callq 0x8800
leaq 0x98(%rsp), %rdx
leaq 0x18(%rsp), %rdi
movq %rbx, %rsi
callq 0x88b0
leaq 0x18(%rsp), %rdi
movq 0x10(%rsp), %rsi
callq 0x8170
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xff24
movl %eax, %ebx
leaq 0x18(%rsp), %rdi
callq 0x8990
leaq 0x98(%rsp), %rdi
callq 0x8990
movq %r13, %rdi
callq 0x8250
leaq 0x78(%rsp), %rdi
callq 0x8990
pushq $0x4
popq %rsi
testl %ebx, %ebx
je 0xf76b
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x87d0
pushq $0x4
popq %rsi
jmp 0xf76b
movq %rbp, %rdi
leaq 0x2d9d(%rip), %rsi      # 0x124e6
callq 0x8850
pushq $0x5
popq %rsi
testb %al, %al
jne 0xf76b
movq %rbp, %rdi
leaq 0x2d8e(%rip), %rsi      # 0x124ed
callq 0x8850
pushq $0x6
popq %rsi
testb %al, %al
je 0xf799
movq %r14, %rdi
callq 0xab92
movq (%rax), %rbx
testq %rbx, %rbx
je 0xf799
movq %r12, %rdi
movl %r15d, %esi
callq 0x8860
movq %rax, %rdi
callq 0x8030
movq %rbx, %rdi
movq %rax, %rsi
callq 0x11382
movq %rbp, %rdi
callq 0x8990
incl %r15d
jmp 0xf597
leaq 0xb0(%rsp), %rdi
callq 0x8260
movq %rax, %rbx
leaq 0x2cd4(%rip), %rsi      # 0x12494
leaq 0x48(%rsp), %rdi
callq 0x8800
leaq 0x48(%rsp), %rsi
movq %rbx, %rdi
callq 0x86a0
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x8990
movq 0x8(%rsp), %rax
movq 0x600(%rax), %rdx
movq 0x768(%rax), %rdi
movq %rbx, %rsi
movq %r14, %rcx
callq 0x8f50
xorl %ebp, %ebp
movq 0x8(%rsp), %rax
cmpl 0x6c0(%rax), %ebp
jge 0xf8ba
movq %r14, %rdi
movl %ebp, %esi
callq 0x82c0
testl %eax, %eax
js 0xf842
movq %r14, %rdi
movl %ebp, %esi
callq 0xab92
movq (%rax), %r15
leaq 0x650(%r15), %rdi
xorl %esi, %esi
callq 0x86f0
testb %al, %al
je 0xf846
incl %ebp
jmp 0xf804
leaq 0x638(%r15), %r12
xorl %r13d, %r13d
movq 0x8(%rsp), %rax
cmpl 0x6c0(%rax), %r13d
jge 0xf842
movq %r14, %rdi
movl %r13d, %esi
callq 0x82c0
cmpl %r13d, %ebp
je 0xf8a8
testl %eax, %eax
js 0xf8a8
movq %r14, %rdi
movl %r13d, %esi
callq 0xab92
movq (%rax), %rbx
leaq 0x638(%rbx), %rsi
movq %r12, %rdi
callq 0x8580
testb %al, %al
je 0xf8a8
addq $0x650, %rbx            # imm = 0x650
movq %rbx, %rdi
xorl %esi, %esi
callq 0x86f0
testb %al, %al
jne 0xf8ad
incl %r13d
jmp 0xf850
movq %r15, %rdi
movq %rbx, %rsi
callq 0x9ea8
jmp 0xf842
movq 0x8(%rsp), %rax
movq 0x600(%rax), %rdi
xorl %esi, %esi
callq 0x8740
movq %r14, %rdi
callq 0x11bcc
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0xd0a2
jmp 0xf957
leaq 0x2bae(%rip), %rsi      # 0x12499
leaq 0x48(%rsp), %rdi
callq 0x8800
leaq 0x30(%rsp), %rdi
movq %r14, %rdx
callq 0xfe32
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x8170
movq %rax, %rbx
leaq 0x29cc(%rip), %rsi      # 0x122e7
leaq 0x18(%rsp), %rdi
callq 0x8800
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movl $0x7f01, %ecx           # imm = 0x7F01
callq 0x8350
leaq 0x18(%rsp), %rdi
callq 0x8990
leaq 0x30(%rsp), %rdi
callq 0x8990
leaq 0x48(%rsp), %rdi
callq 0x8990
leaq 0xb0(%rsp), %rdi
callq 0x8500
addq $0xd8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0xf9b2
jmp 0xf9b9
jmp 0xf9b9
jmp 0xfa30
jmp 0xfa4b
jmp 0xfa3a
jmp 0xf9ca
movq %rax, %rbx
jmp 0xf9dc
movq %rax, %rbx
jmp 0xf9f3
jmp 0xfa30
jmp 0xfa4b
jmp 0xfa30
jmp 0xfa4b
jmp 0xfa4b
jmp 0xf9b2
movq %rax, %rbx
jmp 0xfa0c
jmp 0xf9b9
movq %rax, %rbx
jmp 0xfa16
jmp 0xfa30
jmp 0xfa4b
jmp 0xfa4b
movq %rax, %rbx
jmp 0xf9e9
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x8990
leaq 0x98(%rsp), %rdi
callq 0x8990
leaq 0x48(%rsp), %rdi
callq 0x8250
leaq 0x78(%rsp), %rdi
callq 0x8990
jmp 0xfa3d
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x8990
leaq 0x18(%rsp), %rdi
callq 0x8990
leaq 0x30(%rsp), %rdi
callq 0x8990
jmp 0xfa33
jmp 0xfa4b
jmp 0xfa4b
jmp 0xfa4b
jmp 0xfa4b
jmp 0xfa4b
jmp 0xfa4b
jmp 0xfa4b
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xfa42
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x8990
jmp 0xfa4e
jmp 0xfa4b
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x8500
movq %rbx, %rdi
callq 0x8290
nop