_ZN8firebase9firestore5model10DatabaseIdC2ENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEES9_:
   32|  1.22k|DatabaseId::DatabaseId(std::string project_id, std::string database_id) {
   33|  1.22k|  rep_ = std::make_shared<Rep>(std::move(project_id), std::move(database_id));
   34|  1.22k|}

_ZN8firebase9firestore5model10DatabaseId3RepC2EONSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEESB_:
   79|  1.22k|        : project_id{std::move(project_id)},
   80|  1.22k|          database_id{std::move(database_id)} {
   81|  1.22k|    }

_ZN8firebase9firestore6nanopb11FieldsArrayINS0_26_google_firestore_v1_ValueEEEPK10pb_field_sv:
  134|  2.45k|inline const pb_field_t* FieldsArray<google_firestore_v1_Value>() {
  135|  2.45k|  return google_firestore_v1_Value_fields;
  136|  2.45k|}

_ZN8firebase9firestore6nanopb17FreeNanopbMessageEPK10pb_field_sPv:
   23|  1.22k|void FreeNanopbMessage(const pb_field_t* fields, void* dest_struct) {
   24|  1.22k|  pb_release(fields, dest_struct);
   25|  1.22k|}

_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEE8TryParseEPNS1_6ReaderE:
  262|  1.22k|Message<T> Message<T>::TryParse(Reader* reader) {
  263|  1.22k|  Message<T> result;
  264|  1.22k|  reader->Read(result.fields(), result.get());
  265|       |
  266|  1.22k|  if (!reader->ok()) {
  ------------------
  |  Branch (266:7): [True: 879, False: 349]
  ------------------
  267|       |    // In the event reading a Nanopb proto fails, Nanopb calls `pb_release` on
  268|       |    // the partially-filled message; let go of ownership to make sure double
  269|       |    // deletion doesn't occur.
  270|    879|    result.release();
  271|       |    // Guarantee that a partially-filled message is never returned.
  272|    879|    return Message<T>{};
  273|    879|  }
  274|       |
  275|    349|  return result;
  276|  1.22k|}
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEEC2Ev:
   67|  2.10k|  Message() = default;
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEE6fieldsEv:
  167|  2.45k|  static const pb_field_t* fields() {
  168|  2.45k|    return FieldsArray<T>();
  169|  2.45k|  }
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEE3getEv:
  121|  2.10k|  T* get() {
  122|  2.10k|    return owns_proto_ ? &proto_ : nullptr;
  ------------------
  |  Branch (122:12): [True: 2.10k, False: 0]
  ------------------
  123|  2.10k|  }
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEE7releaseEv:
  111|    879|  T* release() {
  112|    879|    auto result = get();
  113|    879|    owns_proto_ = false;
  114|    879|    return result;
  115|    879|  }
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEEC2EOS4_:
   97|    349|      : owns_proto_{other.owns_proto_}, proto_{other.proto_} {
   98|    349|    other.owns_proto_ = false;
   99|    349|  }
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEED2Ev:
   82|  2.45k|  ~Message() {
   83|  2.45k|    Free();
   84|  2.45k|  }
_ZN8firebase9firestore6nanopb7MessageINS0_26_google_firestore_v1_ValueEE4FreeEv:
  186|  2.45k|  void Free() {
  187|  2.45k|    if (owns_proto_) {
  ------------------
  |  Branch (187:9): [True: 1.22k, False: 1.22k]
  ------------------
  188|  1.22k|      FreeNanopbMessage(fields(), &proto_);
  189|  1.22k|    }
  190|  2.45k|  }

_ZN8firebase9firestore6nanopb11CheckedSizeEm:
   27|     10|pb_size_t CheckedSize(size_t size) {
   28|     10|  HARD_ASSERT(size <= PB_SIZE_MAX,
  ------------------
  |  |   54|     10|  do {                                                          \
  |  |   55|     10|    if (!ABSL_PREDICT_TRUE(condition)) {                        \
  |  |  ------------------
  |  |  |  |  179|     10|#define ABSL_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:48): [Folded - Ignored]
  |  |  |  |  |  Branch (179:57): [True: 10, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 10]
  |  |  ------------------
  |  |   56|      0|      std::string _message =                                    \
  |  |   57|      0|          firebase::firestore::util::StringFormat(__VA_ARGS__); \
  |  |   58|      0|      INVOKE_INTERNAL_FAIL(_message, #condition);               \
  |  |  ------------------
  |  |  |  |   41|      0|  firebase::firestore::util::internal::FailAssertion( \
  |  |  |  |   42|      0|      __FILE__, FIRESTORE_FUNCTION_NAME, __LINE__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FIRESTORE_FUNCTION_NAME __PRETTY_FUNCTION__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      0|    }                                                           \
  |  |   60|     10|  } while (0)
  |  |  ------------------
  |  |  |  Branch (60:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   29|     10|              "Size exceeds nanopb limits. Too many entries.");
   30|     10|  return static_cast<pb_size_t>(size);
   31|     10|}
_ZN8firebase9firestore6nanopb14MakeBytesArrayEPKvm:
   40|     10|                                           size_t size) {
   41|     10|  if (size == 0) return nullptr;
  ------------------
  |  Branch (41:7): [True: 0, False: 10]
  ------------------
   42|       |
   43|     10|  pb_size_t pb_size = CheckedSize(size);
   44|       |
   45|       |  // Allocate one extra byte for the null terminator that's not necessarily
   46|       |  // there in a string_view. As long as we're making a copy, might as well
   47|       |  // make a copy that won't overrun when used as a regular C string. This is
   48|       |  // essentially just to make debugging easier--actual user data can have
   49|       |  // embedded nulls so we shouldn't be using this as a C string under normal
   50|       |  // circumstances.
   51|     10|  auto result = static_cast<pb_bytes_array_t*>(
   52|     10|      std::malloc(PB_BYTES_ARRAY_T_ALLOCSIZE(pb_size + 1)));
  ------------------
  |  |  270|     10|#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes))
  ------------------
   53|     10|  result->size = pb_size;
   54|     10|  std::memcpy(result->bytes, data, pb_size);
   55|     10|  result->bytes[pb_size] = '\0';
   56|       |
   57|     10|  return result;
   58|     10|}

_ZN8firebase9firestore6nanopb14MakeBytesArrayERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
   77|     10|inline pb_bytes_array_t* _Nullable MakeBytesArray(const std::string& str) {
   78|     10|  return MakeBytesArray(str.data(), str.size());
   79|     10|}

_ZN8firebase9firestore6nanopb12StringReaderC2EPKhm:
   32|  1.22k|    : stream_(pb_istream_from_buffer(bytes, size)) {
   33|  1.22k|}
_ZN8firebase9firestore6nanopb12StringReader4ReadEPK10pb_field_sPv:
   39|  1.22k|void StringReader::Read(const pb_field_t fields[], void* dest_struct) {
   40|  1.22k|  if (!ok()) return;
  ------------------
  |  Branch (40:7): [True: 0, False: 1.22k]
  ------------------
   41|       |
   42|  1.22k|  if (!pb_decode(&stream_, fields, dest_struct)) {
  ------------------
  |  Branch (42:7): [True: 879, False: 349]
  ------------------
   43|    879|    Fail(PB_GET_ERROR(&stream_));
  ------------------
  |  |  594|    879|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (594:31): [True: 879, False: 0]
  |  |  ------------------
  ------------------
   44|    879|  }
   45|  1.22k|}

_ZN8firebase9firestore6nanopb6ReaderD2Ev:
   48|  1.22k|  virtual ~Reader() = default;
_ZNK8firebase9firestore6nanopb6Reader2okEv:
   68|  2.45k|  bool ok() const {
   69|  2.45k|    return context_.ok();
   70|  2.45k|  }
_ZN8firebase9firestore6nanopb6Reader4FailENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   88|    879|  void Fail(std::string description) {
   89|    879|    context_.Fail(std::move(description));
   90|    879|  }

_ZN8firebase9firestore6remote10SerializerC2ENS0_5model10DatabaseIdE:
  181|  1.22k|    : database_id_(std::move(database_id)) {
  182|  1.22k|}

_ZNK8firebase9firestore4util11ReadContext2okEv:
   37|  2.45k|  bool ok() const {
   38|  2.45k|    return status_.ok();
   39|  2.45k|  }
_ZN8firebase9firestore4util11ReadContext4FailENSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   57|    879|  void Fail(std::string description) {
   58|    879|    status_.Update(util::Status(Error::kErrorDataLoss, std::move(description)));
   59|    879|  }

_ZN8firebase9firestore4util6StatusC2ENS0_5ErrorENSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
   31|    879|Status::Status(Error code, std::string msg) {
   32|    879|  HARD_ASSERT(code != Error::kErrorOk);
  ------------------
  |  |   54|    879|  do {                                                          \
  |  |   55|    879|    if (!ABSL_PREDICT_TRUE(condition)) {                        \
  |  |  ------------------
  |  |  |  |  179|    879|#define ABSL_PREDICT_TRUE(x) (__builtin_expect(false || (x), true))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:48): [Folded - Ignored]
  |  |  |  |  |  Branch (179:57): [True: 879, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  |  Branch (55:9): [True: 0, False: 879]
  |  |  ------------------
  |  |   56|      0|      std::string _message =                                    \
  |  |   57|      0|          firebase::firestore::util::StringFormat(__VA_ARGS__); \
  |  |   58|      0|      INVOKE_INTERNAL_FAIL(_message, #condition);               \
  |  |  ------------------
  |  |  |  |   41|      0|  firebase::firestore::util::internal::FailAssertion( \
  |  |  |  |   42|      0|      __FILE__, FIRESTORE_FUNCTION_NAME, __LINE__, __VA_ARGS__)
  |  |  |  |  ------------------
  |  |  |  |  |  |   30|      0|#define FIRESTORE_FUNCTION_NAME __PRETTY_FUNCTION__
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   59|      0|    }                                                           \
  |  |   60|    879|  } while (0)
  |  |  ------------------
  |  |  |  Branch (60:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   33|    879|  state_ = State::MakePtr(code, std::move(msg));
   34|    879|}
_ZN8firebase9firestore4util6Status6UpdateERKS2_:
   44|    879|void Status::Update(const Status& new_status) {
   45|    879|  if (ok()) {
  ------------------
  |  Branch (45:7): [True: 879, False: 0]
  ------------------
   46|    879|    *this = new_status;
   47|    879|  }
   48|    879|}
_ZNK8firebase9firestore4util6Status5State7DeleterclEPKS3_:
   85|  1.75k|void Status::State::Deleter::operator()(const State* ptr) const {
   86|  1.75k|  if (ptr != State::MovedFromIndicator()) {
  ------------------
  |  Branch (86:7): [True: 1.75k, False: 0]
  ------------------
   87|  1.75k|    delete ptr;
   88|  1.75k|  }
   89|  1.75k|}
_ZN8firebase9firestore4util6Status12SlowCopyFromEPKNS2_5StateE:
   96|    879|void Status::SlowCopyFrom(const State* src) {
   97|    879|  if (src == nullptr) {
  ------------------
  |  Branch (97:7): [True: 0, False: 879]
  ------------------
   98|      0|    state_ = nullptr;
   99|    879|  } else {
  100|    879|    state_ = State::MakePtr(*src);
  101|    879|  }
  102|    879|}

_ZNK8firebase9firestore4util6Status2okEv:
   85|  3.33k|  bool ok() const {
   86|  3.33k|    return state_ == nullptr;
   87|  3.33k|  }
_ZN8firebase9firestore4util6Status2OKEv:
   63|  1.22k|  static Status OK() {
   64|  1.22k|    return Status();
   65|  1.22k|  }
_ZN8firebase9firestore4util6Status5State18MovedFromIndicatorEv:
  147|  1.75k|    static State* MovedFromIndicator() {
  148|  1.75k|      return reinterpret_cast<State*>(0x01);
  149|  1.75k|    }
_ZN8firebase9firestore4util6StatusaSERKS2_:
  214|    879|inline Status& Status::operator=(const Status& s) {
  215|       |  // The following condition catches both aliasing (when this == &s),
  216|       |  // and the common case where both s and *this are ok.
  217|    879|  if (state_ != s.state_) {
  ------------------
  |  Branch (217:7): [True: 879, False: 0]
  ------------------
  218|    879|    SlowCopyFrom(s.state_.get());
  219|    879|  }
  220|    879|  return *this;
  221|    879|}
_ZN8firebase9firestore4util6StatusC2Ev:
   49|  1.22k|  Status() = default;
_ZN8firebase9firestore4util6Status5StateC2ERKS3_:
  203|    879|    : code(other.code),
  204|    879|      msg(other.msg),
  205|    879|      platform_error((other.platform_error == nullptr)
  ------------------
  |  Branch (205:22): [True: 879, False: 0]
  ------------------
  206|    879|                         ? nullptr
  207|    879|                         : other.platform_error->Copy()) {
  208|    879|}
_ZN8firebase9firestore4util6Status5State7MakePtrIJRNS0_5ErrorENSt3__112basic_stringIcNS7_11char_traitsIcEENS7_9allocatorIcEEEEEEENS7_10unique_ptrIS3_NS3_7DeleterEEEDpOT_:
  152|    879|    static StatePtr MakePtr(Args&&... args) {
  153|    879|      return StatePtr(new State(std::forward<Args>(args)...));
  154|    879|    }
_ZN8firebase9firestore4util6Status5StateC2ENS0_5ErrorEONSt3__112basic_stringIcNS5_11char_traitsIcEENS5_9allocatorIcEEEE:
  211|    879|    : code(code), msg(std::move(msg)) {
  212|    879|}
_ZN8firebase9firestore4util6Status5State7MakePtrIJRKS3_EEENSt3__110unique_ptrIS3_NS3_7DeleterEEEDpOT_:
  152|    879|    static StatePtr MakePtr(Args&&... args) {
  153|    879|      return StatePtr(new State(std::forward<Args>(args)...));
  154|    879|    }

LLVMFuzzerTestOneInput:
   34|  1.22k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
   35|  1.22k|  Serializer serializer{DatabaseId{"project", DatabaseId::kDefault}};
   36|  1.22k|  try {
   37|       |    // Try to decode the received data using the serializer.
   38|  1.22k|    StringReader reader{data, size};
   39|  1.22k|    auto message = Message<google_firestore_v1_Value>::TryParse(&reader);
   40|       |    //ReadContext;
   41|       |    //serializerodeFieldValue(&context, *message);
   42|  1.22k|  } catch (...) {
   43|       |    // Ignore caught errors and assertions because fuzz testing is looking for
   44|       |    // crashes and memory errors.
   45|      0|  }
   46|  1.22k|  return 0;
   47|  1.22k|}

pb_field_iter_begin:
    9|  1.37M|{
   10|  1.37M|    iter->start = fields;
   11|  1.37M|    iter->pos = fields;
   12|  1.37M|    iter->required_field_index = 0;
   13|  1.37M|    iter->dest_struct = dest_struct;
   14|  1.37M|    iter->pData = (char*)dest_struct + iter->pos->data_offset;
   15|  1.37M|    iter->pSize = (char*)iter->pData + iter->pos->size_offset;
   16|       |    
   17|  1.37M|    return (iter->pos->tag != 0);
   18|  1.37M|}
pb_field_iter_next:
   21|  5.59M|{
   22|  5.59M|    const pb_field_t *prev_field = iter->pos;
   23|       |
   24|  5.59M|    if (prev_field->tag == 0)
  ------------------
  |  Branch (24:9): [True: 0, False: 5.59M]
  ------------------
   25|      0|    {
   26|       |        /* Handle empty message types, where the first field is already the terminator.
   27|       |         * In other cases, the iter->pos never points to the terminator. */
   28|      0|        return false;
   29|      0|    }
   30|       |    
   31|  5.59M|    iter->pos++;
   32|       |    
   33|  5.59M|    if (iter->pos->tag == 0)
  ------------------
  |  Branch (33:9): [True: 818k, False: 4.77M]
  ------------------
   34|   818k|    {
   35|       |        /* Wrapped back to beginning, reinitialize */
   36|   818k|        (void)pb_field_iter_begin(iter, iter->start, iter->dest_struct);
   37|   818k|        return false;
   38|   818k|    }
   39|  4.77M|    else
   40|  4.77M|    {
   41|       |        /* Increment the pointers based on previous field size */
   42|  4.77M|        size_t prev_size = prev_field->data_size;
   43|       |    
   44|  4.77M|        if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF &&
  ------------------
  |  |  205|  4.77M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  4.77M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(prev_field->type) == PB_HTYPE_ONEOF &&
  ------------------
  |  |  194|  9.54M|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (44:13): [True: 4.44M, False: 328k]
  ------------------
   45|  4.77M|            PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF &&
  ------------------
  |  |  205|  4.44M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  4.44M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                          PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF &&
  ------------------
  |  |  194|  9.22M|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (45:13): [True: 4.44M, False: 0]
  ------------------
   46|  4.77M|            iter->pos->data_offset == PB_SIZE_MAX)
  ------------------
  |  |  221|  4.44M|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (46:13): [True: 4.44M, False: 0]
  ------------------
   47|  4.44M|        {
   48|       |            /* Don't advance pointers inside unions */
   49|  4.44M|            return true;
   50|  4.44M|        }
   51|   328k|        else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC &&
  ------------------
  |  |  204|   328k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   328k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                      else if (PB_ATYPE(prev_field->type) == PB_ATYPE_STATIC &&
  ------------------
  |  |  199|   656k|#define PB_ATYPE_STATIC   0x00
  ------------------
  |  Branch (51:18): [True: 50.0k, False: 278k]
  ------------------
   52|   328k|                 PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  205|  50.0k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  50.0k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                               PB_HTYPE(prev_field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  193|  50.0k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (52:18): [True: 0, False: 50.0k]
  ------------------
   53|      0|        {
   54|       |            /* In static arrays, the data_size tells the size of a single entry and
   55|       |             * array_size is the number of entries */
   56|      0|            prev_size *= prev_field->array_size;
   57|      0|        }
   58|   328k|        else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|   328k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   328k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                      else if (PB_ATYPE(prev_field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|   328k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (58:18): [True: 278k, False: 50.0k]
  ------------------
   59|   278k|        {
   60|       |            /* Pointer fields always have a constant size in the main structure.
   61|       |             * The data_size only applies to the dynamically allocated area. */
   62|   278k|            prev_size = sizeof(void*);
   63|   278k|        }
   64|       |
   65|   328k|        if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED)
  ------------------
  |  |  205|   328k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   328k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(prev_field->type) == PB_HTYPE_REQUIRED)
  ------------------
  |  |  191|   328k|#define PB_HTYPE_REQUIRED 0x00
  ------------------
  |  Branch (65:13): [True: 0, False: 328k]
  ------------------
   66|      0|        {
   67|       |            /* Count the required fields, in order to check their presence in the
   68|       |             * decoder. */
   69|      0|            iter->required_field_index++;
   70|      0|        }
   71|       |    
   72|   328k|        iter->pData = (char*)iter->pData + prev_size + iter->pos->data_offset;
   73|   328k|        iter->pSize = (char*)iter->pData + iter->pos->size_offset;
   74|   328k|        return true;
   75|  4.77M|    }
   76|  5.59M|}
pb_field_iter_find:
   79|   659k|{
   80|   659k|    const pb_field_t *start = iter->pos;
   81|       |    
   82|  3.18M|    do {
   83|  3.18M|        if (iter->pos->tag == tag &&
  ------------------
  |  Branch (83:13): [True: 568k, False: 2.61M]
  ------------------
   84|  3.18M|            PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION)
  ------------------
  |  |  206|   568k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   568k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          PB_LTYPE(iter->pos->type) != PB_LTYPE_EXTENSION)
  ------------------
  |  |  177|   568k|#define PB_LTYPE_EXTENSION 0x09
  ------------------
  |  Branch (84:13): [True: 568k, False: 0]
  ------------------
   85|   568k|        {
   86|       |            /* Found the wanted field */
   87|   568k|            return true;
   88|   568k|        }
   89|       |        
   90|  2.61M|        (void)pb_field_iter_next(iter);
   91|  2.61M|    } while (iter->pos != start);
  ------------------
  |  Branch (91:14): [True: 2.52M, False: 90.8k]
  ------------------
   92|       |    
   93|       |    /* Searched all the way back to start, and found nothing. */
   94|  90.8k|    return false;
   95|   659k|}

pb_read:
  103|   124k|{
  104|   124k|    if (count == 0)
  ------------------
  |  Branch (104:9): [True: 5.65k, False: 118k]
  ------------------
  105|  5.65k|        return true;
  106|       |
  107|   118k|#ifndef PB_BUFFER_ONLY
  108|   118k|	if (buf == NULL && stream->callback != buf_read)
  ------------------
  |  Branch (108:6): [True: 70.5k, False: 48.0k]
  |  Branch (108:21): [True: 0, False: 70.5k]
  ------------------
  109|      0|	{
  110|       |		/* Skip input bytes */
  111|      0|		pb_byte_t tmp[16];
  112|      0|		while (count > 16)
  ------------------
  |  Branch (112:10): [True: 0, False: 0]
  ------------------
  113|      0|		{
  114|      0|			if (!pb_read(stream, tmp, 16))
  ------------------
  |  Branch (114:8): [True: 0, False: 0]
  ------------------
  115|      0|				return false;
  116|       |			
  117|      0|			count -= 16;
  118|      0|		}
  119|       |		
  120|      0|		return pb_read(stream, tmp, count);
  121|      0|	}
  122|   118k|#endif
  123|       |
  124|   118k|    if (stream->bytes_left < count)
  ------------------
  |  Branch (124:9): [True: 169, False: 118k]
  ------------------
  125|    169|        PB_RETURN_ERROR(stream, "end-of-stream");
  ------------------
  |  |  597|    169|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|    169|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 169]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  126|       |    
  127|   118k|#ifndef PB_BUFFER_ONLY
  128|   118k|    if (!stream->callback(stream, buf, count))
  ------------------
  |  Branch (128:9): [True: 0, False: 118k]
  ------------------
  129|      0|        PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  130|       |#else
  131|       |    if (!buf_read(stream, buf, count))
  132|       |        return false;
  133|       |#endif
  134|       |    
  135|   118k|    stream->bytes_left -= count;
  136|   118k|    return true;
  137|   118k|}
pb_istream_from_buffer:
  160|  1.22k|{
  161|  1.22k|    pb_istream_t stream;
  162|       |    /* Cast away the const from buf without a compiler error.  We are
  163|       |     * careful to use it only in a const manner in the callbacks.
  164|       |     */
  165|  1.22k|    union {
  166|  1.22k|        void *state;
  167|  1.22k|        const void *c_state;
  168|  1.22k|    } state;
  169|       |#ifdef PB_BUFFER_ONLY
  170|       |    stream.callback = NULL;
  171|       |#else
  172|  1.22k|    stream.callback = &buf_read;
  173|  1.22k|#endif
  174|  1.22k|    state.c_state = buf;
  175|  1.22k|    stream.state = state.state;
  176|  1.22k|    stream.bytes_left = bufsize;
  177|  1.22k|#ifndef PB_NO_ERRMSG
  178|  1.22k|    stream.errmsg = NULL;
  179|  1.22k|#endif
  180|  1.22k|    return stream;
  181|  1.22k|}
pb_decode_varint32:
  250|   144k|{
  251|   144k|    return pb_decode_varint32_eof(stream, dest, NULL);
  252|   144k|}
pb_decode_varint:
  256|   202k|{
  257|   202k|    pb_byte_t byte;
  258|   202k|    uint_fast8_t bitpos = 0;
  259|   202k|    uint64_t result = 0;
  260|       |    
  261|   202k|    do
  262|   214k|    {
  263|   214k|        if (bitpos >= 64)
  ------------------
  |  Branch (263:13): [True: 7, False: 214k]
  ------------------
  264|      7|            PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  597|      7|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      7|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  265|       |        
  266|   214k|        if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (266:13): [True: 55, False: 214k]
  ------------------
  267|     55|            return false;
  268|       |
  269|   214k|        result |= (uint64_t)(byte & 0x7F) << bitpos;
  270|   214k|        bitpos = (uint_fast8_t)(bitpos + 7);
  271|   214k|    } while (byte & 0x80);
  ------------------
  |  Branch (271:14): [True: 11.5k, False: 202k]
  ------------------
  272|       |    
  273|   202k|    *dest = result;
  274|   202k|    return true;
  275|   202k|}
pb_decode_tag:
  299|   452k|{
  300|   452k|    uint32_t temp;
  301|   452k|    *eof = false;
  302|   452k|    *wire_type = (pb_wire_type_t) 0;
  303|   452k|    *tag = 0;
  304|       |    
  305|   452k|    if (!pb_decode_varint32_eof(stream, &temp, eof))
  ------------------
  |  Branch (305:9): [True: 125, False: 452k]
  ------------------
  306|    125|    {
  307|    125|        return false;
  308|    125|    }
  309|       |    
  310|   452k|    if (temp == 0)
  ------------------
  |  Branch (310:9): [True: 4.96k, False: 447k]
  ------------------
  311|  4.96k|    {
  312|  4.96k|        *eof = true; /* Special feature: allow 0-terminated messages. */
  313|  4.96k|        return false;
  314|  4.96k|    }
  315|       |    
  316|   447k|    *tag = temp >> 3;
  317|   447k|    *wire_type = (pb_wire_type_t)(temp & 7);
  318|   447k|    return true;
  319|   452k|}
pb_skip_field:
  322|  90.8k|{
  323|  90.8k|    switch (wire_type)
  324|  90.8k|    {
  325|  22.6k|        case PB_WT_VARINT: return pb_skip_varint(stream);
  ------------------
  |  Branch (325:9): [True: 22.6k, False: 68.1k]
  ------------------
  326|  42.9k|        case PB_WT_64BIT: return pb_read(stream, NULL, 8);
  ------------------
  |  Branch (326:9): [True: 42.9k, False: 47.8k]
  ------------------
  327|  8.05k|        case PB_WT_STRING: return pb_skip_string(stream);
  ------------------
  |  Branch (327:9): [True: 8.05k, False: 82.7k]
  ------------------
  328|  16.9k|        case PB_WT_32BIT: return pb_read(stream, NULL, 4);
  ------------------
  |  Branch (328:9): [True: 16.9k, False: 73.8k]
  ------------------
  329|    133|        default: PB_RETURN_ERROR(stream, "invalid wire_type");
  ------------------
  |  |  597|    133|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|    133|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 133]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (329:9): [True: 133, False: 90.6k]
  ------------------
  330|  90.8k|    }
  331|  90.8k|}
pb_make_string_substream:
  373|   100k|{
  374|   100k|    uint32_t size;
  375|   100k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (375:9): [True: 116, False: 100k]
  ------------------
  376|    116|        return false;
  377|       |    
  378|   100k|    *substream = *stream;
  379|   100k|    if (substream->bytes_left < size)
  ------------------
  |  Branch (379:9): [True: 69, False: 100k]
  ------------------
  380|     69|        PB_RETURN_ERROR(stream, "parent stream too short");
  ------------------
  |  |  597|     69|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|     69|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  381|       |    
  382|   100k|    substream->bytes_left = size;
  383|   100k|    stream->bytes_left -= size;
  384|   100k|    return true;
  385|   100k|}
pb_close_string_substream:
  388|   100k|{
  389|   100k|    if (substream->bytes_left) {
  ------------------
  |  Branch (389:9): [True: 4.73k, False: 95.4k]
  ------------------
  390|  4.73k|        if (!pb_read(substream, NULL, substream->bytes_left))
  ------------------
  |  Branch (390:13): [True: 0, False: 4.73k]
  ------------------
  391|      0|            return false;
  392|  4.73k|    }
  393|       |
  394|   100k|    stream->state = substream->state;
  395|       |
  396|   100k|#ifndef PB_NO_ERRMSG
  397|   100k|    stream->errmsg = substream->errmsg;
  398|   100k|#endif
  399|   100k|    return true;
  400|   100k|}
pb_decode_noinit:
  929|   101k|{
  930|   101k|    uint32_t fields_seen[(PB_MAX_REQUIRED_FIELDS + 31) / 32] = {0, 0};
  931|   101k|    const uint32_t allbits = ~(uint32_t)0;
  932|   101k|    uint32_t extension_range_start = 0;
  933|   101k|    pb_field_iter_t iter;
  934|       |
  935|       |    /* 'fixed_count_field' and 'fixed_count_size' track position of a repeated fixed
  936|       |     * count field. This can only handle _one_ repeated fixed count field that
  937|       |     * is unpacked and unordered among other (non repeated fixed count) fields.
  938|       |     */
  939|   101k|    const pb_field_t *fixed_count_field = NULL;
  940|   101k|    pb_size_t fixed_count_size = 0;
  941|       |
  942|       |    /* Return value ignored, as empty message types will be correctly handled by
  943|       |     * pb_field_iter_find() anyway. */
  944|   101k|    (void)pb_field_iter_begin(&iter, fields, dest_struct);
  945|       |
  946|   547k|    while (stream->bytes_left)
  ------------------
  |  Branch (946:12): [True: 452k, False: 94.9k]
  ------------------
  947|   452k|    {
  948|   452k|        uint32_t tag;
  949|   452k|        pb_wire_type_t wire_type;
  950|   452k|        bool eof;
  951|       |
  952|   452k|        if (!pb_decode_tag(stream, &wire_type, &tag, &eof))
  ------------------
  |  Branch (952:13): [True: 5.09k, False: 447k]
  ------------------
  953|  5.09k|        {
  954|  5.09k|            if (eof)
  ------------------
  |  Branch (954:17): [True: 4.96k, False: 125]
  ------------------
  955|  4.96k|                break;
  956|    125|            else
  957|    125|                return false;
  958|  5.09k|        }
  959|       |
  960|   447k|        if (!pb_field_iter_find(&iter, tag))
  ------------------
  |  Branch (960:13): [True: 90.8k, False: 356k]
  ------------------
  961|  90.8k|        {
  962|       |            /* No match found, check if it matches an extension. */
  963|  90.8k|            if (tag >= extension_range_start)
  ------------------
  |  Branch (963:17): [True: 7.46k, False: 83.3k]
  ------------------
  964|  7.46k|            {
  965|  7.46k|                if (!find_extension_field(&iter))
  ------------------
  |  Branch (965:21): [True: 7.46k, False: 0]
  ------------------
  966|  7.46k|                    extension_range_start = (uint32_t)-1;
  967|      0|                else
  968|      0|                    extension_range_start = iter.pos->tag;
  969|       |
  970|  7.46k|                if (tag >= extension_range_start)
  ------------------
  |  Branch (970:21): [True: 0, False: 7.46k]
  ------------------
  971|      0|                {
  972|      0|                    size_t pos = stream->bytes_left;
  973|       |
  974|      0|                    if (!decode_extension(stream, tag, wire_type, &iter))
  ------------------
  |  Branch (974:25): [True: 0, False: 0]
  ------------------
  975|      0|                        return false;
  976|       |
  977|      0|                    if (pos != stream->bytes_left)
  ------------------
  |  Branch (977:25): [True: 0, False: 0]
  ------------------
  978|      0|                    {
  979|       |                        /* The field was handled */
  980|      0|                        continue;
  981|      0|                    }
  982|      0|                }
  983|  7.46k|            }
  984|       |
  985|       |            /* No match found, skip data */
  986|  90.8k|            if (!pb_skip_field(stream, wire_type))
  ------------------
  |  Branch (986:17): [True: 313, False: 90.5k]
  ------------------
  987|    313|                return false;
  988|  90.5k|            continue;
  989|  90.8k|        }
  990|       |
  991|       |        /* If a repeated fixed count field was found, get size from
  992|       |         * 'fixed_count_field' as there is no counter contained in the struct.
  993|       |         */
  994|   356k|        if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REPEATED
  ------------------
  |  |  205|   356k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   356k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REPEATED
  ------------------
  |  |  193|   712k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (994:13): [True: 67.7k, False: 288k]
  ------------------
  995|   356k|            && iter.pSize == iter.pData)
  ------------------
  |  Branch (995:16): [True: 0, False: 67.7k]
  ------------------
  996|      0|        {
  997|      0|            if (fixed_count_field != iter.pos) {
  ------------------
  |  Branch (997:17): [True: 0, False: 0]
  ------------------
  998|       |                /* If the new fixed count field does not match the previous one,
  999|       |                 * check that the previous one is NULL or that it finished
 1000|       |                 * receiving all the expected data.
 1001|       |                 */
 1002|      0|                if (fixed_count_field != NULL &&
  ------------------
  |  Branch (1002:21): [True: 0, False: 0]
  ------------------
 1003|      0|                    fixed_count_size != fixed_count_field->array_size)
  ------------------
  |  Branch (1003:21): [True: 0, False: 0]
  ------------------
 1004|      0|                {
 1005|      0|                    PB_RETURN_ERROR(stream, "wrong size for fixed count field");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1006|      0|                }
 1007|       |
 1008|      0|                fixed_count_field = iter.pos;
 1009|      0|                fixed_count_size = 0;
 1010|      0|            }
 1011|       |
 1012|      0|            iter.pSize = &fixed_count_size;
 1013|      0|        }
 1014|       |
 1015|   356k|        if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REQUIRED
  ------------------
  |  |  205|   356k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   356k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(iter.pos->type) == PB_HTYPE_REQUIRED
  ------------------
  |  |  191|   712k|#define PB_HTYPE_REQUIRED 0x00
  ------------------
  |  Branch (1015:13): [True: 0, False: 356k]
  ------------------
 1016|   356k|            && iter.required_field_index < PB_MAX_REQUIRED_FIELDS)
  ------------------
  |  |  136|      0|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
  |  Branch (1016:16): [True: 0, False: 0]
  ------------------
 1017|      0|        {
 1018|      0|            uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31));
 1019|      0|            fields_seen[iter.required_field_index >> 5] |= tmp;
 1020|      0|        }
 1021|       |
 1022|   356k|        if (!decode_field(stream, wire_type, &iter))
  ------------------
  |  Branch (1022:13): [True: 1.09k, False: 355k]
  ------------------
 1023|  1.09k|            return false;
 1024|   356k|    }
 1025|       |
 1026|       |    /* Check that all elements of the last decoded fixed count field were present. */
 1027|  99.8k|    if (fixed_count_field != NULL &&
  ------------------
  |  Branch (1027:9): [True: 0, False: 99.8k]
  ------------------
 1028|  99.8k|        fixed_count_size != fixed_count_field->array_size)
  ------------------
  |  Branch (1028:9): [True: 0, False: 0]
  ------------------
 1029|      0|    {
 1030|      0|        PB_RETURN_ERROR(stream, "wrong size for fixed count field");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1031|      0|    }
 1032|       |
 1033|       |    /* Check that all required fields were present. */
 1034|  99.8k|    {
 1035|       |        /* First figure out the number of required fields by
 1036|       |         * seeking to the end of the field array. Usually we
 1037|       |         * are already close to end after decoding.
 1038|       |         */
 1039|  99.8k|        unsigned req_field_count;
 1040|  99.8k|        pb_type_t last_type;
 1041|  99.8k|        unsigned i;
 1042|   205k|        do {
 1043|   205k|            req_field_count = iter.required_field_index;
 1044|   205k|            last_type = iter.pos->type;
 1045|   205k|        } while (pb_field_iter_next(&iter));
  ------------------
  |  Branch (1045:18): [True: 105k, False: 99.8k]
  ------------------
 1046|       |        
 1047|       |        /* Fixup if last field was also required. */
 1048|  99.8k|        if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.pos->tag != 0)
  ------------------
  |  |  205|  99.8k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  99.8k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(last_type) == PB_HTYPE_REQUIRED && iter.pos->tag != 0)
  ------------------
  |  |  191|   199k|#define PB_HTYPE_REQUIRED 0x00
  ------------------
  |  Branch (1048:13): [True: 0, False: 99.8k]
  |  Branch (1048:57): [True: 0, False: 0]
  ------------------
 1049|      0|            req_field_count++;
 1050|       |        
 1051|  99.8k|        if (req_field_count > PB_MAX_REQUIRED_FIELDS)
  ------------------
  |  |  136|  99.8k|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
  |  Branch (1051:13): [True: 0, False: 99.8k]
  ------------------
 1052|      0|            req_field_count = PB_MAX_REQUIRED_FIELDS;
  ------------------
  |  |  136|      0|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
 1053|       |
 1054|  99.8k|        if (req_field_count > 0)
  ------------------
  |  Branch (1054:13): [True: 0, False: 99.8k]
  ------------------
 1055|      0|        {
 1056|       |            /* Check the whole words */
 1057|      0|            for (i = 0; i < (req_field_count >> 5); i++)
  ------------------
  |  Branch (1057:25): [True: 0, False: 0]
  ------------------
 1058|      0|            {
 1059|      0|                if (fields_seen[i] != allbits)
  ------------------
  |  Branch (1059:21): [True: 0, False: 0]
  ------------------
 1060|      0|                    PB_RETURN_ERROR(stream, "missing required field");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1061|      0|            }
 1062|       |            
 1063|       |            /* Check the remaining bits (if any) */
 1064|      0|            if ((req_field_count & 31) != 0)
  ------------------
  |  Branch (1064:17): [True: 0, False: 0]
  ------------------
 1065|      0|            {
 1066|      0|                if (fields_seen[req_field_count >> 5] !=
  ------------------
  |  Branch (1066:21): [True: 0, False: 0]
  ------------------
 1067|      0|                    (allbits >> (32 - (req_field_count & 31))))
 1068|      0|                {
 1069|      0|                    PB_RETURN_ERROR(stream, "missing required field");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1070|      0|                }
 1071|      0|            }
 1072|      0|        }
 1073|  99.8k|    }
 1074|       |    
 1075|  99.8k|    return true;
 1076|  99.8k|}
pb_decode:
 1079|  68.9k|{
 1080|  68.9k|    bool status;
 1081|  68.9k|    pb_message_set_to_defaults(fields, dest_struct);
 1082|  68.9k|    status = pb_decode_noinit(stream, fields, dest_struct);
 1083|       |    
 1084|  68.9k|#ifdef PB_ENABLE_MALLOC
 1085|  68.9k|    if (!status)
  ------------------
  |  Branch (1085:9): [True: 1.13k, False: 67.7k]
  ------------------
 1086|  1.13k|        pb_release(fields, dest_struct);
 1087|  68.9k|#endif
 1088|       |    
 1089|  68.9k|    return status;
 1090|  68.9k|}
pb_release:
 1256|   161k|{
 1257|   161k|    pb_field_iter_t iter;
 1258|       |    
 1259|   161k|    if (!dest_struct)
  ------------------
  |  Branch (1259:9): [True: 0, False: 161k]
  ------------------
 1260|      0|        return; /* Ignore NULL pointers, similar to free() */
 1261|       |
 1262|   161k|    if (!pb_field_iter_begin(&iter, fields, dest_struct))
  ------------------
  |  Branch (1262:9): [True: 0, False: 161k]
  ------------------
 1263|      0|        return; /* Empty message type */
 1264|       |    
 1265|   161k|    do
 1266|   945k|    {
 1267|   945k|        pb_release_single_field(&iter);
 1268|   945k|    } while (pb_field_iter_next(&iter));
  ------------------
  |  Branch (1268:14): [True: 784k, False: 161k]
  ------------------
 1269|   161k|}
pb_decode_fixed64:
 1309|  17.8k|{
 1310|  17.8k|    pb_byte_t bytes[8];
 1311|       |
 1312|  17.8k|    if (!pb_read(stream, bytes, 8))
  ------------------
  |  Branch (1312:9): [True: 23, False: 17.8k]
  ------------------
 1313|     23|        return false;
 1314|       |    
 1315|  17.8k|    *(uint64_t*)dest = ((uint64_t)bytes[0] << 0) |
 1316|  17.8k|                       ((uint64_t)bytes[1] << 8) |
 1317|  17.8k|                       ((uint64_t)bytes[2] << 16) |
 1318|  17.8k|                       ((uint64_t)bytes[3] << 24) |
 1319|  17.8k|                       ((uint64_t)bytes[4] << 32) |
 1320|  17.8k|                       ((uint64_t)bytes[5] << 40) |
 1321|  17.8k|                       ((uint64_t)bytes[6] << 48) |
 1322|  17.8k|                       ((uint64_t)bytes[7] << 56);
 1323|       |    
 1324|  17.8k|    return true;
 1325|  17.8k|}
pb_decode.c:buf_read:
   88|   949k|{
   89|   949k|    size_t i;
   90|   949k|    const pb_byte_t *source = (const pb_byte_t*)stream->state;
   91|   949k|    stream->state = (pb_byte_t*)stream->state + count;
   92|       |    
   93|   949k|    if (buf != NULL)
  ------------------
  |  Branch (93:9): [True: 879k, False: 70.4k]
  ------------------
   94|   879k|    {
   95|  4.25M|        for (i = 0; i < count; i++)
  ------------------
  |  Branch (95:21): [True: 3.38M, False: 879k]
  ------------------
   96|  3.38M|            buf[i] = source[i];
   97|   879k|    }
   98|       |    
   99|   949k|    return true;
  100|   949k|}
pb_decode.c:pb_decode_varint32_eof:
  188|   596k|{
  189|   596k|    pb_byte_t byte;
  190|   596k|    uint32_t result;
  191|       |    
  192|   596k|    if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (192:9): [True: 196, False: 596k]
  ------------------
  193|    196|    {
  194|    196|        if (stream->bytes_left == 0)
  ------------------
  |  Branch (194:13): [True: 196, False: 0]
  ------------------
  195|    196|        {
  196|    196|            if (eof)
  ------------------
  |  Branch (196:17): [True: 0, False: 196]
  ------------------
  197|      0|            {
  198|      0|                *eof = true;
  199|      0|            }
  200|    196|        }
  201|       |
  202|    196|        return false;
  203|    196|    }
  204|       |    
  205|   596k|    if ((byte & 0x80) == 0)
  ------------------
  |  Branch (205:9): [True: 582k, False: 13.7k]
  ------------------
  206|   582k|    {
  207|       |        /* Quick case, 1 byte value */
  208|   582k|        result = byte;
  209|   582k|    }
  210|  13.7k|    else
  211|  13.7k|    {
  212|       |        /* Multibyte case */
  213|  13.7k|        uint_fast8_t bitpos = 7;
  214|  13.7k|        result = byte & 0x7F;
  215|       |        
  216|  13.7k|        do
  217|  20.9k|        {
  218|  20.9k|            if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (218:17): [True: 58, False: 20.8k]
  ------------------
  219|     58|                return false;
  220|       |            
  221|  20.8k|            if (bitpos >= 32)
  ------------------
  |  Branch (221:17): [True: 1.71k, False: 19.1k]
  ------------------
  222|  1.71k|            {
  223|       |                /* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */
  224|  1.71k|                uint8_t sign_extension = (bitpos < 63) ? 0xFF : 0x01;
  ------------------
  |  Branch (224:42): [True: 544, False: 1.16k]
  ------------------
  225|       |                
  226|  1.71k|                if ((byte & 0x7F) != 0x00 && ((result >> 31) == 0 || byte != sign_extension))
  ------------------
  |  Branch (226:21): [True: 341, False: 1.37k]
  |  Branch (226:47): [True: 24, False: 317]
  |  Branch (226:70): [True: 50, False: 267]
  ------------------
  227|     74|                {
  228|     74|                    PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  597|     74|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|     74|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 74]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  229|     74|                }
  230|  1.71k|            }
  231|  19.1k|            else
  232|  19.1k|            {
  233|  19.1k|                result |= (uint32_t)(byte & 0x7F) << bitpos;
  234|  19.1k|            }
  235|  20.8k|            bitpos = (uint_fast8_t)(bitpos + 7);
  236|  20.8k|        } while (byte & 0x80);
  ------------------
  |  Branch (236:18): [True: 7.23k, False: 13.5k]
  ------------------
  237|       |        
  238|  13.5k|        if (bitpos == 35 && (byte & 0x70) != 0)
  ------------------
  |  Branch (238:13): [True: 452, False: 13.1k]
  |  Branch (238:29): [True: 7, False: 445]
  ------------------
  239|      7|        {
  240|       |            /* The last byte was at bitpos=28, so only bottom 4 bits fit. */
  241|      7|            PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  597|      7|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      7|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 7]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  242|      7|        }
  243|  13.5k|   }
  244|       |   
  245|   595k|   *dest = result;
  246|   595k|   return true;
  247|   596k|}
pb_decode.c:pb_readbyte:
  142|   831k|{
  143|   831k|    if (stream->bytes_left == 0)
  ------------------
  |  Branch (143:9): [True: 309, False: 831k]
  ------------------
  144|    309|        PB_RETURN_ERROR(stream, "end-of-stream");
  ------------------
  |  |  597|    309|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|    309|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 309]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  145|       |
  146|   831k|#ifndef PB_BUFFER_ONLY
  147|   831k|    if (!stream->callback(stream, buf, 1))
  ------------------
  |  Branch (147:9): [True: 0, False: 831k]
  ------------------
  148|      0|        PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  149|       |#else
  150|       |    *buf = *(const pb_byte_t*)stream->state;
  151|       |    stream->state = (pb_byte_t*)stream->state + 1;
  152|       |#endif
  153|       |
  154|   831k|    stream->bytes_left--;
  155|       |    
  156|   831k|    return true;    
  157|   831k|}
pb_decode.c:pb_skip_varint:
  279|  22.6k|{
  280|  22.6k|    pb_byte_t byte;
  281|  22.6k|    do
  282|  24.7k|    {
  283|  24.7k|        if (!pb_read(stream, &byte, 1))
  ------------------
  |  Branch (283:13): [True: 42, False: 24.7k]
  ------------------
  284|     42|            return false;
  285|  24.7k|    } while (byte & 0x80);
  ------------------
  |  Branch (285:14): [True: 2.07k, False: 22.6k]
  ------------------
  286|  22.6k|    return true;
  287|  22.6k|}
pb_decode.c:pb_skip_string:
  290|  8.05k|{
  291|  8.05k|    uint32_t length;
  292|  8.05k|    if (!pb_decode_varint32(stream, &length))
  ------------------
  |  Branch (292:9): [True: 34, False: 8.01k]
  ------------------
  293|     34|        return false;
  294|       |    
  295|  8.01k|    return pb_read(stream, NULL, length);
  296|  8.05k|}
pb_decode.c:find_extension_field:
  826|  7.46k|{
  827|  7.46k|    const pb_field_t *start = iter->pos;
  828|       |    
  829|  15.2k|    do {
  830|  15.2k|        if (PB_LTYPE(iter->pos->type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  206|  15.2k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  15.2k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(iter->pos->type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  177|  15.2k|#define PB_LTYPE_EXTENSION 0x09
  ------------------
  |  Branch (830:13): [True: 0, False: 15.2k]
  ------------------
  831|      0|            return true;
  832|  15.2k|        (void)pb_field_iter_next(iter);
  833|  15.2k|    } while (iter->pos != start);
  ------------------
  |  Branch (833:14): [True: 7.74k, False: 7.46k]
  ------------------
  834|       |    
  835|  7.46k|    return false;
  836|  7.46k|}
pb_decode.c:decode_field:
  735|   356k|{
  736|   356k|#ifdef PB_ENABLE_MALLOC
  737|       |    /* When decoding an oneof field, check if there is old data that must be
  738|       |     * released first. */
  739|   356k|    if (PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  205|   356k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   356k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(iter->pos->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  194|   356k|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (739:9): [True: 283k, False: 72.7k]
  ------------------
  740|   283k|    {
  741|   283k|        if (!pb_release_union_field(stream, iter))
  ------------------
  |  Branch (741:13): [True: 0, False: 283k]
  ------------------
  742|      0|            return false;
  743|   283k|    }
  744|   356k|#endif
  745|       |
  746|   356k|    switch (PB_ATYPE(iter->pos->type))
  ------------------
  |  |  204|   356k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   356k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
  747|   356k|    {
  748|   279k|        case PB_ATYPE_STATIC:
  ------------------
  |  |  199|   279k|#define PB_ATYPE_STATIC   0x00
  ------------------
  |  Branch (748:9): [True: 279k, False: 76.8k]
  ------------------
  749|   279k|            return decode_static_field(stream, wire_type, iter);
  750|       |        
  751|  76.8k|        case PB_ATYPE_POINTER:
  ------------------
  |  |  200|  76.8k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (751:9): [True: 76.8k, False: 279k]
  ------------------
  752|  76.8k|            return decode_pointer_field(stream, wire_type, iter);
  753|       |        
  754|      0|        case PB_ATYPE_CALLBACK:
  ------------------
  |  |  201|      0|#define PB_ATYPE_CALLBACK 0x40
  ------------------
  |  Branch (754:9): [True: 0, False: 356k]
  ------------------
  755|      0|            return decode_callback_field(stream, wire_type, iter);
  756|       |        
  757|      0|        default:
  ------------------
  |  Branch (757:9): [True: 0, False: 356k]
  ------------------
  758|      0|            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  759|   356k|    }
  760|   356k|}
pb_decode.c:pb_release_union_field:
 1132|   283k|{
 1133|   283k|    pb_size_t old_tag = *(pb_size_t*)iter->pSize; /* Previous which_ value */
 1134|   283k|    pb_size_t new_tag = iter->pos->tag; /* New which_ value */
 1135|       |
 1136|   283k|    if (old_tag == 0)
  ------------------
  |  Branch (1136:9): [True: 3.29k, False: 280k]
  ------------------
 1137|  3.29k|        return true; /* Ok, no old data in union */
 1138|       |
 1139|   280k|    if (old_tag == new_tag)
  ------------------
  |  Branch (1139:9): [True: 174k, False: 106k]
  ------------------
 1140|   174k|        return true; /* Ok, old data is of same type => merge */
 1141|       |
 1142|       |    /* Release old data. The find can fail if the message struct contains
 1143|       |     * invalid data. */
 1144|   106k|    if (!pb_field_iter_find(iter, old_tag))
  ------------------
  |  Branch (1144:9): [True: 0, False: 106k]
  ------------------
 1145|      0|        PB_RETURN_ERROR(stream, "invalid union tag");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1146|       |
 1147|   106k|    pb_release_single_field(iter);
 1148|       |
 1149|       |    /* Restore iterator to where it should be.
 1150|       |     * This shouldn't fail unless the pb_field_t structure is corrupted. */
 1151|   106k|    if (!pb_field_iter_find(iter, new_tag))
  ------------------
  |  Branch (1151:9): [True: 0, False: 106k]
  ------------------
 1152|      0|        PB_RETURN_ERROR(stream, "iterator error");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1153|       |
 1154|   106k|    if (PB_ATYPE(iter->pos->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|   106k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   106k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(iter->pos->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|   106k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (1154:9): [True: 5.10k, False: 101k]
  ------------------
 1155|  5.10k|    {
 1156|       |        /* Initialize the pointer to NULL to make sure it is valid
 1157|       |         * even in case of error return. */
 1158|  5.10k|        *(void**)iter->pData = NULL;
 1159|  5.10k|    }
 1160|       |
 1161|   106k|    return true;
 1162|   106k|}
pb_decode.c:decode_static_field:
  407|   279k|{
  408|   279k|    pb_type_t type;
  409|   279k|    pb_decoder_t func;
  410|       |    
  411|   279k|    type = iter->pos->type;
  412|   279k|    func = PB_DECODERS[PB_LTYPE(type)];
  ------------------
  |  |  206|   279k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   279k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
  413|       |
  414|   279k|    switch (PB_HTYPE(type))
  ------------------
  |  |  205|   279k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   279k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
  415|   279k|    {
  416|      0|        case PB_HTYPE_REQUIRED:
  ------------------
  |  |  191|      0|#define PB_HTYPE_REQUIRED 0x00
  ------------------
  |  Branch (416:9): [True: 0, False: 279k]
  ------------------
  417|      0|            return func(stream, iter->pos, iter->pData);
  418|       |            
  419|  2.45k|        case PB_HTYPE_OPTIONAL:
  ------------------
  |  |  192|  2.45k|#define PB_HTYPE_OPTIONAL 0x10
  ------------------
  |  Branch (419:9): [True: 2.45k, False: 277k]
  ------------------
  420|  2.45k|            if (iter->pSize != iter->pData)
  ------------------
  |  Branch (420:17): [True: 0, False: 2.45k]
  ------------------
  421|      0|                *(bool*)iter->pSize = true;
  422|  2.45k|            return func(stream, iter->pos, iter->pData);
  423|       |    
  424|      0|        case PB_HTYPE_REPEATED:
  ------------------
  |  |  193|      0|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (424:9): [True: 0, False: 279k]
  ------------------
  425|      0|            if (wire_type == PB_WT_STRING
  ------------------
  |  Branch (425:17): [True: 0, False: 0]
  ------------------
  426|      0|                && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  206|      0|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|      0|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                              && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  161|      0|#define PB_LTYPE_LAST_PACKABLE 0x05
  ------------------
  |  Branch (426:20): [True: 0, False: 0]
  ------------------
  427|      0|            {
  428|       |                /* Packed array */
  429|      0|                bool status = true;
  430|      0|                pb_size_t *size = (pb_size_t*)iter->pSize;
  431|       |
  432|      0|                pb_istream_t substream;
  433|      0|                if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (433:21): [True: 0, False: 0]
  ------------------
  434|      0|                    return false;
  435|       |
  436|      0|                while (substream.bytes_left > 0 && *size < iter->pos->array_size)
  ------------------
  |  Branch (436:24): [True: 0, False: 0]
  |  Branch (436:52): [True: 0, False: 0]
  ------------------
  437|      0|                {
  438|      0|                    void *pItem = (char*)iter->pData + iter->pos->data_size * (*size);
  439|      0|                    if (!func(&substream, iter->pos, pItem))
  ------------------
  |  Branch (439:25): [True: 0, False: 0]
  ------------------
  440|      0|                    {
  441|      0|                        status = false;
  442|      0|                        break;
  443|      0|                    }
  444|      0|                    (*size)++;
  445|      0|                }
  446|       |
  447|      0|                if (substream.bytes_left != 0)
  ------------------
  |  Branch (447:21): [True: 0, False: 0]
  ------------------
  448|      0|                    PB_RETURN_ERROR(stream, "array overflow");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  449|      0|                if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (449:21): [True: 0, False: 0]
  ------------------
  450|      0|                    return false;
  451|       |
  452|      0|                return status;
  453|      0|            }
  454|      0|            else
  455|      0|            {
  456|       |                /* Repeated field */
  457|      0|                pb_size_t *size = (pb_size_t*)iter->pSize;
  458|      0|                char *pItem = (char*)iter->pData + iter->pos->data_size * (*size);
  459|       |
  460|      0|                if ((*size)++ >= iter->pos->array_size)
  ------------------
  |  Branch (460:21): [True: 0, False: 0]
  ------------------
  461|      0|                    PB_RETURN_ERROR(stream, "array overflow");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  462|       |
  463|      0|                return func(stream, iter->pos, pItem);
  464|      0|            }
  465|       |
  466|   277k|        case PB_HTYPE_ONEOF:
  ------------------
  |  |  194|   277k|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (466:9): [True: 277k, False: 2.45k]
  ------------------
  467|   277k|            if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
  ------------------
  |  |  206|   277k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   277k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
  ------------------
  |  |  173|   554k|#define PB_LTYPE_SUBMESSAGE 0x08
  ------------------
  |  Branch (467:17): [True: 30.7k, False: 246k]
  ------------------
  468|   277k|                *(pb_size_t*)iter->pSize != iter->pos->tag)
  ------------------
  |  Branch (468:17): [True: 24.5k, False: 6.26k]
  ------------------
  469|  24.5k|            {
  470|       |                /* We memset to zero so that any callbacks are set to NULL.
  471|       |                 * This is because the callbacks might otherwise have values
  472|       |                 * from some other union field. */
  473|  24.5k|                memset(iter->pData, 0, iter->pos->data_size);
  474|  24.5k|                pb_message_set_to_defaults((const pb_field_t*)iter->pos->ptr, iter->pData);
  475|  24.5k|            }
  476|   277k|            *(pb_size_t*)iter->pSize = iter->pos->tag;
  477|       |
  478|   277k|            return func(stream, iter->pos, iter->pData);
  479|       |
  480|      0|        default:
  ------------------
  |  Branch (480:9): [True: 0, False: 279k]
  ------------------
  481|      0|            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  482|   279k|    }
  483|   279k|}
pb_decode.c:pb_dec_varint:
 1340|   148k|{
 1341|   148k|    pb_uint64_t value;
  ------------------
  |  |   62|   148k|#define pb_uint64_t uint64_t
  ------------------
 1342|   148k|    pb_int64_t svalue;
  ------------------
  |  |   61|   148k|#define pb_int64_t int64_t
  ------------------
 1343|   148k|    pb_int64_t clamped;
  ------------------
  |  |   61|   148k|#define pb_int64_t int64_t
  ------------------
 1344|   148k|    if (!pb_decode_varint(stream, &value))
  ------------------
  |  Branch (1344:9): [True: 37, False: 148k]
  ------------------
 1345|     37|        return false;
 1346|       |    
 1347|       |    /* See issue 97: Google's C++ protobuf allows negative varint values to
 1348|       |     * be cast as int32_t, instead of the int64_t that should be used when
 1349|       |     * encoding. Previous nanopb versions had a bug in encoding. In order to
 1350|       |     * not break decoding of such messages, we cast <=32 bit fields to
 1351|       |     * int32_t first to get the sign correct.
 1352|       |     */
 1353|   148k|    if (field->data_size == sizeof(pb_int64_t))
  ------------------
  |  Branch (1353:9): [True: 147k, False: 432]
  ------------------
 1354|   147k|        svalue = (pb_int64_t)value;
 1355|    432|    else
 1356|    432|        svalue = (int32_t)value;
 1357|       |
 1358|       |    /* Cast to the proper field size, while checking for overflows */
 1359|   148k|    if (field->data_size == sizeof(pb_int64_t))
  ------------------
  |  Branch (1359:9): [True: 147k, False: 432]
  ------------------
 1360|   147k|        clamped = *(pb_int64_t*)dest = svalue;
 1361|    432|    else if (field->data_size == sizeof(int32_t))
  ------------------
  |  Branch (1361:14): [True: 432, False: 0]
  ------------------
 1362|    432|        clamped = *(int32_t*)dest = (int32_t)svalue;
 1363|      0|    else if (field->data_size == sizeof(int_least16_t))
  ------------------
  |  Branch (1363:14): [True: 0, False: 0]
  ------------------
 1364|      0|        clamped = *(int_least16_t*)dest = (int_least16_t)svalue;
 1365|      0|    else if (field->data_size == sizeof(int_least8_t))
  ------------------
  |  Branch (1365:14): [True: 0, False: 0]
  ------------------
 1366|      0|        clamped = *(int_least8_t*)dest = (int_least8_t)svalue;
 1367|      0|    else
 1368|      0|        PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1369|       |
 1370|   148k|    if (clamped != svalue)
  ------------------
  |  Branch (1370:9): [True: 0, False: 148k]
  ------------------
 1371|      0|        PB_RETURN_ERROR(stream, "integer too large");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1372|       |    
 1373|   148k|    return true;
 1374|   148k|}
pb_decode.c:pb_dec_uvarint:
 1377|  54.2k|{
 1378|  54.2k|    pb_uint64_t value, clamped;
  ------------------
  |  |   62|  54.2k|#define pb_uint64_t uint64_t
  ------------------
 1379|  54.2k|    if (!pb_decode_varint(stream, &value))
  ------------------
  |  Branch (1379:9): [True: 25, False: 54.2k]
  ------------------
 1380|     25|        return false;
 1381|       |    
 1382|       |    /* Cast to the proper field size, while checking for overflows */
 1383|  54.2k|    if (field->data_size == sizeof(pb_uint64_t))
  ------------------
  |  Branch (1383:9): [True: 0, False: 54.2k]
  ------------------
 1384|      0|        clamped = *(pb_uint64_t*)dest = value;
 1385|  54.2k|    else if (field->data_size == sizeof(uint32_t))
  ------------------
  |  Branch (1385:14): [True: 54.2k, False: 0]
  ------------------
 1386|  54.2k|        clamped = *(uint32_t*)dest = (uint32_t)value;
 1387|      0|    else if (field->data_size == sizeof(uint_least16_t))
  ------------------
  |  Branch (1387:14): [True: 0, False: 0]
  ------------------
 1388|      0|        clamped = *(uint_least16_t*)dest = (uint_least16_t)value;
 1389|      0|    else if (field->data_size == sizeof(uint_least8_t))
  ------------------
  |  Branch (1389:14): [True: 0, False: 0]
  ------------------
 1390|      0|        clamped = *(uint_least8_t*)dest = (uint_least8_t)value;
 1391|      0|    else
 1392|      0|        PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1393|       |    
 1394|  54.2k|    if (clamped != value)
  ------------------
  |  Branch (1394:9): [True: 65, False: 54.1k]
  ------------------
 1395|     65|        PB_RETURN_ERROR(stream, "integer too large");
  ------------------
  |  |  597|     65|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|     65|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 65]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1396|       |
 1397|  54.1k|    return true;
 1398|  54.2k|}
pb_decode.c:pb_dec_fixed64:
 1431|  17.8k|{
 1432|  17.8k|    PB_UNUSED(field);
  ------------------
  |  |  112|  17.8k|#define PB_UNUSED(x) (void)(x)
  ------------------
 1433|  17.8k|#ifndef PB_WITHOUT_64BIT
 1434|  17.8k|    return pb_decode_fixed64(stream, dest);
 1435|       |#else
 1436|       |    PB_UNUSED(dest);
 1437|       |    PB_RETURN_ERROR(stream, "no 64bit support");
 1438|       |#endif
 1439|  17.8k|}
pb_decode.c:pb_dec_bytes:
 1442|  9.08k|{
 1443|  9.08k|    uint32_t size;
 1444|  9.08k|    size_t alloc_size;
 1445|  9.08k|    pb_bytes_array_t *bdest;
 1446|       |    
 1447|  9.08k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (1447:9): [True: 42, False: 9.04k]
  ------------------
 1448|     42|        return false;
 1449|       |    
 1450|  9.04k|    if (size > PB_SIZE_MAX)
  ------------------
  |  |  221|  9.04k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (1450:9): [True: 0, False: 9.04k]
  ------------------
 1451|      0|        PB_RETURN_ERROR(stream, "bytes overflow");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1452|       |    
 1453|  9.04k|    alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size);
  ------------------
  |  |  270|  9.04k|#define PB_BYTES_ARRAY_T_ALLOCSIZE(n) ((size_t)n + offsetof(pb_bytes_array_t, bytes))
  ------------------
 1454|  9.04k|    if (size > alloc_size)
  ------------------
  |  Branch (1454:9): [True: 0, False: 9.04k]
  ------------------
 1455|      0|        PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1456|       |    
 1457|  9.04k|    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|  9.04k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|  9.04k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|  9.04k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (1457:9): [True: 9.04k, False: 0]
  ------------------
 1458|  9.04k|    {
 1459|       |#ifndef PB_ENABLE_MALLOC
 1460|       |        PB_RETURN_ERROR(stream, "no malloc support");
 1461|       |#else
 1462|  9.04k|        if (stream->bytes_left < size)
  ------------------
  |  Branch (1462:13): [True: 46, False: 8.99k]
  ------------------
 1463|     46|            PB_RETURN_ERROR(stream, "end-of-stream");
  ------------------
  |  |  597|     46|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|     46|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1464|       |
 1465|  8.99k|        if (!allocate_field(stream, dest, alloc_size, 1))
  ------------------
  |  Branch (1465:13): [True: 0, False: 8.99k]
  ------------------
 1466|      0|            return false;
 1467|  8.99k|        bdest = *(pb_bytes_array_t**)dest;
 1468|  8.99k|#endif
 1469|  8.99k|    }
 1470|      0|    else
 1471|      0|    {
 1472|      0|        if (alloc_size > field->data_size)
  ------------------
  |  Branch (1472:13): [True: 0, False: 0]
  ------------------
 1473|      0|            PB_RETURN_ERROR(stream, "bytes overflow");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1474|      0|        bdest = (pb_bytes_array_t*)dest;
 1475|      0|    }
 1476|       |
 1477|  8.99k|    bdest->size = (pb_size_t)size;
 1478|  8.99k|    return pb_read(stream, bdest->bytes, size);
 1479|  9.04k|}
pb_decode.c:allocate_field:
  491|  76.7k|{    
  492|  76.7k|    void *ptr = *(void**)pData;
  493|       |    
  494|  76.7k|    if (data_size == 0 || array_size == 0)
  ------------------
  |  Branch (494:9): [True: 0, False: 76.7k]
  |  Branch (494:27): [True: 0, False: 76.7k]
  ------------------
  495|      0|        PB_RETURN_ERROR(stream, "invalid size");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  496|       |    
  497|       |#ifdef __AVR__
  498|       |    /* Workaround for AVR libc bug 53284: http://savannah.nongnu.org/bugs/?53284
  499|       |     * Realloc to size of 1 byte can cause corruption of the malloc structures.
  500|       |     */
  501|       |    if (data_size == 1 && array_size == 1)
  502|       |    {
  503|       |        data_size = 2;
  504|       |    }
  505|       |#endif
  506|       |
  507|       |    /* Check for multiplication overflows.
  508|       |     * This code avoids the costly division if the sizes are small enough.
  509|       |     * Multiplication is safe as long as only half of bits are set
  510|       |     * in either multiplicand.
  511|       |     */
  512|  76.7k|    {
  513|  76.7k|        const size_t check_limit = (size_t)1 << (sizeof(size_t) * 4);
  514|  76.7k|        if (data_size >= check_limit || array_size >= check_limit)
  ------------------
  |  Branch (514:13): [True: 0, False: 76.7k]
  |  Branch (514:41): [True: 0, False: 76.7k]
  ------------------
  515|      0|        {
  516|      0|            const size_t size_max = (size_t)-1;
  517|      0|            if (size_max / array_size < data_size)
  ------------------
  |  Branch (517:17): [True: 0, False: 0]
  ------------------
  518|      0|            {
  519|      0|                PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  520|      0|            }
  521|      0|        }
  522|  76.7k|    }
  523|       |    
  524|       |    /* Allocate new or expand previous allocation */
  525|       |    /* Note: on failure the old pointer will remain in the structure,
  526|       |     * the message must be freed by caller also on error return. */
  527|  76.7k|    ptr = pb_realloc(ptr, array_size * data_size);
  ------------------
  |  |  379|  76.7k|#       define pb_realloc(ptr, size) realloc(ptr, size)
  ------------------
  528|  76.7k|    if (ptr == NULL)
  ------------------
  |  Branch (528:9): [True: 0, False: 76.7k]
  ------------------
  529|      0|        PB_RETURN_ERROR(stream, "realloc failed");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  530|       |    
  531|  76.7k|    *(void**)pData = ptr;
  532|  76.7k|    return true;
  533|  76.7k|}
pb_decode.c:pb_dec_submessage:
 1520|   100k|{
 1521|   100k|    bool status;
 1522|   100k|    pb_istream_t substream;
 1523|   100k|    const pb_field_t* submsg_fields = (const pb_field_t*)field->ptr;
 1524|       |    
 1525|   100k|    if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (1525:9): [True: 185, False: 100k]
  ------------------
 1526|    185|        return false;
 1527|       |    
 1528|   100k|    if (field->ptr == NULL)
  ------------------
  |  Branch (1528:9): [True: 0, False: 100k]
  ------------------
 1529|      0|        PB_RETURN_ERROR(stream, "invalid field descriptor");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1530|       |    
 1531|       |    /* New array entries need to be initialized, while required and optional
 1532|       |     * submessages have already been initialized in the top-level pb_decode. */
 1533|   100k|    if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  205|   100k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   100k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  193|   100k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (1533:9): [True: 67.6k, False: 32.4k]
  ------------------
 1534|  67.6k|        status = pb_decode(&substream, submsg_fields, dest);
 1535|  32.4k|    else
 1536|  32.4k|        status = pb_decode_noinit(&substream, submsg_fields, dest);
 1537|       |    
 1538|   100k|    if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (1538:9): [True: 0, False: 100k]
  ------------------
 1539|      0|        return false;
 1540|   100k|    return status;
 1541|   100k|}
pb_decode.c:decode_pointer_field:
  554|  76.8k|{
  555|       |#ifndef PB_ENABLE_MALLOC
  556|       |    PB_UNUSED(wire_type);
  557|       |    PB_UNUSED(iter);
  558|       |    PB_RETURN_ERROR(stream, "no malloc support");
  559|       |#else
  560|  76.8k|    pb_type_t type;
  561|  76.8k|    pb_decoder_t func;
  562|       |    
  563|  76.8k|    type = iter->pos->type;
  564|  76.8k|    func = PB_DECODERS[PB_LTYPE(type)];
  ------------------
  |  |  206|  76.8k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  76.8k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
  565|       |    
  566|  76.8k|    switch (PB_HTYPE(type))
  ------------------
  |  |  205|  76.8k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  76.8k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
  567|  76.8k|    {
  568|      0|        case PB_HTYPE_REQUIRED:
  ------------------
  |  |  191|      0|#define PB_HTYPE_REQUIRED 0x00
  ------------------
  |  Branch (568:9): [True: 0, False: 76.8k]
  ------------------
  569|  2.52k|        case PB_HTYPE_OPTIONAL:
  ------------------
  |  |  192|  2.52k|#define PB_HTYPE_OPTIONAL 0x10
  ------------------
  |  Branch (569:9): [True: 2.52k, False: 74.3k]
  ------------------
  570|  9.08k|        case PB_HTYPE_ONEOF:
  ------------------
  |  |  194|  9.08k|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (570:9): [True: 6.55k, False: 70.2k]
  ------------------
  571|  9.08k|            if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
  ------------------
  |  |  206|  9.08k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  9.08k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE &&
  ------------------
  |  |  173|  18.1k|#define PB_LTYPE_SUBMESSAGE 0x08
  ------------------
  |  Branch (571:17): [True: 0, False: 9.08k]
  ------------------
  572|  9.08k|                *(void**)iter->pData != NULL)
  ------------------
  |  Branch (572:17): [True: 0, False: 0]
  ------------------
  573|      0|            {
  574|       |                /* Duplicate field, have to release the old allocation first. */
  575|      0|                pb_release_single_field(iter);
  576|      0|            }
  577|       |        
  578|  9.08k|            if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  205|  9.08k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  9.08k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                          if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  194|  9.08k|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (578:17): [True: 6.55k, False: 2.52k]
  ------------------
  579|  6.55k|            {
  580|  6.55k|                *(pb_size_t*)iter->pSize = iter->pos->tag;
  581|  6.55k|            }
  582|       |
  583|  9.08k|            if (PB_LTYPE(type) == PB_LTYPE_STRING ||
  ------------------
  |  |  206|  9.08k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  9.08k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(type) == PB_LTYPE_STRING ||
  ------------------
  |  |  169|  18.1k|#define PB_LTYPE_STRING 0x07
  ------------------
  |  Branch (583:17): [True: 0, False: 9.08k]
  ------------------
  584|  9.08k|                PB_LTYPE(type) == PB_LTYPE_BYTES)
  ------------------
  |  |  206|  9.08k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  9.08k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                              PB_LTYPE(type) == PB_LTYPE_BYTES)
  ------------------
  |  |  165|  9.08k|#define PB_LTYPE_BYTES 0x06
  ------------------
  |  Branch (584:17): [True: 9.08k, False: 0]
  ------------------
  585|  9.08k|            {
  586|  9.08k|                return func(stream, iter->pos, iter->pData);
  587|  9.08k|            }
  588|      0|            else
  589|      0|            {
  590|      0|                if (!allocate_field(stream, iter->pData, iter->pos->data_size, 1))
  ------------------
  |  Branch (590:21): [True: 0, False: 0]
  ------------------
  591|      0|                    return false;
  592|       |                
  593|      0|                initialize_pointer_field(*(void**)iter->pData, iter);
  594|      0|                return func(stream, iter->pos, *(void**)iter->pData);
  595|      0|            }
  596|       |    
  597|  67.7k|        case PB_HTYPE_REPEATED:
  ------------------
  |  |  193|  67.7k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (597:9): [True: 67.7k, False: 9.08k]
  ------------------
  598|  67.7k|            if (wire_type == PB_WT_STRING
  ------------------
  |  Branch (598:17): [True: 59.9k, False: 7.81k]
  ------------------
  599|  67.7k|                && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  206|  59.9k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  59.9k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                              && PB_LTYPE(type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  161|  59.9k|#define PB_LTYPE_LAST_PACKABLE 0x05
  ------------------
  |  Branch (599:20): [True: 0, False: 59.9k]
  ------------------
  600|      0|            {
  601|       |                /* Packed array, multiple items come in at once. */
  602|      0|                bool status = true;
  603|      0|                pb_size_t *size = (pb_size_t*)iter->pSize;
  604|      0|                size_t allocated_size = *size;
  605|      0|                void *pItem;
  606|      0|                pb_istream_t substream;
  607|       |                
  608|      0|                if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (608:21): [True: 0, False: 0]
  ------------------
  609|      0|                    return false;
  610|       |                
  611|      0|                while (substream.bytes_left)
  ------------------
  |  Branch (611:24): [True: 0, False: 0]
  ------------------
  612|      0|                {
  613|      0|                    if (*size == PB_SIZE_MAX)
  ------------------
  |  |  221|      0|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (613:25): [True: 0, False: 0]
  ------------------
  614|      0|                    {
  615|      0|#ifndef PB_NO_ERRMSG
  616|      0|                        stream->errmsg = "too many array entries";
  617|      0|#endif
  618|      0|                        status = false;
  619|      0|                        break;
  620|      0|                    }
  621|       |
  622|      0|                    if ((size_t)*size + 1 > allocated_size)
  ------------------
  |  Branch (622:25): [True: 0, False: 0]
  ------------------
  623|      0|                    {
  624|       |                        /* Allocate more storage. This tries to guess the
  625|       |                         * number of remaining entries. Round the division
  626|       |                         * upwards. */
  627|      0|                        size_t remain = (substream.bytes_left - 1) / iter->pos->data_size + 1;
  628|      0|                        if (remain < PB_SIZE_MAX - allocated_size)
  ------------------
  |  |  221|      0|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (628:29): [True: 0, False: 0]
  ------------------
  629|      0|                            allocated_size += remain;
  630|      0|                        else
  631|      0|                            allocated_size += 1;
  632|       |                        
  633|      0|                        if (!allocate_field(&substream, iter->pData, iter->pos->data_size, allocated_size))
  ------------------
  |  Branch (633:29): [True: 0, False: 0]
  ------------------
  634|      0|                        {
  635|      0|                            status = false;
  636|      0|                            break;
  637|      0|                        }
  638|      0|                    }
  639|       |
  640|       |                    /* Decode the array entry */
  641|      0|                    pItem = *(char**)iter->pData + iter->pos->data_size * (*size);
  642|      0|                    initialize_pointer_field(pItem, iter);
  643|      0|                    if (!func(&substream, iter->pos, pItem))
  ------------------
  |  Branch (643:25): [True: 0, False: 0]
  ------------------
  644|      0|                    {
  645|      0|                        status = false;
  646|      0|                        break;
  647|      0|                    }
  648|       |                    
  649|      0|                    (*size)++;
  650|      0|                }
  651|      0|                if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (651:21): [True: 0, False: 0]
  ------------------
  652|      0|                    return false;
  653|       |                
  654|      0|                return status;
  655|      0|            }
  656|  67.7k|            else
  657|  67.7k|            {
  658|       |                /* Normal repeated field, i.e. only one item at a time. */
  659|  67.7k|                pb_size_t *size = (pb_size_t*)iter->pSize;
  660|  67.7k|                void *pItem;
  661|       |                
  662|  67.7k|                if (*size == PB_SIZE_MAX)
  ------------------
  |  |  221|  67.7k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (662:21): [True: 0, False: 67.7k]
  ------------------
  663|      0|                    PB_RETURN_ERROR(stream, "too many array entries");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  664|       |                
  665|  67.7k|                if (!allocate_field(stream, iter->pData, iter->pos->data_size, (size_t)(*size + 1)))
  ------------------
  |  Branch (665:21): [True: 0, False: 67.7k]
  ------------------
  666|      0|                    return false;
  667|       |            
  668|  67.7k|                pItem = *(char**)iter->pData + iter->pos->data_size * (*size);
  669|  67.7k|                (*size)++;
  670|  67.7k|                initialize_pointer_field(pItem, iter);
  671|  67.7k|                return func(stream, iter->pos, pItem);
  672|  67.7k|            }
  673|       |
  674|      0|        default:
  ------------------
  |  Branch (674:9): [True: 0, False: 76.8k]
  ------------------
  675|      0|            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  597|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  593|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (593:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  676|  76.8k|    }
  677|  76.8k|#endif
  678|  76.8k|}
pb_decode.c:initialize_pointer_field:
  537|  67.7k|{
  538|  67.7k|    if (PB_LTYPE(iter->pos->type) == PB_LTYPE_STRING ||
  ------------------
  |  |  206|  67.7k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  67.7k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(iter->pos->type) == PB_LTYPE_STRING ||
  ------------------
  |  |  169|   135k|#define PB_LTYPE_STRING 0x07
  ------------------
  |  Branch (538:9): [True: 0, False: 67.7k]
  ------------------
  539|  67.7k|        PB_LTYPE(iter->pos->type) == PB_LTYPE_BYTES)
  ------------------
  |  |  206|  67.7k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  67.7k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                      PB_LTYPE(iter->pos->type) == PB_LTYPE_BYTES)
  ------------------
  |  |  165|  67.7k|#define PB_LTYPE_BYTES 0x06
  ------------------
  |  Branch (539:9): [True: 0, False: 67.7k]
  ------------------
  540|      0|    {
  541|      0|        *(void**)pItem = NULL;
  542|      0|    }
  543|  67.7k|    else if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
  ------------------
  |  |  206|  67.7k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  67.7k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                  else if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
  ------------------
  |  |  173|  67.7k|#define PB_LTYPE_SUBMESSAGE 0x08
  ------------------
  |  Branch (543:14): [True: 67.7k, False: 0]
  ------------------
  544|  67.7k|    {
  545|       |        /* We memset to zero so that any callbacks are set to NULL.
  546|       |         * Then set any default values. */
  547|  67.7k|        memset(pItem, 0, iter->pos->data_size);
  548|  67.7k|        pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, pItem);
  549|  67.7k|    }
  550|  67.7k|}
pb_decode.c:pb_message_set_to_defaults:
  912|   294k|{
  913|   294k|    pb_field_iter_t iter;
  914|       |
  915|   294k|    if (!pb_field_iter_begin(&iter, fields, dest_struct))
  ------------------
  |  Branch (915:9): [True: 0, False: 294k]
  ------------------
  916|      0|        return; /* Empty message type */
  917|       |    
  918|   294k|    do
  919|  1.81M|    {
  920|  1.81M|        pb_field_set_to_default(&iter);
  921|  1.81M|    } while (pb_field_iter_next(&iter));
  ------------------
  |  Branch (921:14): [True: 1.51M, False: 294k]
  ------------------
  922|   294k|}
pb_decode.c:pb_field_set_to_default:
  840|  1.81M|{
  841|  1.81M|    pb_type_t type;
  842|  1.81M|    type = iter->pos->type;
  843|       |    
  844|  1.81M|    if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  206|  1.81M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  1.81M|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  177|  1.81M|#define PB_LTYPE_EXTENSION 0x09
  ------------------
  |  Branch (844:9): [True: 0, False: 1.81M]
  ------------------
  845|      0|    {
  846|      0|        pb_extension_t *ext = *(pb_extension_t* const *)iter->pData;
  847|      0|        while (ext != NULL)
  ------------------
  |  Branch (847:16): [True: 0, False: 0]
  ------------------
  848|      0|        {
  849|      0|            pb_field_iter_t ext_iter;
  850|      0|            ext->found = false;
  851|      0|            iter_from_extension(&ext_iter, ext);
  852|      0|            pb_field_set_to_default(&ext_iter);
  853|      0|            ext = ext->next;
  854|      0|        }
  855|      0|    }
  856|  1.81M|    else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
  ------------------
  |  |  204|  1.81M|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|  1.81M|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
  ------------------
  |  |  199|  1.81M|#define PB_ATYPE_STATIC   0x00
  ------------------
  |  Branch (856:14): [True: 1.25M, False: 551k]
  ------------------
  857|  1.25M|    {
  858|  1.25M|        bool init_data = true;
  859|  1.25M|        if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && iter->pSize != iter->pData)
  ------------------
  |  |  205|  1.25M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  1.25M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && iter->pSize != iter->pData)
  ------------------
  |  |  192|  2.51M|#define PB_HTYPE_OPTIONAL 0x10
  ------------------
  |  Branch (859:13): [True: 165k, False: 1.09M]
  |  Branch (859:52): [True: 0, False: 165k]
  ------------------
  860|      0|        {
  861|       |            /* Set has_field to false. Still initialize the optional field
  862|       |             * itself also. */
  863|      0|            *(bool*)iter->pSize = false;
  864|      0|        }
  865|  1.25M|        else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  205|  1.25M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  1.25M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  193|  2.51M|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (865:18): [True: 0, False: 1.25M]
  ------------------
  866|  1.25M|                 PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  205|  1.25M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  1.25M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                               PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  194|  1.25M|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (866:18): [True: 1.09M, False: 165k]
  ------------------
  867|  1.09M|        {
  868|       |            /* REPEATED: Set array count to 0, no need to initialize contents.
  869|       |               ONEOF: Set which_field to 0. */
  870|  1.09M|            *(pb_size_t*)iter->pSize = 0;
  871|  1.09M|            init_data = false;
  872|  1.09M|        }
  873|       |
  874|  1.25M|        if (init_data)
  ------------------
  |  Branch (874:13): [True: 165k, False: 1.09M]
  ------------------
  875|   165k|        {
  876|   165k|            if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
  ------------------
  |  |  206|   165k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   165k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(iter->pos->type) == PB_LTYPE_SUBMESSAGE)
  ------------------
  |  |  173|   165k|#define PB_LTYPE_SUBMESSAGE 0x08
  ------------------
  |  Branch (876:17): [True: 133k, False: 32.4k]
  ------------------
  877|   133k|            {
  878|       |                /* Initialize submessage to defaults */
  879|   133k|                pb_message_set_to_defaults((const pb_field_t *) iter->pos->ptr, iter->pData);
  880|   133k|            }
  881|  32.4k|            else if (iter->pos->ptr != NULL)
  ------------------
  |  Branch (881:22): [True: 0, False: 32.4k]
  ------------------
  882|      0|            {
  883|       |                /* Initialize to default value */
  884|      0|                memcpy(iter->pData, iter->pos->ptr, iter->pos->data_size);
  885|      0|            }
  886|  32.4k|            else
  887|  32.4k|            {
  888|       |                /* Initialize to zeros */
  889|  32.4k|                memset(iter->pData, 0, iter->pos->data_size);
  890|  32.4k|            }
  891|   165k|        }
  892|  1.25M|    }
  893|   551k|    else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|   551k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   551k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|   551k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (893:14): [True: 551k, False: 0]
  ------------------
  894|   551k|    {
  895|       |        /* Initialize the pointer to NULL. */
  896|   551k|        *(void**)iter->pData = NULL;
  897|       |        
  898|       |        /* Initialize array count to 0. */
  899|   551k|        if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  205|   551k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   551k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  193|  1.10M|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (899:13): [True: 8.31k, False: 543k]
  ------------------
  900|   551k|            PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  205|   543k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   543k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                          PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  194|   543k|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (900:13): [True: 410k, False: 133k]
  ------------------
  901|   418k|        {
  902|   418k|            *(pb_size_t*)iter->pSize = 0;
  903|   418k|        }
  904|   551k|    }
  905|      0|    else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  204|      0|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|      0|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  201|      0|#define PB_ATYPE_CALLBACK 0x40
  ------------------
  |  Branch (905:14): [True: 0, False: 0]
  ------------------
  906|      0|    {
  907|       |        /* Don't overwrite callback */
  908|      0|    }
  909|  1.81M|}
pb_decode.c:pb_release_single_field:
 1165|  1.05M|{
 1166|  1.05M|    pb_type_t type;
 1167|  1.05M|    type = iter->pos->type;
 1168|       |
 1169|  1.05M|    if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  205|  1.05M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  1.05M|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  194|  1.05M|#define PB_HTYPE_ONEOF    0x30
  ------------------
  |  Branch (1169:9): [True: 877k, False: 174k]
  ------------------
 1170|   877k|    {
 1171|   877k|        if (*(pb_size_t*)iter->pSize != iter->pos->tag)
  ------------------
  |  Branch (1171:13): [True: 767k, False: 109k]
  ------------------
 1172|   767k|            return; /* This is not the current field in the union */
 1173|   877k|    }
 1174|       |
 1175|       |    /* Release anything contained inside an extension or submsg.
 1176|       |     * This has to be done even if the submsg itself is statically
 1177|       |     * allocated. */
 1178|   284k|    if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  206|   284k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   284k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  177|   284k|#define PB_LTYPE_EXTENSION 0x09
  ------------------
  |  Branch (1178:9): [True: 0, False: 284k]
  ------------------
 1179|      0|    {
 1180|       |        /* Release fields from all extensions in the linked list */
 1181|      0|        pb_extension_t *ext = *(pb_extension_t**)iter->pData;
 1182|      0|        while (ext != NULL)
  ------------------
  |  Branch (1182:16): [True: 0, False: 0]
  ------------------
 1183|      0|        {
 1184|      0|            pb_field_iter_t ext_iter;
 1185|      0|            iter_from_extension(&ext_iter, ext);
 1186|      0|            pb_release_single_field(&ext_iter);
 1187|      0|            ext = ext->next;
 1188|      0|        }
 1189|      0|    }
 1190|   284k|    else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK)
  ------------------
  |  |  206|   284k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|   284k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                  else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK)
  ------------------
  |  |  173|   568k|#define PB_LTYPE_SUBMESSAGE 0x08
  ------------------
                  else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK)
  ------------------
  |  |  204|   100k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   100k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  else if (PB_LTYPE(type) == PB_LTYPE_SUBMESSAGE && PB_ATYPE(type) != PB_ATYPE_CALLBACK)
  ------------------
  |  |  201|   100k|#define PB_ATYPE_CALLBACK 0x40
  ------------------
  |  Branch (1190:14): [True: 100k, False: 184k]
  |  Branch (1190:55): [True: 100k, False: 0]
  ------------------
 1191|   100k|    {
 1192|       |        /* Release fields in submessage or submsg array */
 1193|   100k|        void *pItem = iter->pData;
 1194|   100k|        pb_size_t count = 1;
 1195|       |        
 1196|   100k|        if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|   100k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   100k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                      if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|   100k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (1196:13): [True: 8.53k, False: 91.5k]
  ------------------
 1197|  8.53k|        {
 1198|  8.53k|            pItem = *(void**)iter->pData;
 1199|  8.53k|        }
 1200|       |        
 1201|   100k|        if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  205|   100k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|   100k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  193|   100k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (1201:13): [True: 8.53k, False: 91.5k]
  ------------------
 1202|  8.53k|        {
 1203|  8.53k|            if (PB_ATYPE(type) == PB_ATYPE_STATIC && iter->pSize == iter->pData) {
  ------------------
  |  |  204|  8.53k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|  8.53k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                          if (PB_ATYPE(type) == PB_ATYPE_STATIC && iter->pSize == iter->pData) {
  ------------------
  |  |  199|  17.0k|#define PB_ATYPE_STATIC   0x00
  ------------------
  |  Branch (1203:17): [True: 0, False: 8.53k]
  |  Branch (1203:54): [True: 0, False: 0]
  ------------------
 1204|       |                /* No _count field so use size of the array */
 1205|      0|                count = iter->pos->array_size;
 1206|  8.53k|            } else {
 1207|  8.53k|                count = *(pb_size_t*)iter->pSize;
 1208|  8.53k|            }
 1209|       |
 1210|  8.53k|            if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size)
  ------------------
  |  |  204|  8.53k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|  8.53k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                          if (PB_ATYPE(type) == PB_ATYPE_STATIC && count > iter->pos->array_size)
  ------------------
  |  |  199|  17.0k|#define PB_ATYPE_STATIC   0x00
  ------------------
  |  Branch (1210:17): [True: 0, False: 8.53k]
  |  Branch (1210:54): [True: 0, False: 0]
  ------------------
 1211|      0|            {
 1212|       |                /* Protect against corrupted _count fields */
 1213|      0|                count = iter->pos->array_size;
 1214|      0|            }
 1215|  8.53k|        }
 1216|       |        
 1217|   100k|        if (pItem)
  ------------------
  |  Branch (1217:13): [True: 96.1k, False: 3.85k]
  ------------------
 1218|  96.1k|        {
 1219|   255k|            while (count--)
  ------------------
  |  Branch (1219:20): [True: 159k, False: 96.1k]
  ------------------
 1220|   159k|            {
 1221|   159k|                pb_release((const pb_field_t*)iter->pos->ptr, pItem);
 1222|   159k|                pItem = (char*)pItem + iter->pos->data_size;
 1223|   159k|            }
 1224|  96.1k|        }
 1225|   100k|    }
 1226|       |    
 1227|   284k|    if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  204|   284k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  202|   284k|#define PB_ATYPE_MASK     0xC0
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  200|   284k|#define PB_ATYPE_POINTER  0x80
  ------------------
  |  Branch (1227:9): [True: 80.6k, False: 203k]
  ------------------
 1228|  80.6k|    {
 1229|  80.6k|        if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  205|  80.6k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  80.6k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  193|   161k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (1229:13): [True: 8.53k, False: 72.1k]
  ------------------
 1230|  80.6k|            (PB_LTYPE(type) == PB_LTYPE_STRING ||
  ------------------
  |  |  206|  8.53k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  8.53k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                          (PB_LTYPE(type) == PB_LTYPE_STRING ||
  ------------------
  |  |  169|  17.0k|#define PB_LTYPE_STRING 0x07
  ------------------
  |  Branch (1230:14): [True: 0, False: 8.53k]
  ------------------
 1231|  8.53k|             PB_LTYPE(type) == PB_LTYPE_BYTES))
  ------------------
  |  |  206|  8.53k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  187|  8.53k|#define PB_LTYPE_MASK 0x0F
  |  |  ------------------
  ------------------
                           PB_LTYPE(type) == PB_LTYPE_BYTES))
  ------------------
  |  |  165|  8.53k|#define PB_LTYPE_BYTES 0x06
  ------------------
  |  Branch (1231:14): [True: 0, False: 8.53k]
  ------------------
 1232|      0|        {
 1233|       |            /* Release entries in repeated string or bytes array */
 1234|      0|            void **pItem = *(void***)iter->pData;
 1235|      0|            pb_size_t count = *(pb_size_t*)iter->pSize;
 1236|      0|            while (count--)
  ------------------
  |  Branch (1236:20): [True: 0, False: 0]
  ------------------
 1237|      0|            {
 1238|      0|                pb_free(*pItem);
  ------------------
  |  |  382|      0|#       define pb_free(ptr) free(ptr)
  ------------------
 1239|      0|                *pItem++ = NULL;
 1240|      0|            }
 1241|      0|        }
 1242|       |        
 1243|  80.6k|        if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  205|  80.6k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  195|  80.6k|#define PB_HTYPE_MASK     0x30
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  193|  80.6k|#define PB_HTYPE_REPEATED 0x20
  ------------------
  |  Branch (1243:13): [True: 8.53k, False: 72.1k]
  ------------------
 1244|  8.53k|        {
 1245|       |            /* We are going to release the array, so set the size to 0 */
 1246|  8.53k|            *(pb_size_t*)iter->pSize = 0;
 1247|  8.53k|        }
 1248|       |        
 1249|       |        /* Release main item */
 1250|  80.6k|        pb_free(*(void**)iter->pData);
  ------------------
  |  |  382|  80.6k|#       define pb_free(ptr) free(ptr)
  ------------------
 1251|  80.6k|        *(void**)iter->pData = NULL;
 1252|  80.6k|    }
 1253|   284k|}
pb_decode.c:pb_dec_bool:
 1329|  26.5k|{
 1330|  26.5k|    uint32_t value;
 1331|  26.5k|    PB_UNUSED(field);
  ------------------
  |  |  112|  26.5k|#define PB_UNUSED(x) (void)(x)
  ------------------
 1332|  26.5k|    if (!pb_decode_varint32(stream, &value))
  ------------------
  |  Branch (1332:9): [True: 18, False: 26.4k]
  ------------------
 1333|     18|        return false;
 1334|       |
 1335|  26.4k|    *(bool*)dest = (value != 0);
 1336|  26.4k|    return true;
 1337|  26.5k|}

