// File: /workspace/github_c_makefile_star2_O1/enzo1982[P]smooth/classes/i18n/translator.cpp
// Function: smooth::I18n::Translator::AddLanguage(smooth::I18n::Language*)
S::Int S::I18n::Translator::AddLanguage(Language *language)
{
	/* Check arguments and return an error if they are not sane.
	 */
	if (language == NIL) return Error();

	const String	&langName = language->GetName();

	for (Int i = 0; i < languages.Length(); i++)
	{
		const String	&compName = languages.GetNth(i)->GetName();

		for (Int j = 0; j < Math::Max(langName.Length(), compName.Length()); j++)
		{
			if (langName == compName) return Error();

			if ((langName[j] < compName[j] && !(langName[j] == '(' && compName[j] == '/')) || (langName[j] == '/' && compName[j] == '('))
			{
				languages.InsertAtPos(i, language);

				return Success();
			}

			if ((langName[j] > compName[j] && !(langName[j] == '/' && compName[j] == '(')) || (langName[j] == '(' && compName[j] == '/')) break;
		}
	}

	languages.Add(language);

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, 0x8(%rsp)
testq %rsi, %rsi
je 0x9c310
leaq 0x20(%rdi), %r14
cmpl $0x0, 0x28(%rdi)
setg %cl
jle 0x9c317
movq 0x8(%rsp), %rax
leaq 0x8(%rax), %r12
xorl %r13d, %r13d
movq %r14, 0x10(%rsp)
movq %rdi, 0x20(%rsp)
movb %cl, 0x3(%rsp)
movq %r14, %rdi
movl %r13d, %esi
callq 0x5b0a4
movq (%rax), %rbp
addq $0x8, %rbp
movq %r12, %rdi
callq 0x57180
movl %eax, %ebx
movq %rbp, %rdi
callq 0x57180
cmpl %eax, %ebx
cmovgl %ebx, %eax
testl %eax, %eax
jle 0x9c2b6
xorl %r14d, %r14d
movq %r12, %rdi
movq %rbp, %rsi
callq 0x55900
movl %eax, %ebx
testb %al, %al
jne 0x9c2e5
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
movl %eax, %r15d
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl %eax, %r15d
jge 0x9c208
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x28, %eax
jne 0x9c2ba
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x2f, %eax
jne 0x9c2ba
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x2f, %eax
jne 0x9c22c
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x28, %eax
je 0x9c2ba
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
movl %eax, %r15d
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl %eax, %r15d
jle 0x9c26e
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x2f, %eax
jne 0x9c2ed
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x28, %eax
jne 0x9c2ed
movq %r12, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x28, %eax
jne 0x9c28e
movq %rbp, %rdi
movl %r14d, %esi
callq 0x57fe0
cmpl $0x2f, %eax
je 0x9c2ed
incl %r14d
movq %r12, %rdi
callq 0x57180
movl %eax, %r15d
movq %rbp, %rdi
callq 0x57180
cmpl %eax, %r15d
cmovgl %r15d, %eax
cmpl %eax, %r14d
jl 0x9c1ad
jmp 0x9c2ed
movb $0x1, %bl
jmp 0x9c2f5
movq 0x8(%rsp), %rax
movq %rax, 0x18(%rsp)
movq 0x10(%rsp), %r14
movq %r14, %rdi
movl %r13d, %esi
leaq 0x18(%rsp), %rdx
callq 0x9dd8a
xorl %ebx, %ebx
movl $0x0, 0x4(%rsp)
jmp 0x9c2f5
movl $0xffffffff, 0x4(%rsp)  # imm = 0xFFFFFFFF
xorb $0x1, %bl
movq 0x10(%rsp), %r14
testb %bl, %bl
je 0x9c319
incl %r13d
movq 0x20(%rsp), %rdi
cmpl 0x28(%rdi), %r13d
setl %cl
jl 0x9c175
jmp 0x9c31d
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x9c33d
jmp 0x9c31d
movb 0x3(%rsp), %cl
testb $0x1, %cl
movl 0x4(%rsp), %eax
jne 0x9c33d
leaq 0x18(%rsp), %rsi
movq 0x8(%rsp), %rax
movq %rax, (%rsi)
movq %r14, %rdi
callq 0x5af08
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq