_ZN4chip8Encoding5Read8ERPKh:
  150|    271|{
  151|    271|    return nl::IO::Read8(reinterpret_cast<const void *&>(p));
  152|    271|}
_ZN4chip8Encoding12LittleEndian10HostSwap64Em:
  288|  8.67k|{
  289|  8.67k|    return nl::ByteOrder::Swap64LittleToHost(v);
  290|  8.67k|}
_ZN4chip8Encoding12LittleEndian8HostSwapImEET_S3_:
  294|  8.67k|{
  295|  8.67k|    return HostSwap64(v);
  296|  8.67k|}
_ZN4chip8Encoding12LittleEndian6Read16ERPKh:
  419|  1.96k|{
  420|  1.96k|    return nl::IO::LittleEndian::ReadUnaligned16(reinterpret_cast<const void *&>(p));
  421|  1.96k|}
_ZN4chip8Encoding12LittleEndian6Read32ERPKh:
  459|    773|{
  460|    773|    return nl::IO::LittleEndian::ReadUnaligned32(reinterpret_cast<const void *&>(p));
  461|    773|}

_ZN4chip9ChipErrorC2EjPKcj:
  190|  95.8k|        mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
  ------------------
  |  |  122|  95.8k|#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l))
  ------------------
  191|  95.8k|    {}
_ZNK4chip9ChipErroreqERKS0_:
  203|  6.03k|    bool operator==(const ChipError & other) const { return mError == other.mError; }
_ZNK4chip9ChipErrorneERKS0_:
  204|  5.57k|    bool operator!=(const ChipError & other) const { return mError != other.mError; }
_ZN4chip9ChipError9IsSuccessES0_:
  218|  69.3k|    static constexpr bool IsSuccess(ChipError error) { return error.mError == 0; }

_ZN4chip3TLV9TLVReaderC2Ev:
   53|  1.65k|    ImplicitProfileId(kProfileIdNotSpecified), AppData(nullptr), mElemLenOrVal(0), mBackingStore(nullptr), mReadPoint(nullptr),
   54|  1.65k|    mBufEnd(nullptr), mLenRead(0), mMaxLen(0), mContainerType(kTLVType_NotSpecified), mControlByte(kTLVControlByte_NotSpecified),
   55|  1.65k|    mContainerOpen(false)
   56|  1.65k|{}
_ZN4chip3TLV9TLVReader4InitEPKhm:
   59|    826|{
   60|       |    // TODO: Maybe we can just make mMaxLen and mLenRead size_t instead?
   61|    826|    uint32_t actualDataLen = dataLen > UINT32_MAX ? UINT32_MAX : static_cast<uint32_t>(dataLen);
  ------------------
  |  Branch (61:30): [True: 0, False: 826]
  ------------------
   62|    826|    mBackingStore          = nullptr;
   63|    826|    mReadPoint             = data;
   64|    826|    mBufEnd                = data + actualDataLen;
   65|    826|    mLenRead               = 0;
   66|    826|    mMaxLen                = actualDataLen;
   67|    826|    ClearElementState();
   68|    826|    mContainerType = kTLVType_NotSpecified;
   69|    826|    SetContainerOpen(false);
   70|       |
   71|    826|    ImplicitProfileId = kProfileIdNotSpecified;
   72|    826|}
_ZN4chip3TLV9TLVReader4InitERKS1_:
   96|    826|{
   97|       |    // Initialize private data members
   98|       |
   99|    826|    mElemTag       = aReader.mElemTag;
  100|    826|    mElemLenOrVal  = aReader.mElemLenOrVal;
  101|    826|    mBackingStore  = aReader.mBackingStore;
  102|    826|    mReadPoint     = aReader.mReadPoint;
  103|    826|    mBufEnd        = aReader.mBufEnd;
  104|    826|    mLenRead       = aReader.mLenRead;
  105|    826|    mMaxLen        = aReader.mMaxLen;
  106|    826|    mControlByte   = aReader.mControlByte;
  107|    826|    mContainerType = aReader.mContainerType;
  108|    826|    SetContainerOpen(aReader.IsContainerOpen());
  109|       |
  110|       |    // Initialize public data members
  111|       |
  112|    826|    ImplicitProfileId = aReader.ImplicitProfileId;
  113|    826|    AppData           = aReader.AppData;
  114|    826|}
_ZNK4chip3TLV9TLVReader7GetTypeEv:
  117|  9.97k|{
  118|  9.97k|    TLVElementType elemType = ElementType();
  119|  9.97k|    if (elemType == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (119:9): [True: 0, False: 9.97k]
  ------------------
  120|      0|        return kTLVType_NotSpecified;
  121|  9.97k|    if (elemType == TLVElementType::FloatingPointNumber32 || elemType == TLVElementType::FloatingPointNumber64)
  ------------------
  |  Branch (121:9): [True: 195, False: 9.78k]
  |  Branch (121:62): [True: 232, False: 9.55k]
  ------------------
  122|    427|        return kTLVType_FloatingPointNumber;
  123|  9.55k|    if (elemType == TLVElementType::NotSpecified || elemType >= TLVElementType::Null)
  ------------------
  |  Branch (123:9): [True: 3.12k, False: 6.43k]
  |  Branch (123:53): [True: 2.77k, False: 3.65k]
  ------------------
  124|  5.90k|        return static_cast<TLVType>(elemType);
  125|  3.65k|    return static_cast<TLVType>(static_cast<uint8_t>(elemType) & ~kTLVTypeSizeMask);
  126|  9.55k|}
_ZNK4chip3TLV9TLVReader9GetLengthEv:
  129|    464|{
  130|    464|    if (TLVTypeHasLength(ElementType()))
  ------------------
  |  Branch (130:9): [True: 464, False: 0]
  ------------------
  131|    464|        return static_cast<uint32_t>(mElemLenOrVal);
  132|      0|    return 0;
  133|    464|}
_ZN4chip3TLV9TLVReader14EnterContainerERNS0_7TLVTypeE:
  563|  2.30k|{
  564|  2.30k|    TLVElementType elemType = ElementType();
  565|  2.30k|    if (!TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (565:9): [True: 0, False: 2.30k]
  ------------------
  566|      0|        return CHIP_ERROR_INCORRECT_STATE;
  ------------------
  |  |  512|      0|#define CHIP_ERROR_INCORRECT_STATE                             CHIP_CORE_ERROR(0x03)
  |  |  ------------------
  |  |  |  |  436|      0|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  567|       |
  568|  2.30k|    outerContainerType = mContainerType;
  569|  2.30k|    mContainerType     = static_cast<TLVType>(elemType);
  570|       |
  571|  2.30k|    ClearElementState();
  572|  2.30k|    SetContainerOpen(false);
  573|       |
  574|  2.30k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  2.30k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  575|  2.30k|}
_ZN4chip3TLV9TLVReader13ExitContainerENS0_7TLVTypeE:
  578|  1.96k|{
  579|  1.96k|    CHIP_ERROR err;
  580|       |
  581|  1.96k|    err = SkipToEndOfContainer();
  582|  1.96k|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  1.96k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (582:9): [True: 479, False: 1.48k]
  ------------------
  583|    479|        return err;
  584|       |
  585|  1.48k|    mContainerType = outerContainerType;
  586|  1.48k|    ClearElementState();
  587|       |
  588|  1.48k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  1.48k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  589|  1.96k|}
_ZN4chip3TLV9TLVReader4NextEv:
  602|  9.15k|{
  603|  9.15k|    ReturnErrorOnFailure(Skip());
  ------------------
  |  |  150|  9.15k|    do                                                                                                                             \
  |  |  151|  9.15k|    {                                                                                                                              \
  |  |  152|  9.15k|        auto __err = (expr);                                                                                                       \
  |  |  153|  9.15k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 9.15k]
  |  |  ------------------
  |  |  154|  9.15k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  9.15k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  604|  9.15k|    ReturnErrorOnFailure(ReadElement());
  ------------------
  |  |  150|  9.15k|    do                                                                                                                             \
  |  |  151|  9.15k|    {                                                                                                                              \
  |  |  152|  9.15k|        auto __err = (expr);                                                                                                       \
  |  |  153|  9.15k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 815, False: 8.34k]
  |  |  ------------------
  |  |  154|  9.15k|        {                                                                                                                          \
  |  |  155|    815|            return __err;                                                                                                          \
  |  |  156|    815|        }                                                                                                                          \
  |  |  157|  9.15k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  605|       |
  606|  8.34k|    TLVElementType elemType = ElementType();
  607|       |
  608|  8.34k|    VerifyOrReturnError(elemType != TLVElementType::EndOfContainer, CHIP_END_OF_TLV);
  ------------------
  |  |  251|  8.34k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  8.34k|    do                                                                                                                             \
  |  |  |  |  271|  8.34k|    {                                                                                                                              \
  |  |  |  |  272|  8.34k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 1.48k, False: 6.85k]
  |  |  |  |  ------------------
  |  |  |  |  273|  8.34k|        {                                                                                                                          \
  |  |  |  |  274|  1.48k|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|  1.48k|            return (value);                                                                                                        \
  |  |  |  |  276|  1.48k|        }                                                                                                                          \
  |  |  |  |  277|  8.34k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  609|       |
  610|       |    // Ensure that GetDataPtr calls can be called immediately after Next, so
  611|       |    // that `Get(ByteSpan&)` does not need to advance buffers and just works
  612|  6.85k|    if (TLVTypeIsString(elemType) && (GetLength() != 0))
  ------------------
  |  Branch (612:9): [True: 464, False: 6.39k]
  |  Branch (612:38): [True: 231, False: 233]
  ------------------
  613|    231|    {
  614|    231|        ReturnErrorOnFailure(EnsureData(CHIP_ERROR_TLV_UNDERRUN));
  ------------------
  |  |  150|    231|    do                                                                                                                             \
  |  |  151|    231|    {                                                                                                                              \
  |  |  152|    231|        auto __err = (expr);                                                                                                       \
  |  |  153|    231|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 231]
  |  |  ------------------
  |  |  154|    231|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|    231|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  615|    231|    }
  616|       |
  617|  6.85k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  6.85k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  618|  6.85k|}
_ZN4chip3TLV9TLVReader4SkipEv:
  649|  9.15k|{
  650|  9.15k|    const TLVElementType elemType = ElementType();
  651|  9.15k|    VerifyOrReturnError(elemType != TLVElementType::EndOfContainer, CHIP_END_OF_TLV);
  ------------------
  |  |  251|  9.15k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  9.15k|    do                                                                                                                             \
  |  |  |  |  271|  9.15k|    {                                                                                                                              \
  |  |  |  |  272|  9.15k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 9.15k]
  |  |  |  |  ------------------
  |  |  |  |  273|  9.15k|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  9.15k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  652|       |
  653|  9.15k|    if (TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (653:9): [True: 0, False: 9.15k]
  ------------------
  654|      0|    {
  655|      0|        TLVType outerContainerType;
  656|      0|        ReturnErrorOnFailure(EnterContainer(outerContainerType));
  ------------------
  |  |  150|      0|    do                                                                                                                             \
  |  |  151|      0|    {                                                                                                                              \
  |  |  152|      0|        auto __err = (expr);                                                                                                       \
  |  |  153|      0|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  154|      0|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|      0|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  657|      0|        return ExitContainer(outerContainerType);
  658|      0|    }
  659|       |
  660|  9.15k|    ReturnErrorOnFailure(SkipData());
  ------------------
  |  |  150|  9.15k|    do                                                                                                                             \
  |  |  151|  9.15k|    {                                                                                                                              \
  |  |  152|  9.15k|        auto __err = (expr);                                                                                                       \
  |  |  153|  9.15k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 9.15k]
  |  |  ------------------
  |  |  154|  9.15k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  9.15k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  661|  9.15k|    ClearElementState();
  662|       |
  663|  9.15k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  9.15k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  664|  9.15k|}
_ZN4chip3TLV9TLVReader17ClearElementStateEv:
  672|  13.7k|{
  673|  13.7k|    mElemTag      = AnonymousTag();
  674|  13.7k|    mControlByte  = kTLVControlByte_NotSpecified;
  675|  13.7k|    mElemLenOrVal = 0;
  676|  13.7k|}
_ZN4chip3TLV9TLVReader8SkipDataEv:
  688|  9.63k|{
  689|  9.63k|    CHIP_ERROR err          = CHIP_NO_ERROR;
  ------------------
  |  |  482|  9.63k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  690|  9.63k|    TLVElementType elemType = ElementType();
  691|       |
  692|  9.63k|    if (TLVTypeHasLength(elemType))
  ------------------
  |  Branch (692:9): [True: 464, False: 9.17k]
  ------------------
  693|    464|    {
  694|    464|        err = ReadData(nullptr, static_cast<uint32_t>(mElemLenOrVal));
  695|    464|    }
  696|       |
  697|  9.63k|    return err;
  698|  9.63k|}
_ZN4chip3TLV9TLVReader20SkipToEndOfContainerEv:
  701|  1.96k|{
  702|  1.96k|    CHIP_ERROR err;
  703|  1.96k|    TLVType outerContainerType = mContainerType;
  704|  1.96k|    uint32_t nestLevel         = 0;
  705|       |
  706|       |    // If the user calls Next() after having called OpenContainer() but before calling
  707|       |    // CloseContainer() they're effectively doing a close container by skipping over
  708|       |    // the container element.  So reset the 'container open' flag here to prevent them
  709|       |    // from calling CloseContainer() with the now orphaned container reader.
  710|  1.96k|    SetContainerOpen(false);
  711|       |
  712|  1.96k|    while (true)
  ------------------
  |  Branch (712:12): [Folded - Ignored]
  ------------------
  713|  1.96k|    {
  714|  1.96k|        TLVElementType elemType = ElementType();
  715|       |
  716|  1.96k|        if (elemType == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (716:13): [True: 1.48k, False: 479]
  ------------------
  717|  1.48k|        {
  718|  1.48k|            if (nestLevel == 0)
  ------------------
  |  Branch (718:17): [True: 1.48k, False: 0]
  ------------------
  719|  1.48k|                return CHIP_NO_ERROR;
  ------------------
  |  |  482|  1.48k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  720|       |
  721|      0|            nestLevel--;
  722|      0|            mContainerType = (nestLevel == 0) ? outerContainerType : kTLVType_UnknownContainer;
  ------------------
  |  Branch (722:30): [True: 0, False: 0]
  ------------------
  723|      0|        }
  724|       |
  725|    479|        else if (TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (725:18): [True: 0, False: 479]
  ------------------
  726|      0|        {
  727|      0|            nestLevel++;
  728|      0|            mContainerType = static_cast<TLVType>(elemType);
  729|      0|        }
  730|       |
  731|    479|        err = SkipData();
  732|    479|        if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|    479|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (732:13): [True: 0, False: 479]
  ------------------
  733|      0|            return err;
  734|       |
  735|    479|        err = ReadElement();
  736|    479|        if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|    479|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (736:13): [True: 479, False: 0]
  ------------------
  737|    479|            return err;
  738|    479|    }
  739|  1.96k|}
_ZN4chip3TLV9TLVReader11ReadElementEv:
  742|  9.63k|{
  743|       |    // Make sure we have input data. Return CHIP_END_OF_TLV if no more data is available.
  744|  9.63k|    ReturnErrorOnFailure(EnsureData(CHIP_END_OF_TLV));
  ------------------
  |  |  150|  9.63k|    do                                                                                                                             \
  |  |  151|  9.63k|    {                                                                                                                              \
  |  |  152|  9.63k|        auto __err = (expr);                                                                                                       \
  |  |  153|  9.63k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 907, False: 8.72k]
  |  |  ------------------
  |  |  154|  9.63k|        {                                                                                                                          \
  |  |  155|    907|            return __err;                                                                                                          \
  |  |  156|    907|        }                                                                                                                          \
  |  |  157|  9.63k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  745|  8.72k|    VerifyOrReturnError(mReadPoint != nullptr, CHIP_ERROR_INVALID_TLV_ELEMENT);
  ------------------
  |  |  251|  8.72k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  8.72k|    do                                                                                                                             \
  |  |  |  |  271|  8.72k|    {                                                                                                                              \
  |  |  |  |  272|  8.72k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 8.72k]
  |  |  |  |  ------------------
  |  |  |  |  273|  8.72k|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  8.72k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  746|       |
  747|       |    // Get the element's control byte.
  748|  8.72k|    mControlByte = *mReadPoint;
  749|       |
  750|       |    // Extract the element type from the control byte. Fail if it's invalid.
  751|  8.72k|    TLVElementType elemType = ElementType();
  752|  8.72k|    VerifyOrReturnError(IsValidTLVType(elemType), CHIP_ERROR_INVALID_TLV_ELEMENT);
  ------------------
  |  |  251|  8.72k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  8.72k|    do                                                                                                                             \
  |  |  |  |  271|  8.72k|    {                                                                                                                              \
  |  |  |  |  272|  8.72k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 10, False: 8.71k]
  |  |  |  |  ------------------
  |  |  |  |  273|  8.72k|        {                                                                                                                          \
  |  |  |  |  274|     10|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|     10|            return (value);                                                                                                        \
  |  |  |  |  276|     10|        }                                                                                                                          \
  |  |  |  |  277|  8.72k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  753|       |
  754|       |    // Extract the tag control from the control byte.
  755|  8.71k|    TLVTagControl tagControl = static_cast<TLVTagControl>(mControlByte & kTLVTagControlMask);
  756|       |
  757|       |    // Determine the number of bytes in the element's tag, if any.
  758|  8.71k|    uint8_t tagBytes = sTagSizes[tagControl >> kTLVTagControlShift];
  759|       |
  760|       |    // Extract the size of length/value field from the control byte.
  761|  8.71k|    TLVFieldSize lenOrValFieldSize = GetTLVFieldSize(elemType);
  762|       |
  763|       |    // Determine the number of bytes in the length/value field.
  764|  8.71k|    const uint8_t valOrLenBytes = TLVFieldSizeToBytes(lenOrValFieldSize);
  765|       |
  766|       |    // Determine the number of bytes in the element's 'head'. This includes: the control byte, the tag bytes (if present), the
  767|       |    // length bytes (if present), and for elements that don't have a length (e.g. integers), the value bytes.
  768|  8.71k|    const uint8_t elemHeadBytes = static_cast<uint8_t>(1 + tagBytes + valOrLenBytes);
  769|       |
  770|       |    // 17 = 1 control byte + 8 tag bytes + 8 length/value bytes
  771|  8.71k|    uint8_t stagingBuf[17];
  772|       |
  773|       |    // Odd workaround: clang-tidy claims garbage value otherwise as it does not
  774|       |    // understand that ReadData initializes stagingBuf
  775|  8.71k|    stagingBuf[1] = 0;
  776|       |
  777|       |    // If the head of the element goes past the end of the current input buffer,
  778|       |    // we need to read it into the staging buffer to parse it.  Just do that unconditionally,
  779|       |    // even if the head does not go past end of current buffer, to save codesize.
  780|  8.71k|    ReturnErrorOnFailure(ReadData(stagingBuf, elemHeadBytes));
  ------------------
  |  |  150|  8.71k|    do                                                                                                                             \
  |  |  151|  8.71k|    {                                                                                                                              \
  |  |  152|  8.71k|        auto __err = (expr);                                                                                                       \
  |  |  153|  8.71k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 44, False: 8.67k]
  |  |  ------------------
  |  |  154|  8.71k|        {                                                                                                                          \
  |  |  155|     44|            return __err;                                                                                                          \
  |  |  156|     44|        }                                                                                                                          \
  |  |  157|  8.71k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  781|       |
  782|       |    // +1 to skip over the control byte
  783|  8.67k|    const uint8_t * p = stagingBuf + 1;
  784|       |
  785|       |    // Read the tag field, if present.
  786|  8.67k|    mElemTag      = ReadTag(tagControl, p);
  787|  8.67k|    mElemLenOrVal = 0;
  788|       |
  789|       |    // Read the length/value field, if present.
  790|       |    // NOTE: this is works because even though we only memcpy a subset of values and leave
  791|       |    //       the rest 0. Value looks like "<le-byte> <le-byte> ... <le-byte> 0 0 ... 0"
  792|       |    //       which is the TLV format. HostSwap ensures this becomes a real host value
  793|       |    //       (should be a NOOP on LE machines, will full-swap on big-endian machines)
  794|  8.67k|    memcpy(&mElemLenOrVal, p, valOrLenBytes);
  795|  8.67k|    LittleEndian::HostSwap(mElemLenOrVal);
  796|       |
  797|  8.67k|    VerifyOrReturnError(!TLVTypeHasLength(elemType) || (mElemLenOrVal <= UINT32_MAX), CHIP_ERROR_NOT_IMPLEMENTED);
  ------------------
  |  |  251|  8.67k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  8.67k|    do                                                                                                                             \
  |  |  |  |  271|  8.67k|    {                                                                                                                              \
  |  |  |  |  272|  9.24k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:15): [True: 8.10k, False: 570]
  |  |  |  |  |  Branch (272:15): [True: 522, False: 48]
  |  |  |  |  ------------------
  |  |  |  |  273|  8.67k|        {                                                                                                                          \
  |  |  |  |  274|     48|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|     48|            return (value);                                                                                                        \
  |  |  |  |  276|     48|        }                                                                                                                          \
  |  |  |  |  277|  8.67k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  798|       |
  799|  8.62k|    return VerifyElement();
  800|  8.67k|}
_ZN4chip3TLV9TLVReader13VerifyElementEv:
  803|  8.62k|{
  804|  8.62k|    if (ElementType() == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (804:9): [True: 1.58k, False: 7.04k]
  ------------------
  805|  1.58k|    {
  806|  1.58k|        if (mContainerType == kTLVType_NotSpecified)
  ------------------
  |  Branch (806:13): [True: 2, False: 1.58k]
  ------------------
  807|      2|            return CHIP_ERROR_INVALID_TLV_ELEMENT;
  ------------------
  |  |  801|      2|#define CHIP_ERROR_INVALID_TLV_ELEMENT                         CHIP_CORE_ERROR(0x23)
  |  |  ------------------
  |  |  |  |  436|      2|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      2|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  808|  1.58k|        if (mElemTag != AnonymousTag())
  ------------------
  |  Branch (808:13): [True: 96, False: 1.48k]
  ------------------
  809|     96|            return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|     96|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|     96|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     96|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  810|  1.58k|    }
  811|  7.04k|    else
  812|  7.04k|    {
  813|  7.04k|        if (mElemTag == UnknownImplicitTag())
  ------------------
  |  Branch (813:13): [True: 7, False: 7.03k]
  ------------------
  814|      7|            return CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG;
  ------------------
  |  |  820|      7|#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG                    CHIP_CORE_ERROR(0x25)
  |  |  ------------------
  |  |  |  |  436|      7|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      7|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|  7.03k|        switch (mContainerType)
  816|  7.03k|        {
  817|  4.62k|        case kTLVType_NotSpecified:
  ------------------
  |  Branch (817:9): [True: 4.62k, False: 2.41k]
  ------------------
  818|  4.62k|            if (IsContextTag(mElemTag))
  ------------------
  |  Branch (818:17): [True: 15, False: 4.60k]
  ------------------
  819|     15|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|     15|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|     15|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     15|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  820|  4.60k|            break;
  821|  4.60k|        case kTLVType_Structure:
  ------------------
  |  Branch (821:9): [True: 433, False: 6.60k]
  ------------------
  822|    433|            if (mElemTag == AnonymousTag())
  ------------------
  |  Branch (822:17): [True: 1, False: 432]
  ------------------
  823|      1|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|      1|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|      1|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      1|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  824|    432|            break;
  825|    808|        case kTLVType_Array:
  ------------------
  |  Branch (825:9): [True: 808, False: 6.22k]
  ------------------
  826|    808|            if (mElemTag != AnonymousTag())
  ------------------
  |  Branch (826:17): [True: 108, False: 700]
  ------------------
  827|    108|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|    108|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|    108|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    108|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  828|    700|            break;
  829|    700|        case kTLVType_UnknownContainer:
  ------------------
  |  Branch (829:9): [True: 0, False: 7.03k]
  ------------------
  830|  1.17k|        case kTLVType_List:
  ------------------
  |  Branch (830:9): [True: 1.17k, False: 5.86k]
  ------------------
  831|  1.17k|            break;
  832|      0|        default:
  ------------------
  |  Branch (832:9): [True: 0, False: 7.03k]
  ------------------
  833|      0|            return CHIP_ERROR_INCORRECT_STATE;
  ------------------
  |  |  512|      0|#define CHIP_ERROR_INCORRECT_STATE                             CHIP_CORE_ERROR(0x03)
  |  |  ------------------
  |  |  |  |  436|      0|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|      0|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  834|  7.03k|        }
  835|  7.03k|    }
  836|       |
  837|       |    // If the current element encodes a specific length (e.g. a UTF8 string or a byte string), verify
  838|       |    // that the purported length fits within the remaining bytes of the encoding (as delineated by mMaxLen).
  839|       |    //
  840|       |    // Note that this check is not strictly necessary to prevent runtime errors, as any attempt to access
  841|       |    // the data of an element with an invalid length will result in an error.  However checking the length
  842|       |    // here catches the error earlier, and ensures that the application will never see the erroneous length
  843|       |    // value.
  844|       |    //
  845|  8.39k|    if (TLVTypeHasLength(ElementType()))
  ------------------
  |  Branch (845:9): [True: 520, False: 7.87k]
  ------------------
  846|    520|    {
  847|    520|        uint32_t overallLenRemaining = mMaxLen - mLenRead;
  848|    520|        if (overallLenRemaining < static_cast<uint32_t>(mElemLenOrVal))
  ------------------
  |  Branch (848:13): [True: 56, False: 464]
  ------------------
  849|     56|            return CHIP_ERROR_TLV_UNDERRUN;
  ------------------
  |  |  792|     56|#define CHIP_ERROR_TLV_UNDERRUN                                CHIP_CORE_ERROR(0x22)
  |  |  ------------------
  |  |  |  |  436|     56|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     56|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  850|    520|    }
  851|       |
  852|  8.34k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  8.34k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  853|  8.39k|}
_ZNK4chip3TLV9TLVReader7ReadTagENS0_13TLVTagControlERPKh:
  856|  8.67k|{
  857|  8.67k|    uint16_t vendorId;
  858|  8.67k|    uint16_t profileNum;
  859|       |
  860|  8.67k|    switch (tagControl)
  861|  8.67k|    {
  862|    271|    case TLVTagControl::ContextSpecific:
  ------------------
  |  Branch (862:5): [True: 271, False: 8.40k]
  ------------------
  863|    271|        return ContextTag(Read8(p));
  864|    282|    case TLVTagControl::CommonProfile_2Bytes:
  ------------------
  |  Branch (864:5): [True: 282, False: 8.39k]
  ------------------
  865|    282|        return CommonTag(LittleEndian::Read16(p));
  866|    509|    case TLVTagControl::CommonProfile_4Bytes:
  ------------------
  |  Branch (866:5): [True: 509, False: 8.16k]
  ------------------
  867|    509|        return CommonTag(LittleEndian::Read32(p));
  868|      3|    case TLVTagControl::ImplicitProfile_2Bytes:
  ------------------
  |  Branch (868:5): [True: 3, False: 8.67k]
  ------------------
  869|      3|        if (ImplicitProfileId == kProfileIdNotSpecified)
  ------------------
  |  Branch (869:13): [True: 3, False: 0]
  ------------------
  870|      3|            return UnknownImplicitTag();
  871|      0|        return ProfileTag(ImplicitProfileId, LittleEndian::Read16(p));
  872|      5|    case TLVTagControl::ImplicitProfile_4Bytes:
  ------------------
  |  Branch (872:5): [True: 5, False: 8.67k]
  ------------------
  873|      5|        if (ImplicitProfileId == kProfileIdNotSpecified)
  ------------------
  |  Branch (873:13): [True: 5, False: 0]
  ------------------
  874|      5|            return UnknownImplicitTag();
  875|      0|        return ProfileTag(ImplicitProfileId, LittleEndian::Read32(p));
  876|    386|    case TLVTagControl::FullyQualified_6Bytes:
  ------------------
  |  Branch (876:5): [True: 386, False: 8.28k]
  ------------------
  877|    386|        vendorId   = LittleEndian::Read16(p);
  878|    386|        profileNum = LittleEndian::Read16(p);
  879|    386|        return ProfileTag(vendorId, profileNum, LittleEndian::Read16(p));
  880|    264|    case TLVTagControl::FullyQualified_8Bytes:
  ------------------
  |  Branch (880:5): [True: 264, False: 8.41k]
  ------------------
  881|    264|        vendorId   = LittleEndian::Read16(p);
  882|    264|        profileNum = LittleEndian::Read16(p);
  883|    264|        return ProfileTag(vendorId, profileNum, LittleEndian::Read32(p));
  884|  6.95k|    case TLVTagControl::Anonymous:
  ------------------
  |  Branch (884:5): [True: 6.95k, False: 1.72k]
  ------------------
  885|  6.95k|    default:
  ------------------
  |  Branch (885:5): [True: 0, False: 8.67k]
  ------------------
  886|  6.95k|        return AnonymousTag();
  887|  8.67k|    }
  888|  8.67k|}
_ZN4chip3TLV9TLVReader8ReadDataEPhj:
  891|  9.18k|{
  892|  18.1k|    while (len > 0)
  ------------------
  |  Branch (892:12): [True: 8.99k, False: 9.13k]
  ------------------
  893|  8.99k|    {
  894|  8.99k|        ReturnErrorOnFailure(EnsureData(CHIP_ERROR_TLV_UNDERRUN));
  ------------------
  |  |  150|  8.99k|    do                                                                                                                             \
  |  |  151|  8.99k|    {                                                                                                                              \
  |  |  152|  8.99k|        auto __err = (expr);                                                                                                       \
  |  |  153|  8.99k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 44, False: 8.95k]
  |  |  ------------------
  |  |  154|  8.99k|        {                                                                                                                          \
  |  |  155|     44|            return __err;                                                                                                          \
  |  |  156|     44|        }                                                                                                                          \
  |  |  157|  8.99k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  895|       |
  896|  8.95k|        uint32_t remainingLen = static_cast<decltype(mMaxLen)>(mBufEnd - mReadPoint);
  897|       |
  898|  8.95k|        uint32_t readLen = len;
  899|  8.95k|        if (readLen > remainingLen)
  ------------------
  |  Branch (899:13): [True: 44, False: 8.90k]
  ------------------
  900|     44|            readLen = remainingLen;
  901|       |
  902|  8.95k|        if (buf != nullptr)
  ------------------
  |  Branch (902:13): [True: 8.71k, False: 231]
  ------------------
  903|  8.71k|        {
  904|  8.71k|            memcpy(buf, mReadPoint, readLen);
  905|  8.71k|            buf += readLen;
  906|  8.71k|        }
  907|  8.95k|        mReadPoint += readLen;
  908|  8.95k|        mLenRead += readLen;
  909|  8.95k|        len -= readLen;
  910|  8.95k|    }
  911|       |
  912|  9.13k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  9.13k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  913|  9.18k|}
_ZN4chip3TLV9TLVReader10EnsureDataENS_9ChipErrorE:
  916|  18.8k|{
  917|  18.8k|    if (mReadPoint == mBufEnd)
  ------------------
  |  Branch (917:9): [True: 951, False: 17.9k]
  ------------------
  918|    951|    {
  919|    951|        VerifyOrReturnError((mLenRead != mMaxLen) && (mBackingStore != nullptr), noDataErr);
  ------------------
  |  |  251|    951|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|    951|    do                                                                                                                             \
  |  |  |  |  271|    951|    {                                                                                                                              \
  |  |  |  |  272|    951|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:15): [True: 0, False: 951]
  |  |  |  |  |  Branch (272:15): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  273|    951|        {                                                                                                                          \
  |  |  |  |  274|    951|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|    951|            return (value);                                                                                                        \
  |  |  |  |  276|    951|        }                                                                                                                          \
  |  |  |  |  277|    951|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  920|       |
  921|      0|        uint32_t bufLen;
  922|      0|        ReturnErrorOnFailure(mBackingStore->GetNextBuffer(*this, mReadPoint, bufLen));
  ------------------
  |  |  150|      0|    do                                                                                                                             \
  |  |  151|      0|    {                                                                                                                              \
  |  |  152|      0|        auto __err = (expr);                                                                                                       \
  |  |  153|      0|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 0]
  |  |  ------------------
  |  |  154|      0|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|      0|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  923|      0|        VerifyOrReturnError(bufLen > 0, noDataErr);
  ------------------
  |  |  251|      0|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|      0|    do                                                                                                                             \
  |  |  |  |  271|      0|    {                                                                                                                              \
  |  |  |  |  272|      0|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  273|      0|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|      0|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  924|       |
  925|       |        // Cap mBufEnd so that we don't read beyond the user's specified maximum length, even
  926|       |        // if the underlying buffer is larger.
  927|      0|        bufLen  = std::min(bufLen, mMaxLen - mLenRead);
  928|      0|        mBufEnd = mReadPoint + bufLen;
  929|      0|    }
  930|       |
  931|  17.9k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  17.9k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  932|  18.8k|}
_ZNK4chip3TLV9TLVReader11ElementTypeEv:
  974|  67.6k|{
  975|  67.6k|    if (mControlByte == static_cast<uint16_t>(kTLVControlByte_NotSpecified))
  ------------------
  |  Branch (975:9): [True: 13.2k, False: 54.3k]
  ------------------
  976|  13.2k|        return TLVElementType::NotSpecified;
  977|  54.3k|    return static_cast<TLVElementType>(mControlByte & kTLVTypeMask);
  978|  67.6k|}

_ZNK4chip3TLV9TLVReader15IsContainerOpenEv:
  970|    826|    bool IsContainerOpen() const { return mContainerOpen; }
_ZN4chip3TLV9TLVReader16SetContainerOpenEb:
  971|  5.92k|    void SetContainerOpen(bool aContainerOpen) { mContainerOpen = aContainerOpen; }

_ZNK4chip3TLV3TageqERKS1_:
   41|  7.47k|    constexpr bool operator==(const Tag & other) const { return mVal == other.mVal; }
_ZNK4chip3TLV3TagneERKS1_:
   42|  2.38k|    constexpr bool operator!=(const Tag & other) const { return mVal != other.mVal; }
_ZN4chip3TLV3TagC2Em:
   48|  32.3k|    explicit constexpr Tag(uint64_t val) : mVal(val) {}
_ZN4chip3TLV10ProfileTagEjj:
  136|  32.3k|{
  137|  32.3k|    return Tag((static_cast<uint64_t>(~profileId) << Tag::kProfileIdShift) | tagNum);
  138|  32.3k|}
_ZN4chip3TLV10ProfileTagEttj:
  149|    650|{
  150|    650|    constexpr uint32_t kVendorIdShift = Tag::kVendorIdShift - Tag::kProfileIdShift;
  151|       |
  152|    650|    return ProfileTag((static_cast<uint32_t>(vendorId) << kVendorIdShift) | profileNum, tagNum);
  153|    650|}
_ZN4chip3TLV10ContextTagEh:
  162|    271|{
  163|    271|    return ProfileTag(Tag::kSpecialTagProfileId, tagNum);
  164|    271|}
_ZN4chip3TLV9CommonTagEj:
  202|    791|{
  203|    791|    return ProfileTag(kCommonProfileId, tagNum);
  204|    791|}
_ZN4chip3TLV12AnonymousTagEv:
  210|  23.5k|{
  211|  23.5k|    return ProfileTag(Tag::kSpecialTagProfileId, Tag::kAnonymousTagNum);
  212|  23.5k|}
_ZN4chip3TLV18UnknownImplicitTagEv:
  218|  7.05k|{
  219|  7.05k|    return ProfileTag(Tag::kSpecialTagProfileId, Tag::kUnknownImplicitTagNum);
  220|  7.05k|}
_ZN4chip3TLV16ProfileIdFromTagENS0_3TagE:
  231|  4.62k|{
  232|  4.62k|    return ~static_cast<uint32_t>(tag.mVal >> Tag::kProfileIdShift);
  233|  4.62k|}
_ZN4chip3TLV13TagNumFromTagENS0_3TagE:
  275|  3.68k|{
  276|  3.68k|    return static_cast<uint32_t>(tag.mVal);
  277|  3.68k|}
_ZN4chip3TLV12IsContextTagENS0_3TagE:
  291|  4.62k|{
  292|  4.62k|    return ProfileIdFromTag(tag) == Tag::kSpecialTagProfileId && TagNumFromTag(tag) <= Tag::kContextTagMaxNum;
  ------------------
  |  Branch (292:12): [True: 3.68k, False: 936]
  |  Branch (292:66): [True: 15, False: 3.67k]
  ------------------
  293|  4.62k|}
TLVReader.cpp:_ZN4chip3TLVrsINS0_3$_0EEEhNS0_13TLVTagControlERKT_:
  117|  8.71k|{
  118|  8.71k|    return static_cast<uint8_t>(static_cast<uint8_t>(lhs) >> rhs);
  119|  8.71k|}

_ZN4chip3TLV14IsValidTLVTypeENS0_14TLVElementTypeE:
  124|  8.72k|{
  125|  8.72k|    return type <= TLVElementType::EndOfContainer;
  126|  8.72k|}
_ZN4chip3TLV15TLVTypeHasValueENS0_14TLVElementTypeE:
  134|  8.71k|{
  135|  8.71k|    return (type <= TLVElementType::UInt64 ||
  ------------------
  |  Branch (135:13): [True: 1.52k, False: 7.19k]
  ------------------
  136|  8.71k|            (type >= TLVElementType::FloatingPointNumber32 && type <= TLVElementType::ByteString_8ByteLength));
  ------------------
  |  Branch (136:14): [True: 5.45k, False: 1.73k]
  |  Branch (136:63): [True: 1.01k, False: 4.44k]
  ------------------
  137|  8.71k|}
_ZN4chip3TLV16TLVTypeHasLengthENS0_14TLVElementTypeE:
  145|  27.1k|{
  146|  27.1k|    return type >= TLVElementType::UTF8String_1ByteLength && type <= TLVElementType::ByteString_8ByteLength;
  ------------------
  |  Branch (146:12): [True: 11.1k, False: 15.9k]
  |  Branch (146:62): [True: 2.01k, False: 9.17k]
  ------------------
  147|  27.1k|}
_ZN4chip3TLV18TLVTypeIsContainerENS0_14TLVElementTypeE:
  155|  11.9k|{
  156|  11.9k|    return type >= TLVElementType::Structure && type <= TLVElementType::List;
  ------------------
  |  Branch (156:12): [True: 2.30k, False: 9.63k]
  |  Branch (156:49): [True: 2.30k, False: 0]
  ------------------
  157|  11.9k|}
_ZN4chip3TLV18TLVTypeIsContainerENS0_7TLVTypeE:
  160|  6.85k|{
  161|  6.85k|    return type >= kTLVType_Structure && type <= kTLVType_List;
  ------------------
  |  Branch (161:12): [True: 2.30k, False: 4.55k]
  |  Branch (161:42): [True: 2.30k, False: 0]
  ------------------
  162|  6.85k|}
_ZN4chip3TLV15TLVTypeIsStringENS0_14TLVElementTypeE:
  170|  6.85k|{
  171|  6.85k|    return type >= TLVElementType::UTF8String_1ByteLength && type <= TLVElementType::ByteString_8ByteLength;
  ------------------
  |  Branch (171:12): [True: 3.24k, False: 3.61k]
  |  Branch (171:62): [True: 464, False: 2.77k]
  ------------------
  172|  6.85k|}
_ZN4chip3TLV15GetTLVFieldSizeENS0_14TLVElementTypeE:
  196|  8.71k|{
  197|  8.71k|    if (TLVTypeHasValue(type))
  ------------------
  |  Branch (197:9): [True: 2.53k, False: 6.18k]
  ------------------
  198|  2.53k|        return static_cast<TLVFieldSize>(static_cast<uint8_t>(type) & kTLVTypeSizeMask);
  199|  6.18k|    return kTLVFieldSize_0Byte;
  200|  8.71k|}
_ZN4chip3TLV19TLVFieldSizeToBytesENS0_12TLVFieldSizeE:
  204|  8.71k|{
  205|       |    // We would like to assert fieldSize < 7, but that gives us fatal
  206|       |    // -Wtautological-constant-out-of-range-compare warnings...
  207|  8.71k|    return static_cast<uint8_t>((fieldSize != kTLVFieldSize_0Byte) ? (1 << fieldSize) : 0);
  ------------------
  |  Branch (207:33): [True: 2.53k, False: 6.18k]
  ------------------
  208|  8.71k|}

_ZN4chip3TLV9Utilities7IterateERKNS0_9TLVReaderEPFNS_9ChipErrorES4_mPvES6_:
  133|    826|{
  134|    826|    const bool recurse = true;
  135|    826|    CHIP_ERROR retval;
  136|       |
  137|    826|    retval = Iterate(aReader, aHandler, aContext, recurse);
  138|       |
  139|    826|    return retval;
  140|    826|}
_ZN4chip3TLV9Utilities7IterateERKNS0_9TLVReaderEPFNS_9ChipErrorES4_mPvES6_b:
  165|    826|{
  166|    826|    VerifyOrReturnError(aHandler != nullptr, CHIP_ERROR_INVALID_ARGUMENT);
  ------------------
  |  |  251|    826|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|    826|    do                                                                                                                             \
  |  |  |  |  271|    826|    {                                                                                                                              \
  |  |  |  |  272|    826|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 826]
  |  |  |  |  ------------------
  |  |  |  |  273|    826|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|    826|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  167|       |
  168|    826|    TLVReader temp;
  169|    826|    temp.Init(aReader);
  170|       |
  171|    826|    constexpr size_t depth = 0;
  172|    826|    return Iterate(temp, depth, aHandler, aContext, aRecurse);
  173|    826|}
TLVUtilities.cpp:_ZN4chip3TLV9UtilitiesL7IterateERNS0_9TLVReaderEmPFNS_9ChipErrorERKS2_mPvES7_b:
   75|  3.13k|{
   76|  3.13k|    CHIP_ERROR retval = CHIP_NO_ERROR;
  ------------------
  |  |  482|  3.13k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
   77|       |
   78|  3.13k|    if (aDepth >= kMaxRecursionDepth)
  ------------------
  |  Branch (78:9): [True: 11, False: 3.12k]
  ------------------
   79|     11|    {
   80|     11|        return CHIP_ERROR_RECURSION_DEPTH_LIMIT;
  ------------------
  |  |  526|     11|#define CHIP_ERROR_RECURSION_DEPTH_LIMIT                       CHIP_CORE_ERROR(0x05)
  |  |  ------------------
  |  |  |  |  436|     11|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     11|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   81|     11|    }
   82|       |
   83|  3.12k|    if (aReader.GetType() == kTLVType_NotSpecified)
  ------------------
  |  Branch (83:9): [True: 3.12k, False: 0]
  ------------------
   84|  3.12k|    {
   85|  3.12k|        ReturnErrorOnFailure(aReader.Next());
  ------------------
  |  |  150|  3.12k|    do                                                                                                                             \
  |  |  151|  3.12k|    {                                                                                                                              \
  |  |  152|  3.12k|        auto __err = (expr);                                                                                                       \
  |  |  153|  3.12k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 1.44k, False: 1.68k]
  |  |  ------------------
  |  |  154|  3.12k|        {                                                                                                                          \
  |  |  155|  1.44k|            return __err;                                                                                                          \
  |  |  156|  1.44k|        }                                                                                                                          \
  |  |  157|  3.12k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   86|  3.12k|    }
   87|       |
   88|  1.68k|    do
   89|  6.85k|    {
   90|  6.85k|        const TLVType theType = aReader.GetType();
   91|       |
   92|  6.85k|        ReturnErrorOnFailure((aHandler) (aReader, aDepth, aContext));
  ------------------
  |  |  150|  6.85k|    do                                                                                                                             \
  |  |  151|  6.85k|    {                                                                                                                              \
  |  |  152|  6.85k|        auto __err = (expr);                                                                                                       \
  |  |  153|  6.85k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 6.85k]
  |  |  ------------------
  |  |  154|  6.85k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  6.85k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   93|       |
   94|  6.85k|        if (aRecurse && TLVTypeIsContainer(theType))
  ------------------
  |  Branch (94:13): [True: 6.85k, False: 0]
  |  Branch (94:25): [True: 2.30k, False: 4.55k]
  ------------------
   95|  2.30k|        {
   96|  2.30k|            TLVType containerType;
   97|       |
   98|  2.30k|            ReturnErrorOnFailure(aReader.EnterContainer(containerType));
  ------------------
  |  |  150|  2.30k|    do                                                                                                                             \
  |  |  151|  2.30k|    {                                                                                                                              \
  |  |  152|  2.30k|        auto __err = (expr);                                                                                                       \
  |  |  153|  2.30k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 2.30k]
  |  |  ------------------
  |  |  154|  2.30k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  2.30k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   99|       |
  100|  2.30k|            retval = Iterate(aReader, aDepth + 1, aHandler, aContext, aRecurse);
  101|  2.30k|            if ((retval != CHIP_END_OF_TLV) && (retval != CHIP_NO_ERROR))
  ------------------
  |  |  783|  2.30k|#define CHIP_END_OF_TLV CHIP_ERROR_END_OF_TLV
  |  |  ------------------
  |  |  |  |  782|  2.30k|#define CHIP_ERROR_END_OF_TLV                                  CHIP_CORE_ERROR(0x21)
  |  |  |  |  ------------------
  |  |  |  |  |  |  436|  2.30k|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  171|  2.30k|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                          if ((retval != CHIP_END_OF_TLV) && (retval != CHIP_NO_ERROR))
  ------------------
  |  |  482|    343|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (101:17): [True: 343, False: 1.96k]
  |  Branch (101:17): [True: 343, False: 1.96k]
  |  Branch (101:48): [True: 343, False: 0]
  ------------------
  102|    343|            {
  103|    343|                return retval;
  104|    343|            }
  105|       |
  106|  1.96k|            ReturnErrorOnFailure(aReader.ExitContainer(containerType));
  ------------------
  |  |  150|  1.96k|    do                                                                                                                             \
  |  |  151|  1.96k|    {                                                                                                                              \
  |  |  152|  1.96k|        auto __err = (expr);                                                                                                       \
  |  |  153|  1.96k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 479, False: 1.48k]
  |  |  ------------------
  |  |  154|  1.96k|        {                                                                                                                          \
  |  |  155|    479|            return __err;                                                                                                          \
  |  |  156|    479|        }                                                                                                                          \
  |  |  157|  1.96k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  107|  1.96k|        }
  108|  6.85k|    } while ((retval = aReader.Next()) == CHIP_NO_ERROR);
  ------------------
  |  |  482|  6.03k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (108:14): [True: 5.17k, False: 859]
  ------------------
  109|       |
  110|    859|    return retval;
  111|  1.68k|}

LLVMFuzzerTestOneInput:
   15|    826|{
   16|    826|    TLVReader reader;
   17|    826|    reader.Init(data, len);
   18|    826|    chip::TLV::Utilities::Iterate(reader, FuzzIterator, nullptr);
   19|       |
   20|    826|    return 0;
   21|    826|}
FuzzTlvReader.cpp:_ZL12FuzzIteratorRKN4chip3TLV9TLVReaderEmPv:
   10|  6.85k|{
   11|  6.85k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  6.85k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
   12|  6.85k|}

TLVReader.cpp:_ZL29nlByteOrderSwap64LittleToHostm:
   79|  8.67k|{
   80|  8.67k|    return inValue;
   81|  8.67k|}
TLVReader.cpp:_ZL29nlByteOrderSwap16LittleToHostt:
   43|  1.96k|{
   44|  1.96k|    return inValue;
   45|  1.96k|}
TLVReader.cpp:_ZL29nlByteOrderSwap32LittleToHostj:
   61|    773|{
   62|    773|    return inValue;
   63|    773|}

_ZN2nl9ByteOrder18Swap16LittleToHostEt:
  160|  1.96k|        {
  161|  1.96k|            return nlByteOrderSwap16LittleToHost(inValue);
  162|  1.96k|        }
_ZN2nl9ByteOrder18Swap32LittleToHostEj:
  178|    773|        {
  179|    773|            return nlByteOrderSwap32LittleToHost(inValue);
  180|    773|        }
_ZN2nl9ByteOrder18Swap64LittleToHostEm:
  196|  8.67k|        {
  197|  8.67k|            return nlByteOrderSwap64LittleToHost(inValue);
  198|  8.67k|        }

TLVReader.cpp:_ZL9nlIORead8PPKv:
  982|    271|{
  983|    271|    return nlIOReadAligned8(p);
  984|    271|}
TLVReader.cpp:_ZL16nlIOReadAligned8PPKv:
  447|    271|{
  448|    271|    const uint8_t temp = nlIOGetAligned8(*p);
  449|       |
  450|    271|    *(const uint8_t **)(p) += sizeof (uint8_t);
  451|       |
  452|    271|    return temp;
  453|    271|}
TLVReader.cpp:_ZL15nlIOGetAligned8PKv:
   83|    271|{
   84|    271|    return *(const uint8_t *)(p);
   85|    271|}
TLVReader.cpp:_ZL19nlIOReadUnaligned16PPKv:
  542|  1.96k|{
  543|  1.96k|    const uint16_t temp = nlIOGetUnaligned16(*p);
  544|       |
  545|  1.96k|    *(const uint8_t **)(p) += sizeof (uint16_t);
  546|       |
  547|  1.96k|    return temp;
  548|  1.96k|}
TLVReader.cpp:_ZL18nlIOGetUnaligned16PKv:
  148|  1.96k|{
  149|  1.96k|    uint16_t temp;
  150|       |
  151|  1.96k|    __nlIO_MEMCPY(&temp, p, sizeof(uint16_t));
  ------------------
  |  |   44|  1.96k|#define __nlIO_MEMCPY __builtin_memcpy
  ------------------
  152|       |
  153|  1.96k|    return temp;
  154|  1.96k|}
TLVReader.cpp:_ZL19nlIOReadUnaligned32PPKv:
  561|    773|{
  562|    773|    const uint32_t temp = nlIOGetUnaligned32(*p);
  563|       |
  564|    773|    *(const uint8_t **)(p) += sizeof (uint32_t);
  565|       |
  566|    773|    return temp;
  567|    773|}
TLVReader.cpp:_ZL18nlIOGetUnaligned32PKv:
  165|    773|{
  166|    773|    uint32_t temp;
  167|       |
  168|    773|    __nlIO_MEMCPY(&temp, p, sizeof(uint32_t));
  ------------------
  |  |   44|    773|#define __nlIO_MEMCPY __builtin_memcpy
  ------------------
  169|       |
  170|    773|    return temp;
  171|    773|}

TLVReader.cpp:_ZN2nl2IOL5Read8ERPKv:
  901|    271|{
  902|    271|    return nlIORead8(&p);
  903|    271|}
TLVReader.cpp:_ZN2nl2IOL15ReadUnaligned16ERPKv:
  488|  1.96k|{
  489|  1.96k|    return nlIOReadUnaligned16(&p);
  490|  1.96k|}
TLVReader.cpp:_ZN2nl2IOL15ReadUnaligned32ERPKv:
  503|    773|{
  504|    773|    return nlIOReadUnaligned32(&p);
  505|    773|}

TLVReader.cpp:_ZN2nl2IO12LittleEndianL15ReadUnaligned16ERPKv:
  794|  1.96k|{
  795|  1.96k|    return ByteOrder::Swap16LittleToHost(IO::ReadUnaligned16(p));
  796|  1.96k|}
TLVReader.cpp:_ZN2nl2IO12LittleEndianL15ReadUnaligned32ERPKv:
  813|    773|{
  814|    773|    return ByteOrder::Swap32LittleToHost(IO::ReadUnaligned32(p));
  815|    773|}

