LLVMFuzzerTestOneInput:
  219|  2.33k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
  220|  2.33k|  FuzzedDataProvider provider(data, size);
  221|  2.33k|  pw::protobuf::fuzz::TestOneInput(provider);
  222|  2.33k|  return 0;
  223|  2.33k|}
decoder_fuzzer.cc:_ZN2pw8protobuf4fuzz12_GLOBAL__N_112TestOneInputER18FuzzedDataProvider:
  207|  2.33k|void TestOneInput(FuzzedDataProvider& provider) {
  208|  2.33k|  constexpr size_t kMaxFuzzedProtoSize = 4096;
  209|  2.33k|  std::vector<std::byte> proto_message_data = provider.ConsumeBytes<std::byte>(
  210|  2.33k|      provider.ConsumeIntegralInRange<size_t>(0, kMaxFuzzedProtoSize));
  211|  2.33k|  stream::MemoryReader memory_reader(proto_message_data);
  212|  2.33k|  StreamDecoder decoder(memory_reader);
  213|  2.33k|  RecursiveFuzzedDecode(provider, decoder);
  214|  2.33k|}
decoder_fuzzer.cc:_ZN2pw8protobuf4fuzz12_GLOBAL__N_121RecursiveFuzzedDecodeER18FuzzedDataProviderRNS0_13StreamDecoderEj:
   35|  4.27k|                           uint32_t depth = 0) {
   36|  4.27k|  constexpr size_t kMaxRepeatedRead = 256;
   37|  4.27k|  constexpr size_t kMaxDepth = 3;
   38|       |
   39|  4.27k|  if (depth > kMaxDepth) {
  ------------------
  |  Branch (39:7): [True: 426, False: 3.84k]
  ------------------
   40|    426|    return;
   41|    426|  }
   42|  12.8k|  while (provider.remaining_bytes() != 0 && decoder.Next().ok()) {
  ------------------
  |  Branch (42:10): [True: 11.7k, False: 1.15k]
  |  Branch (42:10): [True: 10.3k, False: 2.50k]
  |  Branch (42:45): [True: 10.3k, False: 1.35k]
  ------------------
   43|  10.3k|    FieldType field_type = provider.ConsumeEnum<FieldType>();
   44|  10.3k|    switch (field_type) {
  ------------------
  |  Branch (44:13): [True: 0, False: 10.3k]
  ------------------
   45|    364|      case kUint32:
  ------------------
  |  Branch (45:7): [True: 364, False: 9.99k]
  ------------------
   46|    364|        if (!decoder.ReadUint32().status().ok()) {
  ------------------
  |  Branch (46:13): [True: 102, False: 262]
  ------------------
   47|    102|          return;
   48|    102|        }
   49|    262|        break;
   50|    398|      case kPackedUint32: {
  ------------------
  |  Branch (50:7): [True: 398, False: 9.95k]
  ------------------
   51|    398|        uint32_t packed[kMaxRepeatedRead] = {0};
   52|    398|        if (!decoder.ReadPackedUint32(packed).status().ok()) {
  ------------------
  |  Branch (52:13): [True: 122, False: 276]
  ------------------
   53|    122|          return;
   54|    122|        }
   55|    398|      } break;
   56|    315|      case kUint64:
  ------------------
  |  Branch (56:7): [True: 315, False: 10.0k]
  ------------------
   57|    315|        if (!decoder.ReadUint64().status().ok()) {
  ------------------
  |  Branch (57:13): [True: 16, False: 299]
  ------------------
   58|     16|          return;
   59|     16|        }
   60|    299|        break;
   61|    473|      case kPackedUint64: {
  ------------------
  |  Branch (61:7): [True: 473, False: 9.88k]
  ------------------
   62|    473|        uint64_t packed[kMaxRepeatedRead] = {0};
   63|    473|        if (!decoder.ReadPackedUint64(packed).status().ok()) {
  ------------------
  |  Branch (63:13): [True: 63, False: 410]
  ------------------
   64|     63|          return;
   65|     63|        }
   66|    473|      } break;
   67|    414|      case kInt32:
  ------------------
  |  Branch (67:7): [True: 414, False: 9.94k]
  ------------------
   68|    414|        if (!decoder.ReadInt32().status().ok()) {
  ------------------
  |  Branch (68:13): [True: 140, False: 274]
  ------------------
   69|    140|          return;
   70|    140|        }
   71|    274|        break;
   72|    312|      case kPackedInt32: {
  ------------------
  |  Branch (72:7): [True: 312, False: 10.0k]
  ------------------
   73|    312|        int32_t packed[kMaxRepeatedRead] = {0};
   74|    312|        if (!decoder.ReadPackedInt32(packed).status().ok()) {
  ------------------
  |  Branch (74:13): [True: 47, False: 265]
  ------------------
   75|     47|          return;
   76|     47|        }
   77|    312|      } break;
   78|    265|      case kInt64:
  ------------------
  |  Branch (78:7): [True: 247, False: 10.1k]
  ------------------
   79|    247|        if (!decoder.ReadInt64().status().ok()) {
  ------------------
  |  Branch (79:13): [True: 16, False: 231]
  ------------------
   80|     16|          return;
   81|     16|        }
   82|    231|        break;
   83|    280|      case kPackedInt64: {
  ------------------
  |  Branch (83:7): [True: 280, False: 10.0k]
  ------------------
   84|    280|        int64_t packed[kMaxRepeatedRead] = {0};
   85|    280|        if (!decoder.ReadPackedInt64(packed).status().ok()) {
  ------------------
  |  Branch (85:13): [True: 41, False: 239]
  ------------------
   86|     41|          return;
   87|     41|        }
   88|    280|      } break;
   89|    450|      case kSint32:
  ------------------
  |  Branch (89:7): [True: 450, False: 9.90k]
  ------------------
   90|    450|        if (!decoder.ReadSint32().status().ok()) {
  ------------------
  |  Branch (90:13): [True: 119, False: 331]
  ------------------
   91|    119|          return;
   92|    119|        }
   93|    331|        break;
   94|    441|      case kPackedSint32: {
  ------------------
  |  Branch (94:7): [True: 441, False: 9.91k]
  ------------------
   95|    441|        int32_t packed[kMaxRepeatedRead] = {0};
   96|    441|        if (!decoder.ReadPackedSint32(packed).status().ok()) {
  ------------------
  |  Branch (96:13): [True: 139, False: 302]
  ------------------
   97|    139|          return;
   98|    139|        }
   99|    441|      } break;
  100|    302|      case kSint64:
  ------------------
  |  Branch (100:7): [True: 227, False: 10.1k]
  ------------------
  101|    227|        if (!decoder.ReadSint64().status().ok()) {
  ------------------
  |  Branch (101:13): [True: 22, False: 205]
  ------------------
  102|     22|          return;
  103|     22|        }
  104|    205|        break;
  105|    300|      case kPackedSint64: {
  ------------------
  |  Branch (105:7): [True: 300, False: 10.0k]
  ------------------
  106|    300|        int64_t packed[kMaxRepeatedRead] = {0};
  107|    300|        if (!decoder.ReadPackedSint64(packed).status().ok()) {
  ------------------
  |  Branch (107:13): [True: 39, False: 261]
  ------------------
  108|     39|          return;
  109|     39|        }
  110|    300|      } break;
  111|    261|      case kBool:
  ------------------
  |  Branch (111:7): [True: 244, False: 10.1k]
  ------------------
  112|    244|        if (!decoder.ReadBool().status().ok()) {
  ------------------
  |  Branch (112:13): [True: 156, False: 88]
  ------------------
  113|    156|          return;
  114|    156|        }
  115|     88|        break;
  116|    345|      case kFixed32:
  ------------------
  |  Branch (116:7): [True: 345, False: 10.0k]
  ------------------
  117|    345|        if (!decoder.ReadFixed32().status().ok()) {
  ------------------
  |  Branch (117:13): [True: 3, False: 342]
  ------------------
  118|      3|          return;
  119|      3|        }
  120|    342|        break;
  121|    342|      case kPackedFixed32: {
  ------------------
  |  Branch (121:7): [True: 283, False: 10.0k]
  ------------------
  122|    283|        uint32_t packed[kMaxRepeatedRead] = {0};
  123|    283|        if (!decoder.ReadPackedFixed32(packed).status().ok()) {
  ------------------
  |  Branch (123:13): [True: 28, False: 255]
  ------------------
  124|     28|          return;
  125|     28|        }
  126|    283|      } break;
  127|    255|      case kFixed64:
  ------------------
  |  Branch (127:7): [True: 210, False: 10.1k]
  ------------------
  128|    210|        if (!decoder.ReadFixed64().status().ok()) {
  ------------------
  |  Branch (128:13): [True: 8, False: 202]
  ------------------
  129|      8|          return;
  130|      8|        }
  131|    202|        break;
  132|    317|      case kPackedFixed64: {
  ------------------
  |  Branch (132:7): [True: 317, False: 10.0k]
  ------------------
  133|    317|        uint64_t packed[kMaxRepeatedRead] = {0};
  134|    317|        if (!decoder.ReadPackedFixed64(packed).status().ok()) {
  ------------------
  |  Branch (134:13): [True: 28, False: 289]
  ------------------
  135|     28|          return;
  136|     28|        }
  137|    317|      } break;
  138|    289|      case kSfixed32:
  ------------------
  |  Branch (138:7): [True: 253, False: 10.1k]
  ------------------
  139|    253|        if (!decoder.ReadSfixed32().status().ok()) {
  ------------------
  |  Branch (139:13): [True: 8, False: 245]
  ------------------
  140|      8|          return;
  141|      8|        }
  142|    245|        break;
  143|    297|      case kPackedSfixed32: {
  ------------------
  |  Branch (143:7): [True: 297, False: 10.0k]
  ------------------
  144|    297|        int32_t packed[kMaxRepeatedRead] = {0};
  145|    297|        if (!decoder.ReadPackedSfixed32(packed).status().ok()) {
  ------------------
  |  Branch (145:13): [True: 28, False: 269]
  ------------------
  146|     28|          return;
  147|     28|        }
  148|    297|      } break;
  149|    269|      case kSfixed64:
  ------------------
  |  Branch (149:7): [True: 207, False: 10.1k]
  ------------------
  150|    207|        if (!decoder.ReadSfixed64().status().ok()) {
  ------------------
  |  Branch (150:13): [True: 7, False: 200]
  ------------------
  151|      7|          return;
  152|      7|        }
  153|    200|        break;
  154|    260|      case kPackedSfixed64: {
  ------------------
  |  Branch (154:7): [True: 260, False: 10.0k]
  ------------------
  155|    260|        int64_t packed[kMaxRepeatedRead] = {0};
  156|    260|        if (!decoder.ReadPackedSfixed64(packed).status().ok()) {
  ------------------
  |  Branch (156:13): [True: 29, False: 231]
  ------------------
  157|     29|          return;
  158|     29|        }
  159|    260|      } break;
  160|    266|      case kFloat:
  ------------------
  |  Branch (160:7): [True: 266, False: 10.0k]
  ------------------
  161|    266|        if (!decoder.ReadFloat().status().ok()) {
  ------------------
  |  Branch (161:13): [True: 13, False: 253]
  ------------------
  162|     13|          return;
  163|     13|        }
  164|    253|        break;
  165|    263|      case kPackedFloat: {
  ------------------
  |  Branch (165:7): [True: 263, False: 10.0k]
  ------------------
  166|    263|        float packed[kMaxRepeatedRead] = {0};
  167|    263|        if (!decoder.ReadPackedFloat(packed).status().ok()) {
  ------------------
  |  Branch (167:13): [True: 28, False: 235]
  ------------------
  168|     28|          return;
  169|     28|        }
  170|    263|      } break;
  171|    235|      case kDouble:
  ------------------
  |  Branch (171:7): [True: 211, False: 10.1k]
  ------------------
  172|    211|        if (!decoder.ReadDouble().status().ok()) {
  ------------------
  |  Branch (172:13): [True: 11, False: 200]
  ------------------
  173|     11|          return;
  174|     11|        }
  175|    200|        break;
  176|    329|      case kPackedDouble: {
  ------------------
  |  Branch (176:7): [True: 329, False: 10.0k]
  ------------------
  177|    329|        double packed[kMaxRepeatedRead] = {0};
  178|    329|        if (!decoder.ReadPackedDouble(packed).status().ok()) {
  ------------------
  |  Branch (178:13): [True: 35, False: 294]
  ------------------
  179|     35|          return;
  180|     35|        }
  181|    329|      } break;
  182|    344|      case kBytes: {
  ------------------
  |  Branch (182:7): [True: 344, False: 10.0k]
  ------------------
  183|    344|        std::byte bytes[kMaxRepeatedRead] = {std::byte{0}};
  184|    344|        if (!decoder.ReadBytes(bytes).status().ok()) {
  ------------------
  |  Branch (184:13): [True: 45, False: 299]
  ------------------
  185|     45|          return;
  186|     45|        }
  187|    344|      } break;
  188|    371|      case kString: {
  ------------------
  |  Branch (188:7): [True: 371, False: 9.98k]
  ------------------
  189|    371|        char str[kMaxRepeatedRead] = {0};
  190|    371|        if (!decoder.ReadString(str).status().ok()) {
  ------------------
  |  Branch (190:13): [True: 49, False: 322]
  ------------------
  191|     49|          return;
  192|     49|        }
  193|    371|      } break;
  194|  1.93k|      case kPush: {
  ------------------
  |  Branch (194:7): [True: 1.93k, False: 8.42k]
  ------------------
  195|  1.93k|        StreamDecoder nested_decoder = decoder.GetNestedDecoder();
  196|  1.93k|        RecursiveFuzzedDecode(provider, nested_decoder, depth + 1);
  197|  1.93k|      } break;
  198|      0|      case kPop:
  ------------------
  |  Branch (198:7): [True: 0, False: 10.3k]
  ------------------
  199|      0|        if (depth > 0) {
  ------------------
  |  Branch (199:13): [True: 0, False: 0]
  ------------------
  200|       |          // Special "field". The marks the end of a nested message.
  201|      0|          return;
  202|      0|        }
  203|  10.3k|    }
  204|  10.3k|  }
  205|  3.84k|}

_ZN2pw8protobuf13StreamDecoderD2Ev:
  105|  4.27k|StreamDecoder::~StreamDecoder() {
  106|  4.27k|  if (parent_ != nullptr) {
  ------------------
  |  Branch (106:7): [True: 1.93k, False: 2.33k]
  ------------------
  107|  1.93k|    parent_->CloseNestedDecoder(*this);
  108|  2.33k|  } else if (stream_bounds_.high < std::numeric_limits<size_t>::max()) {
  ------------------
  |  Branch (108:14): [True: 0, False: 2.33k]
  ------------------
  109|      0|    if (status_.ok()) {
  ------------------
  |  Branch (109:9): [True: 0, False: 0]
  ------------------
  110|       |      // Advance the stream to the end of the bounds.
  111|      0|      PW_CHECK(Advance(stream_bounds_.high).ok());
  112|      0|    }
  113|      0|  }
  114|  4.27k|}
_ZN2pw8protobuf13StreamDecoder4NextEv:
  116|  11.7k|Status StreamDecoder::Next() {
  117|  11.7k|  PW_CHECK(!nested_reader_open_,
  118|  11.7k|           "Cannot use parent decoder while a nested one is open");
  119|       |
  120|  11.7k|  PW_TRY(status_);
  121|       |
  122|  11.6k|  if (!field_consumed_) {
  ------------------
  |  Branch (122:7): [True: 0, False: 11.6k]
  ------------------
  123|      0|    PW_TRY(SkipField());
  124|      0|  }
  125|       |
  126|  11.6k|  if (position_ >= stream_bounds_.high) {
  ------------------
  |  Branch (126:7): [True: 928, False: 10.7k]
  ------------------
  127|    928|    return Status::OutOfRange();
  128|    928|  }
  129|       |
  130|  10.7k|  status_ = ReadFieldKey();
  131|  10.7k|  return status_;
  132|  11.6k|}
_ZN2pw8protobuf13StreamDecoder16GetNestedDecoderEv:
  153|  1.93k|StreamDecoder StreamDecoder::GetNestedDecoder() {
  154|  1.93k|  Status status = CheckOkToRead(WireType::kDelimited);
  155|       |
  156|  1.93k|  if (reader_.ConservativeReadLimit() < delimited_field_size_) {
  ------------------
  |  Branch (156:7): [True: 36, False: 1.89k]
  ------------------
  157|     36|    status.Update(Status::DataLoss());
  158|     36|  }
  159|       |
  160|  1.93k|  nested_reader_open_ = true;
  161|       |
  162|  1.93k|  if (!status.ok()) {
  ------------------
  |  Branch (162:7): [True: 58, False: 1.87k]
  ------------------
  163|     58|    return StreamDecoder(reader_, this, status);
  164|     58|  }
  165|       |
  166|  1.87k|  size_t low = position_;
  167|  1.87k|  size_t high = low + delimited_field_size_;
  168|       |
  169|  1.87k|  return StreamDecoder(reader_, this, low, high);
  170|  1.93k|}
_ZN2pw8protobuf13StreamDecoder7AdvanceEm:
  172|  1.79k|Status StreamDecoder::Advance(size_t end_position) {
  173|  1.79k|  if (reader_.seekable()) {
  ------------------
  |  Branch (173:7): [True: 1.79k, False: 0]
  ------------------
  174|  1.79k|    PW_TRY(reader_.Seek(end_position - position_, stream::Stream::kCurrent));
  175|  1.79k|    position_ = end_position;
  176|  1.79k|    return OkStatus();
  177|  1.79k|  }
  178|       |
  179|      0|  while (position_ < end_position) {
  ------------------
  |  Branch (179:10): [True: 0, False: 0]
  ------------------
  180|      0|    std::byte b;
  181|      0|    PW_TRY(reader_.Read(span(&b, 1)));
  182|      0|    position_++;
  183|      0|  }
  184|      0|  return OkStatus();
  185|      0|}
_ZN2pw8protobuf13StreamDecoder18CloseNestedDecoderERS1_:
  199|  1.93k|void StreamDecoder::CloseNestedDecoder(StreamDecoder& nested) {
  200|  1.93k|  PW_CHECK_PTR_EQ(nested.parent_, this);
  201|       |
  202|  1.93k|  nested.nested_reader_open_ = true;
  203|  1.93k|  nested.parent_ = nullptr;
  204|       |
  205|  1.93k|  status_ = nested.status_;
  206|  1.93k|  position_ = nested.position_;
  207|  1.93k|  if (status_.ok()) {
  ------------------
  |  Branch (207:7): [True: 1.79k, False: 139]
  ------------------
  208|       |    // Advance the stream to the end of the nested message field.
  209|  1.79k|    PW_CHECK(Advance(nested.stream_bounds_.high).ok());
  210|  1.79k|  }
  211|       |
  212|  1.93k|  field_consumed_ = true;
  213|  1.93k|  nested_reader_open_ = false;
  214|  1.93k|}
_ZN2pw8protobuf13StreamDecoder12ReadFieldKeyEv:
  216|  10.7k|Status StreamDecoder::ReadFieldKey() {
  217|  10.7k|  PW_DCHECK(field_consumed_);
  218|       |
  219|  10.7k|  uint64_t varint = 0;
  220|  10.7k|  PW_TRY_ASSIGN(size_t bytes_read,
  221|  10.6k|                varint::Read(reader_, &varint, RemainingBytes()));
  222|  10.6k|  position_ += bytes_read;
  223|       |
  224|  10.6k|  if (!FieldKey::IsValidKey(varint)) {
  ------------------
  |  Branch (224:7): [True: 188, False: 10.4k]
  ------------------
  225|    188|    return Status::DataLoss();
  226|    188|  }
  227|       |
  228|  10.4k|  PW_DCHECK(varint <= std::numeric_limits<uint32_t>::max());
  229|  10.4k|  current_field_ = FieldKey(static_cast<uint32_t>(varint));
  230|       |
  231|  10.4k|  if (current_field_.wire_type() == WireType::kDelimited) {
  ------------------
  |  Branch (231:7): [True: 6.62k, False: 3.83k]
  ------------------
  232|       |    // Read the length varint of length-delimited fields immediately to simplify
  233|       |    // later processing of the field.
  234|  6.62k|    StatusWithSize sws = varint::Read(reader_, &varint, RemainingBytes());
  235|  6.62k|    position_ += sws.size();
  236|  6.62k|    if (sws.IsOutOfRange()) {
  ------------------
  |  Branch (236:9): [True: 31, False: 6.59k]
  ------------------
  237|       |      // Out of range indicates the end of the stream. As a value is expected
  238|       |      // here, report it as a data loss and terminate the decode operation.
  239|     31|      return Status::DataLoss();
  240|     31|    }
  241|  6.59k|    if (!sws.ok()) {
  ------------------
  |  Branch (241:9): [True: 5, False: 6.58k]
  ------------------
  242|      5|      return sws.status();
  243|      5|    }
  244|       |
  245|  6.58k|    if (varint > std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (245:9): [True: 63, False: 6.52k]
  ------------------
  246|     63|      return Status::DataLoss();
  247|     63|    }
  248|       |
  249|  6.52k|    delimited_field_size_ = varint;
  250|  6.52k|    delimited_field_offset_ = position_;
  251|  6.52k|  }
  252|       |
  253|  10.3k|  field_consumed_ = false;
  254|  10.3k|  return OkStatus();
  255|  10.4k|}
_ZN2pw8protobuf13StreamDecoder15ReadVarintFieldENS_4spanISt4byteLm18446744073709551615EEENS0_8internal10VarintTypeE:
  314|  2.26k|                                      VarintType decode_type) {
  315|  2.26k|  PW_CHECK(out.size() == sizeof(bool) || out.size() == sizeof(uint32_t) ||
  316|  2.26k|               out.size() == sizeof(uint64_t),
  317|  2.26k|           "Protobuf varints must only be used with bool, int32_t, uint32_t, "
  318|  2.26k|           "int64_t, or uint64_t");
  319|  2.26k|  PW_TRY(CheckOkToRead(WireType::kVarint));
  320|       |
  321|  2.22k|  const StatusWithSize sws = ReadOneVarint(out, decode_type);
  322|  2.22k|  if (sws.status() != Status::DataLoss())
  ------------------
  |  Branch (322:7): [True: 2.11k, False: 111]
  ------------------
  323|  2.11k|    field_consumed_ = true;
  324|  2.22k|  return sws.status();
  325|  2.26k|}
_ZN2pw8protobuf13StreamDecoder13ReadOneVarintENS_4spanISt4byteLm18446744073709551615EEENS0_8internal10VarintTypeE:
  328|  11.5k|                                            VarintType decode_type) {
  329|  11.5k|  uint64_t value;
  330|  11.5k|  StatusWithSize sws = varint::Read(reader_, &value, RemainingBytes());
  331|  11.5k|  position_ += sws.size();
  332|  11.5k|  if (sws.IsOutOfRange()) {
  ------------------
  |  Branch (332:7): [True: 37, False: 11.4k]
  ------------------
  333|       |    // Out of range indicates the end of the stream. As a value is expected
  334|       |    // here, report it as a data loss and terminate the decode operation.
  335|     37|    status_ = Status::DataLoss();
  336|     37|    return StatusWithSize(status_, sws.size());
  337|     37|  }
  338|  11.4k|  if (!sws.ok()) {
  ------------------
  |  Branch (338:7): [True: 241, False: 11.2k]
  ------------------
  339|    241|    return sws;
  340|    241|  }
  341|       |
  342|  11.2k|  if (out.size() == sizeof(uint64_t)) {
  ------------------
  |  Branch (342:7): [True: 7.67k, False: 3.58k]
  ------------------
  343|  7.67k|    if (decode_type == VarintType::kUnsigned) {
  ------------------
  |  Branch (343:9): [True: 2.79k, False: 4.88k]
  ------------------
  344|  2.79k|      std::memcpy(out.data(), &value, out.size());
  345|  4.88k|    } else {
  346|  4.88k|      const int64_t signed_value = decode_type == VarintType::kZigZag
  ------------------
  |  Branch (346:36): [True: 2.86k, False: 2.01k]
  ------------------
  347|  4.88k|                                       ? varint::ZigZagDecode(value)
  348|  4.88k|                                       : static_cast<int64_t>(value);
  349|  4.88k|      std::memcpy(out.data(), &signed_value, out.size());
  350|  4.88k|    }
  351|  7.67k|  } else if (out.size() == sizeof(uint32_t)) {
  ------------------
  |  Branch (351:14): [True: 3.58k, False: 0]
  ------------------
  352|  3.58k|    if (decode_type == VarintType::kUnsigned) {
  ------------------
  |  Branch (352:9): [True: 991, False: 2.58k]
  ------------------
  353|    991|      if (value > std::numeric_limits<uint32_t>::max()) {
  ------------------
  |  Branch (353:11): [True: 78, False: 913]
  ------------------
  354|     78|        return StatusWithSize(Status::FailedPrecondition(), sws.size());
  355|     78|      }
  356|    913|      std::memcpy(out.data(), &value, out.size());
  357|  2.58k|    } else {
  358|  2.58k|      const int64_t signed_value = decode_type == VarintType::kZigZag
  ------------------
  |  Branch (358:36): [True: 1.31k, False: 1.27k]
  ------------------
  359|  2.58k|                                       ? varint::ZigZagDecode(value)
  360|  2.58k|                                       : static_cast<int64_t>(value);
  361|  2.58k|      if (signed_value > std::numeric_limits<int32_t>::max() ||
  ------------------
  |  Branch (361:11): [True: 31, False: 2.55k]
  ------------------
  362|  2.58k|          signed_value < std::numeric_limits<int32_t>::min()) {
  ------------------
  |  Branch (362:11): [True: 85, False: 2.47k]
  ------------------
  363|    116|        return StatusWithSize(Status::FailedPrecondition(), sws.size());
  364|    116|      }
  365|  2.47k|      std::memcpy(out.data(), &signed_value, out.size());
  366|  2.47k|    }
  367|  3.58k|  } else if (out.size() == sizeof(bool)) {
  ------------------
  |  Branch (367:14): [True: 0, False: 0]
  ------------------
  368|      0|    PW_CHECK(decode_type == VarintType::kUnsigned,
  369|      0|             "Protobuf bool can never be signed");
  370|      0|    std::memcpy(out.data(), &value, out.size());
  371|      0|  }
  372|       |
  373|  11.0k|  return sws;
  374|  11.2k|}
_ZN2pw8protobuf13StreamDecoder14ReadFixedFieldENS_4spanISt4byteLm18446744073709551615EEE:
  376|  1.49k|Status StreamDecoder::ReadFixedField(span<std::byte> out) {
  377|  1.49k|  WireType expected_wire_type =
  378|  1.49k|      out.size() == sizeof(uint32_t) ? WireType::kFixed32 : WireType::kFixed64;
  ------------------
  |  Branch (378:7): [True: 864, False: 628]
  ------------------
  379|  1.49k|  PW_TRY(CheckOkToRead(expected_wire_type));
  380|       |
  381|  1.46k|  if (reader_.ConservativeReadLimit() < out.size()) {
  ------------------
  |  Branch (381:7): [True: 17, False: 1.44k]
  ------------------
  382|     17|    status_ = Status::DataLoss();
  383|     17|    return status_;
  384|     17|  }
  385|       |
  386|  1.44k|  if (RemainingBytes() < out.size()) {
  ------------------
  |  Branch (386:7): [True: 7, False: 1.44k]
  ------------------
  387|      7|    status_ = Status::DataLoss();
  388|      7|    return status_;
  389|      7|  }
  390|       |
  391|  1.44k|  PW_TRY(reader_.Read(out));
  392|  1.44k|  position_ += out.size();
  393|  1.44k|  field_consumed_ = true;
  394|       |
  395|  1.44k|  if (endian::native != endian::little) {
  ------------------
  |  Branch (395:7): [Folded - Ignored]
  ------------------
  396|      0|    std::reverse(out.begin(), out.end());
  397|      0|  }
  398|       |
  399|  1.44k|  return OkStatus();
  400|  1.44k|}
_ZN2pw8protobuf13StreamDecoder18ReadDelimitedFieldENS_4spanISt4byteLm18446744073709551615EEE:
  402|    715|StatusWithSize StreamDecoder::ReadDelimitedField(span<std::byte> out) {
  403|    715|  if (Status status = CheckOkToRead(WireType::kDelimited); !status.ok()) {
  ------------------
  |  Branch (403:60): [True: 5, False: 710]
  ------------------
  404|      5|    return StatusWithSize(status, 0);
  405|      5|  }
  406|       |
  407|    710|  if (reader_.ConservativeReadLimit() < delimited_field_size_) {
  ------------------
  |  Branch (407:7): [True: 37, False: 673]
  ------------------
  408|     37|    status_ = Status::DataLoss();
  409|     37|    return StatusWithSize(status_, 0);
  410|     37|  }
  411|       |
  412|    673|  if (out.size() < delimited_field_size_) {
  ------------------
  |  Branch (412:7): [True: 26, False: 647]
  ------------------
  413|       |    // Value can't fit into the provided buffer. Don't advance the cursor so
  414|       |    // that the field can be re-read with a larger buffer or through the stream
  415|       |    // API.
  416|     26|    return StatusWithSize::ResourceExhausted();
  417|     26|  }
  418|       |
  419|    647|  Result<ByteSpan> result = reader_.Read(out.first(delimited_field_size_));
  420|    647|  if (!result.ok()) {
  ------------------
  |  Branch (420:7): [True: 26, False: 621]
  ------------------
  421|     26|    return StatusWithSize(result.status(), 0);
  422|     26|  }
  423|       |
  424|    621|  position_ += result.value().size();
  425|    621|  field_consumed_ = true;
  426|    621|  return StatusWithSize(result.value().size());
  427|    647|}
_ZN2pw8protobuf13StreamDecoder20ReadPackedFixedFieldENS_4spanISt4byteLm18446744073709551615EEEm:
  430|  1.74k|                                                   size_t elem_size) {
  431|  1.74k|  if (Status status = CheckOkToRead(WireType::kDelimited); !status.ok()) {
  ------------------
  |  Branch (431:60): [True: 30, False: 1.71k]
  ------------------
  432|     30|    return StatusWithSize(status, 0);
  433|     30|  }
  434|       |
  435|  1.71k|  if (reader_.ConservativeReadLimit() < delimited_field_size_) {
  ------------------
  |  Branch (435:7): [True: 42, False: 1.67k]
  ------------------
  436|     42|    status_ = Status::DataLoss();
  437|     42|    return StatusWithSize(status_, 0);
  438|     42|  }
  439|       |
  440|  1.67k|  if (out.size() < delimited_field_size_) {
  ------------------
  |  Branch (440:7): [True: 23, False: 1.65k]
  ------------------
  441|       |    // Value can't fit into the provided buffer. Don't advance the cursor so
  442|       |    // that the field can be re-read with a larger buffer or through the stream
  443|       |    // API.
  444|     23|    return StatusWithSize::ResourceExhausted();
  445|     23|  }
  446|       |
  447|  1.65k|  Result<ByteSpan> result = reader_.Read(out.first(delimited_field_size_));
  448|  1.65k|  if (!result.ok()) {
  ------------------
  |  Branch (448:7): [True: 81, False: 1.57k]
  ------------------
  449|     81|    return StatusWithSize(result.status(), 0);
  450|     81|  }
  451|       |
  452|  1.57k|  position_ += result.value().size();
  453|  1.57k|  field_consumed_ = true;
  454|       |
  455|       |  // Decode little-endian serialized packed fields.
  456|  1.57k|  if (endian::native != endian::little) {
  ------------------
  |  Branch (456:7): [Folded - Ignored]
  ------------------
  457|      0|    for (auto out_start = out.begin(); out_start != out.end();
  ------------------
  |  Branch (457:40): [True: 0, False: 0]
  ------------------
  458|      0|         out_start += elem_size) {
  459|      0|      std::reverse(out_start, out_start + elem_size);
  460|      0|    }
  461|      0|  }
  462|       |
  463|  1.57k|  return StatusWithSize(result.value().size() / elem_size);
  464|  1.65k|}
_ZN2pw8protobuf13StreamDecoder21ReadPackedVarintFieldENS_4spanISt4byteLm18446744073709551615EEEmNS0_8internal10VarintTypeE:
  468|  2.20k|                                                    VarintType decode_type) {
  469|  2.20k|  PW_CHECK(elem_size == sizeof(bool) || elem_size == sizeof(uint32_t) ||
  470|  2.20k|               elem_size == sizeof(uint64_t),
  471|  2.20k|           "Protobuf varints must only be used with bool, int32_t, uint32_t, "
  472|  2.20k|           "int64_t, or uint64_t");
  473|       |
  474|  2.20k|  if (Status status = CheckOkToRead(WireType::kDelimited); !status.ok()) {
  ------------------
  |  Branch (474:60): [True: 47, False: 2.15k]
  ------------------
  475|     47|    return StatusWithSize(status, 0);
  476|     47|  }
  477|       |
  478|  2.15k|  if (reader_.ConservativeReadLimit() < delimited_field_size_) {
  ------------------
  |  Branch (478:7): [True: 39, False: 2.11k]
  ------------------
  479|     39|    status_ = Status::DataLoss();
  480|     39|    return StatusWithSize(status_, 0);
  481|     39|  }
  482|       |
  483|  2.11k|  size_t bytes_read = 0;
  484|  2.11k|  size_t number_out = 0;
  485|  11.0k|  while (bytes_read < delimited_field_size_ && !out.empty()) {
  ------------------
  |  Branch (485:10): [True: 9.31k, False: 1.75k]
  |  Branch (485:48): [True: 9.31k, False: 4]
  ------------------
  486|  9.31k|    const StatusWithSize sws = ReadOneVarint(out.first(elem_size), decode_type);
  487|  9.31k|    if (!sws.ok()) {
  ------------------
  |  Branch (487:9): [True: 361, False: 8.94k]
  ------------------
  488|    361|      return StatusWithSize(sws.status(), number_out);
  489|    361|    }
  490|       |
  491|  8.94k|    bytes_read += sws.size();
  492|  8.94k|    out = out.subspan(elem_size);
  493|  8.94k|    ++number_out;
  494|  8.94k|  }
  495|       |
  496|  1.75k|  if (bytes_read < delimited_field_size_) {
  ------------------
  |  Branch (496:7): [True: 4, False: 1.75k]
  ------------------
  497|      4|    return StatusWithSize(Status::ResourceExhausted(), number_out);
  498|      4|  }
  499|       |
  500|  1.75k|  field_consumed_ = true;
  501|  1.75k|  return StatusWithSize(OkStatus(), number_out);
  502|  1.75k|}
_ZN2pw8protobuf13StreamDecoder13CheckOkToReadENS0_8WireTypeE:
  504|  10.3k|Status StreamDecoder::CheckOkToRead(WireType type) {
  505|  10.3k|  PW_CHECK(!nested_reader_open_,
  506|  10.3k|           "Cannot read from a decoder while a nested decoder is open");
  507|  10.3k|  PW_CHECK(!field_consumed_,
  508|  10.3k|           "Attempting to read from protobuf decoder without first calling "
  509|  10.3k|           "Next()");
  510|       |
  511|       |  // Attempting to read the wrong type is typically a programmer error;
  512|       |  // however, it could also occur due to data corruption. As we don't want to
  513|       |  // crash on bad data, return NOT_FOUND here to distinguish it from other
  514|       |  // corruption cases.
  515|  10.3k|  if (current_field_.wire_type() != type) {
  ------------------
  |  Branch (515:7): [True: 171, False: 10.1k]
  ------------------
  516|    171|    status_ = Status::NotFound();
  517|    171|  }
  518|       |
  519|  10.3k|  return status_;
  520|  10.3k|}

_ZN2pw6stream12MemoryReader6DoReadENS_4spanISt4byteLm18446744073709551615EEE:
   45|  42.3k|StatusWithSize MemoryReader::DoRead(ByteSpan dest) {
   46|  42.3k|  if (source_.size_bytes() == position_) {
  ------------------
  |  Branch (46:7): [True: 324, False: 42.0k]
  ------------------
   47|    324|    return StatusWithSize::OutOfRange();
   48|    324|  }
   49|       |
   50|  42.0k|  size_t bytes_to_read =
   51|  42.0k|      std::min(dest.size_bytes(), source_.size_bytes() - position_);
   52|  42.0k|  if (bytes_to_read == 0) {
  ------------------
  |  Branch (52:7): [True: 1.92k, False: 40.1k]
  ------------------
   53|       |    // Calling memcpy with a null pointer is undefined behavior, even when zero
   54|       |    // bytes are copied. We must return early here to avoid performing such a
   55|       |    // call when the dest span is empty.
   56|  1.92k|    return StatusWithSize(0);
   57|  1.92k|  }
   58|       |
   59|  40.1k|  std::memcpy(dest.data(), source_.data() + position_, bytes_to_read);
   60|  40.1k|  position_ += bytes_to_read;
   61|       |
   62|  40.1k|  return StatusWithSize(bytes_to_read);
   63|  42.0k|}

_ZN2pw6varint4ReadERNS_6stream6ReaderEPmm:
   39|  28.8k|StatusWithSize Read(stream::Reader& reader, uint64_t* output, size_t max_size) {
   40|  28.8k|  uint64_t value = 0;
   41|  28.8k|  size_t count = 0;
   42|       |
   43|  38.8k|  while (true) {
  ------------------
  |  Branch (43:10): [Folded - Ignored]
  ------------------
   44|  38.8k|    if (count >= varint::kMaxVarint64SizeBytes) {
  ------------------
  |  Branch (44:9): [True: 45, False: 38.8k]
  ------------------
   45|       |      // Varint can't fit a uint64_t, this likely means we're reading binary
   46|       |      // data that is not actually a varint.
   47|     45|      return StatusWithSize::DataLoss(count);
   48|     45|    }
   49|       |
   50|  38.8k|    if (count >= max_size) {
  ------------------
  |  Branch (50:9): [True: 147, False: 38.6k]
  ------------------
   51|       |      // Varint didn't fit within the range given; return OutOfRange() if
   52|       |      // max_size was 0, but DataLoss if we were reading something we thought
   53|       |      // was going to be a varint.
   54|    147|      return count > 0 ? StatusWithSize::DataLoss(count)
  ------------------
  |  Branch (54:14): [True: 136, False: 11]
  ------------------
   55|    147|                       : StatusWithSize::OutOfRange();
   56|    147|    }
   57|       |
   58|  38.6k|    std::byte b;
   59|  38.6k|    if (auto result = reader.Read(span(&b, 1)); !result.ok()) {
  ------------------
  |  Branch (59:49): [True: 217, False: 38.4k]
  ------------------
   60|    217|      if (count > 0 && result.status().IsOutOfRange()) {
  ------------------
  |  Branch (60:11): [True: 91, False: 126]
  |  Branch (60:24): [True: 91, False: 0]
  ------------------
   61|       |        // Status::OutOfRange on the first byte means we tried to read a varint
   62|       |        // when we reached the end of file. But after the first byte it means we
   63|       |        // failed to decode a varint we were in the middle of, and that's not
   64|       |        // a normal error condition.
   65|     91|        return StatusWithSize::DataLoss(count);
   66|     91|      }
   67|    126|      return StatusWithSize(result.status(), count);
   68|    217|    }
   69|       |
   70|  38.4k|    value |= static_cast<uint64_t>(b & std::byte(0b01111111)) << (7 * count);
   71|  38.4k|    ++count;
   72|       |
   73|       |    // MSB == 0 indicates last byte of the varint.
   74|  38.4k|    if ((b & std::byte(0b10000000)) == std::byte(0)) {
  ------------------
  |  Branch (74:9): [True: 28.4k, False: 9.95k]
  ------------------
   75|  28.4k|      break;
   76|  28.4k|    }
   77|  38.4k|  }
   78|       |
   79|  28.4k|  *output = value;
   80|  28.4k|  return StatusWithSize(count);
   81|  28.8k|}

