// File: /workspace/github_cpp_makefile_star2_O1/ncbi[P]amr/common.cpp
// Function: Common_sp::getFiletype(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, bool)
Filetype getFiletype (const string &path,
                      bool expandLink)
{
  struct stat buf;
  if (expandLink)
  {
    if (stat (path. c_str (), & buf))
      return Filetype::none;
  }
  else
  {
    if (lstat (path. c_str (), & buf))
      return Filetype::none;
  }
    
  if (S_ISDIR  (buf. st_mode))  return Filetype::dir;
  if (S_ISCHR  (buf. st_mode))  return Filetype::terminal;
  if (S_ISBLK  (buf. st_mode))  return Filetype::disk;
  if (S_ISREG  (buf. st_mode))  return Filetype::file;
  if (S_ISFIFO (buf. st_mode))  return Filetype::pipe;
  if (! expandLink)
  {
    if (S_ISLNK  (buf. st_mode))  return Filetype::link;
  }
  if (S_ISSOCK (buf. st_mode))  return Filetype::socket;
    
  NEVER_CALL;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x198, %rsp            # imm = 0x198
movl %esi, %ebx
movq (%rdi), %rdi
testl %esi, %esi
je 0x3a21b
leaq 0x108(%rsp), %rsi
callq 0xa510
jmp 0x3a228
leaq 0x108(%rsp), %rsi
callq 0xaae0
testl %eax, %eax
je 0x3a240
xorl %eax, %eax
addq $0x198, %rsp            # imm = 0x198
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl $0xf000, %ecx           # imm = 0xF000
andl 0x120(%rsp), %ecx
leal -0x1000(%rcx), %eax
cmpl $0x8000, %eax           # imm = 0x8000
jae 0x3a274
shrl $0xc, %eax
movl $0xab, %edx
btl %eax, %edx
jae 0x3a274
movl %eax, %eax
leaq 0x55c71(%rip), %rcx     # 0x8fee0
movl (%rcx,%rax,4), %eax
jmp 0x3a22e
cmpl $0xa000, %ecx           # imm = 0xA000
sete %dl
xorb $0x1, %bl
movl $0x6, %eax
testb %bl, %dl
jne 0x3a22e
movl $0x7, %eax
cmpl $0xc000, %ecx           # imm = 0xC000
je 0x3a22e
callq 0xa6b0
testl %eax, %eax
jne 0x3a32e
leaq 0x98(%rsp), %r14
movq %r14, -0x10(%r14)
leaq 0x52680(%rip), %rsi     # 0x8c936
leaq 0x5268c(%rip), %rdx     # 0x8c949
leaq 0x88(%rsp), %rdi
callq 0x2fdd8
leaq 0xa8(%rsp), %rdi
movl $0x51a, %esi            # imm = 0x51A
callq 0x2d60a
leaq 0xc8(%rsp), %rdi
leaq 0x88(%rsp), %rsi
leaq 0xa8(%rsp), %rdx
callq 0x2d562
leaq 0x508e5(%rip), %rsi     # 0x8abe5
leaq 0xc8(%rsp), %rdi
callq 0xaac0
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3a338
movups (%rcx), %xmm0
movups %xmm0, (%r15)
jmp 0x3a345
movl $0x1, %edi
callq 0xa6c0
movq %rdx, 0x8(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x18(%rsp)
movq 0x8(%rax), %rdx
movq %rdx, 0x10(%rsp)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0x78(%rsp), %r12
movq %r12, -0x10(%r12)
leaq 0x52a04(%rip), %rsi     # 0x8cd72
leaq 0x52a32(%rip), %rdx     # 0x8cda7
leaq 0x68(%rsp), %rdi
callq 0x2fdd8
leaq 0x525ad(%rip), %rsi     # 0x8c933
leaq 0x68(%rsp), %rdi
callq 0xaac0
leaq 0x38(%rsp), %r13
movq %r13, -0x10(%r13)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3a3b2
movups (%rcx), %xmm0
movups %xmm0, (%r13)
jmp 0x3a3bf
movq %rdx, 0x28(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x38(%rsp)
movq 0x8(%rax), %rsi
leaq 0x28(%rsp), %rdx
movq %rsi, 0x8(%rdx)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
leaq 0xe8(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x2d562
leaq 0x526c0(%rip), %rsi     # 0x8cab4
leaq 0xe8(%rsp), %rdi
callq 0xaac0
leaq 0x58(%rsp), %rbp
movq %rbp, -0x10(%rbp)
movq (%rax), %rdx
movq %rax, %rcx
addq $0x10, %rcx
cmpq %rcx, %rdx
jne 0x3a422
movups (%rcx), %xmm0
movups %xmm0, (%rbp)
jmp 0x3a42f
movq %rdx, 0x48(%rsp)
movq (%rcx), %rdx
movq %rdx, 0x58(%rsp)
movq 0x8(%rax), %rdx
leaq 0x48(%rsp), %rdi
movq %rdx, 0x8(%rdi)
movq %rcx, (%rax)
movq $0x0, 0x8(%rax)
movb $0x0, 0x10(%rax)
callq 0x3523b
movq %rax, %rbx
movq 0x48(%rsp), %rdi
cmpq %rbp, %rdi
je 0x3a46f
movq 0x58(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a46f
movq %rax, %rbx
leaq 0xf8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a495
movq 0xf8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a495
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x3a4b1
movq 0x38(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a4b1
movq %rax, %rbx
movq 0x68(%rsp), %rdi
cmpq %r12, %rdi
je 0x3a4cd
movq 0x78(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a4cd
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x3a4e9
movq 0x18(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a4e9
movq %rax, %rbx
leaq 0xd8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a50f
movq 0xd8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a50f
movq %rax, %rbx
leaq 0xb8(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x3a535
movq 0xb8(%rsp), %rsi
incq %rsi
callq 0xa5a0
jmp 0x3a535
movq %rax, %rbx
movq 0x88(%rsp), %rdi
cmpq %r14, %rdi
je 0x3a552
movq 0x98(%rsp), %rsi
incq %rsi
callq 0xa5a0
movq %rbx, %rdi
callq 0xaa10