_Z9burtlemixRjS_S_:
   28|   601k|{
   29|   601k|  a -= b;
   30|   601k|  a -= c;
   31|   601k|  a ^= (c >> 13);
   32|   601k|  b -= c;
   33|   601k|  b -= a;
   34|   601k|  b ^= (a << 8);
   35|   601k|  c -= a;
   36|   601k|  c -= b;
   37|   601k|  c ^= (b >> 13);
   38|   601k|  a -= b;
   39|   601k|  a -= c;
   40|   601k|  a ^= (c >> 12);
   41|   601k|  b -= c;
   42|   601k|  b -= a;
   43|   601k|  b ^= (a << 16);
   44|   601k|  c -= a;
   45|   601k|  c -= b;
   46|   601k|  c ^= (b >> 5);
   47|   601k|  a -= b;
   48|   601k|  a -= c;
   49|   601k|  a ^= (c >> 3);
   50|   601k|  b -= c;
   51|   601k|  b -= a;
   52|   601k|  b ^= (a << 10);
   53|   601k|  c -= a;
   54|   601k|  c -= b;
   55|   601k|  c ^= (b >> 15);
   56|   601k|}
_Z6burtlePKhjj:
   59|  25.2k|{
   60|  25.2k|  uint32_t a, b, c, len;
   61|       |
   62|       |  /* Set up the internal state */
   63|  25.2k|  len = length;
   64|  25.2k|  a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
   65|  25.2k|  c = initval; /* the previous hash value */
   66|       |
   67|       |  /*---------------------------------------- handle most of the key */
   68|   595k|  while (len >= 12) {
  ------------------
  |  Branch (68:10): [True: 570k, False: 25.2k]
  ------------------
   69|   570k|    a += (k[0] + ((uint32_t)k[1] << 8) + ((uint32_t)k[2] << 16) + ((uint32_t)k[3] << 24));
   70|   570k|    b += (k[4] + ((uint32_t)k[5] << 8) + ((uint32_t)k[6] << 16) + ((uint32_t)k[7] << 24));
   71|   570k|    c += (k[8] + ((uint32_t)k[9] << 8) + ((uint32_t)k[10] << 16) + ((uint32_t)k[11] << 24));
   72|   570k|    burtlemix(a, b, c);
   73|   570k|    k += 12;
   74|   570k|    len -= 12;
   75|   570k|  }
   76|       |
   77|       |  /*------------------------------------- handle the last 11 bytes */
   78|  25.2k|  c += length;
   79|  25.2k|  switch (len) { /* all the case statements fall through */
  ------------------
  |  Branch (79:11): [True: 766, False: 24.5k]
  ------------------
   80|    533|  case 11:
  ------------------
  |  Branch (80:3): [True: 533, False: 24.7k]
  ------------------
   81|    533|    c += ((uint32_t)k[10] << 24);
   82|       |    /* fall-through */
   83|  5.32k|  case 10:
  ------------------
  |  Branch (83:3): [True: 4.78k, False: 20.5k]
  ------------------
   84|  5.32k|    c += ((uint32_t)k[9] << 16);
   85|       |    /* fall-through */
   86|  5.66k|  case 9:
  ------------------
  |  Branch (86:3): [True: 346, False: 24.9k]
  ------------------
   87|  5.66k|    c += ((uint32_t)k[8] << 8);
   88|       |    /* the first byte of c is reserved for the length */
   89|       |    /* fall-through */
   90|  6.36k|  case 8:
  ------------------
  |  Branch (90:3): [True: 697, False: 24.5k]
  ------------------
   91|  6.36k|    b += ((uint32_t)k[7] << 24);
   92|       |    /* fall-through */
   93|  7.08k|  case 7:
  ------------------
  |  Branch (93:3): [True: 717, False: 24.5k]
  ------------------
   94|  7.08k|    b += ((uint32_t)k[6] << 16);
   95|       |    /* fall-through */
   96|  8.05k|  case 6:
  ------------------
  |  Branch (96:3): [True: 979, False: 24.3k]
  ------------------
   97|  8.05k|    b += ((uint32_t)k[5] << 8);
   98|       |    /* fall-through */
   99|  8.56k|  case 5:
  ------------------
  |  Branch (99:3): [True: 509, False: 24.7k]
  ------------------
  100|  8.56k|    b += k[4];
  101|       |    /* fall-through */
  102|  20.1k|  case 4:
  ------------------
  |  Branch (102:3): [True: 11.5k, False: 13.7k]
  ------------------
  103|  20.1k|    a += ((uint32_t)k[3] << 24);
  104|       |    /* fall-through */
  105|  21.3k|  case 3:
  ------------------
  |  Branch (105:3): [True: 1.25k, False: 24.0k]
  ------------------
  106|  21.3k|    a += ((uint32_t)k[2] << 16);
  107|       |    /* fall-through */
  108|  21.9k|  case 2:
  ------------------
  |  Branch (108:3): [True: 559, False: 24.7k]
  ------------------
  109|  21.9k|    a += ((uint32_t)k[1] << 8);
  110|       |    /* fall-through */
  111|  24.5k|  case 1:
  ------------------
  |  Branch (111:3): [True: 2.60k, False: 22.6k]
  ------------------
  112|  24.5k|    a += k[0];
  113|       |    /* case 0: nothing left to add */
  114|  25.2k|  }
  115|  25.2k|  burtlemix(a, b, c);
  116|       |  /*-------------------------------------------- report the result */
  117|  25.2k|  return c;
  118|  25.2k|}
_Z8burtleCIPKhjj:
  121|  1.92k|{
  122|  1.92k|  uint32_t a, b, c, len;
  123|       |
  124|       |  /* Set up the internal state */
  125|  1.92k|  len = length;
  126|  1.92k|  a = b = 0x9e3779b9; /* the golden ratio; an arbitrary value */
  127|  1.92k|  c = initval; /* the previous hash value */
  128|       |
  129|       |  /*---------------------------------------- handle most of the key */
  130|  5.89k|  while (len >= 12) {
  ------------------
  |  Branch (130:10): [True: 3.97k, False: 1.92k]
  ------------------
  131|  3.97k|    a += (dns_tolower(k[0]) + ((uint32_t)dns_tolower(k[1]) << 8) + ((uint32_t)dns_tolower(k[2]) << 16) + ((uint32_t)dns_tolower(k[3]) << 24));
  132|  3.97k|    b += (dns_tolower(k[4]) + ((uint32_t)dns_tolower(k[5]) << 8) + ((uint32_t)dns_tolower(k[6]) << 16) + ((uint32_t)dns_tolower(k[7]) << 24));
  133|  3.97k|    c += (dns_tolower(k[8]) + ((uint32_t)dns_tolower(k[9]) << 8) + ((uint32_t)dns_tolower(k[10]) << 16) + ((uint32_t)dns_tolower(k[11]) << 24));
  134|  3.97k|    burtlemix(a, b, c);
  135|  3.97k|    k += 12;
  136|  3.97k|    len -= 12;
  137|  3.97k|  }
  138|       |
  139|       |  /*------------------------------------- handle the last 11 bytes */
  140|  1.92k|  c += length;
  141|  1.92k|  switch (len) { /* all the case statements fall through */
  ------------------
  |  Branch (141:11): [True: 30, False: 1.89k]
  ------------------
  142|     26|  case 11:
  ------------------
  |  Branch (142:3): [True: 26, False: 1.89k]
  ------------------
  143|     26|    c += ((uint32_t)dns_tolower(k[10]) << 24);
  144|       |    /* fall-through */
  145|     34|  case 10:
  ------------------
  |  Branch (145:3): [True: 8, False: 1.91k]
  ------------------
  146|     34|    c += ((uint32_t)dns_tolower(k[9]) << 16);
  147|       |    /* fall-through */
  148|     36|  case 9:
  ------------------
  |  Branch (148:3): [True: 2, False: 1.92k]
  ------------------
  149|     36|    c += ((uint32_t)dns_tolower(k[8]) << 8);
  150|       |    /* the first byte of c is reserved for the length */
  151|       |    /* fall-through */
  152|     50|  case 8:
  ------------------
  |  Branch (152:3): [True: 14, False: 1.90k]
  ------------------
  153|     50|    b += ((uint32_t)dns_tolower(k[7]) << 24);
  154|       |    /* fall-through */
  155|     72|  case 7:
  ------------------
  |  Branch (155:3): [True: 22, False: 1.90k]
  ------------------
  156|     72|    b += ((uint32_t)dns_tolower(k[6]) << 16);
  157|       |    /* fall-through */
  158|     86|  case 6:
  ------------------
  |  Branch (158:3): [True: 14, False: 1.90k]
  ------------------
  159|     86|    b += ((uint32_t)dns_tolower(k[5]) << 8);
  160|       |    /* fall-through */
  161|     98|  case 5:
  ------------------
  |  Branch (161:3): [True: 12, False: 1.91k]
  ------------------
  162|     98|    b += dns_tolower(k[4]);
  163|       |    /* fall-through */
  164|    122|  case 4:
  ------------------
  |  Branch (164:3): [True: 24, False: 1.89k]
  ------------------
  165|    122|    a += ((uint32_t)dns_tolower(k[3]) << 24);
  166|       |    /* fall-through */
  167|    296|  case 3:
  ------------------
  |  Branch (167:3): [True: 174, False: 1.74k]
  ------------------
  168|    296|    a += ((uint32_t)dns_tolower(k[2]) << 16);
  169|       |    /* fall-through */
  170|    300|  case 2:
  ------------------
  |  Branch (170:3): [True: 4, False: 1.91k]
  ------------------
  171|    300|    a += ((uint32_t)dns_tolower(k[1]) << 8);
  172|       |    /* fall-through */
  173|  1.89k|  case 1:
  ------------------
  |  Branch (173:3): [True: 1.59k, False: 330]
  ------------------
  174|  1.89k|    a += dns_tolower(k[0]);
  175|       |    /* case 0: nothing left to add */
  176|  1.92k|  }
  177|  1.92k|  burtlemix(a, b, c);
  178|       |  /*-------------------------------------------- report the result */
  179|  1.92k|  return c;
  180|  1.92k|}

_ZN17dnsheader_alignedC2EPKv:
  195|    961|  {
  196|    961|    if (reinterpret_cast<uintptr_t>(mem) % sizeof(uint32_t) == 0) {  // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
  ------------------
  |  Branch (196:9): [True: 961, False: 0]
  ------------------
  197|    961|      d_p = reinterpret_cast<const dnsheader*>(mem);  // NOLINT(cppcoreguidelines-pro-type-reinterpret-cast)
  198|    961|    }
  199|      0|    else {
  200|      0|      memcpy(&d_h, mem, sizeof(dnsheader));
  201|      0|      d_p = &d_h;
  202|      0|    }
  203|    961|  }
_ZNK17dnsheader_aligned3getEv:
  206|    961|  {
  207|    961|    return d_p;
  208|    961|  }

_ZN18DNSDistPacketCacheC2Emjjjjjbjbb:
   33|  2.45k|{
   34|  2.45k|  if (d_maxEntries == 0) {
  ------------------
  |  Branch (34:7): [True: 0, False: 2.45k]
  ------------------
   35|      0|    throw std::runtime_error("Trying to create a 0-sized packet-cache");
   36|      0|  }
   37|       |
   38|  2.45k|  d_shards.resize(d_shardCount);
   39|       |
   40|       |  /* we reserve maxEntries + 1 to avoid rehashing from occurring
   41|       |     when we get to maxEntries, as it means a load factor of 1 */
   42|  2.45k|  for (auto& shard : d_shards) {
  ------------------
  |  Branch (42:20): [True: 2.45k, False: 2.45k]
  ------------------
   43|  2.45k|    shard.setSize((maxEntries / d_shardCount) + 1);
   44|  2.45k|  }
   45|  2.45k|}
_ZN18DNSDistPacketCache15getClientSubnetERKNSt3__16vectorIh14noinit_adaptorINS0_9allocatorIhEEEEEmRN5boost8optionalI7NetmaskEE:
   48|    961|{
   49|    961|  uint16_t optRDPosition;
   50|    961|  size_t remaining = 0;
   51|       |
   52|    961|  int res = getEDNSOptionsStart(packet, qnameWireLength, &optRDPosition, &remaining);
   53|       |
   54|    961|  if (res == 0) {
  ------------------
  |  Branch (54:7): [True: 539, False: 422]
  ------------------
   55|    539|    size_t ecsOptionStartPosition = 0;
   56|    539|    size_t ecsOptionSize = 0;
   57|       |
   58|    539|    res = getEDNSOption(reinterpret_cast<const char*>(&packet.at(optRDPosition)), remaining, EDNSOptionCode::ECS, &ecsOptionStartPosition, &ecsOptionSize);
   59|       |
   60|    539|    if (res == 0 && ecsOptionSize > (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  226|    227|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                  if (res == 0 && ecsOptionSize > (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  227|    227|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (60:9): [True: 227, False: 312]
  |  Branch (60:21): [True: 216, False: 11]
  ------------------
   61|       |
   62|    216|      EDNSSubnetOpts eso;
   63|    216|      if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  226|    216|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  227|    216|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  226|    216|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    if (getEDNSSubnetOptsFromString(reinterpret_cast<const char*>(&packet.at(optRDPosition + ecsOptionStartPosition + (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE))), ecsOptionSize - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE), &eso) == true) {
  ------------------
  |  |  227|    216|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (63:11): [True: 75, False: 141]
  ------------------
   64|     75|        subnet = eso.source;
   65|     75|        return true;
   66|     75|      }
   67|    216|    }
   68|    539|  }
   69|       |
   70|    886|  return false;
   71|    961|}
_ZN18DNSDistPacketCache6getKeyERKN5boost9container12basic_stringIcNSt3__111char_traitsIcEEvEEmRKNS3_6vectorIh14noinit_adaptorINS3_9allocatorIhEEEEEb:
  433|  1.92k|{
  434|  1.92k|  uint32_t result = 0;
  435|       |  /* skip the query ID */
  436|  1.92k|  if (packet.size() < sizeof(dnsheader)) {
  ------------------
  |  Branch (436:7): [True: 0, False: 1.92k]
  ------------------
  437|      0|    throw std::range_error("Computing packet cache key for an invalid packet size (" + std::to_string(packet.size()) +")");
  438|      0|  }
  439|       |
  440|  1.92k|  result = burtle(&packet.at(2), sizeof(dnsheader) - 2, result);
  441|  1.92k|  result = burtleCI((const unsigned char*) qname.c_str(), qname.length(), result);
  442|  1.92k|  if (packet.size() < sizeof(dnsheader) + qnameWireLength) {
  ------------------
  |  Branch (442:7): [True: 0, False: 1.92k]
  ------------------
  443|      0|    throw std::range_error("Computing packet cache key for an invalid packet (" + std::to_string(packet.size()) + " < " + std::to_string(sizeof(dnsheader) + qnameWireLength) + ")");
  444|      0|  }
  445|  1.92k|  if (packet.size() > ((sizeof(dnsheader) + qnameWireLength))) {
  ------------------
  |  Branch (445:7): [True: 1.92k, False: 0]
  ------------------
  446|  1.92k|    if (!d_optionsToSkip.empty()) {
  ------------------
  |  Branch (446:9): [True: 961, False: 961]
  ------------------
  447|       |      /* skip EDNS options if any */
  448|    961|      result = PacketCache::hashAfterQname(std::string_view(reinterpret_cast<const char*>(packet.data()), packet.size()), result, sizeof(dnsheader) + qnameWireLength, d_optionsToSkip);
  449|    961|    }
  450|    961|    else {
  451|    961|      result = burtle(&packet.at(sizeof(dnsheader) + qnameWireLength), packet.size() - (sizeof(dnsheader) + qnameWireLength), result);
  452|    961|    }
  453|  1.92k|  }
  454|  1.92k|  result = burtle((const unsigned char*) &receivedOverUDP, sizeof(receivedOverUDP), result);
  455|  1.92k|  return result;
  456|  1.92k|}
_ZN18DNSDistPacketCache17setSkippedOptionsERKNSt3__113unordered_setItNS0_4hashItEENS0_8equal_toItEENS0_9allocatorItEEEE:
  511|  1.22k|{
  512|  1.22k|  d_optionsToSkip = optionsToSkip;
  513|  1.22k|}

_ZN18DNSDistPacketCache10CacheShard7setSizeEm:
  118|  2.45k|    {
  119|  2.45k|      d_map.write_lock()->reserve(maxSize);
  120|  2.45k|    }
_ZN18DNSDistPacketCache10CacheShardC2Ev:
  111|  2.45k|    {
  112|  2.45k|    }
_ZN18DNSDistPacketCache20setECSParsingEnabledEb:
   80|  2.45k|  {
   81|  2.45k|    d_parseECS = enabled;
   82|  2.45k|  }

_Z19getEDNSOptionsStartRKNSt3__16vectorIh14noinit_adaptorINS_9allocatorIhEEEEEmPtPm:
  390|    961|{
  391|    961|  assert(optRDPosition != nullptr);
  392|      0|  assert(remaining != nullptr);
  393|      0|  const struct dnsheader* dh = reinterpret_cast<const struct dnsheader*>(packet.data());
  394|       |
  395|    961|  if (offset >= packet.size()) {
  ------------------
  |  Branch (395:7): [True: 0, False: 961]
  ------------------
  396|      0|    return ENOENT;
  397|      0|  }
  398|       |
  399|    961|  if (ntohs(dh->qdcount) != 1 || ntohs(dh->ancount) != 0 || ntohs(dh->arcount) != 1 || ntohs(dh->nscount) != 0)
  ------------------
  |  Branch (399:7): [True: 57, False: 904]
  |  Branch (399:34): [True: 32, False: 872]
  |  Branch (399:61): [True: 40, False: 832]
  |  Branch (399:88): [True: 20, False: 812]
  ------------------
  400|    149|    return ENOENT;
  401|       |
  402|    812|  size_t pos = sizeof(dnsheader) + offset;
  403|    812|  pos += DNS_TYPE_SIZE + DNS_CLASS_SIZE;
  ------------------
  |  |  220|    812|#define DNS_TYPE_SIZE (2)
  ------------------
                pos += DNS_TYPE_SIZE + DNS_CLASS_SIZE;
  ------------------
  |  |  221|    812|#define DNS_CLASS_SIZE (2)
  ------------------
  404|       |
  405|    812|  if (pos >= packet.size())
  ------------------
  |  Branch (405:7): [True: 9, False: 803]
  ------------------
  406|      9|    return ENOENT;
  407|       |
  408|    803|  if ((pos + /* root */ 1 + DNS_TYPE_SIZE + DNS_CLASS_SIZE) >= packet.size()) {
  ------------------
  |  |  220|    803|#define DNS_TYPE_SIZE (2)
  ------------------
                if ((pos + /* root */ 1 + DNS_TYPE_SIZE + DNS_CLASS_SIZE) >= packet.size()) {
  ------------------
  |  |  221|    803|#define DNS_CLASS_SIZE (2)
  ------------------
  |  Branch (408:7): [True: 18, False: 785]
  ------------------
  409|     18|    return ENOENT;
  410|     18|  }
  411|       |
  412|    785|  if (packet[pos] != 0) {
  ------------------
  |  Branch (412:7): [True: 103, False: 682]
  ------------------
  413|       |    /* not the root so not an OPT record */
  414|    103|    return ENOENT;
  415|    103|  }
  416|    682|  pos += 1;
  417|       |
  418|    682|  uint16_t qtype = packet.at(pos)*256 + packet.at(pos+1);
  419|    682|  pos += DNS_TYPE_SIZE;
  ------------------
  |  |  220|    682|#define DNS_TYPE_SIZE (2)
  ------------------
  420|    682|  pos += DNS_CLASS_SIZE;
  ------------------
  |  |  221|    682|#define DNS_CLASS_SIZE (2)
  ------------------
  421|       |
  422|    682|  if (qtype != QType::OPT || (packet.size() - pos) < (DNS_TTL_SIZE + DNS_RDLENGTH_SIZE)) {
  ------------------
  |  |  222|    545|#define DNS_TTL_SIZE (4)
  ------------------
                if (qtype != QType::OPT || (packet.size() - pos) < (DNS_TTL_SIZE + DNS_RDLENGTH_SIZE)) {
  ------------------
  |  |  223|    545|#define DNS_RDLENGTH_SIZE (2)
  ------------------
  |  Branch (422:7): [True: 137, False: 545]
  |  Branch (422:30): [True: 6, False: 539]
  ------------------
  423|    143|    return ENOENT;
  424|    143|  }
  425|       |
  426|    539|  pos += DNS_TTL_SIZE;
  ------------------
  |  |  222|    539|#define DNS_TTL_SIZE (4)
  ------------------
  427|    539|  *optRDPosition = pos;
  428|    539|  *remaining = packet.size() - pos;
  429|       |
  430|    539|  return 0;
  431|    682|}

_ZN7DNSNameC2ENSt3__117basic_string_viewIcNS0_11char_traitsIcEEEE:
   57|      4|{
   58|      4|  const char* p = sw.data();
   59|      4|  size_t length = sw.length();
   60|       |
   61|      4|  if(length == 0 || (length == 1 && p[0]=='.')) {
  ------------------
  |  Branch (61:6): [True: 0, False: 4]
  |  Branch (61:22): [True: 4, False: 0]
  |  Branch (61:37): [True: 2, False: 2]
  ------------------
   62|      2|    d_storage.assign(1, '\0');
   63|      2|  } else {
   64|      2|    if(!std::memchr(p, '\\', length)) {
  ------------------
  |  Branch (64:8): [True: 2, False: 0]
  ------------------
   65|      2|      unsigned char lenpos=0;
   66|      2|      unsigned char labellen=0;
   67|      2|      const char* const pbegin=p, *pend=p+length;
   68|       |
   69|      2|      d_storage.reserve(length+1);
   70|      4|      for(auto iter = pbegin; iter != pend; ) {
  ------------------
  |  Branch (70:31): [True: 2, False: 2]
  ------------------
   71|      2|        lenpos = d_storage.size();
   72|      2|        if(*iter=='.')
  ------------------
  |  Branch (72:12): [True: 0, False: 2]
  ------------------
   73|      0|          throwSafeRangeError("Found . in wrong position in DNSName: ", p, length);
   74|      2|        d_storage.append(1, '\0');
   75|      2|        labellen=0;
   76|      2|        auto begiter=iter;
   77|      4|        for(; iter != pend && *iter!='.'; ++iter) {
  ------------------
  |  Branch (77:15): [True: 2, False: 2]
  |  Branch (77:31): [True: 2, False: 0]
  ------------------
   78|      2|          labellen++;
   79|      2|        }
   80|      2|        d_storage.append(begiter,iter);
   81|      2|        if(iter != pend)
  ------------------
  |  Branch (81:12): [True: 0, False: 2]
  ------------------
   82|      0|          ++iter;
   83|      2|        if(labellen > 63)
  ------------------
  |  Branch (83:12): [True: 0, False: 2]
  ------------------
   84|      0|          throwSafeRangeError("label too long to append: ", p, length);
   85|       |
   86|      2|        if(iter-pbegin > static_cast<ptrdiff_t>(s_maxDNSNameLength - 1)) // reserve two bytes, one for length and one for the root label
  ------------------
  |  Branch (86:12): [True: 0, False: 2]
  ------------------
   87|      0|          throwSafeRangeError("name too long to append: ", p, length);
   88|       |
   89|      2|        d_storage[lenpos]=labellen;
   90|      2|      }
   91|      2|      d_storage.append(1, '\0');
   92|      2|    }
   93|      0|    else {
   94|      0|      d_storage=segmentDNSNameRaw(p, length);
   95|      0|      if(d_storage.size() > s_maxDNSNameLength) {
  ------------------
  |  Branch (95:10): [True: 0, False: 0]
  ------------------
   96|      0|        throwSafeRangeError("name too long: ", p, length);
   97|      0|      }
   98|      0|    }
   99|      2|  }
  100|      4|}
_ZN7DNSNameC2EPKciibPtS2_Pjt:
  104|  1.22k|{
  105|  1.22k|  if (offset >= len)
  ------------------
  |  Branch (105:7): [True: 8, False: 1.21k]
  ------------------
  106|      8|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  107|       |
  108|  1.21k|  if(!uncompress) {
  ------------------
  |  Branch (108:6): [True: 1.21k, False: 0]
  ------------------
  109|  1.21k|    if(const void * fnd=memchr(pos+offset, 0, len-offset)) {
  ------------------
  |  Branch (109:21): [True: 1.17k, False: 38]
  ------------------
  110|  1.17k|      d_storage.reserve(2+(const char*)fnd-(pos+offset));
  111|  1.17k|    }
  112|  1.21k|  }
  113|       |
  114|  1.21k|  packetParser(pos, len, offset, uncompress, qtype, qclass, consumed, 0, minOffset);
  115|  1.21k|}
_ZN7DNSName12packetParserEPKciibPtS2_Pjit:
  119|  1.21k|{
  120|  1.21k|  const unsigned char* pos=(const unsigned char*)qpos;
  121|  1.21k|  unsigned char labellen;
  122|  1.21k|  const unsigned char *opos = pos;
  123|       |
  124|  1.21k|  if (offset >= len)
  ------------------
  |  Branch (124:7): [True: 0, False: 1.21k]
  ------------------
  125|      0|    throw std::range_error("Trying to read past the end of the buffer ("+std::to_string(offset)+ " >= "+std::to_string(len)+")");
  126|  1.21k|  if (offset < (int) minOffset)
  ------------------
  |  Branch (126:7): [True: 0, False: 1.21k]
  ------------------
  127|      0|    throw std::range_error("Trying to read before the beginning of the buffer ("+std::to_string(offset)+ " < "+std::to_string(minOffset)+")");
  128|       |
  129|  1.21k|  const unsigned char* end = pos + len;
  130|  1.21k|  pos += offset;
  131|  6.67k|  while((labellen=*pos++) && pos < end) { // "scan and copy"
  ------------------
  |  Branch (131:9): [True: 5.68k, False: 997]
  |  Branch (131:30): [True: 5.58k, False: 94]
  ------------------
  132|  5.58k|    if(labellen >= 0xc0) {
  ------------------
  |  Branch (132:8): [True: 88, False: 5.50k]
  ------------------
  133|     88|      if(!uncompress)
  ------------------
  |  Branch (133:10): [True: 88, False: 0]
  ------------------
  134|     88|        throw std::range_error("Found compressed label, instructed not to follow");
  135|       |
  136|      0|      labellen &= (~0xc0);
  137|      0|      int newpos = (labellen << 8) + *(const unsigned char*)pos;
  138|       |
  139|      0|      if(newpos < offset) {
  ------------------
  |  Branch (139:10): [True: 0, False: 0]
  ------------------
  140|      0|        if(newpos < (int) minOffset)
  ------------------
  |  Branch (140:12): [True: 0, False: 0]
  ------------------
  141|      0|          throw std::range_error("Invalid label position during decompression ("+std::to_string(newpos)+ " < "+std::to_string(minOffset)+")");
  142|      0|        if (++depth > 100)
  ------------------
  |  Branch (142:13): [True: 0, False: 0]
  ------------------
  143|      0|          throw std::range_error("Abort label decompression after 100 redirects");
  144|      0|        packetParser((const char*)opos, len, newpos, true, nullptr, nullptr, nullptr, depth, minOffset);
  145|      0|      } else
  146|      0|        throw std::range_error("Found a forward reference during label decompression");
  147|      0|      pos++;
  148|      0|      break;
  149|  5.50k|    } else if(labellen & 0xc0) {
  ------------------
  |  Branch (149:15): [True: 31, False: 5.46k]
  ------------------
  150|     31|      throw std::range_error("Found an invalid label length in qname (only one of the first two bits is set)");
  151|     31|    }
  152|  5.46k|    if (pos + labellen < end) {
  ------------------
  |  Branch (152:9): [True: 5.46k, False: 7]
  ------------------
  153|  5.46k|      appendRawLabel((const char*)pos, labellen);
  154|  5.46k|    }
  155|      7|    else
  156|      7|      throw std::range_error("Found an invalid label length in qname");
  157|  5.46k|    pos+=labellen;
  158|  5.46k|  }
  159|  1.09k|  if(d_storage.empty())
  ------------------
  |  Branch (159:6): [True: 803, False: 288]
  ------------------
  160|    803|    d_storage.append(1, (char)0); // we just parsed the root
  161|  1.09k|  if(consumed)
  ------------------
  |  Branch (161:6): [True: 1.08k, False: 5]
  ------------------
  162|  1.08k|    *consumed = pos - opos - offset;
  163|  1.09k|  if(qtype) {
  ------------------
  |  Branch (163:6): [True: 1.08k, False: 5]
  ------------------
  164|  1.08k|    if (pos + 2 > end) {
  ------------------
  |  Branch (164:9): [True: 123, False: 963]
  ------------------
  165|    123|      throw std::range_error("Trying to read qtype past the end of the buffer ("+std::to_string((pos - opos) + 2)+ " > "+std::to_string(len)+")");
  166|    123|    }
  167|    963|    *qtype=(*(const unsigned char*)pos)*256 + *((const unsigned char*)pos+1);
  168|    963|  }
  169|    968|  pos+=2;
  170|    968|  if(qclass) {
  ------------------
  |  Branch (170:6): [True: 963, False: 5]
  ------------------
  171|    963|    if (pos + 2 > end) {
  ------------------
  |  Branch (171:9): [True: 2, False: 961]
  ------------------
  172|      2|      throw std::range_error("Trying to read qclass past the end of the buffer ("+std::to_string((pos - opos) + 2)+ " > "+std::to_string(len)+")");
  173|      2|    }
  174|    961|    *qclass=(*(const unsigned char*)pos)*256 + *((const unsigned char*)pos+1);
  175|    961|  }
  176|    968|}
_ZN7DNSName14appendRawLabelEPKcj:
  345|  5.46k|{
  346|  5.46k|  if(length==0)
  ------------------
  |  Branch (346:6): [True: 0, False: 5.46k]
  ------------------
  347|      0|    throw std::range_error("no such thing as an empty label to append");
  348|  5.46k|  if(length > 63)
  ------------------
  |  Branch (348:6): [True: 0, False: 5.46k]
  ------------------
  349|      0|    throw std::range_error("label too long to append");
  350|  5.46k|  if(d_storage.size() + length > s_maxDNSNameLength - 1) // reserve one byte for the label length
  ------------------
  |  Branch (350:6): [True: 5, False: 5.45k]
  ------------------
  351|      5|    throw std::range_error("name too long to append");
  352|       |
  353|  5.45k|  if(d_storage.empty()) {
  ------------------
  |  Branch (353:6): [True: 386, False: 5.07k]
  ------------------
  354|    386|    d_storage.append(1, (char)length);
  355|    386|  }
  356|  5.07k|  else {
  357|  5.07k|    *d_storage.rbegin()=(char)length;
  358|  5.07k|  }
  359|  5.45k|  d_storage.append(start, length);
  360|  5.45k|  d_storage.append(1, (char)0);
  361|  5.45k|}

_Z11dns_tolowerh:
   55|  50.6k|{
   56|  50.6k|  return dns_tolower_table[c];
   57|  50.6k|}
_ZNK7DNSName10getStorageEv:
  183|  1.92k|  const string_t& getStorage() const {
  184|  1.92k|    return d_storage;
  185|  1.92k|  }

_Z17getNextEDNSOptionPKcmRtS1_:
   27|  22.6k|{
   28|  22.6k|  if (data == nullptr || dataLen < (sizeof(uint16_t) + sizeof(uint16_t))) {
  ------------------
  |  Branch (28:7): [True: 0, False: 22.6k]
  |  Branch (28:26): [True: 114, False: 22.5k]
  ------------------
   29|    114|    return false;
   30|    114|  }
   31|       |
   32|  22.5k|  size_t pos = 0;
   33|  22.5k|  const uint8_t* p = reinterpret_cast<const uint8_t*>(data);
   34|       |
   35|  22.5k|  optionCode = (static_cast<uint16_t>(p[pos]) * 256) + p[pos + 1];
   36|  22.5k|  pos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  22.5k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   37|       |
   38|  22.5k|  optionLen = (static_cast<uint16_t>(p[pos]) * 256) + p[pos + 1];
   39|  22.5k|  pos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  22.5k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   40|  22.5k|  (void) pos;
   41|       |
   42|  22.5k|  return true;
   43|  22.6k|}
_Z13getEDNSOptionPKcmtPmS1_:
   47|    539|{
   48|    539|  assert(optRR != nullptr);
   49|      0|  assert(optionValuePosition != nullptr);
   50|      0|  assert(optionValueSize != nullptr);
   51|      0|  size_t pos = 0;
   52|    539|  if (len < DNS_RDLENGTH_SIZE)
  ------------------
  |  |  223|    539|#define DNS_RDLENGTH_SIZE (2)
  ------------------
  |  Branch (52:7): [True: 0, False: 539]
  ------------------
   53|      0|    return EINVAL;
   54|       |
   55|    539|  const uint16_t rdLen = (((unsigned char) optRR[pos]) * 256) + ((unsigned char) optRR[pos+1]);
   56|    539|  size_t rdPos = 0;
   57|    539|  pos += DNS_RDLENGTH_SIZE;
  ------------------
  |  |  223|    539|#define DNS_RDLENGTH_SIZE (2)
  ------------------
   58|    539|  if ((pos + rdLen) > len) {
  ------------------
  |  Branch (58:7): [True: 149, False: 390]
  ------------------
   59|    149|    return EINVAL;
   60|    149|  }
   61|       |
   62|  3.40k|  while(len >= (pos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE) &&
  ------------------
  |  |  226|  3.40k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                while(len >= (pos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE) &&
  ------------------
  |  |  227|  3.40k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (62:9): [True: 3.32k, False: 72]
  ------------------
   63|  3.40k|        rdLen >= (rdPos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  226|  3.32k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                      rdLen >= (rdPos + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE)) {
  ------------------
  |  |  227|  3.32k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
  |  Branch (63:9): [True: 3.30k, False: 20]
  ------------------
   64|  3.30k|    uint16_t optionCode;
   65|  3.30k|    uint16_t optionLen;
   66|  3.30k|    if (!getNextEDNSOption(optRR + pos, len-pos, optionCode, optionLen)) {
  ------------------
  |  Branch (66:9): [True: 0, False: 3.30k]
  ------------------
   67|      0|      break;
   68|      0|    }
   69|       |
   70|  3.30k|    pos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  3.30k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   71|  3.30k|    rdPos += EDNS_OPTION_CODE_SIZE;
  ------------------
  |  |  226|  3.30k|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
   72|  3.30k|    pos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  3.30k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   73|  3.30k|    rdPos += EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|  3.30k|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   74|       |
   75|  3.30k|    if (optionLen > (rdLen - rdPos) || optionLen > (len - pos)) {
  ------------------
  |  Branch (75:9): [True: 71, False: 3.23k]
  |  Branch (75:40): [True: 0, False: 3.23k]
  ------------------
   76|     71|      return EINVAL;
   77|     71|    }
   78|       |
   79|  3.23k|    if (optionCode == wantedOption) {
  ------------------
  |  Branch (79:9): [True: 227, False: 3.01k]
  ------------------
   80|    227|      *optionValuePosition = pos - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE);
  ------------------
  |  |  226|    227|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    *optionValuePosition = pos - (EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE);
  ------------------
  |  |  227|    227|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   81|    227|      *optionValueSize = optionLen + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  226|    227|#define EDNS_OPTION_CODE_SIZE (2)
  ------------------
                    *optionValueSize = optionLen + EDNS_OPTION_CODE_SIZE + EDNS_OPTION_LENGTH_SIZE;
  ------------------
  |  |  227|    227|#define EDNS_OPTION_LENGTH_SIZE (2)
  ------------------
   82|    227|      return 0;
   83|    227|    }
   84|  3.01k|    else {
   85|       |      /* skip this option */
   86|  3.01k|      pos += optionLen;
   87|  3.01k|      rdPos += optionLen;
   88|  3.01k|    }
   89|  3.23k|  }
   90|       |
   91|     92|  return ENOENT;
   92|    390|}

_Z27getEDNSSubnetOptsFromStringPKcjP14EDNSSubnetOpts:
   44|    216|{
   45|    216|  EDNSSubnetOptsWire esow;
   46|    216|  static_assert (sizeof(esow) == 4, "sizeof(EDNSSubnetOptsWire) must be 4 bytes");
   47|    216|  if(len < sizeof(esow))
  ------------------
  |  Branch (47:6): [True: 12, False: 204]
  ------------------
   48|     12|    return false;
   49|    204|  memcpy(&esow, options, sizeof(esow));
   50|    204|  esow.family = ntohs(esow.family);
   51|       |  //cerr<<"Family when parsing from string: "<<esow.family<<endl;
   52|    204|  ComboAddress address;
   53|    204|  unsigned int octetsin = esow.sourceMask > 0 ? (((esow.sourceMask - 1)>> 3)+1) : 0;
  ------------------
  |  Branch (53:27): [True: 137, False: 67]
  ------------------
   54|       |  //cerr<<"octetsin:"<<octetsin<<endl;
   55|    204|  if(esow.family == 1) {
  ------------------
  |  Branch (55:6): [True: 67, False: 137]
  ------------------
   56|     67|    if(len != sizeof(esow)+octetsin)
  ------------------
  |  Branch (56:8): [True: 35, False: 32]
  ------------------
   57|     35|      return false;
   58|     32|    if(octetsin > sizeof(address.sin4.sin_addr.s_addr))
  ------------------
  |  Branch (58:8): [True: 5, False: 27]
  ------------------
   59|      5|      return false;
   60|     27|    address.reset();
   61|     27|    address.sin4.sin_family = AF_INET;
   62|     27|    if(octetsin > 0)
  ------------------
  |  Branch (62:8): [True: 10, False: 17]
  ------------------
   63|     10|      memcpy(&address.sin4.sin_addr.s_addr, options+sizeof(esow), octetsin);
   64|    137|  } else if(esow.family == 2) {
  ------------------
  |  Branch (64:13): [True: 78, False: 59]
  ------------------
   65|     78|    if(len != sizeof(esow)+octetsin)
  ------------------
  |  Branch (65:8): [True: 28, False: 50]
  ------------------
   66|     28|      return false;
   67|     50|    if(octetsin > sizeof(address.sin6.sin6_addr.s6_addr))
  ------------------
  |  Branch (67:8): [True: 2, False: 48]
  ------------------
   68|      2|      return false;
   69|       |
   70|     48|    address.reset();
   71|     48|    address.sin4.sin_family = AF_INET6;
   72|     48|    if(octetsin > 0)
  ------------------
  |  Branch (72:8): [True: 29, False: 19]
  ------------------
   73|     29|      memcpy(&address.sin6.sin6_addr.s6_addr, options+sizeof(esow), octetsin);
   74|     48|  }
   75|     59|  else
   76|     59|    return false;
   77|       |  //cerr<<"Source address: "<<address.toString()<<", mask: "<<(int)esow.sourceMask<<endl;
   78|     75|  eso->source = Netmask(address, esow.sourceMask);
   79|       |  /* 'address' has more bits set (potentially) than scopeMask. This leads to odd looking netmasks that promise
   80|       |     more precision than they have. For this reason we truncate the address to scopeMask bits */
   81|       |  
   82|     75|  address.truncate(esow.scopeMask); // truncate will not throw for odd scopeMasks
   83|     75|  eso->scope = Netmask(address, esow.scopeMask);
   84|       |
   85|     75|  return true;
   86|    204|}

LLVMFuzzerTestOneInput:
   28|  1.23k|{
   29|       |
   30|  1.23k|  if (size > std::numeric_limits<uint16_t>::max()) {
  ------------------
  |  Branch (30:7): [True: 5, False: 1.22k]
  ------------------
   31|      5|    return 0;
   32|      5|  }
   33|       |
   34|       |  /* dnsdist's version */
   35|  1.22k|  DNSDistPacketCache pcSkipCookies(10000);
   36|       |  // By default, cookies are not hashed
   37|  1.22k|  pcSkipCookies.setECSParsingEnabled(true);
   38|       |
   39|  1.22k|  DNSDistPacketCache pcHashCookies(10000);
   40|  1.22k|  pcHashCookies.setECSParsingEnabled(true);
   41|       |  // Do not skip cookies
   42|  1.22k|  pcHashCookies.setSkippedOptions({});
   43|       |
   44|  1.22k|  try {
   45|  1.22k|    uint16_t qtype;
   46|  1.22k|    uint16_t qclass;
   47|  1.22k|    unsigned int consumed;
   48|  1.22k|    PacketBuffer vect(data, data + size);
   49|  1.22k|    const DNSName qname(reinterpret_cast<const char*>(data), size, sizeof(dnsheader), false, &qtype, &qclass, &consumed);
   50|  1.22k|    pcSkipCookies.getKey(qname.getStorage(), consumed, vect, false);
   51|  1.22k|    pcHashCookies.getKey(qname.getStorage(), consumed, vect, false);
   52|  1.22k|    boost::optional<Netmask> subnet;
   53|  1.22k|    DNSDistPacketCache::getClientSubnet(vect, consumed, subnet);
   54|  1.22k|  }
   55|  1.22k|  catch (const std::exception& e) {
   56|    264|  }
   57|  1.22k|  catch (const PDNSException& e) {
   58|      0|  }
   59|       |
   60|  1.22k|  return 0;
   61|  1.22k|}

_ZN12ComboAddress8truncateEj:
  319|     75|{
  320|     75|  uint8_t* start;
  321|     75|  int len=4;
  322|     75|  if(sin4.sin_family==AF_INET) {
  ------------------
  |  Branch (322:6): [True: 27, False: 48]
  ------------------
  323|     27|    if(bits >= 32)
  ------------------
  |  Branch (323:8): [True: 13, False: 14]
  ------------------
  324|     13|      return;
  325|     14|    start = (uint8_t*)&sin4.sin_addr.s_addr;
  326|     14|    len=4;
  327|     14|  }
  328|     48|  else {
  329|     48|    if(bits >= 128)
  ------------------
  |  Branch (329:8): [True: 9, False: 39]
  ------------------
  330|      9|      return;
  331|     39|    start = (uint8_t*)&sin6.sin6_addr.s6_addr;
  332|     39|    len=16;
  333|     39|  }
  334|       |
  335|     53|  auto tozero= len*8 - bits; // if set to 22, this will clear 1 byte, as it should
  336|       |
  337|     53|  memset(start + len - tozero/8, 0, tozero/8); // blot out the whole bytes on the right
  338|       |
  339|     53|  auto bitsleft=tozero % 8; // 2 bits left to clear
  340|       |
  341|       |  // a b c d, to truncate to 22 bits, we just zeroed 'd' and need to zero 2 bits from c
  342|       |  // so and by '11111100', which is ~((1<<2)-1)  = ~3
  343|     53|  uint8_t* place = start + len - 1 - tozero/8;
  344|     53|  *place &= (~((1<<bitsleft)-1));
  345|     53|}

_ZN12ComboAddressC2Ev:
  182|    636|  {
  183|    636|    sin4.sin_family=AF_INET;
  184|    636|    sin4.sin_addr.s_addr=0;
  185|    636|    sin4.sin_port=0;
  186|    636|    sin6.sin6_scope_id = 0;
  187|    636|    sin6.sin6_flowinfo = 0;
  188|    636|  }
_ZNK12ComboAddress6isIPv4Ev:
  228|    150|  {
  229|    150|    return sin4.sin_family == AF_INET;
  230|    150|  }
_ZN12ComboAddress5resetEv:
  356|     75|  {
  357|     75|    memset(&sin4, 0, sizeof(sin4));
  358|     75|    memset(&sin6, 0, sizeof(sin6));
  359|     75|  }
_ZN7NetmaskC2Ev:
  476|    432|  {
  477|    432|    d_network.sin4.sin_family = 0; // disable this doing anything useful
  478|    432|    d_network.sin4.sin_port = 0; // this guarantees d_network compares identical
  479|    432|    d_mask = 0;
  480|    432|    d_bits = 0;
  481|    432|  }
_ZN7NetmaskC2ERK12ComboAddressh:
  484|    150|  {
  485|    150|    d_network.sin4.sin_port = 0;
  486|    150|    setBits(network.isIPv4() ? std::min(bits, static_cast<uint8_t>(32)) : std::min(bits, static_cast<uint8_t>(128)));
  ------------------
  |  Branch (486:13): [True: 54, False: 96]
  ------------------
  487|    150|  }
_ZN7Netmask7setBitsEh:
  500|    150|  {
  501|    150|    d_bits = value;
  502|       |
  503|    150|    if (d_bits < 32) {
  ------------------
  |  Branch (503:9): [True: 83, False: 67]
  ------------------
  504|     83|      d_mask = ~(0xFFFFFFFF >> d_bits);
  505|     83|    }
  506|     67|    else {
  507|       |      // note that d_mask is unused for IPv6
  508|     67|      d_mask = 0xFFFFFFFF;
  509|     67|    }
  510|       |
  511|    150|    if (isIPv4()) {
  ------------------
  |  Branch (511:9): [True: 54, False: 96]
  ------------------
  512|     54|      d_network.sin4.sin_addr.s_addr = htonl(ntohl(d_network.sin4.sin_addr.s_addr) & d_mask);
  513|     54|    }
  514|     96|    else if (isIPv6()) {
  ------------------
  |  Branch (514:14): [True: 96, False: 0]
  ------------------
  515|     96|      uint8_t bytes = d_bits/8;
  516|     96|      uint8_t *us = (uint8_t*) &d_network.sin6.sin6_addr.s6_addr;
  517|     96|      uint8_t bits = d_bits % 8;
  518|     96|      uint8_t mask = (uint8_t) ~(0xFF>>bits);
  519|       |
  520|     96|      if (bytes < sizeof(d_network.sin6.sin6_addr.s6_addr)) {
  ------------------
  |  Branch (520:11): [True: 86, False: 10]
  ------------------
  521|     86|        us[bytes] &= mask;
  522|     86|      }
  523|       |
  524|    848|      for(size_t idx = bytes + 1; idx < sizeof(d_network.sin6.sin6_addr.s6_addr); ++idx) {
  ------------------
  |  Branch (524:35): [True: 752, False: 96]
  ------------------
  525|    752|        us[idx] = 0;
  526|    752|      }
  527|     96|    }
  528|    150|  }
_ZNK7Netmask6isIPv6Ev:
  619|     96|  {
  620|     96|    return d_network.sin6.sin6_family == AF_INET6;
  621|     96|  }
_ZNK7Netmask6isIPv4Ev:
  624|    150|  {
  625|    150|    return d_network.sin4.sin_family == AF_INET;
  626|    150|  }

_ZN17SharedLockGuardedINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEE10write_lockEv:
  436|  2.45k|  {
  437|  2.45k|    return SharedLockGuardedHolder<T>(d_value, d_mutex);
  438|  2.45k|  }
_ZN23SharedLockGuardedHolderINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEC2ERSD_RNS0_12shared_mutexE:
  307|  2.45k|  {
  308|  2.45k|  }
_ZNK23SharedLockGuardedHolderINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEptEv:
  314|  2.45k|  T* operator->() const noexcept {
  315|  2.45k|    return &d_value;
  316|  2.45k|  }
_ZN17SharedLockGuardedINSt3__113unordered_mapIjN18DNSDistPacketCache10CacheValueENS0_4hashIjEENS0_8equal_toIjEENS0_9allocatorINS0_4pairIKjS3_EEEEEEEC2Ev:
  427|  2.45k|  {
  428|  2.45k|  }

_ZN14noinit_adaptorINSt3__19allocatorIhEEE7destroyIhEEvPT_:
   40|  4.56M|  void destroy(U* p) {
   41|  4.56M|    p->~U();
   42|  4.56M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEE9constructIhRKhJEEEvPT_OT0_DpOT1_:
   35|  4.56M|  void construct(U* p, V&& v, Args&&... args) {
   36|  4.56M|    ::new((void*)p) U(std::forward<V>(v), std::forward<Args>(args)...);
   37|  4.56M|  }
_ZN14noinit_adaptorINSt3__19allocatorIhEEEC2Ev:
   21|  1.22k|  noinit_adaptor(): Allocator() { }

_ZN11PacketCache14hashAfterQnameERKNSt3__117basic_string_viewIcNS0_11char_traitsIcEEEEjmRKNS0_13unordered_setItNS0_4hashItEENS0_8equal_toItEENS0_9allocatorItEEEE:
   37|    961|  {
   38|    961|    const size_t packetSize = packet.size();
   39|    961|    assert(packetSize >= sizeof(dnsheader));
   40|       |
   41|       |    /* we need at least 2 (QTYPE) + 2 (QCLASS)
   42|       |
   43|       |       + OPT root label (1), type (2), class (2) and ttl (4)
   44|       |       + the OPT RR rdlen (2)
   45|       |       = 15
   46|       |    */
   47|      0|    const dnsheader_aligned dnsheaderdata(packet.data());
   48|    961|    const struct dnsheader *dh = dnsheaderdata.get();
   49|    961|    if (ntohs(dh->qdcount) != 1 || ntohs(dh->ancount) != 0 || ntohs(dh->nscount) != 0 || ntohs(dh->arcount) != 1 || (pos + 15) >= packetSize) {
  ------------------
  |  Branch (49:9): [True: 57, False: 904]
  |  Branch (49:36): [True: 32, False: 872]
  |  Branch (49:63): [True: 36, False: 836]
  |  Branch (49:90): [True: 24, False: 812]
  |  Branch (49:117): [True: 97, False: 715]
  ------------------
   50|    246|      if (packetSize > pos) {
  ------------------
  |  Branch (50:11): [True: 246, False: 0]
  ------------------
   51|    246|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   52|    246|      }
   53|    246|      return currentHash;
   54|    246|    }
   55|       |
   56|    715|    currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 15, currentHash);
   57|       |    /* skip the qtype (2), qclass (2) */
   58|       |    /* root label (1), type (2), class (2) and ttl (4) */
   59|       |    /* already hashed above */
   60|    715|    pos += 13;
   61|       |
   62|    715|    const uint16_t rdLen = ((static_cast<uint16_t>(packet.at(pos)) * 256) + static_cast<uint16_t>(packet.at(pos + 1)));
   63|       |    /* skip the rd length */
   64|       |    /* already hashed above */
   65|    715|    pos += 2;
   66|       |
   67|    715|    if (rdLen > (packetSize - pos)) {
  ------------------
  |  Branch (67:9): [True: 145, False: 570]
  ------------------
   68|    145|      if (pos < packetSize) {
  ------------------
  |  Branch (68:11): [True: 145, False: 0]
  ------------------
   69|    145|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   70|    145|      }
   71|    145|      return currentHash;
   72|    145|    }
   73|       |
   74|    570|    uint16_t rdataRead = 0;
   75|    570|    uint16_t optionCode;
   76|    570|    uint16_t optionLen;
   77|       |
   78|  19.5k|    while (pos < packetSize && rdataRead < rdLen && getNextEDNSOption(&packet.at(pos), rdLen - rdataRead, optionCode, optionLen)) {
  ------------------
  |  Branch (78:12): [True: 19.3k, False: 184]
  |  Branch (78:32): [True: 19.3k, False: 63]
  |  Branch (78:53): [True: 19.2k, False: 114]
  ------------------
   79|  19.2k|      if (optionLen > (rdLen - rdataRead - 4)) {
  ------------------
  |  Branch (79:11): [True: 209, False: 18.9k]
  ------------------
   80|    209|        if (packetSize > pos) {
  ------------------
  |  Branch (80:13): [True: 209, False: 0]
  ------------------
   81|    209|          currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
   82|    209|        }
   83|    209|        return currentHash;
   84|    209|      }
   85|       |
   86|  18.9k|      if (optionsToSkip.count(optionCode) == 0) {
  ------------------
  |  Branch (86:11): [True: 18.0k, False: 939]
  ------------------
   87|       |        /* hash the option code, length and content */
   88|  18.0k|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 4 + optionLen, currentHash);
   89|  18.0k|      }
   90|    939|      else {
   91|       |        /* skip option: hash only its code and length */
   92|    939|        currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), 4, currentHash);
   93|    939|      }
   94|       |
   95|  18.9k|      pos += 4 + optionLen;
   96|  18.9k|      rdataRead += 4 + optionLen;
   97|  18.9k|    }
   98|       |
   99|    361|    if (pos < packetSize) {
  ------------------
  |  Branch (99:9): [True: 177, False: 184]
  ------------------
  100|    177|      currentHash = burtle(reinterpret_cast<const unsigned char*>(&packet.at(pos)), packetSize - pos, currentHash);
  101|    177|    }
  102|       |
  103|    361|    return currentHash;
  104|    570|  }

qtype.cc:_ZL12swapElementsRKNSt3__13mapIKNS_12basic_stringIcNS_11char_traitsIcEENS_9allocatorIcEEEEtNS_4lessIS7_EENS4_INS_4pairIS7_tEEEEEE:
  103|      2|static map<uint16_t, const string> swapElements(const map<const string, uint16_t>& names) {
  104|      2|  map<uint16_t, const string> ret;
  105|       |
  106|    130|  for (const auto& n : names) {
  ------------------
  |  Branch (106:22): [True: 130, False: 2]
  ------------------
  107|    130|    ret.emplace(n.second, n.first);
  108|    130|  }
  109|      2|  return ret;
  110|      2|}

_ZN4pdns12stat_t_traitImEC2Em:
   38|  19.6k|    stat_t_trait(const base_t x) {
   39|  19.6k|      new(&counter) atomic_t(x);
   40|  19.6k|    }
_ZN4pdns12stat_t_traitImED2Ev:
   41|  19.6k|    ~stat_t_trait() {
   42|  19.6k|      reinterpret_cast<atomic_t *>(&counter)->~atomic_t();
   43|  19.6k|    }

