// File: /workspace/github_c_makefile_star2_O2/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 0x9eb19
movq %rbx, %rdi
callq 0x56f10
pushq $0x28
popq %rdi
callq 0x56700
movq %rax, %r15
movq %rax, %rdi
callq 0x58e60
movq %r15, 0x30(%rbx)
movq %r15, %rdi
movq %r14, %rsi
callq 0x56560
testl %eax, %eax
je 0x9ec8a
movq 0x30(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x59820
movq %r12, %rdi
movq %r14, %rsi
callq 0x573e0
movq %r15, %rdi
movq %rax, %rsi
callq 0x56560
movl %eax, %r15d
movq %rsp, %rdi
callq 0x5a588
testl %r15d, %r15d
je 0x9ec97
movq 0x30(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x58cb0
movq %r12, %rdi
movq %r14, %rsi
callq 0x573e0
movq %r15, %rdi
movq %rax, %rsi
callq 0x56560
movl %eax, %r15d
movq %rsp, %rdi
callq 0x5a588
testl %r15d, %r15d
je 0x9ecba
testb %bpl, %bpl
je 0x9ed0a
pushq $0x30
popq %rdi
callq 0x56700
movq %rax, %r15
leaq 0x62eae(%rip), %rsi     # 0x101a7e
movq %rsp, %rdi
callq 0x58c40
leaq 0x18(%rsp), %rdi
xorl %esi, %esi
callq 0x5a180
movq %rsp, %rsi
leaq 0x18(%rsp), %rdx
movq %r15, %rdi
callq 0x578f0
movq %r15, 0x38(%rbx)
leaq 0x18(%rsp), %rdi
callq 0x5a588
movq %rsp, %rdi
callq 0x5a588
movq 0x30(%rbx), %rdi
movq 0x38(%rbx), %rsi
callq 0x5a440
movq 0x38(%rbx), %r15
movq %rsp, %r12
movq %r12, %rdi
xorl %esi, %esi
callq 0x5a180
leaq 0xc62d9(%rip), %rsi     # 0x164f08
movq %r15, %rdi
movq %r12, %rdx
callq 0x56880
leaq 0xc6327(%rip), %rsi     # 0x164f68
leaq 0xc62a8(%rip), %rdx     # 0x164ef0
movq %rax, %rdi
callq 0x59460
movq %rsp, %rdi
callq 0x5a588
pushq $0x1
popq %rsi
movq %r14, %rdi
callq 0x59270
cmpl $0x3a, %eax
je 0x9ec8a
movq %r14, %rdi
xorl %esi, %esi
callq 0x59270
cmpl $0x2f, %eax
je 0x9ec8a
movq %r14, %rdi
xorl %esi, %esi
callq 0x59270
cmpl $0x5c, %eax
jne 0x9ed22
movq %rbx, %rdi
movq %r14, %rsi
callq 0x56630
jmp 0x9ece3
movq %rsp, %r15
movq %r15, %rdi
callq 0x59820
movq %r15, %rdi
movq %r14, %rsi
callq 0x573e0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56630
jmp 0x9ecdb
movq %rsp, %r15
movq %r15, %rdi
callq 0x58cb0
movq %r15, %rdi
movq %r14, %rsi
callq 0x573e0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56630
movq %rsp, %rdi
callq 0x5a588
movq 0x30(%rbx), %rdi
callq 0x58010
testq %rax, %rax
je 0x9ed0a
leaq 0xc6210(%rip), %rsi     # 0x164f08
movq %rax, %rdi
callq 0x57950
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
jne 0x9ed15
movq %rbx, %rdi
callq 0x56f10
pushq $-0x1
popq %rax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rsp, %r15
movq %r15, %rdi
callq 0x58cb0
movq %r15, %rdi
movq %r14, %rsi
callq 0x573e0
movq %rbx, %rdi
movq %rax, %rsi
callq 0x56630
jmp 0x9ecdb
jmp 0x9ed82
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x5a588
jmp 0x9ed59
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5a588
jmp 0x9ed66
movq %rax, %rbx
pushq $0x30
jmp 0x9ed77
jmp 0x9ed82
jmp 0x9ed82
jmp 0x9ed82
jmp 0x9ed82
movq %rax, %rbx
pushq $0x28
popq %rsi
movq %r15, %rdi
callq 0x564c0
jmp 0x9ed8d
movq %rax, %rbx
movq %rsp, %rdi
callq 0x5a588
movq %rbx, %rdi
callq 0x58260
nop