LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blkdev.cpp
// Function: BlkDev::os_write(unsigned long, unsigned long, void const*, unsigned long)
int64_t
BlkDev::os_write(const uint64_t  lba_,
                 const uint64_t  blocks_,
                 const void     *buf_,
                 const uint64_t  buflen_)
{
  int64_t rv;
  uint64_t len;
  off_t offset;

  len    = ((buflen_ * _logical_block_size) / _logical_block_size);
  len    = std::min((blocks_ * _logical_block_size),len);
  offset = (lba_ * _logical_block_size);

  rv = ::pwrite(_fd,buf_,len,offset);
  if(rv == -1)
    return -errno;

  return (rv / _logical_block_size);
}

// Assembly:
pushq %rbx
movq %r8, %rax
movq %rdx, %r8
movq %rdi, %rbx
movq 0x8(%rdi), %r9
imulq %r9, %rax
xorl %edx, %edx
divq %r9
imulq %r9, %r8
cmpq %r8, %rax
cmovbq %rax, %r8
imulq %rsi, %r9
movl 0x8c(%rdi), %edi
movq %rcx, %rsi
movq %r8, %rdx
movq %r9, %rcx
callq 0x4130
cmpq $-0x1, %rax
je 0xac22
xorl %edx, %edx
divq 0x8(%rbx)
jmp 0xac2d
callq 0x4050
movslq (%rax), %rax
negq %rax
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blkdev.cpp
// Function: BlkDev::read(unsigned long, unsigned long, std::vector<char, std::allocator<char>>&)
int64_t
BlkDev::read(const uint64_t     lba_,
             const uint64_t     blocks_,
             std::vector<char> &buf_)
{
  switch(_rw_type)
    {
    case ATA:
      return ata_read(lba_,blocks_,&buf_[0],buf_.size());
    case OS:
      return os_read(lba_,blocks_,&buf_[0],buf_.size());
    }

  return -ENOTSUP;
}

// Assembly:
movl (%rdi), %eax
cmpl $0x1, %eax
je 0xaca9
testl %eax, %eax
jne 0xacbb
movq (%rcx), %rax
movq 0x8(%rcx), %r8
subq %rax, %r8
movq %rax, %rcx
jmp 0xac30
movq (%rcx), %rax
movq 0x8(%rcx), %r8
subq %rax, %r8
movq %rax, %rcx
jmp 0xab84
pushq $-0x5f
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blkdev.cpp
// Function: BlkDev::write(unsigned long, unsigned long, std::vector<char, std::allocator<char>> const&)
int64_t
BlkDev::write(const uint64_t           lba_,
              const uint64_t           blocks_,
              const std::vector<char> &buf_)
{
  switch(_rw_type)
    {
    case ATA:
      return ata_write(lba_,blocks_,&buf_[0],buf_.size());
    case OS:
      return os_write(lba_,blocks_,&buf_[0],buf_.size());
    }

  return -ENOTSUP;
}

// Assembly:
movl (%rdi), %eax
cmpl $0x1, %eax
je 0xacf5
testl %eax, %eax
jne 0xad07
movq (%rcx), %rax
movq 0x8(%rcx), %r8
subq %rax, %r8
movq %rax, %rcx
jmp 0xac52
movq (%rcx), %rax
movq 0x8(%rcx), %r8
subq %rax, %r8
movq %rax, %rcx
jmp 0xabda
pushq $-0x5f
popq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blkdev.cpp
// Function: BlkDev::sync()
int
BlkDev::sync(void)
{
  int rv;
  int error;

  error = 0;

  rv = ::fsync(_fd);
  if(rv == -1)
    error = -errno;

  rv = ::fdatasync(_fd);
  if(rv == -1)
    error = -errno;

  rv = IOCtl::block_flush(_fd);
  if(rv < 0)
    error = rv;

  return error;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x8c(%rdi), %edi
callq 0x4410
xorl %ebp, %ebp
cmpl $-0x1, %eax
jne 0xad39
callq 0x4050
xorl %ebp, %ebp
subl (%rax), %ebp
movl 0x8c(%rbx), %edi
callq 0x4240
cmpl $-0x1, %eax
jne 0xad52
callq 0x4050
xorl %ebp, %ebp
subl (%rax), %ebp
movl 0x8c(%rbx), %edi
callq 0xc4c5
testl %eax, %eax
cmovnsl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blocktofilemapper.cpp
// Function: BlockToFileMapper::scan(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int
BlockToFileMapper::scan(const std::string &basepath)
{
  int rv;
  int64_t blocksize;

  blocksize = File::logical_block_size(basepath);
  if(blocksize < 0)
    return blocksize;

  rv = ::scan(basepath,blocksize,_blockmap);

  ::compress(_blockmap);

  return rv;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq %rsi, %rdi
callq 0xbc08
testq %rax, %rax
js 0xae58
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %rdx
callq 0xae67
movl %eax, %ebp
movq 0x18(%rbx), %r14
leaq 0x8(%rbx), %r13
cmpq %r13, %r14
je 0xae54
movq %r14, %rdi
callq 0x4340
movq %rax, %r12
leaq 0x30(%r14), %r15
cmpq %r13, %r12
je 0xae47
leaq 0x30(%r12), %rsi
movq %r15, %rdi
callq 0x5c9e
testb %al, %al
je 0xae47
movq 0x28(%r14), %rax
movq 0x20(%r14), %rcx
addq %rax, %rcx
cmpq 0x20(%r12), %rcx
jne 0xae47
addq 0x28(%r12), %rax
movq %rax, 0x28(%r14)
movq %rbx, %rdi
movq %r12, %rsi
callq 0xb398
movq %r14, %rdi
callq 0x4340
movq %rax, %r12
jmp 0xadfe
movq %r14, %rdi
callq 0x4340
movq %rax, %r14
jmp 0xadea
movzbl %bpl, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/blocktofilemapper.cpp
// Function: BlockToFileMapper::find[abi:cxx11](unsigned long) const
std::pair<bool,std::string>
BlockToFileMapper::find(const uint64_t block) const
{
  BlockMap::const_iterator iter;


  iter = _blockmap.upper_bound(block);
  if(iter != _blockmap.end())
    --iter;

  if(iter == _blockmap.end())
    return std::make_pair(false,std::string());

  if(block < (iter->first + iter->second.first))
    return std::make_pair(true,iter->second.second);

  return std::make_pair(false,std::string());
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rsi
movq %rdx, (%rsi)
movq %r14, %rdi
callq 0xb3e6
addq $0x8, %r14
cmpq %r14, %rax
je 0xb11a
movq %rax, %rdi
callq 0x42c0
cmpq %r14, %rax
je 0xb145
movq 0x28(%rax), %rcx
addq 0x20(%rax), %rcx
cmpq %rcx, (%rsp)
jae 0xb145
addq $0x30, %rax
movb $0x1, (%rbx)
movq %rbx, %rdi
addq $0x8, %rdi
movq %rax, %rsi
callq 0x45b0
jmp 0xb193
leaq 0x18(%rsp), %rax
xorl %ecx, %ecx
movb %cl, (%rax)
movb %cl, (%rbx)
leaq 0x18(%rbx), %rdx
movq %rdx, 0x8(%rbx)
movb (%rax), %dl
movb %dl, 0x18(%rbx)
movq 0x1(%rax), %rdx
movq %rdx, 0x19(%rbx)
movl 0x9(%rax), %edx
movl %edx, 0x21(%rbx)
movzwl 0xd(%rax), %edx
movw %dx, 0x25(%rbx)
movb 0xf(%rax), %dl
movb %dl, 0x27(%rbx)
andq $0x0, 0x10(%rbx)
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %cl, (%rax)
leaq 0x8(%rsp), %rdi
callq 0x4200
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/captcha.cpp
// Function: captcha::calculate[abi:cxx11](BlkDev const&)
std::string
  calculate(const BlkDev &blkdev)
  {
    std::stringstream ss;

    if(blkdev.has_identity())
      ss << blkdev.identity().serial_number;

    if(ss.gcount() == 0)
      ss << blkdev.size_in_bytes();

    return ss.str();
  }

// Assembly:
pushq %r14
pushq %rbx
subq $0x188, %rsp            # imm = 0x188
movq %rsi, %r14
movq %rdi, %rbx
movq %rsp, %rdi
callq 0x4350
cmpb $0x1, 0x88(%r14)
jne 0xb448
leaq 0x10(%rsp), %rdi
leaq 0x40(%r14), %rsi
callq 0x44b0
cmpq $0x0, 0x8(%rsp)
jne 0xb45e
leaq 0x10(%rsp), %rdi
movq 0x18(%r14), %rsi
callq 0x4320
leaq 0x18(%rsp), %rsi
movq %rbx, %rdi
callq 0x4680
movq %rsp, %rdi
callq 0x43a0
movq %rbx, %rax
addq $0x188, %rsp            # imm = 0x188
popq %rbx
popq %r14
retq
movq %rax, %rbx
movq %rsp, %rdi
callq 0x43a0
movq %rbx, %rdi
callq 0x4730
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/errors.cpp
// Function: AppError::to_string[abi:cxx11]() const
std::string
AppError::to_string(void) const
{
  std::string rv;

  rv = "ERROR - ";
  rv += type_to_string(type);
  rv += ": ";
  rv += extra;
  rv += " [";
  rv += Error::to_string(error);
  rv += ']';

  return rv;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
leaq 0x746e(%rip), %rsi      # 0x1295c
callq 0x4790
movl (%r14), %eax
cmpq $0xa, %rax
ja 0xb62a
leaq 0x7429(%rip), %rcx      # 0x12930
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0x7453(%rip), %rsi      # 0x1296a
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x7479(%rip), %rsi      # 0x129ab
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x74e2(%rip), %rsi      # 0x12a2f
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x741c(%rip), %rsi      # 0x12984
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x7412(%rip), %rsi      # 0x12995
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x745d(%rip), %rsi      # 0x129fb
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x73b9(%rip), %rsi      # 0x12972
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x73f1(%rip), %rsi      # 0x129c2
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x73f3(%rip), %rsi      # 0x129dc
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x7444(%rip), %rsi      # 0x12a45
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x7402(%rip), %rsi      # 0x12a1b
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
jmp 0xb640
leaq 0x741c(%rip), %rsi      # 0x12a4d
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x5cd4
leaq 0x8(%rsp), %rsi
movq %rbx, %rdi
callq 0x47b0
leaq 0x8(%rsp), %rdi
callq 0x4200
leaq 0x71d5(%rip), %rsi      # 0x12833
movq %rbx, %rdi
callq 0x4780
leaq 0x8(%r14), %rsi
movq %rbx, %rdi
callq 0x47b0
leaq 0x6c01(%rip), %rsi      # 0x1227a
movq %rbx, %rdi
callq 0x4780
movl 0x4(%r14), %edi
callq 0xb494
movq %rbx, %rdi
movq %rax, %rsi
callq 0x4780
pushq $0x5d
popq %rsi
movq %rbx, %rdi
callq 0x4400
movq %rbx, %rax
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
leaq 0x8(%rsp), %rdi
callq 0x4200
jmp 0xb6bf
jmp 0xb6bc
movq %rax, %r14
movq %rbx, %rdi
callq 0x4200
movq %r14, %rdi
callq 0x4730
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/fiemap.cpp
// Function: FIEMap::extent_map_count(int)
int
  extent_map_count(const int fd)
  {
    int rv;
    struct fiemap fm = {0};

    fm.fm_length = FIEMAP_MAX_OFFSET;

    rv = ::ioctl(fd,FS_IOC_FIEMAP,&fm);
    if(rv == -1)
      return -1;

    return fm.fm_mapped_extents;
  }

// Assembly:
subq $0x28, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
orq $-0x1, 0x8(%rdx)
movl $0xc020660b, %esi       # imm = 0xC020660B
xorl %eax, %eax
callq 0x45e0
cmpl $-0x1, %eax
je 0xbba3
movl 0x14(%rsp), %eax
addq $0x28, %rsp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/fiemap.cpp
// Function: FIEMap::extent_map(int)
struct fiemap *
  extent_map(const int fd)
  {
    int rv;
    int extent_count;
    int extent_size;
    struct fiemap *fm;

    extent_count = FIEMap::extent_map_count(fd);
    if(extent_count == -1)
      return NULL;

    extent_size = (sizeof(struct fiemap_extent) * extent_count);

    fm = (struct fiemap*)calloc(1,(sizeof(struct fiemap) + extent_size));
    if(fm == NULL)
      return NULL;

    fm->fm_length       = FIEMAP_MAX_OFFSET;
    fm->fm_extent_count = extent_count;

    rv = ::ioctl(fd,FS_IOC_FIEMAP,fm);
    if(rv == -1)
      {
        ::free(fm);
        return NULL;
      }

    return fm;
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebp
callq 0xbb78
cmpl $-0x1, %eax
je 0xbbfc
movl %eax, %r14d
imull $0x38, %eax, %eax
movslq %eax, %rsi
addq $0x20, %rsi
pushq $0x1
popq %rdi
callq 0x4310
testq %rax, %rax
je 0xbbfc
movq %rax, %rbx
orq $-0x1, 0x8(%rax)
movl %r14d, 0x18(%rax)
movl $0xc020660b, %esi       # imm = 0xC020660B
movl %ebp, %edi
movq %rax, %rdx
xorl %eax, %eax
callq 0x45e0
cmpl $-0x1, %eax
jne 0xbbfe
movq %rbx, %rdi
callq 0x4530
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/file.cpp
// Function: File::logical_block_size(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
int64_t
  logical_block_size(const std::string &filepath)
  {
    int fd;
    int64_t logical_block_size;
    std::string devpath;

    devpath = FileToBlkDev::find(filepath);
    if(devpath.empty())
      return -ENOENT;

    fd = ::open(devpath.c_str(),O_RDONLY|O_NONBLOCK);
    if(fd == -1)
      return -errno;

    logical_block_size = IOCtl::logical_block_size(fd);

    ::close(fd);

    return logical_block_size;
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0x40, %rsp
movq %rdi, %rsi
leaq 0x10(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x20(%rsp), %rdi
callq 0xbeec
movq %rsp, %rbx
leaq 0x20(%rsp), %r14
movq %rbx, %rdi
movq %r14, %rsi
callq 0x4550
movq %r14, %rdi
callq 0x4200
cmpq $0x0, 0x8(%rbx)
je 0xbc7c
movq (%rsp), %rdi
movl $0x800, %esi            # imm = 0x800
xorl %eax, %eax
callq 0x4380
movl %eax, %ebx
cmpl $-0x1, %eax
je 0xbc81
movl %ebx, %edi
callq 0xc3ac
movl %eax, %ebp
movl %ebx, %edi
callq 0x47c0
movslq %ebp, %rbx
jmp 0xbc8c
pushq $-0x2
popq %rbx
jmp 0xbc8c
callq 0x4050
movslq (%rax), %rbx
negq %rbx
movq %rsp, %rdi
callq 0x4200
movq %rbx, %rax
addq $0x40, %rsp
popq %rbx
popq %r14
popq %rbp
retq
jmp 0xbca2
movq %rax, %rbx
movq %rsp, %rdi
callq 0x4200
movq %rbx, %rdi
callq 0x4730
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/file.cpp
// Function: File::blocks(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&, std::vector<File::Block, std::allocator<File::Block>>&)
int
  blocks(const std::string &filepath,
         BlockVector       &blockvector)
  {
    int fd;
    int rv;
    int64_t logical_block_size;

    logical_block_size = File::logical_block_size(filepath);
    if(logical_block_size < 0)
      return logical_block_size;

    fd = ::open(filepath.c_str(),O_RDONLY);
    if(fd == -1)
      return -errno;

    rv = ::blocks(fd,logical_block_size,blockvector);

    ::close(fd);

    return rv;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %r15
callq 0xbc08
movq %rax, %rbx
testq %rax, %rax
js 0xbd72
movq (%r15), %rdi
xorl %ebp, %ebp
xorl %esi, %esi
xorl %eax, %eax
callq 0x4380
cmpl $-0x1, %eax
je 0xbd5c
movl %eax, %r12d
movl %eax, %edi
callq 0xbba8
testq %rax, %rax
je 0xbd67
movq %rax, %r15
movl %r12d, 0x4(%rsp)
movq %rax, %r13
addq $0x30, %r13
xorl %ebp, %ebp
leaq 0x8(%rsp), %r12
movl 0x14(%r15), %eax
cmpq %rax, %rbp
jae 0xbd4b
movq -0x8(%r13), %rax
xorl %edx, %edx
divq %rbx
movq %rax, 0x8(%rsp)
movq (%r13), %rax
xorl %edx, %edx
divq %rbx
movq %rax, 0x10(%rsp)
movq %r14, %rdi
movq %r12, %rsi
callq 0xbd84
incq %rbp
addq $0x38, %r13
jmp 0xbd12
movq %r15, %rdi
callq 0x4530
xorl %ebx, %ebx
movl 0x4(%rsp), %r12d
jmp 0xbd6a
callq 0x4050
subl (%rax), %ebp
movl %ebp, %ebx
jmp 0xbd72
pushq $-0xc
popq %rbx
movl %r12d, %edi
callq 0x47c0
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/info.cpp
// Function: InfoPrinter::init(unsigned long, unsigned long, std::vector<unsigned long, std::allocator<unsigned long>>*)
void
InfoPrinter::init(const size_t  start_block_,
                  const size_t  end_block_,
                  U64Vec       *badblocks_)
{
  std::cout << "\r\x1B[2K" << '\x1B' << '7';

  _start_block = start_block_;
  _end_block   = end_block_;
  _badblocks   = badblocks_;
  _start_time  = Time::get_monotonic();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq 0x14f11(%rip), %rdi     # 0x20fb8
leaq 0x69f2(%rip), %rsi      # 0x12aa0
callq 0x44b0
pushq $0x1b
popq %rsi
movq %rax, %rdi
callq 0x4520
pushq $0x37
popq %rsi
movq %rax, %rdi
callq 0x4520
movq %r15, 0x8(%r12)
movq %r14, 0x10(%r12)
movq %rbx, 0x18(%r12)
callq 0x117ac
movsd %xmm0, (%r12)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/ioctl.cpp
// Function: IOCtl::logical_block_size(int)
int
  logical_block_size(const int fd)
  {
    int rv;
    int size;

    rv = ::ioctl(fd, BLKSSZGET, &size);
    if(rv == -1)
      return -errno;

    return size;
  }

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
movl $0x1268, %esi           # imm = 0x1268
xorl %eax, %eax
callq 0x45e0
cmpl $-0x1, %eax
je 0xc3cf
movl 0xc(%rsp), %ebx
jmp 0xc3d6
callq 0x4050
subl (%rax), %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/ioctl.cpp
// Function: IOCtl::physical_block_size(int)
int
  physical_block_size(const int fd)
  {
    int rv;
    int size;

    rv = ::ioctl(fd,BLKBSZGET,&size);
    if(rv == -1)
      return -errno;

    return size;
  }

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorl %ebx, %ebx
leaq 0xc(%rsp), %rdx
movl $0x80081270, %esi       # imm = 0x80081270
xorl %eax, %eax
callq 0x45e0
cmpl $-0x1, %eax
je 0xc401
movl 0xc(%rsp), %ebx
jmp 0xc408
callq 0x4050
subl (%rax), %ebx
movl %ebx, %eax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/ioctl.cpp
// Function: IOCtl::size_in_bytes(int)
int64_t
  size_in_bytes(const int fd)
  {
    int rv;

#ifdef BLKGETSIZE64
    {
      int64_t size;

      rv = ::ioctl(fd,BLKGETSIZE64,&size);
      if(rv != -1)
        return size;
    }
#endif

    {
      unsigned long size;

      rv = ::ioctl(fd,BLKGETSIZE,&size);
      if(rv != 0)
        return ((int64_t)size * 512);
    }

    return -errno;
  }

// Assembly:
pushq %rbx
subq $0x10, %rsp
movl %edi, %ebx
leaq 0x8(%rsp), %rdx
movl $0x80081272, %esi       # imm = 0x80081272
xorl %eax, %eax
callq 0x45e0
cmpl $-0x1, %eax
je 0xc434
movq 0x8(%rsp), %rax
jmp 0xc461
leaq 0x8(%rsp), %rdx
movl $0x1260, %esi           # imm = 0x1260
movl %ebx, %edi
xorl %eax, %eax
callq 0x45e0
testl %eax, %eax
je 0xc456
movq 0x8(%rsp), %rax
shlq $0x9, %rax
jmp 0xc461
callq 0x4050
movslq (%rax), %rax
negq %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/ioctl.cpp
// Function: IOCtl::logical_block_count(int)
int64_t
  logical_block_count(const int fd)
  {
    int logical_block_size;
    int64_t size_in_bytes;

    logical_block_size = IOCtl::logical_block_size(fd);
    if(logical_block_size < 0)
      return logical_block_size;

    size_in_bytes = IOCtl::size_in_bytes(fd);
    if(size_in_bytes < 0)
      return size_in_bytes;

    return (size_in_bytes / logical_block_size);
  }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
callq 0xc3ac
movl %eax, %ebx
testl %eax, %eax
js 0xc48c
movl %ebp, %edi
callq 0xc410
testq %rax, %rax
js 0xc48f
movl %ebx, %ecx
xorl %edx, %edx
divq %rcx
jmp 0xc48f
movslq %ebx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/ioctl.cpp
// Function: IOCtl::physical_block_count(int)
int64_t
  physical_block_count(const int fd)
  {
    int physical_block_size;
    int64_t size_in_bytes;

    physical_block_size = IOCtl::physical_block_size(fd);
    if(physical_block_size < 0)
      return physical_block_size;

    size_in_bytes = IOCtl::size_in_bytes(fd);
    if(size_in_bytes < 0)
      return size_in_bytes;

    return (size_in_bytes / physical_block_size);
  }

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl %edi, %ebp
callq 0xc3de
movl %eax, %ebx
testl %eax, %eax
js 0xc4bb
movl %ebp, %edi
callq 0xc410
testq %rax, %rax
js 0xc4be
movl %ebx, %ecx
xorl %edx, %edx
divq %rcx
jmp 0xc4be
movslq %ebx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/num.cpp
// Function: num::humanize[abi:cxx11](unsigned long, bool)
std::string
  humanize(const uint64_t bytes,
           const bool     si)
  {
    int exp  = 0;
    int unit = (si ? 1000 : 1024);
    std::stringstream ss;

    exp = ((bytes == 0) ?
           0 :
           compute_exp(bytes,unit));

    ss.precision(2);
    ss << std::fixed
       << (bytes / std::pow(unit,exp))
       << suffix[exp][si];

    return ss.str();
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x1a8, %rsp            # imm = 0x1A8
movl %edx, %ebp
movq %rsi, %r14
movq %rdi, %rbx
testl %edx, %edx
movl $0x3e8, %eax            # imm = 0x3E8
movl $0x400, %r15d           # imm = 0x400
cmovnel %eax, %r15d
leaq 0x20(%rsp), %rdi
callq 0x4350
movq %r14, %xmm1
punpckldq 0x6523(%rip), %xmm1 # xmm1 = xmm1[0],mem[0],xmm1[1],mem[1]
subpd 0x652b(%rip), %xmm1     # 0x12a80
movapd %xmm1, %xmm0
unpckhpd %xmm1, %xmm0            # xmm0 = xmm0[1],xmm1[1]
addsd %xmm1, %xmm0
testq %r14, %r14
movapd %xmm0, 0x10(%rsp)
je 0xc5a6
callq 0x43e0
movsd %xmm0, 0x8(%rsp)
cvtsi2sd %r15d, %xmm0
movsd %xmm0, (%rsp)
callq 0x43e0
movsd (%rsp), %xmm2
movsd 0x8(%rsp), %xmm1
divsd %xmm0, %xmm1
cvttsd2si %xmm1, %eax
cmpl $0x7, %eax
pushq $0x7
popq %r15
cmovll %eax, %r15d
jmp 0xc5ae
cvtsi2sd %r15d, %xmm2
xorl %r15d, %r15d
leaq 0x30(%rsp), %r14
movq -0x10(%r14), %rax
movq -0x18(%rax), %rax
movq $0x2, 0x28(%rsp,%rax)
movq (%r14), %rax
movq -0x18(%rax), %rax
movl $0xfffffefb, %ecx       # imm = 0xFFFFFEFB
andl 0x48(%rsp,%rax), %ecx
orl $0x4, %ecx
movl %ecx, 0x48(%rsp,%rax)
cvtsi2sd %r15d, %xmm1
movapd %xmm2, %xmm0
callq 0x4720
movapd 0x10(%rsp), %xmm1
divsd %xmm0, %xmm1
movq %r14, %rdi
movapd %xmm1, %xmm0
callq 0x46b0
movslq %r15d, %rcx
shlq $0x4, %rcx
leaq 0x14563(%rip), %rdx     # 0x20b70
addq %rcx, %rdx
movzbl %bpl, %ecx
movq (%rdx,%rcx,8), %rsi
movq %rax, %rdi
callq 0x44b0
leaq 0x38(%rsp), %rsi
movq %rbx, %rdi
callq 0x4680
leaq 0x20(%rsp), %rdi
callq 0x43a0
movq %rbx, %rax
addq $0x1a8, %rsp            # imm = 0x1A8
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rdi
callq 0x43a0
movq %rbx, %rdi
callq 0x4730
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/options.cpp
// Function: Options::validate() const
AppError
Options::validate(void) const
{
  switch(instruction)
    {
    case Options::_INVALID:
      return AppError::argument_invalid("instruction is invalid");
    case Options::FILETHRASH:
      break;
    case Options::FSTHRASH:
      break;
    case Options::BURNIN:
      if(captcha.empty())
        return AppError::argument_required("captcha");
    case Options::SCAN:
      break;
    case Options::FIX:
    case Options::FIX_FILE:
    case Options::WRITE_PSEUDO_UNCORRECTABLE_WL:
    case Options::WRITE_PSEUDO_UNCORRECTABLE_WOL:
    case Options::WRITE_FLAGGED_UNCORRECTABLE_WL:
    case Options::WRITE_FLAGGED_UNCORRECTABLE_WOL:
      if(captcha.empty())
        return AppError::argument_required("captcha");
      break;
    case Options::FIND_FILES:
      break;
    case Options::SECURITY_ERASE:
    case Options::ENHANCED_SECURITY_ERASE:
      if(captcha.empty())
        return AppError::argument_required("captcha");
      break;
    case Options::DUMP_FILES:
    case Options::INFO:
    case Options::CAPTCHA:
      break;
    default:
      break;
    }

  if(start_block >= end_block)
    return AppError::argument_invalid("start block >= end block");

  return AppError::success();
}

// Assembly:
pushq %rbx
subq $0x30, %rsp
movq %rdi, %rbx
movl (%rsi), %eax
incl %eax
cmpl $0x11, %eax
ja 0xce93
leaq 0x5d62(%rip), %rcx      # 0x12b58
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
cmpq $0x0, 0xa0(%rsi)
jne 0xce93
leaq 0x5e6e(%rip), %rsi      # 0x12c82
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5cd4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb71e
jmp 0xceca
cmpq $0x0, 0xa0(%rsi)
jne 0xce93
leaq 0x5e3c(%rip), %rsi      # 0x12c82
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5cd4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb71e
jmp 0xceca
leaq 0x5f5c(%rip), %rsi      # 0x12dc7
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5cd4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb778
jmp 0xceca
cmpq $0x0, 0xa0(%rsi)
je 0xcedd
movq 0x38(%rsi), %rax
cmpq 0x40(%rsi), %rax
jae 0xcea7
movq %rbx, %rdi
callq 0xb6d0
jmp 0xced4
leaq 0x5f30(%rip), %rsi      # 0x12dde
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5cd4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb778
leaq 0x10(%rsp), %rdi
callq 0x4200
movq %rbx, %rax
addq $0x30, %rsp
popq %rbx
retq
leaq 0x5d9e(%rip), %rsi      # 0x12c82
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x5cd4
leaq 0x10(%rsp), %rsi
movq %rbx, %rdi
callq 0xb71e
jmp 0xceca
jmp 0xcf12
jmp 0xcf21
jmp 0xcf12
jmp 0xcf21
jmp 0xcf12
jmp 0xcf21
jmp 0xcf12
jmp 0xcf21
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x4200
jmp 0xcf24
movq %rax, %rbx
movq %rbx, %rdi
callq 0x4730
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/rnd.cpp
// Function: rnd::str[abi:cxx11](int)
std::string
  str(int len_)
  {
    std::string s;

    for(int i = 0; i < len_; i++)
      s.push_back('a' + (std::rand() % 26));

    return s;
  }

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movb $0x0, 0x10(%rdi)
xorl %ebp, %ebp
testl %esi, %esi
cmovgl %esi, %ebp
pushq $0x1a
popq %r14
subl $0x1, %ebp
jb 0xcf7c
callq 0x4100
cltd
idivl %r14d
addb $0x61, %dl
movsbl %dl, %esi
movq %rbx, %rdi
callq 0x4400
jmp 0xcf5e
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x4200
movq %r14, %rdi
callq 0x4730
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::tf_init(sg::ata_tf*, unsigned char, unsigned long, unsigned int)
void
  tf_init(struct ata_tf *tf,
          uint8_t        ata_op,
          uint64_t       lba,
          unsigned int   nsect)
  {
    memset(tf,0,sizeof(struct ata_tf));

    tf->command   = ata_op;
    tf->dev       = ATA_USING_LBA | 0xA0;
    tf->lob.lbal  = lba;
    tf->lob.lbam  = lba >>  8;
    tf->lob.lbah  = lba >> 16;
    tf->lob.nsect = nsect;

    if(needs_lba48(ata_op,lba,nsect))
      {
        tf->is_lba48  = 1;
        tf->hob.feat  = 0;
        tf->hob.nsect = nsect >>  8;
        tf->hob.lbal  =   lba >> 24;
        tf->hob.lbam  =   lba >> 32;
        tf->hob.lbah  =   lba >> 40;
      }
    else
      {
        tf->dev |= (lba >> 24) & 0x0F;
      }
  }

// Assembly:
andq $0x0, 0x7(%rdi)
andq $0x0, 0x2(%rdi)
movb %sil, 0x1(%rdi)
movb $-0x20, (%rdi)
movb %dl, 0x7(%rdi)
movb %dh, 0x8(%rdi)
movl %edx, %eax
shrl $0x10, %eax
movb %al, 0x9(%rdi)
movb %cl, 0x6(%rdi)
leal -0x6(%rsi), %eax
cmpl $0x3f, %eax
ja 0x10c03
movabsq $-0x6ffd3ffd3fffffff, %r8 # imm = 0x9002C002C0000001
btq %rax, %r8
jae 0x10c03
movb $0x1, 0x4(%rdi)
movb %ch, 0xb(%rdi)
movl %edx, %eax
shrl $0x18, %eax
movb %al, 0xc(%rdi)
movq %rdx, %rax
shrq $0x20, %rax
movb %al, 0xd(%rdi)
shrq $0x28, %rdx
movb %dl, 0xe(%rdi)
retq
leal -0xf3(%rsi), %eax
cmpl $0x2, %eax
jb 0x10c53
cmpl $0x80, %esi
je 0x10c53
cmpl $0xb0, %esi
je 0x10c53
cmpl $0xea, %esi
je 0x10be2
cmpq $0xfffffff, %rdx        # imm = 0xFFFFFFF
setae %al
cmpl $0x100, %ecx            # imm = 0x100
setae %sil
orb %al, %sil
jne 0x10be2
movl %ecx, %eax
addq %rdx, %rax
movq $-0x10000000, %rsi      # imm = 0xF0000000
addq %rsi, %rax
cmpq %rsi, %rax
jbe 0x10be2
shrl $0x18, %edx
andb $0xf, %dl
orb $-0x20, %dl
movb %dl, (%rdi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::identify(int, sg::identity&)
int
  identify(const int     fd,
           sg::identity &ident)
  {
    int rv;
    int timeout;
    char buf[512];
    int buflen = sizeof(buf);
    struct ata_tf tf;

    tf_init(&tf,ATA_OP_IDENTIFY,0,1);

    timeout = 60000;
    rv = exec(fd,SG_READ,SG_PIO,&tf,buf,buflen,timeout);
    if(rv == 0)
      buf_to_identity(buf,ident);

    return rv;
  }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %rbx
leaq 0x11(%rsp), %rcx
andq $0x0, 0x7(%rcx)
andq $0x0, 0x2(%rcx)
xorl %eax, %eax
movb %al, 0x7(%rcx)
movb %al, 0x9(%rcx)
movb $0x1, 0x6(%rcx)
movw $0xece0, (%rcx)         # imm = 0xECE0
movl $0xea60, (%rsp)         # imm = 0xEA60
leaq 0x20(%rsp), %r8
xorl %esi, %esi
xorl %edx, %edx
movl $0x200, %r9d            # imm = 0x200
callq 0x10c5f
movl %eax, %ebp
testl %eax, %eax
jne 0x112aa
leaq 0x20(%rsp), %rdi
movq %rbx, %rsi
callq 0x10f7e
movl %ebp, %eax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::read_block(int, unsigned long, unsigned long, void*, unsigned long, int)
int
  read_block(const int       fd_,
             const uint64_t  lba_,
             const uint64_t  blocks_,
             void           *buf_,
             const size_t    buflen_,
             const int       timeout_)
  {
    int blocks;
    int instruction;
    struct ata_tf tf;

    blocks = blocks_;
    if(blocks >= 65536)
      blocks = 0;
    instruction = ATA_OP_READ_PIO_EXT;
    tf_init(&tf,instruction,lba_,blocks);

    return exec(fd_,SG_READ,SG_PIO,&tf,buf_,buflen_,timeout_);
  }

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %r8, %rax
movq %rcx, %r8
xorl %ecx, %ecx
cmpl $0x10000, %edx          # imm = 0x10000
cmovgel %ecx, %edx
leaq 0x11(%rsp), %rcx
andq $0x0, 0x2(%rcx)
movq %rsi, %rbx
movb $0x0, 0xa(%rcx)
movw $0x24e0, (%rcx)         # imm = 0x24E0
movb %bl, 0x7(%rcx)
movb %bh, 0x19(%rsp)
shrl $0x10, %esi
movb %sil, 0x9(%rcx)
movb %dl, 0x6(%rcx)
movb $0x1, 0x4(%rcx)
movb %dh, 0x1c(%rsp)
movl %ebx, %edx
shrl $0x18, %edx
movb %dl, 0xc(%rcx)
movq %rbx, %rdx
shrq $0x20, %rdx
movb %dl, 0xd(%rcx)
shrq $0x28, %rbx
movb %bl, 0xe(%rcx)
movl %r9d, (%rsp)
xorl %esi, %esi
xorl %edx, %edx
movl %eax, %r9d
callq 0x10c5f
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::write_block(int, unsigned long, unsigned long, void const*, unsigned long, int)
int
  write_block(const int       fd_,
              const uint64_t  lba_,
              const uint64_t  blocks_,
              const void     *buf_,
              const size_t    buflen_,
              const int       timeout_)
  {
    int blocks;
    int instruction;
    struct ata_tf tf;

    blocks = blocks_;
    if(blocks >= 65536)
      blocks = 0;
    instruction = ATA_OP_WRITE_PIO_EXT;
    tf_init(&tf,instruction,lba_,blocks);

    return exec(fd_,SG_WRITE,SG_PIO,&tf,(void*)buf_,buflen_,timeout_);
  }

// Assembly:
pushq %rbx
subq $0x20, %rsp
movq %r8, %rax
movq %rcx, %r8
xorl %ecx, %ecx
cmpl $0x10000, %edx          # imm = 0x10000
cmovgel %ecx, %edx
leaq 0x11(%rsp), %rcx
andq $0x0, 0x2(%rcx)
movq %rsi, %rbx
movb $0x0, 0xa(%rcx)
movw $0x34e0, (%rcx)         # imm = 0x34E0
movb %bl, 0x7(%rcx)
movb %bh, 0x19(%rsp)
shrl $0x10, %esi
movb %sil, 0x9(%rcx)
movb %dl, 0x6(%rcx)
movb $0x1, 0x4(%rcx)
movb %dh, 0x1c(%rsp)
movl %ebx, %edx
shrl $0x18, %edx
movb %dl, 0xc(%rcx)
movq %rbx, %rdx
shrq $0x20, %rdx
movb %dl, 0xd(%rcx)
shrq $0x28, %rbx
movb %bl, 0xe(%rcx)
movl %r9d, (%rsp)
pushq $0x1
popq %rsi
xorl %edx, %edx
movl %eax, %r9d
callq 0x10c5f
addq $0x20, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::flush_write_cache(int, int)
int
  flush_write_cache(const int fd,
                    const int timeout)
  {
    int rv;
    struct ata_tf tf;

    tf_init(&tf,ATA_OP_FLUSHCACHE_EXT,0,0);

    rv = exec(fd,SG_READ,SG_PIO,&tf,NULL,0,timeout);
    if(rv < 0)
      {
        tf_init(&tf,ATA_OP_FLUSHCACHE,0,0);

        rv = exec(fd,SG_READ,SG_PIO,&tf,NULL,0,timeout);
      }

    return rv;
  }

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebp
movl %edi, %ebx
leaq 0x9(%rsp), %rcx
andq $0x0, 0x2(%rcx)
movb $0x0, 0xa(%rcx)
movw $0xeae0, (%rcx)         # imm = 0xEAE0
andl $0x0, 0x6(%rcx)
movb $0x1, 0x4(%rcx)
andl $0x0, 0xb(%rcx)
movl %esi, (%rsp)
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x10c5f
testl %eax, %eax
jns 0x11416
leaq 0xb(%rsp), %rax
movb $0x0, 0x8(%rax)
andq $0x0, (%rax)
movw $0xe7e0, -0x2(%rax)     # imm = 0xE7E0
andl $0x0, 0x4(%rax)
movb $0x1, 0x2(%rax)
andl $0x0, 0x9(%rax)
movl %ebp, (%rsp)
leaq 0x9(%rsp), %rcx
movl %ebx, %edi
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x10c5f
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::write_uncorrectable(int, unsigned long, unsigned char, int)
int
  write_uncorrectable(const int      fd_,
                      const uint64_t lba_,
                      const uint8_t  type_,
                      const int      timeout_)
  {
    int rv;
    struct ata_tf tf;

    tf_init(&tf,ATA_OP_WRITE_UNC_EXT,lba_,1);
    tf.lob.feat = type_;
    tf.is_lba48 = 1;

    rv = exec(fd_,SG_READ,SG_PIO,&tf,NULL,0,timeout_);
    if(rv < 0)
      {
        char buf[520];

        tf_init(&tf,ATA_OP_WRITE_LONG_ONCE,lba_,1);
        memset(buf,0xA5,sizeof(buf));
        rv = exec(fd_,SG_WRITE,SG_PIO,&tf,buf,sizeof(buf),timeout_);
      }

    return rv;
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movl %ecx, %r14d
leaq 0x11(%rsp), %rcx
andq $0x0, 0x2(%rcx)
movq %rsi, %rbx
andw $0x0, 0xa(%rcx)
movl %edi, %ebp
movw $0x45e0, (%rcx)         # imm = 0x45E0
movb %bl, 0x7(%rcx)
movb %bh, 0x19(%rsp)
movl %ebx, %eax
shrl $0x10, %eax
movb %al, 0x9(%rcx)
movb $0x1, %al
movb %al, 0x6(%rcx)
shrl $0x18, %esi
movb %sil, 0xc(%rcx)
movq %rbx, %rsi
shrq $0x20, %rsi
movb %sil, 0xd(%rcx)
movq %rbx, %rsi
shrq $0x28, %rsi
movb %sil, 0xe(%rcx)
movb %dl, 0x5(%rcx)
movb %al, 0x4(%rcx)
movl %r14d, (%rsp)
xorl %esi, %esi
xorl %edx, %edx
xorl %r8d, %r8d
xorl %r9d, %r9d
callq 0x10c5f
testl %eax, %eax
jns 0x114e3
leaq 0x11(%rsp), %r15
pushq $0x33
popq %rsi
pushq $0x1
popq %r12
movq %r15, %rdi
movq %rbx, %rdx
movl %r12d, %ecx
callq 0x10ba8
leaq 0x20(%rsp), %rbx
movl $0x208, %edx            # imm = 0x208
movq %rbx, %rdi
movl $0xa5, %esi
callq 0x4290
movl %r14d, (%rsp)
movl %ebp, %edi
movl %r12d, %esi
xorl %edx, %edx
movq %r15, %rcx
movq %rbx, %r8
movl $0x208, %r9d            # imm = 0x208
callq 0x10c5f
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::security_set_password(int, int, char const*, int)
int
  security_set_password(const int  fd_,
                        const int  identifier_,
                        const char password_[32],
                        const int  timeout_)
  {
    uint8_t data[512];
    struct ata_tf tf;

    ::memset(data,0,512);
    ::memcpy(&data[2],password_,32);
    switch(identifier_)
      {
      case SG_IDENTIFIER_USER:
        data[0] = 0x00;
        break;
      case SG_IDENTIFIER_MASTER:
        data[0] = 0x01;
      default:
        return -EINVAL;
      }

    tf_init(&tf,ATA_OP_SECURITY_SET_PASSWORD,0,0);

    return exec(fd_,SG_WRITE,SG_PIO,&tf,data,512,timeout_);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x220, %rsp            # imm = 0x220
movl %ecx, %ebp
movq %rdx, %r14
movl %esi, %r15d
movl %edi, %ebx
leaq 0x20(%rsp), %r12
movl $0x200, %edx            # imm = 0x200
movq %r12, %rdi
xorl %esi, %esi
callq 0x4290
movups (%r14), %xmm0
movups 0x10(%r14), %xmm1
movups %xmm0, 0x2(%r12)
movups %xmm1, 0x12(%r12)
testl %r15d, %r15d
je 0x11564
pushq $-0x16
popq %rax
jmp 0x1159d
leaq 0x11(%rsp), %rcx
andq $0x0, 0x2(%rcx)
movb $0x0, 0xa(%rcx)
movw $0xf1e0, (%rcx)         # imm = 0xF1E0
andl $0x0, 0x6(%rcx)
movb $0x1, 0x4(%rcx)
andl $0x0, 0xb(%rcx)
movl %ebp, (%rsp)
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %r8
movl %ebx, %edi
xorl %edx, %edx
movl $0x200, %r9d            # imm = 0x200
callq 0x10c5f
addq $0x220, %rsp            # imm = 0x220
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/sg.cpp
// Function: sg::security_erase(int, int, int, char const*, int)
int
  security_erase(const int  fd_,
                 const int  erase_mode_,
                 const int  identifier_,
                 const char password_[32],
                 const int  timeout_)
  {
    struct ata_tf tf;
    uint8_t data[512];

    ::memset(data,0,512);
    ::memcpy(&data[2],password_,32);
    switch(identifier_)
      {
      case SG_IDENTIFIER_USER:
        data[0] |= 0x00;
        break;
      case SG_IDENTIFIER_MASTER:
        data[0] |= 0x01;
        break;
      default:
        return -EINVAL;
      }

    switch(erase_mode_)
      {
      case SG_ERASE_NORMAL:
        data[0] |= 0x00;
        break;
      case SG_ERASE_ENHANCED:
        data[0] |= 0x02;
        break;
      default:
        return -EINVAL;
      }

    tf_init(&tf,ATA_OP_SECURITY_ERASE_UNIT,0,1);

    return exec(fd_,SG_WRITE,SG_PIO,&tf,data,512,timeout_);
  }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movl %r8d, %ebx
movq %rcx, %r12
movl %edx, %r15d
movl %esi, %r14d
movl %edi, %ebp
leaq 0x20(%rsp), %r13
movl $0x200, %edx            # imm = 0x200
movq %r13, %rdi
xorl %esi, %esi
callq 0x4290
movups (%r12), %xmm0
movups 0x10(%r12), %xmm1
movups %xmm0, 0x2(%r13)
movups %xmm1, 0x12(%r13)
pushq $-0x16
popq %rax
testl %r15d, %r15d
je 0x1163f
cmpl $0x1, %r15d
jne 0x1168a
movb $0x1, 0x20(%rsp)
movb $0x3, %cl
jmp 0x11641
movb $0x2, %cl
testl %r14d, %r14d
je 0x11650
cmpl $0x1, %r14d
jne 0x1168a
movb %cl, 0x20(%rsp)
leaq 0x11(%rsp), %rcx
andq $0x0, 0x7(%rcx)
andq $0x0, 0x2(%rcx)
xorl %eax, %eax
movb %al, 0x7(%rcx)
movb %al, 0x9(%rcx)
movb $0x1, 0x6(%rcx)
movw $0xf4e0, (%rcx)         # imm = 0xF4E0
movl %ebx, (%rsp)
pushq $0x1
popq %rsi
leaq 0x20(%rsp), %r8
movl %ebp, %edi
xorl %edx, %edx
movl $0x200, %r9d            # imm = 0x200
callq 0x10c5f
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/trapexit[P]bbf/src/signals.cpp
// Function: signals::setup_handlers()
void
  setup_handlers()
  {
    struct sigaction sa = {0};

    sa.sa_flags   = SA_RESTART;
    sa.sa_handler = signals::handler;

    sigaction(SIGHUP,&sa,NULL);
    sigaction(SIGALRM,&sa,NULL);
    sigaction(SIGTERM,&sa,NULL);
    sigaction(SIGINT,&sa,NULL);
    sigaction(SIGQUIT,&sa,NULL);
    sigaction(SIGUSR1,&sa,NULL);
    sigaction(SIGUSR2,&sa,NULL);
  }

// Assembly:
pushq %rbx
subq $0xa0, %rsp
leaq 0x10(%rsp), %rbx
movl $0x90, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x4290
movl $0x10000000, 0x80(%rbx) # imm = 0x10000000
leaq -0x3b(%rip), %rax       # 0x116ff
movq %rax, -0x8(%rbx)
pushq $0x1
popq %rdi
leaq 0x8(%rsp), %rbx
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0xe
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0xf
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0x2
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0x3
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0xa
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
pushq $0xc
popq %rdi
movq %rbx, %rsi
xorl %edx, %edx
callq 0x4570
addq $0xa0, %rsp
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/vgteam[P]stream/cpp/example.pb.cc
// Function: InitDefaultsscc_info_Person_example_2eproto()
static void InitDefaultsscc_info_Person_example_2eproto() {
  GOOGLE_PROTOBUF_VERIFY_VERSION;

  {
    void* ptr = &::_Person_default_instance_;
    new (ptr) ::Person();
    ::PROTOBUF_NAMESPACE_ID::internal::OnShutdownDestroyMessage(ptr);
  }
  ::Person::InitAsDefaultInstance();
}

// Assembly:
pushq %rbx
leaq 0x2a97(%rip), %rdx      # 0x70cb
movl $0x2df5a4, %edi         # imm = 0x2DF5A4
movl $0x2df5a0, %esi         # imm = 0x2DF5A0
callq 0x42f0
leaq 0x5cde(%rip), %rbx      # 0xa328
movq %rbx, %rdi
callq 0x5228
movq %rbx, %rdi
popq %rbx
jmp 0x522f
nop
// File: /workspace/github_cpp_makefile_star2_O2/vgteam[P]stream/cpp/example.pb.cc
// Function: Person::Person(Person const&)
Person::Person(const Person& from)
  : ::PROTOBUF_NAMESPACE_ID::Message(),
      _has_bits_(from._has_bits_) {
  _internal_metadata_.MergeFrom<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(from._internal_metadata_);
  name_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_name()) {
    name_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_name(),
      GetArena());
  }
  email_.UnsafeSetDefault(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited());
  if (from._internal_has_email()) {
    email_.Set(&::PROTOBUF_NAMESPACE_ID::internal::GetEmptyStringAlreadyInited(), from._internal_email(),
      GetArena());
  }
  id_ = from.id_;
  // @@protoc_insertion_point(copy_constructor:Person)
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
andq $0x0, 0x8(%rdi)
movq %rsi, %r14
leaq 0x55d0(%rip), %rax      # 0x9c60
movq %rax, (%rdi)
movl 0x10(%rsi), %eax
movl %eax, 0x10(%rdi)
andl $0x0, 0x14(%rdi)
leaq 0x8(%rdi), %r15
movq 0x8(%rsi), %rsi
testb $0x1, %sil
je 0x46bb
andq $-0x2, %rsi
addq $0x8, %rsi
movq %r15, %rdi
callq 0x5630
movq 0x58ee(%rip), %r12      # 0x9fb0
movq %r12, 0x18(%rbx)
movl 0x10(%r14), %eax
testb $0x1, %al
je 0x46ee
leaq 0x18(%rbx), %rdi
movq 0x18(%r14), %rdx
movq (%r15), %rcx
testb $0x1, %cl
jne 0x4725
movq 0x58cb(%rip), %rsi      # 0x9fb0
callq 0x4ea2
movl 0x10(%r14), %eax
movq %r12, 0x20(%rbx)
testb $0x2, %al
je 0x4712
leaq 0x20(%rbx), %rdi
movq 0x20(%r14), %rdx
movq (%r15), %rcx
testb $0x1, %cl
jne 0x472e
movq 0x58a3(%rip), %rsi      # 0x9fb0
callq 0x4ea2
movl 0x28(%r14), %eax
movl %eax, 0x28(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x46de
andq $-0x2, %rcx
movq (%rcx), %rcx
jmp 0x4706
nop
// File: /workspace/github_cpp_makefile_star2_O2/vgteam[P]stream/cpp/example.pb.cc
// Function: Person::Clear()
void Person::Clear() {
// @@protoc_insertion_point(message_clear_start:Person)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  // Prevent compiler warnings about cached_has_bits being unused
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  if (cached_has_bits & 0x00000003u) {
    if (cached_has_bits & 0x00000001u) {
      name_.ClearNonDefaultToEmpty();
    }
    if (cached_has_bits & 0x00000002u) {
      email_.ClearNonDefaultToEmpty();
    }
  }
  id_ = 0;
  _has_bits_.Clear();
  _internal_metadata_.Clear<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>();
}

// Assembly:
movl 0x10(%rdi), %eax
testb $0x3, %al
je 0x47b7
testb $0x1, %al
je 0x47a4
movq 0x18(%rdi), %rcx
andq $0x0, 0x8(%rcx)
movq (%rcx), %rcx
movb $0x0, (%rcx)
testb $0x2, %al
je 0x47b7
movq 0x20(%rdi), %rax
andq $0x0, 0x8(%rax)
movq (%rax), %rax
movb $0x0, (%rax)
andl $0x0, 0x28(%rdi)
andl $0x0, 0x10(%rdi)
testb $0x1, 0x8(%rdi)
jne 0x47c6
retq
addq $0x8, %rdi
jmp 0x565e
nop
// File: /workspace/github_cpp_makefile_star2_O2/vgteam[P]stream/cpp/example.pb.cc
// Function: Person::_InternalSerialize(unsigned char*, google::protobuf::io::EpsCopyOutputStream*) const
::PROTOBUF_NAMESPACE_ID::uint8* Person::_InternalSerialize(
    ::PROTOBUF_NAMESPACE_ID::uint8* target, ::PROTOBUF_NAMESPACE_ID::io::EpsCopyOutputStream* stream) const {
  // @@protoc_insertion_point(serialize_to_array_start:Person)
  ::PROTOBUF_NAMESPACE_ID::uint32 cached_has_bits = 0;
  (void) cached_has_bits;

  cached_has_bits = _has_bits_[0];
  // required string name = 1;
  if (cached_has_bits & 0x00000001u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_name().data(), static_cast<int>(this->_internal_name().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "Person.name");
    target = stream->WriteStringMaybeAliased(
        1, this->_internal_name(), target);
  }

  // required int32 id = 2;
  if (cached_has_bits & 0x00000004u) {
    target = stream->EnsureSpace(target);
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::WriteInt32ToArray(2, this->_internal_id(), target);
  }

  // optional string email = 3;
  if (cached_has_bits & 0x00000002u) {
    ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::VerifyUTF8StringNamedField(
      this->_internal_email().data(), static_cast<int>(this->_internal_email().length()),
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::SERIALIZE,
      "Person.email");
    target = stream->WriteStringMaybeAliased(
        3, this->_internal_email(), target);
  }

  if (PROTOBUF_PREDICT_FALSE(_internal_metadata_.have_unknown_fields())) {
    target = ::PROTOBUF_NAMESPACE_ID::internal::WireFormat::InternalSerializeUnknownFieldsToArray(
        _internal_metadata_.unknown_fields<::PROTOBUF_NAMESPACE_ID::UnknownFieldSet>(::PROTOBUF_NAMESPACE_ID::UnknownFieldSet::default_instance), target, stream);
  }
  // @@protoc_insertion_point(serialize_to_array_end:Person)
  return target;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movl 0x10(%rdi), %r12d
testb $0x1, %r12b
je 0x4992
movq 0x18(%r14), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
leaq 0x273e(%rip), %rcx      # 0x70b2
pushq $0x1
popq %rbp
movl %ebp, %edx
callq 0x4230
movq 0x18(%r14), %rdx
movq %rbx, %rdi
movl %ebp, %esi
movq %r15, %rcx
callq 0x508a
movq %rax, %r15
testb $0x4, %r12b
je 0x49b6
movq %rbx, %rdi
movq %r15, %rsi
callq 0x5174
movl 0x28(%r14), %edi
movb $0x10, (%rax)
leaq 0x1(%rax), %rsi
callq 0x54da
movq %rax, %r15
testb $0x2, %r12b
je 0x49ea
movq 0x20(%r14), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
leaq 0x26f1(%rip), %rcx      # 0x70be
pushq $0x1
popq %rdx
callq 0x4230
movq 0x20(%r14), %rdx
pushq $0x3
popq %rsi
movq %rbx, %rdi
movq %r15, %rcx
callq 0x508a
movq %rax, %r15
movq 0x8(%r14), %rdi
testb $0x1, %dil
jne 0x4a00
movq %r15, %rax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
andq $-0x2, %rdi
addq $0x8, %rdi
movq %r15, %rsi
movq %rbx, %rdx
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x41a0
nop
// File: /workspace/github_cpp_makefile_star2_O2/vgteam[P]stream/cpp/example.pb.cc
// Function: Person::RequiredFieldsByteSizeFallback() const
size_t Person::RequiredFieldsByteSizeFallback() const {
// @@protoc_insertion_point(required_fields_byte_size_fallback_start:Person)
  size_t total_size = 0;

  if (_internal_has_name()) {
    // required string name = 1;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::StringSize(
        this->_internal_name());
  }

  if (_internal_has_id()) {
    // required int32 id = 2;
    total_size += 1 +
      ::PROTOBUF_NAMESPACE_ID::internal::WireFormatLite::Int32Size(
        this->_internal_id());
  }

  return total_size;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl 0x10(%rdi), %eax
testb $0x1, %al
jne 0x4a2e
xorl %ebx, %ebx
jmp 0x4a41
movq 0x18(%r14), %rdi
callq 0x5182
movq %rax, %rbx
incq %rbx
movl 0x10(%r14), %eax
testb $0x4, %al
je 0x4a54
movl 0x28(%r14), %edi
callq 0x5536
addq %rax, %rbx
incq %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop