LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/Answer.cpp
// Function: mDNSResolver::Answer::skipQuestions(unsigned char*, unsigned int, unsigned int*)
MDNS_RESULT Answer::skipQuestions(unsigned char* buffer, unsigned int len, unsigned int* offset) {
    unsigned int questionCount = (buffer[4] << 8) + buffer[5];

    *offset += 12;
    for(int i = 0; i < questionCount; i++) {

      while(buffer[*offset] != '\0') {
        // If it's a pointer, add two to the counter
        if((buffer[*offset] & 0xc0) == 0xc0) {
          (*offset) += 2;
          break;
        } else {
          unsigned int labelLength = (unsigned int)buffer[*offset];

          if(labelLength > 0x3f) {
            return E_MDNS_INVALID_LABEL_LENGTH;
          }

          (*offset) += 1; // Increment to move to the next byte
          (*offset) += labelLength;

          if(*offset > len) {
            return E_MDNS_PACKET_ERROR;
          }
        }
      }

      (*offset) += 5; // 2 bytes for the qtypes and 2 bytes qclass + plus one to land us on the next bit
    }

    if(*offset > len + 1) {
      return E_MDNS_PACKET_ERROR;
    }

    return E_MDNS_OK;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movzwl 0x4(%rdi), %eax
addl $0xc, (%rdx)
rolw $0x8, %ax
testw %ax, %ax
setne %r10b
je 0x49e3c
movzwl %ax, %ecx
movl (%rdx), %r8d
xorl %r9d, %r9d
movl $0x23, %r11d
movl %r8d, %ebx
movzbl (%rdi,%rbx), %ebx
testl %ebx, %ebx
je 0x49e27
movl %ebx, %r14d
notl %r14d
testb $-0x40, %r14b
je 0x49e20
cmpb $0x3f, %bl
jbe 0x49e07
movl $0x26, %eax
xorl %ebx, %ebx
jmp 0x49e1a
addl %ebx, %r8d
incl %r8d
cmpl %esi, %r8d
setbe %bl
movl %r8d, (%rdx)
cmoval %r11d, %eax
testb %bl, %bl
jne 0x49de2
jmp 0x49e3c
addl $0x2, %r8d
movl %r8d, (%rdx)
addl $0x5, %r8d
movl %r8d, (%rdx)
incl %r9d
cmpl %ecx, %r9d
setb %r10b
jne 0x49de2
jmp 0x49e3c
testb $0x1, %r10b
jne 0x49e51
incl %esi
xorl %eax, %eax
cmpl %esi, (%rdx)
seta %al
leal (%rax,%rax,2), %eax
addl $0x20, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/Answer.cpp
// Function: mDNSResolver::Answer::resolveCnames(mDNSResolver::Cache&)
MDNS_RESULT Answer::resolveCnames(Cache &cache) {
    for(int i = 0; i < cache.length(); i++) {
      if(cache[i].cname != NULL && cache[i].cname->resolved) {
        cache[i].ipAddress = cache[i].cname->ipAddress;
        cache[i].resolved = true;
        cache[i].cname = NULL;
      }
    }
    return E_MDNS_OK;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
callq 0x3a730
testl %eax, %eax
jle 0x4a1fb
xorl %r14d, %r14d
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
cmpq $0x0, 0x110(%rax)
je 0x4a1e7
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
movq 0x110(%rax), %rax
cmpb $0x1, 0x108(%rax)
jne 0x4a1e7
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
movq 0x110(%rax), %r15
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
movl 0x10c(%r15), %ecx
movl %ecx, 0x10c(%rax)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
movb $0x1, 0x108(%rax)
movq %rbx, %rdi
movl %r14d, %esi
callq 0x3a3ae
movq $0x0, 0x110(%rax)
incl %r14d
movq %rbx, %rdi
callq 0x3a730
cmpl %eax, %r14d
jl 0x4a165
movl $0x20, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/Answer.cpp
// Function: mDNSResolver::Answer::resolveAName(unsigned char*, unsigned int, unsigned int*, mDNSResolver::Response&, long, int)
MDNS_RESULT Answer::resolveAName(unsigned char *buffer, unsigned int len, unsigned int *offset, Response& response, long ttl, int dataLen) {
    if(dataLen == 4) {
      unsigned int a = (unsigned int)*(buffer + (*offset)++);
      unsigned int b = (unsigned int)*(buffer + (*offset)++);
      unsigned int c = (unsigned int)*(buffer + (*offset)++);
      unsigned int d = (unsigned int)*(buffer + (*offset)++);

      response.resolved = true;
      response.ttl = ttl;
      response.ipAddress = IPAddress(a, b, c, d);

    } else {
      (*offset) += dataLen;
    }

    return E_MDNS_OK;
  }

// Assembly:
movl (%rdx), %r10d
cmpl $0x4, %r9d
jne 0x4a281
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rbx
leal 0x1(%r10), %eax
movl %eax, (%rdx)
movzbl (%rdi,%r10), %esi
leal 0x2(%r10), %ecx
movl %ecx, (%rdx)
movzbl (%rdi,%rax), %eax
leal 0x3(%r10), %r9d
movl %r9d, (%rdx)
movzbl (%rdi,%rcx), %ecx
addl $0x4, %r10d
movl %r10d, (%rdx)
movzbl (%rdi,%r9), %r9d
movb $0x1, 0x108(%rbx)
movq %r8, 0x100(%rbx)
leaq -0x14(%rbp), %r14
movq %r14, %rdi
movl %eax, %edx
movl %r9d, %r8d
callq 0x4c7a4
movl (%r14), %eax
movl %eax, 0x10c(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
jmp 0x4a287
addl %r9d, %r10d
movl %r10d, (%rdx)
movl $0x20, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/Answer.cpp
// Function: mDNSResolver::Answer::parseName(char**, char const*, unsigned int)
MDNS_RESULT Answer::parseName(char** name, const char* mapped, unsigned int len) {
    unsigned int namePointer = 0;
    unsigned int mapPointer = 0;

    while(mapPointer < len) {
      int labelLength = mapped[mapPointer++];

      if(labelLength > 0x3f) {
        return E_MDNS_INVALID_LABEL_LENGTH;
      }

      if(namePointer + labelLength > len - 1) {
        return E_MDNS_PACKET_ERROR;
      }

      if(namePointer != 0) {
        (*name)[namePointer++] = '.';
      }

      for(int i = 0; i < labelLength; i++) {
        (*name)[namePointer++] = mapped[mapPointer++];
      }
    }

    (*name)[len - 1] = '\0';

    return E_MDNS_OK;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
leal -0x1(%rdx), %ecx
xorl %r9d, %r9d
xorl %r8d, %r8d
cmpl %edx, %r8d
jae 0x4a328
movl %r8d, %r10d
incl %r8d
movsbl (%rsi,%r10), %r10d
cmpl $0x3f, %r10d
jle 0x4a2d0
xorl %r11d, %r11d
movl $0x26, %eax
jmp 0x4a321
leal (%r9,%r10), %r11d
xorl %ebx, %ebx
cmpl %ecx, %r11d
jbe 0x4a2e5
movl $0x23, %eax
xorl %r11d, %r11d
jmp 0x4a321
testl %r9d, %r9d
je 0x4a2fb
movq (%rdi), %r11
movl %r9d, %ebx
incl %r9d
movb $0x2e, (%r11,%rbx)
movl %r9d, %ebx
movb $0x1, %r11b
testb %r10b, %r10b
jle 0x4a31e
movl %r8d, %r9d
incl %r8d
movb (%rsi,%r9), %r9b
movq (%rdi), %r14
movl %ebx, %r15d
incl %ebx
movb %r9b, (%r14,%r15)
decl %r10d
jne 0x4a303
movl %ebx, %r9d
testb %r11b, %r11b
jne 0x4a2b0
jmp 0x4a334
movq (%rdi), %rax
movb $0x0, (%rax,%rcx)
movl $0x20, %eax
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/Answer.cpp
// Function: mDNSResolver::Answer::assembleName(unsigned char*, unsigned int, unsigned int*, char**, unsigned int)
int Answer::assembleName(unsigned char *buffer, unsigned int len, unsigned int *offset, char **name, unsigned int maxlen) {
    unsigned int index = 0;
    unsigned int nameLength = 0;

    while(index < maxlen) {
      if((buffer[*offset] & 0xc0) == 0xc0) {
        unsigned int pointerOffset = ((buffer[(*offset)++] & 0x3f) << 8) + buffer[(*offset)++];
        if(pointerOffset > len) {
          // Points to somewhere beyond the packet
          return -1 * E_MDNS_POINTER_OVERFLOW;
        }

        char *namePointer = *name + nameLength;
        int pointerLen = assembleName(buffer, len, &pointerOffset, &namePointer, MDNS_MAX_NAME_LEN - nameLength);

        if(pointerLen < 0) {
          return pointerLen;
        }

        nameLength += pointerLen;

        break;
      } else if(buffer[*offset] == '\0') {
        (*name)[nameLength++] = buffer[(*offset)++];
        break;
      } else {
        (*name)[nameLength++] = buffer[(*offset)++];
      }
      index++;
    }

    return nameLength;
  }

// Assembly:
testl %r8d, %r8d
je 0x4a37d
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movl %r8d, %r8d
xorl %ebx, %ebx
movl (%rdx), %eax
movb (%rdi,%rax), %r9b
cmpb $-0x40, %r9b
jae 0x4a380
testb %r9b, %r9b
je 0x4a3d9
leal 0x1(%rax), %r9d
movl %r9d, (%rdx)
movb (%rdi,%rax), %al
movq (%rcx), %r9
movb %al, (%r9,%rbx)
incq %rbx
cmpq %rbx, %r8
jne 0x4a34f
movl %ebx, %eax
jmp 0x4a3ea
xorl %eax, %eax
retq
leal 0x1(%rax), %r8d
movl %r8d, (%rdx)
movzbl (%rdi,%rax), %r9d
andl $0x3f, %r9d
shll $0x8, %r9d
addl $0x2, %eax
movl %eax, (%rdx)
movzbl (%rdi,%r8), %edx
orl %r9d, %edx
movl %edx, -0xc(%rbp)
movl $0xffffffde, %eax       # imm = 0xFFFFFFDE
cmpl %esi, %edx
ja 0x4a3ea
movq (%rcx), %rax
addq %rbx, %rax
leaq -0x18(%rbp), %rcx
movq %rax, (%rcx)
movl $0xff, %r8d
subl %ebx, %r8d
leaq -0xc(%rbp), %rdx
callq 0x4a33c
movl %eax, %ecx
xorl %eax, %eax
testl %ecx, %ecx
cmovnsl %ebx, %eax
addl %ecx, %eax
jmp 0x4a3ea
leal 0x1(%rax), %esi
movl %esi, (%rdx)
movb (%rdi,%rax), %dl
movq (%rcx), %rcx
leal 0x1(%rbx), %eax
movb %dl, (%rcx,%rbx)
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/mDNSResolver.cpp
// Function: mDNSResolver::Resolver::search(char const*)
IPAddress Resolver::search(const char* name) {
    if(!isMDNSName(name)) {
      return INADDR_NONE;
    }

    cache.expire();

    int attempts = 0;

    while(attempts < MDNS_ATTEMPTS) {
      int index = cache.search(name);

      if(index == -1) {
        cache.insert(Response(name, 5));
        continue;
      } else if(cache[index].resolved) {
        return cache[index].ipAddress;
      }

      long now = millis();

      // Send a query packet every second
      if(now - timeout > MDNS_RETRY) {
        query(name);
        timeout = now;
        attempts++;
      }

      MDNS_RESULT result = read();
      if(result != E_MDNS_OK) {
        return INADDR_NONE;
      }
    }

    return INADDR_NONE;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x128, %rsp            # imm = 0x128
movq %rsi, %rbx
movq %rdi, -0x38(%rbp)
callq 0x4c2d8
testb %al, %al
je 0x4c2a4
leaq 0x1d4e1(%rip), %r15     # 0x696b0
movq %r15, %rdi
callq 0x3a6ae
xorl %r13d, %r13d
leaq -0x150(%rbp), %r14
movq %r15, %rdi
movq %rbx, %rsi
callq 0x3a652
cmpl $-0x1, %eax
je 0x4c222
movl %eax, %r12d
movq %r15, %rdi
movl %eax, %esi
callq 0x3a3ae
cmpb $0x1, 0x108(%rax)
jne 0x4c24c
movq %r15, %rdi
movl %r12d, %esi
callq 0x3a3ae
movl 0x10c(%rax), %eax
movl %eax, -0x2c(%rbp)
movl $0x1, %ecx
jmp 0x4c295
movl $0x5, %edx
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3c36c
movq %r15, %rdi
movq %r14, %rsi
callq 0x3a3c2
movq %r14, %rdi
callq 0x3c3ce
movl $0x2, %ecx
jmp 0x4c295
callq 0x4c7f4
movq %rax, %r12
movq -0x38(%rbp), %rdi
subq 0x28(%rdi), %rax
cmpq $0x3e9, %rax            # imm = 0x3E9
jl 0x4c27b
movq -0x38(%rbp), %rdi
movq %rbx, %rsi
callq 0x4c318
movq -0x38(%rbp), %rdi
movq %r12, 0x28(%rdi)
incl %r13d
callq 0x4c39a
xorl %ecx, %ecx
cmpl $0x20, %eax
setne %al
je 0x4c293
movl 0x1d418(%rip), %edx     # 0x696a8
movl %edx, -0x2c(%rbp)
movb %al, %cl
testb $0x1, %cl
jne 0x4c2bc
cmpl $0x5, %r13d
jl 0x4c1e1
movl 0x1d3fe(%rip), %eax     # 0x696a8
addq $0x128, %rsp            # imm = 0x128
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl -0x2c(%rbp), %eax
jmp 0x4c2aa
movq %rax, %rbx
leaq -0x150(%rbp), %rdi
callq 0x3c3ce
movq %rbx, %rdi
callq 0xb6d0
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/mDNSResolver.cpp
// Function: mDNSResolver::Resolver::isMDNSName(char const*)
bool Resolver::isMDNSName(const char* name) {
    int len = strlen(name);
    int tldLen = strlen(MDNS_TLD);

    if(len < tldLen) {
      return false;
    }

    return strcmp(name + len - tldLen, MDNS_TLD) == 0;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rsi, %rdi
callq 0xb180
cmpl $0x6, %eax
jge 0x4c2f2
xorl %eax, %eax
jmp 0x4c310
andl $0x7fffffff, %eax       # imm = 0x7FFFFFFF
leaq (%rbx,%rax), %rdi
addq $-0x6, %rdi
leaq 0x3787(%rip), %rsi      # 0x4fa8d
callq 0xb510
testl %eax, %eax
sete %al
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/mDNSResolver.cpp
// Function: mDNSResolver::Resolver::query(char const*)
void Resolver::query(const char* name) {
    Query query(name);
    
#if defined(ESP32)
	udp.beginMulticast(MDNS_BROADCAST_IP, MDNS_PORT);
	udp.beginMulticastPacket();
#else
	udp.beginPacketMulticast(MDNS_BROADCAST_IP, MDNS_PORT, localIP, UDP_TIMEOUT);
#endif
    query.sendPacket(udp);
    udp.endPacket();
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %rbx
subq $0x18, %rsp
movq %rdi, %rbx
leaq -0x10(%rbp), %rdi
callq 0x32e90
leaq -0x14(%rbp), %rdi
movl $0xe0, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xfb, %r8d
callq 0x4c7a4
movl 0x20(%rbx), %ecx
addq $0x8, %rbx
movl -0x14(%rbp), %esi
movq %rbx, %rdi
movl $0x14e9, %edx           # imm = 0x14E9
movl $0xff, %r8d
callq 0x4c6ec
leaq -0x10(%rbp), %rdi
movq %rbx, %rsi
callq 0x32ea0
movq %rbx, %rdi
callq 0x4c6f4
leaq -0x10(%rbp), %rdi
callq 0x32e9a
addq $0x18, %rsp
popq %rbx
popq %rbp
retq
movq %rax, %rbx
leaq -0x10(%rbp), %rdi
callq 0x32e9a
movq %rbx, %rdi
callq 0xb6d0
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/mDNSResolver.cpp
// Function: mDNSResolver::Resolver::read()
MDNS_RESULT Resolver::read() {
    cache.expire();

    if(!init) {
      init = true;
#if defined(ESP32)
	udp.beginMulticast(MDNS_BROADCAST_IP, MDNS_PORT);
#else
	udp.beginMulticast(localIP, MDNS_BROADCAST_IP, MDNS_PORT);
#endif
    }

    unsigned int len = udp.parsePacket();

    if(len > 0) {
      unsigned char *buffer = (unsigned char *)malloc(sizeof(unsigned char) * len);

      if(buffer == NULL) {
        // Out of memory - the packet is probably too big to parse. Probably.
        // Silently bombing out, possibly isn't great, but it'll do for the moment.
        return E_MDNS_OUT_OF_MEMORY;
      }

      udp.read(buffer, len);
      lastResult = Answer::process(buffer, len, cache);

      free(buffer);
      return lastResult;
    }

    return E_MDNS_OK;
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x1d2fe(%rip), %rdi     # 0x696b0
callq 0x3a6ae
cmpb $0x0, 0x24(%rbx)
jne 0x4c3f8
movb $0x1, 0x24(%rbx)
leaq 0x8(%rbx), %r14
movl 0x20(%rbx), %r15d
leaq -0x2c(%rbp), %r12
movq %r12, %rdi
movl $0xe0, %esi
xorl %edx, %edx
xorl %ecx, %ecx
movl $0xfb, %r8d
callq 0x4c7a4
movl (%r12), %edx
movq %r14, %rdi
movl %r15d, %esi
movl $0x14e9, %ecx           # imm = 0x14E9
callq 0x4c6d4
leaq 0x8(%rbx), %r12
movq %r12, %rdi
callq 0x4c78e
testl %eax, %eax
je 0x4c44d
movl %eax, %r14d
movl %eax, %r13d
movq %r13, %rdi
callq 0xb4e0
testq %rax, %rax
je 0x4c455
movq %rax, %r15
movq %r12, %rdi
movq %rax, %rsi
movq %r13, %rdx
callq 0x4c718
leaq 0x1d27d(%rip), %rdx     # 0x696b0
movq %r15, %rdi
movl %r14d, %esi
callq 0x49ccc
movl %eax, %r14d
movl %eax, (%rbx)
movq %r15, %rdi
callq 0xb480
jmp 0x4c45b
movl $0x20, %r14d
jmp 0x4c45b
movl $0x27, %r14d
movl %r14d, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/src/mDNSResolver.cpp
// Function: mDNSResolver::Resolver::loop()
void Resolver::loop() {
    // Clear the buffers out.
    // This wouldn't be needed if the UDP library had the ability to
    // leave a multicast group
    unsigned int len = udp.parsePacket();
    unsigned char *buffer = (unsigned char *)malloc(sizeof(unsigned char) * len);
    if(buffer != NULL) {
      udp.read(buffer, len);
      free(buffer);
    }
  }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
addq $0x8, %rbx
movq %rbx, %rdi
callq 0x4c78e
movl %eax, %r14d
movq %r14, %rdi
callq 0xb4e0
testq %rax, %rax
je 0x4c4ba
movq %rax, %r15
movq %rbx, %rdi
movq %rax, %rsi
movq %r14, %rdx
callq 0x4c718
movq %r15, %rdi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0xb480
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/mocks/WiFiUdp.cpp
// Function: WiFiUDP::WiFiUDP(unsigned char*, int)
WiFiUDP::WiFiUDP(unsigned char *buffer, int length) {
  this->readBuffer = NULL;
  this->writeBuffer = NULL;
  this->readBufferLength = 0;
  this->writeBufferLength = 0;
  this->setReadBuffer(buffer, length);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq %edx, %r15
movq %r15, %rdi
callq 0xb4e0
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movq %rax, (%r14)
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xb2f0
movl %r15d, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/mocks/WiFiUdp.cpp
// Function: WiFiUDP::setReadBuffer(unsigned char*, int)
void WiFiUDP::setReadBuffer(unsigned char *buffer, int length) {
  //if(this->readBuffer != NULL) {
    //free(this->readBuffer);
    //this->readBuffer = NULL;
  //}

  this->readBuffer = (unsigned char *)malloc(sizeof(unsigned char) * length);
  memcpy(this->readBuffer, buffer, length);
  this->readBufferLength = length;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movslq %edx, %r15
movq %r15, %rdi
callq 0xb4e0
movq %rax, (%r14)
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0xb2f0
movl %r15d, 0x10(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/mocks/WiFiUdp.cpp
// Function: WiFiUDP::loadFromFile(char const*)
WiFiUDP* WiFiUDP::loadFromFile(const char *path) {
  unsigned char *source = NULL;
  WiFiUDP* udp = new WiFiUDP;

  FILE *fp = fopen(path, "rb");

  if(fp != NULL) {
    if(fseek(fp, 0L, SEEK_END) != 0) {
      fprintf(stderr, "ERROR: Unable to seek to the end of the file: %s\n", path);
      fclose(fp);
      return udp;
    }

    long bufsize = ftell(fp);
    if(bufsize == -1) {
      fprintf(stderr, "ERROR: Unable to get file position\n");
      fclose(fp);
      return udp;
    }

    // Need to do something more c++ friendly, as this is a memory leak
    source = (unsigned char *)malloc(sizeof(unsigned char) * (bufsize + 1));
    if(fseek(fp, 0L, SEEK_SET) != 0) {
      fprintf(stderr, "ERROR: Unable to see to the beginning of the file: %s\n", path);
      fclose(fp);
      return udp;
    }

    size_t len = fread(source, sizeof(unsigned char), bufsize, fp);
    if(ferror(fp) != 0) {
      fprintf(stderr, "ERROR: Unable to read the file (%i): %s\n", ferror(fp), path);
      fclose(fp);
      return udp;
    }

    udp->setReadBuffer(source, len);
    fclose(fp);
    return udp;
  } else {
    fprintf(stderr, "ERROR: Unable to seek to open file: %s\n", path);
  }

  return udp;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %r15
movl $0x18, %edi
callq 0xb3b0
movq %rax, %rbx
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
movq $0x0, 0x10(%rax)
leaq 0x4af1(%rip), %rsi      # 0x5108c
movq %r15, %rdi
callq 0xb460
testq %rax, %rax
je 0x4c65b
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0xb410
testl %eax, %eax
jne 0x4c678
movq %r14, %rdi
callq 0xb030
cmpq $-0x1, %rax
je 0x4c68b
movq %rax, %r13
leaq 0x1(%rax), %rdi
callq 0xb4e0
movq %rax, %r12
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0xb410
testl %eax, %eax
jne 0x4c695
movl $0x1, %esi
movq %r12, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0xb590
movq %rax, %r13
movq %r14, %rdi
callq 0xb730
testl %eax, %eax
jne 0x4c6b2
movslq %r13d, %r15
movq %r15, %rdi
callq 0xb4e0
movq %rax, (%rbx)
movq %rax, %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0xb2f0
movl %r15d, 0x10(%rbx)
movq %r14, %rdi
callq 0xb3a0
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x1c95e(%rip), %rax     # 0x68fc0
movq (%rax), %rdi
leaq 0x4ad9(%rip), %rsi      # 0x51145
movq %r15, %rdx
xorl %eax, %eax
callq 0xb530
jmp 0x4c649
movq 0x1c941(%rip), %rax     # 0x68fc0
movq (%rax), %rdi
leaq 0x4a06(%rip), %rsi      # 0x5108f
jmp 0x4c6a6
movq %r14, %rdi
callq 0xba79
jmp 0x4c649
movq 0x1c924(%rip), %rax     # 0x68fc0
movq (%rax), %rdi
leaq 0x4a3f(%rip), %rsi      # 0x510e5
movq %r15, %rdx
xorl %eax, %eax
callq 0xb530
jmp 0x4c641
movq 0x1c907(%rip), %rcx     # 0x68fc0
movq (%rcx), %rdi
leaq 0x4a59(%rip), %rsi      # 0x5111c
movl %eax, %edx
movq %r15, %rcx
xorl %eax, %eax
callq 0xb530
jmp 0x4c641
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/mocks/WiFiUdp.cpp
// Function: WiFiUDP::write(unsigned char const*, unsigned long)
size_t WiFiUDP::write(const uint8_t *buffer, size_t size) {
  //if(this->writeBuffer != NULL) {
    //free(this->writeBuffer);
    //this->writeBuffer = NULL;
  //}

  this->writeBuffer = (unsigned char *)malloc(sizeof(unsigned char) * size);
  memcpy(this->writeBuffer, buffer, size);
  this->writeBufferLength = size;

  return size;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r14
movq %rdi, %r15
movq %rdx, %rdi
callq 0xb4e0
movq %rax, 0x8(%r15)
movq %rax, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0xb2f0
movl %ebx, 0x14(%r15)
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/madpilot[P]mDNSResolver/mocks/IPAddress.cpp
// Function: IPAddress::IPAddress(unsigned char, unsigned char, unsigned char, unsigned char)
IPAddress::IPAddress(uint8_t first_octet, uint8_t second_octet, uint8_t third_octet, uint8_t fourth_octet)
{
    _address.bytes[0] = first_octet;
    _address.bytes[1] = second_octet;
    _address.bytes[2] = third_octet;
    _address.bytes[3] = fourth_octet;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
movb %sil, (%rdi)
movb %dl, 0x1(%rdi)
movb %cl, 0x2(%rdi)
movb %r8b, 0x3(%rdi)
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::clear(node_s*)
void bntree::clear(node_t *p) {
    if (p != NULL) {
        if (p->right) {
            this->clear(p->right);
            this->node_free(p->right);
        }

        if (p->left) {
            this->clear(p->left);
            this->node_free(p->left);
        }
    }
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
testq %rsi, %rsi
je 0x2438
movq %rsi, %rbx
movq %rdi, %r14
movq 0x50(%rsi), %rsi
testq %rsi, %rsi
je 0x2417
movq %r14, %rdi
callq 0x23ee
movq 0x50(%rbx), %rsi
callq 0x2486
movq 0x48(%rbx), %rsi
testq %rsi, %rsi
je 0x2438
movq %r14, %rdi
callq 0x23ee
movq 0x48(%rbx), %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
jmp 0x2486
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::search(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
uint64_t bntree::search(string key) {
    if (!this->tree->root) {
        return -1;
    }

    node_t *search_node = this->tree->root;
    uint64_t index_node = this->get_child_weight(search_node->left);

    for (;;) {
        if (key == search_node->data.key) {
            return index_node; // найден узел с таким ключем, вернем его индекс
        } else if (key > search_node->data.key) {
            search_node = search_node->right;

            if (search_node == NULL)
                return -1;

            index_node += (this->get_child_weight(search_node->left) + 1);
        } else {
            search_node = search_node->left;

            if (search_node == NULL)
                return -1;

            index_node -= (this->get_child_weight(search_node->left) + 1);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq (%rdi), %rax
movq (%rax), %r15
movq $-0x1, %rbx
testq %r15, %r15
je 0x2568
movq %rsi, %r14
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x24ec
movq 0x40(%rax), %r12
jmp 0x24ef
xorl %r12d, %r12d
movq 0x8(%r14), %rdx
cmpq 0x8(%r15), %rdx
jne 0x250d
testq %rdx, %rdx
je 0x2565
movq (%r15), %rsi
movq (%r14), %rdi
callq 0x2180
testl %eax, %eax
je 0x2565
movq %r14, %rdi
movq %r15, %rsi
callq 0x2040
testl %eax, %eax
jle 0x2537
movq 0x50(%r15), %r15
testq %r15, %r15
je 0x2568
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x2552
movq 0x40(%rax), %rax
incq %rax
jmp 0x2560
movq 0x48(%r15), %r15
testq %r15, %r15
je 0x2568
movq 0x48(%r15), %rax
testq %rax, %rax
je 0x2559
movq 0x40(%rax), %rax
notq %rax
jmp 0x2560
movl $0x1, %eax
jmp 0x2560
movq $-0x1, %rax
addq %rax, %r12
jmp 0x24ef
movq %r12, %rbx
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq %rax, %rdi
callq 0x2f59
nop
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::erase_simple(node_s*)
bool bntree::erase_simple(node_t *search_node) {

    node_t *prev_node = search_node->parent;

    if (!search_node->left && !search_node->right) {
        // Удаляемый узел является листом.

        // Обнуляем соответствующую ссылку родителя.
        if (prev_node == NULL) {
            // Удаляемый узел корень.
            this->tree->root = NULL;
        } else if (prev_node->left == search_node) {
            prev_node->left = NULL;
        } else if (prev_node->right == search_node) {
            prev_node->right = NULL;
        }

    } else if (search_node->left && !search_node->right) {
        // Удаляемый узел имеет только левого ребенка.

        // Перекомпануем ссылки родителя на левого внука.
        if (prev_node == NULL) {
            // Удаляемый узел корень.
            this->tree->root = search_node->left;
            this->tree->root->parent = NULL;
        } else if (prev_node->left == search_node) {
            prev_node->left = search_node->left;
            search_node->left->parent = prev_node;
        } else if (prev_node->right == search_node) {
            prev_node->right = search_node->left;
            search_node->left->parent = prev_node;
        }

    } else if (!search_node->left && search_node->right) {
        // Удаляемый узел имеет только правого ребенка.

        // Перекомпануем ссылки родителя на правого внука.
        if (prev_node == NULL) {
            // Удаляемый узел корень.
            this->tree->root = search_node->right;
            this->tree->root->parent = NULL;
        } else if (prev_node->left == search_node) {
            prev_node->left = search_node->right;
            search_node->right->parent = prev_node;
        } else if (prev_node->right == search_node) {
            prev_node->right = search_node->right;
            search_node->right->parent = prev_node;
        }

    } else {
        // Удаляемый узел имеет двух детей. Здесь не обрабатываем.

        return false;
    }

    return true;
}

// Assembly:
movq 0x48(%rsi), %rdx
movq 0x58(%rsi), %rcx
testq %rdx, %rdx
je 0x287d
cmpq $0x0, 0x50(%rsi)
je 0x28b2
testq %rdx, %rdx
jne 0x28af
jmp 0x2889
cmpq $0x0, 0x50(%rsi)
je 0x28de
testq %rdx, %rdx
jne 0x286f
movq 0x50(%rsi), %rdx
testq %rdx, %rdx
je 0x28af
testq %rcx, %rcx
je 0x28ce
cmpq %rsi, 0x48(%rcx)
je 0x2914
movb $0x1, %al
cmpq %rsi, 0x50(%rcx)
jne 0x28b1
movq %rdx, 0x50(%rcx)
movq 0x50(%rsi), %rdx
jmp 0x28c9
xorl %eax, %eax
retq
testq %rcx, %rcx
je 0x28ce
cmpq %rsi, 0x48(%rcx)
je 0x28fa
movb $0x1, %al
cmpq %rsi, 0x50(%rcx)
jne 0x28b1
movq %rdx, 0x50(%rcx)
movq %rcx, 0x58(%rdx)
retq
movq (%rdi), %rax
movq %rdx, (%rax)
movq $0x0, 0x58(%rdx)
jmp 0x2926
testq %rcx, %rcx
je 0x2908
cmpq %rsi, 0x48(%rcx)
je 0x291e
movb $0x1, %al
cmpq %rsi, 0x50(%rcx)
jne 0x28b1
movq $0x0, 0x50(%rcx)
retq
movq %rdx, 0x48(%rcx)
movq 0x48(%rsi), %rax
movq %rcx, 0x58(%rax)
jmp 0x2926
movq (%rdi), %rax
movq $0x0, (%rax)
jmp 0x2926
movq %rdx, 0x48(%rcx)
movq %rcx, 0x58(%rdx)
jmp 0x2926
movq $0x0, 0x48(%rcx)
movb $0x1, %al
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::get(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
data_t *bntree::get(string key) {
    node_t *search_node = this->tree->root;
    uint64_t index_node = this->get_child_weight(search_node->left);

    for (;;) {
        if (key == search_node->data.key) {
            return &search_node->data;
        } else if (key > search_node->data.key) {
            search_node = search_node->right;
            index_node += (this->get_child_weight(search_node->left) + 1);
        } else {
            search_node = search_node->left;
            index_node -= (this->get_child_weight(search_node->right) + 1);
        }
    }

    return NULL;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq (%rdi), %rax
movq (%rax), %r14
movq 0x8(%rbx), %rdx
cmpq 0x8(%r14), %rdx
jne 0x2cc3
testq %rdx, %rdx
je 0x2cdf
movq (%r14), %rsi
movq (%rbx), %rdi
callq 0x2180
testl %eax, %eax
je 0x2cdf
movq %rbx, %rdi
movq %r14, %rsi
callq 0x2040
xorl %ecx, %ecx
testl %eax, %eax
setg %cl
leaq (%r14,%rcx,8), %rax
addq $0x48, %rax
jmp 0x2ca2
movq %r14, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movq %rax, %rdi
callq 0x2f59
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::print(node_s*, int)
void bntree::print(node_t *p, int indent) {
    if (p != NULL) {
        if (p->right) {
            this->print(p->right, indent + 4);
        }
        if (indent) {
            //std::cout << std::setw(indent) << ' ' << p->weight << ' ';
            std::cout << std::setw(indent) << ' ';
        }
        if (p->right) {
            std::cout << " /\n" << std::setw(indent) << ' ';
        }
        //std::cout << p->data.key << ":" << p->data.val << "\n ";
        std::cout << p->data.key << ":" << p << ":" << p->parent << "\n ";
        if (p->left) {
            std::cout << std::setw(indent) << ' ' << " \\\n";
            this->print(p->left, indent + 4);
        }
    }
}

// Assembly:
testq %rsi, %rsi
je 0x2e79
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %edx, %ebx
movq %rsi, %r15
movq %rdi, %r12
movq 0x50(%rsi), %rsi
testq %rsi, %rsi
je 0x2d35
leal 0x4(%rbx), %edx
movq %r12, %rdi
callq 0x2d02
movslq %ebx, %r14
testl %ebx, %ebx
je 0x2d61
movq 0x3295(%rip), %rdi      # 0x5fd8
movq (%rdi), %rax
movq -0x18(%rax), %rax
movq %r14, 0x10(%rdi,%rax)
leaq 0xd(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
callq 0x2190
movq %r12, 0x10(%rsp)
cmpq $0x0, 0x50(%r15)
je 0x2daa
movq 0x3264(%rip), %r12      # 0x5fd8
leaq 0x12a5(%rip), %rsi      # 0x4020
movl $0x3, %edx
movq %r12, %rdi
callq 0x2190
movq (%r12), %rax
movq -0x18(%rax), %rax
movq %r14, 0x10(%r12,%rax)
leaq 0xe(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %r12, %rdi
callq 0x2190
movq (%r15), %rsi
movq 0x8(%r15), %rdx
movq 0x3220(%rip), %r12      # 0x5fd8
movq %r12, %rdi
callq 0x2190
movq %rax, %r13
leaq 0x125a(%rip), %rbp      # 0x4024
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2190
movq %r13, %rdi
movq %r15, %rsi
callq 0x2100
movq %rax, %r13
movl $0x1, %edx
movq %rax, %rdi
movq %rbp, %rsi
callq 0x2190
movq 0x58(%r15), %rsi
movq %r13, %rdi
callq 0x2100
leaq 0x121b(%rip), %rsi      # 0x4026
movl $0x2, %edx
movq %rax, %rdi
callq 0x2190
cmpq $0x0, 0x48(%r15)
movq 0x10(%rsp), %r13
je 0x2e6b
movq (%r12), %rax
movq -0x18(%rax), %rax
movq %r14, 0x10(%r12,%rax)
leaq 0xf(%rsp), %rsi
movb $0x20, (%rsi)
movl $0x1, %edx
movq %r12, %rdi
callq 0x2190
leaq 0x11dc(%rip), %rsi      # 0x4029
movl $0x3, %edx
movq %rax, %rdi
callq 0x2190
movq 0x48(%r15), %rsi
addl $0x4, %ebx
movq %r13, %rdi
movl %ebx, %edx
callq 0x2d02
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::weight_to_depth(node_s*)
uint64_t bntree::weight_to_depth(node_t *p) {
    if (p == NULL) {
        return 0;
    }

    if (p->weight == 1) {
        return 1;
    } else if (p->weight == 2) {
        return 2;
    }

    return this->ilog2(this->cpl2(p->weight));
}

// Assembly:
testq %rsi, %rsi
je 0x2eee
movq 0x40(%rsi), %rax
leaq -0x1(%rax), %rcx
cmpq $0x2, %rcx
jb 0x2eed
pushq %rbx
subq $0x10, %rsp
movq %rcx, %rax
shrq %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x2, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x4, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x8, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x10, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x20, %rcx
orq %rax, %rcx
incq %rcx
cvtsi2sd %rcx, %xmm0
leaq 0xc(%rsp), %rbx
movq %rbx, %rdi
callq 0x2200
movl (%rbx), %eax
decl %eax
cltq
addq $0x10, %rsp
popq %rbx
retq
xorl %eax, %eax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/bntree.cpp
// Function: bntree::cpl2(unsigned long)
uint64_t bntree::cpl2(uint64_t x) {
    x = x - 1;
    x = x | (x >> 1);
    x = x | (x >> 2);
    x = x | (x >> 4);
    x = x | (x >> 8);
    x = x | (x >> 16);
    x = x | (x >> 32);

    return x + 1;
}

// Assembly:
leaq -0x1(%rsi), %rax
movq %rax, %rcx
shrq %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x2, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x4, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x8, %rax
orq %rcx, %rax
movq %rax, %rcx
shrq $0x10, %rcx
orq %rax, %rcx
movq %rcx, %rax
shrq $0x20, %rax
orq %rcx, %rax
incq %rax
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/dvjdjvu[P]bntree/./src/test.cpp
// Function: std::vector<std::pair<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>> get_sequence<std::vector<std::pair<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>, std::allocator<std::pair<unsigned long, std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>>>>>(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>> const&)
S get_sequence(const string& _file_name)
{
    ifstream infile(_file_name);
    S result;

    typename S::value_type item;

    while (infile >> item)
    {
        result.emplace_back(move(item));
    }

    return result;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x230, %rsp            # imm = 0x230
movq %rdi, %rbx
leaq 0x28(%rsp), %r14
movq %r14, %rdi
movl $0x8, %edx
callq 0x21c0
xorl %eax, %eax
movq %rax, 0x10(%rbx)
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
leaq 0x8(%rsp), %r15
movq %rax, -0x8(%r15)
leaq 0x18(%rsp), %r13
movq %r13, -0x10(%r13)
movq %rax, -0x8(%r13)
movb $0x0, (%r13)
movq %rsp, %r12
movq %r14, %rdi
movq %r12, %rsi
callq 0x20c0
movq %r14, %rdi
movq %r15, %rsi
callq 0x21a0
movq 0x28(%rsp), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x48(%rsp,%rax)
jne 0x3895
movq %rbx, %rdi
movq %r12, %rsi
callq 0x3cf8
jmp 0x3862
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x38a4
callq 0x2140
leaq 0x28(%rsp), %rdi
callq 0x2060
movq %rbx, %rax
addq $0x230, %rsp            # imm = 0x230
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %rax, %r14
movq 0x8(%rsp), %rdi
cmpq %r13, %rdi
je 0x38d4
callq 0x2140
movq %rbx, %rdi
callq 0x38ee
leaq 0x28(%rsp), %rdi
callq 0x2060
movq %r14, %rdi
callq 0x21e0
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/TLB.cpp
// Function: TLB::operator[](int)
int& TLB::operator[] (const int pnum) {
	// before returning a reference to tb[pnum], update the queue according to LRU policy
	if (tb.count(pnum))
		// if pnum is in tb
		q.remove(pnum);
	else {
		// TLB miss; tb[pnum] will create a new entry in tb and reference 0 (default int)
		if (q.size() == TLB_SIZE) {
			// if queue (TLB) full
			int victim = q.front();	// victim page number
			tb.erase(tb.find(victim));	// remove victim entry
			q.pop_front();
		}
	}
	q.push_back(pnum);	// add pnum at the end of queue

	return tb[pnum];
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %esi, %eax
movq %rdi, %rbx
movl %esi, -0x1c(%rbp)
movq 0x10(%rdi), %rcx
leaq 0x8(%rdi), %rsi
movq %rsi, %rdx
testq %rcx, %rcx
je 0x25cc
movq %rcx, %rdi
movq %rsi, %rdx
xorl %r8d, %r8d
cmpl %eax, 0x20(%rdi)
setl %r8b
cmovgeq %rdi, %rdx
movq 0x10(%rdi,%r8,8), %rdi
testq %rdi, %rdi
jne 0x25b4
movq %rsi, %rdi
cmpq %rsi, %rdx
je 0x25de
cmpl %eax, 0x20(%rdx)
cmovgq %rsi, %rdx
movq %rdx, %rdi
leaq 0x30(%rbx), %r14
cmpq %rsi, %rdi
je 0x25f5
leaq -0x1c(%rbp), %rsi
movq %r14, %rdi
callq 0x268a
jmp 0x2650
cmpq $0x10, 0x40(%rbx)
jne 0x2650
movq (%r14), %rax
movl 0x10(%rax), %eax
movq %rsi, %rdx
testq %rcx, %rcx
je 0x2624
movq %rsi, %rdx
xorl %edi, %edi
cmpl %eax, 0x20(%rcx)
setl %dil
cmovgeq %rcx, %rdx
movq 0x10(%rcx,%rdi,8), %rcx
testq %rcx, %rcx
jne 0x260d
cmpq %rsi, %rdx
je 0x2630
cmpl 0x20(%rdx), %eax
cmovgeq %rdx, %rsi
movq %rbx, %rdi
callq 0x2790
movq 0x30(%rbx), %r15
decq 0x40(%rbx)
movq %r15, %rdi
callq 0x2340
movq %r15, %rdi
callq 0x2200
movl $0x18, %edi
callq 0x2220
leaq -0x1c(%rbp), %r15
movl (%r15), %ecx
movl %ecx, 0x10(%rax)
movq %rax, %rdi
movq %r14, %rsi
callq 0x2060
incq 0x40(%rbx)
movq %rbx, %rdi
movq %r15, %rsi
callq 0x271a
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/PageTable.cpp
// Function: PageTable::~PageTable()
PageTable::~PageTable() {
	// commit all dirty pages to backing store
	for (auto const& kv : pt) {
		if (kv.second.second)
			bs.write(kv.first, kv.second.first);
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movq 0x18(%rdi), %r15
leaq 0x8(%rdi), %r12
cmpq %r12, %r15
je 0x2ca5
leaq 0x98(%rbx), %r14
cmpb $0x1, 0x28(%r15)
jne 0x2c95
movl 0x20(%r15), %esi
movl 0x24(%r15), %edx
movq %r14, %rdi
callq 0x3994
movq %r15, %rdi
callq 0x21a0
movq %rax, %r15
cmpq %r12, %rax
jne 0x2c7e
leaq 0x3a8(%rbx), %r14
leaq 0x3d8(%rbx), %r15
movq 0x3d8(%rbx), %rdi
cmpq %r15, %rdi
je 0x2ccf
movq (%rdi), %r12
callq 0x2200
movq %r12, %rdi
cmpq %r15, %r12
jne 0x2cbf
movq %r14, %rdi
callq 0x3214
leaq 0x98(%rbx), %rdi
callq 0x31aa
leaq 0x80(%rbx), %r14
movq 0x80(%rbx), %rdi
cmpq %r14, %rdi
je 0x2d06
movq (%rdi), %r15
callq 0x2200
movq %r15, %rdi
cmpq %r14, %r15
jne 0x2cf6
movq 0x60(%rbx), %rdi
leaq 0x70(%rbx), %rax
cmpq %rax, %rdi
je 0x2d18
callq 0x2200
leaq 0x30(%rbx), %rdi
callq 0x326c
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x32c4
movq %rax, %r15
leaq 0x3a8(%rbx), %rdi
callq 0x316e
movq %r14, %rdi
callq 0x31aa
leaq 0x80(%rbx), %rdi
callq 0x31d8
leaq 0x60(%rbx), %rdi
callq 0x2110
leaq 0x30(%rbx), %rdi
callq 0x3200
movq %rbx, %rdi
callq 0x320a
movq %r15, %rdi
callq 0x2290
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/PageTable.cpp
// Function: PageTable::getFreeFrameNum()
int PageTable::getFreeFrameNum() {
	/*
	Find a free frame and return its frame number
	*/
	int fnum;
	if (!fs.empty()) {
		fnum = *fs.begin();		// always get the free frame with the smallest frame number
		fs.erase(fnum);			// remove fnum from the set of free frames
	}
	else {	// need to replace a page, q is full (since we don't delete a page by itself, fs.size() == 64 - q.size())
		// either FIFO or LRU replaces the page at the front of the queue
		int pnum = q.front();	// victim page number
		fnum = pt[pnum].first;

		// if a dirty page, write its memory frame to backing store
		if (pt[pnum].second) {
			bs.write(pnum, fnum);
			setDirty(pnum, false);	// reset dirty bit
		}

		pt[pnum].first = -1;	// reset victim page's frame number
		q.pop_front();
	}
	return fnum;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
cmpq $0x0, 0x58(%rdi)
je 0x2f3c
movq 0x48(%rbx), %rax
addq $0x30, %rbx
movl 0x20(%rax), %eax
leaq -0x18(%rbp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x37ac
movq %rbx, %rdi
movq %rax, %rsi
callq 0x3828
jmp 0x2fc5
movq 0x80(%rbx), %rax
movl 0x10(%rax), %eax
leaq -0x14(%rbp), %r14
movl %eax, (%r14)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3106
movl (%rax), %eax
movl %eax, -0x18(%rbp)
movq %rbx, %rdi
movq %r14, %rsi
callq 0x3106
cmpb $0x1, 0x4(%rax)
jne 0x2f95
leaq 0x98(%rbx), %rdi
movl -0x14(%rbp), %esi
movl -0x18(%rbp), %edx
callq 0x3994
movl -0x14(%rbp), %eax
leaq -0x1c(%rbp), %rsi
movl %eax, (%rsi)
movq %rbx, %rdi
callq 0x3106
movb $0x0, 0x4(%rax)
leaq -0x14(%rbp), %rsi
movq %rbx, %rdi
callq 0x3106
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
movq 0x80(%rbx), %r14
decq 0x90(%rbx)
movq %r14, %rdi
callq 0x2340
movq %r14, %rdi
callq 0x2200
movl -0x18(%rbp), %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/PageTable.cpp
// Function: operator<<(std::ostream&, PageTable const&)
ostream& operator<<(ostream &strm, const PageTable &PT) {
	for (auto const& kv : PT.pt) {
		if (kv.second.first != -1)
			strm << kv.first << ' ' << kv.second.first << endl;
	}
	return strm;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq 0x18(%rsi), %r15
addq $0x8, %r14
cmpq %r14, %r15
je 0x3063
leaq -0x29(%rbp), %r12
cmpl $-0x1, 0x24(%r15)
je 0x3053
movl 0x20(%r15), %esi
movq %rbx, %rdi
callq 0x2380
movb $0x20, -0x29(%rbp)
movl $0x1, %edx
movq %rax, %rdi
movq %r12, %rsi
callq 0x2240
movl 0x24(%r15), %esi
movq %rax, %rdi
callq 0x2380
movq %rax, %r13
movq (%rax), %rax
movq -0x18(%rax), %rdi
addq %r13, %rdi
movl $0xa, %esi
callq 0x2210
movsbl %al, %esi
movq %r13, %rdi
callq 0x2030
movq %rax, %rdi
callq 0x2190
movq %r15, %rdi
callq 0x2250
movq %rax, %r15
cmpq %r14, %rax
jne 0x2ff6
movq %rbx, %rax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/./BackingStore.h
// Function: BackingStore::BackingStore(std::__cxx11::basic_string<char, std::char_traits<char>, std::allocator<char>>)
BackingStore(std::string name) {
		// open the file that simulates disk in rw mode
		store.open(name, std::ios::binary | std::ios::in | std::ios::out);	// c++11 allows istream.open string rather than char*
		if (!store)
			throw std::invalid_argument("Can't open backing store file!");
	}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
callq 0x2260
movq %rbx, %rdi
movq %r14, %rsi
movl $0x1c, %edx
callq 0x22c0
movq (%rbx), %rax
movq -0x18(%rax), %rax
testb $0x5, 0x20(%rbx,%rax)
jne 0x30b4
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl $0x10, %edi
callq 0x2120
movq %rax, %r14
leaq 0x1f6e(%rip), %rsi      # 0x5036
movq %rax, %rdi
callq 0x23d0
movq 0x4ef9(%rip), %rsi      # 0x7fd0
movq 0x4ee2(%rip), %rdx      # 0x7fc0
movq %r14, %rdi
callq 0x2370
movq %rax, %r15
movq %r14, %rdi
callq 0x21c0
jmp 0x30f6
movq %rax, %r15
movq %rbx, %rdi
callq 0x2090
movq %r15, %rdi
callq 0x2390
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/BackingStore.cpp
// Function: BackingStore::read(int)
void BackingStore::read(int pnum) {
	assert(!store.eof());

	// seek to the page at pnum
	if (store.seekg(pnum * FRAME_SIZE, ios::beg))
		store.read((char *)buff, FRAME_SIZE);
	else
		throw runtime_error("Seek error");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq (%rdi), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%rdi,%rax)
jne 0x392f
movq %rdi, %rbx
shll $0x8, %esi
movslq %esi, %rsi
xorl %edx, %edx
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x394e
leaq 0x210(%rbx), %rsi
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x2270
leaq 0x174a(%rip), %rdi      # 0x5080
leaq 0x1750(%rip), %rsi      # 0x508d
leaq 0x175a(%rip), %rcx      # 0x509e
movl $0xd, %edx
callq 0x2180
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
leaq 0x1759(%rip), %rsi      # 0x50bb
movq %rax, %rdi
callq 0x20f0
movq 0x467f(%rip), %rsi      # 0x7ff0
movq 0x4638(%rip), %rdx      # 0x7fb0
movq %rbx, %rdi
callq 0x2370
movq %rax, %r14
movq %rbx, %rdi
callq 0x21c0
movq %r14, %rdi
callq 0x2390
nop
// File: /workspace/github_cpp_makefile_star2_O1/yiboyang[P]VirtualMemory/BackingStore.cpp
// Function: BackingStore::write(int, int)
void BackingStore::write(int pnum, int fnum) {
	assert(!store.eof());

	// seek to the page at pnum
	if (store.seekg(pnum * FRAME_SIZE, ios::beg))
		store.write((char *)Memory[fnum], FRAME_SIZE);
	else
		throw runtime_error("Seek error");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq (%rdi), %rax
movq -0x18(%rax), %rax
testb $0x2, 0x20(%rdi,%rax)
jne 0x39ed
movl %edx, %r14d
movq %rdi, %rbx
shll $0x8, %esi
movslq %esi, %rsi
xorl %edx, %edx
callq 0x22b0
movq (%rax), %rcx
movq -0x18(%rcx), %rcx
testb $0x5, 0x20(%rax,%rcx)
jne 0x3a0c
movslq %r14d, %rsi
shlq $0x8, %rsi
addq 0x45b8(%rip), %rsi      # 0x7f90
addq $0x10, %rbx
movl $0x100, %edx            # imm = 0x100
movq %rbx, %rdi
popq %rbx
popq %r14
popq %rbp
jmp 0x22a0
leaq 0x168c(%rip), %rdi      # 0x5080
leaq 0x1692(%rip), %rsi      # 0x508d
leaq 0x16c4(%rip), %rcx      # 0x50c6
movl $0x1a, %edx
callq 0x2180
movl $0x10, %edi
callq 0x2120
movq %rax, %rbx
leaq 0x169b(%rip), %rsi      # 0x50bb
movq %rax, %rdi
callq 0x20f0
movq 0x45c1(%rip), %rsi      # 0x7ff0
movq 0x457a(%rip), %rdx      # 0x7fb0
movq %rbx, %rdi
callq 0x2370
movq %rax, %r14
movq %rbx, %rdi
callq 0x21c0
movq %r14, %rdi
callq 0x2390
nopl (%rax)
// File: /workspace/github_cpp_makefile_star2_O1/ALSchwalm[P]cppEvolve/examples/primes.cpp
// Function: treeFitness(evolve::tree::Tree<int> const*)
double treeFitness(const tree::Tree<int>* tree)
{
    double total = 0;
    std::vector<int> used;
    for(nodes::x=0; nodes::x < static_cast<int>(primes.size()); ++nodes::x) {
        auto val = tree->eval();
        if (std::find(primes.begin(), primes.end(), val) != primes.end() &&
            std::find(used.begin(), used.end(), val) == used.end()) {

            used.push_back(val);
            total += 1;
        }
    }
    return total;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rdi, %rbx
xorpd %xmm0, %xmm0
leaq -0x50(%rbp), %r14
movapd %xmm0, (%r14)
movq $0x0, 0x10(%r14)
movl $0x0, 0x9cba(%rip)      # 0xc144
xorpd %xmm0, %xmm0
movsd %xmm0, -0x38(%rbp)
leaq 0x4be6(%rip), %r15      # 0x7080
leaq 0x4c07(%rip), %r12      # 0x70a8
leaq -0x2c(%rbp), %r13
movq (%rbx), %rdi
movq (%rdi), %rax
callq *0x10(%rax)
movl %eax, -0x2c(%rbp)
movq %r15, %rdi
movq %r12, %rsi
movq %r13, %rdx
callq 0x3af3
cmpq %r12, %rax
je 0x250f
movq -0x50(%rbp), %rdi
movq -0x48(%rbp), %rsi
movq %r13, %rdx
callq 0x3b91
movq -0x48(%rbp), %rsi
cmpq %rsi, %rax
jne 0x250f
cmpq -0x40(%rbp), %rsi
je 0x24f2
movl -0x2c(%rbp), %eax
movl %eax, (%rsi)
addq $0x4, %rsi
movq %rsi, -0x48(%rbp)
jmp 0x24fd
movq %r14, %rdi
movq %r13, %rdx
callq 0x3c34
movsd -0x38(%rbp), %xmm0
addsd 0x4afe(%rip), %xmm0     # 0x7008
movsd %xmm0, -0x38(%rbp)
movl 0x9c2f(%rip), %eax      # 0xc144
leal 0x1(%rax), %ecx
movl %ecx, 0x9c26(%rip)      # 0xc144
cmpl $0x9, %eax
jl 0x24a5
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2531
callq 0x2140
movsd -0x38(%rbp), %xmm0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
jmp 0x2547
movq %rax, %rbx
movq -0x50(%rbp), %rdi
testq %rdi, %rdi
je 0x2558
callq 0x2140
movq %rbx, %rdi
callq 0x21f0