// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/i18n/translator.cpp
// Function: smooth::I18n::Translator::ActivateLanguage(smooth::String const&)
S::Int S::I18n::Translator::ActivateLanguage(const String &magic)
{
	foreach (Language *language, languages)
	{
		if (language->magic != magic) continue;

		activeLanguage = language;

		/* Try to set application language for internal library strings.
		 */
		if (magic != "internal")
		{
			String	 code = magic.SubString(magic.Find("_") + 1, magic.Find(".xml") - magic.Find("_") - 1);
			String	 id   = String("smooth_").Append(code).Append(".xml");

			if (defaultTranslator->ActivateLanguage(id) != Success())
			{
				/* If failed, try the base language code if applicable.
				 */
				if (code.Contains("_"))
				{
					id = String("smooth_").Append(code.Head(code.Find("_"))).Append(".xml");

					defaultTranslator->ActivateLanguage(id);
				}
			}

			/* Activate user default language if setting the application language failed.
			 */
			if (defaultTranslator->GetActiveLanguageID() != id) defaultTranslator->SelectUserDefaultLanguage();
		}

		/* Activate internal language if application language is set to internal.
		 */
		if (magic == "internal" && defaultTranslator != NIL) defaultTranslator->ActivateLanguage(magic);

		/* Load actual language data.
		 */
		if (magic != "internal" && activeLanguage->strings.Length() == 0 && activeLanguage->sections.Length() == 0)
		{
			/* Check translation folders.
			 */
			const Array<Directory>	&dirs = GetTranslationFolders(appPrefix);

			foreach (const Directory &dir, dirs)
			{
				/* Load translation file.
				 */
				String		 file = String(dir).Append(Directory::GetDirectoryDelimiter()).Append(magic);
				XML::Document	 doc;

				if (doc.LoadFile(file) == Success() && LoadData(doc, activeLanguage) == Success()) break;
			}
		}

		return Success();
	}

	return Error();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %rsi, %r14
leaq 0x20(%rdi), %rax
movq %rax, 0x68(%rsp)
movq %rdi, 0x18(%rsp)
leaq 0x8(%rdi), %rax
movq %rax, 0x60(%rsp)
movl $0xffffffff, %r12d      # imm = 0xFFFFFFFF
movq 0x18(%rsp), %rax
movl 0x28(%rax), %eax
decl %eax
cmpl %eax, %r12d
jge 0x9da79
incl %r12d
movq 0x68(%rsp), %rdi
movl %r12d, %esi
callq 0x60a40
movq (%rax), %rbp
leaq 0x108(%rbp), %r13
xorl %ecx, %ecx
testb $0x1, %cl
jne 0x9d649
movl %ecx, %r15d
movq %r13, %rdi
movq %r14, %rsi
callq 0x56fa0
movb $0x1, %cl
testb %al, %al
jne 0x9d678
movq 0x18(%rsp), %rax
movq %rbp, 0x78(%rax)
movq %r14, %rdi
leaq 0x5ab2a(%rip), %rsi     # 0xf81ce
callq 0x590a0
testb %al, %al
je 0x9d904
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
leaq 0x77c07(%rip), %rsi     # 0x1152c7
callq 0x579f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x57610
movl %eax, %ebp
movq %rsp, %r13
movq %r13, %rdi
leaq 0x5ab5e(%rip), %rsi     # 0xf823d
callq 0x579f0
movq %r14, %rdi
movq %r13, %rsi
callq 0x57610
movl %eax, %r13d
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
leaq 0x77bc6(%rip), %rsi     # 0x1152c7
callq 0x579f0
movq %r14, %rdi
movq %rbx, %rsi
callq 0x57610
incl %ebp
notl %eax
addl %eax, %r13d
leaq 0x70(%rsp), %rdi
movq %r14, %rsi
movl %ebp, %edx
movl %r13d, %ecx
callq 0x58f50
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rsp, %r13
movq %r13, %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
movq %r13, %rdi
leaq 0x5aaef(%rip), %rsi     # 0xf8242
callq 0x579f0
movq %r13, %rdi
leaq 0x70(%rsp), %rsi
callq 0x562f0
movq %rax, %r13
leaq 0x20(%rsp), %rbp
movq %rbp, %rdi
leaq 0x5aac6(%rip), %rsi     # 0xf823d
callq 0x579f0
movq %r13, %rdi
movq %rbp, %rsi
callq 0x562f0
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
callq 0x59200
movq 0xcec38(%rip), %rax     # 0x16c3e8
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
testl %eax, %eax
je 0x9d8bd
movq %rsp, %r13
movq %r13, %rdi
leaq 0x77af6(%rip), %rsi     # 0x1152c7
callq 0x579f0
leaq 0x70(%rsp), %rdi
movq %r13, %rsi
callq 0x55180
movl %eax, %ebp
movq %r13, %rdi
callq 0x59200
testb %bpl, %bpl
je 0x9d8bd
movq %rsp, %rdi
leaq 0x5aa42(%rip), %rsi     # 0xf8242
callq 0x579f0
leaq 0xe0(%rsp), %r13
movq %r13, %rdi
leaq 0x77ab0(%rip), %rsi     # 0x1152c7
callq 0x579f0
leaq 0x70(%rsp), %rbx
movq %rbx, %rdi
movq %r13, %rsi
callq 0x57610
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rbx, %rsi
movl %eax, %edx
callq 0x58b00
movq %rsp, %rdi
movq %r13, %rsi
callq 0x562f0
movq %rax, %r13
leaq 0xc8(%rsp), %rbx
movq %rbx, %rdi
leaq 0x5a9df(%rip), %rsi     # 0xf823d
callq 0x579f0
movq %r13, %rdi
movq %rbx, %rsi
callq 0x562f0
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
movq %rax, %rsi
callq 0x555f0
leaq 0xc8(%rsp), %rdi
callq 0x59200
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0xe0(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
callq 0x59200
movq 0xceb37(%rip), %rax     # 0x16c3e8
movq (%rax), %rdi
movq (%rdi), %rax
movq %rbx, %rsi
callq *0x10(%rax)
movq 0xceb24(%rip), %rax     # 0x16c3e8
movq (%rax), %rax
movq 0x78(%rax), %rdi
movl $0x108, %eax            # imm = 0x108
addq %rax, %rdi
leaq 0x38(%rsp), %rsi
callq 0x56fa0
testb %al, %al
je 0x9d8f0
movq 0xceb00(%rip), %rax     # 0x16c3e8
movq (%rax), %rdi
callq 0x57430
leaq 0x38(%rsp), %rdi
callq 0x59200
leaq 0x70(%rsp), %rdi
callq 0x59200
movq %r14, %rdi
leaq 0x5a8c0(%rip), %rsi     # 0xf81ce
callq 0x57ef0
movq 0xceace(%rip), %rcx     # 0x16c3e8
movq (%rcx), %rdi
testq %rdi, %rdi
setne %cl
andb %al, %cl
cmpb $0x1, %cl
jne 0x9d933
movq (%rdi), %rax
movq %r14, %rsi
callq *0x10(%rax)
movq %r14, %rdi
leaq 0x5a891(%rip), %rsi     # 0xf81ce
callq 0x590a0
testb %al, %al
je 0x9da64
movq 0x18(%rsp), %rax
movq 0x78(%rax), %rax
cmpl $0x0, 0x48(%rax)
jne 0x9da64
cmpl $0x0, 0xa0(%rax)
jne 0x9da64
leaq 0x70(%rsp), %rdi
movq 0x60(%rsp), %rsi
callq 0x9ce97
cmpl $0x0, 0x78(%rsp)
jle 0x9da5a
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
incl %ebp
leaq 0x70(%rsp), %rdi
movl %ebp, %esi
callq 0x9dcd2
leaq 0x38(%rsp), %rdi
movq %rax, %rsi
callq 0x56d90
callq 0x55370
leaq 0x20(%rsp), %r13
movq %r13, %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0x38(%rsp), %rdi
movq %r13, %rsi
callq 0x562f0
movq %rax, %rdi
movq %r14, %rsi
callq 0x562f0
movq %rsp, %rdi
movq %rax, %rsi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rbx
movq %rbx, %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57be0
movq %rbx, %rdi
movq %rsp, %rsi
callq 0x55520
testl %eax, %eax
je 0x9da1e
leaq 0x38(%rsp), %rdi
callq 0x55400
movq %rsp, %rdi
callq 0x59200
jmp 0x9da4c
movq 0x18(%rsp), %rax
movq 0x78(%rax), %rdx
leaq 0x38(%rsp), %rbx
movq %rbx, %rsi
callq 0x55db0
movl %eax, %r13d
movq %rbx, %rdi
callq 0x55400
movq %rsp, %rdi
callq 0x59200
testl %r13d, %r13d
je 0x9da5a
movl 0x78(%rsp), %eax
decl %eax
cmpl %eax, %ebp
jl 0x9d989
leaq 0x70(%rsp), %rdi
callq 0x5cd7e
testb $0x1, %r15b
jne 0x9d649
movzbl %r15b, %eax
andl $0x1, %eax
negl %eax
jmp 0x9da7e
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x9da92
movq %rax, %rbx
jmp 0x9dab8
jmp 0x9da9e
jmp 0x9db46
movq %rax, %rbx
jmp 0x9dad4
jmp 0x9db46
movq %rax, %rbx
leaq 0xc8(%rsp), %rdi
callq 0x59200
leaq 0x20(%rsp), %rdi
callq 0x59200
jmp 0x9dac7
movq %rax, %rbx
leaq 0xe0(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
callq 0x59200
jmp 0x9db49
jmp 0x9db2a
jmp 0x9daeb
jmp 0x9daf0
movq %rax, %rbx
jmp 0x9db53
jmp 0x9daf5
movq %rax, %rbx
jmp 0x9db0f
movq %rax, %rbx
jmp 0x9db07
movq %rax, %rbx
jmp 0x9db23
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
jmp 0x9db58
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
jmp 0x9db4e
jmp 0x9db39
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x55400
jmp 0x9db41
movq %rax, %rbx
jmp 0x9db7b
movq %rax, %rbx
movq %rsp, %rdi
jmp 0x9db76
movq %rax, %rbx
leaq 0x38(%rsp), %rdi
callq 0x59200
leaq 0x70(%rsp), %rdi
callq 0x59200
jmp 0x9db85
movq %rax, %rbx
jmp 0x9db71
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x59200
leaq 0x38(%rsp), %rdi
callq 0x59200
leaq 0x70(%rsp), %rdi
callq 0x5cd7e
movq %rbx, %rdi
callq 0x57090
nop