// File: demon386[P]git-store/./libs/filesystem/src/operations.cpp
// Function: boost::filesystem::detail::status(boost::filesystem::path const&, boost::system::error_code*)
BOOST_FILESYSTEM_DECL
  file_status status(const path& p, error_code* ec)
  {
#   ifdef BOOST_POSIX_API

    struct stat path_stat;
    if (::stat(p.c_str(), &path_stat)!= 0)
    {
      if (ec != 0)                            // always report errno, even though some
        ec->assign(errno, system_category());   // errno values are not status_errors

      if (not_found_error(errno))
      {
        return fs::file_status(fs::file_not_found, fs::no_perms);
      }
      if (ec == 0)
        BOOST_FILESYSTEM_THROW(filesystem_error("boost::filesystem::status",
          p, error_code(errno, system_category())));
      return fs::file_status(fs::status_error);
    }
    if (ec != 0) ec->clear();;
    if (S_ISDIR(path_stat.st_mode))
      return fs::file_status(fs::directory_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    if (S_ISREG(path_stat.st_mode))
      return fs::file_status(fs::regular_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    if (S_ISBLK(path_stat.st_mode))
      return fs::file_status(fs::block_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    if (S_ISCHR(path_stat.st_mode))
      return fs::file_status(fs::character_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    if (S_ISFIFO(path_stat.st_mode))
      return fs::file_status(fs::fifo_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    if (S_ISSOCK(path_stat.st_mode))
      return fs::file_status(fs::socket_file,
        static_cast<perms>(path_stat.st_mode) & fs::perms_mask);
    return fs::file_status(fs::type_unknown);

#   else  // Windows

    DWORD attr(::GetFileAttributesW(p.c_str()));
    if (attr == 0xFFFFFFFF)
    {
      return process_status_failure(p, ec);
    }

    //  reparse point handling;
    //    since GetFileAttributesW does not resolve symlinks, try to open a file
    //    handle to discover if the file exists
    if (attr & FILE_ATTRIBUTE_REPARSE_POINT)
    {
      handle_wrapper h(
        create_file_handle(
            p.c_str(),
            0,  // dwDesiredAccess; attributes only
            FILE_SHARE_DELETE | FILE_SHARE_READ | FILE_SHARE_WRITE,
            0,  // lpSecurityAttributes
            OPEN_EXISTING,
            FILE_FLAG_BACKUP_SEMANTICS,
            0)); // hTemplateFile
      if (h.handle == INVALID_HANDLE_VALUE)
      {
        return process_status_failure(p, ec);
      }

      if (!is_reparse_point_a_symlink(p))
        return file_status(reparse_file, make_permissions(p, attr));
    }

    if (ec != 0) ec->clear();
    return (attr & FILE_ATTRIBUTE_DIRECTORY)
      ? file_status(directory_file, make_permissions(p, attr))
      : file_status(regular_file, make_permissions(p, attr));

#   endif
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x120, %rsp            # imm = 0x120
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x10(%rbp), %rdi
callq 0x4dc70
movq %rax, %rdi
leaq -0xa8(%rbp), %rsi
callq 0xdae0
cmpl $0x0, %eax
je 0x4bd54
cmpq $0x0, -0x18(%rbp)
je 0x4bbed
movq -0x18(%rbp), %rax
movq %rax, -0x100(%rbp)
callq 0xd070
movl (%rax), %eax
movl %eax, -0xf8(%rbp)
callq 0x53ec0
movq -0x100(%rbp), %rdi
movl -0xf8(%rbp), %esi
movq %rax, %rdx
callq 0x4d800
callq 0xd070
movl (%rax), %edi
callq 0x4bee0
testb $0x1, %al
jne 0x4bbff
jmp 0x4bc14
leaq -0x8(%rbp), %rdi
movl $0x1, %esi
xorl %edx, %edx
callq 0x4df70
jmp 0x4beb8
cmpq $0x0, -0x18(%rbp)
jne 0x4bd3f
movb $0x1, -0xf1(%rbp)
movl $0x50, %edi
callq 0xd2b0
movq %rax, -0x110(%rbp)
leaq -0xc9(%rbp), %rdi
movq %rdi, -0x108(%rbp)
callq 0xdb50
movq -0x108(%rbp), %rdx
leaq 0x1738e(%rip), %rsi     # 0x62fe6
leaq -0xc8(%rbp), %rdi
callq 0xd8b0
jmp 0x4bc66
movq -0x10(%rbp), %rax
movq %rax, -0x118(%rbp)
callq 0xd070
movl (%rax), %eax
movl %eax, -0x11c(%rbp)
callq 0x53ec0
movl -0x11c(%rbp), %esi
movq %rax, %rdx
leaq -0xf0(%rbp), %rdi
callq 0x4d680
movq -0x118(%rbp), %rdx
movq -0x110(%rbp), %rdi
movl -0xf0(%rbp), %ecx
movq -0xe8(%rbp), %r8
leaq -0xc8(%rbp), %rsi
callq 0x4d6b0
movq -0x110(%rbp), %rdi
movb $0x0, -0xf1(%rbp)
leaq 0x41884(%rip), %rsi     # 0x8d558
leaq 0x1ae5(%rip), %rdx      # 0x4d7c0
callq 0xdad0
jmp 0x4bed1
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
jmp 0x4bd17
movq %rax, %rcx
movl %edx, %eax
movq %rcx, -0xd8(%rbp)
movl %eax, -0xdc(%rbp)
leaq -0xc8(%rbp), %rdi
callq 0xdca8
leaq -0xc9(%rbp), %rdi
callq 0xd6b0
testb $0x1, -0xf1(%rbp)
jne 0x4bd2e
jmp 0x4bd3a
movq -0x110(%rbp), %rdi
callq 0xd460
jmp 0x4bec5
leaq -0x8(%rbp), %rdi
xorl %esi, %esi
movl $0xffff, %edx           # imm = 0xFFFF
callq 0x4df70
jmp 0x4beb8
cmpq $0x0, -0x18(%rbp)
je 0x4bd64
movq -0x18(%rbp), %rdi
callq 0x4d9e0
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x4000, %eax           # imm = 0x4000
jne 0x4bd9b
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x3, %esi
callq 0x4df70
jmp 0x4beb8
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x8000, %eax           # imm = 0x8000
jne 0x4bdd2
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x2, %esi
callq 0x4df70
jmp 0x4beb8
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x6000, %eax           # imm = 0x6000
jne 0x4be09
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x5, %esi
callq 0x4df70
jmp 0x4beb8
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x2000, %eax           # imm = 0x2000
jne 0x4be3d
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x6, %esi
callq 0x4df70
jmp 0x4beb8
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0x1000, %eax           # imm = 0x1000
jne 0x4be71
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x7, %esi
callq 0x4df70
jmp 0x4beb8
movl -0x90(%rbp), %eax
andl $0xf000, %eax           # imm = 0xF000
cmpl $0xc000, %eax           # imm = 0xC000
jne 0x4bea5
movl -0x90(%rbp), %edi
movl $0xfff, %esi            # imm = 0xFFF
callq 0x4ddc0
movl %eax, %edx
leaq -0x8(%rbp), %rdi
movl $0x8, %esi
callq 0x4df70
jmp 0x4beb8
leaq -0x8(%rbp), %rdi
movl $0xa, %esi
movl $0xffff, %edx           # imm = 0xFFFF
callq 0x4df70
movq -0x8(%rbp), %rax
addq $0x120, %rsp            # imm = 0x120
popq %rbp
retq
movq -0xd8(%rbp), %rdi
callq 0xdb30
nopw %cs:(%rax,%rax)