LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/sstable.cc
// Function: sstable::getAllValues(int)
opStatus sstable::getAllValues(int clientSocket) {
  std::ifstream readfd;
  openFileToRead(readfd);
  unsigned char ch;
  while(readfd.peek() != EOF) {
    readfd >> ch;
    std::string data((int)ch, '\0');
    readfd.read(&data[0], (int)ch);
    std::cout << "Read key : " << data << " from SSTable!" << std::endl;
    readfd >> ch;
    std::string val((int)ch, '\0');
    readfd.read(&val[0], (int)ch);
    sendToClient(clientSocket, data+" -------> "+val+"\n");
  }
  closeFileAfterRead(readfd);
  return opStatus::opSuccess;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x2b8, %rsp            # imm = 0x2B8
movl %esi, 0xc(%rsp)
movq %rdi, %rbx
leaq 0xb0(%rsp), %r14
movq %r14, %rdi
callq 0x5450
movq %rbx, %rdi
movq %r14, %rsi
callq 0x14af6
leaq 0xb0(%rsp), %r14
leaq 0x30(%rsp), %r12
leaq 0x10(%rsp), %rbp
leaq 0x50(%rsp), %r13
leaq 0x70(%rsp), %rbx
leaq 0x90(%rsp), %r15
movq %r14, %rdi
callq 0x5180
cmpl $-0x1, %eax
je 0x14f1c
movq %r14, %rdi
leaq 0xb(%rsp), %rsi
callq 0x5510
movzbl 0xb(%rsp), %esi
leaq 0x40(%rsp), %rax
movq %rax, 0x30(%rsp)
movq %r12, %rdi
xorl %edx, %edx
callq 0x5470
movq 0x30(%rsp), %rsi
movzbl 0xb(%rsp), %edx
movq %r14, %rdi
callq 0x54d0
movq 0x10175(%rip), %rdi     # 0x24fc0
leaq 0x3384(%rip), %rsi      # 0x181d6
callq 0x53b0
movq %rax, %rdi
movq %r12, %rsi
callq 0x5370
movq %rax, %rdi
leaq 0x36a6(%rip), %rsi      # 0x18512
callq 0x53b0
movq %rax, %rdi
callq 0x5210
movq %r14, %rdi
leaq 0xb(%rsp), %rsi
callq 0x5510
movzbl 0xb(%rsp), %esi
leaq 0x20(%rsp), %rax
movq %rax, 0x10(%rsp)
movq %rbp, %rdi
xorl %edx, %edx
callq 0x5470
movq 0x10(%rsp), %rsi
movzbl 0xb(%rsp), %edx
movq %r14, %rdi
callq 0x54d0
movq %r13, %rdi
movq %r12, %rsi
leaq 0x332f(%rip), %rdx      # 0x181ed
callq 0x13497
movq %rbx, %rdi
movq %r13, %rsi
movq %rbp, %rdx
callq 0x13478
movq %r15, %rdi
movq %rbx, %rsi
leaq 0x2505(%rip), %rdx      # 0x173e3
callq 0x13375
movl 0xc(%rsp), %edi
movq %r15, %rsi
callq 0x1677c
movq %r15, %rdi
callq 0x51d0
movq %rbx, %rdi
callq 0x51d0
movq %r13, %rdi
callq 0x51d0
movq %rbp, %rdi
callq 0x51d0
movq %r12, %rdi
callq 0x51d0
jmp 0x14dfb
leaq 0xb0(%rsp), %rdi
callq 0x50a0
leaq 0xb0(%rsp), %rdi
callq 0x50e0
xorl %eax, %eax
addq $0x2b8, %rsp            # imm = 0x2B8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x14f93
jmp 0x14f93
movq %rax, %rbx
jmp 0x14f72
movq %rax, %rbx
jmp 0x14f68
movq %rax, %rbx
leaq 0x90(%rsp), %rdi
callq 0x51d0
leaq 0x70(%rsp), %rdi
callq 0x51d0
leaq 0x50(%rsp), %rdi
callq 0x51d0
jmp 0x14f87
jmp 0x14f98
jmp 0x14f84
jmp 0x14f93
movq %rax, %rbx
leaq 0x10(%rsp), %rdi
callq 0x51d0
jmp 0x14f9b
movq %rax, %rbx
jmp 0x14fa5
movq %rax, %rbx
leaq 0x30(%rsp), %rdi
callq 0x51d0
leaq 0xb0(%rsp), %rdi
callq 0x50e0
movq %rbx, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/sstableWrapper.cc
// Function: sstableWrapper::getValueFromKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>, int)
opStatus sstableWrapper::getValueFromKey(std::string key, int clientSocket) {
  std::list<sstable*>::reverse_iterator iter;
  int count = 0;
  for(iter = sstableObjRefList.rbegin();
      iter != sstableObjRefList.rend();
      ++iter) {
    ++count;
    // Check the in-memory bloom filter first.
    if(!((*iter)->isKeyPresent(key))) {
      continue;
    }
    // Now the SSTable may contain the key.
    opStatus ret = (*iter)->getValueFromKey(key, clientSocket);
    // The key is found in the SSTable then the return will be opSuccess.
    if(ret == opStatus::opSuccess) {
      std::cout << "Checked " << count << " SSTables and found!" << std::endl;
      return ret;
    }
    // The key is found as a tombstone.
    if(ret == opStatus::opKeyNotFound) {
      std::cout << "Checked " << count << " SSTables but NOT found!" 
                << std::endl;
      return ret;
    }
  }
  std::cout << "Checked " << count << " SSTables but NOT found!" << std::endl;
  return opStatus::opKeyNotFound;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x58, %rsp
movl %edx, 0x4(%rsp)
movq %rsi, 0x10(%rsp)
movq %rdi, %r14
addq $0x8, %r14
xorl %ebp, %ebp
leaq 0x18(%rsp), %rbx
leaq 0x38(%rsp), %r12
movq %r14, %r13
movq %rbx, 0x8(%rsp)
cmpq (%r14), %r13
je 0x15dea
movq 0x8(%r13), %rax
movq 0x10(%rax), %r15
movq %rbx, %rdi
movq 0x10(%rsp), %rsi
callq 0x5540
movq %r15, %rdi
movq %rbx, %rsi
callq 0x14b22
movl %eax, %r15d
movq %rbx, %rdi
callq 0x51d0
testb %r15b, %r15b
je 0x15ddf
movl %ebp, %ebx
movq %r14, %rbp
movq 0x8(%r13), %rax
movq 0x10(%rax), %r15
movq %r12, %r14
movq %r12, %rdi
movq 0x10(%rsp), %rsi
callq 0x5540
movq %r15, %rdi
movq %r12, %rsi
movl 0x4(%rsp), %edx
callq 0x14b70
movl %eax, %r15d
movq %r14, %rdi
callq 0x51d0
testl %r15d, %r15d
je 0x15df0
cmpl $0x2, %r15d
movq %rbp, %r14
movl %ebx, %ebp
leaq 0x18(%rsp), %rbx
je 0x15dfd
movq 0x8(%r13), %r13
incl %ebp
jmp 0x15d5a
pushq $0x2
popq %r15
jmp 0x15dff
movl %ebx, %ebp
incl %ebp
leaq 0x2779(%rip), %rbx      # 0x18574
jmp 0x15e06
incl %ebp
leaq 0x2783(%rip), %rbx      # 0x18589
movq 0xf1b3(%rip), %rdi      # 0x24fc0
leaq 0x2757(%rip), %rsi      # 0x1856b
callq 0x53b0
movq %rax, %rdi
movl %ebp, %esi
callq 0x5690
movq %rax, %rdi
movq %rbx, %rsi
callq 0x53b0
movq %rax, %rdi
callq 0x5210
movl %r15d, %eax
addq $0x58, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %r14, 0x8(%rsp)
jmp 0x15e55
movq %rax, %r15
movq 0x8(%rsp), %rdi
callq 0x51d0
movq %r15, %rdi
callq 0x56c0
nop
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/sstableWrapper.cc
// Function: sstableWrapper::getAllValues(int)
opStatus sstableWrapper::getAllValues(int clientSocket) {
  std::list<sstable*>::reverse_iterator iter;
  int count = 0;
  for(iter = sstableObjRefList.rbegin();
      iter != sstableObjRefList.rend();
      ++iter) {
    ++count;
    opStatus ret = (*iter)->getAllValues(clientSocket);
  }
  std::cout << "Listed " << count << " SSTables!" << std::endl;
  return opStatus::opSuccess;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %ebp
movq %rdi, %r14
addq $0x8, %r14
xorl %ebx, %ebx
movq %r14, %r15
cmpq (%r14), %r15
je 0x15e99
incl %ebx
movq 0x8(%r15), %rax
movq 0x10(%rax), %rdi
movl %ebp, %esi
callq 0x14da4
movq 0x8(%r15), %r15
jmp 0x15e7d
movq 0xf120(%rip), %rdi      # 0x24fc0
leaq 0x26fb(%rip), %rsi      # 0x185a2
callq 0x53b0
movq %rax, %rdi
movl %ebx, %esi
callq 0x5690
leaq 0x26ed(%rip), %rsi      # 0x185aa
movq %rax, %rdi
callq 0x53b0
movq %rax, %rdi
callq 0x5210
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/sstableWrapper.cc
// Function: sstableWrapper::~sstableWrapper()
sstableWrapper::~sstableWrapper() {
  std::list<sstable*>::iterator iter;
  for(iter = sstableObjRefList.begin();
      iter != sstableObjRefList.end();
      ++iter) {
    delete *iter;
  }
  delete sstable_no;
  sstableObjRefList.clear(); 
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r14
leaq 0x8(%rdi), %rbx
movq %rbx, %r12
movq (%r12), %r12
cmpq %rbx, %r12
je 0x15f16
movq 0x10(%r12), %r15
testq %r15, %r15
je 0x15f07
movq %r15, %rdi
callq 0x14fba
movl $0x468, %esi            # imm = 0x468
movq %r15, %rdi
callq 0x53d0
jmp 0x15eec
movq (%r14), %rdi
pushq $0x4
popq %rsi
callq 0x53d0
movq %rbx, %rdi
callq 0x15f48
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x15f60
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/utils.cc
// Function: getKeyValuePair(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
keyValuePair_t getKeyValuePair(std::string inBuffer) {
  int i = 0;
  // Operator
  while(inBuffer[i] != '<') {
    ++i;
  }
  // Key
  std::string key = "";
  ++i;
  while(inBuffer[i] != '>') {
    key += inBuffer[i];
    ++i;
  }
  // Value
  std::string value = "";
  while(inBuffer[i] != '<') {
    ++i;
  }
  ++i;
  while(inBuffer[i] != '>') {
    value += inBuffer[i];
    ++i;
  }
  return keyValuePair_t(key, value);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x88, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
xorl %r12d, %r12d
cmpb $0x3c, (%rax,%r12)
leaq 0x1(%r12), %r12
jne 0x160f2
leaq 0x12df(%rip), %rsi      # 0x173e4
leaq 0x68(%rsp), %r15
leaq 0x8(%rsp), %rdx
movq %r15, %rdi
callq 0x6ac6
movq (%r14), %rax
movb (%rax,%r12), %al
cmpb $0x3e, %al
je 0x16132
incq %r12
movsbl %al, %esi
movq %r15, %rdi
callq 0x5340
jmp 0x16117
leaq 0x12ab(%rip), %rsi      # 0x173e4
leaq 0x8(%rsp), %rdi
leaq 0x7(%rsp), %rdx
callq 0x6ac6
movq (%r14), %rax
cmpb $0x3c, (%rax,%r12)
leaq 0x1(%r12), %r12
jne 0x1614b
leaq 0x8(%rsp), %r15
movq (%r14), %rax
movb (%rax,%r12), %al
cmpb $0x3e, %al
je 0x16177
incq %r12
movsbl %al, %esi
movq %r15, %rdi
callq 0x5340
jmp 0x1615c
leaq 0x48(%rsp), %rdi
leaq 0x68(%rsp), %rsi
callq 0x5540
leaq 0x28(%rsp), %rdi
leaq 0x8(%rsp), %rsi
callq 0x5540
leaq 0x48(%rsp), %rsi
leaq 0x28(%rsp), %rdx
movq %rbx, %rdi
callq 0x6b02
leaq 0x28(%rsp), %rdi
callq 0x51d0
leaq 0x48(%rsp), %rdi
callq 0x51d0
leaq 0x8(%rsp), %rdi
callq 0x51d0
leaq 0x68(%rsp), %rdi
callq 0x51d0
movq %rbx, %rax
addq $0x88, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rbx
leaq 0x28(%rsp), %rdi
callq 0x51d0
jmp 0x161f3
movq %rax, %rbx
leaq 0x48(%rsp), %rdi
callq 0x51d0
jmp 0x16206
jmp 0x16203
jmp 0x16212
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x51d0
jmp 0x16215
movq %rax, %rbx
leaq 0x68(%rsp), %rdi
callq 0x51d0
movq %rbx, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/dbengine/utils.cc
// Function: getKey(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
std::string getKey(std::string inBuffer) {
  int i = 0;
  // Operator
  while(inBuffer[i] != '<') {
    ++i;
  }
  // Key
  std::string key = "";
  ++i;
  while(inBuffer[i] != '>') {
    key += inBuffer[i];
    ++i;
  }
  return key;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rax
xorl %r15d, %r15d
cmpb $0x3c, (%rax,%r15)
leaq 0x1(%r15), %r15
jne 0x1623c
leaq 0x1196(%rip), %rsi      # 0x173e4
leaq 0xf(%rsp), %rdx
movq %rbx, %rdi
callq 0x6ac6
movq (%r14), %rax
movb (%rax,%r15), %al
cmpb $0x3e, %al
je 0x16276
incq %r15
movsbl %al, %esi
movq %rbx, %rdi
callq 0x5340
jmp 0x1625b
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
movq %rax, %r14
movq %rbx, %rdi
callq 0x51d0
movq %r14, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/serverCode/server.cc
// Function: main
int main(int argc, char** argv) {

  int server_socket, client_socket, addr_size;
  SA_IN server_addr, client_addr;

  for(int i = 0; i < THREAD_POOL_SIZE; i++) {
    pthread_create(&thread_pool[i], NULL, thread_function, NULL);
  }

  check((server_socket = socket(AF_INET, SOCK_STREAM, 0)), 
        "Failed to create socket");
  
  // Initializing address struct
  server_addr.sin_family = AF_INET;
  server_addr.sin_addr.s_addr = INADDR_ANY;
  server_addr.sin_port = htons(SERVERPORT);

  check(bind(server_socket, (SA*)&server_addr, sizeof(server_addr)),
        "Bind failed!");
  check(listen(server_socket, SERVER_BACKLOG),
        "Listen failed!");

  // Create database object reference
  dbObjectRef = new database();

  while(true) {

    printf("Waiting for connections...\n");
    addr_size = sizeof(SA_IN);

    check(client_socket = 
        accept(server_socket, (SA*)&client_addr, (socklen_t*)&addr_size),
        "accept failed");
    printf("Connected!\n");
    
    // Put the connection somewhere so that an available thread can find it.
    int* pclient = (int*)malloc(sizeof(int));
    *pclient = client_socket;
    pthread_mutex_lock(&mutex);
    conn_queue.push(pclient);
    // Signal that a job has arrived in the queue.
    pthread_cond_signal(&condition_var);
    pthread_mutex_unlock(&mutex);
  }
  delete dbObjectRef;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
xorl %r14d, %r14d
leaq 0xf578(%rip), %r15      # 0x25850
leaq 0x136(%rip), %rbx       # 0x16415
cmpq $0x50, %r14
je 0x162fb
leaq (%r15,%r14), %rdi
xorl %esi, %esi
movq %rbx, %rdx
xorl %ecx, %ecx
callq 0x5700
addq $0x8, %r14
jmp 0x162df
pushq $0x2
popq %rdi
pushq $0x1
popq %rsi
xorl %edx, %edx
callq 0x50c0
movl %eax, %ebx
leaq 0x22b7(%rip), %rsi      # 0x185c8
movl %eax, %edi
callq 0x1647b
leaq 0x28(%rsp), %rsi
movq $0x39300002, (%rsi)     # imm = 0x39300002
pushq $0x10
popq %rdx
movl %ebx, %edi
callq 0x5080
leaq 0x22ab(%rip), %rsi      # 0x185e0
movl %eax, %edi
callq 0x1647b
pushq $0x64
popq %rsi
movl %ebx, %edi
callq 0x5430
leaq 0x22a0(%rip), %rsi      # 0x185ed
movl %eax, %edi
callq 0x1647b
pushq $0x10
popq %rdi
callq 0x53c0
movq %rax, %r14
movq %rax, %rdi
callq 0x6780
movq %r14, 0xf5da(%rip)      # 0x25948
leaq 0xf57b(%rip), %r15      # 0x258f0
leaq 0xf524(%rip), %r12      # 0x258a0
leaq 0x10(%rsp), %r13
leaq 0xf590(%rip), %rbp      # 0x25918
leaq 0x23ff(%rip), %rdi      # 0x1878e
callq 0x5600
movl $0x10, 0xc(%rsp)
movl %ebx, %edi
leaq 0x18(%rsp), %rsi
leaq 0xc(%rsp), %rdx
callq 0x5120
movl %eax, %r14d
movl %eax, %edi
leaq 0x2243(%rip), %rsi      # 0x185fc
callq 0x1647b
leaq 0x23e4(%rip), %rdi      # 0x187a9
callq 0x5600
pushq $0x4
popq %rdi
callq 0x5520
movq %rax, 0x10(%rsp)
movl %r14d, (%rax)
movq %r15, %rdi
callq 0x55a0
movq %r12, %rdi
movq %r13, %rsi
callq 0x16afa
movq %rbp, %rdi
callq 0x5030
movq %r15, %rdi
callq 0x5300
jmp 0x16388
movq %rax, %rbx
pushq $0x10
popq %rsi
movq %r14, %rdi
callq 0x53d0
movq %rbx, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/serverCode/server.cc
// Function: thread_function(void*)
void* thread_function(void* arg) {
  int* pclient;
  while(true) {
    pclient = NULL;

    pthread_mutex_lock(&mutex);
    if(conn_queue.size() == 0) {
      // The thread waits until it is signaled to wake up. The lock (mutex) is
      // also released meanwhile, and when signaled the thread first acquires
      // lock and then only returns here to continue execution.
      pthread_cond_wait(&condition_var, &mutex);
    }
    // Now there is a request in the queue to be handled.
    pclient = conn_queue.front();
    conn_queue.pop();
    pthread_mutex_unlock(&mutex);

    if(pclient != NULL) {
      handle_connection(pclient);
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
leaq 0xf4cc(%rip), %rbx      # 0x258f0
leaq 0xf475(%rip), %r14      # 0x258a0
leaq 0xf4e6(%rip), %r15      # 0x25918
movq %rbx, %rdi
callq 0x55a0
movq %r14, %rdi
callq 0x16b96
testq %rax, %rax
jne 0x16452
movq %r15, %rdi
movq %rbx, %rsi
callq 0x55e0
movq 0xf457(%rip), %rax      # 0x258b0
movq (%rax), %r12
movq %r14, %rdi
callq 0x16d2e
movq %rbx, %rdi
callq 0x5300
testq %r12, %r12
je 0x16432
movq %r12, %rdi
callq 0x16494
jmp 0x16432
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/serverCode/server.cc
// Function: check(int, char const*)
int check(int exp, const char* msg) {
  if(exp == SOCKETERROR) {
    perror(msg);
    exit(1);
  }
  return exp;
}

// Assembly:
cmpl $-0x1, %edi
je 0x16483
movl %edi, %eax
retq
pushq %rax
movq %rsi, %rdi
callq 0x5330
pushq $0x1
popq %rdi
callq 0x54a0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/serverCode/server.cc
// Function: sendWelcomeMessage(int)
void sendWelcomeMessage(int client_socket) {
  std::string welcome;
  
  welcome = "*************************************************************\n";
  welcome += "*                Welcome to myDB Engine                     *\n";
  welcome += "*        Created by : Prakhar Sinha, Shorya Jain            *\n";
  welcome += "*        (Type exit to terminate the connection)            *\n";
  welcome += "*************************************************************\n"; 
  
  write(client_socket, &welcome[0], strlen(welcome.c_str()));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1f66(%rip), %rsi      # 0x18653
leaq 0x8(%rsp), %rdi
callq 0x5740
leaq 0x1f94(%rip), %rsi      # 0x18692
leaq 0x8(%rsp), %rdi
callq 0x5730
leaq 0x1fc2(%rip), %rsi      # 0x186d1
leaq 0x8(%rsp), %rdi
callq 0x5730
leaq 0x1ff0(%rip), %rsi      # 0x18710
leaq 0x8(%rsp), %rdi
callq 0x5730
leaq 0x1f22(%rip), %rsi      # 0x18653
leaq 0x8(%rsp), %rdi
callq 0x5730
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x51b0
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5130
leaq 0x8(%rsp), %rdi
callq 0x51d0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x51d0
movq %rbx, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/prakhar2808[P]DBEngine/serverCode/server.cc
// Function: sendGoodByeMessage(int)
void sendGoodByeMessage(int client_socket) {
  std::string goodBye;
  
  goodBye = "*************************************************************\n";
  goodBye += "*                       Good Bye!                           *\n";
  goodBye += "*************************************************************\n";

  write(client_socket, &goodBye[0], strlen(goodBye.c_str()));  
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %edi, %ebx
leaq 0x18(%rsp), %rax
movq %rax, -0x10(%rax)
andq $0x0, -0x8(%rax)
movb $0x0, (%rax)
leaq 0x1e34(%rip), %rsi      # 0x18653
leaq 0x8(%rsp), %rdi
callq 0x5740
leaq 0x1f1f(%rip), %rsi      # 0x1874f
leaq 0x8(%rsp), %rdi
callq 0x5730
leaq 0x1e12(%rip), %rsi      # 0x18653
leaq 0x8(%rsp), %rdi
callq 0x5730
movq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x51b0
movl %ebx, %edi
movq %r14, %rsi
movq %rax, %rdx
callq 0x5130
leaq 0x8(%rsp), %rdi
callq 0x51d0
addq $0x28, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rbx
leaq 0x8(%rsp), %rdi
callq 0x51d0
movq %rbx, %rdi
callq 0x56c0
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::fill_cache(unsigned int, unsigned int, PACKET*)
void CACHE::fill_cache(uint32_t set, uint32_t way, PACKET *packet)
{
#ifdef SANITY_CHECK
    if (cache_type == IS_ITLB) {
        if (packet->data == 0)
            assert(0);
    }

    if (cache_type == IS_DTLB) {
        if (packet->data == 0)
            assert(0);
    }

    if (cache_type == IS_STLB) {
        if (packet->data == 0)
            assert(0);
    }
#endif
    if (block[set][way].prefetch && (block[set][way].used == 0))
        STATS.pf_useless++;

    if (block[set][way].valid == 0)
        block[set][way].valid = 1;
    block[set][way].dirty = 0;
    block[set][way].prefetch = (packet->type == PREFETCH) ? 1 : 0;
    block[set][way].used = 0;

    if (block[set][way].prefetch)
        STATS.pf_fill++;

    block[set][way].delta = packet->delta;
    block[set][way].depth = packet->depth;
    block[set][way].signature = packet->signature;
    block[set][way].confidence = packet->confidence;

    block[set][way].tag = packet->address;
    block[set][way].address = packet->address;
    block[set][way].full_addr = packet->full_addr;
    block[set][way].data = packet->data;
    block[set][way].cpu = packet->cpu;
    block[set][way].instr_id = packet->instr_id;

    DP ( if (warmup_complete[packet->cpu]) {
    cout << "[" << NAME << "] " << __func__ << " set: " << set << " way: " << way;
    cout << " lru: " << block[set][way].lru << " tag: " << hex << block[set][way].tag << " full_addr: " << block[set][way].full_addr;
    cout << " data: " << block[set][way].data << dec << endl; });
}

// Assembly:
pushq %rax
movzbl 0x73a4(%rdi), %eax
cmpl $0x2, %eax
je 0x2f2c
cmpl $0x1, %eax
je 0x2f03
testl %eax, %eax
jne 0x2f3a
cmpq $0x0, 0x360(%rcx)
jne 0x2f3a
leaq 0xd17c(%rip), %rdi      # 0x10067
leaq 0xd177(%rip), %rsi      # 0x10069
leaq 0xd22b(%rip), %rcx      # 0x10124
movl $0x337, %edx            # imm = 0x337
callq 0x2160
cmpq $0x0, 0x360(%rcx)
jne 0x2f3a
leaq 0xd153(%rip), %rdi      # 0x10067
leaq 0xd14e(%rip), %rsi      # 0x10069
leaq 0xd202(%rip), %rcx      # 0x10124
movl $0x33c, %edx            # imm = 0x33C
callq 0x2160
cmpq $0x0, 0x360(%rcx)
je 0x2fcd
movq 0x7390(%rdi), %rax
movl %esi, %esi
movq (%rax,%rsi,8), %rax
movl %edx, %edx
imulq $0x50, %rdx, %rdx
leaq (%rax,%rdx), %rsi
cmpb $0x0, 0x1(%rax,%rdx)
je 0x2f65
cmpb $0x0, 0x3(%rsi)
jne 0x2f65
incq 0x102d8(%rdi)
cmpb $0x0, (%rsi)
jne 0x2f6d
movb $0x1, (%rsi)
xorl %esi, %esi
movb %sil, 0x2(%rax,%rdx)
cmpb $0x2, 0x32f(%rcx)
sete 0x1(%rax,%rdx)
movb %sil, 0x3(%rax,%rdx)
jne 0x2f8e
incq 0x102e0(%rdi)
movups 0x18(%rcx), %xmm0
movups %xmm0, 0x4(%rax,%rdx)
movups 0x340(%rcx), %xmm0
movlps %xmm0, 0x28(%rax,%rdx)
movups %xmm0, 0x18(%rax,%rdx)
movq 0x360(%rcx), %rsi
movq %rsi, 0x30(%rax,%rdx)
movl 0x330(%rcx), %esi
movq %rsi, 0x38(%rax,%rdx)
movq 0x368(%rcx), %rcx
movq %rcx, 0x40(%rax,%rdx)
popq %rax
retq
leaq 0xd093(%rip), %rdi      # 0x10067
leaq 0xd08e(%rip), %rsi      # 0x10069
leaq 0xd142(%rip), %rcx      # 0x10124
movl $0x341, %edx            # imm = 0x341
callq 0x2160
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::add_mshr(PACKET*)
void CACHE::add_mshr(PACKET *packet)
{
    uint32_t index = 0;

    // search mshr
    for (index=0; index<MSHR_SIZE; index++) {
        if (MSHR.entry[index].address == 0) {
            
            memcpy(&MSHR.entry[index], packet, sizeof(PACKET));
            MSHR.entry[index].returned = INFLIGHT;
            MSHR.occupancy++;

            DP ( if (warmup_complete[packet->cpu]) {
            cout << "[" << NAME << "_MSHR] " << __func__ << " instr_id: " << packet->instr_id;
            cout << " address: " << hex << packet->address << " full_addr: " << packet->full_addr << dec;
            cout << " index: " << index << " occupancy: " << MSHR.occupancy << endl; });

            break;
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x7388(%rdi), %ecx
movq 0xca20(%rdi), %rax
imulq $0x380, %rcx, %rcx      # imm = 0x380
addq $0x380, %rcx            # imm = 0x380
xorl %edx, %edx
leaq 0x380(%rdx), %r14
cmpq %r14, %rcx
je 0x39a6
cmpq $0x0, 0x340(%rax,%rdx)
movq %r14, %rdx
jne 0x3964
leaq (%rax,%r14), %rdi
addq $-0x380, %rdi           # imm = 0xFC80
movl $0x380, %edx            # imm = 0x380
callq 0x21b0
movq 0xca20(%rbx), %rax
movb $0x1, -0x54(%rax,%r14)
incl 0xc9bc(%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::operate()
void CACHE::operate()
{
    handle_fill();
    handle_writeback();
    handle_read();

    if (PQ.occupancy && (RQ.occupancy == 0))
        handle_prefetch();
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
callq 0x286c
movq %rbx, %rdi
callq 0x2fec
movq %rbx, %rdi
callq 0x39ae
cmpl $0x0, 0xad1c(%rbx)
je 0x45ee
cmpl $0x0, 0x907c(%rbx)
jne 0x45ee
movq %rbx, %rdi
popq %rbx
jmp 0x4208
popq %rbx
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::invalidate_entry(unsigned long)
int CACHE::invalidate_entry(uint64_t inval_addr)
{
    uint32_t set = get_set(inval_addr);
    int match_way = -1;

    if (NUM_SET < set) {
        cerr << "[" << NAME << "_ERROR] " << __func__ << " invalid set index: " << set << " NUM_SET: " << NUM_SET;
        cerr << " inval_addr: " << hex << inval_addr << dec << endl;
        assert(0);
    }

    // invalidate
    for (uint32_t way=0; way<NUM_WAY; way++) {
        if (block[set][way].valid && (block[set][way].tag == inval_addr)) {

            block[set][way].valid = 0;

            match_way = way;

            DP ( if (warmup_complete[cpu]) {
            cout << "[" << NAME << "] " << __func__ << " inval_addr: " << hex << inval_addr;  
            cout << " tag: " << block[set][way].tag << " data: " << block[set][way].data << dec;
            cout << " set: " << set << " way: " << way << " lru: " << block[set][way].lru << " cycle: " << current_core_cycle[cpu] << endl; });

            break;
        }
    }

    return match_way;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2e58
movl %eax, %ebp
cmpl %eax, 0x7370(%r14)
jb 0x4694
movl 0x7374(%r14), %ecx
movq 0x7390(%r14), %rdx
movl %ebp, %esi
xorl %edi, %edi
pushq $-0x1
popq %rax
xorl %r8d, %r8d
cmpq %r8, %rcx
je 0x4689
movq (%rdx,%rsi,8), %r9
cmpb $0x0, (%r9,%rdi)
je 0x4678
cmpq %rbx, 0x28(%r9,%rdi)
je 0x4681
incq %r8
addq $0x50, %rdi
jmp 0x4661
movb $0x0, (%r9,%rdi)
movl %r8d, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq 0x11955(%rip), %r15     # 0x15ff0
leaq 0xb9ee(%rip), %rsi      # 0x10090
movq %r15, %rdi
callq 0x2230
leaq 0x7350(%r14), %rsi
movq %rax, %rdi
callq 0x21d0
leaq 0xc55e(%rip), %rsi      # 0x10c1e
movq %rax, %rdi
callq 0x2230
leaq 0xbaf4(%rip), %rsi      # 0x101c3
movq %rax, %rdi
callq 0x2230
leaq 0xba85(%rip), %rsi      # 0x10163
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
movl %ebp, %esi
callq 0x22a0
leaq 0xba81(%rip), %rsi      # 0x10178
movq %rax, %rdi
callq 0x2230
movl 0x7370(%r14), %esi
movq %rax, %rdi
callq 0x22a0
leaq 0xbabf(%rip), %rsi      # 0x101d4
movq %r15, %rdi
callq 0x2230
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x8, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2080
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
movl 0x18(%rax,%rcx), %edx
andl $-0x4b, %edx
orl $0x2, %edx
movl %edx, 0x18(%rax,%rcx)
movq %rax, %rdi
callq 0x2110
leaq 0xb906(%rip), %rdi      # 0x10067
leaq 0xb901(%rip), %rsi      # 0x10069
leaq 0xba73(%rip), %rcx      # 0x101e2
movl $0x389, %edx            # imm = 0x389
callq 0x2160
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::prefetch_line(unsigned long, unsigned long, unsigned long, int)
int CACHE::prefetch_line(uint64_t ip, uint64_t base_addr, uint64_t pf_addr, int fill_level)
{
    if (PQ.occupancy < PQ.SIZE) {
        if ((base_addr>>PAGE_SHIFT) == (pf_addr>>PAGE_SHIFT)) {
            
            PACKET pf_packet;
            pf_packet.fill_level = fill_level;
            pf_packet.cpu = cpu;
            //pf_packet.data_index = LQ.entry[lq_index].data_index;
            //pf_packet.lq_index = lq_index;
            pf_packet.address = pf_addr >> LOG2_BLOCK_SIZE;
            pf_packet.full_addr = pf_addr;
            //pf_packet.instr_id = LQ.entry[lq_index].instr_id;
            //pf_packet.rob_index = LQ.entry[lq_index].rob_index;
            pf_packet.ip = ip;
            pf_packet.type = PREFETCH;
            pf_packet.event_cycle = current_core_cycle[cpu];

            // give a dummy 0 as the IP of a prefetch
            add_pq(&pf_packet);

            return 1;
        }
    }

    return 0;
}

// Assembly:
xorq %rcx, %rdx
xorl %eax, %eax
cmpq $0xfff, %rdx            # imm = 0xFFF
ja 0x4e16
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x380, %rsp            # imm = 0x380
movq %rcx, %r14
movq %rdi, %rbx
movl 0xad08(%rdi), %ecx
cmpl %ecx, 0xad1c(%rdi)
jae 0x4e07
movl %r8d, %ebp
movq %rsi, %r15
movq %rsp, %r12
movq %r12, %rdi
callq 0x53f4
movl %ebp, 0x8(%r12)
movl 0x7348(%rbx), %eax
movl %eax, 0x330(%r12)
movq %r14, %rcx
shrq $0x6, %rcx
movq %rcx, 0x340(%r12)
movq %r14, 0x348(%r12)
movq %r15, 0x370(%r12)
movb $0x2, 0x32f(%r12)
leaq 0x780c4(%rip), %rcx     # 0x7ceb0
movq (%rcx,%rax,8), %rax
movq %rax, 0x378(%r12)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r12, %rsi
callq *0x10(%rax)
pushq $0x1
popq %rax
addq $0x380, %rsp            # imm = 0x380
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::kpc_prefetch_line(unsigned long, unsigned long, int, int, int, int, int)
int CACHE::kpc_prefetch_line(uint64_t base_addr, uint64_t pf_addr, int fill_level, int delta, int depth, int signature, int confidence)
{
    if (PQ.occupancy < PQ.SIZE) {
        if ((base_addr>>PAGE_SHIFT) == (pf_addr>>PAGE_SHIFT)) {
            
            PACKET pf_packet;
            pf_packet.fill_level = fill_level;
            pf_packet.cpu = cpu;
            //pf_packet.data_index = LQ.entry[lq_index].data_index;
            //pf_packet.lq_index = lq_index;
            pf_packet.address = pf_addr >> LOG2_BLOCK_SIZE;
            pf_packet.full_addr = pf_addr;
            //pf_packet.instr_id = LQ.entry[lq_index].instr_id;
            //pf_packet.rob_index = LQ.entry[lq_index].rob_index;
            pf_packet.ip = 0;
            pf_packet.type = PREFETCH;
            pf_packet.delta = delta;
            pf_packet.depth = depth;
            pf_packet.signature = signature;
            pf_packet.confidence = confidence;
            pf_packet.event_cycle = current_core_cycle[cpu];

            // give a dummy 0 as the IP of a prefetch
            add_pq(&pf_packet);

            STATS.pf_issued++;

            return 1;
        }
    }

    return 0;
}

// Assembly:
xorq %rdx, %rsi
xorl %eax, %eax
cmpq $0xfff, %rsi            # imm = 0xFFF
ja 0x4ef6
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x388, %rsp            # imm = 0x388
movl %ecx, %r12d
movq %rdi, %rbx
movl 0xad08(%rdi), %ecx
cmpl %ecx, 0xad1c(%rdi)
jae 0x4ee5
movl %r9d, %ebp
movl %r8d, %r14d
movq %rdx, %r15
leaq 0x8(%rsp), %r13
movq %r13, %rdi
callq 0x53f4
movl %r12d, 0x8(%r13)
movl 0x7348(%rbx), %eax
movl %eax, 0x330(%r13)
movq %r15, %rcx
shrq $0x6, %rcx
movq %rcx, 0x340(%r13)
movq %r15, 0x348(%r13)
andq $0x0, 0x370(%r13)
movb $0x2, 0x32f(%r13)
movl %r14d, 0x18(%r13)
movl %ebp, 0x1c(%r13)
movl 0x3c0(%rsp), %ecx
movl %ecx, 0x20(%r13)
movl 0x3c8(%rsp), %ecx
movl %ecx, 0x24(%r13)
leaq 0x77fec(%rip), %rcx     # 0x7ceb0
movq (%rcx,%rax,8), %rax
movq %rax, 0x378(%r13)
movq (%rbx), %rax
movq %rbx, %rdi
movq %r13, %rsi
callq *0x10(%rax)
incq 0x102c8(%rbx)
pushq $0x1
popq %rax
addq $0x388, %rsp            # imm = 0x388
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::get_occupancy(unsigned char)
uint32_t CACHE::get_occupancy(uint8_t queue_type)
{
    if (queue_type == 0)
        return MSHR.occupancy;
    else if (queue_type == 1)
        return RQ.occupancy;
    else if (queue_type == 2)
        return WQ.occupancy;
    else if (queue_type == 3)
        return PQ.occupancy;

    return 0;
}

// Assembly:
cmpl $0x3, %esi
ja 0x53b3
movl %esi, %eax
leaq 0xacb2(%rip), %rcx      # 0x10040
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc9bc(%rdi), %eax
retq
movl 0x73dc(%rdi), %eax
retq
movl 0xad1c(%rdi), %eax
retq
movl 0x907c(%rdi), %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/cache.cc
// Function: CACHE::get_size(unsigned char)
uint32_t CACHE::get_size(uint8_t queue_type)
{
    if (queue_type == 0)
        return MSHR.SIZE;
    else if (queue_type == 1)
        return RQ.SIZE;
    else if (queue_type == 2)
        return WQ.SIZE;
    else if (queue_type == 3)
        return PQ.SIZE;

    return 0;
}

// Assembly:
cmpl $0x3, %esi
ja 0x53e9
movl %esi, %eax
leaq 0xac8c(%rip), %rcx      # 0x10050
movslq (%rcx,%rax,4), %rax
addq %rcx, %rax
jmpq *%rax
movl 0xc9a8(%rdi), %eax
retq
movl 0x73c8(%rdi), %eax
retq
movl 0xad08(%rdi), %eax
retq
movl 0x9068(%rdi), %eax
retq
xorl %eax, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: record_roi_stats(unsigned int, CACHE*)
void record_roi_stats(uint32_t cpu, CACHE *cache)
{
    for (uint32_t i=0; i<NUM_TYPES; i++) {
        cache->roi_access[cpu][i] = cache->sim_access[cpu][i];
        cache->roi_hit[cpu][i] = cache->sim_hit[cpu][i];
        cache->roi_miss[cpu][i] = cache->sim_miss[cpu][i];
    }
}

// Assembly:
movl %edi, %eax
shlq $0x5, %rax
addq %rsi, %rax
addq $0x10388, %rax          # imm = 0x10388
pushq $-0x20
popq %rcx
testq %rcx, %rcx
je 0x5e6c
movq -0x80(%rax,%rcx), %rdx
movq -0x60(%rax,%rcx), %rsi
movq %rdx, -0x20(%rax,%rcx)
movq %rsi, (%rax,%rcx)
movq -0x40(%rax,%rcx), %rdx
movq %rdx, 0x20(%rax,%rcx)
addq $0x8, %rcx
jmp 0x5e44
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: reset_cache_stats(unsigned int, CACHE*)
void reset_cache_stats(uint32_t cpu, CACHE *cache)
{
    for (uint32_t i=0; i<NUM_TYPES; i++) {
        cache->ACCESS[i] = 0;
        cache->HIT[i] = 0;
        cache->MISS[i] = 0;
        cache->MSHR_MERGED[i] = 0;
        cache->STALL[i] = 0;

        cache->sim_access[cpu][i] = 0;
        cache->sim_hit[cpu][i] = 0;
        cache->sim_miss[cpu][i] = 0;
    }

    cache->RQ.ACCESS = 0;
    cache->RQ.MERGED = 0;
    cache->RQ.TO_CACHE = 0;

    cache->WQ.ACCESS = 0;
    cache->WQ.MERGED = 0;
    cache->WQ.TO_CACHE = 0;
    cache->WQ.FORWARD = 0;
    cache->WQ.FULL = 0;
}

// Assembly:
movl %edi, %eax
shlq $0x5, %rax
addq %rsi, %rax
addq $0x10328, %rax          # imm = 0x10328
pushq $-0x20
popq %rcx
testq %rcx, %rcx
je 0x6902
andq $0x0, 0x72c8(%rsi,%rcx)
andq $0x0, 0x72e8(%rsi,%rcx)
andq $0x0, 0x7308(%rsi,%rcx)
andq $0x0, 0x7328(%rsi,%rcx)
andq $0x0, 0x7348(%rsi,%rcx)
andq $0x0, -0x20(%rax,%rcx)
andq $0x0, (%rax,%rcx)
andq $0x0, 0x20(%rax,%rcx)
addq $0x8, %rcx
jmp 0x68b9
andq $0x0, 0x90a8(%rsi)
andq $0x0, 0x7438(%rsi)
xorps %xmm0, %xmm0
movups %xmm0, 0x7408(%rsi)
movups %xmm0, 0x7418(%rsi)
movups %xmm0, 0x90b8(%rsi)
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/main.cc
// Function: lg2(int)
int lg2(int n)
{
    int i, m = n, c = -1;
    for (i=0; m; i++) {
        m /= 2;
        c++;
    }
    return c;
}

// Assembly:
movl %edi, %eax
pushq $-0x1
popq %rcx
pushq $0x2
popq %rsi
testl %eax, %eax
je 0x71fa
cltd
idivl %esi
incl %ecx
jmp 0x71ef
movl %ecx, %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/dram_controller.cc
// Function: MEMORY_CONTROLLER::update_process_cycle(PACKET_QUEUE*)
void MEMORY_CONTROLLER::update_process_cycle(PACKET_QUEUE *queue)
{
    // update next_process_cycle
    uint64_t min_cycle = UINT64_MAX;
    uint32_t min_index = queue->SIZE;
    for (uint32_t i=0; i<queue->SIZE; i++) {
        if (queue->entry[i].scheduled && (queue->entry[i].event_cycle < min_cycle)) {
            min_cycle = queue->entry[i].event_cycle;
            min_index = i;
        }
    }
    
    queue->next_process_cycle = min_cycle;
    queue->next_process_index = min_index;
    if (min_index < queue->SIZE) {

        DP (if (warmup_complete[queue->entry[min_index].cpu]) {
        cout << "[" << queue->NAME << "] " <<  __func__ << " instr_id: " << queue->entry[min_index].instr_id;
        cout << " address: " << hex << queue->entry[min_index].address << " full_addr: " << queue->entry[min_index].full_addr;
        cout << " data: " << queue->entry[min_index].data << dec << " num_returned: " << queue->num_returned;
        cout << " event: " << queue->entry[min_index].event_cycle << " current: " << current_core_cycle[queue->entry[min_index].cpu] << " next: " << queue->next_process_cycle << endl; });
    }
}

// Assembly:
movl 0x20(%rsi), %eax
pushq $-0x1
popq %rcx
movl $0x378, %edx            # imm = 0x378
xorl %edi, %edi
movl %eax, %r8d
cmpq %rdi, %rax
je 0x9306
movq 0x98(%rsi), %r9
cmpb $0x0, -0x376(%r9,%rdx)
je 0x92fa
movq (%r9,%rdx), %r9
cmpq %rcx, %r9
cmovbq %r9, %rcx
cmovbl %edi, %r8d
incq %rdi
addq $0x380, %rdx            # imm = 0x380
jmp 0x92d4
movq %rcx, 0x58(%rsi)
movl %r8d, 0x44(%rsi)
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/dram_controller.cc
// Function: MEMORY_CONTROLLER::get_occupancy(unsigned char)
uint32_t MEMORY_CONTROLLER::get_occupancy(uint8_t queue_type)
{
    if (queue_type == 1)
        return RQ.occupancy;
    else if (queue_type == 2)
        return WQ.occupancy;

    return 0;
}

// Assembly:
cmpl $0x2, %esi
je 0x9ae5
xorl %eax, %eax
cmpl $0x1, %esi
jne 0x9aeb
movl 0x9f2c(%rdi), %eax
retq
movl 0x828c(%rdi), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/dram_controller.cc
// Function: MEMORY_CONTROLLER::get_size(unsigned char)
uint32_t MEMORY_CONTROLLER::get_size(uint8_t queue_type)
{
    if (queue_type == 1)
        return RQ.SIZE;
    else if (queue_type == 2)
        return WQ.SIZE;

    return 0;
}

// Assembly:
cmpl $0x2, %esi
je 0x9aff
xorl %eax, %eax
cmpl $0x1, %esi
jne 0x9b05
movl 0x9f18(%rdi), %eax
retq
movl 0x8278(%rdi), %eax
retq
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/block.cc
// Function: PACKET_QUEUE::add_queue(PACKET*)
void PACKET_QUEUE::add_queue(PACKET *packet)
{
#ifdef SANITY_CHECK
    if (occupancy && (head == tail))
        assert(0);
#endif

    // add entry
    memcpy(&entry[tail], packet, sizeof(PACKET));

    DP ( if (warmup_complete[packet->cpu]) {
    cout << "[" << NAME << "] " << __func__ << " cpu: " << packet->cpu << " instr_id: " << packet->instr_id;
    cout << " address: " << hex << entry[tail].address << " full_addr: " << entry[tail].full_addr << dec;
    cout << " head: " << head << " tail: " << tail << " occupancy: " << occupancy << " event_cycle: " << entry[tail].event_cycle << endl; });

    occupancy++;
    tail++;
    if (tail >= SIZE)
        tail = 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
cmpl $0x0, 0x34(%rdi)
je 0x9c8d
movl 0x30(%rbx), %eax
cmpl %eax, 0x2c(%rbx)
jne 0x9c90
leaq 0x63f0(%rip), %rdi      # 0x10067
leaq 0x6ebc(%rip), %rsi      # 0x10b3a
leaq 0x6ec2(%rip), %rcx      # 0x10b47
pushq $0x50
popq %rdx
callq 0x2160
movl 0x30(%rbx), %eax
movl %eax, %eax
imulq $0x380, %rax, %rdi      # imm = 0x380
addq 0x98(%rbx), %rdi
movl $0x380, %edx            # imm = 0x380
callq 0x21b0
incl 0x34(%rbx)
movl 0x30(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl 0x20(%rbx), %eax
cmovbl %eax, %ecx
movl %ecx, 0x30(%rbx)
popq %rbx
retq
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/block.cc
// Function: PACKET_QUEUE::remove_queue(PACKET*)
void PACKET_QUEUE::remove_queue(PACKET *packet)
{
#ifdef SANITY_CHECK
    if ((occupancy == 0) && (head == tail))
        assert(0);
#endif

    DP ( if (warmup_complete[packet->cpu]) {
    cout << "[" << NAME << "] " << __func__ << " cpu: " << packet->cpu << " instr_id: " << packet->instr_id;
    cout << " address: " << hex << packet->address << " full_addr: " << packet->full_addr << dec << " fill_level: " << packet->fill_level;
    cout << " head: " << head << " tail: " << tail << " occupancy: " << occupancy << " event_cycle: " << packet->event_cycle << endl; });

    // reset entry
    PACKET empty_packet;
    memcpy(packet, &empty_packet, sizeof(PACKET));

    occupancy--;
    head++;
    if (head >= SIZE)
        head = 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x380, %rsp            # imm = 0x380
movq %rsi, %r14
movq %rdi, %rbx
cmpl $0x0, 0x34(%rdi)
jne 0x9ce0
movl 0x2c(%rbx), %eax
cmpl 0x30(%rbx), %eax
je 0x9d1b
movq %rsp, %r15
movq %r15, %rdi
callq 0x53f4
movl $0x380, %edx            # imm = 0x380
movq %r14, %rdi
movq %r15, %rsi
callq 0x21b0
decl 0x34(%rbx)
movl 0x2c(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl 0x20(%rbx), %eax
cmovbl %eax, %ecx
movl %ecx, 0x2c(%rbx)
addq $0x380, %rsp            # imm = 0x380
popq %rbx
popq %r14
popq %r15
retq
leaq 0x6345(%rip), %rdi      # 0x10067
leaq 0x6e11(%rip), %rsi      # 0x10b3a
leaq 0x6e3e(%rip), %rcx      # 0x10b6e
pushq $0x65
popq %rdx
callq 0x2160
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/ooo_cpu.cc
// Function: O3_CPU::add_to_rob(ooo_model_instr*)
uint32_t O3_CPU::add_to_rob(ooo_model_instr *arch_instr)
{
    uint32_t index = ROB.tail;

    // sanity check
    if (ROB.entry[index].instr_id != 0) {
        cerr << "[ROB_ERROR] " << __func__ << " is not empty index: " << index;
        cerr << " instr_id: " << ROB.entry[index].instr_id << endl;
        assert(0);
    }

    memcpy (&ROB.entry[index], arch_instr, sizeof(ooo_model_instr));
    ROB.entry[index].event_cycle = current_core_cycle[cpu];

    ROB.occupancy++;
    ROB.tail++;
    if (ROB.tail >= ROB.SIZE)
        ROB.tail = 0;

    DP ( if (warmup_complete[cpu]) {
    cout << "[ROB] " <<  __func__ << " instr_id: " << ROB.entry[index].instr_id;
    cout << " ip: " << hex << ROB.entry[index].ip << dec;
    cout << " head: " << ROB.head << " tail: " << ROB.tail << " occupancy: " << ROB.occupancy;
    cout << " event: " << ROB.entry[index].event_cycle << " current: " << current_core_cycle[cpu] << endl; });

    return index;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x95c(%rdi), %r14d
movq 0x9b8(%rdi), %rdi
imulq $0x758, %r14, %r12      # imm = 0x758
cmpq $0x0, (%rdi,%r12)
jne 0xa39d
addq %r12, %rdi
movl $0x758, %edx            # imm = 0x758
callq 0x21b0
movl (%rbx), %eax
leaq 0x72b51(%rip), %rcx     # 0x7ceb0
movq (%rcx,%rax,8), %rax
movq 0x9b8(%rbx), %rcx
movq %rax, 0x40(%rcx,%r12)
incl 0x960(%rbx)
movl 0x95c(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl 0x950(%rbx), %eax
cmovbl %eax, %ecx
movl %ecx, 0x95c(%rbx)
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0xbc4c(%rip), %r15      # 0x15ff0
leaq 0x686f(%rip), %rsi      # 0x10c1a
movq %r15, %rdi
callq 0x2230
leaq 0x686d(%rip), %rsi      # 0x10c27
movq %rax, %rdi
callq 0x2230
leaq 0x5e6a(%rip), %rsi      # 0x10233
movq %rax, %rdi
callq 0x2230
movq %rax, %rdi
movl %r14d, %esi
callq 0x22a0
leaq 0x6a75(%rip), %rsi      # 0x10e58
movq %r15, %rdi
callq 0x2230
movq 0x9b8(%rbx), %rcx
movq (%rcx,%r12), %rsi
movq %rax, %rdi
callq 0x2080
movq %rax, %rdi
callq 0x2110
leaq 0x5c5a(%rip), %rdi      # 0x10067
leaq 0x67da(%rip), %rsi      # 0x10bee
leaq 0x6817(%rip), %rcx      # 0x10c32
movl $0x12c, %edx            # imm = 0x12C
callq 0x2160
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/ooo_cpu.cc
// Function: O3_CPU::check_rob(unsigned long)
uint32_t O3_CPU::check_rob(uint64_t instr_id)
{
    if ((ROB.head == ROB.tail) && ROB.occupancy == 0)
        return ROB.SIZE;

    if (ROB.head < ROB.tail) {
        for (uint32_t i=ROB.head; i<ROB.tail; i++) {
            if (ROB.entry[i].instr_id == instr_id) {
                DP ( if (warmup_complete[ROB.cpu]) {
                cout << "[ROB] " << __func__ << " same instr_id: " << ROB.entry[i].instr_id;
                cout << " rob_index: " << i << endl; });
                return i;
            }
        }
    }
    else {
        for (uint32_t i=ROB.head; i<ROB.SIZE; i++) {
            if (ROB.entry[i].instr_id == instr_id) {
                DP ( if (warmup_complete[cpu]) {
                cout << "[ROB] " << __func__ << " same instr_id: " << ROB.entry[i].instr_id;
                cout << " rob_index: " << i << endl; });
                return i;
            }
        }
        for (uint32_t i=0; i<ROB.tail; i++) {
            if (ROB.entry[i].instr_id == instr_id) {
                DP ( if (warmup_complete[cpu]) {
                cout << "[ROB] " << __func__ << " same instr_id: " << ROB.entry[i].instr_id;
                cout << " rob_index: " << i << endl; });
                return i;
            }
        }
    }

    cerr << "[ROB_ERROR] " << __func__ << " does not have any matching index! ";
    cerr << " instr_id: " << instr_id << endl;
    assert(0);

    return ROB.SIZE;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movl 0x958(%rdi), %eax
movl 0x95c(%rdi), %ecx
cmpl %ecx, %eax
jne 0xa454
cmpl $0x0, 0x960(%rdi)
jne 0xa454
movl 0x950(%rdi), %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
cmpl %ecx, %eax
jae 0xa47a
imulq $0x758, %rax, %rdx      # imm = 0x758
addq 0x9b8(%rdi), %rdx
cmpl %ecx, %eax
jae 0xa4be
cmpq %rbx, (%rdx)
je 0xa44c
incl %eax
addq $0x758, %rdx            # imm = 0x758
jmp 0xa466
movl 0x950(%rdi), %esi
movq 0x9b8(%rdi), %rdx
imulq $0x758, %rax, %rdi      # imm = 0x758
addq %rdx, %rdi
cmpl %esi, %eax
jae 0xa4a5
cmpq %rbx, (%rdi)
je 0xa44c
incl %eax
addq $0x758, %rdi            # imm = 0x758
jmp 0xa491
xorl %eax, %eax
cmpl %eax, %ecx
je 0xa4be
movl %eax, %esi
imulq $0x758, %rsi, %rsi      # imm = 0x758
cmpq %rbx, (%rdx,%rsi)
je 0xa44c
incl %eax
jmp 0xa4a7
movq 0xbb2b(%rip), %r14      # 0x15ff0
leaq 0x674e(%rip), %rsi      # 0x10c1a
movq %r14, %rdi
callq 0x2230
leaq 0x6786(%rip), %rsi      # 0x10c61
movq %rax, %rdi
callq 0x2230
leaq 0x6781(%rip), %rsi      # 0x10c6b
movq %rax, %rdi
callq 0x2230
leaq 0x695f(%rip), %rsi      # 0x10e58
movq %r14, %rdi
callq 0x2230
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2080
movq %rax, %rdi
callq 0x2110
leaq 0x5b4c(%rip), %rdi      # 0x10067
leaq 0x66cc(%rip), %rsi      # 0x10bee
leaq 0x6766(%rip), %rcx      # 0x10c8f
movl $0x164, %edx            # imm = 0x164
callq 0x2160
nop
// File: /workspace/github_cpp_makefile_star2_O2/NishadSaraf[P]Championship-Simulator/src/ooo_cpu.cc
// Function: O3_CPU::do_scheduling(unsigned int)
void O3_CPU::do_scheduling(uint32_t rob_index)
{
    ROB.entry[rob_index].reg_ready = 1; // reg_ready will be reset to 0 if there is RAW dependency 

    reg_dependency(rob_index);
    ROB.next_schedule = (rob_index == (ROB.SIZE - 1)) ? 0 : (rob_index + 1);

    if (ROB.entry[rob_index].is_memory)
        ROB.entry[rob_index].scheduled = INFLIGHT;
    else {
        ROB.entry[rob_index].scheduled = COMPLETED;

        // ADD LATENCY
        if (ROB.entry[rob_index].event_cycle < current_core_cycle[cpu])
            ROB.entry[rob_index].event_cycle = current_core_cycle[cpu] + SCHEDULING_LATENCY;
        else
            ROB.entry[rob_index].event_cycle += SCHEDULING_LATENCY;

        if (ROB.entry[rob_index].reg_ready) {

#ifdef SANITY_CHECK
            if (RTE1[RTE1_tail] < ROB_SIZE)
                assert(0);
#endif
            // remember this rob_index in the Ready-To-Execute array 1
            RTE1[RTE1_tail] = rob_index;

            DP (if (warmup_complete[cpu]) {
            cout << "[RTE1] " << __func__ << " instr_id: " << ROB.entry[rob_index].instr_id << " rob_index: " << rob_index << " is added to RTE1";
            cout << " head: " << RTE1_head << " tail: " << RTE1_tail << endl; }); 

            RTE1_tail++;
            if (RTE1_tail == ROB_SIZE)
                RTE1_tail = 0;
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movl %esi, %r14d
movq %rdi, %rbx
movq 0x9b8(%rdi), %rax
movl %esi, %ecx
imulq $0x758, %rcx, %r15      # imm = 0x758
movb $0x1, 0x59(%rax,%r15)
callq 0xab72
movl 0x950(%rbx), %eax
decl %eax
leal 0x1(%r14), %ecx
xorl %edx, %edx
cmpl %r14d, %eax
cmovnel %ecx, %edx
movl %edx, 0x980(%rbx)
movq 0x9b8(%rbx), %rax
leaq (%rax,%r15), %rcx
cmpb $0x0, 0x49(%rax,%r15)
je 0xaae4
movl $0x1, 0x68(%rcx)
jmp 0xab4d
movl $0x2, 0x68(%rcx)
movq 0x40(%rax,%r15), %rcx
movl (%rbx), %edx
leaq 0x723b7(%rip), %rsi     # 0x7ceb0
movq (%rsi,%rdx,8), %rdx
movl 0x723bd(%rip), %esi     # 0x7cec0
cmpq %rdx, %rcx
cmovaq %rcx, %rdx
addq %rsi, %rdx
movq %rdx, 0x40(%rax,%r15)
cmpb $0x0, 0x59(%rax,%r15)
je 0xab4d
movl 0x324c(%rbx), %eax
cmpl $0xff, 0x2e48(%rbx,%rax,4)
jbe 0xab53
movl %r14d, 0x2e48(%rbx,%rax,4)
movl 0x324c(%rbx), %eax
incl %eax
xorl %ecx, %ecx
cmpl $0x100, %eax            # imm = 0x100
cmovnel %eax, %ecx
movl %ecx, 0x324c(%rbx)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x550d(%rip), %rdi      # 0x10067
leaq 0x608d(%rip), %rsi      # 0x10bee
leaq 0x61a0(%rip), %rcx      # 0x10d08
movl $0x22a, %edx            # imm = 0x22A
callq 0x2160