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

	if (cacheDir != NIL) return cacheDir;

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

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

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

	cacheDir = buffer;

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

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

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

	buffer.Zero();

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

	pclose(pstdin);

	cacheDir = buffer;
#else
	cacheDir = getenv("XDG_CACHE_HOME");

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

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

		cacheDir = cacheDir.Append("/.cache");
	}
#endif

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

	return cacheDir;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x38, %rsp
movq %rdi, %rbx
movb 0xc474f(%rip), %al      # 0x176090
testb %al, %al
je 0xb1ac8
leaq 0xc4728(%rip), %rdi     # 0x176078
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0xb196f
leaq 0xc4716(%rip), %rsi     # 0x176078
movq %rbx, %rdi
callq 0x570b0
jmp 0xb1abe
leaq 0x60960(%rip), %rsi     # 0x1122d6
leaq 0x20(%rsp), %rdi
callq 0x590d0
leaq 0x60ef0(%rip), %rdi     # 0x112877
callq 0x57720
leaq 0xc46e5(%rip), %rdi     # 0x176078
movq %rax, %rsi
callq 0x55f40
leaq 0xc46d6(%rip), %rdi     # 0x176078
xorl %esi, %esi
callq 0x55260
testb %al, %al
je 0xb1a1e
callq 0x56090
movl %eax, %edi
callq 0x559b0
testq %rax, %rax
je 0xb19d0
movq 0x20(%rax), %rsi
leaq 0xc46af(%rip), %rdi     # 0x176078
callq 0x55f40
jmp 0xb19e3
leaq 0xc46a1(%rip), %rdi     # 0x176078
leaq 0x4186e(%rip), %rsi     # 0xf324c
callq 0x55f40
leaq 0x60e9c(%rip), %rsi     # 0x112886
leaq 0x8(%rsp), %rdi
callq 0x579f0
leaq 0xc467d(%rip), %rdi     # 0x176078
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0xc466c(%rip), %rdi     # 0x176078
movq %rax, %rsi
callq 0x555f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4641(%rip), %rdi     # 0x176078
leaq 0x8(%rsp), %rsi
callq 0x58b10
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x59200
testb %bpl, %bpl
jne 0xb1a7f
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc460d(%rip), %rdi     # 0x176078
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0xc45ed(%rip), %rdi     # 0x176078
movq %rax, %rsi
callq 0x57ef0
testb %al, %al
je 0xb1aa5
leaq 0xc45da(%rip), %rdi     # 0x176078
xorl %esi, %esi
callq 0x579e0
leaq 0xc45cc(%rip), %rsi     # 0x176078
movq %rbx, %rdi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc45c1(%rip), %rdi     # 0x176090
callq 0x56120
testl %eax, %eax
je 0xb1949
leaq 0xc4595(%rip), %rdi     # 0x176078
xorl %esi, %esi
callq 0x58e20
movq 0xba43f(%rip), %rdi     # 0x16bf30
leaq 0xc4580(%rip), %rsi     # 0x176078
leaq 0xbc581(%rip), %rdx     # 0x16e080
callq 0x57e10
leaq 0xc4585(%rip), %rdi     # 0x176090
callq 0x56b80
jmp 0xb1949
movq %rax, %rbx
leaq 0xc4571(%rip), %rdi     # 0x176090
callq 0x56420
jmp 0xb1b4e
jmp 0xb1b2e
jmp 0xb1b41
jmp 0xb1b41
jmp 0xb1b2e
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x59200
jmp 0xb1b44
jmp 0xb1b41
jmp 0xb1b41
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rdi
callq 0x57090