// File: /workspace/github_c_makefile_star2_O1/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 0xc4963(%rip), %al      # 0x177090
testb %al, %al
je 0xb28b4
leaq 0xc493c(%rip), %rdi     # 0x177078
xorl %esi, %esi
callq 0x56bd0
testb %al, %al
je 0xb275b
leaq 0xc492a(%rip), %rsi     # 0x177078
movq %rbx, %rdi
callq 0x570b0
jmp 0xb28aa
leaq 0x609c4(%rip), %rsi     # 0x113126
leaq 0x20(%rsp), %rdi
callq 0x590d0
leaq 0x60f3f(%rip), %rdi     # 0x1136b2
callq 0x57720
leaq 0xc48f9(%rip), %rdi     # 0x177078
movq %rax, %rsi
callq 0x55f40
leaq 0xc48ea(%rip), %rdi     # 0x177078
xorl %esi, %esi
callq 0x55260
testb %al, %al
je 0xb280a
callq 0x56090
movl %eax, %edi
callq 0x559b0
testq %rax, %rax
je 0xb27bc
movq 0x20(%rax), %rsi
leaq 0xc48c3(%rip), %rdi     # 0x177078
callq 0x55f40
jmp 0xb27cf
leaq 0xc48b5(%rip), %rdi     # 0x177078
leaq 0x41a82(%rip), %rsi     # 0xf424c
callq 0x55f40
leaq 0x60eeb(%rip), %rsi     # 0x1136c1
leaq 0x8(%rsp), %rdi
callq 0x579f0
leaq 0xc4891(%rip), %rdi     # 0x177078
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0xc4880(%rip), %rdi     # 0x177078
movq %rax, %rsi
callq 0x555f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4855(%rip), %rdi     # 0x177078
leaq 0x8(%rsp), %rsi
callq 0x58b10
movl %eax, %ebp
leaq 0x8(%rsp), %rdi
callq 0x59200
testb %bpl, %bpl
jne 0xb286b
callq 0x55370
leaq 0x8(%rsp), %rdi
movq %rax, %rsi
callq 0x579f0
leaq 0xc4821(%rip), %rdi     # 0x177078
leaq 0x8(%rsp), %rsi
callq 0x562f0
leaq 0x8(%rsp), %rdi
callq 0x59200
callq 0x55370
leaq 0xc4801(%rip), %rdi     # 0x177078
movq %rax, %rsi
callq 0x57ef0
testb %al, %al
je 0xb2891
leaq 0xc47ee(%rip), %rdi     # 0x177078
xorl %esi, %esi
callq 0x579e0
leaq 0xc47e0(%rip), %rsi     # 0x177078
movq %rbx, %rdi
callq 0x570b0
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rax
addq $0x38, %rsp
popq %rbx
popq %rbp
retq
leaq 0xc47d5(%rip), %rdi     # 0x177090
callq 0x56120
testl %eax, %eax
je 0xb2735
leaq 0xc47a9(%rip), %rdi     # 0x177078
xorl %esi, %esi
callq 0x58e20
movq 0xba653(%rip), %rdi     # 0x16cf30
leaq 0xc4794(%rip), %rsi     # 0x177078
leaq 0xbc795(%rip), %rdx     # 0x16f080
callq 0x57e10
leaq 0xc4799(%rip), %rdi     # 0x177090
callq 0x56b80
jmp 0xb2735
movq %rax, %rbx
leaq 0xc4785(%rip), %rdi     # 0x177090
callq 0x56420
jmp 0xb293a
jmp 0xb291a
jmp 0xb292d
jmp 0xb292d
jmp 0xb291a
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x59200
jmp 0xb2930
jmp 0xb292d
jmp 0xb292d
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x56a30
movq %rbx, %rdi
callq 0x57090