// File: /workspace/github_c_makefile_star2_O1/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 0xc4b67(%rip), %al      # 0x177070
testb %al, %al
je 0xb2690
leaq 0xc4b40(%rip), %rdi     # 0x177058
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0xb2537
leaq 0xc4b2e(%rip), %rsi     # 0x177058
movq %rbx, %rdi
callq 0x570b0
jmp 0xb2686
leaq 0x60be8(%rip), %rsi     # 0x113126
leaq 0x20(%rsp), %rdi
callq 0x590d0
leaq 0x6114a(%rip), %rdi     # 0x113699
callq 0x57720
leaq 0xc4afd(%rip), %rdi     # 0x177058
movq %rax, %rsi
callq 0x55f40
leaq 0xc4aee(%rip), %rdi     # 0x177058
xorl %esi, %esi
callq 0x55260
testb %al, %al
je 0xb25e6
callq 0x56090
movl %eax, %edi
callq 0x559b0
testq %rax, %rax
je 0xb2598
movq 0x20(%rax), %rsi
leaq 0xc4ac7(%rip), %rdi     # 0x177058
callq 0x55f40
jmp 0xb25ab
leaq 0xc4ab9(%rip), %rdi     # 0x177058
leaq 0x41ca6(%rip), %rsi     # 0xf424c
callq 0x55f40
leaq 0x610f7(%rip), %rsi     # 0x1136a9
leaq 0x8(%rsp), %rdi
callq 0x579f0
leaq 0xc4a95(%rip), %rdi     # 0x177058
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0xc4a84(%rip), %rdi     # 0x177058
movq %rax, %rsi
callq 0x555f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4a59(%rip), %rdi     # 0x177058
leaq 0x8(%rsp), %rsi
callq 0x58b10
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x59200
testb %bpl, %bpl
jne 0xb2647
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4a25(%rip), %rdi     # 0x177058
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0xc4a05(%rip), %rdi     # 0x177058
movq %rax, %rsi
callq 0x57ef0
testb %al, %al
je 0xb266d
leaq 0xc49f2(%rip), %rdi     # 0x177058
xorl %esi, %esi
callq 0x579e0
leaq 0xc49e4(%rip), %rsi     # 0x177058
movq %rbx, %rdi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc49d9(%rip), %rdi     # 0x177070
callq 0x56120
testl %eax, %eax
je 0xb2511
leaq 0xc49ad(%rip), %rdi     # 0x177058
xorl %esi, %esi
callq 0x58e20
movq 0xba877(%rip), %rdi     # 0x16cf30
leaq 0xc4998(%rip), %rsi     # 0x177058
leaq 0xbc9b9(%rip), %rdx     # 0x16f080
callq 0x57e10
leaq 0xc499d(%rip), %rdi     # 0x177070
callq 0x56b80
jmp 0xb2511
movq %rax, %rbx
leaq 0xc4989(%rip), %rdi     # 0x177070
callq 0x56420
jmp 0xb2716
jmp 0xb26f6
jmp 0xb2709
jmp 0xb2709
jmp 0xb26f6
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x59200
jmp 0xb270c
jmp 0xb2709
jmp 0xb2709
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rdi
callq 0x57090