// File: /workspace/github_cpp_makefile_star2_O2/demon386[P]git-store/./libs/filesystem/src/operations.cpp
// Function: boost::filesystem::detail::read_symlink(boost::filesystem::path const&, boost::system::error_code*)
BOOST_FILESYSTEM_DECL
  path read_symlink(const path& p, system::error_code* ec)
  {
    path symlink_path;

#   ifdef BOOST_POSIX_API

    for (std::size_t path_max = 64;; path_max *= 2)// loop 'til buffer large enough
    {
      boost::scoped_array<char> buf(new char[path_max]);
      ssize_t result;
      if ((result=::readlink(p.c_str(), buf.get(), path_max))== -1)
      {
        if (ec == 0)
          BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::read_symlink",
            p, error_code(errno, system_category())));
        else ec->assign(errno, system_category());
        break;
      }
      else
      {
        if(result != static_cast<ssize_t>(path_max))
        {
          symlink_path.assign(buf.get(), buf.get() + result);
          if (ec != 0) ec->clear();
          break;
        }
      }
    }

#   elif _WIN32_WINNT < 0x0600  // SDK earlier than Vista and Server 2008
    error(BOOST_ERROR_NOT_SUPPORTED, p, ec,
          "boost::filesystem::read_symlink");
#   else  // Vista and Server 2008 SDK, or later

    union info_t
    {
      char buf[REPARSE_DATA_BUFFER_HEADER_SIZE+MAXIMUM_REPARSE_DATA_BUFFER_SIZE];
      REPARSE_DATA_BUFFER rdb;
    } info;

    handle_wrapper h(
      create_file_handle(p.c_str(), GENERIC_READ, 0, 0, OPEN_EXISTING,
        FILE_FLAG_BACKUP_SEMANTICS | FILE_FLAG_OPEN_REPARSE_POINT, 0));

    if (error(h.handle == INVALID_HANDLE_VALUE ? BOOST_ERRNO : 0,
      p, ec, "boost::filesystem::read_symlink"))
        return symlink_path;

    DWORD sz;

    if (!error(::DeviceIoControl(h.handle, FSCTL_GET_REPARSE_POINT,
          0, 0, info.buf, sizeof(info), &sz, 0) == 0 ? BOOST_ERRNO : 0, p, ec,
          "boost::filesystem::read_symlink" ))
      symlink_path.assign(
        static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer)
        + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t),
        static_cast<wchar_t*>(info.rdb.SymbolicLinkReparseBuffer.PathBuffer)
        + info.rdb.SymbolicLinkReparseBuffer.PrintNameOffset/sizeof(wchar_t)
        + info.rdb.SymbolicLinkReparseBuffer.PrintNameLength/sizeof(wchar_t));
#     endif
    return symlink_path;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rdx, %r12
movq %rsi, %r15
movb $0x0, 0x10(%rdi)
pushq $0x40
popq %r13
movq %r13, %rdi
callq 0xc030
movq %rax, %r14
movq (%r15), %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0xc510
cmpq $-0x1, %rax
je 0x226b3
cmpq %r13, %rax
jne 0x226d0
movq %r14, %rdi
callq 0x25502
addq %r13, %r13
jmp 0x22682
testq %r12, %r12
je 0x22708
callq 0xc060
movl (%rax), %r15d
callq 0x2761f
movl %r15d, (%r12)
movq %rax, 0x8(%r12)
jmp 0x226ee
movq %r14, %rdx
addq %rax, %rdx
movq %rbx, %rdi
movq %r14, %rsi
callq 0x24c14
testq %r12, %r12
je 0x226ee
movq %r12, %rdi
callq 0x24b32
movq %r14, %rdi
callq 0x25502
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x50
popq %rdi
callq 0xc250
movq %rax, %r12
leaq 0xd815(%rip), %rsi      # 0x2ff2f
leaq -0x50(%rbp), %rdi
leaq -0x29(%rbp), %rdx
callq 0xc1b0
callq 0xc060
movl (%rax), %r13d
callq 0x2761f
leaq -0x50(%rbp), %rsi
movq %r12, %rdi
movq %r15, %rdx
movl %r13d, %ecx
movq %rax, %r8
callq 0x24a48
leaq 0x25e38(%rip), %rsi     # 0x48588
leaq 0x2391(%rip), %rdx      # 0x24ae8
movq %r12, %rdi
callq 0xc810
movq %rax, %r15
leaq -0x50(%rbp), %rdi
callq 0xc9a0
jmp 0x2277d
movq %rax, %r15
movq %r12, %rdi
callq 0xc390
jmp 0x2277d
movq %rax, %r15
movq %r14, %rdi
callq 0x25502
jmp 0x2278a
movq %rax, %r15
movq %rbx, %rdi
callq 0xc9a0
movq %r15, %rdi
callq 0xc850