// File: /workspace/github_c_makefile_star2_O0/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
movq %rsp, %rbp
subq $0xd0, %rsp
movq %rdi, -0x90(%rbp)
movq %rdi, %rax
movq %rax, -0x88(%rbp)
movq %rdi, -0x8(%rbp)
cmpb $0x0, 0x109fb9(%rip)    # 0x213ce0
jne 0x109d70
leaq 0x109fb0(%rip), %rdi    # 0x213ce0
callq 0x5a4e0
cmpl $0x0, %eax
je 0x109d70
leaq 0x109f87(%rip), %rdi    # 0x213cc8
xorl %esi, %esi
callq 0x5da90
jmp 0x109d4a
movq 0xff1d7(%rip), %rdi     # 0x208f28
leaq 0x109f70(%rip), %rsi    # 0x213cc8
leaq 0x1019a1(%rip), %rdx    # 0x20b700
callq 0x5c700
leaq 0x109f75(%rip), %rdi    # 0x213ce0
callq 0x5b0c0
leaq 0x109f51(%rip), %rdi    # 0x213cc8
xorl %esi, %esi
callq 0x5b110
testb $0x1, %al
jne 0x109d84
jmp 0x109db9
movq -0x90(%rbp), %rdi
leaq 0x109f36(%rip), %rsi    # 0x213cc8
callq 0x5b6d0
jmp 0x10a00f
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq 0x109f31(%rip), %rdi    # 0x213ce0
callq 0x5a860
jmp 0x10a01f
leaq 0x9be26(%rip), %rsi     # 0x1a5be6
leaq -0x30(%rbp), %rdi
callq 0x5ddc0
leaq 0x9c3a2(%rip), %rdi     # 0x1a6172
callq 0x5bea0
movq %rax, %rsi
leaq 0x109ee9(%rip), %rdi    # 0x213cc8
callq 0x5a230
jmp 0x109de6
leaq 0x109edb(%rip), %rdi    # 0x213cc8
xorl %esi, %esi
callq 0x59320
movb %al, -0x91(%rbp)
jmp 0x109dfc
movb -0x91(%rbp), %al
testb $0x1, %al
jne 0x109e0b
jmp 0x109ed7
callq 0x5a3e0
movl %eax, %edi
callq 0x59b70
movq %rax, -0xa0(%rbp)
jmp 0x109e20
movq -0xa0(%rbp), %rax
movq %rax, -0x38(%rbp)
cmpq $0x0, -0x38(%rbp)
je 0x109e5b
movq -0x38(%rbp), %rax
movq 0x20(%rax), %rsi
leaq 0x109e87(%rip), %rdi    # 0x213cc8
callq 0x5a230
jmp 0x109e48
jmp 0x109e72
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
jmp 0x10a004
leaq 0x109e66(%rip), %rdi    # 0x213cc8
leaq 0x7d3ca(%rip), %rsi     # 0x187233
callq 0x5a230
jmp 0x109e70
jmp 0x109e72
leaq 0x9c308(%rip), %rsi     # 0x1a6181
leaq -0x50(%rbp), %rdi
callq 0x5c1f0
jmp 0x109e84
leaq 0x109e3d(%rip), %rdi    # 0x213cc8
leaq -0x50(%rbp), %rsi
callq 0x5a710
movq %rax, -0xa8(%rbp)
jmp 0x109e9d
movq -0xa8(%rbp), %rsi
leaq 0x109e1d(%rip), %rdi    # 0x213cc8
callq 0x59760
jmp 0x109eb2
leaq -0x50(%rbp), %rdi
callq 0x5df00
jmp 0x109ed7
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x50(%rbp), %rdi
callq 0x5df00
jmp 0x10a004
callq 0x59460
movq %rax, -0xb0(%rbp)
jmp 0x109ee5
movq -0xb0(%rbp), %rsi
leaq -0x68(%rbp), %rdi
callq 0x5c1f0
jmp 0x109ef7
leaq 0x109dca(%rip), %rdi    # 0x213cc8
leaq -0x68(%rbp), %rsi
callq 0x5d6c0
movb %al, -0xb1(%rbp)
jmp 0x109f0f
movb -0xb1(%rbp), %al
xorb $-0x1, %al
movb %al, -0xb2(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5df00
movb -0xb2(%rbp), %al
testb $0x1, %al
jne 0x109f32
jmp 0x109f9d
callq 0x59460
movq %rax, -0xc0(%rbp)
jmp 0x109f40
movq -0xc0(%rbp), %rsi
leaq -0x80(%rbp), %rdi
callq 0x5c1f0
jmp 0x109f52
leaq 0x109d6f(%rip), %rdi    # 0x213cc8
leaq -0x80(%rbp), %rsi
callq 0x5a710
jmp 0x109f64
leaq -0x80(%rbp), %rdi
callq 0x5df00
jmp 0x109f9d
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x68(%rbp), %rdi
callq 0x5df00
jmp 0x10a004
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x80(%rbp), %rdi
callq 0x5df00
jmp 0x10a004
callq 0x59460
movq %rax, -0xc8(%rbp)
jmp 0x109fab
movq -0xc8(%rbp), %rsi
leaq 0x109d0f(%rip), %rdi    # 0x213cc8
callq 0x5c7f0
movb %al, -0xc9(%rbp)
jmp 0x109fc6
movb -0xc9(%rbp), %al
testb $0x1, %al
jne 0x109fd2
jmp 0x109fe4
leaq 0x109cef(%rip), %rdi    # 0x213cc8
xorl %esi, %esi
callq 0x5c1e0
jmp 0x109fe2
jmp 0x109fe4
movq -0x90(%rbp), %rdi
leaq 0x109cd6(%rip), %rsi    # 0x213cc8
callq 0x5b6d0
jmp 0x109ff9
leaq -0x30(%rbp), %rdi
callq 0x5af60
jmp 0x10a00f
leaq -0x30(%rbp), %rdi
callq 0x5af60
jmp 0x10a01f
movq -0x88(%rbp), %rax
addq $0xd0, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x5b6b0
nopl (%rax,%rax)