// File: demon386[P]git-store/./libs/filesystem/src/operations.cpp
// Function: boost::filesystem::detail::temp_directory_path(boost::system::error_code*)
BOOST_FILESYSTEM_DECL
  path temp_directory_path(system::error_code* ec)
  {
#   ifdef BOOST_POSIX_API
      const char* val = 0;
      
      (val = std::getenv("TMPDIR" )) ||
      (val = std::getenv("TMP"    )) ||
      (val = std::getenv("TEMP"   )) ||
      (val = std::getenv("TEMPDIR"));
      
#     ifdef __ANDROID__
        const char* default_tmp = "/data/local/tmp";
#     else
        const char* default_tmp = "/tmp";
#     endif
      path p((val!=0) ? val : default_tmp);
       
      if (p.empty() || (ec&&!is_directory(p, *ec))||(!ec&&!is_directory(p)))
      {
        error(ENOTDIR, p, ec, "boost::filesystem::temp_directory_path");
        return p;
      }
        
      return p;
      
#   else  // Windows

      const wchar_t* tmp_env = L"TMP";
      const wchar_t* temp_env = L"TEMP";
      const wchar_t* localappdata_env = L"LOCALAPPDATA";
      const wchar_t* userprofile_env = L"USERPROFILE";
      const wchar_t* env_list[]
        = {tmp_env, temp_env, localappdata_env, userprofile_env, 0};

      path p;
      for (int i = 0; env_list[i]; ++i)
      {
        std::wstring env = wgetenv(env_list[i]);
        if (!env.empty())
        {
          p = env;
          if (i >= 2)
            p /= L"Temp";
          error_code lcl_ec;
          if (exists(p, lcl_ec) && !lcl_ec && is_directory(p, lcl_ec) && !lcl_ec)
            break;
          p.clear();
        }
      }

      if (p.empty())
      {
        // use vector since in C++03 a string is not required to be contiguous
        std::vector<wchar_t> buf(::GetWindowsDirectoryW(NULL, 0));

        if (buf.empty()
          || ::GetWindowsDirectoryW(&buf[0], static_cast<UINT>(buf.size())) == 0)
        {
          error(::GetLastError(), ec, "boost::filesystem::temp_directory_path");
          return path();
        }
        p = &*buf.begin();  // do not depend on buf.size(); see ticket #10388
        p /= L"Temp";
      }
      return p;

#   endif
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x90, %rsp
movq %rdi, -0x70(%rbp)
movq %rdi, %rax
movq %rax, -0x68(%rbp)
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq $0x0, -0x18(%rbp)
leaq 0x170b3(%rip), %rdi     # 0x63000
callq 0xd780
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4bf9f
leaq 0x170a4(%rip), %rdi     # 0x63007
callq 0xd780
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4bf9f
leaq 0x17092(%rip), %rdi     # 0x6300b
callq 0xd780
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
jne 0x4bf9f
leaq 0x17081(%rip), %rdi     # 0x63010
callq 0xd780
movq %rax, -0x18(%rbp)
cmpq $0x0, %rax
setne %al
leaq 0x17072(%rip), %rax     # 0x63018
movq %rax, -0x20(%rbp)
movb $0x0, -0x21(%rbp)
cmpq $0x0, -0x18(%rbp)
je 0x4bfbf
movq -0x18(%rbp), %rax
movq %rax, -0x78(%rbp)
jmp 0x4bfc7
movq -0x20(%rbp), %rax
movq %rax, -0x78(%rbp)
movq -0x70(%rbp), %rdi
movq -0x78(%rbp), %rsi
callq 0x4df90
movq -0x70(%rbp), %rdi
callq 0x4d570
movb %al, -0x79(%rbp)
jmp 0x4bfe2
movb -0x79(%rbp), %al
testb $0x1, %al
jne 0x4c033
jmp 0x4bfeb
cmpq $0x0, -0x10(%rbp)
je 0x4c00d
movq -0x70(%rbp), %rdi
movq -0x10(%rbp), %rsi
callq 0x4dcc0
movb %al, -0x7a(%rbp)
jmp 0x4c004
movb -0x7a(%rbp), %al
testb $0x1, %al
jne 0x4c00d
jmp 0x4c033
cmpq $0x0, -0x10(%rbp)
jne 0x4c0dd
movq -0x70(%rbp), %rdi
callq 0x4e000
movb %al, -0x7b(%rbp)
jmp 0x4c026
movb -0x7b(%rbp), %al
testb $0x1, %al
jne 0x4c0dd
jmp 0x4c033
movq -0x10(%rbp), %rax
movq %rax, -0x90(%rbp)
leaq -0x59(%rbp), %rdi
movq %rdi, -0x88(%rbp)
callq 0xdb50
movq -0x88(%rbp), %rdx
leaq 0x16fc1(%rip), %rsi     # 0x6301d
leaq -0x58(%rbp), %rdi
callq 0xd8b0
jmp 0x4c067
movq -0x90(%rbp), %rdx
movq -0x70(%rbp), %rsi
movl $0x14, %edi
leaq -0x58(%rbp), %rcx
callq 0x4a0b0
jmp 0x4c082
leaq -0x58(%rbp), %rdi
callq 0xdca8
leaq -0x59(%rbp), %rdi
callq 0xd6b0
movb $0x1, -0x21(%rbp)
movl $0x1, -0x60(%rbp)
jmp 0x4c0e8
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4c104
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
jmp 0x4c0d2
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0x30(%rbp)
movl %eax, -0x34(%rbp)
leaq -0x58(%rbp), %rdi
callq 0xdca8
leaq -0x59(%rbp), %rdi
callq 0xd6b0
jmp 0x4c104
movb $0x1, -0x21(%rbp)
movl $0x1, -0x60(%rbp)
testb $0x1, -0x21(%rbp)
jne 0x4c0f7
movq -0x70(%rbp), %rdi
callq 0x4d550
movq -0x68(%rbp), %rax
addq $0x90, %rsp
popq %rbp
retq
movq -0x70(%rbp), %rdi
callq 0x4d550
movq -0x30(%rbp), %rdi
callq 0xdb30
nopw %cs:(%rax,%rax)