// File: /workspace/github_cpp_makefile_star2_O3/demon386[P]git-store/./libs/filesystem/src/operations.cpp
// Function: boost::filesystem::detail::permissions(boost::filesystem::path const&, boost::filesystem::perms, boost::system::error_code*)
BOOST_FILESYSTEM_DECL
  void permissions(const path& p, perms prms, system::error_code* ec)
  {
    BOOST_ASSERT_MSG(!((prms & add_perms) && (prms & remove_perms)),
      "add_perms and remove_perms are mutually exclusive");

    if ((prms & add_perms) && (prms & remove_perms))  // precondition failed
      return;

# ifdef BOOST_POSIX_API
    error_code local_ec;
    file_status current_status((prms & symlink_perms)
                               ? fs::symlink_status(p, local_ec)
                               : fs::status(p, local_ec));
    if (local_ec)
    {
      if (ec == 0)
      BOOST_FILESYSTEM_THROW(filesystem_error(
          "boost::filesystem::permissions", p, local_ec));
      else
        *ec = local_ec;
      return;
    }

    if (prms & add_perms)
      prms |= current_status.permissions();
    else if (prms & remove_perms)
      prms = current_status.permissions() & ~prms;

    // Mac OS X Lion and some other platforms don't support fchmodat().
    // Solaris (SunPro and gcc) only support fchmodat() on Solaris 11 and higher,
    // and a runtime check is too much trouble.
    // Linux does not support permissions on symbolic links and has no plans to
    // support them in the future.  The chmod() code is thus more practical,
    // rather than always hitting ENOTSUP when sending in AT_SYMLINK_NO_FOLLOW.
    //  - See the 3rd paragraph of
    // "Symbolic link ownership, permissions, and timestamps" at:
    //   "http://man7.org/linux/man-pages/man7/symlink.7.html"
    //  - See the fchmodat() Linux man page:
    //   "http://man7.org/linux/man-pages/man2/fchmodat.2.html"
#   if defined(AT_FDCWD) && defined(AT_SYMLINK_NOFOLLOW) \
      && !(defined(__SUNPRO_CC) || defined(__sun) || defined(sun)) \
      && !(defined(linux) || defined(__linux) || defined(__linux__))
      if (::fchmodat(AT_FDCWD, p.c_str(), mode_cast(prms),
           !(prms & symlink_perms) ? 0 : AT_SYMLINK_NOFOLLOW))
#   else  // fallback if fchmodat() not supported
      if (::chmod(p.c_str(), mode_cast(prms)))
#   endif
    {
      if (ec == 0)
      BOOST_FILESYSTEM_THROW(filesystem_error(
          "boost::filesystem::permissions", p,
          error_code(errno, system::generic_category())));
      else
        ec->assign(errno, system::generic_category());
    }

# else  // Windows

    // if not going to alter FILE_ATTRIBUTE_READONLY, just return
    if (!(!((prms & (add_perms | remove_perms)))
      || (prms & (owner_write|group_write|others_write))))
      return;

    DWORD attr = ::GetFileAttributesW(p.c_str());

    if (error(attr == 0 ? BOOST_ERRNO : 0, p, ec, "boost::filesystem::permissions"))
      return;

    if (prms & add_perms)
      attr &= ~FILE_ATTRIBUTE_READONLY;
    else if (prms & remove_perms)
      attr |= FILE_ATTRIBUTE_READONLY;
    else if (prms & (owner_write|group_write|others_write))
      attr &= ~FILE_ATTRIBUTE_READONLY;
    else
      attr |= FILE_ATTRIBUTE_READONLY;

    error(::SetFileAttributesW(p.c_str(), attr) == 0 ? BOOST_ERRNO : 0,
      p, ec, "boost::filesystem::permissions");
# endif
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl %esi, %r12d
notl %r12d
testl $0x3000, %r12d          # imm = 0x3000
je 0x27fb3
movq %rdx, %r14
movl %esi, %r15d
movq %rdi, %rbx
movl $0x0, -0x30(%rbp)
callq 0x2c4e2
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rsi
movq %rbx, %rdi
btl $0xe, %r15d
jb 0x27f39
callq 0x2869d
jmp 0x27f3e
callq 0x26910
cmpl $0x0, -0x30(%rbp)
je 0x27f57
testq %r14, %r14
je 0x27fd2
movups -0x30(%rbp), %xmm0
movups %xmm0, (%r14)
jmp 0x27fa6
shrq $0x20, %rax
btl $0xc, %r15d
jb 0x27f6e
btl $0xd, %r15d
jae 0x27f74
andl %r12d, %eax
jmp 0x27f71
orl %r15d, %eax
movl %eax, %r15d
movq (%rbx), %rdi
andl 0x2466a(%rip), %r15d    # 0x4c5e8
movl %r15d, %esi
callq 0xb410
testl %eax, %eax
je 0x27fa6
testq %r14, %r14
je 0x2802c
callq 0xb060
movl (%rax), %ebx
callq 0x2c4c4
movl %ebx, (%r14)
movq %rax, 0x8(%r14)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdde7(%rip), %rdi      # 0x35da1
leaq 0xdb18(%rip), %rsi      # 0x35ad9
leaq 0xde41(%rip), %rcx      # 0x35e09
movl $0x562, %edx            # imm = 0x562
callq 0xb310
movl $0x50, %edi
callq 0xb250
movq %rax, %r14
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xde72(%rip), %rsi      # 0x35e60
leaq 0xde89(%rip), %rdx      # 0x35e7e
leaq -0x50(%rbp), %rdi
callq 0xf8ee
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %r8
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
callq 0x2946c
leaq 0x2354d(%rip), %rsi     # 0x4b568
leaq 0x1554(%rip), %rdx      # 0x29576
movq %r14, %rdi
callq 0xb7b0
jmp 0x28091
movl $0x50, %edi
callq 0xb250
movq %rax, %r14
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xde17(%rip), %rsi      # 0x35e60
leaq 0xde2e(%rip), %rdx      # 0x35e7e
leaq -0x50(%rbp), %rdi
callq 0xf8ee
callq 0xb060
movl (%rax), %r15d
callq 0x2c4c4
leaq -0x50(%rbp), %rsi
movq %r14, %rdi
movq %rbx, %rdx
movl %r15d, %ecx
movq %rax, %r8
callq 0x2946c
leaq 0x234e6(%rip), %rsi     # 0x4b568
leaq 0x14ed(%rip), %rdx      # 0x29576
movq %r14, %rdi
callq 0xb7b0
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
jne 0x280ad
jmp 0x280bf
jmp 0x280b4
movq %rax, %rbx
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x280bf
callq 0xb430
jmp 0x280bf
movq %rax, %rbx
movq %r14, %rdi
callq 0xb360
movq %rbx, %rdi
callq 0xb7f0