// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/misc/config.cpp
// Function: smooth::Configuration::Open(smooth::String const&, bool)
S::Int S::Configuration::Open(const String &file, Bool create)
{
	if (configFile != NIL) Close();

	configFile = new XML::Document();

	if (configFile->LoadFile(file) == Success())
	{
		fileName = file;
	}
	else if (configFile->LoadFile(GUI::Application::GetStartupDirectory().Append(file)) == Success())
	{
		fileName = GUI::Application::GetStartupDirectory().Append(file);
	}
	else if (configFile->LoadFile(GUI::Application::GetApplicationDirectory().Append(file)) == Success())
	{
		fileName = GUI::Application::GetApplicationDirectory().Append(file);
	}
	else
	{
		if (!create)
		{
			Close();

			return Error();
		}
		else
		{
			ownRoot = new XML::Node("ConfigFile");

			configFile->SetRootNode(ownRoot);

			ownRoot->AddNode(NodeConfigurationID)->SetAttribute(AttributeNameID, ConfigurationDefaultID);

			if (file[1] == ':' ||
			    file[0] == '/' ||
			    file[0] == '\\') fileName = file;
			else		     fileName = GUI::Application::GetApplicationDirectory().Append(file);
		}
	}

	/* Check XML file type.
	 */
	XML::Node	*root = configFile->GetRootNode();

	if (root == NIL || root->GetNodeByName(NodeConfigurationID) == NIL)
	{
		Close();

		return Error();
	}

	return Success();
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
cmpq $0x0, 0x30(%rdi)
je 0xa2fc1
movq %rbx, %rdi
callq 0x55e40
movl $0x28, %edi
callq 0x556b0
movq %rax, %r15
movq %rax, %rdi
callq 0x57be0
movq %r15, 0x30(%rbx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x55520
testl %eax, %eax
je 0xa3138
movq 0x30(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x58530
movq %r12, %rdi
movq %r14, %rsi
callq 0x562f0
movq %r15, %rdi
movq %rax, %rsi
callq 0x55520
movl %eax, %r15d
movq %rsp, %rdi
callq 0x59200
testl %r15d, %r15d
je 0xa3145
movq 0x30(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x57a50
movq %r12, %rdi
movq %r14, %rsi
callq 0x562f0
movq %r15, %rdi
movq %rax, %rsi
callq 0x55520
movl %eax, %r15d
movq %rsp, %rdi
callq 0x59200
testl %r15d, %r15d
je 0xa3168
testb %bpl, %bpl
je 0xa31b8
movl $0x30, %edi
callq 0x556b0
movq %rax, %r15
leaq 0x6eb02(%rip), %rsi     # 0x111b7e
movq %rsp, %rdi
callq 0x579f0
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x58e20
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x567b0
movq %r15, 0x38(%rbx)
leaq 0x18(%rsp), %rdi
callq 0x59200
movq %rsp, %rdi
callq 0x59200
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x590c0
movq 0x38(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x58e20
leaq 0xcbc6d(%rip), %rsi     # 0x16ed48
movq %r15, %rdi
movq %r12, %rdx
callq 0x55820
leaq 0xcbcbb(%rip), %rsi     # 0x16eda8
leaq 0xcbc3c(%rip), %rdx     # 0x16ed30
movq %rax, %rdi
callq 0x581c0
movq %rsp, %rdi
callq 0x59200
movq %r14, %rdi
movl $0x1, %esi
callq 0x57fe0
cmpl $0x3a, %eax
je 0xa3138
movq %r14, %rdi
xorl %esi, %esi
callq 0x57fe0
cmpl $0x2f, %eax
je 0xa3138
movq %r14, %rdi
xorl %esi, %esi
callq 0x57fe0
cmpl $0x5c, %eax
jne 0xa31d2
movq %rbx, %rdi
movq %r14, %rsi
callq 0x555f0
jmp 0xa3191
movq %rsp, %r15
movq %r15, %rdi
callq 0x58530
movq %r15, %rdi
movq %r14, %rsi
callq 0x562f0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x555f0
jmp 0xa3189
movq %rsp, %r15
movq %r15, %rdi
callq 0x57a50
movq %r15, %rdi
movq %r14, %rsi
callq 0x562f0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x555f0
movq %rsp, %rdi
callq 0x59200
movq 0x30(%rbx), %rdi
callq 0x56e60
testq %rax, %rax
je 0xa31b8
leaq 0xcbba2(%rip), %rsi     # 0x16ed48
movq %rax, %rdi
callq 0x56810
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
jne 0xa31c5
movq %rbx, %rdi
callq 0x55e40
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %r15
movq %r15, %rdi
callq 0x57a50
movq %r15, %rdi
movq %r14, %rsi
callq 0x562f0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x555f0
jmp 0xa3189
jmp 0xa3237
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x59200
jmp 0xa3209
movq %rax, %rbx
movq %rsp, %rdi
callq 0x59200
jmp 0xa3216
movq %rax, %rbx
movl $0x30, %esi
jmp 0xa322d
jmp 0xa3237
jmp 0xa3237
jmp 0xa3237
jmp 0xa3237
movq %rax, %rbx
movl $0x28, %esi
movq %r15, %rdi
callq 0x55480
jmp 0xa3242
movq %rax, %rbx
movq %rsp, %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090