// File: /workspace/github_c_makefile_star2_O3/enzo1982[P]smooth/classes/system/system.cpp
// Function: smooth::System::System::GetApplicationDataDirectory()
S::String S::System::System::GetApplicationDataDirectory()
{
	static String	 configDir;

	if (configDir != NIL) return configDir;

	String::InputFormat	 inputFormat("UTF-8");

#if defined __WIN32__
	ITEMIDLIST	*idlist;
	Buffer<wchar_t>	 buffer(32768 + 1);

	SHGetSpecialFolderLocation(NIL, CSIDL_APPDATA, &idlist);
	SHGetPathFromIDList(idlist, buffer);

	configDir = buffer;

	CoTaskMemFree(idlist);
#elif defined __APPLE__
	passwd	*pw = getpwuid(getuid());

	if (pw != NIL)	configDir = pw->pw_dir;
	else		configDir = "~";

	configDir = configDir.Append("/Library/Preferences");
#elif defined __HAIKU__
	FILE		*pstdin = popen("finddir B_USER_SETTINGS_DIRECTORY", "r");
	Buffer<char>	 buffer(PATH_MAX + 1);

	buffer.Zero();

	fscanf(pstdin, String("%[^\n]").Append(String::FromInt(buffer.Size() - 1)), (char *) buffer);

	pclose(pstdin);

	configDir = buffer;
#else
	configDir = getenv("XDG_CONFIG_HOME");

	if (configDir == NIL)
	{
		passwd	*pw = getpwuid(getuid());

		if (pw != NIL)	configDir = pw->pw_dir;
		else		configDir = "~";

		configDir = configDir.Append("/.config");
	}
#endif

	if (!configDir.EndsWith(Directory::GetDirectoryDelimiter())) configDir.Append(Directory::GetDirectoryDelimiter());
	if ( configDir == Directory::GetDirectoryDelimiter())	     configDir = NIL;

	return configDir;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movb 0xc4953(%rip), %al      # 0x176070
testb %al, %al
je 0xb18a4
leaq 0xc492c(%rip), %rdi     # 0x176058
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0xb174b
leaq 0xc491a(%rip), %rsi     # 0x176058
movq %rbx, %rdi
callq 0x570b0
jmp 0xb189a
leaq 0x60b84(%rip), %rsi     # 0x1122d6
leaq 0x20(%rsp), %rdi
callq 0x590d0
leaq 0x610fb(%rip), %rdi     # 0x11285e
callq 0x57720
leaq 0xc48e9(%rip), %rdi     # 0x176058
movq %rax, %rsi
callq 0x55f40
leaq 0xc48da(%rip), %rdi     # 0x176058
xorl %esi, %esi
callq 0x55260
testb %al, %al
je 0xb17fa
callq 0x56090
movl %eax, %edi
callq 0x559b0
testq %rax, %rax
je 0xb17ac
movq 0x20(%rax), %rsi
leaq 0xc48b3(%rip), %rdi     # 0x176058
callq 0x55f40
jmp 0xb17bf
leaq 0xc48a5(%rip), %rdi     # 0x176058
leaq 0x41a92(%rip), %rsi     # 0xf324c
callq 0x55f40
leaq 0x610a8(%rip), %rsi     # 0x11286e
leaq 0x8(%rsp), %rdi
callq 0x579f0
leaq 0xc4881(%rip), %rdi     # 0x176058
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0xc4870(%rip), %rdi     # 0x176058
movq %rax, %rsi
callq 0x555f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4845(%rip), %rdi     # 0x176058
leaq 0x8(%rsp), %rsi
callq 0x58b10
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x59200
testb %bpl, %bpl
jne 0xb185b
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4811(%rip), %rdi     # 0x176058
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0xc47f1(%rip), %rdi     # 0x176058
movq %rax, %rsi
callq 0x57ef0
testb %al, %al
je 0xb1881
leaq 0xc47de(%rip), %rdi     # 0x176058
xorl %esi, %esi
callq 0x579e0
leaq 0xc47d0(%rip), %rsi     # 0x176058
movq %rbx, %rdi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc47c5(%rip), %rdi     # 0x176070
callq 0x56120
testl %eax, %eax
je 0xb1725
leaq 0xc4799(%rip), %rdi     # 0x176058
xorl %esi, %esi
callq 0x58e20
movq 0xba663(%rip), %rdi     # 0x16bf30
leaq 0xc4784(%rip), %rsi     # 0x176058
leaq 0xbc7a5(%rip), %rdx     # 0x16e080
callq 0x57e10
leaq 0xc4789(%rip), %rdi     # 0x176070
callq 0x56b80
jmp 0xb1725
movq %rax, %rbx
leaq 0xc4775(%rip), %rdi     # 0x176070
callq 0x56420
jmp 0xb192a
jmp 0xb190a
jmp 0xb191d
jmp 0xb191d
jmp 0xb190a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x59200
jmp 0xb1920
jmp 0xb191d
jmp 0xb191d
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rdi
callq 0x57090