LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/main.cpp
// Function: ExtractInstruction[abi:cxx11](std::basic_ifstream<char, std::char_traits<char>>&)
vector<string> ExtractInstruction(ifstream& is)
{
   vector<string> instruction;
   char ch;
   int n=0;

   while(is.good()&&!is.eof())
   {
      n=0;
      string s="";

      ch=is.get();

      if(ch==EOF)
            continue;
      else if(ch=='/') // se è un commento ignoriamo tutto
      {
            is.ignore(100, '\n');
            continue;
      }
      else
      {
            // raccolgo i caratteri della riga finchè non incontro un \n o raggiungo la massima lunghezza della istruzione permessa
            do
            {
                  n++;
                  s+=ch;
                  ch=is.get();
            }while(ch != '\n' && n < INSTR_LENGTH);

            // se raggiungo la massima lunghezza della istruzione inserisco un \n come carattere finale
            if(n >= INSTR_LENGTH)
            {
                  s+=ch;
                  s+='\n';
            }
            
            // carico nel vettore la stringa così costruita
            instruction.push_back(s);
      }
   }
   
   return instruction;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movq %rsi, %r14
andq $0x0, 0x10(%rdi)
xorps %xmm0, %xmm0
movq %rdi, -0x38(%rbp)
movups %xmm0, (%rdi)
leaq 0x1d38(%rip), %r15      # 0x605a
leaq -0x58(%rbp), %r12
leaq -0x29(%rbp), %r13
movq (%r14), %rax
movq -0x18(%rax), %rax
cmpl $0x0, 0x20(%r14,%rax)
jne 0x43cd
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rdx
callq 0x46d0
movq %r14, %rdi
callq 0x3270
cmpb $0x2f, %al
je 0x43b2
movzbl %al, %ecx
cmpl $0xff, %ecx
je 0x43c0
pushq $-0x1
popq %rbx
movsbl %al, %esi
movq %r12, %rdi
callq 0x31c0
movq %r14, %rdi
callq 0x3270
incl %ebx
cmpb $0xa, %al
je 0x4386
cmpl $0xf9, %ebx
jb 0x4365
cmpl $0xf9, %ebx
jb 0x43a4
movsbl %al, %esi
movq %r12, %rdi
callq 0x31c0
movq %r12, %rdi
pushq $0xa
popq %rsi
callq 0x31c0
movq -0x38(%rbp), %rdi
movq %r12, %rsi
callq 0x47a6
jmp 0x43c0
movq %r14, %rdi
pushq $0x64
popq %rsi
pushq $0xa
popq %rdx
callq 0x3140
movq %r12, %rdi
callq 0x30c0
jmp 0x432a
movq -0x38(%rbp), %rax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x43f3
jmp 0x43e7
movq %rax, %r14
leaq -0x58(%rbp), %rdi
callq 0x30c0
movq -0x38(%rbp), %rdi
callq 0x4718
movq %r14, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/main.cpp
// Function: isBitStreamInstruction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
bool isBitStreamInstruction(string instr)
{
      string s = instr.substr(0, 100);

      istringstream iss(s);
      string tmp;
      long int n;

      iss >> tmp;

      if(tmp != "SDR")
            return false;

      iss >> n;

      if(n < 1000)
            return false;
      
      return true;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x1c8, %rsp            # imm = 0x1C8
movq %rdi, %rsi
leaq -0x50(%rbp), %rbx
pushq $0x64
popq %rcx
movq %rbx, %rdi
xorl %edx, %edx
callq 0x3240
leaq -0x1d0(%rbp), %rdi
pushq $0x8
popq %rdx
movq %rbx, %rsi
callq 0x3360
leaq -0x20(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x1d0(%rbp), %rdi
leaq -0x30(%rbp), %rsi
callq 0x32a0
leaq 0x216e(%rip), %rsi      # 0x65cb
leaq -0x30(%rbp), %rdi
callq 0x470b
testb %al, %al
je 0x446e
xorl %ebx, %ebx
jmp 0x4489
leaq -0x1d0(%rbp), %rdi
leaq -0x10(%rbp), %rsi
callq 0x3230
cmpq $0x3e8, -0x10(%rbp)     # imm = 0x3E8
setge %bl
leaq -0x30(%rbp), %rdi
callq 0x30c0
leaq -0x1d0(%rbp), %rdi
callq 0x30d0
leaq -0x50(%rbp), %rdi
callq 0x30c0
movl %ebx, %eax
addq $0x1c8, %rsp            # imm = 0x1C8
popq %rbx
popq %rbp
retq
movq %rax, %rbx
jmp 0x44d0
movq %rax, %rbx
leaq -0x30(%rbp), %rdi
callq 0x30c0
leaq -0x1d0(%rbp), %rdi
callq 0x30d0
leaq -0x50(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/main.cpp
// Function: ExtractBitstream(std::vector<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>>>>, long)
vector<string> ExtractBitstream(vector<string> instructionsFile, long int currentIndex)
{
      vector<string> stream;
      string tmp, tmp2;
      int i = 0, k = 0;

      // Prima riga: ignoro tutto ciò che viene prima delle parentesi
      while(instructionsFile[currentIndex][i] != '(')
      {
            i++;
      }

      i++;

      // Arrivato alla parentesi prendo tutto
      while(instructionsFile[currentIndex][i] != '\n' && instructionsFile[currentIndex][i] != '\r')
      {
            tmp += instructionsFile[currentIndex][i];
            i++;
      }

      stream.push_back(tmp);

      currentIndex++;

      // Immetto righe finchè l'ultimo carattere di una riga è ')' si noti che così viene caricata anche l'SMASK
      while(instructionsFile[currentIndex][instructionsFile[currentIndex].size() - 4] != ')')
      {
            stream.push_back(instructionsFile[currentIndex]);
            currentIndex++;
      }

      // Immetto ultima riga fino al carattere di ')'
      while(instructionsFile[currentIndex][k] != ')')
      {
            tmp2 += instructionsFile[currentIndex][k];
            k++;
      }

      stream.push_back(tmp2);

      return stream;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x48, %rsp
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %rbx
xorps %xmm0, %xmm0
andq $0x0, 0x10(%rdi)
leaq -0x58(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movups %xmm0, (%rdi)
xorl %r13d, %r13d
movb %r13b, (%rax)
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb %r13b, (%rax)
movq (%rsi), %rax
shlq $0x5, %r14
movq (%rax,%r14), %rax
cmpb $0x28, (%rax,%r13)
leaq 0x1(%r13), %r13
jne 0x4534
leaq -0x68(%rbp), %r12
movq (%r15), %rax
movq (%rax,%r14), %rax
movzbl (%rax,%r13), %eax
cmpl $0xa, %eax
je 0x4569
cmpl $0xd, %eax
je 0x4569
incq %r13
movsbl %al, %esi
movq %r12, %rdi
callq 0x31c0
jmp 0x4543
leaq -0x68(%rbp), %rsi
movq %rbx, %rdi
callq 0x47a6
addq $0x20, %r14
movq (%r15), %rsi
movq (%rsi,%r14), %rax
movq 0x8(%rsi,%r14), %rcx
cmpb $0x29, -0x4(%rax,%rcx)
je 0x459d
addq %r14, %rsi
addq $0x20, %r14
movq %rbx, %rdi
callq 0x47a6
jmp 0x4579
xorl %r13d, %r13d
leaq -0x48(%rbp), %r12
movb (%rax,%r13), %al
cmpb $0x29, %al
je 0x45c3
movsbl %al, %esi
movq %r12, %rdi
callq 0x31c0
incq %r13
movq (%r15), %rax
movq (%rax,%r14), %rax
jmp 0x45a4
leaq -0x48(%rbp), %rsi
movq %rbx, %rdi
callq 0x47a6
leaq -0x48(%rbp), %rdi
callq 0x30c0
leaq -0x68(%rbp), %rdi
callq 0x30c0
movq %rbx, %rax
addq $0x48, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x45f9
jmp 0x45f9
jmp 0x45f9
movq %rax, %r14
leaq -0x48(%rbp), %rdi
callq 0x30c0
leaq -0x68(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x4718
movq %r14, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/main.cpp
// Function: ExtractAnswer(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string ExtractAnswer(string line)
{
      istringstream iss(line);
      string str;
      iss >> str;
      iss >> str;
      iss >> str;

      return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rdi, %rbx
leaq -0x190(%rbp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x3360
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb $0x0, 0x10(%rbx)
movq %r14, %rdi
movq %rbx, %rsi
callq 0x32a0
leaq -0x190(%rbp), %rdi
movq %rbx, %rsi
callq 0x32a0
leaq -0x190(%rbp), %rdi
movq %rbx, %rsi
callq 0x32a0
leaq -0x190(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
popq %r14
popq %rbp
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x30c0
leaq -0x190(%rbp), %rdi
callq 0x30d0
movq %r14, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: Serial::WriteString(char const*)
void Serial::WriteString(const char *String)
{
   int length=strlen(String);
   if (write(fd,String,length)!=length)
   {
      throw ErrorWriteException();
   }
   return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movq %rdi, %r14
movq %rsi, %rdi
callq 0x30b0
movl (%r14), %edi
movslq %eax, %r14
movq %rbx, %rsi
movq %r14, %rdx
callq 0x3080
cmpq %r14, %rax
jne 0x4e1a
popq %rbx
popq %r14
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3eef(%rip), %rcx      # 0x8d18
movq %rcx, (%rax)
leaq 0x3e3d(%rip), %rsi      # 0x8c70
movq 0x41a6(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x3380
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: Serial::ReadChar(char*, unsigned int)
unsigned Serial::ReadChar(char *pByte, unsigned TimeOut_ms)
{
   // Timer per la gestione del timeout
   TimeOut Timer;
   Timer.InitTimer();
   while (Timer.ElapsedTime_ms()<TimeOut_ms || TimeOut_ms==0)
   {
      switch (read(fd,pByte,1))
      {
         case -1: throw ErrorReadException();
         case 1 : return 1;
      }
   }
   throw TimeoutException();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r14
movq %rdi, %r15
leaq -0x38(%rbp), %rdi
callq 0x4f32
movl %ebx, %r12d
pushq $0x1
popq %r13
leaq -0x38(%rbp), %rdi
callq 0x4f3e
testl %ebx, %ebx
je 0x4ec3
cmpq %r12, %rax
jae 0x4f0a
movl (%r15), %edi
movq %r14, %rsi
movq %r13, %rdx
callq 0x32f0
cmpq $0x1, %rax
je 0x4ef8
cmpq $-0x1, %rax
jne 0x4eb1
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3e54(%rip), %rcx      # 0x8d40
movq %rcx, (%rax)
leaq 0x3d92(%rip), %rsi      # 0x8c88
jmp 0x4f23
pushq $0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3e4f(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x3d05(%rip), %rsi      # 0x8c28
movq 0x40b6(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x3380
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: TimeOut::ElapsedTime_ms()
unsigned long int TimeOut::ElapsedTime_ms()
{
   struct timeval CurrentTime;
   int sec,usec;
   gettimeofday(&CurrentTime, NULL);
   sec=CurrentTime.tv_sec-PreviousTime.tv_sec;
   usec=CurrentTime.tv_usec-PreviousTime.tv_usec;
   if (usec<0)
   {
      usec=1000000-PreviousTime.tv_usec+CurrentTime.tv_usec;
      sec--;
   }
   return sec*1000+usec/1000;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
leaq -0x20(%rbp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x3340
movl (%r14), %ecx
movl 0x8(%r14), %edx
subl (%rbx), %ecx
subl 0x8(%rbx), %edx
leal 0xf4240(%rdx), %eax
movl %edx, %esi
sarl $0x1f, %esi
addl %ecx, %esi
testl %edx, %edx
cmovnsl %edx, %eax
imull $0x3e8, %esi, %ecx      # imm = 0x3E8
movl $0x3e8, %esi            # imm = 0x3E8
cltd
idivl %esi
addl %ecx, %eax
cltq
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: Serial::ReadStringNoTimeOut(char*, char, unsigned int)
unsigned Serial::ReadStringNoTimeOut(char *String, char FinalChar, unsigned MaxNbBytes)
{
   unsigned NbBytes=0;
   unsigned ret;
   while (NbBytes<MaxNbBytes)
   {
      ret=ReadChar(&String[NbBytes]);
      if (ret==1)
      {
         if (String[NbBytes]==FinalChar)
         {
            String[NbBytes]='\0';
            return NbBytes;
         }
         NbBytes++;
      }
      else
      {
         // Ramo superfluo in quanto l'eccezione verrebbe lanciata da ReadChar(...)
         // lasciato per facilitare un eventuale debug
         throw ErrorReadException();
      }
   }
   throw ErrorBufferFullException();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edx, %r14d
movq %rsi, %rbx
movq %rdi, %r15
movl %ecx, %r13d
xorl %r12d, %r12d
cmpq %r12, %r13
je 0x4fe6
leaq (%rbx,%r12), %rsi
movq %r15, %rdi
xorl %edx, %edx
callq 0x4e88
cmpb %r14b, (%rbx,%r12)
je 0x4fcf
incq %r12
jmp 0x4fb1
movb $0x0, (%rbx,%r12)
movl %r12d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3d9b(%rip), %rcx      # 0x8d90
movq %rcx, (%rax)
leaq 0x3ca1(%rip), %rsi      # 0x8ca0
movq 0x3fda(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x3380
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: Serial::ReadString(char*, char, unsigned int, unsigned int)
unsigned Serial::ReadString(char *String,char FinalChar,unsigned MaxNbBytes,unsigned TimeOut_ms)
{
   // Se non è specificato un timeout, usa il metodo senza timeout
   if (TimeOut_ms==0)
      return ReadStringNoTimeOut(String,FinalChar,MaxNbBytes);
   unsigned NbBytes=0;
   unsigned ret;

   // Timer la gestione del timeout
   TimeOut Timer;
   long int TimeOutParam;

   // Inizializza il timer
   Timer.InitTimer();

   while (NbBytes<MaxNbBytes)
   {
      // Tempo trascorso
      TimeOutParam=TimeOut_ms-Timer.ElapsedTime_ms();
      if (TimeOutParam>0)
      {
         ret=ReadChar(&String[NbBytes],TimeOutParam);
         if (ret==1)
         {
            if (String[NbBytes]==FinalChar)
            {
               String[NbBytes]='\0';
               return NbBytes;
            }
            NbBytes++;
         }
         else
          throw ErrorReadException();
      }
      if (Timer.ElapsedTime_ms()>TimeOut_ms)
      {
         String[NbBytes]='\0';
         throw TimeoutException();
      }
   }
   throw ErrorBufferFullException();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movl %edx, -0x2c(%rbp)
testl %r8d, %r8d
je 0x50e8
movl %r8d, %r15d
movq %rdi, -0x40(%rbp)
movq %rsi, -0x38(%rbp)
leaq -0x58(%rbp), %r14
movq %r14, %rdi
callq 0x4f32
movl %r15d, %ebx
xorl %r15d, %r15d
cmpl %r12d, %r15d
jae 0x5102
movq %r14, %rdi
callq 0x4f3e
movq %rbx, %rdx
subq %rax, %rdx
jle 0x509e
movq %r14, %r13
movl %r12d, %r14d
movl %r15d, %eax
movq %rax, -0x48(%rbp)
movq -0x38(%rbp), %rcx
leaq (%rcx,%rax), %r12
movq -0x40(%rbp), %rdi
movq %r12, %rsi
callq 0x4e88
movl -0x2c(%rbp), %eax
movq -0x48(%rbp), %rcx
movq -0x38(%rbp), %rdx
cmpb %al, (%rdx,%rcx)
je 0x50d1
incl %r15d
movl %r14d, %r12d
movq %r13, %r14
movq %r14, %rdi
callq 0x4f3e
cmpq %rbx, %rax
jbe 0x504b
movl %r15d, %eax
movq -0x38(%rbp), %rcx
movb $0x0, (%rcx,%rax)
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3ca3(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x3b59(%rip), %rsi      # 0x8c28
jmp 0x511b
movb $0x0, (%r12)
movl %r15d, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movsbl -0x2c(%rbp), %edx
movl %r12d, %ecx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x4f94
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3c7f(%rip), %rcx      # 0x8d90
movq %rcx, (%rax)
leaq 0x3b85(%rip), %rsi      # 0x8ca0
movq 0x3ebe(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x3380
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/serial.cpp
// Function: Serial::Read(void*, unsigned int, unsigned int)
unsigned Serial::Read (void *Buffer,unsigned MaxNbBytes,unsigned TimeOut_ms)
{
   // Timer per gestire il timeout
   TimeOut Timer;

   // Inizializza il timer
   Timer.InitTimer();
   unsigned NbByteRead=0;
   while (Timer.ElapsedTime_ms()<TimeOut_ms || TimeOut_ms==0)
   {
      unsigned char* Ptr=(unsigned char*)Buffer+NbByteRead;
      int Ret=read(fd,(void*)Ptr,MaxNbBytes-NbByteRead);
      if (Ret==-1)
         throw ErrorReadException();
      if (Ret>0)
      {
         NbByteRead+=Ret;
         if (NbByteRead>=MaxNbBytes)
            return NbByteRead;
      }
   }
   throw TimeoutException();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %ebx
movl %edx, %r14d
movq %rsi, %r15
movq %rdi, %r12
leaq -0x40(%rbp), %rdi
callq 0x4f32
movl %ebx, %eax
movq %rax, -0x30(%rbp)
xorl %r13d, %r13d
leaq -0x40(%rbp), %rdi
callq 0x4f3e
testl %ebx, %ebx
je 0x516b
cmpq -0x30(%rbp), %rax
jae 0x51c9
movl %r13d, %esi
addq %r15, %rsi
movl (%r12), %edi
movl %r14d, %edx
subl %r13d, %edx
callq 0x32f0
movq %rax, %rcx
cmpl $-0x1, %ecx
je 0x51ae
leal (%rcx,%r13), %eax
cmpl %r14d, %eax
setb %dl
testl %ecx, %ecx
setle %cl
cmovgl %eax, %r13d
orb %dl, %cl
jne 0x5158
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3b83(%rip), %rcx      # 0x8d40
movq %rcx, (%rax)
leaq 0x3ac1(%rip), %rsi      # 0x8c88
jmp 0x51e2
pushq $0x8
popq %rdi
callq 0x30f0
leaq 0x3b90(%rip), %rcx      # 0x8d68
movq %rcx, (%rax)
leaq 0x3a46(%rip), %rsi      # 0x8c28
movq 0x3df7(%rip), %rdx      # 0x8fe0
movq %rax, %rdi
callq 0x3380
nop
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: DecodeInstruction(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string DecodeInstruction (string line) 
{
	// Necessario per analizzare linea componente per componente
	istringstream iss(line);
	string sub;
	iss >> sub;

	// Vengono chiamate diverse funzioni a seconda del valore di sub
	if (sub == "SDR")			return GenerateSDROutput (line);
	else if (sub == "SIR") 		return GenerateSIROutput (line);
	else if (sub == "STATE")	return GenerateSTATEOutput (line);
	else if (sub == "RUNTEST")	return GenerateRUNTESTOutput (line);
	else 
	{
		// Handler per altri casi
		return "";
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x228, %rsp            # imm = 0x228
movq %rsi, %r14
movq %rdi, %rbx
leaq -0x240(%rbp), %r15
pushq $0x8
popq %rdx
movq %r15, %rdi
callq 0x3360
leaq -0x30(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x40(%rbp), %rsi
movq %r15, %rdi
callq 0x32a0
leaq 0x123c(%rip), %rsi      # 0x65cb
leaq -0x40(%rbp), %rdi
callq 0x48e3
testb %al, %al
je 0x53c6
leaq -0xc0(%rbp), %rdi
movq %r14, %rsi
callq 0x32c0
leaq -0xc0(%rbp), %rsi
movq %rbx, %rdi
callq 0x54f4
leaq -0xc0(%rbp), %rdi
jmp 0x5463
leaq 0x139b(%rip), %rsi      # 0x6768
leaq -0x40(%rbp), %rdi
callq 0x48e3
testb %al, %al
je 0x5401
leaq -0xa0(%rbp), %rdi
movq %r14, %rsi
callq 0x32c0
leaq -0xa0(%rbp), %rsi
movq %rbx, %rdi
callq 0x56b9
leaq -0xa0(%rbp), %rdi
jmp 0x5463
leaq 0x1364(%rip), %rsi      # 0x676c
leaq -0x40(%rbp), %rdi
callq 0x48e3
testb %al, %al
je 0x5433
leaq -0x80(%rbp), %rdi
movq %r14, %rsi
callq 0x32c0
leaq -0x80(%rbp), %rsi
movq %rbx, %rdi
callq 0x587d
leaq -0x80(%rbp), %rdi
jmp 0x5463
leaq 0x1338(%rip), %rsi      # 0x6772
leaq -0x40(%rbp), %rdi
callq 0x48e3
testb %al, %al
je 0x548e
leaq -0x60(%rbp), %rdi
movq %r14, %rsi
callq 0x32c0
leaq -0x60(%rbp), %rsi
movq %rbx, %rdi
callq 0x5960
leaq -0x60(%rbp), %rdi
callq 0x30c0
leaq -0x40(%rbp), %rdi
callq 0x30c0
leaq -0x240(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x228, %rsp            # imm = 0x228
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xbc5(%rip), %rsi       # 0x605a
leaq -0x19(%rbp), %rdx
movq %rbx, %rdi
callq 0x46d0
jmp 0x5468
movq %rax, %rbx
leaq -0x60(%rbp), %rdi
jmp 0x54cd
jmp 0x54d4
movq %rax, %rbx
leaq -0x80(%rbp), %rdi
jmp 0x54cd
movq %rax, %rbx
leaq -0xa0(%rbp), %rdi
jmp 0x54cd
movq %rax, %rbx
leaq -0xc0(%rbp), %rdi
callq 0x30c0
jmp 0x54d7
movq %rax, %rbx
leaq -0x40(%rbp), %rdi
callq 0x30c0
leaq -0x240(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: GenerateSTATEOutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string GenerateSTATEOutput (string line)
{
		istringstream iss(line);
		string sub;

		// Scarta nome comando
		iss >> sub;
		// Prende nome stato
		iss >> sub;
		if (sub == "RESET;")
		{
			return "!!!!!*";
		}
		else if (sub == "IDLE;") 
		{
			return "*";
		}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
leaq -0x1b8(%rbp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x3360
leaq -0x28(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq -0x38(%rbp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq -0x1b8(%rbp), %rdi
leaq -0x38(%rbp), %rsi
callq 0x32a0
leaq 0xeae(%rip), %rsi       # 0x6781
leaq -0x38(%rbp), %rdi
callq 0x48e3
testb %al, %al
je 0x58f5
leaq 0xea1(%rip), %rsi       # 0x6788
leaq -0x11(%rbp), %rdx
movq %rbx, %rdi
callq 0x46d0
jmp 0x5918
leaq 0xe93(%rip), %rsi       # 0x678f
leaq -0x38(%rbp), %rdi
callq 0x48e3
leaq 0xe81(%rip), %rsi       # 0x678d
leaq -0x11(%rbp), %rdx
movq %rbx, %rdi
callq 0x46d0
leaq -0x38(%rbp), %rdi
callq 0x30c0
leaq -0x1b8(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r14
popq %rbp
retq
jmp 0x5940
jmp 0x5940
movq %rax, %rbx
leaq -0x38(%rbp), %rdi
callq 0x30c0
leaq -0x1b8(%rbp), %rdi
callq 0x30d0
movq %rbx, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: GenerateRUNTESTOutput(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string GenerateRUNTESTOutput (string line)
{
		istringstream iss(line);
		string sub, str;
		long int n;
		int i;

		// Scarta nome comando
		iss >> sub;
		iss >> n;

		// Impostiamo come massimo il numero di caratteri che possiamo inviare sulla seriale
		if(n > 1000)
			n = 1000;

		// Assumendo che i cicli di clock indicati siano divisibili per 4
		for (i=0; i < n/4; i++)
		{
			// Tanti '0' quanti sono i cicli di clock richiesti divisi per 4
			str += '0';
		}

		return str;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x1b0, %rsp            # imm = 0x1B0
movq %rdi, %rbx
leaq -0x1c8(%rbp), %r14
pushq $0x8
popq %rdx
movq %r14, %rdi
callq 0x3360
leaq -0x38(%rbp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
xorl %ecx, %ecx
movb %cl, (%rax)
leaq 0x10(%rbx), %rax
movq %rax, (%rbx)
andq $0x0, 0x8(%rbx)
movb %cl, 0x10(%rbx)
leaq -0x48(%rbp), %rsi
movq %r14, %rdi
callq 0x32a0
leaq -0x1c8(%rbp), %rdi
leaq -0x28(%rbp), %rsi
callq 0x3230
movq -0x28(%rbp), %rax
cmpq $0x3e8, %rax            # imm = 0x3E8
jle 0x59dc
movq $0x3e8, -0x28(%rbp)     # imm = 0x3E8
movl $0x3e8, %eax            # imm = 0x3E8
xorl %r15d, %r15d
pushq $0x4
popq %r12
pushq $0x30
popq %r14
cqto
idivq %r12
cmpq %r15, %rax
jle 0x5a05
movq %rbx, %rdi
movl %r14d, %esi
callq 0x31c0
incq %r15
movq -0x28(%rbp), %rax
jmp 0x59e7
leaq -0x48(%rbp), %rdi
callq 0x30c0
leaq -0x1c8(%rbp), %rdi
callq 0x30d0
movq %rbx, %rax
addq $0x1b0, %rsp            # imm = 0x1B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
jmp 0x5a2f
movq %rax, %r14
movq %rbx, %rdi
callq 0x30c0
leaq -0x48(%rbp), %rdi
callq 0x30c0
leaq -0x1c8(%rbp), %rdi
callq 0x30d0
movq %r14, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: hexCharToBin[abi:cxx11](char)
string hexCharToBin(char c)	// Funzione di conversione valore esadecimale in valore binario
{
    switch(toupper(c))
    {
        case '0': return "0000";
        case '1': return "0001";
        case '2': return "0010";
        case '3': return "0011";
        case '4': return "0100";
        case '5': return "0101";
        case '6': return "0110";
        case '7': return "0111";
        case '8': return "1000";
        case '9': return "1001";
        case 'A': return "1010";
        case 'B': return "1011";
        case 'C': return "1100";
        case 'D': return "1101";
        case 'E': return "1110";
        case 'F': return "1111";
    }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl %esi, %edi
callq 0x33c0
addl $-0x30, %eax
leaq 0xc9b(%rip), %rcx       # 0x670c
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
leaq 0xd14(%rip), %rsi       # 0x6795
jmp 0x5b0b
leaq 0xd3f(%rip), %rsi       # 0x67cc
jmp 0x5b0b
leaq 0xd3b(%rip), %rsi       # 0x67d1
jmp 0x5b0b
leaq 0xd0a(%rip), %rsi       # 0x67a9
jmp 0x5b0b
leaq 0xd1a(%rip), %rsi       # 0x67c2
jmp 0x5b0b
leaq 0xd2f(%rip), %rsi       # 0x67e0
jmp 0x5b0b
leaq 0xce5(%rip), %rsi       # 0x679f
jmp 0x5b0b
leaq 0xce1(%rip), %rsi       # 0x67a4
jmp 0x5b0b
leaq 0xd0a(%rip), %rsi       # 0x67d6
jmp 0x5b0b
leaq 0xce3(%rip), %rsi       # 0x67b8
jmp 0x5b0b
leaq 0xce9(%rip), %rsi       # 0x67c7
jmp 0x5b0b
leaq 0xcb3(%rip), %rsi       # 0x679a
jmp 0x5b0b
leaq 0xcbe(%rip), %rsi       # 0x67ae
jmp 0x5b0b
leaq 0xcba(%rip), %rsi       # 0x67b3
jmp 0x5b0b
leaq 0xcbb(%rip), %rsi       # 0x67bd
jmp 0x5b0b
leaq 0xcd0(%rip), %rsi       # 0x67db
leaq -0x9(%rbp), %rdx
movq %rbx, %rdi
callq 0x46d0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/mattdibi[P]Programmatore-JTAG-per-Xilinx/svftoserial.cpp
// Function: hexstrToBinstr(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
string hexstrToBinstr(string hex)	// Funzione di conversione stringa esadecimale in stringa binaria
{
		string bin;

		for(unsigned k = 0; k != hex.length(); ++k)
		{
			bin += hexCharToBin(hex[k]);
		}

		return bin;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
movq %rdi, %rbx
leaq 0x10(%rdi), %rax
movq %rax, (%rdi)
andq $0x0, 0x8(%rdi)
movq %rsi, %r14
movb $0x0, 0x10(%rdi)
xorl %r12d, %r12d
leaq -0x40(%rbp), %r15
movl %r12d, %r12d
cmpq %r12, 0x8(%r14)
je 0x5b7e
movq (%r14), %rax
movsbl (%rax,%r12), %esi
movq %r15, %rdi
callq 0x5a57
movq %rbx, %rdi
movq %r15, %rsi
callq 0x33f0
movq %r15, %rdi
callq 0x30c0
incl %r12d
jmp 0x5b4d
movq %rbx, %rax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r14
jmp 0x5b9f
movq %rax, %r14
leaq -0x40(%rbp), %rdi
callq 0x30c0
movq %rbx, %rdi
callq 0x30c0
movq %r14, %rdi
callq 0x3390
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::~timer_qheap()
timer_qheap::~timer_qheap() {
    if (this->tfd != -1) {
        ::close(this->tfd);
        this->tfd = -1;
    }
    for (const auto &v : this->qheap)
        delete v;
    this->qheap.clear();
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x8244(%rip), %rax      # 0x11fb0
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x30(%rdi), %edi
cmpl $-0x1, %edi
je 0x9d84
callq 0x9bc0
orl $-0x1, 0x30(%rbx)
leaq 0x40(%rbx), %r14
movq 0x40(%rbx), %r15
movq 0x48(%rbx), %r12
cmpq %r12, %r15
je 0x9da3
movq (%r15), %rdi
callq 0x9690
addq $0x8, %r15
jmp 0x9d90
movq 0x40(%rbx), %rax
cmpq %rax, 0x48(%rbx)
je 0x9db1
movq %rax, 0x48(%rbx)
movq %r14, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x97b0
movq %rax, %rdi
callq 0xa1e5
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::open()
int timer_qheap::open() {
    int fd = ::timerfd_create(CLOCK_BOOTTIME, TFD_NONBLOCK|TFD_CLOEXEC);
    if (fd == -1) {
        fprintf(stderr, "reactor: timerfd_create fail! %s\n", strerror(errno));
        return -1;
    }
    this->tfd = fd;
    return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
pushq $0x7
popq %rdi
movl $0x80800, %esi          # imm = 0x80800
callq 0x9ab0
cmpl $-0x1, %eax
je 0x9dfb
movl %eax, 0x30(%rbx)
xorl %eax, %eax
popq %rbx
retq
movq 0x81ce(%rip), %rax      # 0x11fd0
movq (%rax), %rbx
callq 0x9060
movl (%rax), %edi
callq 0x91d0
leaq 0x41e8(%rip), %rsi      # 0xe000
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x9940
pushq $-0x1
popq %rax
jmp 0x9df9
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::adjust_timerfd(long)
void timer_qheap::adjust_timerfd(int64_t delay /*millisecond*/) {
    struct timespec ts;
    ts.tv_sec = delay / 1000;
    ts.tv_nsec = delay % 1000 * 1000 * 1000;
    if (delay < 1)
        ts.tv_nsec = 1;
    struct itimerspec its;
    ::memset(&its, 0, sizeof(its));
    its.it_value = ts;
    ::timerfd_settime(this->tfd, 0 /*Relative time*/, &its, nullptr);
}

// Assembly:
subq $0x28, %rsp
movl $0x3e8, %ecx            # imm = 0x3E8
movq %rsi, %rax
xorl %edx, %edx
divq %rcx
imulq $0xf4240, %rdx, %rax    # imm = 0xF4240
testq %rsi, %rsi
pushq $0x1
popq %r8
cmovgq %rax, %r8
movq %rsi, %rax
cqto
idivq %rcx
xorps %xmm0, %xmm0
movq %rsp, %rdx
movaps %xmm0, (%rdx)
movq %rax, 0x10(%rdx)
movq %r8, 0x18(%rdx)
movl 0x30(%rdi), %edi
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x9530
addq $0x28, %rsp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::schedule(ev_handler*, int, int)
int timer_qheap::schedule(ev_handler *eh, const int delay, const int interval) {
    if (eh == nullptr)
        return -1;

    struct timeval tv;
    ::gettimeofday(&tv, nullptr);
    int64_t now = int64_t(tv.tv_sec) * 1000 + tv.tv_usec / 1000; // millisecond
    auto item = new timer_item();
    item->eh = eh;
    item->expire_at = now + delay;
    item->interval = interval;
    eh->set_timer(item);
    this->insert(item);

    auto min = this->qheap[0];
    if (min->expire_at != this->timerfd_settime) {
        this->adjust_timerfd(min->expire_at - now);
        this->timerfd_settime = min->expire_at;
    }
    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
testq %rsi, %rsi
je 0x9f18
movl %ecx, %ebp
movl %edx, %r12d
movq %rsi, %r15
movq %rdi, %r14
xorl %ebx, %ebx
leaq 0x8(%rsp), %r13
movq %r13, %rdi
xorl %esi, %esi
callq 0x9a00
imulq $0x3e8, (%r13), %rcx    # imm = 0x3E8
movq 0x8(%r13), %rax
movl $0x3e8, %esi            # imm = 0x3E8
cqto
idivq %rsi
movq %rax, %r13
addq %rcx, %r13
pushq $0x18
popq %rdi
callq 0x96c0
andq $0x0, (%rax)
movq %r15, 0x10(%rax)
movslq %r12d, %rcx
addq %r13, %rcx
movq %rcx, 0x8(%rax)
movl %ebp, (%rax)
movq %rax, 0x28(%r15)
movq %r14, %rdi
movq %rax, %rsi
callq 0x9640
movq 0x40(%r14), %rax
movq (%rax), %r15
movq 0x8(%r15), %rsi
cmpq 0x38(%r14), %rsi
je 0x9f1b
subq %r13, %rsi
movq %r14, %rdi
callq 0x9090
movq 0x8(%r15), %rax
movq %rax, 0x38(%r14)
jmp 0x9f1b
pushq $-0x1
popq %rbx
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::shift_up(int)
void timer_qheap::shift_up(int idx) {
    auto item = this->qheap[idx];
    while (idx > 0
        && item->expire_at < this->qheap[get_parent_index(idx)]->expire_at) {
        this->qheap[idx] = this->qheap[get_parent_index(idx)];
        idx = get_parent_index(idx);
    }
    this->qheap[idx] = item;
}

// Assembly:
movslq %esi, %rax
movq 0x40(%rdi), %rcx
movq (%rcx,%rax,8), %rax
testl %esi, %esi
jle 0x9f79
movq 0x8(%rax), %r9
leal -0x1(%rsi), %edx
shrl $0x2, %edx
movq (%rcx,%rdx,8), %r8
cmpq 0x8(%r8), %r9
jge 0x9f79
movl %esi, %esi
movq %r8, (%rcx,%rsi,8)
movq 0x40(%rdi), %rcx
movl %edx, %esi
jmp 0x9f53
movslq %esi, %rdx
movq %rax, (%rcx,%rdx,8)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::shift_down(int)
void timer_qheap::shift_down(int idx) {
    int min_child = 0;
    auto item = this->qheap[idx];
    while (true) {
        min_child = get_child_index(idx, 0);
        if (min_child >= static_cast<int>(this->qheap.size()))
            break;

        for (int i = 1; i < 4; ++i) {
            int child_idx = get_child_index(idx, i);
            if (child_idx < static_cast<int>(this->qheap.size())
                && this->qheap[child_idx]->expire_at < this->qheap[min_child]->expire_at)
                min_child = child_idx;
        }

        if (this->qheap[min_child]->expire_at >= item->expire_at)
            break;

        this->qheap[idx] = this->qheap[min_child];
        idx = min_child;
    }
    this->qheap[idx] = item;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movslq %esi, %rax
movq 0x40(%rdi), %rcx
movq (%rcx,%rax,8), %rax
leal 0x1(,%rsi,4), %edx
movq 0x48(%rdi), %r9
subq %rcx, %r9
shrq $0x3, %r9
movslq %esi, %r8
cmpl %r9d, %edx
jge 0xa011
shll $0x2, %esi
movslq %esi, %rsi
movslq %r9d, %r9
movl %esi, %r10d
addq $0x2, %r10
leaq (%rcx,%rsi,8), %r11
addq $0x10, %r11
addq $0x2, %rsi
xorl %ebx, %ebx
movslq %edx, %r14
cmpq $0x3, %rbx
je 0x9ff7
leaq (%rsi,%rbx), %r15
cmpq %r9, %r15
jge 0x9ff2
movq (%r11,%rbx,8), %r15
movq 0x8(%r15), %r15
movq (%rcx,%r14,8), %r14
cmpq 0x8(%r14), %r15
jge 0x9ff2
leal (%r10,%rbx), %edx
incq %rbx
jmp 0x9fca
movq (%rcx,%r14,8), %rsi
movq 0x8(%rsi), %r9
cmpq 0x8(%rax), %r9
jge 0xa011
movq %rsi, (%rcx,%r8,8)
movq 0x40(%rdi), %rcx
movl %edx, %esi
jmp 0x9f92
movq %rax, (%rcx,%r8,8)
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/timer_qheap.cpp
// Function: timer_qheap::on_read()
bool timer_qheap::on_read() {
    int64_t v = 0;
    int ret = 0;
    do {
        ret = ::read(this->tfd, &v, sizeof(v));
        if (ret == -1 && errno == EINTR)
            continue;
    } while (false); 

    struct timeval tv;
    ::gettimeofday(&tv, nullptr);
    int64_t now = int64_t(tv.tv_sec) * 1000 + tv.tv_usec / 1000; // millisecond
    auto delay = this->handle_expired(now);
    if (delay > 0)
        this->adjust_timerfd(delay);
    return true;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
movq %rsp, %rsi
andq $0x0, (%rsi)
movl 0x30(%rdi), %edi
pushq $0x8
popq %rdx
callq 0x9960
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x9a00
imulq $0x3e8, (%r14), %rsi    # imm = 0x3E8
movq 0x8(%r14), %rax
movl $0x3e8, %ecx            # imm = 0x3E8
cqto
idivq %rcx
addq %rax, %rsi
movq %rbx, %rdi
callq 0x9460
testq %rax, %rax
jle 0xa14b
movq %rbx, %rdi
movq %rax, %rsi
callq 0x9090
movb $0x1, %al
addq $0x18, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poller.cpp
// Function: poller::destroy()
void poller::destroy() {
    if (this->efd == -1) {
        ::close(this->efd);
        this->efd = -1;
    }
    if (this->poll_descs != nullptr) {
        delete this->poll_descs;
        this->poll_descs = nullptr;
    }
    if (this->ready_events != nullptr) {
        delete[] this->ready_events;
        this->ready_events = nullptr;
    }
    if (this->io_buf != nullptr) {
        delete[] this->io_buf;
        this->io_buf = nullptr;
    }
    if (this->timer != nullptr) {
        delete this->timer;
        this->timer = nullptr;
    }
    if (this->async_sendq != nullptr) {
        delete this->async_sendq;
        this->async_sendq = nullptr;
    }
    if (this->poll_sync_opterate != nullptr) {
        delete this->poll_sync_opterate;
        this->poll_sync_opterate = nullptr;
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
cmpl $-0x1, 0x4(%rdi)
jne 0xa637
pushq $-0x1
popq %rdi
callq 0x9bc0
orl $-0x1, 0x4(%rbx)
movq 0x30(%rbx), %r14
testq %r14, %r14
je 0xa655
movq %r14, %rdi
callq 0x9730
movq %r14, %rdi
callq 0x9690
andq $0x0, 0x30(%rbx)
movq 0x18(%rbx), %rdi
testq %rdi, %rdi
je 0xa668
callq 0x9830
andq $0x0, 0x18(%rbx)
movq 0x10(%rbx), %rdi
testq %rdi, %rdi
je 0xa67b
callq 0x9830
andq $0x0, 0x10(%rbx)
movq 0x20(%rbx), %rdi
testq %rdi, %rdi
je 0xa68f
movq (%rdi), %rax
callq *0x8(%rax)
andq $0x0, 0x20(%rbx)
movq 0x28(%rbx), %rdi
testq %rdi, %rdi
je 0xa6a3
movq (%rdi), %rax
callq *0x8(%rax)
andq $0x0, 0x28(%rbx)
movq 0x38(%rbx), %rdi
testq %rdi, %rdi
je 0xa6b7
movq (%rdi), %rax
callq *0x8(%rax)
andq $0x0, 0x38(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poller.cpp
// Function: poller::add(ev_handler*, int, unsigned int)
int poller::add(ev_handler *eh, const int fd, const uint32_t ev) {
    eh->set_poller(this);
    int64_t seq = this->seq.fetch_add(1, std::memory_order_relaxed);
    eh->set_seq(seq);
    auto pd = this->poll_descs->new_one(fd);
    pd->fd = fd;
    pd->eh = eh;
    pd->events = ev;
    pd->seq = seq;
    this->poll_descs->store(fd, pd);

    struct epoll_event epev;
    epev.events = ev;
    epev.data.ptr = pd;

    if (::epoll_ctl(this->efd, EPOLL_CTL_ADD, fd, &epev) == 0)
        return 0;
    this->poll_descs->del(fd);
    return -1;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq %rdi, 0x18(%rsi)
pushq $0x1
popq %r13
lock
xaddq %r13, 0x48(%rdi)
movl %ecx, %r15d
movl %edx, %ebp
movq %r13, 0x10(%rsi)
movq 0x30(%rdi), %rdi
movl %edx, %esi
callq 0x9770
movq %rax, %r12
movl %ebp, (%rax)
movq %r14, 0x10(%rax)
movl %r15d, 0x4(%rax)
movq %r13, 0x8(%rax)
movq 0x30(%rbx), %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x9930
leaq 0xc(%rsp), %rcx
movl %r15d, (%rcx)
movq %r12, 0x4(%rcx)
movl 0x4(%rbx), %edi
pushq $0x1
popq %rsi
movl %ebp, %edx
callq 0x98e0
testl %eax, %eax
je 0xa742
movq 0x30(%rbx), %rdi
movl %ebp, %esi
callq 0x9c10
pushq $-0x1
popq %rax
jmp 0xa744
xorl %eax, %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/shaovie[P]reactor/src/poller.cpp
// Function: poller::append(int, unsigned int)
int poller::append(const int fd, const uint32_t ev) {
    auto pd = this->poll_descs->load(fd);
    if (pd == nullptr)
        return -1;

    // Always save first, recover if failed  (this method is for multi-threading scenarios)."
    pd->events |= ev;
    
    struct epoll_event epev;
    epev.events = pd->events;
    epev.data.ptr = pd;
    if (::epoll_ctl(this->efd, EPOLL_CTL_MOD, fd, &epev) != 0) {
        pd->events &= ~ev;
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movl %esi, %ebp
movq %rdi, %r15
movq 0x30(%rdi), %rdi
callq 0x9850
testq %rax, %rax
je 0xa7e2
movq %rax, %r14
movl 0x4(%rax), %eax
orl %ebx, %eax
movl %eax, 0x4(%r14)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
movq %r14, 0x4(%rcx)
movl 0x4(%r15), %edi
pushq $0x3
popq %rsi
movl %ebp, %edx
callq 0x98e0
testl %eax, %eax
je 0xa7e7
notl %ebx
andl %ebx, 0x4(%r14)
pushq $-0x1
popq %rax
jmp 0xa7e9
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poller.cpp
// Function: poller::remove(int, unsigned int)
int poller::remove(const int fd, const uint32_t ev) {
    if (ev == ev_handler::ev_all) {
        this->poll_descs->del(fd);
        return ::epoll_ctl(this->efd, EPOLL_CTL_DEL, fd, nullptr);
    }
    auto pd = this->poll_descs->load(fd);
    if (pd == nullptr)
        return -1;
    if ((pd->events & (~ev)) == 0) {
        this->poll_descs->del(fd);
        return ::epoll_ctl(this->efd, EPOLL_CTL_DEL, fd, nullptr);
    }

    // Always save first, recover if failed  (this method is for multi-threading scenarios)."
    pd->events &= (~ev);

    struct epoll_event epev;
    epev.events = pd->events;
    epev.data.ptr = pd;
    if (::epoll_ctl(this->efd, EPOLL_CTL_MOD, fd, &epev) != 0) {
        pd->events |= ev;
        return -1;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x18, %rsp
movl %esi, %ebx
movq %rdi, %r14
movq 0x30(%rdi), %rdi
cmpl $0x2005, %edx           # imm = 0x2005
jne 0xa830
movl %ebx, %esi
callq 0x9c10
movl 0x4(%r14), %edi
pushq $0x2
popq %rsi
movl %ebx, %edx
xorl %ecx, %ecx
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x98e0
movl %edx, %ebp
movl %ebx, %esi
callq 0x9850
testq %rax, %rax
je 0xa870
movq %rax, %r15
movl %ebp, %eax
notl %eax
andl 0x4(%r15), %eax
je 0xa87e
movl %eax, 0x4(%r15)
leaq 0xc(%rsp), %rcx
movl %eax, (%rcx)
movq %r15, 0x4(%rcx)
movl 0x4(%r14), %edi
pushq $0x3
popq %rsi
movl %ebx, %edx
callq 0x98e0
testl %eax, %eax
je 0xa884
orl %ebp, 0x4(%r15)
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x30(%r14), %rdi
jmp 0xa80f
xorl %eax, %eax
jmp 0xa873
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poller.cpp
// Function: poller::set_cpu_affinity()
void poller::set_cpu_affinity() {
    if (this->cpu_id == -1)
        return;
    cpu_set_t cpu_set;
    CPU_ZERO(&cpu_set);
    CPU_SET(this->cpu_id, &cpu_set);
    if (pthread_setaffinity_np(pthread_self(), sizeof(cpu_set_t), &cpu_set) != 0)
        fprintf(stderr, "reactor: set cpu affinity fail! %s\n", strerror(errno));
}

// Assembly:
movl (%rdi), %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpq %rax, %rcx
je 0xa8fc
pushq %rbx
subq $0x80, %rsp
xorps %xmm0, %xmm0
movaps %xmm0, 0x70(%rsp)
movaps %xmm0, 0x60(%rsp)
movaps %xmm0, 0x50(%rsp)
movaps %xmm0, 0x40(%rsp)
movaps %xmm0, 0x30(%rsp)
movaps %xmm0, 0x20(%rsp)
movaps %xmm0, 0x10(%rsp)
movaps %xmm0, (%rsp)
cmpl $0x3ff, %ecx            # imm = 0x3FF
ja 0xa8db
pushq $0x1
popq %rax
shlq %cl, %rax
shrl $0x6, %ecx
orq %rax, (%rsp,%rcx,8)
callq 0x95f0
movq %rsp, %rdx
movl $0x80, %esi
movq %rax, %rdi
callq 0x9a80
testl %eax, %eax
jne 0xa8fd
addq $0x80, %rsp
popq %rbx
retq
movq 0x76cc(%rip), %rax      # 0x11fd0
movq (%rax), %rbx
callq 0x9060
movl (%rax), %edi
callq 0x91d0
leaq 0x381c(%rip), %rsi      # 0xe136
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x9940
jmp 0xa8f4
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::~poll_desc_map()
~poll_desc_map() {
        if (this->arr != nullptr)
            delete[] this->arr;
        this->mtx.lock();
        for (const auto &kv : this->map)
            delete kv.second;
        
        this->mtx.unlock();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rdi
testq %rdi, %rdi
je 0xac00
callq 0x9830
leaq 0x48(%rbx), %r14
movq %r14, %rdi
callq 0x9b60
leaq 0x20(%rbx), %r15
movq (%r15), %r15
testq %r15, %r15
je 0xac23
movq 0x10(%r15), %rdi
callq 0x9690
jmp 0xac10
addq $0x10, %rbx
movq %r14, %rdi
callq 0x9510
movq %rbx, %rdi
popq %rbx
popq %r14
popq %r15
jmp 0x9100
movq %rax, %rdi
callq 0xa1e5
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::store(int, poll_desc*)
inline void store(const int i, poll_desc *v) {
        if (i < this->arr_size)
            return;

        this->mtx.lock();
        this->map[i] = v;
        this->mtx.unlock();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, 0xc(%rsp)
cmpl %esi, (%rdi)
jg 0xacb3
movq %rdx, %rbx
movq %rdi, %r14
leaq 0x48(%rdi), %r15
movq %r15, %rdi
callq 0x9b60
addq $0x10, %r14
leaq 0xc(%rsp), %rsi
movq %r14, %rdi
callq 0x9b50
movq %rbx, (%rax)
movq %r15, %rdi
callq 0x9510
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::del(int)
void del(const int i) {
        if (i < this->arr_size) {
            poll_desc *p = &(this->arr[i]);
            p->events =  0;
            p->fd     = -1;
            p->seq    = -1;
            p->eh     = nullptr;
            return;
        }
        this->mtx.lock();
        auto ret = this->map.find(i);
        if (ret != this->map.end()) {
            delete ret->second;
            this->map.erase(ret);
        }
        this->mtx.unlock();
    }

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl %esi, 0xc(%rsp)
cmpl %esi, (%rdi)
jle 0xacf4
movq 0x8(%rbx), %rax
movslq %esi, %rcx
imulq $0x18, %rcx, %rcx
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq %rdx, (%rax,%rcx)
orq $-0x1, 0x8(%rax,%rcx)
andq $0x0, 0x10(%rax,%rcx)
jmp 0xad35
leaq 0x48(%rbx), %r14
movq %r14, %rdi
callq 0x9b60
addq $0x10, %rbx
leaq 0xc(%rsp), %rsi
movq %rbx, %rdi
callq 0x9950
testq %rax, %rax
je 0xad2d
movq %rax, %r15
movq 0x10(%rax), %rdi
callq 0x9690
movq %rbx, %rdi
movq %r15, %rsi
callq 0x9900
movq %r14, %rdi
callq 0x9510
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_desc.h
// Function: poll_desc_map::load(int)
inline poll_desc *load(const int i) {
        if (i < this->arr_size) {
            poll_desc *p = &(this->arr[i]);
            if (p->fd == -1)
                return nullptr;
            return p;
        }
        std::lock_guard<std::mutex> g(this->mtx);
        auto ret = this->map.find(i);
        if (ret != this->map.end())
            return ret->second;

        return nullptr;
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %r14
movl %esi, 0x4(%rsp)
cmpl %esi, (%rdi)
jle 0xad6b
movq 0x8(%r14), %rax
movslq %esi, %rcx
imulq $0x18, %rcx, %rcx
leaq (%rax,%rcx), %rdx
xorl %r14d, %r14d
cmpl $-0x1, (%rax,%rcx)
cmovneq %rdx, %r14
jmp 0xad9e
leaq 0x48(%r14), %rbx
movq %rbx, %rdi
callq 0x9b60
addq $0x10, %r14
leaq 0x4(%rsp), %rsi
movq %r14, %rdi
callq 0x9950
testq %rax, %rax
je 0xad93
movq 0x10(%rax), %r14
jmp 0xad96
xorl %r14d, %r14d
movq %rbx, %rdi
callq 0x9510
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x9510
movq %r14, %rdi
callq 0x9aa0
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::~poll_sync_opt()
poll_sync_opt::~poll_sync_opt() {
   if (this->efd != -1)
        ::close(this->efd);
    
   if (this->readq != nullptr)
       delete this->readq;
   if (this->writeq != nullptr)
       delete this->writeq;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq 0x6ba6(%rip), %rax      # 0x11fc0
addq $0x10, %rax
movq %rax, (%rdi)
movl 0x30(%rdi), %edi
cmpl $-0x1, %edi
je 0xb42e
callq 0x9bc0
movq 0x68(%rbx), %r14
testq %r14, %r14
je 0xb447
movq %r14, %rdi
callq 0x98d0
movq %r14, %rdi
callq 0x9690
movq 0x70(%rbx), %rbx
testq %rbx, %rbx
je 0xb467
movq %rbx, %rdi
callq 0x98d0
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x9690
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0xa1e5
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::do_sync(poll_sync_opt::opt_arg const&)
void poll_sync_opt::do_sync(const poll_sync_opt::opt_arg &arg) {
    if (arg.type == poll_sync_opt::sync_cache_t) {
        auto p = (poll_sync_opt::sync_cache *)arg.arg;
        this->poll->poll_cache_set(p->id, p->value, p->free_func);
        delete p;
    }
}

// Assembly:
cmpl $0x1, (%rsi)
jne 0xb4b6
pushq %rbx
movq 0x8(%rsi), %rbx
movq 0x18(%rdi), %rdi
movl (%rbx), %esi
movq 0x8(%rbx), %rdx
movq 0x10(%rbx), %rcx
callq 0x9590
movq %rbx, %rdi
popq %rbx
jmp 0x9690
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/shaovie[P]reactor/src/poll_sync_opt.cpp
// Function: poll_sync_opt::open(poller*)
int poll_sync_opt::open(poller *poll) {
    int fd = ::eventfd(0, EFD_NONBLOCK|EFD_CLOEXEC);
    if (fd == -1) {
        fprintf(stderr, "reactor: create eventfd fail! %s\n", strerror(errno));
        return -1;
    }
    if (poll->add(this, fd, ev_handler::ev_read) == -1) {
        fprintf(stderr, "reactor: add eventfd to poller fail! %s\n", strerror(errno));
        ::close(fd);
        return -1;
    }
    this->efd = fd;
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
xorl %edi, %edi
movl $0x80800, %esi          # imm = 0x80800
callq 0x9800
cmpl $-0x1, %eax
je 0xb4f9
movl %eax, %ebx
movq %r15, %rdi
movq %r14, %rsi
movl %eax, %edx
movl $0x2001, %ecx           # imm = 0x2001
callq 0x9b70
cmpl $-0x1, %eax
je 0xb525
movl %ebx, 0x30(%r14)
xorl %eax, %eax
popq %rbx
popq %r14
popq %r15
retq
movq 0x6ad0(%rip), %rax      # 0x11fd0
movq (%rax), %rbx
callq 0x9060
movl (%rax), %edi
callq 0x91d0
leaq 0x2c68(%rip), %rsi      # 0xe17e
movq %rbx, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x9940
jmp 0xb556
movq 0x6aa4(%rip), %rax      # 0x11fd0
movq (%rax), %r14
callq 0x9060
movl (%rax), %edi
callq 0x91d0
leaq 0x2c5e(%rip), %rsi      # 0xe1a0
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x9940
movl %ebx, %edi
callq 0x9bc0
pushq $-0x1
popq %rax
jmp 0xb4f3
nop