// File: /workspace/github_c_makefile_star2_O2/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 0xbf843(%rip), %al      # 0x16c250
testb %al, %al
je 0xacb94
leaq 0xbf81c(%rip), %rdi     # 0x16c238
xorl %esi, %esi
callq 0x57d40
testb %al, %al
je 0xaca3b
leaq 0xbf80a(%rip), %rsi     # 0x16c238
movq %rbx, %rdi
callq 0x58280
jmp 0xacb8a
leaq 0x55784(%rip), %rsi     # 0x1021c6
leaq 0x20(%rsp), %rdi
callq 0x5a450
leaq 0x55d14(%rip), %rdi     # 0x102767
callq 0x58950
leaq 0xbf7d9(%rip), %rdi     # 0x16c238
movq %rax, %rsi
callq 0x57010
leaq 0xbf7ca(%rip), %rdi     # 0x16c238
xorl %esi, %esi
callq 0x56280
testb %al, %al
je 0xacaea
callq 0x57170
movl %eax, %edi
callq 0x56a10
testq %rax, %rax
je 0xaca9c
movq 0x20(%rax), %rsi
leaq 0xbf7a3(%rip), %rdi     # 0x16c238
callq 0x57010
jmp 0xacaaf
leaq 0xbf795(%rip), %rdi     # 0x16c238
leaq 0x36789(%rip), %rsi     # 0xe3233
callq 0x57010
leaq 0x55cc0(%rip), %rsi     # 0x102776
leaq 0x8(%rsp), %rdi
callq 0x58c40
leaq 0xbf771(%rip), %rdi     # 0x16c238
leaq 0x8(%rsp), %rsi
callq 0x573e0
leaq 0xbf760(%rip), %rdi     # 0x16c238
movq %rax, %rsi
callq 0x56630
leaq 0x8(%rsp), %rdi
callq 0x5a588
callq 0x563a0
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x58c40
leaq 0xbf735(%rip), %rdi     # 0x16c238
leaq 0x8(%rsp), %rsi
callq 0x59e50
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x5a588
testb %bpl, %bpl
jne 0xacb4b
callq 0x563a0
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x58c40
leaq 0xbf701(%rip), %rdi     # 0x16c238
leaq 0x8(%rsp), %rsi
callq 0x573e0
leaq 0x8(%rsp), %rdi
callq 0x5a588
callq 0x563a0
leaq 0xbf6e1(%rip), %rdi     # 0x16c238
movq %rax, %rsi
callq 0x59180
testb %al, %al
je 0xacb71
leaq 0xbf6ce(%rip), %rdi     # 0x16c238
xorl %esi, %esi
callq 0x58c30
leaq 0xbf6c0(%rip), %rsi     # 0x16c238
movq %rbx, %rdi
callq 0x58280
leaq 0x20(%rsp), %rdi
callq 0x57b90
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
leaq 0xbf6b5(%rip), %rdi     # 0x16c250
callq 0x57210
testl %eax, %eax
je 0xaca15
leaq 0xbf689(%rip), %rdi     # 0x16c238
xorl %esi, %esi
callq 0x5a180
movq 0xb5373(%rip), %rdi     # 0x161f30
leaq 0xbf674(%rip), %rsi     # 0x16c238
leaq 0xb7675(%rip), %rdx     # 0x164240
callq 0x590a0
leaq 0xbf679(%rip), %rdi     # 0x16c250
callq 0x57cf0
jmp 0xaca15
movq %rax, %rbx
leaq 0xbf665(%rip), %rdi     # 0x16c250
callq 0x57520
jmp 0xacc1a
jmp 0xacbfa
jmp 0xacc0d
jmp 0xacc0d
jmp 0xacbfa
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x5a588
jmp 0xacc10
jmp 0xacc0d
jmp 0xacc0d
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x57b90
movq %rbx, %rdi
callq 0x58260