// File: /workspace/github_c_makefile_star2_O0/enzo1982[P]smooth/classes/system/system.cpp
// Function: smooth::System::System::GetProgramFilesDirectory()
S::String S::System::System::GetProgramFilesDirectory()
{
	static String	 programsDir;

	if (programsDir != NIL) return programsDir;

#ifdef __WIN32__
	HKEY	 currentVersion;

	if (RegOpenKeyEx(HKEY_LOCAL_MACHINE, L"Software\\Microsoft\\Windows\\CurrentVersion", 0, KEY_QUERY_VALUE, &currentVersion) == ERROR_SUCCESS)
	{
		DWORD		 size = (32768 + 1) * sizeof(wchar_t);
		Buffer<BYTE>	 buffer(size);

		RegQueryValueEx(currentVersion, L"ProgramFilesDir", 0, NIL, buffer, &size);

		programsDir = (wchar_t *) (BYTE *) buffer;

		RegCloseKey(currentVersion);
	}

	if (programsDir == NIL)
	{
		/* Failed to get the program files directory from the registry.
		 * Get the directory name from the environment variable.
		 */
		Buffer<wchar_t>	 buffer(32768 + 1);

		ExpandEnvironmentStrings(String("%ProgramFiles%"), buffer, buffer.Size());

		programsDir = buffer;
	}
#endif

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

	return programsDir;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x80, %rsp
movq %rdi, -0x58(%rbp)
movq %rdi, %rax
movq %rax, -0x50(%rbp)
movq %rdi, -0x8(%rbp)
cmpb $0x0, 0x10a45f(%rip)    # 0x213ca0
jne 0x10988a
leaq 0x10a456(%rip), %rdi    # 0x213ca0
callq 0x5a4e0
cmpl $0x0, %eax
je 0x10988a
leaq 0x10a42d(%rip), %rdi    # 0x213c88
xorl %esi, %esi
callq 0x5da90
jmp 0x109864
movq 0xff6bd(%rip), %rdi     # 0x208f28
leaq 0x10a416(%rip), %rsi    # 0x213c88
leaq 0x101e87(%rip), %rdx    # 0x20b700
callq 0x5c700
leaq 0x10a41b(%rip), %rdi    # 0x213ca0
callq 0x5b0c0
leaq 0x10a3f7(%rip), %rdi    # 0x213c88
xorl %esi, %esi
callq 0x5b110
testb $0x1, %al
jne 0x10989e
jmp 0x1098d0
movq -0x58(%rbp), %rdi
leaq 0x10a3df(%rip), %rsi    # 0x213c88
callq 0x5b6d0
jmp 0x1099ac
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq 0x10a3da(%rip), %rdi    # 0x213ca0
callq 0x5a860
jmp 0x1099b9
callq 0x59460
movq %rax, %rsi
leaq -0x30(%rbp), %rdi
movq %rdi, -0x68(%rbp)
callq 0x5c1f0
movq -0x68(%rbp), %rsi
leaq 0x10a398(%rip), %rdi    # 0x213c88
callq 0x5d6c0
movb %al, -0x59(%rbp)
jmp 0x1098fa
movb -0x59(%rbp), %al
xorb $-0x1, %al
movb %al, -0x69(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5df00
movb -0x69(%rbp), %al
testb $0x1, %al
jne 0x109914
jmp 0x109974
callq 0x59460
movq %rax, %rsi
leaq -0x48(%rbp), %rdi
movq %rdi, -0x78(%rbp)
callq 0x5c1f0
movq -0x78(%rbp), %rsi
leaq 0x10a354(%rip), %rdi    # 0x213c88
callq 0x5a710
jmp 0x10993b
leaq -0x48(%rbp), %rdi
callq 0x5df00
jmp 0x109974
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x30(%rbp), %rdi
callq 0x5df00
jmp 0x1099b9
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x10(%rbp)
movl %eax, -0x14(%rbp)
leaq -0x48(%rbp), %rdi
callq 0x5df00
jmp 0x1099b9
callq 0x59460
movq %rax, %rsi
leaq 0x10a305(%rip), %rdi    # 0x213c88
callq 0x5c7f0
testb $0x1, %al
jne 0x10998e
jmp 0x10999c
leaq 0x10a2f3(%rip), %rdi    # 0x213c88
xorl %esi, %esi
callq 0x5c1e0
movq -0x58(%rbp), %rdi
leaq 0x10a2e1(%rip), %rsi    # 0x213c88
callq 0x5b6d0
movq -0x50(%rbp), %rax
addq $0x80, %rsp
popq %rbp
retq
movq -0x10(%rbp), %rdi
callq 0x5b6b0
nopw %cs:(%rax,%rax)