// File: /workspace/github_c_makefile_star2_O1/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, 0x8(%rsp)
cmpl $-0x1, %eax
je 0xed75
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0xd87e
leaq 0x688(%r14), %r15
movq %r15, %rdi
movq %rbx, %rsi
callq 0x7550
movq 0x5b8(%r14), %r14
leaq 0x3a6a(%rip), %rsi      # 0x12309
leaq 0x48(%rsp), %rdi
callq 0x77f0
leaq 0x3a6d(%rip), %rsi      # 0x1231d
leaq 0x30(%rsp), %rdi
callq 0x77f0
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7170
movq %rax, %rbx
leaq 0x3bec(%rip), %rsi      # 0x124bf
leaq 0x18(%rsp), %rdi
callq 0x77f0
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x7170
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
movq %r15, %rdx
callq 0xf2d2
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 0x18(%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 0x3b6e(%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 0x8(%rsp), %rax
leaq 0x6b8(%rax), %rcx
movq %rcx, (%rsp)
addq $0x6a0, %rax            # imm = 0x6A0
movq %rax, 0x10(%rsp)
xorl %r15d, %r15d
leaq 0x30(%rsp), %rbp
movq %r12, %rdi
callq 0x75f0
cmpl %eax, %r15d
jge 0xec0e
movq %r12, %rdi
movl %r15d, %esi
callq 0x7850
movq %rax, %rbx
movq %r13, %rdi
leaq 0x3670(%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 0x3ac3(%rip), %rsi      # 0x124c8
callq 0x7840
testb %al, %al
je 0xea1e
movq (%rsp), %rdi
xorl %esi, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x3aa8(%rip), %rsi      # 0x124d0
callq 0x7840
testb %al, %al
je 0xea44
movq (%rsp), %rdi
movl $0x1, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x3a8a(%rip), %rsi      # 0x124d8
callq 0x7840
testb %al, %al
je 0xea6a
movq (%rsp), %rdi
movl $0x2, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x3a6d(%rip), %rsi      # 0x124e1
callq 0x7840
testb %al, %al
je 0xea90
movq (%rsp), %rdi
movl $0x3, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x3a53(%rip), %rsi      # 0x124ed
callq 0x7840
testb %al, %al
je 0xeb84
movq %r12, %rdi
movl %r15d, %esi
callq 0x7850
movq %rax, %rdi
callq 0x7030
movq 0x10(%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), %r14
movq %r14, %rdi
movq %rax, %rsi
callq 0x77f0
movq %r14, %rdx
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
callq 0x78a0
movq %r14, %rdi
movq 0x10(%rsp), %rsi
callq 0x7170
movq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0xf3cc
movl %eax, %ebx
leaq 0x18(%rsp), %rdi
callq 0x7980
leaq 0x98(%rsp), %rdi
callq 0x7980
movq %r13, %rdi
callq 0x7250
leaq 0x78(%rsp), %rdi
callq 0x7980
testl %ebx, %ebx
je 0xeb74
movq 0x10(%rsp), %rdi
xorl %esi, %esi
callq 0x77c0
movq (%rsp), %rdi
movl $0x4, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x3968(%rip), %rsi      # 0x124f6
callq 0x7840
testb %al, %al
je 0xeba7
movq (%rsp), %rdi
movl $0x5, %esi
callq 0x9ca8
jmp 0xebc8
movq %rbp, %rdi
leaq 0x394c(%rip), %rsi      # 0x124fd
callq 0x7840
testb %al, %al
je 0xec0a
movq (%rsp), %rdi
movl $0x6, %esi
callq 0x9ca8
movq (%rax), %rbx
testq %rbx, %rbx
je 0xebfa
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 0xe9a7
xorl %ebx, %ebx
jmp 0xebcb
leaq 0xb0(%rsp), %rdi
callq 0x7260
movq %rax, %rbx
leaq 0x387f(%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 0x8(%rsp), %rax
movq 0x600(%rax), %rdx
movq 0x768(%rax), %rdi
movq %rbx, %rsi
movq (%rsp), %rcx
callq 0x7fac
movq 0x8(%rsp), %rax
cmpl $0x0, 0x6c0(%rax)
jle 0xed4a
xorl %ebp, %ebp
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x72c0
testl %eax, %eax
js 0xed37
movq (%rsp), %rdi
movl %ebp, %esi
callq 0x9ca8
movq (%rax), %r15
leaq 0x650(%r15), %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x76f0
movq 0x8(%rsp), %rcx
cmpl $0x0, 0x6c0(%rcx)
setle %cl
orb %cl, %al
jne 0xed37
leaq 0x638(%r15), %r13
xorl %ebx, %ebx
movq (%rsp), %rdi
movl %ebx, %esi
callq 0x72c0
cmpl %ebx, %ebp
je 0xed13
testl %eax, %eax
js 0xed13
movq (%rsp), %rdi
movl %ebx, %esi
callq 0x9ca8
movq (%rax), %r14
leaq 0x638(%r14), %rsi
movq %r13, %rdi
callq 0x7580
testb %al, %al
je 0xed13
addq $0x650, %r14            # imm = 0x650
movq %r14, %rdi
xorl %esi, %esi
callq 0x76f0
testb %al, %al
jne 0xed24
incl %ebx
movq 0x8(%rsp), %rax
cmpl 0x6c0(%rax), %ebx
jl 0xecca
jmp 0xed37
movq %r12, %rdi
movq %r14, %rsi
callq 0x7550
movq %r15, %rdi
callq 0xa956
incl %ebp
movq 0x8(%rsp), %rax
cmpl 0x6c0(%rax), %ebp
jl 0xec7c
movq 0x8(%rsp), %rax
movq 0x600(%rax), %rdi
xorl %esi, %esi
callq 0x7740
movq (%rsp), %rdi
callq 0x111f0
movq (%rax), %rsi
movq 0x8(%rsp), %rdi
callq 0xc332
jmp 0xede8
leaq 0x372d(%rip), %rsi      # 0x124a9
leaq 0x48(%rsp), %rdi
callq 0x77f0
leaq 0x30(%rsp), %rdi
movq %rbx, %rdx
callq 0xf2d2
leaq 0x48(%rsp), %rdi
leaq 0x30(%rsp), %rsi
callq 0x7170
movq %rax, %rbx
leaq 0x354b(%rip), %rsi      # 0x122f7
leaq 0x18(%rsp), %rdi
callq 0x77f0
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
xorl %edx, %edx
movl $0x7f01, %ecx           # imm = 0x7F01
callq 0x7350
leaq 0x18(%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 0xee43
jmp 0xee4a
jmp 0xee4a
jmp 0xeebe
jmp 0xeed9
jmp 0xeeca
movq %rax, %rbx
jmp 0xee68
jmp 0xee56
movq %rax, %rbx
jmp 0xee7f
jmp 0xeebe
jmp 0xeed9
jmp 0xeebe
jmp 0xeed9
jmp 0xeed9
jmp 0xee43
movq %rax, %rbx
jmp 0xee98
jmp 0xee4a
movq %rax, %rbx
jmp 0xeea2
jmp 0xeebe
jmp 0xeed9
movq %rax, %rbx
jmp 0xee75
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x7980
leaq 0x98(%rsp), %rdi
callq 0x7980
leaq 0x48(%rsp), %rdi
callq 0x7250
leaq 0x78(%rsp), %rdi
callq 0x7980
jmp 0xeecd
movq %rax, %rbx
leaq 0x78(%rsp), %rdi
callq 0x7980
leaq 0x18(%rsp), %rdi
callq 0x7980
leaq 0x30(%rsp), %rdi
callq 0x7980
jmp 0xeec1
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
jmp 0xeed9
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
jmp 0xeed2
jmp 0xeed9
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x7980
jmp 0xeedc
movq %rax, %rbx
leaq 0xb0(%rsp), %rdi
callq 0x7500
movq %rbx, %rdi
callq 0x7290
nop