// File: /workspace/github_c_makefile_star2_O1/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 0xa3a89
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 0xa3c00
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 0xa3c0d
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 0xa3c30
testb %bpl, %bpl
je 0xa3c80
movl $0x30, %edi
callq 0x556b0
movq %rax, %r15
leaq 0x6ee96(%rip), %rsi     # 0x1129da
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 0xcc1a5(%rip), %rsi     # 0x16fd48
movq %r15, %rdi
movq %r12, %rdx
callq 0x55820
leaq 0xcc1f3(%rip), %rsi     # 0x16fda8
leaq 0xcc174(%rip), %rdx     # 0x16fd30
movq %rax, %rdi
callq 0x581c0
movq %rsp, %rdi
callq 0x59200
movq %r14, %rdi
movl $0x1, %esi
callq 0x57fe0
cmpl $0x3a, %eax
je 0xa3c00
movq %r14, %rdi
xorl %esi, %esi
callq 0x57fe0
cmpl $0x2f, %eax
je 0xa3c00
movq %r14, %rdi
xorl %esi, %esi
callq 0x57fe0
cmpl $0x5c, %eax
jne 0xa3c9a
movq %rbx, %rdi
movq %r14, %rsi
callq 0x555f0
jmp 0xa3c59
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 0xa3c51
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 0xa3c80
leaq 0xcc0da(%rip), %rsi     # 0x16fd48
movq %rax, %rdi
callq 0x56810
movq %rax, %rcx
xorl %eax, %eax
testq %rcx, %rcx
jne 0xa3c8d
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 0xa3c51
jmp 0xa3cff
movq %rax, %rbx
leaq 0x18(%rsp), %rdi
callq 0x59200
jmp 0xa3cd1
movq %rax, %rbx
movq %rsp, %rdi
callq 0x59200
jmp 0xa3cde
movq %rax, %rbx
movl $0x30, %esi
jmp 0xa3cf5
jmp 0xa3cff
jmp 0xa3cff
jmp 0xa3cff
jmp 0xa3cff
movq %rax, %rbx
movl $0x28, %esi
movq %r15, %rdi
callq 0x55480
jmp 0xa3d0a
movq %rax, %rbx
movq %rsp, %rdi
callq 0x59200
movq %rbx, %rdi
callq 0x57090