LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/hptools.cpp
// Function: (anonymous namespace)::md5_process((anonymous namespace)::md5_state*, unsigned char const*, unsigned long)
void md5_process(md5_state * md, const unsigned char *in, unsigned long inlen)
{
    unsigned long n;
    while (inlen > 0) {
        if (md->curlen == 0 && inlen >= 64) {
            md5_compress(md, (unsigned char *)in);
            md->length += 64 * 8;
            in += 64;
            inlen -= 64;
        } else {
            n = (inlen < (64 - md->curlen)) ? inlen : (64 - md->curlen);
            memcpy(md->buf + md->curlen, in, (size_t)n);
            md->curlen += n;
            in += n;
            inlen -= n;
            if (md->curlen == 64) {
                md5_compress(md, md->buf);
                md->length += 64 * 8;
                md->curlen = 0;
            }
        }
    }
}

// Assembly:
testq %rdx, %rdx
je 0x10d6b
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x1c(%rdi), %r12
movl 0x18(%r15), %edi
testq %rdi, %rdi
setne %al
cmpq $0x40, %rbx
setb %cl
orb %al, %cl
jne 0x10d0b
movq %r15, %rdi
movq %r14, %rsi
callq 0x11409
addq $0x200, (%r15)          # imm = 0x200
addq $0x40, %r14
addq $-0x40, %rbx
jmp 0x10d59
movl $0x40, %r13d
subl %edi, %r13d
cmpq %r13, %rbx
cmovbq %rbx, %r13
addq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4210
movl 0x18(%r15), %eax
addl %r13d, %eax
movl %eax, 0x18(%r15)
addq %r13, %r14
subq %r13, %rbx
cmpl $0x40, %eax
jne 0x10d59
movq %r15, %rdi
movq %r12, %rsi
callq 0x11409
addq $0x200, (%r15)          # imm = 0x200
movl $0x0, 0x18(%r15)
testq %rbx, %rbx
jne 0x10cda
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/hptools.cpp
// Function: (anonymous namespace)::md5_done((anonymous namespace)::md5_state*, unsigned char*)
void md5_done(md5_state * md, unsigned char *out)
{
    int i;

    /* increase the length of the message */
    md->length += md->curlen * 8;

    /* append the '1' bit */
    md->buf[md->curlen++] = (unsigned char)0x80;

    /* if the length is currently above 56 bytes we append zeros
     * then compress.  Then we can fall back to padding zeros and length
     * encoding like normal.
     */
    if (md->curlen > 56) {
        while (md->curlen < 64) {
            md->buf[md->curlen++] = (unsigned char)0;
        }
        md5_compress(md, md->buf);
        md->curlen = 0;
    }

    /* pad upto 56 bytes of zeroes */
    while (md->curlen < 56) {
        md->buf[md->curlen++] = (unsigned char)0;
    }

    /* store length */
    STORE64L(md->length, md->buf+56);
    md5_compress(md, md->buf);

    /* copy output */
    for (i = 0; i < 4; i++) {
        STORE32L(md->state[i], out+(4*i));
    }
#ifdef LTC_CLEAN_STACK
    memset(md, 0, sizeof(md5_state));
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x18(%rdi), %eax
leal (,%rax,8), %ecx
addq %rcx, (%rdi)
leaq 0x1c(%rdi), %r15
leal 0x1(%rax), %ecx
movl %ecx, 0x18(%rdi)
movb $-0x80, 0x1c(%rdi,%rax)
cmpl $0x39, %ecx
jb 0x10dd3
movl 0x18(%r14), %eax
cmpq $0x3f, %rax
ja 0x10dc0
leaq (%r14,%rax), %rdi
addq $0x1c, %rdi
movl $0x40, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x41b0
movl $0x40, 0x18(%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x11409
movl $0x0, 0x18(%r14)
movl 0x18(%r14), %eax
cmpq $0x37, %rax
ja 0x10dfe
leaq (%r14,%rax), %rdi
addq $0x1c, %rdi
movl $0x37, %edx
subl %eax, %edx
incq %rdx
xorl %esi, %esi
callq 0x41b0
movl $0x38, 0x18(%r14)
movq (%r14), %rax
movq %rax, 0x54(%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x11409
xorl %eax, %eax
movb 0xb(%r14,%rax,4), %cl
movb %cl, 0x3(%rbx,%rax,4)
movb 0xa(%r14,%rax,4), %cl
movb %cl, 0x2(%rbx,%rax,4)
movb 0x9(%r14,%rax,4), %cl
movb %cl, 0x1(%rbx,%rax,4)
movb 0x8(%r14,%rax,4), %cl
movb %cl, (%rbx,%rax,4)
incq %rax
cmpq $0x4, %rax
jne 0x10e12
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/hptools.cpp
// Function: (anonymous namespace)::sha256_process((anonymous namespace)::sha256_state*, unsigned char const*, unsigned long)
void sha256_process(sha256_state * md, const unsigned char *in, unsigned long inlen)
{
    unsigned long n;
    while (inlen > 0) {
        if (md->curlen == 0 && inlen >= 64) {
            sha256_compress(md, (unsigned char *)in);
            md->length += 64 * 8;
            in += 64;
            inlen -= 64;
        } else {
            n = (inlen < (64 - md->curlen)) ? inlen : (64 - md->curlen);
            memcpy(md->buf + md->curlen, in, (size_t)n);
            md->curlen += n;
            in += n;
            inlen -= n;
            if (md->curlen == 64) {
                sha256_compress(md, md->buf);
                md->length += 64 * 8;
                md->curlen = 0;
  }
}
  }
}

// Assembly:
testq %rdx, %rdx
je 0x11102
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
leaq 0x2c(%rdi), %r12
movl 0x28(%r15), %edi
testq %rdi, %rdi
setne %al
cmpq $0x40, %rbx
setb %cl
orb %al, %cl
jne 0x110a2
movq %r15, %rdi
movq %r14, %rsi
callq 0x11c35
addq $0x200, (%r15)          # imm = 0x200
addq $0x40, %r14
addq $-0x40, %rbx
jmp 0x110f0
movl $0x40, %r13d
subl %edi, %r13d
cmpq %r13, %rbx
cmovbq %rbx, %r13
addq %r12, %rdi
movq %r14, %rsi
movq %r13, %rdx
callq 0x4210
movl 0x28(%r15), %eax
addl %r13d, %eax
movl %eax, 0x28(%r15)
addq %r13, %r14
subq %r13, %rbx
cmpl $0x40, %eax
jne 0x110f0
movq %r15, %rdi
movq %r12, %rsi
callq 0x11c35
addq $0x200, (%r15)          # imm = 0x200
movl $0x0, 0x28(%r15)
testq %rbx, %rbx
jne 0x11071
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/hptools.cpp
// Function: (anonymous namespace)::sha256_done((anonymous namespace)::sha256_state*, unsigned char*)
void sha256_done(sha256_state * md, unsigned char *out)
{
    int i;

    /* increase the length of the message */
    md->length += md->curlen * 8;

    /* append the '1' bit */
    md->buf[md->curlen++] = (unsigned char)0x80;

    /* if the length is currently above 56 bytes we append zeros
     * then compress.  Then we can fall back to padding zeros and length
     * encoding like normal.
     */
    if (md->curlen > 56) {
        while (md->curlen < 64) {
            md->buf[md->curlen++] = (unsigned char)0;
        }
        sha256_compress(md, md->buf);
        md->curlen = 0;
    }

    /* pad upto 56 bytes of zeroes */
    while (md->curlen < 56) {
        md->buf[md->curlen++] = (unsigned char)0;
    }

    /* store length */
    STORE64H(md->length, md->buf+56);
    sha256_compress(md, md->buf);

    /* copy output */
    for (i = 0; i < 8; i++) {
        STORE32H(md->state[i], out+(4*i));
    }
#ifdef LTC_CLEAN_STACK
    memset(md, 0, sizeof(sha256_state));
#endif
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movl 0x28(%rdi), %eax
leal (,%rax,8), %ecx
addq %rcx, (%rdi)
leaq 0x2c(%rdi), %r15
leal 0x1(%rax), %ecx
movl %ecx, 0x28(%rdi)
movb $-0x80, 0x2c(%rdi,%rax)
cmpl $0x39, %ecx
jb 0x1116a
movl 0x28(%r14), %eax
cmpq $0x3f, %rax
ja 0x11157
leaq (%r14,%rax), %rdi
addq $0x2c, %rdi
movl $0x40, %edx
subl %eax, %edx
xorl %esi, %esi
callq 0x41b0
movl $0x40, 0x28(%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x11c35
movl $0x0, 0x28(%r14)
movl 0x28(%r14), %eax
cmpq $0x37, %rax
ja 0x11195
leaq (%r14,%rax), %rdi
addq $0x2c, %rdi
movl $0x37, %edx
subl %eax, %edx
incq %rdx
xorl %esi, %esi
callq 0x41b0
movl $0x38, 0x28(%r14)
movq (%r14), %rax
bswapq %rax
movq %rax, 0x64(%r14)
movq %r14, %rdi
movq %r15, %rsi
callq 0x11c35
xorl %eax, %eax
movb 0xb(%r14,%rax,4), %cl
movb %cl, (%rbx,%rax,4)
movb 0xa(%r14,%rax,4), %cl
movb %cl, 0x1(%rbx,%rax,4)
movb 0x9(%r14,%rax,4), %cl
movb %cl, 0x2(%rbx,%rax,4)
movb 0x8(%r14,%rax,4), %cl
movb %cl, 0x3(%rbx,%rax,4)
incq %rax
cmpq $0x8, %rax
jne 0x111ac
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/hptools.cpp
// Function: HomePlugAvTools::Checksum(unsigned int const*, unsigned long)
uint32_t HomePlugAvTools::Checksum(
  const uint32_t* pData, 
  size_t iWords)
{
  uint32_t ulCheckSum = 0;
  for(size_t i = 0; i < iWords; i++)
    ulCheckSum ^= pData[i];
  return ~ulCheckSum;
}

// Assembly:
testq %rsi, %rsi
je 0x11403
xorl %ecx, %ecx
xorl %eax, %eax
xorl (%rdi,%rcx,4), %eax
incq %rcx
cmpq %rcx, %rsi
jne 0x113f5
notl %eax
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/macaddress.cpp
// Function: CMACAddress::FromString(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
bool CMACAddress::FromString(const std::string& strMACAddr)
{
  // Loop over six bytes
  size_t iByte = 0;
  unsigned char cMacAddrBuff[size] = {0};
  const char* pString = strMACAddr.c_str();
  for( ; iByte < size; iByte++)
  {
    // Skip separator chars
    if((iByte > 0) && ((pString[0] == ':') || (pString[0] == '-')))
      pString++;

    // Check for valid hex representation of a byte
    if(strspn(pString, pHexDigits) >= 2)
    {
      // Convert into byte
      char cTmp[3] = { pString[0], pString[1], 0 };
      cMacAddrBuff[iByte] = (unsigned char)strtoul(cTmp, 0, 16);
      pString += 2;
    }
    else
    {
      break;
    }
  }

  // Check if six bytes have been converted and nothing remains
  if((iByte == size) && (pString[0] == 0))
  {
    memcpy(m_addr, cMacAddrBuff, size);
    return true;
  }
  else
  {
    return false;
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movw $0x0, 0xc(%rsp)
movl $0x0, 0x8(%rsp)
movq (%rsi), %r14
xorl %r13d, %r13d
leaq 0x2ccc(%rip), %r15      # 0x166e0
leaq 0x5(%rsp), %r12
testq %r13, %r13
je 0x13a2f
movzbl (%r14), %eax
cmpl $0x3a, %eax
je 0x13a2c
cmpl $0x2d, %eax
jne 0x13a2f
incq %r14
movq %r14, %rdi
movq %r15, %rsi
callq 0x4140
cmpq $0x2, %rax
jb 0x13a7b
movb (%r14), %al
movb %al, 0x5(%rsp)
movb 0x1(%r14), %al
movb %al, 0x6(%rsp)
movb $0x0, 0x7(%rsp)
movq %r12, %rdi
xorl %esi, %esi
movl $0x10, %edx
callq 0x40f0
movb %al, 0x8(%rsp,%r13)
addq $0x2, %r14
incq %r13
cmpq $0x6, %r13
jne 0x13a19
movl $0x6, %r13d
cmpq $0x6, %r13
jne 0x13a87
cmpb $0x0, (%r14)
je 0x13a97
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movzwl 0xc(%rsp), %eax
movw %ax, 0x4(%rbx)
movl 0x8(%rsp), %eax
movl %eax, (%rbx)
movb $0x1, %al
jmp 0x13a89
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::CPacketInterfaceLinux(std::set<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::less<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>> const&)
CPacketInterfaceLinux::CPacketInterfaceLinux(const std::set<std::string> &setIfcNames)
{
  m_ifcFilter = setIfcNames;

  if(pipe(m_interruptPipe) != 0)
    perror("pipe");
    
  static struct sock_filter statBPFProgramm [] = 
  {
    BPF_STMT(BPF_LD+BPF_H+BPF_ABS, 12),                                 
    BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K, HomePlugMMEs::uEtherType, 2, 0),    
    BPF_JUMP(BPF_JMP+BPF_JEQ+BPF_K,  HomePlugAvMMEs::uEtherType, 1, 0), 
    BPF_STMT(BPF_RET+BPF_K, 0),                                         
    BPF_STMT(BPF_RET+BPF_K, 0xFFFF)                                     
  };

  m_socketFilter.filter = statBPFProgramm;
  m_socketFilter.len = sizeof(statBPFProgramm) / sizeof(struct sock_filter);

  RefreshAdapters();
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
leaq 0xa24d(%rip), %rax      # 0x1dd08
movq %rax, (%rdi)
leaq 0x8(%rdi), %rbx
leaq 0x10(%rdi), %rax
xorl %ecx, %ecx
movl %ecx, 0x10(%rdi)
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq %rax, 0x28(%rdi)
movq %rcx, 0x30(%rdi)
leaq 0x40(%rdi), %rax
movl %ecx, 0x40(%rdi)
movq %rcx, 0x48(%rdi)
movq %rax, 0x50(%rdi)
movq %rax, 0x58(%rdi)
movq %rcx, 0x60(%rdi)
leaq 0x70(%rdi), %rax
movl %ecx, 0x70(%rdi)
movq %rcx, 0x78(%rdi)
movq %rax, 0x80(%rdi)
movq %rax, 0x88(%rdi)
movq %rcx, 0x90(%rdi)
movq %rbx, %rdi
callq 0x14a72
leaq 0x98(%r14), %rdi
callq 0x4320
testl %eax, %eax
jne 0x13b51
leaq 0xa71f(%rip), %rax      # 0x1e250
movq %rax, 0xa8(%r14)
movw $0x5, 0xa0(%r14)
movq (%r14), %rax
movq %r14, %rdi
callq *0x8(%rax)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x2b9f(%rip), %rdi      # 0x166f7
callq 0x4220
jmp 0x13b2a
movq %rax, %r15
leaq 0x68(%r14), %rdi
addq $0x38, %r14
callq 0x14d90
movq %r14, %rdi
callq 0x5f6e
movq %rbx, %rdi
callq 0x525e
movq %r15, %rdi
callq 0x43e0
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::closeAllSockets()
void CPacketInterfaceLinux::closeAllSockets()
{
  std::map<CMACAddress,Interface>::iterator itIfc;
  for(itIfc = m_ifcs.begin(); itIfc != m_ifcs.end(); ++itIfc)
  {
    close(itIfc->second.fdsocket);
    itIfc->second.fdsocket = -1;
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x80(%rdi), %r14
addq $0x70, %rbx
cmpq %rbx, %r14
je 0x13c10
movl 0x4c(%r14), %edi
callq 0x4440
movl $0xffffffff, 0x4c(%r14) # imm = 0xFFFFFFFF
movq %r14, %rdi
callq 0x41d0
movq %rax, %r14
cmpq %rbx, %rax
jne 0x13bef
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::GetCMACAddress(char const*, CMACAddress&) const
bool CPacketInterfaceLinux::GetCMACAddress(const char* name, CMACAddress& mac) const
{
  bool bResult = false;
  
  if(name)
  {
    int sock = socket(AF_INET, SOCK_STREAM, 0);
    if(sock >= 0)
    {
      struct ifreq ifreq;
      memset(&ifreq, 0, sizeof(struct ifreq));
      strncpy(ifreq.ifr_name, name, IF_NAMESIZE);
      if(ioctl(sock, SIOCGIFHWADDR, &ifreq) >= 0)
      {
        mac = CMACAddress(ifreq.ifr_ifru.ifru_hwaddr.sa_data);
        bResult = true;
      }
      else
      {
        perror("ioctl(SIOGIFHWADDR)");
      }
      close(sock);
    }
    else
    {
      perror("socket");
    }
  }

  return bResult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x14218
movq %rdx, %rbx
movq %rsi, %r14
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40b0
testl %eax, %eax
js 0x1420c
movl %eax, %ebp
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x0, 0x20(%r15)
movl $0x10, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4170
movl $0x8927, %esi           # imm = 0x8927
movl %ebp, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4330
testl %eax, %eax
setns %r14b
js 0x14229
movzwl 0x16(%rsp), %eax
movw %ax, 0x4(%rbx)
movl 0x12(%rsp), %eax
movl %eax, (%rbx)
movl %ebp, %edi
callq 0x4440
jmp 0x1421b
leaq 0x2512(%rip), %rdi      # 0x16725
callq 0x4220
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x24fc(%rip), %rdi      # 0x1672c
callq 0x4220
jmp 0x14203
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::InterfaceIsActive(char const*, bool) const
bool CPacketInterfaceLinux::InterfaceIsActive(const char* name, bool forceActivation) const
{
  bool bResult = false;

  if(name)
  {
    int sock = socket(AF_INET, SOCK_STREAM, 0);
    if(sock >= 0)
    {
      struct ifreq ifreq;
      memset(&ifreq, 0, sizeof(struct ifreq));
      strncpy(ifreq.ifr_name, name, sizeof(ifreq.ifr_name) - 1);
      if (ioctl(sock, SIOCGIFFLAGS, &ifreq) == 0)
      {
        if ((ifreq.ifr_flags & IFF_LOOPBACK) != IFF_LOOPBACK && (ifreq.ifr_flags & IFF_NOARP) != IFF_NOARP)
        {
          if ((ifreq.ifr_flags & IFF_UP) == IFF_UP)
          {
            if ((ifreq.ifr_flags & IFF_RUNNING) == IFF_RUNNING) bResult = true;
          }
        }
      }
      else perror("ioctl(SIOCGIFFLAGS)");
      close(sock);
    }
    else perror("socket");
  }
  return bResult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x142c4
movq %rsi, %r14
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40b0
testl %eax, %eax
js 0x142b8
movl %eax, %ebx
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x0, 0x20(%r15)
movl $0xf, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4170
movl $0x8913, %esi           # imm = 0x8913
movl %ebx, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4330
testl %eax, %eax
jne 0x142d3
movzwl 0x10(%rsp), %eax
andl $0xc9, %eax
cmpw $0x41, %ax
sete %bpl
movl %ebx, %edi
callq 0x4440
jmp 0x142c6
leaq 0x2466(%rip), %rdi      # 0x16725
callq 0x4220
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x2437(%rip), %rdi      # 0x16711
callq 0x4220
xorl %ebp, %ebp
jmp 0x142af
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::GetInterfaceIndex(char const*, int&) const
bool CPacketInterfaceLinux::GetInterfaceIndex(const char* name, int& ifindex) const
{
  bool bResult = false;
  
  if(name)
  {
    int sock = socket(AF_INET, SOCK_STREAM, 0);
    if(sock >= 0)
    {
      struct ifreq ifreq;
      memset(&ifreq, 0, sizeof(struct ifreq));
      strncpy(ifreq.ifr_name, name, IF_NAMESIZE);
      if(ioctl(sock, SIOCGIFINDEX, &ifreq) == 0)
      {
        ifindex = ifreq.ifr_ifindex;
        bResult = true;
      }
      else
      {
        perror("ioctl(SIOCGIFINDEX)");
      }
      close(sock);
    }
    else
    {
      perror("socket");
    }
  }

  return bResult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
testq %rsi, %rsi
je 0x1436b
movq %rdx, %rbx
movq %rsi, %r14
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x40b0
testl %eax, %eax
js 0x1435f
movl %eax, %ebp
xorps %xmm0, %xmm0
movq %rsp, %r15
movaps %xmm0, 0x10(%r15)
movaps %xmm0, (%r15)
movq $0x0, 0x20(%r15)
movl $0x10, %edx
movq %r15, %rdi
movq %r14, %rsi
callq 0x4170
movl $0x8933, %esi           # imm = 0x8933
movl %ebp, %edi
movq %r15, %rdx
xorl %eax, %eax
callq 0x4330
testl %eax, %eax
sete %r14b
jne 0x1437c
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
movl %ebp, %edi
callq 0x4440
jmp 0x1436e
leaq 0x23bf(%rip), %rdi      # 0x16725
callq 0x4220
xorl %r14d, %r14d
movl %r14d, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x23bd(%rip), %rdi      # 0x16740
callq 0x4220
jmp 0x14356
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::openNewSocket(char const*, int) const
int CPacketInterfaceLinux::openNewSocket(const char *unused_ifname, int ifindex) const
{
  int sock = socket(PF_PACKET, (int)SOCK_RAW, htons(ETH_P_ALL));
  if(sock >= 0)
  {
    struct sockaddr_ll saddr = { 0 };
    saddr.sll_family = AF_PACKET;
    saddr.sll_protocol = htons(ETH_P_ALL);
    saddr.sll_ifindex = ifindex;
    saddr.sll_halen = CMACAddress::size;
    memcpy(saddr.sll_addr, (unsigned char *) "\xff\xff\xff\xff\xff\xff" , 6);

    if(bind(sock, SOCKADDR_STAR(&saddr), sizeof(struct sockaddr_ll)) < 0)
    {
      close(sock);
      sock = -1;
      perror("bind");
    }
  }
  else
  {
    perror("socket(PF_PACKET)");
  }
  
  return sock;
}

// Assembly:
pushq %rbp
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebp
movl $0x11, %edi
movl $0x3, %esi
movl $0x300, %edx            # imm = 0x300
callq 0x40b0
movl %eax, %ebx
testl %eax, %eax
js 0x143ef
xorps %xmm0, %xmm0
movq %rsp, %rsi
movaps %xmm0, (%rsi)
movl $0x0, 0x10(%rsi)
movl $0x3000011, (%rsi)      # imm = 0x3000011
movl %ebp, 0x4(%rsi)
movb $0x6, 0xb(%rsi)
movl $0xffffffff, 0xc(%rsi)  # imm = 0xFFFFFFFF
movw $0xffff, 0x10(%rsi)     # imm = 0xFFFF
movl %ebx, %edi
movl $0x14, %edx
callq 0x4070
testl %eax, %eax
js 0x143fd
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
leaq 0x236a(%rip), %rdi      # 0x16760
callq 0x4220
jmp 0x143e6
movl %ebx, %edi
callq 0x4440
leaq 0x2350(%rip), %rdi      # 0x1675b
callq 0x4220
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x143e6
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::AttachFilter()
void CPacketInterfaceLinux::AttachFilter()
{
  if(m_socketFilter.len > 0)
  {
    std::map<CMACAddress,Interface>::const_iterator itIfc;
    for(itIfc = m_ifcs.begin(); itIfc != m_ifcs.end(); ++itIfc)
    {
      if(setsockopt(itIfc->second.fdsocket, SOL_SOCKET, SO_ATTACH_FILTER, &m_socketFilter, sizeof(m_socketFilter)) < 0)
        perror("setsockopt(SO_ATTACH_FILTER)");
    }
  }
}

// Assembly:
cmpw $0x0, 0xa0(%rdi)
je 0x14492
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x80(%rdi), %r14
leaq 0x70(%rdi), %r12
cmpq %r12, %r14
je 0x14487
addq $0xa0, %rbx
leaq 0x2327(%rip), %r15      # 0x16772
movl 0x4c(%r14), %edi
movl $0x1, %esi
movl $0x1a, %edx
movq %rbx, %rcx
movl $0x10, %r8d
callq 0x43f0
testl %eax, %eax
js 0x1447d
movq %r14, %rdi
callq 0x42d0
movq %rax, %r14
cmpq %r12, %rax
jne 0x1444b
jmp 0x14487
movq %r15, %rdi
callq 0x4220
jmp 0x1446b
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::SendPacket(CMACAddress const&, IPacket const&)
bool CPacketInterfaceLinux::SendPacket(const CMACAddress& adapter, const IPacket& packet)
{
  bool bResult = false;

  std::map<CMACAddress,Interface>::const_iterator itIfc;
  if((itIfc = m_ifcs.find(adapter)) != m_ifcs.end())
  {
    struct sockaddr_ll destination = { 0 };
    destination.sll_family = AF_PACKET;
    destination.sll_protocol = ((CMACHeader*)packet.Data())->uEtherType;
    destination.sll_ifindex = itIfc->second.ifindex;
    destination.sll_halen = CMACAddress::size;
    memcpy(destination.sll_addr, ((CMACHeader*)packet.Data())->cDstAddr, CMACAddress::size);

    if(sendto(itIfc->second.fdsocket, (void*)packet.Data(), packet.Size(),
      0, SOCKADDR_STAR(&destination), sizeof(struct sockaddr_ll)) >= 0)
    {
      bResult = true;
    }
    else
    {
      perror("sendto");
    }
  }

  return bResult;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
movq %rdi, %r14
addq $0x68, %rdi
callq 0x15174
addq $0x70, %r14
cmpq %r14, %rax
je 0x14550
movq %rax, %r15
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movl $0x0, 0x10(%r14)
movw $0x11, (%r14)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movzwl 0xc(%rax), %eax
movw %ax, 0x2(%r14)
movl 0x48(%r15), %eax
movl %eax, 0x4(%r14)
movb $0x6, 0xb(%r14)
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movl (%rax), %ecx
movl %ecx, 0xc(%r14)
movzwl 0x4(%rax), %eax
movw %ax, 0x10(%r14)
movl 0x4c(%r15), %ebp
movq (%rbx), %rax
movq %rbx, %rdi
callq *(%rax)
movq %rax, %r15
movq (%rbx), %rax
movq %rbx, %rdi
callq *0x8(%rax)
movl %ebp, %edi
movq %r15, %rsi
movq %rax, %rdx
xorl %ecx, %ecx
movq %r14, %r8
movl $0x14, %r9d
callq 0x4050
testq %rax, %rax
setns %bl
jns 0x14552
leaq 0x21b3(%rip), %rdi      # 0x166fc
callq 0x4220
jmp 0x14552
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: operator-(timeval const&, timeval const&)
struct timeval operator-(const struct timeval& lhs, const struct timeval& rhs)
{
  struct timeval result;
  long underflow = (lhs.tv_usec < rhs.tv_usec) ? 1 : 0;
  result.tv_sec = lhs.tv_sec - (rhs.tv_sec + underflow);
  result.tv_usec = (underflow * 1000000) + lhs.tv_usec - rhs.tv_usec;
  return result; 
}

// Assembly:
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
xorl %edi, %edi
subq 0x8(%rsi), %rcx
setl %dil
leaq 0xf4240(%rcx), %rdx
cmovgeq %rcx, %rdx
subq %rdi, %rax
subq (%rsi), %rax
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::buildfdset(fd_set&, int&) const
void CPacketInterfaceLinux::buildfdset(fd_set& fdset, int& nfds) const
{
  FD_ZERO(&fdset);
  nfds = 0;
  
  std::map<CMACAddress,Interface>::const_iterator itIfc;
  for(itIfc = m_ifcs.begin(); itIfc != m_ifcs.end(); ++itIfc)
  {
    FD_SET(itIfc->second.fdsocket, &fdset);
    nfds = std::max<int>(itIfc->second.fdsocket, nfds);
  }

  FD_SET(m_interruptPipe[0], &fdset);
  nfds = std::max<int>(m_interruptPipe[0], nfds);

  nfds++;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
xorps %xmm0, %xmm0
movups %xmm0, 0x70(%rsi)
movups %xmm0, 0x60(%rsi)
movups %xmm0, 0x50(%rsi)
movups %xmm0, 0x40(%rsi)
movups %xmm0, 0x30(%rsi)
movups %xmm0, 0x20(%rsi)
movups %xmm0, 0x10(%rsi)
movups %xmm0, (%rsi)
movl $0x0, (%rdx)
movq 0x80(%rdi), %rax
leaq 0x70(%rdi), %r12
cmpq %r12, %rax
je 0x1490d
xorl %ebp, %ebp
movl 0x4c(%rax), %edx
leal 0x3f(%rdx), %esi
testl %edx, %edx
cmovnsl %edx, %esi
movl %esi, %edi
andl $-0x40, %edi
movl %edx, %ecx
subl %edi, %ecx
movl $0x1, %edi
shlq %cl, %rdi
sarl $0x6, %esi
movslq %esi, %rcx
orq %rdi, (%r15,%rcx,8)
cmpl %ebp, %edx
jl 0x148fe
movl 0x4c(%rax), %ebp
movl %ebp, (%rbx)
movq %rax, %rdi
callq 0x42d0
cmpq %r12, %rax
jne 0x148d1
movl 0x98(%r14), %edx
leal 0x3f(%rdx), %eax
testl %edx, %edx
cmovnsl %edx, %eax
movl %eax, %esi
andl $-0x40, %esi
movl %edx, %ecx
subl %esi, %ecx
movl $0x1, %esi
shlq %cl, %rsi
sarl $0x6, %eax
cltq
orq %rsi, (%r15,%rax,8)
movl (%rbx), %eax
cmpl %eax, %edx
jl 0x14943
movl 0x98(%r14), %eax
incl %eax
movl %eax, (%rbx)
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/dguglielmi[P]dlan-linux-software/common/packetinterface-linux.cpp
// Function: CPacketInterfaceLinux::nextifcfromfdset(fd_set&) const
std::map<CMACAddress,CPacketInterfaceLinux::Interface>::const_iterator CPacketInterfaceLinux::nextifcfromfdset(fd_set & fdset) const
{
  std::map<CMACAddress,Interface>::const_iterator itIfc;
  for(itIfc = m_ifcs.begin(); itIfc != m_ifcs.end(); ++itIfc)
  {
    if(FD_ISSET(itIfc->second.fdsocket, &fdset))
    {
      FD_CLR(itIfc->second.fdsocket, &fdset);
      break;
    }
  }

  return itIfc;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movq 0x80(%rdi), %rax
addq $0x70, %r14
cmpq %r14, %rax
je 0x149ad
movq %rsi, %rbx
movl 0x4c(%rax), %ecx
leal 0x3f(%rcx), %edi
testl %ecx, %ecx
cmovnsl %ecx, %edi
movl %edi, %edx
sarl $0x6, %edx
movslq %edx, %rdx
movq (%rbx,%rdx,8), %rsi
andl $-0x40, %edi
subl %edi, %ecx
movl $0x1, %edi
shlq %cl, %rdi
btq %rcx, %rsi
jb 0x149a3
movq %rax, %rdi
callq 0x42d0
cmpq %r14, %rax
jne 0x1496a
jmp 0x149ad
notq %rdi
andq %rdi, %rsi
movq %rsi, (%rbx,%rdx,8)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: main
int main(int argc, char **argv)
{
  // args!
  if (argc != 3) {
    help(argv[0]);
    return fail;
  }
  
  // hand it all off to snesasm()
  if (snesasm(string(argv[1]), string(argv[2])) == fail) return fail;
  return success;
}

// Assembly:
pushq %rbx
subq $0x70, %rsp
movq %rsi, %rbx
cmpl $0x3, %edi
jne 0x41b8
movq 0x8(%rbx), %rsi
leaq 0x30(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x2090
movq 0x10(%rbx), %rsi
leaq 0x10(%rsp), %rdi
leaq 0xf(%rsp), %rdx
callq 0x2090
leaq 0x30(%rsp), %rdi
leaq 0x10(%rsp), %rsi
callq 0x429b
movl %eax, %ebx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41a3
callq 0x2140
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41ec
callq 0x2140
jmp 0x41ec
movq (%rbx), %rsi
leaq 0x50(%rsp), %rdi
leaq 0xe(%rsp), %rdx
callq 0x2090
leaq 0x50(%rsp), %rdi
callq 0x423b
leaq 0x60(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x41e7
callq 0x2140
movl $0x1, %ebx
movl %ebx, %eax
addq $0x70, %rsp
popq %rbx
retq
movq %rax, %rbx
leaq 0x20(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4219
callq 0x2140
jmp 0x4219
movq %rax, %rbx
leaq 0x60(%rsp), %rax
jmp 0x421e
movq %rax, %rbx
leaq 0x40(%rsp), %rax
movq -0x10(%rax), %rdi
cmpq %rax, %rdi
je 0x4233
callq 0x2140
jmp 0x4233
jmp 0x4230
movq %rax, %rbx
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: snesasm(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
int snesasm(string in, string out)
{
  if (file_existent(in) == false) {
    cerr << "error: file " << in << " doesn't exist\n";
    return fail;
  }
  
  
  file_to_string(in); // read file
  if (lexer() == fail) return fail; // lexer magic
  if (pass() == fail) return fail; // pass
  if (solve_unsolveds() == fail) return fail; // solve unknown labels
  snes();
  
  ofstream outs(out);
  copy(rom.begin(), rom.end(), ostreambuf_iterator<char>(outs));
  
  return success;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x250, %rsp            # imm = 0x250
movq %rsi, %rbx
movq %rdi, %r14
leaq 0x38(%rsp), %r12
movq %r12, -0x10(%r12)
movq (%rdi), %rsi
movq 0x8(%rdi), %rdx
addq %rsi, %rdx
leaq 0x28(%rsp), %r15
movq %r15, %rdi
callq 0x7be0
movq (%r15), %rsi
leaq 0x48(%rsp), %rdi
movl $0x8, %edx
callq 0x2270
leaq 0x48(%rsp), %rdi
movq (%rdi), %rax
movq -0x18(%rax), %rax
movl 0x68(%rsp,%rax), %ebp
callq 0x2040
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x4307
callq 0x2140
testl %ebp, %ebp
je 0x4353
movq 0x7cde(%rip), %rbx      # 0xbff0
leaq 0x50fb(%rip), %rsi      # 0x9414
movl $0xc, %edx
movq %rbx, %rdi
callq 0x2180
movq (%r14), %rsi
movq 0x8(%r14), %rdx
movq %rbx, %rdi
callq 0x2180
leaq 0x50e5(%rip), %rsi      # 0x9421
movl $0xf, %edx
movq %rax, %rdi
callq 0x2180
movl $0x1, %ebp
jmp 0x442c
leaq 0x18(%rsp), %r15
movq %r15, -0x10(%r15)
movq (%r14), %rsi
movq 0x8(%r14), %rdx
addq %rsi, %rdx
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x7be0
movq %r14, %rdi
callq 0x44b6
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x438a
callq 0x2140
callq 0x47f6
movl $0x1, %ebp
cmpl $0x1, %eax
je 0x442c
callq 0x4def
cmpl $0x1, %eax
je 0x442c
callq 0x6cf8
testl %eax, %eax
jne 0x442c
callq 0x6efc
leaq 0x48(%rsp), %r14
movq %r14, %rdi
movq %rbx, %rsi
movl $0x10, %edx
callq 0x2290
movq 0x7e83(%rip), %rdi      # 0xc258
movq 0x7e84(%rip), %rsi      # 0xc260
movq (%r14), %rax
movq -0x18(%rax), %rax
movq 0x130(%rsp,%rax), %rdx
xorl %ecx, %ecx
testq %rdx, %rdx
sete %cl
callq 0x7d00
movq 0x7bc9(%rip), %rax      # 0xbfc8
movq (%rax), %rcx
movq 0x18(%rax), %rax
leaq 0x50(%rsp), %rdi
movq %rcx, -0x8(%rdi)
movq -0x18(%rcx), %rcx
movq %rax, 0x48(%rsp,%rcx)
callq 0x2110
leaq 0x140(%rsp), %rdi
callq 0x2070
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x250, %rsp            # imm = 0x250
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x2210
jmp 0x446e
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
jne 0x4469
jmp 0x446e
movq %rax, %rbx
movq 0x28(%rsp), %rdi
cmpq %r12, %rdi
je 0x446e
callq 0x2140
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: snes()
void snes()
{
  unsigned char build_byte = 0x00;
  
  if (lohirom == hirom) {
    build_byte += 0x1;
  }
  
  if (sfrom == slowrom) {
    build_byte += 0x20;
  }
  
  base = 0x8000;
  
  org = 0xFFC0;
  if (name_flag == true) {
    for (unsigned int name_counter = 0; name_counter < name.length(); name_counter++) {
      write_byte(name[name_counter]);
    }
  }
  
  org = 0xFFD5;
  write_byte(build_byte);
  write_byte(carttype);
  write_byte(romsize);
  write_byte(0);
  write_byte(0);
  write_byte(licenseecode);
  write_byte(version);
  
  // clear checksum bytes
  write_byte(0);
  write_byte(0);
  write_byte(0);
  write_byte(0);
  
  
  if (compcheck_flag == true) {
  // the weird part, checksum calculation.
  auto checksum = 0ULL;
  auto inverse = 0ULL;
  for (auto counter = 0ULL; counter < rom.size(); counter++) {
    checksum += rom[counter];
  }
  
  
  checksum += 0x1FE; // add inverse to checksum
  checksum &= 0xFFFF; // lower 16 bytes
  inverse = checksum ^ 0xFFFF; // 0xFFFF - checksum
  
  
  // write to rom
  org = 0xFFDC;
  write_byte(inverse & 0xFF);
  write_byte(inverse >> 8);
  write_byte(checksum & 0xFF);
  write_byte(checksum >> 8);
  }
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
xorl %eax, %eax
cmpb $0x1, 0x532b(%rip)      # 0xc234
sete %al
cmpb $0x0, 0x5322(%rip)      # 0xc235
leal 0x20(%rax), %ecx
movzbl %cl, %ebx
cmovnel %eax, %ebx
movq $0x8000, 0x5269(%rip) # imm = 0x8000
movq $0xffc0, 0x5266(%rip) # imm = 0xFFC0
cmpb $0x1, 0x52d1(%rip)      # 0xc20a
jne 0x6f69
cmpq $0x0, 0x52d5(%rip)      # 0xc218
je 0x6f69
movl $0x1, %ebp
xorl %eax, %eax
movq 0x52bd(%rip), %rcx      # 0xc210
movzbl (%rcx,%rax), %edi
callq 0x75a2
movl %ebp, %eax
incl %ebp
cmpq %rax, 0x52b1(%rip)      # 0xc218
ja 0x6f4c
movq $0xffd5, 0x5224(%rip) # imm = 0xFFD5
movzbl %bl, %edi
callq 0x75a2
movzbl 0x52ae(%rip), %edi      # 0xc231
callq 0x75a2
movzbl 0x52a1(%rip), %edi      # 0xc230
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
movzbl 0x5289(%rip), %edi      # 0xc232
callq 0x75a2
movzbl 0x527e(%rip), %edi      # 0xc233
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
xorl %edi, %edi
callq 0x75a2
cmpb $0x1, 0x522b(%rip)      # 0xc208
jne 0x7016
movq 0x527a(%rip), %rax      # 0xc260
movq 0x526b(%rip), %rcx      # 0xc258
subq %rcx, %rax
je 0x701b
cmpq $0x1, %rax
adcq $0x0, %rax
xorl %edx, %edx
xorl %ebx, %ebx
movzbl (%rcx,%rdx), %esi
addq %rsi, %rbx
incq %rdx
cmpq %rdx, %rax
jne 0x6ffe
addq $0x1fe, %rbx            # imm = 0x1FE
jmp 0x7020
popq %rbx
popq %r14
popq %rbp
retq
movl $0x1fe, %ebx            # imm = 0x1FE
movl %ebx, %ebp
xorl $0xffff, %ebp           # imm = 0xFFFF
movq $0xffdc, 0x5165(%rip) # imm = 0xFFDC
movl $0xff, %r14d
movl %ebp, %edi
andl %r14d, %edi
callq 0x75a2
shrl $0x8, %ebp
andl %r14d, %ebp
movl %ebp, %edi
callq 0x75a2
movl %ebx, %edi
andl %r14d, %edi
callq 0x75a2
shrl $0x8, %ebx
andl %r14d, %ebx
movl %ebx, %edi
popq %rbx
popq %r14
popq %rbp
jmp 0x75a2
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: append_token(unsigned int, int)
int append_token(unsigned int counter, int current_token)
{
  unsigned int str_length = ins.length() - 1;
  
  while (ins[counter] != ' ' && ins[counter] != '\n' && ins[counter] != 0x0D && ins[counter] != ',') {
    if (counter == str_length) {
      counter++;
      break; // no overflows please!
    }
    
    tokens[current_token].token_i.append(string(1, ins[counter]));
    counter++;
  }
  
  return counter;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
movl 0x516f(%rip), %ebp      # 0xc1f0
decl %ebp
movslq %esi, %rax
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r14
leaq (%rax,%rax,4), %r12
movl %ebx, %eax
movq 0x514b(%rip), %rcx      # 0xc1e8
movzbl (%rcx,%rax), %edx
cmpq $0x2c, %rdx
ja 0x70b7
movabsq $0x100100002400, %rsi   # imm = 0x100100002400
btq %rdx, %rsi
jb 0x7107
cmpl %ebx, %ebp
je 0x7105
movq 0x5106(%rip), %r13      # 0xc1c8
movsbl (%rcx,%rax), %edx
movq %r15, 0x8(%rsp)
movl $0x1, %esi
movq %r14, %rdi
callq 0x2190
leaq 0x8(,%r12,8), %rdi
addq %r13, %rdi
movq 0x8(%rsp), %rsi
movq 0x10(%rsp), %rdx
callq 0x2060
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x7101
callq 0x2140
incl %ebx
jmp 0x7094
incl %ebx
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq 0x8(%rsp), %rdi
cmpq %r15, %rdi
je 0x712a
callq 0x2140
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: str_tolower(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string str_tolower(string str)
{ 
  for (unsigned int counter = 0; counter < str.length(); counter++) {
    if (isalpha(str[counter])) {
      str[counter] = tolower(str[counter]);
    }
  }
  
  return str;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x8(%rsi), %rax
testq %rax, %rax
je 0x7184
movl $0x1, %r15d
xorl %r12d, %r12d
movq (%r14), %r13
movsbl (%r13,%r12), %ebp
movl %ebp, %edi
callq 0x2230
testl %eax, %eax
je 0x7175
movl %ebp, %edi
callq 0x2200
movb %al, (%r13,%r12)
movl %r15d, %r12d
movq 0x8(%r14), %rax
incl %r15d
cmpq %r12, %rax
ja 0x7155
leaq 0x10(%rbx), %rdx
movq %rdx, (%rbx)
movq (%r14), %rsi
leaq 0x10(%r14), %rcx
cmpq %rcx, %rsi
je 0x71a3
movq %rsi, (%rbx)
movq (%rcx), %rdx
movq %rdx, 0x10(%rbx)
jmp 0x71a9
movups (%rcx), %xmm0
movups %xmm0, (%rdx)
movq %rax, 0x8(%rbx)
movq %rcx, (%r14)
movq $0x0, 0x8(%r14)
movb $0x0, 0x10(%r14)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: hint_next_token()
token hint_next_token()
{
  if (pass_counter >= tokens.size()) {
    token new_tok = {tkNL, ""};
    return new_tok;
  }
  
  return tokens[pass_counter+1];
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x4e91(%rip), %rcx      # 0xc2b0
movq 0x4daa(%rip), %rdx      # 0xc1d0
movq 0x4d9b(%rip), %rax      # 0xc1c8
subq %rax, %rdx
sarq $0x3, %rdx
movabsq $-0x3333333333333333, %rsi # imm = 0xCCCCCCCCCCCCCCCD
imulq %rdx, %rsi
cmpq %rsi, %rcx
jae 0x7471
leaq (%rcx,%rcx,4), %rcx
movl 0x28(%rax,%rcx,8), %edx
movl %edx, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x18(%rbx), %rdx
movq %rdx, 0x8(%rbx)
movq 0x30(%rax,%rcx,8), %rsi
movq 0x38(%rax,%rcx,8), %rdx
addq %rsi, %rdx
callq 0x7be0
jmp 0x7494
movl 0x4cfd(%rip), %eax      # 0xc174
movl %eax, (%rbx)
leaq 0x8(%rbx), %rdi
leaq 0x18(%rbx), %rax
movq %rax, 0x8(%rbx)
leaq 0x1f87(%rip), %rdx      # 0x9413
movq %rdx, %rsi
callq 0x7c70
movq %rbx, %rax
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: raw_data(int, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
void raw_data(int range, string name)
{
  while (hint_next_token().token_type != tkNL) {
    if (hint_next_token().token_type == tkCOMMA) {
      pass_counter++; continue;
    }
    
    directive_arg(name, range);
    
    if (range == r8) {
      write_byte(tr & 0xFF);
    } else if (range == r16) {
      write_byte(tr >> 8);
      write_byte(tr & 0xFF);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rsi, %rbx
movl %edi, %ebp
leaq 0x38(%rsp), %r13
leaq 0x20(%rsp), %r14
movq %r14, %rdi
callq 0x7414
movl 0x20(%rsp), %r12d
movl 0x4caa(%rip), %r15d     # 0xc174
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x74d9
callq 0x2140
cmpl %r15d, %r12d
je 0x757a
movq %r14, %rdi
callq 0x7414
movl 0x20(%rsp), %r12d
movl 0x4c82(%rip), %r15d     # 0xc178
movq 0x28(%rsp), %rdi
cmpq %r13, %rdi
je 0x7505
callq 0x2140
cmpl %r15d, %r12d
jne 0x7513
incq 0x4d9f(%rip)            # 0xc2b0
jmp 0x74b6
leaq 0x10(%rsp), %r15
movq %r15, (%rsp)
movq (%rbx), %rsi
movq 0x8(%rbx), %rdx
addq %rsi, %rdx
movq %rsp, %r12
movq %r12, %rdi
callq 0x7be0
movq %r12, %rdi
movl %ebp, %esi
callq 0x71cf
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x7549
callq 0x2140
cmpl %ebp, 0x4c31(%rip)      # 0xc180
je 0x7569
cmpl %ebp, 0x4c2d(%rip)      # 0xc184
jne 0x74b6
movzbl 0x4ced(%rip), %edi      # 0xc251
callq 0x75a2
movzbl 0x4ce0(%rip), %edi      # 0xc250
callq 0x75a2
jmp 0x74b6
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %rbx
movq (%rsp), %rdi
cmpq %r15, %rdi
je 0x759a
callq 0x2140
movq %rbx, %rdi
callq 0x2250
// File: /workspace/github_cpp_makefile_star2_O1/nicklausw[P]snesasm/snesasm.cpp
// Function: write_byte(unsigned char)
void write_byte(unsigned char byte)
{
  // the surprisingly simplest function of all!
  rom[org-base] = byte; org++;
  
  // ...well, that's before bug checks came in
  if (org > (base*(cur_bank+2))) {
    if (cur_bank >= rombanks) {
      cerr << "error: no more room in rom\n";
      exit(fail);
    } else {
      cerr << "warning: bank overflow; rolling into bank " << cur_bank+1 << "\n";
      cerr << "org: " << org << " base: " << base << " banksize: " << banksize << "\n";
      cur_bank++;
    }
  }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq 0x4beb(%rip), %rax      # 0xc198
subq 0x4bdc(%rip), %rax      # 0xc190
movq 0x4c9d(%rip), %rcx      # 0xc258
movb %dil, (%rcx,%rax)
movq 0x4bd2(%rip), %rcx      # 0xc198
incq %rcx
movq %rcx, 0x4bc8(%rip)      # 0xc198
movq 0x4c69(%rip), %rax      # 0xc240
leaq 0x2(%rax), %rdx
imulq 0x4bad(%rip), %rdx      # 0xc190
cmpq %rdx, %rcx
jbe 0x76c6
movzbl 0x4c43(%rip), %ecx      # 0xc236
cmpq %rcx, %rax
jae 0x76ce
movq 0x49ed(%rip), %r14      # 0xbff0
leaq 0x217d(%rip), %rsi      # 0x9787
movl $0x2a, %edx
movq %r14, %rdi
callq 0x2180
movq 0x4c22(%rip), %rsi      # 0xc240
incq %rsi
movq %r14, %rdi
callq 0x20d0
leaq 0x1de2(%rip), %rbx      # 0x9412
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
leaq 0x216b(%rip), %rsi      # 0x97b2
movl $0x5, %edx
movq %r14, %rdi
callq 0x2180
movq 0x4b3d(%rip), %rsi      # 0xc198
movq %r14, %rdi
callq 0x20d0
movq %rax, %r14
leaq 0x214b(%rip), %rsi      # 0x97b8
movl $0x7, %edx
movq %rax, %rdi
callq 0x2180
movq 0x4b0f(%rip), %rsi      # 0xc190
movq %r14, %rdi
callq 0x20d0
movq %rax, %r14
leaq 0x212d(%rip), %rsi      # 0x97c0
movl $0xb, %edx
movq %rax, %rdi
callq 0x2180
movq 0x4b91(%rip), %rsi      # 0xc238
movq %r14, %rdi
callq 0x20d0
movl $0x1, %edx
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2180
incq 0x4b7a(%rip)            # 0xc240
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq 0x491b(%rip), %rdi      # 0xbff0
leaq 0x208f(%rip), %rsi      # 0x976b
callq 0x2150
movl $0x1, %edi
callq 0x21b0
// File: /workspace/github_cpp_makefile_star2_O1/rocket323[P]fishdb/examples/ex_basic.cpp
// Function: main
int main()
{
    const char *fname = "test.fdb";

    auto bt = BTree::Open(fname);
    if (bt == NULL)
    {
        printf("open db[%s] failed", fname);
        return -1;
    }

    std::string val = "hello world";
    bt->Put("greet", val);

    std::string value;
    bt->Get("greet", value);
    std::cout << "greet: " << value << std::endl;

    bt->Close();
    delete bt;
    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x80, %rsp
leaq -0x90(%rbp), %r14
movq %r14, -0x10(%r14)
leaq 0x5a74(%rip), %rsi      # 0x8004
leaq 0x5a75(%rip), %rdx      # 0x800c
leaq -0xa0(%rbp), %rbx
movq %rbx, %rdi
callq 0x289e
xorps %xmm0, %xmm0
leaq -0x60(%rbp), %rsi
movaps %xmm0, (%rsi)
leaq 0x381(%rip), %rax       # 0x2938
movq %rax, 0x18(%rsi)
leaq 0x380(%rip), %rax       # 0x2942
movq %rax, 0x10(%rsi)
movq %rbx, %rdi
movl $0x2, %edx
callq 0x29a4
movq %rax, %rbx
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x25ed
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
je 0x25fe
callq 0x21b0
testq %rbx, %rbx
je 0x2719
leaq -0x70(%rbp), %r15
movq %r15, -0x10(%r15)
leaq 0x5a0a(%rip), %rsi      # 0x8020
leaq 0x5a0e(%rip), %rdx      # 0x802b
leaq -0x80(%rbp), %rdi
callq 0x289e
leaq 0x59ff(%rip), %rsi      # 0x802c
leaq -0x80(%rbp), %rdx
movq %rbx, %rdi
callq 0x2e92
leaq -0x30(%rbp), %r12
movq %r12, -0x10(%r12)
movq $0x0, -0x8(%r12)
movb $0x0, (%r12)
leaq 0x59d5(%rip), %rsi      # 0x802c
leaq -0x40(%rbp), %rdx
movq %rbx, %rdi
callq 0x2c9c
movq 0x996e(%rip), %rdi      # 0xbfd8
leaq 0x59c1(%rip), %rsi      # 0x8032
movl $0x7, %edx
callq 0x2230
movq -0x40(%rbp), %rsi
movq -0x38(%rbp), %rdx
movq 0x994e(%rip), %rdi      # 0xbfd8
callq 0x2230
movq %rax, %r14
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r14, %rdi
movl $0xa, %esi
callq 0x21d0
movsbl %al, %esi
movq %r14, %rdi
callq 0x2040
movq %rax, %rdi
callq 0x2150
movq %rbx, %rdi
callq 0x2aca
movq 0x78(%rbx), %rdi
testq %rdi, %rdi
je 0x26cf
callq 0x27be
movq 0x60(%rbx), %rax
testq %rax, %rax
je 0x26e9
movq %rbx, %rdi
addq $0x50, %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq %rbx, %rdi
callq 0x2838
movq %rbx, %rdi
callq 0x21b0
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x2707
callq 0x21b0
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x2715
callq 0x21b0
xorl %eax, %eax
jmp 0x2733
leaq 0x58ed(%rip), %rdi      # 0x800d
leaq 0x58dd(%rip), %rsi      # 0x8004
xorl %eax, %eax
callq 0x2050
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
addq $0x80, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2779
movq %rax, %rbx
jmp 0x2792
movq %rax, %rbx
jmp 0x27a0
jmp 0x2779
movq %rax, %rbx
movq -0x50(%rbp), %rax
testq %rax, %rax
je 0x276b
leaq -0x60(%rbp), %rdi
movq %rdi, %rsi
movl $0x3, %edx
callq *%rax
movq -0xa0(%rbp), %rdi
cmpq %r14, %rdi
jne 0x279b
jmp 0x27a0
movq %rax, %rdi
callq 0x282a
movq %rax, %rbx
movq -0x40(%rbp), %rdi
cmpq %r12, %rdi
je 0x2792
callq 0x21b0
movq -0x80(%rbp), %rdi
cmpq %r15, %rdi
je 0x27a0
callq 0x21b0
movq %rbx, %rdi
callq 0x2300
// File: /workspace/github_cpp_makefile_star2_O1/lemire[P]validateutf8-experiments/benchmarks/benchmark.cpp
// Function: main
int main() {
  RealDataBenchmark rdb;
  rdb.run();

  std::vector<size_t> input_size{16384};
  for (const size_t size : input_size) {
    Benchmark bench(size);
    bench.run();
  }
  return EXIT_SUCCESS;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x13c8, %rsp           # imm = 0x13C8
leaq 0x20(%rsp), %rbx
movq %rbx, %rdi
callq 0x62b6
movq %rbx, %rdi
callq 0x63bc
leaq 0x38(%rsp), %rsi
movq $0x4000, (%rsi)         # imm = 0x4000
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rcx
movl $0x1, %edx
callq 0x6638
movq 0x8(%rsp), %r15
movq 0x10(%rsp), %r12
cmpq %r12, %r15
je 0x5ca2
leaq 0x40(%rsp), %r14
leaq 0x38(%rsp), %rbx
movq (%r15), %rax
movq %rax, 0x38(%rsp)
movq %r14, %rdi
callq 0xb532
movq %rbx, %rdi
callq 0x667e
movq %r14, %rdi
callq 0x2140
addq $0x8, %r15
cmpq %r12, %r15
jne 0x5c79
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5cb9
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x20(%rsp), %rdi
callq 0xee5e
xorl %eax, %eax
addq $0x13c8, %rsp           # imm = 0x13C8
popq %rbx
popq %r12
popq %r14
popq %r15
retq
jmp 0x5cd6
movq %rax, %rbx
jmp 0x5d02
movq %rax, %rbx
jmp 0x5ceb
movq %rax, %rbx
movq %r14, %rdi
callq 0x2140
movq 0x8(%rsp), %rdi
testq %rdi, %rdi
je 0x5d02
movq 0x18(%rsp), %rsi
subq %rdi, %rsi
callq 0x2170
leaq 0x20(%rsp), %rdi
callq 0xee5e
movq %rbx, %rdi
callq 0x2250
jmp 0x5d16
movq %rax, %rdi
callq 0x6b12
// File: /workspace/github_cpp_makefile_star2_O1/lemire[P]validateutf8-experiments/dependencies/utf8_v2_3_4/source/utf8/core.h
// Function: _gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char>>> utf8::find_invalid<__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char>>>>(__gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char>>>, __gnu_cxx::__normal_iterator<char*, std::vector<char, std::allocator<char>>>)
octet_iterator find_invalid(octet_iterator start, octet_iterator end)
    {
        octet_iterator result = start;
        while (result != end) {
            utf8::internal::utf_error err_code = utf8::internal::validate_next(result, end);
            if (err_code != internal::UTF8_OK)
                return result;
        }
        return result;
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, (%rsp)
cmpq %rsi, %rdi
je 0xb21c
movq %rsi, %rbx
movq %rsp, %r14
leaq 0xc(%rsp), %r15
movq %r14, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xb22a
testl %eax, %eax
jne 0xb21c
cmpq %rbx, (%rsp)
jne 0xb204
movq (%rsp), %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq