_Z17internal_bswap_32j:
   54|  1.34k|{
   55|  1.34k|#ifdef bitcoin_builtin_bswap32
   56|  1.34k|    return bitcoin_builtin_bswap32(x);
  ------------------
  |  |   24|  1.34k|#      define bitcoin_builtin_bswap32(x) __builtin_bswap32(x)
  ------------------
   57|       |#else
   58|       |    return (((x & 0xff000000U) >> 24) | ((x & 0x00ff0000U) >>  8) |
   59|       |            ((x & 0x0000ff00U) <<  8) | ((x & 0x000000ffU) << 24));
   60|       |#endif
   61|  1.34k|}

_Z16be32toh_internalj:
   44|  1.34k|{
   45|  1.34k|    if constexpr (std::endian::native == std::endian::little) return internal_bswap_32(big_endian_32bits);
   46|       |        else return big_endian_32bits;
   47|  1.34k|}

_Z8ReadBE32ITk8ByteTypehEjPKT_:
   73|  1.34k|{
   74|  1.34k|    uint32_t x;
   75|  1.34k|    memcpy(&x, ptr, 4);
   76|  1.34k|    return be32toh_internal(x);
   77|  1.34k|}

_ZN8CNetAddrC2Ev:
  104|    540|CNetAddr::CNetAddr() = default;
_ZN8CNetAddr5SetIPERKS_:
  107|    350|{
  108|       |    // Size check.
  109|    350|    switch (ipIn.m_net) {
  ------------------
  |  Branch (109:13): [True: 0, False: 350]
  ------------------
  110|    350|    case NET_IPV4:
  ------------------
  |  Branch (110:5): [True: 350, False: 0]
  ------------------
  111|    350|        assert(ipIn.m_addr.size() == ADDR_IPV4_SIZE);
  112|    350|        break;
  113|    350|    case NET_IPV6:
  ------------------
  |  Branch (113:5): [True: 0, False: 350]
  ------------------
  114|      0|        assert(ipIn.m_addr.size() == ADDR_IPV6_SIZE);
  115|      0|        break;
  116|      0|    case NET_ONION:
  ------------------
  |  Branch (116:5): [True: 0, False: 350]
  ------------------
  117|      0|        assert(ipIn.m_addr.size() == ADDR_TORV3_SIZE);
  118|      0|        break;
  119|      0|    case NET_I2P:
  ------------------
  |  Branch (119:5): [True: 0, False: 350]
  ------------------
  120|      0|        assert(ipIn.m_addr.size() == ADDR_I2P_SIZE);
  121|      0|        break;
  122|      0|    case NET_CJDNS:
  ------------------
  |  Branch (122:5): [True: 0, False: 350]
  ------------------
  123|      0|        assert(ipIn.m_addr.size() == ADDR_CJDNS_SIZE);
  124|      0|        break;
  125|      0|    case NET_INTERNAL:
  ------------------
  |  Branch (125:5): [True: 0, False: 350]
  ------------------
  126|      0|        assert(ipIn.m_addr.size() == ADDR_INTERNAL_SIZE);
  127|      0|        break;
  128|      0|    case NET_UNROUTABLE:
  ------------------
  |  Branch (128:5): [True: 0, False: 350]
  ------------------
  129|      0|    case NET_MAX:
  ------------------
  |  Branch (129:5): [True: 0, False: 350]
  ------------------
  130|      0|        assert(false);
  131|    350|    } // no default case, so the compiler can warn about missing cases
  132|       |
  133|    350|    m_net = ipIn.m_net;
  134|    350|    m_addr = ipIn.m_addr;
  135|    350|}
_ZN8CNetAddr13SetLegacyIPv6E4SpanIKhE:
  138|    190|{
  139|    190|    assert(ipv6.size() == ADDR_IPV6_SIZE);
  140|       |
  141|    190|    size_t skip{0};
  142|       |
  143|    190|    if (HasPrefix(ipv6, IPV4_IN_IPV6_PREFIX)) {
  ------------------
  |  Branch (143:9): [True: 1, False: 189]
  ------------------
  144|       |        // IPv4-in-IPv6
  145|      1|        m_net = NET_IPV4;
  146|      1|        skip = sizeof(IPV4_IN_IPV6_PREFIX);
  147|    189|    } else if (HasPrefix(ipv6, TORV2_IN_IPV6_PREFIX)) {
  ------------------
  |  Branch (147:16): [True: 1, False: 188]
  ------------------
  148|       |        // TORv2-in-IPv6 (unsupported). Unserialize as !IsValid(), thus ignoring them.
  149|       |        // Mimic a default-constructed CNetAddr object which is !IsValid() and thus
  150|       |        // will not be gossiped, but continue reading next addresses from the stream.
  151|      1|        m_net = NET_IPV6;
  152|      1|        m_addr.assign(ADDR_IPV6_SIZE, 0x0);
  153|      1|        return;
  154|    188|    } else if (HasPrefix(ipv6, INTERNAL_IN_IPV6_PREFIX)) {
  ------------------
  |  Branch (154:16): [True: 1, False: 187]
  ------------------
  155|       |        // Internal-in-IPv6
  156|      1|        m_net = NET_INTERNAL;
  157|      1|        skip = sizeof(INTERNAL_IN_IPV6_PREFIX);
  158|    187|    } else {
  159|       |        // IPv6
  160|    187|        m_net = NET_IPV6;
  161|    187|    }
  162|       |
  163|    189|    m_addr.assign(ipv6.begin() + skip, ipv6.end());
  164|    189|}
_ZN8CNetAddrC2ERK7in_addr:
  295|    350|{
  296|    350|    m_net = NET_IPV4;
  297|    350|    const uint8_t* ptr = reinterpret_cast<const uint8_t*>(&ipv4Addr);
  298|    350|    m_addr.assign(ptr, ptr + ADDR_IPV4_SIZE);
  299|    350|}
_ZNK8CNetAddr9IsRFC1918Ev:
  316|  1.53k|{
  317|  1.53k|    return IsIPv4() && (
  ------------------
  |  Branch (317:12): [True: 1.00k, False: 534]
  ------------------
  318|  1.00k|        m_addr[0] == 10 ||
  ------------------
  |  Branch (318:9): [True: 1, False: 1.00k]
  ------------------
  319|  1.00k|        (m_addr[0] == 192 && m_addr[1] == 168) ||
  ------------------
  |  Branch (319:10): [True: 92, False: 911]
  |  Branch (319:30): [True: 1, False: 91]
  ------------------
  320|  1.00k|        (m_addr[0] == 172 && m_addr[1] >= 16 && m_addr[1] <= 31));
  ------------------
  |  Branch (320:10): [True: 56, False: 946]
  |  Branch (320:30): [True: 38, False: 18]
  |  Branch (320:49): [True: 5, False: 33]
  ------------------
  321|  1.53k|}
_ZNK8CNetAddr9IsRFC2544Ev:
  324|  1.53k|{
  325|  1.53k|    return IsIPv4() && m_addr[0] == 198 && (m_addr[1] == 18 || m_addr[1] == 19);
  ------------------
  |  Branch (325:12): [True: 997, False: 534]
  |  Branch (325:24): [True: 81, False: 916]
  |  Branch (325:45): [True: 1, False: 80]
  |  Branch (325:64): [True: 1, False: 79]
  ------------------
  326|  1.53k|}
_ZNK8CNetAddr9IsRFC3927Ev:
  329|  1.52k|{
  330|  1.52k|    return IsIPv4() && HasPrefix(m_addr, std::array<uint8_t, 2>{169, 254});
  ------------------
  |  Branch (330:12): [True: 995, False: 534]
  |  Branch (330:24): [True: 1, False: 994]
  ------------------
  331|  1.52k|}
_ZNK8CNetAddr9IsRFC6598Ev:
  334|  1.52k|{
  335|  1.52k|    return IsIPv4() && m_addr[0] == 100 && m_addr[1] >= 64 && m_addr[1] <= 127;
  ------------------
  |  Branch (335:12): [True: 994, False: 533]
  |  Branch (335:24): [True: 52, False: 942]
  |  Branch (335:44): [True: 22, False: 30]
  |  Branch (335:63): [True: 1, False: 21]
  ------------------
  336|  1.52k|}
_ZNK8CNetAddr9IsRFC5737Ev:
  339|  1.52k|{
  340|  1.52k|    return IsIPv4() && (HasPrefix(m_addr, std::array<uint8_t, 3>{192, 0, 2}) ||
  ------------------
  |  Branch (340:12): [True: 993, False: 533]
  |  Branch (340:25): [True: 1, False: 992]
  ------------------
  341|    993|                        HasPrefix(m_addr, std::array<uint8_t, 3>{198, 51, 100}) ||
  ------------------
  |  Branch (341:25): [True: 1, False: 991]
  ------------------
  342|    993|                        HasPrefix(m_addr, std::array<uint8_t, 3>{203, 0, 113}));
  ------------------
  |  Branch (342:25): [True: 0, False: 991]
  ------------------
  343|  1.52k|}
_ZNK8CNetAddr9IsRFC3849Ev:
  346|  1.54k|{
  347|  1.54k|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 4>{0x20, 0x01, 0x0D, 0xB8});
  ------------------
  |  Branch (347:12): [True: 535, False: 1.00k]
  |  Branch (347:24): [True: 1, False: 534]
  ------------------
  348|  1.54k|}
_ZNK8CNetAddr9IsRFC3964Ev:
  351|    346|{
  352|    346|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 2>{0x20, 0x02});
  ------------------
  |  Branch (352:12): [True: 346, False: 0]
  |  Branch (352:24): [True: 3, False: 343]
  ------------------
  353|    346|}
_ZNK8CNetAddr9IsRFC6052Ev:
  356|    350|{
  357|    350|    return IsIPv6() &&
  ------------------
  |  Branch (357:12): [True: 350, False: 0]
  ------------------
  358|    350|           HasPrefix(m_addr, std::array<uint8_t, 12>{0x00, 0x64, 0xFF, 0x9B, 0x00, 0x00,
  ------------------
  |  Branch (358:12): [True: 3, False: 347]
  ------------------
  359|    350|                                                     0x00, 0x00, 0x00, 0x00, 0x00, 0x00});
  360|    350|}
_ZNK8CNetAddr9IsRFC4380Ev:
  363|    343|{
  364|    343|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 4>{0x20, 0x01, 0x00, 0x00});
  ------------------
  |  Branch (364:12): [True: 343, False: 0]
  |  Branch (364:24): [True: 3, False: 340]
  ------------------
  365|    343|}
_ZNK8CNetAddr9IsRFC4862Ev:
  368|  1.52k|{
  369|  1.52k|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 8>{0xFE, 0x80, 0x00, 0x00,
  ------------------
  |  Branch (369:12): [True: 534, False: 994]
  |  Branch (369:24): [True: 1, False: 533]
  ------------------
  370|    534|                                                                0x00, 0x00, 0x00, 0x00});
  371|  1.52k|}
_ZNK8CNetAddr9IsRFC4193Ev:
  374|  1.52k|{
  375|  1.52k|    return IsIPv6() && (m_addr[0] & 0xFE) == 0xFC;
  ------------------
  |  Branch (375:12): [True: 533, False: 991]
  |  Branch (375:24): [True: 8, False: 525]
  ------------------
  376|  1.52k|}
_ZNK8CNetAddr9IsRFC6145Ev:
  379|    351|{
  380|    351|    return IsIPv6() &&
  ------------------
  |  Branch (380:12): [True: 351, False: 0]
  ------------------
  381|    351|           HasPrefix(m_addr, std::array<uint8_t, 12>{0x00, 0x00, 0x00, 0x00, 0x00, 0x00,
  ------------------
  |  Branch (381:12): [True: 3, False: 348]
  ------------------
  382|    351|                                                     0x00, 0x00, 0xFF, 0xFF, 0x00, 0x00});
  383|    351|}
_ZNK8CNetAddr9IsRFC4843Ev:
  386|  1.51k|{
  387|  1.51k|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 3>{0x20, 0x01, 0x00}) &&
  ------------------
  |  Branch (387:12): [True: 525, False: 991]
  |  Branch (387:24): [True: 17, False: 508]
  ------------------
  388|  1.51k|           (m_addr[3] & 0xF0) == 0x10;
  ------------------
  |  Branch (388:12): [True: 1, False: 16]
  ------------------
  389|  1.51k|}
_ZNK8CNetAddr9IsRFC7343Ev:
  392|  1.51k|{
  393|  1.51k|    return IsIPv6() && HasPrefix(m_addr, std::array<uint8_t, 3>{0x20, 0x01, 0x00}) &&
  ------------------
  |  Branch (393:12): [True: 524, False: 991]
  |  Branch (393:24): [True: 16, False: 508]
  ------------------
  394|  1.51k|           (m_addr[3] & 0xF0) == 0x20;
  ------------------
  |  Branch (394:12): [True: 1, False: 15]
  ------------------
  395|  1.51k|}
_ZNK8CNetAddr7IsLocalEv:
  403|  1.51k|{
  404|       |    // IPv4 loopback (127.0.0.0/8 or 0.0.0.0/8)
  405|  1.51k|    if (IsIPv4() && (m_addr[0] == 127 || m_addr[0] == 0)) {
  ------------------
  |  Branch (405:9): [True: 991, False: 523]
  |  Branch (405:22): [True: 1, False: 990]
  |  Branch (405:42): [True: 3, False: 987]
  ------------------
  406|      4|        return true;
  407|      4|    }
  408|       |
  409|       |    // IPv6 loopback (::1/128)
  410|  1.51k|    static const unsigned char pchLocal[16] = {0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1};
  411|  1.51k|    if (IsIPv6() && memcmp(m_addr.data(), pchLocal, sizeof(pchLocal)) == 0) {
  ------------------
  |  Branch (411:9): [True: 523, False: 987]
  |  Branch (411:21): [True: 1, False: 522]
  ------------------
  412|      1|        return true;
  413|      1|    }
  414|       |
  415|  1.50k|    return false;
  416|  1.51k|}
_ZNK8CNetAddr7IsValidEv:
  429|  1.54k|{
  430|       |    // unspecified IPv6 address (::/128)
  431|  1.54k|    unsigned char ipNone6[16] = {};
  432|  1.54k|    if (IsIPv6() && memcmp(m_addr.data(), ipNone6, sizeof(ipNone6)) == 0) {
  ------------------
  |  Branch (432:9): [True: 536, False: 1.00k]
  |  Branch (432:21): [True: 1, False: 535]
  ------------------
  433|      1|        return false;
  434|      1|    }
  435|       |
  436|  1.54k|    if (IsCJDNS() && !HasCJDNSPrefix()) {
  ------------------
  |  Branch (436:9): [True: 0, False: 1.54k]
  |  Branch (436:22): [True: 0, False: 0]
  ------------------
  437|      0|        return false;
  438|      0|    }
  439|       |
  440|       |    // documentation IPv6 address
  441|  1.54k|    if (IsRFC3849())
  ------------------
  |  Branch (441:9): [True: 1, False: 1.54k]
  ------------------
  442|      1|        return false;
  443|       |
  444|  1.54k|    if (IsInternal())
  ------------------
  |  Branch (444:9): [True: 0, False: 1.54k]
  ------------------
  445|      0|        return false;
  446|       |
  447|  1.54k|    if (IsIPv4()) {
  ------------------
  |  Branch (447:9): [True: 1.00k, False: 534]
  ------------------
  448|  1.00k|        const uint32_t addr = ReadBE32(m_addr.data());
  449|  1.00k|        if (addr == INADDR_ANY || addr == INADDR_NONE) {
  ------------------
  |  Branch (449:13): [True: 4, False: 1.00k]
  |  Branch (449:35): [True: 1, False: 1.00k]
  ------------------
  450|      5|            return false;
  451|      5|        }
  452|  1.00k|    }
  453|       |
  454|  1.53k|    return true;
  455|  1.54k|}
_ZNK8CNetAddr10IsRoutableEv:
  467|  1.54k|{
  468|  1.54k|    return IsValid() && !(IsRFC1918() || IsRFC2544() || IsRFC3927() || IsRFC4862() || IsRFC6598() || IsRFC5737() || IsRFC4193() || IsRFC4843() || IsRFC7343() || IsLocal() || IsInternal());
  ------------------
  |  Branch (468:12): [True: 1.53k, False: 7]
  |  Branch (468:27): [True: 7, False: 1.53k]
  |  Branch (468:42): [True: 2, False: 1.52k]
  |  Branch (468:57): [True: 1, False: 1.52k]
  |  Branch (468:72): [True: 1, False: 1.52k]
  |  Branch (468:87): [True: 1, False: 1.52k]
  |  Branch (468:102): [True: 2, False: 1.52k]
  |  Branch (468:117): [True: 8, False: 1.51k]
  |  Branch (468:132): [True: 1, False: 1.51k]
  |  Branch (468:147): [True: 1, False: 1.51k]
  |  Branch (468:162): [True: 5, False: 1.50k]
  |  Branch (468:175): [True: 0, False: 1.50k]
  ------------------
  469|  1.54k|}
_ZNK8CNetAddr10IsInternalEv:
  477|  3.59k|{
  478|  3.59k|   return m_net == NET_INTERNAL;
  479|  3.59k|}
_ZNK8CNetAddr18IsAddrV1CompatibleEv:
  482|    170|{
  483|    170|    switch (m_net) {
  ------------------
  |  Branch (483:13): [True: 0, False: 170]
  ------------------
  484|      0|    case NET_IPV4:
  ------------------
  |  Branch (484:5): [True: 0, False: 170]
  ------------------
  485|    170|    case NET_IPV6:
  ------------------
  |  Branch (485:5): [True: 170, False: 0]
  ------------------
  486|    170|    case NET_INTERNAL:
  ------------------
  |  Branch (486:5): [True: 0, False: 170]
  ------------------
  487|    170|        return true;
  488|      0|    case NET_ONION:
  ------------------
  |  Branch (488:5): [True: 0, False: 170]
  ------------------
  489|      0|    case NET_I2P:
  ------------------
  |  Branch (489:5): [True: 0, False: 170]
  ------------------
  490|      0|    case NET_CJDNS:
  ------------------
  |  Branch (490:5): [True: 0, False: 170]
  ------------------
  491|      0|        return false;
  492|      0|    case NET_UNROUTABLE: // m_net is never and should not be set to NET_UNROUTABLE
  ------------------
  |  Branch (492:5): [True: 0, False: 170]
  ------------------
  493|      0|    case NET_MAX:        // m_net is never and should not be set to NET_MAX
  ------------------
  |  Branch (493:5): [True: 0, False: 170]
  ------------------
  494|      0|        assert(false);
  495|    170|    } // no default case, so the compiler can warn about missing cases
  496|       |
  497|      0|    assert(false);
  498|      0|}
_ZNK8CNetAddr13HasLinkedIPv4Ev:
  657|  1.00k|{
  658|  1.00k|    return IsRoutable() && (IsIPv4() || IsRFC6145() || IsRFC6052() || IsRFC3964() || IsRFC4380());
  ------------------
  |  Branch (658:12): [True: 1.00k, False: 0]
  |  Branch (658:29): [True: 658, False: 348]
  |  Branch (658:41): [True: 2, False: 346]
  |  Branch (658:56): [True: 2, False: 344]
  |  Branch (658:71): [True: 2, False: 342]
  |  Branch (658:86): [True: 2, False: 340]
  ------------------
  659|  1.00k|}
_ZNK8CNetAddr13GetLinkedIPv4Ev:
  662|    333|{
  663|    333|    if (IsIPv4()) {
  ------------------
  |  Branch (663:9): [True: 329, False: 4]
  ------------------
  664|    329|        return ReadBE32(m_addr.data());
  665|    329|    } else if (IsRFC6052() || IsRFC6145()) {
  ------------------
  |  Branch (665:16): [True: 1, False: 3]
  |  Branch (665:31): [True: 1, False: 2]
  ------------------
  666|       |        // mapped IPv4, SIIT translated IPv4: the IPv4 address is the last 4 bytes of the address
  667|      2|        return ReadBE32(Span{m_addr}.last(ADDR_IPV4_SIZE).data());
  668|      2|    } else if (IsRFC3964()) {
  ------------------
  |  Branch (668:16): [True: 1, False: 1]
  ------------------
  669|       |        // 6to4 tunneled IPv4: the IPv4 address is in bytes 2-6
  670|      1|        return ReadBE32(Span{m_addr}.subspan(2, ADDR_IPV4_SIZE).data());
  671|      1|    } else if (IsRFC4380()) {
  ------------------
  |  Branch (671:16): [True: 1, False: 0]
  ------------------
  672|       |        // Teredo tunneled IPv4: the IPv4 address is in the last 4 bytes of the address, but bitflipped
  673|      1|        return ~ReadBE32(Span{m_addr}.last(ADDR_IPV4_SIZE).data());
  674|      1|    }
  675|      0|    assert(false);
  676|      0|}
_ZNK8CNetAddr11GetNetClassEv:
  679|    540|{
  680|       |    // Make sure that if we return NET_IPV6, then IsIPv6() is true. The callers expect that.
  681|       |
  682|       |    // Check for "internal" first because such addresses are also !IsRoutable()
  683|       |    // and we don't want to return NET_UNROUTABLE in that case.
  684|    540|    if (IsInternal()) {
  ------------------
  |  Branch (684:9): [True: 1, False: 539]
  ------------------
  685|      1|        return NET_INTERNAL;
  686|      1|    }
  687|    539|    if (!IsRoutable()) {
  ------------------
  |  Branch (687:9): [True: 36, False: 503]
  ------------------
  688|     36|        return NET_UNROUTABLE;
  689|     36|    }
  690|    503|    if (HasLinkedIPv4()) {
  ------------------
  |  Branch (690:9): [True: 333, False: 170]
  ------------------
  691|    333|        return NET_IPV4;
  692|    333|    }
  693|    170|    return m_net;
  694|    503|}
_ZNK8CNetAddr12GetAddrBytesEv:
  697|    170|{
  698|    170|    if (IsAddrV1Compatible()) {
  ------------------
  |  Branch (698:9): [True: 170, False: 0]
  ------------------
  699|    170|        uint8_t serialized[V1_SERIALIZATION_SIZE];
  700|    170|        SerializeV1Array(serialized);
  701|    170|        return {std::begin(serialized), std::end(serialized)};
  702|    170|    }
  703|      0|    return std::vector<unsigned char>(m_addr.begin(), m_addr.end());
  704|    170|}

_ZNK8CNetAddr6IsIPv4Ev:
  157|  12.0k|    [[nodiscard]] bool IsIPv4() const { return m_net == NET_IPV4; } // IPv4 mapped address (::FFFF:0:0/96, 0.0.0.0/0)
_ZNK8CNetAddr6IsIPv6Ev:
  158|  12.2k|    [[nodiscard]] bool IsIPv6() const { return m_net == NET_IPV6; } // IPv6 address (not mapped IPv4, not Tor)
_ZNK8CNetAddr7IsCJDNSEv:
  176|  1.54k|    [[nodiscard]] bool IsCJDNS() const { return m_net == NET_CJDNS; }
_ZNK8CNetAddr16SerializeV1ArrayERA16_h:
  325|    170|    {
  326|    170|        size_t prefix_size;
  327|       |
  328|    170|        switch (m_net) {
  ------------------
  |  Branch (328:17): [True: 0, False: 170]
  ------------------
  329|    170|        case NET_IPV6:
  ------------------
  |  Branch (329:9): [True: 170, False: 0]
  ------------------
  330|    170|            assert(m_addr.size() == sizeof(arr));
  331|    170|            memcpy(arr, m_addr.data(), m_addr.size());
  332|    170|            return;
  333|      0|        case NET_IPV4:
  ------------------
  |  Branch (333:9): [True: 0, False: 170]
  ------------------
  334|      0|            prefix_size = sizeof(IPV4_IN_IPV6_PREFIX);
  335|      0|            assert(prefix_size + m_addr.size() == sizeof(arr));
  336|      0|            memcpy(arr, IPV4_IN_IPV6_PREFIX.data(), prefix_size);
  337|      0|            memcpy(arr + prefix_size, m_addr.data(), m_addr.size());
  338|      0|            return;
  339|      0|        case NET_INTERNAL:
  ------------------
  |  Branch (339:9): [True: 0, False: 170]
  ------------------
  340|      0|            prefix_size = sizeof(INTERNAL_IN_IPV6_PREFIX);
  341|      0|            assert(prefix_size + m_addr.size() == sizeof(arr));
  342|      0|            memcpy(arr, INTERNAL_IN_IPV6_PREFIX.data(), prefix_size);
  343|      0|            memcpy(arr + prefix_size, m_addr.data(), m_addr.size());
  344|      0|            return;
  345|      0|        case NET_ONION:
  ------------------
  |  Branch (345:9): [True: 0, False: 170]
  ------------------
  346|      0|        case NET_I2P:
  ------------------
  |  Branch (346:9): [True: 0, False: 170]
  ------------------
  347|      0|        case NET_CJDNS:
  ------------------
  |  Branch (347:9): [True: 0, False: 170]
  ------------------
  348|      0|            break;
  349|      0|        case NET_UNROUTABLE:
  ------------------
  |  Branch (349:9): [True: 0, False: 170]
  ------------------
  350|      0|        case NET_MAX:
  ------------------
  |  Branch (350:9): [True: 0, False: 170]
  ------------------
  351|      0|            assert(false);
  352|    170|        } // no default case, so the compiler can warn about missing cases
  353|       |
  354|       |        // Serialize ONION, I2P and CJDNS as all-zeros.
  355|      0|        memset(arr, 0x0, V1_SERIALIZATION_SIZE);
  356|      0|    }

_ZNK15NetGroupManager11GetMappedASERK8CNetAddr:
   82|    540|{
   83|    540|    uint32_t net_class = address.GetNetClass();
   84|    540|    if (m_asmap.size() == 0 || (net_class != NET_IPV4 && net_class != NET_IPV6)) {
  ------------------
  |  Branch (84:9): [True: 0, False: 540]
  |  Branch (84:33): [True: 207, False: 333]
  |  Branch (84:58): [True: 37, False: 170]
  ------------------
   85|     37|        return 0; // Indicates not found, safe because AS0 is reserved per RFC7607.
   86|     37|    }
   87|    503|    std::vector<bool> ip_bits(128);
   88|    503|    if (address.HasLinkedIPv4()) {
  ------------------
  |  Branch (88:9): [True: 333, False: 170]
  ------------------
   89|       |        // For lookup, treat as if it was just an IPv4 address (IPV4_IN_IPV6_PREFIX + IPv4 bits)
   90|  4.32k|        for (int8_t byte_i = 0; byte_i < 12; ++byte_i) {
  ------------------
  |  Branch (90:33): [True: 3.99k, False: 333]
  ------------------
   91|  35.9k|            for (uint8_t bit_i = 0; bit_i < 8; ++bit_i) {
  ------------------
  |  Branch (91:37): [True: 31.9k, False: 3.99k]
  ------------------
   92|  31.9k|                ip_bits[byte_i * 8 + bit_i] = (IPV4_IN_IPV6_PREFIX[byte_i] >> (7 - bit_i)) & 1;
   93|  31.9k|            }
   94|  3.99k|        }
   95|    333|        uint32_t ipv4 = address.GetLinkedIPv4();
   96|  10.9k|        for (int i = 0; i < 32; ++i) {
  ------------------
  |  Branch (96:25): [True: 10.6k, False: 333]
  ------------------
   97|  10.6k|            ip_bits[96 + i] = (ipv4 >> (31 - i)) & 1;
   98|  10.6k|        }
   99|    333|    } else {
  100|       |        // Use all 128 bits of the IPv6 address otherwise
  101|    170|        assert(address.IsIPv6());
  102|    170|        auto addr_bytes = address.GetAddrBytes();
  103|  2.89k|        for (int8_t byte_i = 0; byte_i < 16; ++byte_i) {
  ------------------
  |  Branch (103:33): [True: 2.72k, False: 170]
  ------------------
  104|  2.72k|            uint8_t cur_byte = addr_bytes[byte_i];
  105|  24.4k|            for (uint8_t bit_i = 0; bit_i < 8; ++bit_i) {
  ------------------
  |  Branch (105:37): [True: 21.7k, False: 2.72k]
  ------------------
  106|  21.7k|                ip_bits[byte_i * 8 + bit_i] = (cur_byte >> (7 - bit_i)) & 1;
  107|  21.7k|            }
  108|  2.72k|        }
  109|    170|    }
  110|    503|    uint32_t mapped_as = Interpret(m_asmap, ip_bits);
  111|    503|    return mapped_as;
  112|    503|}

_ZN15NetGroupManagerC2ENSt3__16vectorIbNS0_9allocatorIbEEEE:
   19|    540|        : m_asmap{std::move(asmap)}
   20|    540|    {}

_ZNK9prevectorILj16EhjiE9is_directEv:
  173|  37.0k|    bool is_direct() const { return _size <= N; }
_ZN9prevectorILj16EhjiED2Ev:
  474|    890|    ~prevector() {
  475|    890|        if (!is_direct()) {
  ------------------
  |  Branch (475:13): [True: 0, False: 890]
  ------------------
  476|      0|            free(_union.indirect_contents.indirect);
  477|      0|            _union.indirect_contents.indirect = nullptr;
  478|      0|        }
  479|    890|    }
_ZNK9prevectorILj16EhjiE4sizeEv:
  294|  11.1k|    size_type size() const {
  295|  11.1k|        return is_direct() ? _size : _size - N - 1;
  ------------------
  |  Branch (295:16): [True: 11.1k, False: 0]
  ------------------
  296|  11.1k|    }
_ZN9prevectorILj16EhjiE15change_capacityEj:
  175|    890|    void change_capacity(size_type new_capacity) {
  176|    890|        if (new_capacity <= N) {
  ------------------
  |  Branch (176:13): [True: 890, False: 0]
  ------------------
  177|    890|            if (!is_direct()) {
  ------------------
  |  Branch (177:17): [True: 0, False: 890]
  ------------------
  178|      0|                T* indirect = indirect_ptr(0);
  179|      0|                T* src = indirect;
  180|      0|                T* dst = direct_ptr(0);
  181|      0|                memcpy(dst, src, size() * sizeof(T));
  182|      0|                free(indirect);
  183|      0|                _size -= N + 1;
  184|      0|            }
  185|    890|        } else {
  186|      0|            if (!is_direct()) {
  ------------------
  |  Branch (186:17): [True: 0, False: 0]
  ------------------
  187|       |                /* FIXME: Because malloc/realloc here won't call new_handler if allocation fails, assert
  188|       |                    success. These should instead use an allocator or new/delete so that handlers
  189|       |                    are called as necessary, but performance would be slightly degraded by doing so. */
  190|      0|                _union.indirect_contents.indirect = static_cast<char*>(realloc(_union.indirect_contents.indirect, ((size_t)sizeof(T)) * new_capacity));
  191|      0|                assert(_union.indirect_contents.indirect);
  192|      0|                _union.indirect_contents.capacity = new_capacity;
  193|      0|            } else {
  194|      0|                char* new_indirect = static_cast<char*>(malloc(((size_t)sizeof(T)) * new_capacity));
  195|      0|                assert(new_indirect);
  196|      0|                T* src = direct_ptr(0);
  197|      0|                T* dst = reinterpret_cast<T*>(new_indirect);
  198|      0|                memcpy(dst, src, size() * sizeof(T));
  199|      0|                _union.indirect_contents.indirect = new_indirect;
  200|      0|                _union.indirect_contents.capacity = new_capacity;
  201|      0|                _size += N + 1;
  202|      0|            }
  203|      0|        }
  204|    890|    }
_ZN9prevectorILj16EhjiE10direct_ptrEi:
  169|  4.45k|    T* direct_ptr(difference_type pos) { return reinterpret_cast<T*>(_union.direct) + pos; }
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorENS0_14const_iteratorEEEvPhT_S5_:
  214|    350|    void fill(T* dst, InputIterator first, InputIterator last) {
  215|  1.75k|        while (first != last) {
  ------------------
  |  Branch (215:16): [True: 1.40k, False: 350]
  ------------------
  216|  1.40k|            new(static_cast<void*>(dst)) T(*first);
  217|  1.40k|            ++dst;
  218|  1.40k|            ++first;
  219|  1.40k|        }
  220|    350|    }
_ZNK9prevectorILj16EhjiE14const_iteratorneES1_:
  125|  1.75k|        bool operator!=(const_iterator x) const { return ptr != x.ptr; }
_ZNK9prevectorILj16EhjiE14const_iteratordeEv:
  111|  2.10k|        const T& operator*() const { return *ptr; }
_ZN9prevectorILj16EhjiE14const_iteratorppEv:
  114|  1.40k|        const_iterator& operator++() { ptr++; return *this; }
_ZN9prevectorILj16EhjiE8item_ptrEi:
  206|  4.45k|    T* item_ptr(difference_type pos) { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
  ------------------
  |  Branch (206:47): [True: 4.45k, False: 0]
  ------------------
_ZNK9prevectorILj16EhjiE5beginEv:
  303|  7.82k|    const_iterator begin() const { return const_iterator(item_ptr(0)); }
_ZNK9prevectorILj16EhjiE8item_ptrEi:
  207|  18.7k|    const T* item_ptr(difference_type pos) const { return is_direct() ? direct_ptr(pos) : indirect_ptr(pos); }
  ------------------
  |  Branch (207:59): [True: 18.7k, False: 0]
  ------------------
_ZNK9prevectorILj16EhjiE10direct_ptrEi:
  170|  18.7k|    const T* direct_ptr(difference_type pos) const { return reinterpret_cast<const T*>(_union.direct) + pos; }
_ZN9prevectorILj16EhjiE14const_iteratorC2EPKh:
  109|  8.17k|        const_iterator(const T* ptr_) : ptr(ptr_) {}
_ZNK9prevectorILj16EhjiE3endEv:
  305|    350|    const_iterator end() const { return const_iterator(item_ptr(size())); }
_ZN9prevectorILj16EhjiEaSERKS0_:
  276|    350|    prevector& operator=(const prevector<N, T, Size, Diff>& other) {
  277|    350|        if (&other == this) {
  ------------------
  |  Branch (277:13): [True: 0, False: 350]
  ------------------
  278|      0|            return *this;
  279|      0|        }
  280|    350|        assign(other.begin(), other.end());
  281|    350|        return *this;
  282|    350|    }
_ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorENS0_14const_iteratorEEEvT_S4_:
  233|    350|    void assign(InputIterator first, InputIterator last) {
  234|    350|        size_type n = last - first;
  235|    350|        clear();
  236|    350|        if (capacity() < n) {
  ------------------
  |  Branch (236:13): [True: 0, False: 350]
  ------------------
  237|      0|            change_capacity(n);
  238|      0|        }
  239|    350|        _size += n;
  240|    350|        fill(item_ptr(0), first, last);
  241|    350|    }
_ZmiN9prevectorILj16EhjiE14const_iteratorES1_:
  118|    350|        difference_type friend operator-(const_iterator a, const_iterator b) { return (&(*a) - &(*b)); }
_ZN9prevectorILj16EhjiE5clearEv:
  355|    890|    void clear() {
  356|    890|        resize(0);
  357|    890|    }
_ZN9prevectorILj16EhjiE6resizeEj:
  328|    890|    void resize(size_type new_size) {
  329|    890|        size_type cur_size = size();
  330|    890|        if (cur_size == new_size) {
  ------------------
  |  Branch (330:13): [True: 0, False: 890]
  ------------------
  331|      0|            return;
  332|      0|        }
  333|    890|        if (cur_size > new_size) {
  ------------------
  |  Branch (333:13): [True: 890, False: 0]
  ------------------
  334|    890|            erase(item_ptr(new_size), end());
  335|    890|            return;
  336|    890|        }
  337|      0|        if (new_size > capacity()) {
  ------------------
  |  Branch (337:13): [True: 0, False: 0]
  ------------------
  338|      0|            change_capacity(new_size);
  339|      0|        }
  340|      0|        ptrdiff_t increase = new_size - cur_size;
  341|      0|        fill(item_ptr(cur_size), increase);
  342|      0|        _size += increase;
  343|      0|    }
_ZN9prevectorILj16EhjiE5eraseENS0_8iteratorES1_:
  420|    890|    iterator erase(iterator first, iterator last) {
  421|       |        // Erase is not allowed to the change the object's capacity. That means
  422|       |        // that when starting with an indirectly allocated prevector with
  423|       |        // size and capacity > N, the result may be a still indirectly allocated
  424|       |        // prevector with size <= N and capacity > N. A shrink_to_fit() call is
  425|       |        // necessary to switch to the (more efficient) directly allocated
  426|       |        // representation (with capacity N and size <= N).
  427|    890|        iterator p = first;
  428|    890|        char* endp = (char*)&(*end());
  429|    890|        _size -= last - p;
  430|    890|        memmove(&(*first), &(*last), endp - ((char*)(&(*last))));
  431|    890|        return first;
  432|    890|    }
_ZNK9prevectorILj16EhjiE8iteratordeEv:
   59|  5.34k|        T& operator*() const { return *ptr; }
_ZmiN9prevectorILj16EhjiE8iteratorES1_:
   66|    890|        difference_type friend operator-(iterator a, iterator b) { return (&(*a) - &(*b)); }
_ZN9prevectorILj16EhjiE8iteratorC2EPh:
   58|  2.67k|        iterator(T* ptr_) : ptr(ptr_) {}
_ZN9prevectorILj16EhjiE3endEv:
  304|  1.78k|    iterator end() { return iterator(item_ptr(size())); }
_ZN9prevectorILj16EhjiE4fillEPhlRKh:
  209|    891|    void fill(T* dst, ptrdiff_t count, const T& value = T{}) {
  210|    891|        std::fill_n(dst, count, value);
  211|    891|    }
_ZNK9prevectorILj16EhjiE8capacityEv:
  312|    890|    size_t capacity() const {
  313|    890|        if (is_direct()) {
  ------------------
  |  Branch (313:13): [True: 890, False: 0]
  ------------------
  314|    890|            return N;
  315|    890|        } else {
  316|      0|            return _union.indirect_contents.capacity;
  317|      0|        }
  318|    890|    }
_ZNK9prevectorILj16EhjiEixEj:
  324|  7.96k|    const T& operator[](size_type pos) const {
  325|  7.96k|        return *item_ptr(pos);
  326|  7.96k|    }
_ZNK9prevectorILj16EhjiE4dataEv:
  537|  2.57k|    const value_type* data() const {
  538|  2.57k|        return item_ptr(0);
  539|  2.57k|    }
_ZNK9prevectorILj16EhjiE14const_iteratorptEv:
  112|  7.47k|        const T* operator->() const { return ptr; }
_ZN9prevectorILj16EhjiE6assignEjRKh:
  223|      1|    void assign(size_type n, const T& val) {
  224|      1|        clear();
  225|      1|        if (capacity() < n) {
  ------------------
  |  Branch (225:13): [True: 0, False: 1]
  ------------------
  226|      0|            change_capacity(n);
  227|      0|        }
  228|      1|        _size += n;
  229|      1|        fill(item_ptr(0), n, val);
  230|      1|    }
_ZN9prevectorILj16EhjiEC2EjRKh:
  249|    890|    explicit prevector(size_type n, const T& val) {
  250|    890|        change_capacity(n);
  251|    890|        _size += n;
  252|    890|        fill(item_ptr(0), n, val);
  253|    890|    }
_ZN9prevectorILj16EhjiE6assignITkNSt3__114input_iteratorEPKhEEvT_S5_:
  233|    539|    void assign(InputIterator first, InputIterator last) {
  234|    539|        size_type n = last - first;
  235|    539|        clear();
  236|    539|        if (capacity() < n) {
  ------------------
  |  Branch (236:13): [True: 0, False: 539]
  ------------------
  237|      0|            change_capacity(n);
  238|      0|        }
  239|    539|        _size += n;
  240|    539|        fill(item_ptr(0), first, last);
  241|    539|    }
_ZN9prevectorILj16EhjiE4fillITkNSt3__114input_iteratorEPKhEEvPhT_S6_:
  214|    539|    void fill(T* dst, InputIterator first, InputIterator last) {
  215|  4.94k|        while (first != last) {
  ------------------
  |  Branch (215:16): [True: 4.40k, False: 539]
  ------------------
  216|  4.40k|            new(static_cast<void*>(dst)) T(*first);
  217|  4.40k|            ++dst;
  218|  4.40k|            ++first;
  219|  4.40k|        }
  220|    539|    }

_ZNK4SpanIKhE4sizeEv:
  187|    757|    constexpr std::size_t size() const noexcept { return m_size; }
_ZNK4SpanIKhE5beginEv:
  175|    756|    constexpr C* begin() const noexcept { return m_data; }
_ZNK4SpanIKhE3endEv:
  176|    189|    constexpr C* end() const noexcept { return m_data + m_size; }
_ZNK4SpanIKhE4dataEv:
  174|      4|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanIKhE7subspanEmm:
  201|      1|    {
  202|      1|        ASSERT_IF_DEBUG(size() >= offset + count);
  203|      1|        return Span<C>(m_data + offset, count);
  204|      1|    }
_ZN4SpanIKhEC2IS0_TnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_S0_EE5valueEiE4typeELi0EEEPS5_m:
  119|    194|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_ZN4SpanIKhEC2I9prevectorILj16EhjiEEERKT_NSt3__19enable_ifIXaaaantsr7is_SpanIS5_EE5valuesr3std14is_convertibleIPA_NS8_14remove_pointerIDTcldtclsr3stdE7declvalIS7_EE4dataEEE4typeEPA_S0_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalIS7_EE4sizeEEmEE5valueEDnE4typeE:
  172|      4|        : m_data(other.data()), m_size(other.size()){}
_ZNK4SpanIKhE4lastEm:
  211|      3|    {
  212|      3|         ASSERT_IF_DEBUG(size() >= count);
  213|      3|         return Span<C>(m_data + m_size - count, count);
  214|      3|    }

_Z17asmap_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEE:
   33|    898|{
   34|       |    // Encoding: [7 bits: asmap size] [1 bit: ipv6?] [3-130 bytes: asmap] [4 or 16 bytes: addr]
   35|    898|    if (buffer.size() < 1 + 3 + 4) return;
  ------------------
  |  Branch (35:9): [True: 4, False: 894]
  ------------------
   36|    894|    int asmap_size = 3 + (buffer[0] & 127);
   37|    894|    bool ipv6 = buffer[0] & 128;
   38|    894|    const size_t addr_size = ipv6 ? ADDR_IPV6_SIZE : ADDR_IPV4_SIZE;
  ------------------
  |  Branch (38:30): [True: 235, False: 659]
  ------------------
   39|    894|    if (buffer.size() < size_t(1 + asmap_size + addr_size)) return;
  ------------------
  |  Branch (39:9): [True: 14, False: 880]
  ------------------
   40|    880|    std::vector<bool> asmap = ipv6 ? IPV6_PREFIX_ASMAP : IPV4_PREFIX_ASMAP;
  ------------------
  |  Branch (40:31): [True: 227, False: 653]
  ------------------
   41|    880|    asmap.reserve(asmap.size() + 8 * asmap_size);
   42|  17.9k|    for (int i = 0; i < asmap_size; ++i) {
  ------------------
  |  Branch (42:21): [True: 17.0k, False: 880]
  ------------------
   43|   153k|        for (int j = 0; j < 8; ++j) {
  ------------------
  |  Branch (43:25): [True: 136k, False: 17.0k]
  ------------------
   44|   136k|            asmap.push_back((buffer[1 + i] >> j) & 1);
   45|   136k|        }
   46|  17.0k|    }
   47|    880|    if (!SanityCheckASMap(asmap, 128)) return;
  ------------------
  |  Branch (47:9): [True: 340, False: 540]
  ------------------
   48|       |
   49|    540|    const uint8_t* addr_data = buffer.data() + 1 + asmap_size;
   50|    540|    CNetAddr net_addr;
   51|    540|    if (ipv6) {
  ------------------
  |  Branch (51:9): [True: 190, False: 350]
  ------------------
   52|    190|        assert(addr_size == ADDR_IPV6_SIZE);
   53|    190|        net_addr.SetLegacyIPv6({addr_data, addr_size});
   54|    350|    } else {
   55|    350|        assert(addr_size == ADDR_IPV4_SIZE);
   56|    350|        in_addr ipv4;
   57|    350|        memcpy(&ipv4, addr_data, addr_size);
   58|    350|        net_addr.SetIP(CNetAddr{ipv4});
   59|    350|    }
   60|    540|    NetGroupManager netgroupman{asmap};
   61|    540|    (void)netgroupman.GetMappedAS(net_addr);
   62|    540|}

LLVMFuzzerTestOneInput:
  222|    898|{
  223|    898|    test_one_input({data, size});
  224|    898|    return 0;
  225|    898|}
fuzz.cpp:_ZL14test_one_inputNSt3__14spanIKhLm18446744073709551615EEE:
   83|    898|{
   84|    898|    CheckGlobals check{};
   85|    898|    (*Assert(g_test_one_input))(buffer);
  ------------------
  |  |   85|    898|#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
  ------------------
   86|    898|}

_ZN12CheckGlobalsC2Ev:
   56|    898|CheckGlobals::CheckGlobals() : m_impl(std::make_unique<CheckGlobalsImpl>()) {}
_ZN12CheckGlobalsD2Ev:
   57|    898|CheckGlobals::~CheckGlobals() = default;
_ZN16CheckGlobalsImplC2Ev:
   17|    898|    {
   18|    898|        g_used_g_prng = false;
   19|    898|        g_seeded_g_prng_zero = false;
   20|    898|        g_used_system_time = false;
   21|    898|        SetMockTime(0s);
   22|    898|    }
_ZN16CheckGlobalsImplD2Ev:
   24|    898|    {
   25|    898|        if (g_used_g_prng && !g_seeded_g_prng_zero) {
  ------------------
  |  Branch (25:13): [True: 0, False: 898]
  |  Branch (25:30): [True: 0, False: 0]
  ------------------
   26|      0|            std::cerr << "\n\n"
   27|      0|                         "The current fuzz target used the global random state.\n\n"
   28|       |
   29|      0|                         "This is acceptable, but requires the fuzz target to call \n"
   30|      0|                         "SeedRandomStateForTest(SeedRand::ZEROS) in the first line \n"
   31|      0|                         "of the FUZZ_TARGET function.\n\n"
   32|       |
   33|      0|                         "An alternative solution would be to avoid any use of globals.\n\n"
   34|       |
   35|      0|                         "Without a solution, fuzz instability and non-determinism can lead \n"
   36|      0|                         "to non-reproducible bugs or inefficient fuzzing.\n\n"
   37|      0|                      << std::endl;
   38|      0|            std::abort(); // Abort, because AFL may try to recover from a std::exit
   39|      0|        }
   40|       |
   41|    898|        if (g_used_system_time) {
  ------------------
  |  Branch (41:13): [True: 0, False: 898]
  ------------------
   42|      0|            std::cerr << "\n\n"
   43|      0|                         "The current fuzz target accessed system time.\n\n"
   44|       |
   45|      0|                         "This is acceptable, but requires the fuzz target to call \n"
   46|      0|                         "SetMockTime() at the beginning of processing the fuzz input.\n\n"
   47|       |
   48|      0|                         "Without setting mock time, time-dependent behavior can lead \n"
   49|      0|                         "to non-reproducible bugs or inefficient fuzzing.\n\n"
   50|      0|                      << std::endl;
   51|      0|            std::abort();
   52|      0|        }
   53|    898|    }

_Z9InterpretRKNSt3__16vectorIbNS_9allocatorIbEEEES5_:
   89|    503|{
   90|    503|    std::vector<bool>::const_iterator pos = asmap.begin();
   91|    503|    const std::vector<bool>::const_iterator endpos = asmap.end();
   92|    503|    uint8_t bits = ip.size();
   93|    503|    uint32_t default_asn = 0;
   94|    503|    uint32_t jump, match, matchlen;
   95|    503|    Instruction opcode;
   96|  6.33k|    while (pos != endpos) {
  ------------------
  |  Branch (96:12): [True: 6.33k, False: 0]
  ------------------
   97|  6.33k|        opcode = DecodeType(pos, endpos);
   98|  6.33k|        if (opcode == Instruction::RETURN) {
  ------------------
  |  Branch (98:13): [True: 408, False: 5.92k]
  ------------------
   99|    408|            default_asn = DecodeASN(pos, endpos);
  100|    408|            if (default_asn == INVALID) break; // ASN straddles EOF
  ------------------
  |  Branch (100:17): [True: 0, False: 408]
  ------------------
  101|    408|            return default_asn;
  102|  5.92k|        } else if (opcode == Instruction::JUMP) {
  ------------------
  |  Branch (102:20): [True: 503, False: 5.42k]
  ------------------
  103|    503|            jump = DecodeJump(pos, endpos);
  104|    503|            if (jump == INVALID) break; // Jump offset straddles EOF
  ------------------
  |  Branch (104:17): [True: 0, False: 503]
  ------------------
  105|    503|            if (bits == 0) break; // No input bits left
  ------------------
  |  Branch (105:17): [True: 0, False: 503]
  ------------------
  106|    503|            if (int64_t{jump} >= int64_t{endpos - pos}) break; // Jumping past EOF
  ------------------
  |  Branch (106:17): [True: 0, False: 503]
  ------------------
  107|    503|            if (ip[ip.size() - bits]) {
  ------------------
  |  Branch (107:17): [True: 458, False: 45]
  ------------------
  108|    458|                pos += jump;
  109|    458|            }
  110|    503|            bits--;
  111|  5.42k|        } else if (opcode == Instruction::MATCH) {
  ------------------
  |  Branch (111:20): [True: 4.75k, False: 672]
  ------------------
  112|  4.75k|            match = DecodeMatch(pos, endpos);
  113|  4.75k|            if (match == INVALID) break; // Match bits straddle EOF
  ------------------
  |  Branch (113:17): [True: 0, False: 4.75k]
  ------------------
  114|  4.75k|            matchlen = std::bit_width(match) - 1;
  115|  4.75k|            if (bits < matchlen) break; // Not enough input bits
  ------------------
  |  Branch (115:17): [True: 0, False: 4.75k]
  ------------------
  116|  37.4k|            for (uint32_t bit = 0; bit < matchlen; bit++) {
  ------------------
  |  Branch (116:36): [True: 32.7k, False: 4.65k]
  ------------------
  117|  32.7k|                if ((ip[ip.size() - bits]) != ((match >> (matchlen - 1 - bit)) & 1)) {
  ------------------
  |  Branch (117:21): [True: 95, False: 32.6k]
  ------------------
  118|     95|                    return default_asn;
  119|     95|                }
  120|  32.6k|                bits--;
  121|  32.6k|            }
  122|  4.75k|        } else if (opcode == Instruction::DEFAULT) {
  ------------------
  |  Branch (122:20): [True: 672, False: 0]
  ------------------
  123|    672|            default_asn = DecodeASN(pos, endpos);
  124|    672|            if (default_asn == INVALID) break; // ASN straddles EOF
  ------------------
  |  Branch (124:17): [True: 0, False: 672]
  ------------------
  125|    672|        } else {
  126|      0|            break; // Instruction straddles EOF
  127|      0|        }
  128|  6.33k|    }
  129|      0|    assert(false); // Reached EOF without RETURN, or aborted (see any of the breaks above) - should have been caught by SanityCheckASMap below
  130|      0|    return 0; // 0 is not a valid ASN
  131|      0|}
_Z16SanityCheckASMapRKNSt3__16vectorIbNS_9allocatorIbEEEEi:
  134|    880|{
  135|    880|    const std::vector<bool>::const_iterator begin = asmap.begin(), endpos = asmap.end();
  136|    880|    std::vector<bool>::const_iterator pos = begin;
  137|    880|    std::vector<std::pair<uint32_t, int>> jumps; // All future positions we may jump to (bit offset in asmap -> bits to consume left)
  138|    880|    jumps.reserve(bits);
  139|    880|    Instruction prevopcode = Instruction::JUMP;
  140|    880|    bool had_incomplete_match = false;
  141|  15.1k|    while (pos != endpos) {
  ------------------
  |  Branch (141:12): [True: 15.0k, False: 29]
  ------------------
  142|  15.0k|        uint32_t offset = pos - begin;
  143|  15.0k|        if (!jumps.empty() && offset >= jumps.back().first) return false; // There was a jump into the middle of the previous instruction
  ------------------
  |  Branch (143:13): [True: 2.00k, False: 13.0k]
  |  Branch (143:31): [True: 4, False: 2.00k]
  ------------------
  144|  15.0k|        Instruction opcode = DecodeType(pos, endpos);
  145|  15.0k|        if (opcode == Instruction::RETURN) {
  ------------------
  |  Branch (145:13): [True: 2.13k, False: 12.9k]
  ------------------
  146|  2.13k|            if (prevopcode == Instruction::DEFAULT) return false; // There should not be any RETURN immediately after a DEFAULT (could be combined into just RETURN)
  ------------------
  |  Branch (146:17): [True: 6, False: 2.12k]
  ------------------
  147|  2.12k|            uint32_t asn = DecodeASN(pos, endpos);
  148|  2.12k|            if (asn == INVALID) return false; // ASN straddles EOF
  ------------------
  |  Branch (148:17): [True: 45, False: 2.08k]
  ------------------
  149|  2.08k|            if (jumps.empty()) {
  ------------------
  |  Branch (149:17): [True: 569, False: 1.51k]
  ------------------
  150|       |                // Nothing to execute anymore
  151|    569|                if (endpos - pos > 7) return false; // Excessive padding
  ------------------
  |  Branch (151:21): [True: 23, False: 546]
  ------------------
  152|  2.54k|                while (pos != endpos) {
  ------------------
  |  Branch (152:24): [True: 2.00k, False: 540]
  ------------------
  153|  2.00k|                    if (*pos) return false; // Nonzero padding bit
  ------------------
  |  Branch (153:25): [True: 6, False: 2.00k]
  ------------------
  154|  2.00k|                    ++pos;
  155|  2.00k|                }
  156|    540|                return true; // Sanely reached EOF
  157|  1.51k|            } else {
  158|       |                // Continue by pretending we jumped to the next instruction
  159|  1.51k|                offset = pos - begin;
  160|  1.51k|                if (offset != jumps.back().first) return false; // Unreachable code
  ------------------
  |  Branch (160:21): [True: 25, False: 1.48k]
  ------------------
  161|  1.48k|                bits = jumps.back().second; // Restore the number of bits we would have had left after this jump
  162|  1.48k|                jumps.pop_back();
  163|  1.48k|                prevopcode = Instruction::JUMP;
  164|  1.48k|            }
  165|  12.9k|        } else if (opcode == Instruction::JUMP) {
  ------------------
  |  Branch (165:20): [True: 1.69k, False: 11.2k]
  ------------------
  166|  1.69k|            uint32_t jump = DecodeJump(pos, endpos);
  167|  1.69k|            if (jump == INVALID) return false; // Jump offset straddles EOF
  ------------------
  |  Branch (167:17): [True: 30, False: 1.66k]
  ------------------
  168|  1.66k|            if (int64_t{jump} > int64_t{endpos - pos}) return false; // Jump out of range
  ------------------
  |  Branch (168:17): [True: 54, False: 1.61k]
  ------------------
  169|  1.61k|            if (bits == 0) return false; // Consuming bits past the end of the input
  ------------------
  |  Branch (169:17): [True: 1, False: 1.61k]
  ------------------
  170|  1.61k|            --bits;
  171|  1.61k|            uint32_t jump_offset = pos - begin + jump;
  172|  1.61k|            if (!jumps.empty() && jump_offset >= jumps.back().first) return false; // Intersecting jumps
  ------------------
  |  Branch (172:17): [True: 242, False: 1.37k]
  |  Branch (172:35): [True: 15, False: 227]
  ------------------
  173|  1.59k|            jumps.emplace_back(jump_offset, bits);
  174|  1.59k|            prevopcode = Instruction::JUMP;
  175|  11.2k|        } else if (opcode == Instruction::MATCH) {
  ------------------
  |  Branch (175:20): [True: 9.73k, False: 1.51k]
  ------------------
  176|  9.73k|            uint32_t match = DecodeMatch(pos, endpos);
  177|  9.73k|            if (match == INVALID) return false; // Match bits straddle EOF
  ------------------
  |  Branch (177:17): [True: 20, False: 9.71k]
  ------------------
  178|  9.71k|            int matchlen = std::bit_width(match) - 1;
  179|  9.71k|            if (prevopcode != Instruction::MATCH) had_incomplete_match = false;
  ------------------
  |  Branch (179:17): [True: 2.21k, False: 7.49k]
  ------------------
  180|  9.71k|            if (matchlen < 8 && had_incomplete_match) return false; // Within a sequence of matches only at most one should be incomplete
  ------------------
  |  Branch (180:17): [True: 1.75k, False: 7.96k]
  |  Branch (180:33): [True: 8, False: 1.74k]
  ------------------
  181|  9.70k|            had_incomplete_match = (matchlen < 8);
  182|  9.70k|            if (bits < matchlen) return false; // Consuming bits past the end of the input
  ------------------
  |  Branch (182:17): [True: 1, False: 9.70k]
  ------------------
  183|  9.70k|            bits -= matchlen;
  184|  9.70k|            prevopcode = Instruction::MATCH;
  185|  9.70k|        } else if (opcode == Instruction::DEFAULT) {
  ------------------
  |  Branch (185:20): [True: 1.50k, False: 14]
  ------------------
  186|  1.50k|            if (prevopcode == Instruction::DEFAULT) return false; // There should not be two successive DEFAULTs (they could be combined into one)
  ------------------
  |  Branch (186:17): [True: 10, False: 1.49k]
  ------------------
  187|  1.49k|            uint32_t asn = DecodeASN(pos, endpos);
  188|  1.49k|            if (asn == INVALID) return false; // ASN straddles EOF
  ------------------
  |  Branch (188:17): [True: 49, False: 1.44k]
  ------------------
  189|  1.44k|            prevopcode = Instruction::DEFAULT;
  190|  1.44k|        } else {
  191|     14|            return false; // Instruction straddles EOF
  192|     14|        }
  193|  15.0k|    }
  194|     29|    return false; // Reached EOF without RETURN instruction
  195|    880|}
asmap.cpp:_ZN12_GLOBAL__N_110DecodeTypeERNSt3__114__bit_iteratorINS0_6vectorIbNS0_9allocatorIbEEEELb1ELm0EEERKS6_:
   62|  21.4k|{
   63|  21.4k|    return Instruction(DecodeBits(bitpos, endpos, 0, TYPE_BIT_SIZES));
   64|  21.4k|}
asmap.cpp:_ZN12_GLOBAL__N_110DecodeBitsERNSt3__114__bit_iteratorINS0_6vectorIbNS0_9allocatorIbEEEELb1ELm0EEERKS6_hRKNS2_IhNS3_IhEEEE:
   25|  42.7k|{
   26|  42.7k|    uint32_t val = minval;
   27|  42.7k|    bool bit;
   28|  42.7k|    for (std::vector<uint8_t>::const_iterator bit_sizes_it = bit_sizes.begin();
   29|   173k|        bit_sizes_it != bit_sizes.end(); ++bit_sizes_it) {
  ------------------
  |  Branch (29:9): [True: 173k, False: 0]
  ------------------
   30|   173k|        if (bit_sizes_it + 1 != bit_sizes.end()) {
  ------------------
  |  Branch (30:13): [True: 145k, False: 28.9k]
  ------------------
   31|   145k|            if (bitpos == endpos) break;
  ------------------
  |  Branch (31:17): [True: 45, False: 144k]
  ------------------
   32|   144k|            bit = *bitpos;
   33|   144k|            bitpos++;
   34|   144k|        } else {
   35|  28.9k|            bit = 0;
   36|  28.9k|        }
   37|   173k|        if (bit) {
  ------------------
  |  Branch (37:13): [True: 131k, False: 42.7k]
  ------------------
   38|   131k|            val += (1 << *bit_sizes_it);
   39|   131k|        } else {
   40|   249k|            for (int b = 0; b < *bit_sizes_it; b++) {
  ------------------
  |  Branch (40:29): [True: 206k, False: 42.6k]
  ------------------
   41|   206k|                if (bitpos == endpos) return INVALID; // Reached EOF in mantissa
  ------------------
  |  Branch (41:21): [True: 113, False: 206k]
  ------------------
   42|   206k|                bit = *bitpos;
   43|   206k|                bitpos++;
   44|   206k|                val += bit << (*bit_sizes_it - 1 - b);
   45|   206k|            }
   46|  42.6k|            return val;
   47|  42.7k|        }
   48|   173k|    }
   49|     45|    return INVALID; // Reached EOF in exponent
   50|  42.7k|}
asmap.cpp:_ZN12_GLOBAL__N_19DecodeASNERNSt3__114__bit_iteratorINS0_6vectorIbNS0_9allocatorIbEEEELb1ELm0EEERKS6_:
   68|  4.70k|{
   69|  4.70k|    return DecodeBits(bitpos, endpos, 1, ASN_BIT_SIZES);
   70|  4.70k|}
asmap.cpp:_ZN12_GLOBAL__N_110DecodeJumpERNSt3__114__bit_iteratorINS0_6vectorIbNS0_9allocatorIbEEEELb1ELm0EEERKS6_:
   82|  2.20k|{
   83|  2.20k|    return DecodeBits(bitpos, endpos, 17, JUMP_BIT_SIZES);
   84|  2.20k|}
asmap.cpp:_ZN12_GLOBAL__N_111DecodeMatchERNSt3__114__bit_iteratorINS0_6vectorIbNS0_9allocatorIbEEEELb1ELm0EEERKS6_:
   75|  14.4k|{
   76|  14.4k|    return DecodeBits(bitpos, endpos, 2, MATCH_BIT_SIZES);
   77|  14.4k|}

_Z22inline_assertion_checkILb1EbEOT0_S1_PKciS3_S3_:
   52|    898|{
   53|    898|    if (IS_ASSERT || std::is_constant_evaluated() || G_FUZZING
  ------------------
  |  Branch (53:9): [Folded - Ignored]
  |  Branch (53:22): [Folded - Ignored]
  |  Branch (53:54): [Folded - Ignored]
  ------------------
   54|       |#ifdef ABORT_ON_FAILED_ASSUME
   55|       |        || true
   56|       |#endif
   57|    898|    ) {
   58|    898|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 898]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|    898|    }
   62|    898|    return std::forward<T>(val);
   63|    898|}
_Z22inline_assertion_checkILb1ERPKNSt3__18functionIFvNS0_4spanIKhLm18446744073709551615EEEEEEEOT0_SB_PKciSD_SD_:
   52|    898|{
   53|    898|    if (IS_ASSERT || std::is_constant_evaluated() || G_FUZZING
  ------------------
  |  Branch (53:9): [Folded - Ignored]
  |  Branch (53:22): [Folded - Ignored]
  |  Branch (53:54): [Folded - Ignored]
  ------------------
   54|       |#ifdef ABORT_ON_FAILED_ASSUME
   55|       |        || true
   56|       |#endif
   57|    898|    ) {
   58|    898|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 898]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|    898|    }
   62|    898|    return std::forward<T>(val);
   63|    898|}

_ZN4util9HasPrefixI9prevectorILj16EhjiELm12EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|    701|{
  248|    701|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 701, False: 0]
  ------------------
  249|    701|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 6, False: 695]
  ------------------
  250|    701|}
_ZN4util9HasPrefixI4SpanIKhELm12EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|    190|{
  248|    190|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 190, False: 0]
  ------------------
  249|    190|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 1, False: 189]
  ------------------
  250|    190|}
_ZN4util9HasPrefixI4SpanIKhELm6EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|    377|{
  248|    377|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 377, False: 0]
  ------------------
  249|    377|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 2, False: 375]
  ------------------
  250|    377|}
_ZN4util9HasPrefixI9prevectorILj16EhjiELm2EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|  1.34k|{
  248|  1.34k|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 1.34k, False: 0]
  ------------------
  249|  1.34k|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 4, False: 1.33k]
  ------------------
  250|  1.34k|}
_ZN4util9HasPrefixI9prevectorILj16EhjiELm3EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|  4.02k|{
  248|  4.02k|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 4.02k, False: 0]
  ------------------
  249|  4.02k|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 35, False: 3.99k]
  ------------------
  250|  4.02k|}
_ZN4util9HasPrefixI9prevectorILj16EhjiELm4EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|    878|{
  248|    878|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 878, False: 0]
  ------------------
  249|    878|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 4, False: 874]
  ------------------
  250|    878|}
_ZN4util9HasPrefixI9prevectorILj16EhjiELm8EEEbRKT_RKNSt3__15arrayIhXT0_EEE:
  247|    534|{
  248|    534|    return obj.size() >= PREFIX_LEN &&
  ------------------
  |  Branch (248:12): [True: 534, False: 0]
  ------------------
  249|    534|           std::equal(std::begin(prefix), std::end(prefix), std::begin(obj));
  ------------------
  |  Branch (249:12): [True: 1, False: 533]
  ------------------
  250|    534|}

_Z11SetMockTimeNSt3__16chrono8durationIxNS_5ratioILl1ELl1EEEEE:
   42|    898|{
   43|    898|    Assert(mock_time_in >= 0s);
  ------------------
  |  |   85|    898|#define Assert(val) inline_assertion_check<true>(val, __FILE__, __LINE__, __func__, #val)
  ------------------
   44|    898|    g_mock_time.store(mock_time_in, std::memory_order_relaxed);
   45|    898|}

