_Z16htole32_internalj:
   39|  11.8M|{
   40|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_32(host_32bits);
   41|  11.8M|        else return host_32bits;
   42|  11.8M|}
_Z16le32toh_internalj:
   49|  21.8M|{
   50|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_32(little_endian_32bits);
   51|  21.8M|        else return little_endian_32bits;
   52|  21.8M|}
_Z16htole64_internalm:
   59|  1.94M|{
   60|       |    if constexpr (std::endian::native == std::endian::big) return internal_bswap_64(host_64bits);
   61|  1.94M|        else return host_64bits;
   62|  1.94M|}

_ZN15ChaCha20Aligned6SetKeyE4SpanIKSt4byteE:
   26|  10.3k|{
   27|  10.3k|    assert(key.size() == KEYLEN);
   28|  10.3k|    input[0] = ReadLE32(key.data() + 0);
   29|  10.3k|    input[1] = ReadLE32(key.data() + 4);
   30|  10.3k|    input[2] = ReadLE32(key.data() + 8);
   31|  10.3k|    input[3] = ReadLE32(key.data() + 12);
   32|  10.3k|    input[4] = ReadLE32(key.data() + 16);
   33|  10.3k|    input[5] = ReadLE32(key.data() + 20);
   34|  10.3k|    input[6] = ReadLE32(key.data() + 24);
   35|  10.3k|    input[7] = ReadLE32(key.data() + 28);
   36|  10.3k|    input[8] = 0;
   37|  10.3k|    input[9] = 0;
   38|  10.3k|    input[10] = 0;
   39|  10.3k|    input[11] = 0;
   40|  10.3k|}
_ZN15ChaCha20AlignedD2Ev:
   43|  10.3k|{
   44|  10.3k|    memory_cleanse(input, sizeof(input));
   45|  10.3k|}
_ZN15ChaCha20AlignedC2E4SpanIKSt4byteE:
   48|  10.3k|{
   49|  10.3k|    SetKey(key);
   50|  10.3k|}
_ZN15ChaCha20Aligned4SeekENSt3__14pairIjmEEj:
   53|  49.4k|{
   54|  49.4k|    input[8] = block_counter;
   55|  49.4k|    input[9] = nonce.first;
   56|  49.4k|    input[10] = nonce.second;
   57|  49.4k|    input[11] = nonce.second >> 32;
   58|  49.4k|}
_ZN8ChaCha209KeystreamE4SpanISt4byteE:
  283|  39.5k|{
  284|  39.5k|    if (out.empty()) return;
  ------------------
  |  Branch (284:9): [True: 2.07k, False: 37.4k]
  ------------------
  285|  37.4k|    if (m_bufleft) {
  ------------------
  |  Branch (285:9): [True: 0, False: 37.4k]
  ------------------
  286|      0|        unsigned reuse = std::min<size_t>(m_bufleft, out.size());
  287|      0|        std::copy(m_buffer.end() - m_bufleft, m_buffer.end() - m_bufleft + reuse, out.begin());
  288|      0|        m_bufleft -= reuse;
  289|      0|        out = out.subspan(reuse);
  290|      0|    }
  291|  37.4k|    if (out.size() >= m_aligned.BLOCKLEN) {
  ------------------
  |  Branch (291:9): [True: 33.5k, False: 3.91k]
  ------------------
  292|  33.5k|        size_t blocks = out.size() / m_aligned.BLOCKLEN;
  293|  33.5k|        m_aligned.Keystream(out.first(blocks * m_aligned.BLOCKLEN));
  294|  33.5k|        out = out.subspan(blocks * m_aligned.BLOCKLEN);
  295|  33.5k|    }
  296|  37.4k|    if (!out.empty()) {
  ------------------
  |  Branch (296:9): [True: 7.78k, False: 29.6k]
  ------------------
  297|  7.78k|        m_aligned.Keystream(m_buffer);
  298|  7.78k|        std::copy(m_buffer.begin(), m_buffer.begin() + out.size(), out.begin());
  299|  7.78k|        m_bufleft = m_aligned.BLOCKLEN - out.size();
  300|  7.78k|    }
  301|  37.4k|}
_ZN8ChaCha205CryptE4SpanIKSt4byteES0_IS1_E:
  304|  39.2k|{
  305|  39.2k|    assert(input.size() == output.size());
  306|       |
  307|  39.2k|    if (!input.size()) return;
  ------------------
  |  Branch (307:9): [True: 12.0k, False: 27.2k]
  ------------------
  308|  27.2k|    if (m_bufleft) {
  ------------------
  |  Branch (308:9): [True: 11.6k, False: 15.5k]
  ------------------
  309|  11.6k|        unsigned reuse = std::min<size_t>(m_bufleft, input.size());
  310|   240k|        for (unsigned i = 0; i < reuse; i++) {
  ------------------
  |  Branch (310:30): [True: 228k, False: 11.6k]
  ------------------
  311|   228k|            output[i] = input[i] ^ m_buffer[m_aligned.BLOCKLEN - m_bufleft + i];
  312|   228k|        }
  313|  11.6k|        m_bufleft -= reuse;
  314|  11.6k|        output = output.subspan(reuse);
  315|  11.6k|        input = input.subspan(reuse);
  316|  11.6k|    }
  317|  27.2k|    if (input.size() >= m_aligned.BLOCKLEN) {
  ------------------
  |  Branch (317:9): [True: 11.2k, False: 15.9k]
  ------------------
  318|  11.2k|        size_t blocks = input.size() / m_aligned.BLOCKLEN;
  319|  11.2k|        m_aligned.Crypt(input.first(blocks * m_aligned.BLOCKLEN), output.first(blocks * m_aligned.BLOCKLEN));
  320|  11.2k|        output = output.subspan(blocks * m_aligned.BLOCKLEN);
  321|  11.2k|        input = input.subspan(blocks * m_aligned.BLOCKLEN);
  322|  11.2k|    }
  323|  27.2k|    if (!input.empty()) {
  ------------------
  |  Branch (323:9): [True: 21.4k, False: 5.72k]
  ------------------
  324|  21.4k|        m_aligned.Keystream(m_buffer);
  325|   617k|        for (unsigned i = 0; i < input.size(); i++) {
  ------------------
  |  Branch (325:30): [True: 595k, False: 21.4k]
  ------------------
  326|   595k|            output[i] = input[i] ^ m_buffer[i];
  327|   595k|        }
  328|  21.4k|        m_bufleft = m_aligned.BLOCKLEN - input.size();
  329|  21.4k|    }
  330|  27.2k|}
_ZN8ChaCha20D2Ev:
  333|  10.3k|{
  334|  10.3k|    memory_cleanse(m_buffer.data(), m_buffer.size());
  335|  10.3k|}
_ZN15ChaCha20Aligned9KeystreamE4SpanISt4byteE:
   61|  62.7k|{
   62|  62.7k|    std::byte* c = output.data();
   63|  62.7k|    size_t blocks = output.size() / BLOCKLEN;
   64|  62.7k|    assert(blocks * BLOCKLEN == output.size());
   65|       |
   66|  62.7k|    uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
   67|  62.7k|    uint32_t j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
   68|       |
   69|  62.7k|    if (!blocks) return;
  ------------------
  |  Branch (69:9): [True: 0, False: 62.7k]
  ------------------
   70|       |
   71|  62.7k|    j4 = input[0];
   72|  62.7k|    j5 = input[1];
   73|  62.7k|    j6 = input[2];
   74|  62.7k|    j7 = input[3];
   75|  62.7k|    j8 = input[4];
   76|  62.7k|    j9 = input[5];
   77|  62.7k|    j10 = input[6];
   78|  62.7k|    j11 = input[7];
   79|  62.7k|    j12 = input[8];
   80|  62.7k|    j13 = input[9];
   81|  62.7k|    j14 = input[10];
   82|  62.7k|    j15 = input[11];
   83|       |
   84|   287k|    for (;;) {
   85|   287k|        x0 = 0x61707865;
   86|   287k|        x1 = 0x3320646e;
   87|   287k|        x2 = 0x79622d32;
   88|   287k|        x3 = 0x6b206574;
   89|   287k|        x4 = j4;
   90|   287k|        x5 = j5;
   91|   287k|        x6 = j6;
   92|   287k|        x7 = j7;
   93|   287k|        x8 = j8;
   94|   287k|        x9 = j9;
   95|   287k|        x10 = j10;
   96|   287k|        x11 = j11;
   97|   287k|        x12 = j12;
   98|   287k|        x13 = j13;
   99|   287k|        x14 = j14;
  100|   287k|        x15 = j15;
  101|       |
  102|       |        // The 20 inner ChaCha20 rounds are unrolled here for performance.
  103|   287k|        REPEAT10(
  ------------------
  |  |   23|   287k|#define REPEAT10(a) do { {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; } while(0)
  |  |  ------------------
  |  |  |  Branch (23:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
  104|   287k|            QUARTERROUND( x0, x4, x8,x12);
  105|   287k|            QUARTERROUND( x1, x5, x9,x13);
  106|   287k|            QUARTERROUND( x2, x6,x10,x14);
  107|   287k|            QUARTERROUND( x3, x7,x11,x15);
  108|   287k|            QUARTERROUND( x0, x5,x10,x15);
  109|   287k|            QUARTERROUND( x1, x6,x11,x12);
  110|   287k|            QUARTERROUND( x2, x7, x8,x13);
  111|   287k|            QUARTERROUND( x3, x4, x9,x14);
  112|   287k|        );
  113|       |
  114|   287k|        x0 += 0x61707865;
  115|   287k|        x1 += 0x3320646e;
  116|   287k|        x2 += 0x79622d32;
  117|   287k|        x3 += 0x6b206574;
  118|   287k|        x4 += j4;
  119|   287k|        x5 += j5;
  120|   287k|        x6 += j6;
  121|   287k|        x7 += j7;
  122|   287k|        x8 += j8;
  123|   287k|        x9 += j9;
  124|   287k|        x10 += j10;
  125|   287k|        x11 += j11;
  126|   287k|        x12 += j12;
  127|   287k|        x13 += j13;
  128|   287k|        x14 += j14;
  129|   287k|        x15 += j15;
  130|       |
  131|   287k|        ++j12;
  132|   287k|        if (!j12) ++j13;
  ------------------
  |  Branch (132:13): [True: 0, False: 287k]
  ------------------
  133|       |
  134|   287k|        WriteLE32(c + 0, x0);
  135|   287k|        WriteLE32(c + 4, x1);
  136|   287k|        WriteLE32(c + 8, x2);
  137|   287k|        WriteLE32(c + 12, x3);
  138|   287k|        WriteLE32(c + 16, x4);
  139|   287k|        WriteLE32(c + 20, x5);
  140|   287k|        WriteLE32(c + 24, x6);
  141|   287k|        WriteLE32(c + 28, x7);
  142|   287k|        WriteLE32(c + 32, x8);
  143|   287k|        WriteLE32(c + 36, x9);
  144|   287k|        WriteLE32(c + 40, x10);
  145|   287k|        WriteLE32(c + 44, x11);
  146|   287k|        WriteLE32(c + 48, x12);
  147|   287k|        WriteLE32(c + 52, x13);
  148|   287k|        WriteLE32(c + 56, x14);
  149|   287k|        WriteLE32(c + 60, x15);
  150|       |
  151|   287k|        if (blocks == 1) {
  ------------------
  |  Branch (151:13): [True: 62.7k, False: 224k]
  ------------------
  152|  62.7k|            input[8] = j12;
  153|  62.7k|            input[9] = j13;
  154|  62.7k|            return;
  155|  62.7k|        }
  156|   224k|        blocks -= 1;
  157|   224k|        c += BLOCKLEN;
  158|   224k|    }
  159|  62.7k|}
_ZN15ChaCha20Aligned5CryptE4SpanIKSt4byteES0_IS1_E:
  162|  11.2k|{
  163|  11.2k|    assert(in_bytes.size() == out_bytes.size());
  164|  11.2k|    const std::byte* m = in_bytes.data();
  165|  11.2k|    std::byte* c = out_bytes.data();
  166|  11.2k|    size_t blocks = out_bytes.size() / BLOCKLEN;
  167|  11.2k|    assert(blocks * BLOCKLEN == out_bytes.size());
  168|       |
  169|  11.2k|    uint32_t x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15;
  170|  11.2k|    uint32_t j4, j5, j6, j7, j8, j9, j10, j11, j12, j13, j14, j15;
  171|       |
  172|  11.2k|    if (!blocks) return;
  ------------------
  |  Branch (172:9): [True: 0, False: 11.2k]
  ------------------
  173|       |
  174|  11.2k|    j4 = input[0];
  175|  11.2k|    j5 = input[1];
  176|  11.2k|    j6 = input[2];
  177|  11.2k|    j7 = input[3];
  178|  11.2k|    j8 = input[4];
  179|  11.2k|    j9 = input[5];
  180|  11.2k|    j10 = input[6];
  181|  11.2k|    j11 = input[7];
  182|  11.2k|    j12 = input[8];
  183|  11.2k|    j13 = input[9];
  184|  11.2k|    j14 = input[10];
  185|  11.2k|    j15 = input[11];
  186|       |
  187|   442k|    for (;;) {
  188|   442k|        x0 = 0x61707865;
  189|   442k|        x1 = 0x3320646e;
  190|   442k|        x2 = 0x79622d32;
  191|   442k|        x3 = 0x6b206574;
  192|   442k|        x4 = j4;
  193|   442k|        x5 = j5;
  194|   442k|        x6 = j6;
  195|   442k|        x7 = j7;
  196|   442k|        x8 = j8;
  197|   442k|        x9 = j9;
  198|   442k|        x10 = j10;
  199|   442k|        x11 = j11;
  200|   442k|        x12 = j12;
  201|   442k|        x13 = j13;
  202|   442k|        x14 = j14;
  203|   442k|        x15 = j15;
  204|       |
  205|       |        // The 20 inner ChaCha20 rounds are unrolled here for performance.
  206|   442k|        REPEAT10(
  ------------------
  |  |   23|   442k|#define REPEAT10(a) do { {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; {a}; } while(0)
  |  |  ------------------
  |  |  |  Branch (23:84): [Folded - Ignored]
  |  |  ------------------
  ------------------
  207|   442k|            QUARTERROUND( x0, x4, x8,x12);
  208|   442k|            QUARTERROUND( x1, x5, x9,x13);
  209|   442k|            QUARTERROUND( x2, x6,x10,x14);
  210|   442k|            QUARTERROUND( x3, x7,x11,x15);
  211|   442k|            QUARTERROUND( x0, x5,x10,x15);
  212|   442k|            QUARTERROUND( x1, x6,x11,x12);
  213|   442k|            QUARTERROUND( x2, x7, x8,x13);
  214|   442k|            QUARTERROUND( x3, x4, x9,x14);
  215|   442k|        );
  216|       |
  217|   442k|        x0 += 0x61707865;
  218|   442k|        x1 += 0x3320646e;
  219|   442k|        x2 += 0x79622d32;
  220|   442k|        x3 += 0x6b206574;
  221|   442k|        x4 += j4;
  222|   442k|        x5 += j5;
  223|   442k|        x6 += j6;
  224|   442k|        x7 += j7;
  225|   442k|        x8 += j8;
  226|   442k|        x9 += j9;
  227|   442k|        x10 += j10;
  228|   442k|        x11 += j11;
  229|   442k|        x12 += j12;
  230|   442k|        x13 += j13;
  231|   442k|        x14 += j14;
  232|   442k|        x15 += j15;
  233|       |
  234|   442k|        x0 ^= ReadLE32(m + 0);
  235|   442k|        x1 ^= ReadLE32(m + 4);
  236|   442k|        x2 ^= ReadLE32(m + 8);
  237|   442k|        x3 ^= ReadLE32(m + 12);
  238|   442k|        x4 ^= ReadLE32(m + 16);
  239|   442k|        x5 ^= ReadLE32(m + 20);
  240|   442k|        x6 ^= ReadLE32(m + 24);
  241|   442k|        x7 ^= ReadLE32(m + 28);
  242|   442k|        x8 ^= ReadLE32(m + 32);
  243|   442k|        x9 ^= ReadLE32(m + 36);
  244|   442k|        x10 ^= ReadLE32(m + 40);
  245|   442k|        x11 ^= ReadLE32(m + 44);
  246|   442k|        x12 ^= ReadLE32(m + 48);
  247|   442k|        x13 ^= ReadLE32(m + 52);
  248|   442k|        x14 ^= ReadLE32(m + 56);
  249|   442k|        x15 ^= ReadLE32(m + 60);
  250|       |
  251|   442k|        ++j12;
  252|   442k|        if (!j12) ++j13;
  ------------------
  |  Branch (252:13): [True: 0, False: 442k]
  ------------------
  253|       |
  254|   442k|        WriteLE32(c + 0, x0);
  255|   442k|        WriteLE32(c + 4, x1);
  256|   442k|        WriteLE32(c + 8, x2);
  257|   442k|        WriteLE32(c + 12, x3);
  258|   442k|        WriteLE32(c + 16, x4);
  259|   442k|        WriteLE32(c + 20, x5);
  260|   442k|        WriteLE32(c + 24, x6);
  261|   442k|        WriteLE32(c + 28, x7);
  262|   442k|        WriteLE32(c + 32, x8);
  263|   442k|        WriteLE32(c + 36, x9);
  264|   442k|        WriteLE32(c + 40, x10);
  265|   442k|        WriteLE32(c + 44, x11);
  266|   442k|        WriteLE32(c + 48, x12);
  267|   442k|        WriteLE32(c + 52, x13);
  268|   442k|        WriteLE32(c + 56, x14);
  269|   442k|        WriteLE32(c + 60, x15);
  270|       |
  271|   442k|        if (blocks == 1) {
  ------------------
  |  Branch (271:13): [True: 11.2k, False: 431k]
  ------------------
  272|  11.2k|            input[8] = j12;
  273|  11.2k|            input[9] = j13;
  274|  11.2k|            return;
  275|  11.2k|        }
  276|   431k|        blocks -= 1;
  277|   431k|        c += BLOCKLEN;
  278|   431k|        m += BLOCKLEN;
  279|   431k|    }
  280|  11.2k|}

_ZN8ChaCha20C2E4SpanIKSt4byteE:
   92|  10.3k|    ChaCha20(Span<const std::byte> key) noexcept : m_aligned(key) {}
_ZN8ChaCha204SeekENSt3__14pairIjmEEj:
  105|  49.4k|    {
  106|  49.4k|        m_aligned.Seek(nonce, block_counter);
  107|  49.4k|        m_bufleft = 0;
  108|  49.4k|    }

_ZN20AEADChaCha20Poly1305C2E4SpanIKSt4byteE:
   16|  10.3k|AEADChaCha20Poly1305::AEADChaCha20Poly1305(Span<const std::byte> key) noexcept : m_chacha20(key)
   17|  10.3k|{
   18|  10.3k|    assert(key.size() == KEYLEN);
   19|  10.3k|}
_ZN20AEADChaCha20Poly13057EncryptE4SpanIKSt4byteES3_S3_NSt3__14pairIjmEES0_IS1_E:
   70|  9.88k|{
   71|  9.88k|    assert(cipher.size() == plain1.size() + plain2.size() + EXPANSION);
   72|       |
   73|       |    // Encrypt using ChaCha20 (starting at block 1).
   74|  9.88k|    m_chacha20.Seek(nonce, 1);
   75|  9.88k|    m_chacha20.Crypt(plain1, cipher.first(plain1.size()));
   76|  9.88k|    m_chacha20.Crypt(plain2, cipher.subspan(plain1.size()).first(plain2.size()));
   77|       |
   78|       |    // Seek to block 0, and compute tag using key drawn from there.
   79|  9.88k|    m_chacha20.Seek(nonce, 0);
   80|  9.88k|    ComputeTag(m_chacha20, aad, cipher.first(cipher.size() - EXPANSION), cipher.last(EXPANSION));
   81|  9.88k|}
_ZN20AEADChaCha20Poly13057DecryptE4SpanIKSt4byteES3_NSt3__14pairIjmEES0_IS1_ES7_:
   84|  19.7k|{
   85|  19.7k|    assert(cipher.size() == plain1.size() + plain2.size() + EXPANSION);
   86|       |
   87|       |    // Verify tag (using key drawn from block 0).
   88|  19.7k|    m_chacha20.Seek(nonce, 0);
   89|  19.7k|    std::byte expected_tag[EXPANSION];
   90|  19.7k|    ComputeTag(m_chacha20, aad, cipher.first(cipher.size() - EXPANSION), expected_tag);
   91|  19.7k|    if (timingsafe_bcmp_internal(UCharCast(expected_tag), UCharCast(cipher.last(EXPANSION).data()), EXPANSION)) return false;
  ------------------
  |  Branch (91:9): [True: 10.0k, False: 9.72k]
  ------------------
   92|       |
   93|       |    // Decrypt (starting at block 1).
   94|  9.72k|    m_chacha20.Crypt(cipher.first(plain1.size()), plain1);
   95|  9.72k|    m_chacha20.Crypt(cipher.subspan(plain1.size()).first(plain2.size()), plain2);
   96|  9.72k|    return true;
   97|  19.7k|}
_ZN20AEADChaCha20Poly13059KeystreamENSt3__14pairIjmEE4SpanISt4byteE:
  100|  9.88k|{
  101|       |    // Skip the first output block, as it's used for generating the poly1305 key.
  102|  9.88k|    m_chacha20.Seek(nonce, 1);
  103|  9.88k|    m_chacha20.Keystream(keystream);
  104|  9.88k|}
chacha20poly1305.cpp:_ZN12_GLOBAL__N_110ComputeTagER8ChaCha204SpanIKSt4byteES5_S2_IS3_E:
   40|  29.6k|{
   41|  29.6k|    static const std::byte PADDING[16] = {{}};
   42|       |
   43|       |    // Get block of keystream (use a full 64 byte buffer to avoid the need for chacha20's own buffering).
   44|  29.6k|    std::byte first_block[ChaCha20Aligned::BLOCKLEN];
   45|  29.6k|    chacha20.Keystream(first_block);
   46|       |
   47|       |    // Use the first 32 bytes of the first keystream block as poly1305 key.
   48|  29.6k|    Poly1305 poly1305{Span{first_block}.first(Poly1305::KEYLEN)};
   49|       |
   50|       |    // Compute tag:
   51|       |    // - Process the padded AAD with Poly1305.
   52|  29.6k|    const unsigned aad_padding_length = (16 - (aad.size() % 16)) % 16;
   53|  29.6k|    poly1305.Update(aad).Update(Span{PADDING}.first(aad_padding_length));
   54|       |    // - Process the padded ciphertext with Poly1305.
   55|  29.6k|    const unsigned cipher_padding_length = (16 - (cipher.size() % 16)) % 16;
   56|  29.6k|    poly1305.Update(cipher).Update(Span{PADDING}.first(cipher_padding_length));
   57|       |    // - Process the AAD and plaintext length with Poly1305.
   58|  29.6k|    std::byte length_desc[Poly1305::TAGLEN];
   59|  29.6k|    WriteLE64(length_desc, aad.size());
   60|  29.6k|    WriteLE64(length_desc + 8, cipher.size());
   61|  29.6k|    poly1305.Update(length_desc);
   62|       |
   63|       |    // Output tag.
   64|  29.6k|    poly1305.Finalize(tag);
   65|  29.6k|}
chacha20poly1305.cpp:_ZN12_GLOBAL__N_124timingsafe_bcmp_internalEPKhS1_m:
   30|  19.7k|{
   31|  19.7k|    const unsigned char *p1 = b1, *p2 = b2;
   32|  19.7k|    int ret = 0;
   33|   335k|    for (; n > 0; n--)
  ------------------
  |  Branch (33:12): [True: 316k, False: 19.7k]
  ------------------
   34|   316k|        ret |= *p1++ ^ *p2++;
   35|  19.7k|    return (ret != 0);
   36|  19.7k|}

_ZN20AEADChaCha20Poly13057EncryptE4SpanIKSt4byteES3_NSt3__14pairIjmEES0_IS1_E:
   42|  3.31k|    {
   43|  3.31k|        Encrypt(plain, {}, aad, nonce, cipher);
   44|  3.31k|    }
_ZN20AEADChaCha20Poly13057DecryptE4SpanIKSt4byteES3_NSt3__14pairIjmEES0_IS1_E:
   57|  13.1k|    {
   58|  13.1k|        return Decrypt(cipher, aad, nonce, plain, {});
   59|  13.1k|    }

_Z9WriteLE32ITk8ByteTypehEvPT_j:
   51|   118k|{
   52|   118k|    uint32_t v = htole32_internal(x);
   53|   118k|    memcpy(ptr, &v, 4);
   54|   118k|}
_Z9WriteLE64ITk8ByteTypeSt4byteEvPT_m:
   58|  1.94M|{
   59|  1.94M|    uint64_t v = htole64_internal(x);
   60|  1.94M|    memcpy(ptr, &v, 8);
   61|  1.94M|}
_Z9WriteLE32ITk8ByteTypeSt4byteEvPT_j:
   51|  11.6M|{
   52|  11.6M|    uint32_t v = htole32_internal(x);
   53|  11.6M|    memcpy(ptr, &v, 4);
   54|  11.6M|}
_Z8ReadLE32ITk8ByteTypehEjPKT_:
   28|  14.6M|{
   29|  14.6M|    uint32_t x;
   30|  14.6M|    memcpy(&x, ptr, 4);
   31|  14.6M|    return le32toh_internal(x);
   32|  14.6M|}
_Z8ReadLE32ITk8ByteTypeSt4byteEjPKT_:
   28|  7.16M|{
   29|  7.16M|    uint32_t x;
   30|  7.16M|    memcpy(&x, ptr, 4);
   31|  7.16M|    return le32toh_internal(x);
   32|  7.16M|}

_ZN14poly1305_donna13poly1305_initEPNS_16poly1305_contextEPKh:
   15|  29.6k|void poly1305_init(poly1305_context *st, const unsigned char key[32]) noexcept {
   16|       |    /* r &= 0xffffffc0ffffffc0ffffffc0fffffff */
   17|  29.6k|    st->r[0] = (ReadLE32(&key[ 0])     ) & 0x3ffffff;
   18|  29.6k|    st->r[1] = (ReadLE32(&key[ 3]) >> 2) & 0x3ffff03;
   19|  29.6k|    st->r[2] = (ReadLE32(&key[ 6]) >> 4) & 0x3ffc0ff;
   20|  29.6k|    st->r[3] = (ReadLE32(&key[ 9]) >> 6) & 0x3f03fff;
   21|  29.6k|    st->r[4] = (ReadLE32(&key[12]) >> 8) & 0x00fffff;
   22|       |
   23|       |    /* h = 0 */
   24|  29.6k|    st->h[0] = 0;
   25|  29.6k|    st->h[1] = 0;
   26|  29.6k|    st->h[2] = 0;
   27|  29.6k|    st->h[3] = 0;
   28|  29.6k|    st->h[4] = 0;
   29|       |
   30|       |    /* save pad for later */
   31|  29.6k|    st->pad[0] = ReadLE32(&key[16]);
   32|  29.6k|    st->pad[1] = ReadLE32(&key[20]);
   33|  29.6k|    st->pad[2] = ReadLE32(&key[24]);
   34|  29.6k|    st->pad[3] = ReadLE32(&key[28]);
   35|       |
   36|  29.6k|    st->leftover = 0;
   37|  29.6k|    st->final = 0;
   38|  29.6k|}
_ZN14poly1305_donna15poly1305_finishEPNS_16poly1305_contextEPh:
  100|  29.6k|void poly1305_finish(poly1305_context *st, unsigned char mac[16]) noexcept {
  101|  29.6k|    uint32_t h0,h1,h2,h3,h4,c;
  102|  29.6k|    uint32_t g0,g1,g2,g3,g4;
  103|  29.6k|    uint64_t f;
  104|  29.6k|    uint32_t mask;
  105|       |
  106|       |    /* process the remaining block */
  107|  29.6k|    if (st->leftover) {
  ------------------
  |  Branch (107:9): [True: 0, False: 29.6k]
  ------------------
  108|      0|        size_t i = st->leftover;
  109|      0|        st->buffer[i++] = 1;
  110|      0|        for (; i < POLY1305_BLOCK_SIZE; i++) {
  ------------------
  |  |   14|      0|#define POLY1305_BLOCK_SIZE 16
  ------------------
  |  Branch (110:16): [True: 0, False: 0]
  ------------------
  111|      0|            st->buffer[i] = 0;
  112|      0|        }
  113|      0|        st->final = 1;
  114|      0|        poly1305_blocks(st, st->buffer, POLY1305_BLOCK_SIZE);
  ------------------
  |  |   14|      0|#define POLY1305_BLOCK_SIZE 16
  ------------------
  115|      0|    }
  116|       |
  117|       |    /* fully carry h */
  118|  29.6k|    h0 = st->h[0];
  119|  29.6k|    h1 = st->h[1];
  120|  29.6k|    h2 = st->h[2];
  121|  29.6k|    h3 = st->h[3];
  122|  29.6k|    h4 = st->h[4];
  123|       |
  124|  29.6k|                 c = h1 >> 26; h1 = h1 & 0x3ffffff;
  125|  29.6k|    h2 +=     c; c = h2 >> 26; h2 = h2 & 0x3ffffff;
  126|  29.6k|    h3 +=     c; c = h3 >> 26; h3 = h3 & 0x3ffffff;
  127|  29.6k|    h4 +=     c; c = h4 >> 26; h4 = h4 & 0x3ffffff;
  128|  29.6k|    h0 += c * 5; c = h0 >> 26; h0 = h0 & 0x3ffffff;
  129|  29.6k|    h1 +=     c;
  130|       |
  131|       |    /* compute h + -p */
  132|  29.6k|    g0 = h0 + 5; c = g0 >> 26; g0 &= 0x3ffffff;
  133|  29.6k|    g1 = h1 + c; c = g1 >> 26; g1 &= 0x3ffffff;
  134|  29.6k|    g2 = h2 + c; c = g2 >> 26; g2 &= 0x3ffffff;
  135|  29.6k|    g3 = h3 + c; c = g3 >> 26; g3 &= 0x3ffffff;
  136|  29.6k|    g4 = h4 + c - (1UL << 26);
  137|       |
  138|       |    /* select h if h < p, or h + -p if h >= p */
  139|  29.6k|    mask = (g4 >> ((sizeof(uint32_t) * 8) - 1)) - 1;
  140|  29.6k|    g0 &= mask;
  141|  29.6k|    g1 &= mask;
  142|  29.6k|    g2 &= mask;
  143|  29.6k|    g3 &= mask;
  144|  29.6k|    g4 &= mask;
  145|  29.6k|    mask = ~mask;
  146|  29.6k|    h0 = (h0 & mask) | g0;
  147|  29.6k|    h1 = (h1 & mask) | g1;
  148|  29.6k|    h2 = (h2 & mask) | g2;
  149|  29.6k|    h3 = (h3 & mask) | g3;
  150|  29.6k|    h4 = (h4 & mask) | g4;
  151|       |
  152|       |    /* h = h % (2^128) */
  153|  29.6k|    h0 = ((h0      ) | (h1 << 26)) & 0xffffffff;
  154|  29.6k|    h1 = ((h1 >>  6) | (h2 << 20)) & 0xffffffff;
  155|  29.6k|    h2 = ((h2 >> 12) | (h3 << 14)) & 0xffffffff;
  156|  29.6k|    h3 = ((h3 >> 18) | (h4 <<  8)) & 0xffffffff;
  157|       |
  158|       |    /* mac = (h + pad) % (2^128) */
  159|  29.6k|    f = (uint64_t)h0 + st->pad[0]            ; h0 = (uint32_t)f;
  160|  29.6k|    f = (uint64_t)h1 + st->pad[1] + (f >> 32); h1 = (uint32_t)f;
  161|  29.6k|    f = (uint64_t)h2 + st->pad[2] + (f >> 32); h2 = (uint32_t)f;
  162|  29.6k|    f = (uint64_t)h3 + st->pad[3] + (f >> 32); h3 = (uint32_t)f;
  163|       |
  164|  29.6k|    WriteLE32(mac +  0, h0);
  165|  29.6k|    WriteLE32(mac +  4, h1);
  166|  29.6k|    WriteLE32(mac +  8, h2);
  167|  29.6k|    WriteLE32(mac + 12, h3);
  168|       |
  169|       |    /* zero out the state */
  170|  29.6k|    st->h[0] = 0;
  171|  29.6k|    st->h[1] = 0;
  172|  29.6k|    st->h[2] = 0;
  173|  29.6k|    st->h[3] = 0;
  174|  29.6k|    st->h[4] = 0;
  175|  29.6k|    st->r[0] = 0;
  176|  29.6k|    st->r[1] = 0;
  177|  29.6k|    st->r[2] = 0;
  178|  29.6k|    st->r[3] = 0;
  179|  29.6k|    st->r[4] = 0;
  180|  29.6k|    st->pad[0] = 0;
  181|  29.6k|    st->pad[1] = 0;
  182|  29.6k|    st->pad[2] = 0;
  183|  29.6k|    st->pad[3] = 0;
  184|  29.6k|}
_ZN14poly1305_donna15poly1305_updateEPNS_16poly1305_contextEPKhm:
  186|   148k|void poly1305_update(poly1305_context *st, const unsigned char *m, size_t bytes) noexcept {
  187|   148k|    size_t i;
  188|       |
  189|       |    /* handle leftover */
  190|   148k|    if (st->leftover) {
  ------------------
  |  Branch (190:9): [True: 35.6k, False: 112k]
  ------------------
  191|  35.6k|        size_t want = (POLY1305_BLOCK_SIZE - st->leftover);
  ------------------
  |  |   14|  35.6k|#define POLY1305_BLOCK_SIZE 16
  ------------------
  192|  35.6k|        if (want > bytes) {
  ------------------
  |  Branch (192:13): [True: 0, False: 35.6k]
  ------------------
  193|      0|            want = bytes;
  194|      0|        }
  195|   496k|        for (i = 0; i < want; i++) {
  ------------------
  |  Branch (195:21): [True: 461k, False: 35.6k]
  ------------------
  196|   461k|            st->buffer[st->leftover + i] = m[i];
  197|   461k|        }
  198|  35.6k|        bytes -= want;
  199|  35.6k|        m += want;
  200|  35.6k|        st->leftover += want;
  201|  35.6k|        if (st->leftover < POLY1305_BLOCK_SIZE) return;
  ------------------
  |  |   14|  35.6k|#define POLY1305_BLOCK_SIZE 16
  ------------------
  |  Branch (201:13): [True: 0, False: 35.6k]
  ------------------
  202|  35.6k|        poly1305_blocks(st, st->buffer, POLY1305_BLOCK_SIZE);
  ------------------
  |  |   14|  35.6k|#define POLY1305_BLOCK_SIZE 16
  ------------------
  203|  35.6k|        st->leftover = 0;
  204|  35.6k|    }
  205|       |
  206|       |    /* process full blocks */
  207|   148k|    if (bytes >= POLY1305_BLOCK_SIZE) {
  ------------------
  |  |   14|   148k|#define POLY1305_BLOCK_SIZE 16
  ------------------
  |  Branch (207:9): [True: 59.6k, False: 88.5k]
  ------------------
  208|  59.6k|        size_t want = (bytes & ~(POLY1305_BLOCK_SIZE - 1));
  ------------------
  |  |   14|  59.6k|#define POLY1305_BLOCK_SIZE 16
  ------------------
  209|  59.6k|        poly1305_blocks(st, m, want);
  210|  59.6k|        m += want;
  211|  59.6k|        bytes -= want;
  212|  59.6k|    }
  213|       |
  214|       |    /* store leftover */
  215|   148k|    if (bytes) {
  ------------------
  |  Branch (215:9): [True: 35.6k, False: 112k]
  ------------------
  216|   145k|        for (i = 0; i < bytes; i++) {
  ------------------
  |  Branch (216:21): [True: 109k, False: 35.6k]
  ------------------
  217|   109k|            st->buffer[st->leftover + i] = m[i];
  218|   109k|        }
  219|  35.6k|        st->leftover += bytes;
  220|  35.6k|    }
  221|   148k|}
poly1305.cpp:_ZN14poly1305_donnaL15poly1305_blocksEPNS_16poly1305_contextEPKhm:
   40|  95.3k|static void poly1305_blocks(poly1305_context *st, const unsigned char *m, size_t bytes) noexcept {
   41|  95.3k|    const uint32_t hibit = (st->final) ? 0 : (1UL << 24); /* 1 << 128 */
  ------------------
  |  Branch (41:28): [True: 0, False: 95.3k]
  ------------------
   42|  95.3k|    uint32_t r0,r1,r2,r3,r4;
   43|  95.3k|    uint32_t s1,s2,s3,s4;
   44|  95.3k|    uint32_t h0,h1,h2,h3,h4;
   45|  95.3k|    uint64_t d0,d1,d2,d3,d4;
   46|  95.3k|    uint32_t c;
   47|       |
   48|  95.3k|    r0 = st->r[0];
   49|  95.3k|    r1 = st->r[1];
   50|  95.3k|    r2 = st->r[2];
   51|  95.3k|    r3 = st->r[3];
   52|  95.3k|    r4 = st->r[4];
   53|       |
   54|  95.3k|    s1 = r1 * 5;
   55|  95.3k|    s2 = r2 * 5;
   56|  95.3k|    s3 = r3 * 5;
   57|  95.3k|    s4 = r4 * 5;
   58|       |
   59|  95.3k|    h0 = st->h[0];
   60|  95.3k|    h1 = st->h[1];
   61|  95.3k|    h2 = st->h[2];
   62|  95.3k|    h3 = st->h[3];
   63|  95.3k|    h4 = st->h[4];
   64|       |
   65|  2.98M|    while (bytes >= POLY1305_BLOCK_SIZE) {
  ------------------
  |  |   14|  2.98M|#define POLY1305_BLOCK_SIZE 16
  ------------------
  |  Branch (65:12): [True: 2.88M, False: 95.3k]
  ------------------
   66|       |        /* h += m[i] */
   67|  2.88M|        h0 += (ReadLE32(m+ 0)     ) & 0x3ffffff;
   68|  2.88M|        h1 += (ReadLE32(m+ 3) >> 2) & 0x3ffffff;
   69|  2.88M|        h2 += (ReadLE32(m+ 6) >> 4) & 0x3ffffff;
   70|  2.88M|        h3 += (ReadLE32(m+ 9) >> 6) & 0x3ffffff;
   71|  2.88M|        h4 += (ReadLE32(m+12) >> 8) | hibit;
   72|       |
   73|       |        /* h *= r */
   74|  2.88M|        d0 = ((uint64_t)h0 * r0) + ((uint64_t)h1 * s4) + ((uint64_t)h2 * s3) + ((uint64_t)h3 * s2) + ((uint64_t)h4 * s1);
   75|  2.88M|        d1 = ((uint64_t)h0 * r1) + ((uint64_t)h1 * r0) + ((uint64_t)h2 * s4) + ((uint64_t)h3 * s3) + ((uint64_t)h4 * s2);
   76|  2.88M|        d2 = ((uint64_t)h0 * r2) + ((uint64_t)h1 * r1) + ((uint64_t)h2 * r0) + ((uint64_t)h3 * s4) + ((uint64_t)h4 * s3);
   77|  2.88M|        d3 = ((uint64_t)h0 * r3) + ((uint64_t)h1 * r2) + ((uint64_t)h2 * r1) + ((uint64_t)h3 * r0) + ((uint64_t)h4 * s4);
   78|  2.88M|        d4 = ((uint64_t)h0 * r4) + ((uint64_t)h1 * r3) + ((uint64_t)h2 * r2) + ((uint64_t)h3 * r1) + ((uint64_t)h4 * r0);
   79|       |
   80|       |        /* (partial) h %= p */
   81|  2.88M|                      c = (uint32_t)(d0 >> 26); h0 = (uint32_t)d0 & 0x3ffffff;
   82|  2.88M|        d1 += c;      c = (uint32_t)(d1 >> 26); h1 = (uint32_t)d1 & 0x3ffffff;
   83|  2.88M|        d2 += c;      c = (uint32_t)(d2 >> 26); h2 = (uint32_t)d2 & 0x3ffffff;
   84|  2.88M|        d3 += c;      c = (uint32_t)(d3 >> 26); h3 = (uint32_t)d3 & 0x3ffffff;
   85|  2.88M|        d4 += c;      c = (uint32_t)(d4 >> 26); h4 = (uint32_t)d4 & 0x3ffffff;
   86|  2.88M|        h0 += c * 5;  c =           (h0 >> 26); h0 =           h0 & 0x3ffffff;
   87|  2.88M|        h1 += c;
   88|       |
   89|  2.88M|        m += POLY1305_BLOCK_SIZE;
  ------------------
  |  |   14|  2.88M|#define POLY1305_BLOCK_SIZE 16
  ------------------
   90|  2.88M|        bytes -= POLY1305_BLOCK_SIZE;
  ------------------
  |  |   14|  2.88M|#define POLY1305_BLOCK_SIZE 16
  ------------------
   91|  2.88M|    }
   92|       |
   93|  95.3k|    st->h[0] = h0;
   94|  95.3k|    st->h[1] = h1;
   95|  95.3k|    st->h[2] = h2;
   96|  95.3k|    st->h[3] = h3;
   97|  95.3k|    st->h[4] = h4;
   98|  95.3k|}

_ZN8Poly1305C2E4SpanIKSt4byteE:
   50|  29.6k|    {
   51|  29.6k|        assert(key.size() == KEYLEN);
   52|  29.6k|        poly1305_donna::poly1305_init(&m_ctx, UCharCast(key.data()));
   53|  29.6k|    }
_ZN8Poly13056UpdateE4SpanIKSt4byteE:
   57|   148k|    {
   58|   148k|        poly1305_donna::poly1305_update(&m_ctx, UCharCast(msg.data()), msg.size());
   59|   148k|        return *this;
   60|   148k|    }
_ZN8Poly13058FinalizeE4SpanISt4byteE:
   64|  29.6k|    {
   65|  29.6k|        assert(out.size() == TAGLEN);
   66|  29.6k|        poly1305_donna::poly1305_finish(&m_ctx, UCharCast(out.data()));
   67|  29.6k|    }

_ZN21InsecureRandomContext10SplitMix64ERm:
  421|    986|    {
  422|    986|        uint64_t z = (seedval += 0x9e3779b97f4a7c15);
  423|    986|        z = (z ^ (z >> 30)) * 0xbf58476d1ce4e5b9;
  424|    986|        z = (z ^ (z >> 27)) * 0x94d049bb133111eb;
  425|    986|        return z ^ (z >> 31);
  426|    986|    }
_ZN21InsecureRandomContextC2Em:
  430|    493|        : m_s0(SplitMix64(seedval)), m_s1(SplitMix64(seedval)) {}
_ZN21InsecureRandomContext6rand64Ev:
  440|  1.90M|    {
  441|  1.90M|        uint64_t s0 = m_s0, s1 = m_s1;
  442|  1.90M|        const uint64_t result = std::rotl(s0 + s1, 17) + s0;
  443|  1.90M|        s1 ^= s0;
  444|  1.90M|        m_s0 = std::rotl(s0, 49) ^ s1 ^ (s1 << 21);
  445|  1.90M|        m_s1 = std::rotl(s1, 28);
  446|  1.90M|        return result;
  447|  1.90M|    }
_ZN11RandomMixinI21InsecureRandomContextEC2Ev:
  195|    493|    constexpr RandomMixin() noexcept = default;
_ZN11RandomMixinI21InsecureRandomContextE9randbytesITk9BasicByteSt4byteEENSt3__16vectorIT_NS4_9allocatorIS6_EEEEm:
  298|  19.7k|    {
  299|  19.7k|        std::vector<B> ret(len);
  300|  19.7k|        Impl().fillrand(MakeWritableByteSpan(ret));
  301|  19.7k|        return ret;
  302|  19.7k|    }
_ZN11RandomMixinI21InsecureRandomContextE4ImplEv:
  185|  1.94M|    RandomNumberGenerator auto& Impl() noexcept { return static_cast<T&>(*this); }
_ZN11RandomMixinI21InsecureRandomContextE8fillrandE4SpanISt4byteE:
  268|  19.7k|    {
  269|  1.90M|        while (span.size() >= 8) {
  ------------------
  |  Branch (269:16): [True: 1.88M, False: 19.7k]
  ------------------
  270|  1.88M|            uint64_t gen = Impl().rand64();
  271|  1.88M|            WriteLE64(span.data(), gen);
  272|  1.88M|            span = span.subspan(8);
  273|  1.88M|        }
  274|  19.7k|        if (span.size() >= 4) {
  ------------------
  |  Branch (274:13): [True: 1.54k, False: 18.2k]
  ------------------
  275|  1.54k|            uint32_t gen = Impl().rand32();
  276|  1.54k|            WriteLE32(span.data(), gen);
  277|  1.54k|            span = span.subspan(4);
  278|  1.54k|        }
  279|  36.7k|        while (span.size()) {
  ------------------
  |  Branch (279:16): [True: 16.9k, False: 19.7k]
  ------------------
  280|  16.9k|            span[0] = std::byte(Impl().template randbits<8>());
  281|  16.9k|            span = span.subspan(1);
  282|  16.9k|        }
  283|  19.7k|    }
_ZN11RandomMixinI21InsecureRandomContextE6rand32Ev:
  305|  1.54k|    uint32_t rand32() noexcept { return Impl().template randbits<32>(); }
_ZN11RandomMixinI21InsecureRandomContextE8randbitsILi32EEEmv:
  231|  1.54k|    {
  232|  1.54k|        static_assert(Bits >= 0 && Bits <= 64);
  233|       |        if constexpr (Bits == 64) {
  234|       |            return Impl().rand64();
  235|  1.54k|        } else {
  236|  1.54k|            uint64_t ret;
  237|  1.54k|            if (Bits <= bitbuf_size) {
  ------------------
  |  Branch (237:17): [True: 840, False: 708]
  ------------------
  238|    840|                ret = bitbuf;
  239|    840|                bitbuf >>= Bits;
  240|    840|                bitbuf_size -= Bits;
  241|    840|            } else {
  242|    708|                uint64_t gen = Impl().rand64();
  243|    708|                ret = (gen << bitbuf_size) | bitbuf;
  244|    708|                bitbuf = gen >> (Bits - bitbuf_size);
  245|    708|                bitbuf_size = 64 + bitbuf_size - Bits;
  246|    708|            }
  247|  1.54k|            constexpr uint64_t MASK = (uint64_t{1} << Bits) - 1;
  248|  1.54k|            return ret & MASK;
  249|  1.54k|        }
  250|  1.54k|    }
_ZN11RandomMixinI21InsecureRandomContextE8randbitsILi8EEEmv:
  231|  16.9k|    {
  232|  16.9k|        static_assert(Bits >= 0 && Bits <= 64);
  233|       |        if constexpr (Bits == 64) {
  234|       |            return Impl().rand64();
  235|  16.9k|        } else {
  236|  16.9k|            uint64_t ret;
  237|  16.9k|            if (Bits <= bitbuf_size) {
  ------------------
  |  Branch (237:17): [True: 14.6k, False: 2.33k]
  ------------------
  238|  14.6k|                ret = bitbuf;
  239|  14.6k|                bitbuf >>= Bits;
  240|  14.6k|                bitbuf_size -= Bits;
  241|  14.6k|            } else {
  242|  2.33k|                uint64_t gen = Impl().rand64();
  243|  2.33k|                ret = (gen << bitbuf_size) | bitbuf;
  244|  2.33k|                bitbuf = gen >> (Bits - bitbuf_size);
  245|  2.33k|                bitbuf_size = 64 + bitbuf_size - Bits;
  246|  2.33k|            }
  247|  16.9k|            constexpr uint64_t MASK = (uint64_t{1} << Bits) - 1;
  248|  16.9k|            return ret & MASK;
  249|  16.9k|        }
  250|  16.9k|    }
_ZN11RandomMixinI21InsecureRandomContextEclEv:
  367|  19.7k|    inline uint64_t operator()() noexcept { return Impl().rand64(); }

_Z9UCharCastPSt4byte:
  283|  49.4k|inline unsigned char* UCharCast(std::byte* c) { return reinterpret_cast<unsigned char*>(c); }
_Z9UCharCastPKSt4byte:
  287|   197k|inline const unsigned char* UCharCast(const std::byte* c) { return reinterpret_cast<const unsigned char*>(c); }
_ZNK4SpanIKSt4byteE4lastEm:
  211|  19.7k|    {
  212|  19.7k|         ASSERT_IF_DEBUG(size() >= count);
  213|  19.7k|         return Span<C>(m_data + m_size - count, count);
  214|  19.7k|    }
_ZNK4SpanIKSt4byteE5firstEm:
  206|   109k|    {
  207|   109k|        ASSERT_IF_DEBUG(size() >= count);
  208|   109k|        return Span<C>(m_data, count);
  209|   109k|    }
_ZNK4SpanISt4byteE4lastEm:
  211|  9.88k|    {
  212|  9.88k|         ASSERT_IF_DEBUG(size() >= count);
  213|  9.88k|         return Span<C>(m_data + m_size - count, count);
  214|  9.88k|    }
_ZNK4SpanISt4byteE5firstEm:
  206|   117k|    {
  207|   117k|        ASSERT_IF_DEBUG(size() >= count);
  208|   117k|        return Span<C>(m_data, count);
  209|   117k|    }
_ZNK4SpanIKSt4byteE4sizeEv:
  187|  1.21M|    constexpr std::size_t size() const noexcept { return m_size; }
_ZNK4SpanIKSt4byteE4dataEv:
  174|   291k|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanISt4byteE4sizeEv:
  187|  2.43M|    constexpr std::size_t size() const noexcept { return m_size; }
_ZNK4SpanISt4byteEixEm:
  191|   841k|    {
  192|   841k|        ASSERT_IF_DEBUG(size() > pos);
  193|   841k|        return m_data[pos];
  194|   841k|    }
_ZNK4SpanIKSt4byteEixEm:
  191|   824k|    {
  192|   824k|        ASSERT_IF_DEBUG(size() > pos);
  193|   824k|        return m_data[pos];
  194|   824k|    }
_ZNK4SpanISt4byteE4dataEv:
  174|  2.00M|    constexpr C* data() const noexcept { return m_data; }
_ZNK4SpanISt4byteE7subspanEm:
  196|  1.97M|    {
  197|  1.97M|        ASSERT_IF_DEBUG(size() >= offset);
  198|  1.97M|        return Span<C>(m_data + offset, m_size - offset);
  199|  1.97M|    }
_ZNK4SpanISt4byteE10size_bytesEv:
  188|  19.7k|    constexpr std::size_t size_bytes() const noexcept { return sizeof(C) * m_size; }
_Z15AsWritableBytesISt4byteE4SpanIS0_ES1_IT_E:
  264|  19.7k|{
  265|  19.7k|    return {reinterpret_cast<std::byte*>(s.data()), s.size_bytes()};
  266|  19.7k|}
_ZN4SpanIKSt4byteEC2IS1_TnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_S1_EE5valueEiE4typeELi0EEEPS6_m:
  119|   162k|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_ZN4SpanISt4byteEC2IS0_TnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_S0_EE5valueEiE4typeELi0EEEPS5_m:
  119|  2.12M|    constexpr Span(T* begin, std::size_t size) noexcept : m_data(begin), m_size(size) {}
_ZN4SpanIKSt4byteEC2INSt3__16vectorIS0_NS4_9allocatorIS0_EEEEEERT_NS4_9enable_ifIXaaaantsr7is_SpanIS9_EE5valuesr3std14is_convertibleIPA_NS4_14remove_pointerIDTcldtclsr3stdE7declvalISA_EE4dataEEE4typeEPA_S1_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalISA_EE4sizeEEmEE5valueEDnE4typeE:
  165|  63.0k|        : m_data(other.data()), m_size(other.size()){}
_ZN4SpanISt4byteEC2INSt3__16vectorIS0_NS3_9allocatorIS0_EEEEEERT_NS3_9enable_ifIXaaaantsr7is_SpanIS8_EE5valuesr3std14is_convertibleIPA_NS3_14remove_pointerIDTcldtclsr3stdE7declvalIS9_EE4dataEEE4typeEPA_S0_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalIS9_EE4sizeEEmEE5valueEDnE4typeE:
  165|  78.9k|        : m_data(other.data()), m_size(other.size()){}
_ZN4SpanIKSt4byteEC2IS0_TnNSt3__19enable_ifIXsr3std14is_convertibleIPA_T_PA_S1_EE5valueEiE4typeELi0EEERKS_IS6_E:
  141|  52.6k|    constexpr Span(const Span<O>& other) noexcept : m_data(other.m_data), m_size(other.m_size) {}
_Z20MakeWritableByteSpanIRNSt3__16vectorISt4byteNS0_9allocatorIS2_EEEEE4SpanIS2_EOT_:
  275|  19.7k|{
  276|  19.7k|    return AsWritableBytes(Span{std::forward<V>(v)});
  277|  19.7k|}
_ZN4SpanIKSt4byteEC2Ev:
  111|  3.31k|    constexpr Span() noexcept : m_data(nullptr) {}
_ZN4SpanISt4byteEC2Ev:
  111|  13.1k|    constexpr Span() noexcept : m_data(nullptr) {}
_ZN4SpanISt4byteEC2ILi16EEERAT__S0_:
  151|  19.7k|    constexpr Span(C (&a)[N]) noexcept : m_data(a), m_size(N) {}
_ZN4SpanIKSt4byteEC2ILi16EEERAT__S1_:
  151|  88.9k|    constexpr Span(C (&a)[N]) noexcept : m_data(a), m_size(N) {}
_ZNK4SpanISt4byteE5beginEv:
  175|  7.78k|    constexpr C* begin() const noexcept { return m_data; }
_ZNK4SpanIKSt4byteE7subspanEm:
  196|  32.6k|    {
  197|  32.6k|        ASSERT_IF_DEBUG(size() >= offset);
  198|  32.6k|        return Span<C>(m_data + offset, m_size - offset);
  199|  32.6k|    }
_ZNK4SpanISt4byteE5emptyEv:
  189|  76.9k|    constexpr bool empty() const noexcept { return size() == 0; }
_ZN4SpanISt4byteEC2INSt3__15arrayIS0_Lm64EEEEERT_NS3_9enable_ifIXaaaantsr7is_SpanIS6_EE5valuesr3std14is_convertibleIPA_NS3_14remove_pointerIDTcldtclsr3stdE7declvalIS7_EE4dataEEE4typeEPA_S0_EE5valuesr3std14is_convertibleIDTcldtclsr3stdE7declvalIS7_EE4sizeEEmEE5valueEDnE4typeE:
  165|  29.2k|        : m_data(other.data()), m_size(other.size()){}
_ZNK4SpanIKSt4byteE5emptyEv:
  189|  27.2k|    constexpr bool empty() const noexcept { return size() == 0; }
_ZN4SpanISt4byteEC2ILi64EEERAT__S0_:
  151|  59.2k|    constexpr Span(C (&a)[N]) noexcept : m_data(a), m_size(N) {}

_Z14memory_cleansePvm:
   15|  20.7k|{
   16|       |#if defined(WIN32)
   17|       |    /* SecureZeroMemory is guaranteed not to be optimized out. */
   18|       |    SecureZeroMemory(ptr, len);
   19|       |#else
   20|  20.7k|    std::memset(ptr, 0, len);
   21|       |
   22|       |    /* Memory barrier that scares the compiler away from optimizing out the memset.
   23|       |     *
   24|       |     * Quoting Adam Langley <agl@google.com> in commit ad1907fe73334d6c696c8539646c21b11178f20f
   25|       |     * in BoringSSL (ISC License):
   26|       |     *    As best as we can tell, this is sufficient to break any optimisations that
   27|       |     *    might try to eliminate "superfluous" memsets.
   28|       |     * This method is used in memzero_explicit() the Linux kernel, too. Its advantage is that it
   29|       |     * is pretty efficient because the compiler can still implement the memset() efficiently,
   30|       |     * just not remove it entirely. See "Dead Store Elimination (Still) Considered Harmful" by
   31|       |     * Yang et al. (USENIX Security 2017) for more background.
   32|       |     */
   33|  20.7k|    __asm__ __volatile__("" : : "r"(ptr) : "memory");
   34|  20.7k|#endif
   35|  20.7k|}

_ZN18FuzzedDataProviderC2EPKhm:
   37|    493|      : data_ptr_(data), remaining_bytes_(size) {}
_ZN18FuzzedDataProvider15ConsumeIntegralImEET_v:
  195|    493|template <typename T> T FuzzedDataProvider::ConsumeIntegral() {
  196|    493|  return ConsumeIntegralInRange(std::numeric_limits<T>::min(),
  197|    493|                                std::numeric_limits<T>::max());
  198|    493|}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeImEET_S1_S1_:
  205|  13.6k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  13.6k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  13.6k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  13.6k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 13.6k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  13.6k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  13.6k|  uint64_t result = 0;
  215|  13.6k|  size_t offset = 0;
  216|       |
  217|  34.3k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 33.9k, False: 469]
  |  Branch (217:43): [True: 20.9k, False: 12.9k]
  ------------------
  218|  34.3k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 20.7k, False: 185]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  20.7k|    --remaining_bytes_;
  226|  20.7k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  20.7k|    offset += CHAR_BIT;
  228|  20.7k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  13.6k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 13.1k, False: 493]
  ------------------
  232|  13.1k|    result = result % (range + 1);
  233|       |
  234|  13.6k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  13.6k|}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeIjEET_S1_S1_:
  205|  29.7k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  29.7k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  29.7k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  29.7k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 29.7k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  29.7k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  29.7k|  uint64_t result = 0;
  215|  29.7k|  size_t offset = 0;
  216|       |
  217|  55.1k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 55.1k, False: 0]
  |  Branch (217:43): [True: 25.7k, False: 29.3k]
  ------------------
  218|  55.1k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 25.3k, False: 427]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  25.3k|    --remaining_bytes_;
  226|  25.3k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  25.3k|    offset += CHAR_BIT;
  228|  25.3k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  29.7k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 29.7k, False: 0]
  ------------------
  232|  29.7k|    result = result % (range + 1);
  233|       |
  234|  29.7k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  29.7k|}
_ZN18FuzzedDataProvider15ConsumeIntegralIhEET_v:
  195|  20.1k|template <typename T> T FuzzedDataProvider::ConsumeIntegral() {
  196|  20.1k|  return ConsumeIntegralInRange(std::numeric_limits<T>::min(),
  197|  20.1k|                                std::numeric_limits<T>::max());
  198|  20.1k|}
_ZN18FuzzedDataProvider22ConsumeIntegralInRangeIhEET_S1_S1_:
  205|  20.1k|T FuzzedDataProvider::ConsumeIntegralInRange(T min, T max) {
  206|  20.1k|  static_assert(std::is_integral<T>::value, "An integral type is required.");
  207|  20.1k|  static_assert(sizeof(T) <= sizeof(uint64_t), "Unsupported integral type.");
  208|       |
  209|  20.1k|  if (min > max)
  ------------------
  |  Branch (209:7): [True: 0, False: 20.1k]
  ------------------
  210|      0|    abort();
  211|       |
  212|       |  // Use the biggest type possible to hold the range and the result.
  213|  20.1k|  uint64_t range = static_cast<uint64_t>(max) - static_cast<uint64_t>(min);
  214|  20.1k|  uint64_t result = 0;
  215|  20.1k|  size_t offset = 0;
  216|       |
  217|  39.8k|  while (offset < sizeof(T) * CHAR_BIT && (range >> offset) > 0 &&
  ------------------
  |  Branch (217:10): [True: 20.1k, False: 19.7k]
  |  Branch (217:43): [True: 20.1k, False: 0]
  ------------------
  218|  39.8k|         remaining_bytes_ != 0) {
  ------------------
  |  Branch (218:10): [True: 19.7k, False: 312]
  ------------------
  219|       |    // Pull bytes off the end of the seed data. Experimentally, this seems to
  220|       |    // allow the fuzzer to more easily explore the input space. This makes
  221|       |    // sense, since it works by modifying inputs that caused new code to run,
  222|       |    // and this data is often used to encode length of data read by
  223|       |    // |ConsumeBytes|. Separating out read lengths makes it easier modify the
  224|       |    // contents of the data that is actually read.
  225|  19.7k|    --remaining_bytes_;
  226|  19.7k|    result = (result << CHAR_BIT) | data_ptr_[remaining_bytes_];
  227|  19.7k|    offset += CHAR_BIT;
  228|  19.7k|  }
  229|       |
  230|       |  // Avoid division by 0, in case |range + 1| results in overflow.
  231|  20.1k|  if (range != std::numeric_limits<decltype(range)>::max())
  ------------------
  |  Branch (231:7): [True: 20.1k, False: 0]
  ------------------
  232|  20.1k|    result = result % (range + 1);
  233|       |
  234|  20.1k|  return static_cast<T>(static_cast<uint64_t>(min) + result);
  235|  20.1k|}
_ZN18FuzzedDataProvider11ConsumeBoolEv:
  289|  10.2k|inline bool FuzzedDataProvider::ConsumeBool() {
  290|  10.2k|  return 1 & ConsumeIntegral<uint8_t>();
  291|  10.2k|}
_ZN18FuzzedDataProvider14CopyAndAdvanceEPvm:
  339|    493|                                               size_t num_bytes) {
  340|    493|  std::memcpy(destination, data_ptr_, num_bytes);
  341|    493|  Advance(num_bytes);
  342|    493|}
_ZN18FuzzedDataProvider7AdvanceEm:
  344|    493|inline void FuzzedDataProvider::Advance(size_t num_bytes) {
  345|    493|  if (num_bytes > remaining_bytes_)
  ------------------
  |  Branch (345:7): [True: 0, False: 493]
  ------------------
  346|      0|    abort();
  347|       |
  348|    493|  data_ptr_ += num_bytes;
  349|    493|  remaining_bytes_ -= num_bytes;
  350|    493|}
_ZN18FuzzedDataProvider12ConsumeBytesISt4byteEENSt3__16vectorIT_NS2_9allocatorIS4_EEEEm:
  109|    493|std::vector<T> FuzzedDataProvider::ConsumeBytes(size_t num_bytes) {
  110|    493|  num_bytes = std::min(num_bytes, remaining_bytes_);
  111|    493|  return ConsumeBytes<T>(num_bytes, num_bytes);
  112|    493|}
_ZN18FuzzedDataProvider12ConsumeBytesISt4byteEENSt3__16vectorIT_NS2_9allocatorIS4_EEEEmm:
  353|    493|std::vector<T> FuzzedDataProvider::ConsumeBytes(size_t size, size_t num_bytes) {
  354|    493|  static_assert(sizeof(T) == sizeof(uint8_t), "Incompatible data type.");
  355|       |
  356|       |  // The point of using the size-based constructor below is to increase the
  357|       |  // odds of having a vector object with capacity being equal to the length.
  358|       |  // That part is always implementation specific, but at least both libc++ and
  359|       |  // libstdc++ allocate the requested number of bytes in that constructor,
  360|       |  // which seems to be a natural choice for other implementations as well.
  361|       |  // To increase the odds even more, we also call |shrink_to_fit| below.
  362|    493|  std::vector<T> result(size);
  363|    493|  if (size == 0) {
  ------------------
  |  Branch (363:7): [True: 0, False: 493]
  ------------------
  364|      0|    if (num_bytes != 0)
  ------------------
  |  Branch (364:9): [True: 0, False: 0]
  ------------------
  365|      0|      abort();
  366|      0|    return result;
  367|      0|  }
  368|       |
  369|    493|  CopyAndAdvance(result.data(), num_bytes);
  370|       |
  371|       |  // Even though |shrink_to_fit| is also implementation specific, we expect it
  372|       |  // to provide an additional assurance in case vector's constructor allocated
  373|       |  // a buffer which is larger than the actual amount of data we put inside it.
  374|    493|  result.shrink_to_fit();
  375|    493|  return result;
  376|    493|}

_Z39crypto_aeadchacha20poly1305_fuzz_targetNSt3__14spanIKhLm18446744073709551615EEE:
   29|    493|{
   30|    493|    FuzzedDataProvider provider{buffer.data(), buffer.size()};
   31|       |
   32|    493|    auto key = provider.ConsumeBytes<std::byte>(32);
   33|    493|    key.resize(32);
   34|    493|    AEADChaCha20Poly1305 aead(key);
   35|       |
   36|       |    // Initialize RNG deterministically, to generate contents and AAD. We assume that there are no
   37|       |    // (potentially buggy) edge cases triggered by specific values of contents/AAD, so we can avoid
   38|       |    // reading the actual data for those from the fuzzer input (which would need large amounts of
   39|       |    // data).
   40|    493|    InsecureRandomContext rng(provider.ConsumeIntegral<uint64_t>());
   41|       |
   42|    493|    LIMITED_WHILE(provider.ConsumeBool(), 100)
  ------------------
  |  |   23|  10.2k|    for (unsigned _count{limit}; (condition) && _count; --_count)
  |  |  ------------------
  |  |  |  Branch (23:34): [True: 9.92k, False: 298]
  |  |  |  Branch (23:49): [True: 9.88k, False: 44]
  |  |  ------------------
  ------------------
   43|  9.88k|    {
   44|       |        // Mode:
   45|       |        // - Bit 0: whether to use single-plain Encrypt/Decrypt; otherwise use a split at prefix.
   46|       |        // - Bit 2: whether this ciphertext will be corrupted (making it the last sent one)
   47|       |        // - Bit 3-4: controls the maximum aad length (max 511 bytes)
   48|       |        // - Bit 5-7: controls the maximum content length (max 16383 bytes, for performance reasons)
   49|  9.88k|        unsigned mode = provider.ConsumeIntegral<uint8_t>();
   50|  9.88k|        bool use_splits = mode & 1;
   51|  9.88k|        bool damage = mode & 4;
   52|  9.88k|        unsigned aad_length_bits = 3 * ((mode >> 3) & 3);
   53|  9.88k|        unsigned aad_length = provider.ConsumeIntegralInRange<unsigned>(0, (1 << aad_length_bits) - 1);
   54|  9.88k|        unsigned length_bits = 2 * ((mode >> 5) & 7);
   55|  9.88k|        unsigned length = provider.ConsumeIntegralInRange<unsigned>(0, (1 << length_bits) - 1);
   56|       |        // Generate aad and content.
   57|  9.88k|        auto aad = rng.randbytes<std::byte>(aad_length);
   58|  9.88k|        auto plain = rng.randbytes<std::byte>(length);
   59|  9.88k|        std::vector<std::byte> cipher(length + AEADChaCha20Poly1305::EXPANSION);
   60|       |        // Generate nonce
   61|  9.88k|        AEADChaCha20Poly1305::Nonce96 nonce = {(uint32_t)rng(), rng()};
   62|       |
   63|  9.88k|        if (use_splits && length > 0) {
  ------------------
  |  Branch (63:13): [True: 8.39k, False: 1.48k]
  |  Branch (63:27): [True: 6.56k, False: 1.83k]
  ------------------
   64|  6.56k|            size_t split_index = provider.ConsumeIntegralInRange<size_t>(1, length);
   65|  6.56k|            aead.Encrypt(Span{plain}.first(split_index), Span{plain}.subspan(split_index), aad, nonce, cipher);
   66|  6.56k|        } else {
   67|  3.31k|            aead.Encrypt(plain, aad, nonce, cipher);
   68|  3.31k|        }
   69|       |
   70|       |        // Test Keystream output
   71|  9.88k|        std::vector<std::byte> keystream(length);
   72|  9.88k|        aead.Keystream(nonce, keystream);
   73|  14.8M|        for (size_t i = 0; i < length; ++i) {
  ------------------
  |  Branch (73:28): [True: 14.8M, False: 9.88k]
  ------------------
   74|  14.8M|            assert((plain[i] ^ keystream[i]) == cipher[i]);
   75|  14.8M|        }
   76|       |
   77|  9.88k|        std::vector<std::byte> decrypted_contents(length);
   78|  9.88k|        bool ok{false};
   79|       |
   80|       |        // damage the key
   81|  9.88k|        unsigned key_position = provider.ConsumeIntegralInRange<unsigned>(0, 31);
   82|  9.88k|        std::byte damage_val{(uint8_t)(1U << (key_position & 7))};
   83|  9.88k|        std::vector<std::byte> bad_key = key;
   84|  9.88k|        bad_key[key_position] ^= damage_val;
   85|       |
   86|  9.88k|        AEADChaCha20Poly1305 bad_aead(bad_key);
   87|  9.88k|        ok = bad_aead.Decrypt(cipher, aad, nonce, decrypted_contents);
   88|  9.88k|        assert(!ok);
   89|       |
   90|       |        // Optionally damage 1 bit in either the cipher (corresponding to a change in transit)
   91|       |        // or the aad (to make sure that decryption will fail if the AAD mismatches).
   92|  9.88k|        if (damage) {
  ------------------
  |  Branch (92:13): [True: 151, False: 9.72k]
  ------------------
   93|    151|            unsigned damage_bit = provider.ConsumeIntegralInRange<unsigned>(0, (cipher.size() + aad.size()) * 8U - 1U);
   94|    151|            unsigned damage_pos = damage_bit >> 3;
   95|    151|            std::byte damage_val{(uint8_t)(1U << (damage_bit & 7))};
   96|    151|            if (damage_pos >= cipher.size()) {
  ------------------
  |  Branch (96:17): [True: 25, False: 126]
  ------------------
   97|     25|                aad[damage_pos - cipher.size()] ^= damage_val;
   98|    126|            } else {
   99|    126|                cipher[damage_pos] ^= damage_val;
  100|    126|            }
  101|    151|        }
  102|       |
  103|  9.88k|        if (use_splits && length > 0) {
  ------------------
  |  Branch (103:13): [True: 8.39k, False: 1.48k]
  |  Branch (103:27): [True: 6.56k, False: 1.83k]
  ------------------
  104|  6.56k|            size_t split_index = provider.ConsumeIntegralInRange<size_t>(1, length);
  105|  6.56k|            ok = aead.Decrypt(cipher, aad, nonce, Span{decrypted_contents}.first(split_index), Span{decrypted_contents}.subspan(split_index));
  106|  6.56k|        } else {
  107|  3.31k|            ok = aead.Decrypt(cipher, aad, nonce, decrypted_contents);
  108|  3.31k|        }
  109|       |
  110|       |        // Decryption *must* fail if the packet was damaged, and succeed if it wasn't.
  111|  9.88k|        assert(!ok == damage);
  112|  9.88k|        if (!ok) break;
  ------------------
  |  Branch (112:13): [True: 151, False: 9.72k]
  ------------------
  113|  9.72k|        assert(decrypted_contents == plain);
  114|  9.72k|    }
  115|    493|}

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

_ZN12CheckGlobalsC2Ev:
   56|    493|CheckGlobals::CheckGlobals() : m_impl(std::make_unique<CheckGlobalsImpl>()) {}
_ZN12CheckGlobalsD2Ev:
   57|    493|CheckGlobals::~CheckGlobals() = default;
_ZN16CheckGlobalsImplC2Ev:
   17|    493|    {
   18|    493|        g_used_g_prng = false;
   19|    493|        g_seeded_g_prng_zero = false;
   20|    493|        g_used_system_time = false;
   21|    493|        SetMockTime(0s);
   22|    493|    }
_ZN16CheckGlobalsImplD2Ev:
   24|    493|    {
   25|    493|        if (g_used_g_prng && !g_seeded_g_prng_zero) {
  ------------------
  |  Branch (25:13): [True: 0, False: 493]
  |  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|    493|        if (g_used_system_time) {
  ------------------
  |  Branch (41:13): [True: 0, False: 493]
  ------------------
   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|    493|    }

_Z22inline_assertion_checkILb1EbEOT0_S1_PKciS3_S3_:
   52|    493|{
   53|    493|    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|    493|    ) {
   58|    493|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 493]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|    493|    }
   62|    493|    return std::forward<T>(val);
   63|    493|}
_Z22inline_assertion_checkILb1ERPKNSt3__18functionIFvNS0_4spanIKhLm18446744073709551615EEEEEEEOT0_SB_PKciSD_SD_:
   52|    493|{
   53|    493|    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|    493|    ) {
   58|    493|        if (!val) {
  ------------------
  |  Branch (58:13): [True: 0, False: 493]
  ------------------
   59|      0|            assertion_fail(file, line, func, assertion);
   60|      0|        }
   61|    493|    }
   62|    493|    return std::forward<T>(val);
   63|    493|}

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

