// File: /workspace/github_cpp_makefile_star2_O1/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 0x2826e
je 0x28261
movq %rdx, %rbx
movl %esi, %r15d
movq %rdi, %r14
movl $0x0, -0x30(%rbp)
callq 0x2c80a
movq %rax, -0x28(%rbp)
leaq -0x30(%rbp), %rsi
movq %r14, %rdi
btl $0xe, %r15d
jb 0x281f4
callq 0x28975
jmp 0x281f9
callq 0x26ba2
cmpl $0x0, -0x30(%rbp)
je 0x28211
testq %rbx, %rbx
je 0x2828d
movups -0x30(%rbp), %xmm0
movups %xmm0, (%rbx)
jmp 0x28261
shrq $0x20, %rax
btl $0xc, %r15d
jb 0x28228
btl $0xd, %r15d
jae 0x2822e
andl %r12d, %eax
jmp 0x2822b
orl %r15d, %eax
movl %eax, %r15d
movq (%r14), %rdi
andl 0x243b0(%rip), %r15d    # 0x4c5e8
movl %r15d, %esi
callq 0xb410
testl %eax, %eax
je 0x28261
testq %rbx, %rbx
je 0x282e7
callq 0xb060
movl (%rax), %r14d
callq 0x2c7ec
movl %r14d, (%rbx)
movq %rax, 0x8(%rbx)
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
leaq 0xdb2c(%rip), %rdi      # 0x35da1
leaq 0xd85d(%rip), %rsi      # 0x35ad9
leaq 0xdb86(%rip), %rcx      # 0x35e09
movl $0x562, %edx            # imm = 0x562
callq 0xb310
movl $0x50, %edi
callq 0xb250
movq %rax, %rbx
leaq -0x40(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0xdbb7(%rip), %rsi      # 0x35e60
leaq 0xdbce(%rip), %rdx      # 0x35e7e
leaq -0x50(%rbp), %rdi
callq 0xf97e
movl -0x30(%rbp), %ecx
movq -0x28(%rbp), %r8
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
callq 0x29772
leaq 0x23292(%rip), %rsi     # 0x4b568
leaq 0x157f(%rip), %rdx      # 0x2985c
movq %rbx, %rdi
callq 0xb7b0
jmp 0x2834c
movl $0x50, %edi
callq 0xb250
movq %rax, %rbx
leaq -0x40(%rbp), %r12
movq %r12, -0x10(%r12)
leaq 0xdb5c(%rip), %rsi      # 0x35e60
leaq 0xdb73(%rip), %rdx      # 0x35e7e
leaq -0x50(%rbp), %rdi
callq 0xf97e
callq 0xb060
movl (%rax), %r15d
callq 0x2c7ec
leaq -0x50(%rbp), %rsi
movq %rbx, %rdi
movq %r14, %rdx
movl %r15d, %ecx
movq %rax, %r8
callq 0x29772
leaq 0x2322b(%rip), %rsi     # 0x4b568
leaq 0x1518(%rip), %rdx      # 0x2985c
movq %rbx, %rdi
callq 0xb7b0
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %r12, %rdi
jne 0x28368
jmp 0x2836d
jmp 0x28371
movq %rax, %r14
movq -0x50(%rbp), %rdi
cmpq %r15, %rdi
je 0x2836d
callq 0xb430
xorl %eax, %eax
jmp 0x28376
movq %rax, %r14
movb $0x1, %al
testb %al, %al
je 0x28382
movq %rbx, %rdi
callq 0xb360
movq %r14, %rdi
callq 0xb7f0