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

_ZN4chip9ChipErrorC2EjPKcj:
  190|   949M|        mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
  ------------------
  |  |  122|   949M|#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l))
  ------------------
  191|   949M|    {}
_ZNK4chip9ChipErroreqERKS0_:
  203|  34.9M|    bool operator==(const ChipError & other) const { return mError == other.mError; }
_ZNK4chip9ChipErrorneERKS0_:
  204|   194M|    bool operator!=(const ChipError & other) const { return mError != other.mError; }
_ZNK4chip9ChipError9AsIntegerEv:
  209|  36.4k|    constexpr StorageType AsInteger() const { return mError; }
_ZN4chip9ChipError9IsSuccessES0_:
  218|   395M|    static constexpr bool IsSuccess(ChipError error) { return error.mError == 0; }
_ZNK4chip9ChipError6FormatEv:
  231|  36.4k|    FormatType Format() const { return AsString(); }
_ZNK4chip9ChipError8AsStringEb:
  243|  36.4k|    {
  244|  36.4k|        extern const char * ErrorStr(ChipError, bool);
  245|  36.4k|        return ErrorStr(*this, withSourceLocation);
  246|  36.4k|    }
_ZNK4chip9ChipError7GetFileEv:
  319|  36.4k|    const char * GetFile() const { return mFile; }
_ZNK4chip9ChipError7GetLineEv:
  327|  36.4k|    unsigned int GetLine() const { return mLine; }

_ZN4chip8ErrorStrENS_9ChipErrorEb:
   52|  36.4k|{
   53|  36.4k|    return ErrorStr(err, withSourceLocation, sErrorStr);
   54|  36.4k|}
_ZN4chip8ErrorStrENS_9ChipErrorEbRNS_15ErrorStrStorageE:
   70|  36.4k|{
   71|  36.4k|    char * formattedError   = storage.buff;
   72|  36.4k|    uint16_t formattedSpace = storage.kBufferSize;
   73|       |
   74|  36.4k|#if CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR
   75|       |
   76|  36.4k|    if (const char * const file = err.GetFile(); withSourceLocation && file != nullptr)
  ------------------
  |  Branch (76:50): [True: 36.4k, False: 0]
  |  Branch (76:72): [True: 36.4k, False: 0]
  ------------------
   77|  36.4k|    {
   78|  36.4k|        int n = snprintf(formattedError, formattedSpace, "%s:%u: ", file, err.GetLine());
   79|  36.4k|        if (n > formattedSpace)
  ------------------
  |  Branch (79:13): [True: 0, False: 36.4k]
  ------------------
   80|      0|        {
   81|      0|            n = formattedSpace;
   82|      0|        }
   83|  36.4k|        formattedError += n;
   84|  36.4k|        formattedSpace = static_cast<uint16_t>(formattedSpace - n);
   85|  36.4k|    }
   86|  36.4k|#endif // CHIP_CONFIG_ERROR_SOURCE && !CHIP_CONFIG_SHORT_ERROR_STR
   87|       |
   88|  36.4k|    if (err == CHIP_NO_ERROR)
  ------------------
  |  |  482|  36.4k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (88:9): [True: 0, False: 36.4k]
  ------------------
   89|      0|    {
   90|      0|        (void) snprintf(formattedError, formattedSpace, CHIP_NO_ERROR_STRING);
  ------------------
  |  |   41|      0|#define CHIP_NO_ERROR_STRING "Success"
  ------------------
   91|      0|        return storage.buff;
   92|      0|    }
   93|       |
   94|       |    // Search the registered error formatter for one that will format the given
   95|       |    // error code.
   96|  36.4k|    for (const ErrorFormatter * errFormatter = sErrorFormatterList; errFormatter != nullptr; errFormatter = errFormatter->Next)
  ------------------
  |  Branch (96:69): [True: 0, False: 36.4k]
  ------------------
   97|      0|    {
   98|      0|        if (errFormatter->FormatError(formattedError, formattedSpace, err))
  ------------------
  |  Branch (98:13): [True: 0, False: 0]
  ------------------
   99|      0|        {
  100|      0|            return storage.buff;
  101|      0|        }
  102|      0|    }
  103|       |
  104|       |    // Use a default formatting if no formatter found.
  105|  36.4k|    FormatError(formattedError, formattedSpace, nullptr, err, nullptr);
  106|  36.4k|    return storage.buff;
  107|  36.4k|}
_ZN4chip11FormatErrorEPctPKcNS_9ChipErrorES2_:
  171|  36.4k|{
  172|       |#if CHIP_CONFIG_SHORT_ERROR_STR
  173|       |
  174|       |    if (subsys == nullptr)
  175|       |    {
  176|       |        (void) snprintf(buf, bufSize, "Error " CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT, err.AsInteger());
  177|       |    }
  178|       |    else
  179|       |    {
  180|       |        (void) snprintf(buf, bufSize, "Error %s:" CHIP_CONFIG_SHORT_FORM_ERROR_VALUE_FORMAT, subsys, err.AsInteger());
  181|       |    }
  182|       |
  183|       |#else // CHIP_CONFIG_SHORT_ERROR_STR
  184|       |
  185|  36.4k|    const char * subsysSep = " ";
  186|  36.4k|    const char * descSep   = ": ";
  187|       |
  188|  36.4k|    if (subsys == nullptr)
  ------------------
  |  Branch (188:9): [True: 36.4k, False: 0]
  ------------------
  189|  36.4k|    {
  190|  36.4k|        subsys    = "";
  191|  36.4k|        subsysSep = "";
  192|  36.4k|    }
  193|  36.4k|    if (desc == nullptr)
  ------------------
  |  Branch (193:9): [True: 36.4k, False: 0]
  ------------------
  194|  36.4k|    {
  195|  36.4k|        desc    = "";
  196|  36.4k|        descSep = "";
  197|  36.4k|    }
  198|       |
  199|  36.4k|    (void) snprintf(buf, bufSize, "%s%sError 0x%08" PRIX32 "%s%s", subsys, subsysSep, err.AsInteger(), descSep, desc);
  200|       |
  201|  36.4k|#endif // CHIP_CONFIG_SHORT_ERROR_STR
  202|  36.4k|}

_ZN4chip3TLV9TLVReaderC2Ev:
   53|   114k|    ImplicitProfileId(kProfileIdNotSpecified), AppData(nullptr), mElemLenOrVal(0), mBackingStore(nullptr), mReadPoint(nullptr),
   54|   114k|    mBufEnd(nullptr), mLenRead(0), mMaxLen(0), mContainerType(kTLVType_NotSpecified), mControlByte(kTLVControlByte_NotSpecified),
   55|   114k|    mContainerOpen(false)
   56|   114k|{}
_ZN4chip3TLV9TLVReader4InitEPKhm:
   59|  57.4k|{
   60|       |    // TODO: Maybe we can just make mMaxLen and mLenRead size_t instead?
   61|  57.4k|    uint32_t actualDataLen = dataLen > UINT32_MAX ? UINT32_MAX : static_cast<uint32_t>(dataLen);
  ------------------
  |  Branch (61:30): [True: 0, False: 57.4k]
  ------------------
   62|  57.4k|    mBackingStore          = nullptr;
   63|  57.4k|    mReadPoint             = data;
   64|  57.4k|    mBufEnd                = data + actualDataLen;
   65|  57.4k|    mLenRead               = 0;
   66|  57.4k|    mMaxLen                = actualDataLen;
   67|  57.4k|    ClearElementState();
   68|  57.4k|    mContainerType = kTLVType_NotSpecified;
   69|  57.4k|    SetContainerOpen(false);
   70|       |
   71|  57.4k|    ImplicitProfileId = kProfileIdNotSpecified;
   72|  57.4k|}
_ZNK4chip3TLV9TLVReader7GetTypeEv:
  117|  34.9M|{
  118|  34.9M|    TLVElementType elemType = ElementType();
  119|  34.9M|    if (elemType == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (119:9): [True: 0, False: 34.9M]
  ------------------
  120|      0|        return kTLVType_NotSpecified;
  121|  34.9M|    if (elemType == TLVElementType::FloatingPointNumber32 || elemType == TLVElementType::FloatingPointNumber64)
  ------------------
  |  Branch (121:9): [True: 5.51k, False: 34.8M]
  |  Branch (121:62): [True: 12.9k, False: 34.8M]
  ------------------
  122|  18.4k|        return kTLVType_FloatingPointNumber;
  123|  34.8M|    if (elemType == TLVElementType::NotSpecified || elemType >= TLVElementType::Null)
  ------------------
  |  Branch (123:9): [True: 0, False: 34.8M]
  |  Branch (123:53): [True: 34.5M, False: 305k]
  ------------------
  124|  34.5M|        return static_cast<TLVType>(elemType);
  125|   305k|    return static_cast<TLVType>(static_cast<uint8_t>(elemType) & ~kTLVTypeSizeMask);
  126|  34.8M|}
_ZNK4chip3TLV9TLVReader9GetLengthEv:
  129|  35.8M|{
  130|  35.8M|    if (TLVTypeHasLength(ElementType()))
  ------------------
  |  Branch (130:9): [True: 35.8M, False: 0]
  ------------------
  131|  35.8M|        return static_cast<uint32_t>(mElemLenOrVal);
  132|      0|    return 0;
  133|  35.8M|}
_ZNK4chip3TLV9TLVReader3GetERb:
  136|  69.1k|{
  137|  69.1k|    TLVElementType elemType = ElementType();
  138|  69.1k|    if (elemType == TLVElementType::BooleanFalse)
  ------------------
  |  Branch (138:9): [True: 25.0k, False: 44.0k]
  ------------------
  139|  25.0k|        v = false;
  140|  44.0k|    else if (elemType == TLVElementType::BooleanTrue)
  ------------------
  |  Branch (140:14): [True: 44.0k, False: 0]
  ------------------
  141|  44.0k|        v = true;
  142|      0|    else
  143|      0|        return CHIP_ERROR_WRONG_TLV_TYPE;
  ------------------
  |  |  829|      0|#define CHIP_ERROR_WRONG_TLV_TYPE                              CHIP_CORE_ERROR(0x26)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  144|  69.1k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  69.1k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  145|  69.1k|}
_ZNK4chip3TLV9TLVReader3GetERl:
  184|  16.7k|{
  185|       |    // Internal callers of this method depend on it not modifying "v" on failure.
  186|  16.7k|    switch (ElementType())
  187|  16.7k|    {
  188|  11.2k|    case TLVElementType::Int8:
  ------------------
  |  Branch (188:5): [True: 11.2k, False: 5.50k]
  ------------------
  189|  11.2k|        v = CastToSigned(static_cast<uint8_t>(mElemLenOrVal));
  190|  11.2k|        break;
  191|  1.82k|    case TLVElementType::Int16:
  ------------------
  |  Branch (191:5): [True: 1.82k, False: 14.9k]
  ------------------
  192|  1.82k|        v = CastToSigned(static_cast<uint16_t>(mElemLenOrVal));
  193|  1.82k|        break;
  194|  1.79k|    case TLVElementType::Int32:
  ------------------
  |  Branch (194:5): [True: 1.79k, False: 14.9k]
  ------------------
  195|  1.79k|        v = CastToSigned(static_cast<uint32_t>(mElemLenOrVal));
  196|  1.79k|        break;
  197|  1.89k|    case TLVElementType::Int64:
  ------------------
  |  Branch (197:5): [True: 1.89k, False: 14.8k]
  ------------------
  198|  1.89k|        v = CastToSigned(mElemLenOrVal);
  199|  1.89k|        break;
  200|      0|    default:
  ------------------
  |  Branch (200:5): [True: 0, False: 16.7k]
  ------------------
  201|      0|        return CHIP_ERROR_WRONG_TLV_TYPE;
  ------------------
  |  |  829|      0|#define CHIP_ERROR_WRONG_TLV_TYPE                              CHIP_CORE_ERROR(0x26)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  202|  16.7k|    }
  203|       |
  204|  16.7k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  16.7k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  205|  16.7k|}
_ZNK4chip3TLV9TLVReader3GetERj:
  232|  3.55k|{
  233|  3.55k|    uint64_t v64   = 0;
  234|  3.55k|    CHIP_ERROR err = Get(v64);
  235|  3.55k|    if (!CanCastTo<uint32_t>(v64))
  ------------------
  |  Branch (235:9): [True: 243, False: 3.30k]
  ------------------
  236|    243|    {
  237|    243|        return CHIP_ERROR_INVALID_INTEGER_VALUE;
  ------------------
  |  | 1388|    243|#define CHIP_ERROR_INVALID_INTEGER_VALUE                       CHIP_CORE_ERROR(0x8f)
  |  |  ------------------
  |  |  |  |  436|    243|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    243|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  238|    243|    }
  239|  3.30k|    v = static_cast<uint32_t>(v64);
  240|  3.30k|    return err;
  241|  3.55k|}
_ZNK4chip3TLV9TLVReader3GetERm:
  244|  64.2k|{
  245|       |    // Internal callers of this method depend on it not modifying "v" on failure.
  246|  64.2k|    switch (ElementType())
  247|  64.2k|    {
  248|  50.7k|    case TLVElementType::UInt8:
  ------------------
  |  Branch (248:5): [True: 50.7k, False: 13.5k]
  ------------------
  249|  53.1k|    case TLVElementType::UInt16:
  ------------------
  |  Branch (249:5): [True: 2.41k, False: 61.8k]
  ------------------
  250|  55.9k|    case TLVElementType::UInt32:
  ------------------
  |  Branch (250:5): [True: 2.73k, False: 61.5k]
  ------------------
  251|  62.2k|    case TLVElementType::UInt64:
  ------------------
  |  Branch (251:5): [True: 6.38k, False: 57.8k]
  ------------------
  252|  62.2k|        v = mElemLenOrVal;
  253|  62.2k|        break;
  254|  1.99k|    default:
  ------------------
  |  Branch (254:5): [True: 1.99k, False: 62.2k]
  ------------------
  255|  1.99k|        return CHIP_ERROR_WRONG_TLV_TYPE;
  ------------------
  |  |  829|  1.99k|#define CHIP_ERROR_WRONG_TLV_TYPE                              CHIP_CORE_ERROR(0x26)
  |  |  ------------------
  |  |  |  |  436|  1.99k|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.99k|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  256|  64.2k|    }
  257|  62.2k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  62.2k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  258|  64.2k|}
_ZNK4chip3TLV9TLVReader3GetERd:
  289|  9.18k|{
  290|  9.18k|    switch (ElementType())
  291|  9.18k|    {
  292|  2.73k|    case TLVElementType::FloatingPointNumber32: {
  ------------------
  |  Branch (292:5): [True: 2.73k, False: 6.45k]
  ------------------
  293|  2.73k|        v = BitCastToFloat(mElemLenOrVal);
  294|  2.73k|        break;
  295|      0|    }
  296|  6.45k|    case TLVElementType::FloatingPointNumber64: {
  ------------------
  |  Branch (296:5): [True: 6.45k, False: 2.73k]
  ------------------
  297|  6.45k|        double d;
  298|  6.45k|        memcpy(&d, &mElemLenOrVal, sizeof(d));
  299|  6.45k|        v = d;
  300|  6.45k|        break;
  301|      0|    }
  302|      0|    default:
  ------------------
  |  Branch (302:5): [True: 0, False: 9.18k]
  ------------------
  303|      0|        return CHIP_ERROR_WRONG_TLV_TYPE;
  ------------------
  |  |  829|      0|#define CHIP_ERROR_WRONG_TLV_TYPE                              CHIP_CORE_ERROR(0x26)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  304|  9.18k|    }
  305|  9.18k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  9.18k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  306|  9.18k|}
_ZNK4chip3TLV9TLVReader10GetDataPtrERPKh:
  498|  7.04k|{
  499|  7.04k|    VerifyOrReturnError(TLVTypeIsString(ElementType()), CHIP_ERROR_WRONG_TLV_TYPE);
  ------------------
  |  |  251|  7.04k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  7.04k|    do                                                                                                                             \
  |  |  |  |  271|  7.04k|    {                                                                                                                              \
  |  |  |  |  272|  7.04k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 7.04k]
  |  |  |  |  ------------------
  |  |  |  |  273|  7.04k|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  7.04k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  500|       |
  501|  7.04k|    if (GetLength() == 0)
  ------------------
  |  Branch (501:9): [True: 3.48k, False: 3.55k]
  ------------------
  502|  3.48k|    {
  503|  3.48k|        data = nullptr;
  504|  3.48k|        return CHIP_NO_ERROR;
  ------------------
  |  |  482|  3.48k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  505|  3.48k|    }
  506|       |
  507|  3.55k|    uint32_t remainingLen = static_cast<decltype(mMaxLen)>(mBufEnd - mReadPoint);
  508|       |
  509|       |    // Verify that the entirety of the data is available in the buffer.
  510|       |    // Note that this may not be possible if the reader is reading from a chain of buffers.
  511|  3.55k|    VerifyOrReturnError(remainingLen >= static_cast<uint32_t>(mElemLenOrVal), CHIP_ERROR_TLV_UNDERRUN);
  ------------------
  |  |  251|  3.55k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  3.55k|    do                                                                                                                             \
  |  |  |  |  271|  3.55k|    {                                                                                                                              \
  |  |  |  |  272|  3.55k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 3.55k]
  |  |  |  |  ------------------
  |  |  |  |  273|  3.55k|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  3.55k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  512|  3.55k|    data = mReadPoint;
  513|  3.55k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  3.55k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  514|  3.55k|}
_ZN4chip3TLV9TLVReader14EnterContainerERNS0_7TLVTypeE:
  563|  34.4M|{
  564|  34.4M|    TLVElementType elemType = ElementType();
  565|  34.4M|    if (!TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (565:9): [True: 0, False: 34.4M]
  ------------------
  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|  34.4M|    outerContainerType = mContainerType;
  569|  34.4M|    mContainerType     = static_cast<TLVType>(elemType);
  570|       |
  571|  34.4M|    ClearElementState();
  572|  34.4M|    SetContainerOpen(false);
  573|       |
  574|  34.4M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  34.4M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  575|  34.4M|}
_ZN4chip3TLV9TLVReader13ExitContainerENS0_7TLVTypeE:
  578|  34.3M|{
  579|  34.3M|    CHIP_ERROR err;
  580|       |
  581|  34.3M|    err = SkipToEndOfContainer();
  582|  34.3M|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  34.3M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (582:9): [True: 29.6k, False: 34.3M]
  ------------------
  583|  29.6k|        return err;
  584|       |
  585|  34.3M|    mContainerType = outerContainerType;
  586|  34.3M|    ClearElementState();
  587|       |
  588|  34.3M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  34.3M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  589|  34.3M|}
_ZN4chip3TLV9TLVReader4NextEv:
  602|  34.9M|{
  603|  34.9M|    ReturnErrorOnFailure(Skip());
  ------------------
  |  |  150|  34.9M|    do                                                                                                                             \
  |  |  151|  34.9M|    {                                                                                                                              \
  |  |  152|  34.9M|        auto __err = (expr);                                                                                                       \
  |  |  153|  34.9M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 2.39k, False: 34.9M]
  |  |  ------------------
  |  |  154|  34.9M|        {                                                                                                                          \
  |  |  155|  2.39k|            return __err;                                                                                                          \
  |  |  156|  2.39k|        }                                                                                                                          \
  |  |  157|  34.9M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  604|  34.9M|    ReturnErrorOnFailure(ReadElement());
  ------------------
  |  |  150|  34.9M|    do                                                                                                                             \
  |  |  151|  34.9M|    {                                                                                                                              \
  |  |  152|  34.9M|        auto __err = (expr);                                                                                                       \
  |  |  153|  34.9M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 31.1k, False: 34.8M]
  |  |  ------------------
  |  |  154|  34.9M|        {                                                                                                                          \
  |  |  155|  31.1k|            return __err;                                                                                                          \
  |  |  156|  31.1k|        }                                                                                                                          \
  |  |  157|  34.9M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  605|       |
  606|  34.8M|    TLVElementType elemType = ElementType();
  607|       |
  608|  34.8M|    VerifyOrReturnError(elemType != TLVElementType::EndOfContainer, CHIP_END_OF_TLV);
  ------------------
  |  |  251|  34.8M|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  34.8M|    do                                                                                                                             \
  |  |  |  |  271|  34.8M|    {                                                                                                                              \
  |  |  |  |  272|  34.8M|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 178k, False: 34.6M]
  |  |  |  |  ------------------
  |  |  |  |  273|  34.8M|        {                                                                                                                          \
  |  |  |  |  274|   178k|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|   178k|            return (value);                                                                                                        \
  |  |  |  |  276|   178k|        }                                                                                                                          \
  |  |  |  |  277|  34.8M|    } 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|  34.6M|    if (TLVTypeIsString(elemType) && (GetLength() != 0))
  ------------------
  |  Branch (612:9): [True: 7.37k, False: 34.6M]
  |  Branch (612:38): [True: 3.78k, False: 3.59k]
  ------------------
  613|  3.78k|    {
  614|  3.78k|        ReturnErrorOnFailure(EnsureData(CHIP_ERROR_TLV_UNDERRUN));
  ------------------
  |  |  150|  3.78k|    do                                                                                                                             \
  |  |  151|  3.78k|    {                                                                                                                              \
  |  |  152|  3.78k|        auto __err = (expr);                                                                                                       \
  |  |  153|  3.78k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 3.78k]
  |  |  ------------------
  |  |  154|  3.78k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  3.78k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  615|  3.78k|    }
  616|       |
  617|  34.6M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  34.6M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  618|  34.6M|}
_ZN4chip3TLV9TLVReader6ExpectENS0_7TLVTypeENS0_3TagE:
  635|  34.7k|{
  636|  34.7k|    VerifyOrReturnError(GetType() == expectedType, CHIP_ERROR_WRONG_TLV_TYPE);
  ------------------
  |  |  251|  34.7k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  34.7k|    do                                                                                                                             \
  |  |  |  |  271|  34.7k|    {                                                                                                                              \
  |  |  |  |  272|  34.7k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 1.12k, False: 33.6k]
  |  |  |  |  ------------------
  |  |  |  |  273|  34.7k|        {                                                                                                                          \
  |  |  |  |  274|  1.12k|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|  1.12k|            return (value);                                                                                                        \
  |  |  |  |  276|  1.12k|        }                                                                                                                          \
  |  |  |  |  277|  34.7k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  637|  33.6k|    VerifyOrReturnError(GetTag() == expectedTag, CHIP_ERROR_UNEXPECTED_TLV_ELEMENT);
  ------------------
  |  |  251|  33.6k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  33.6k|    do                                                                                                                             \
  |  |  |  |  271|  33.6k|    {                                                                                                                              \
  |  |  |  |  272|  33.6k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 2.26k, False: 31.3k]
  |  |  |  |  ------------------
  |  |  |  |  273|  33.6k|        {                                                                                                                          \
  |  |  |  |  274|  2.26k|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|  2.26k|            return (value);                                                                                                        \
  |  |  |  |  276|  2.26k|        }                                                                                                                          \
  |  |  |  |  277|  33.6k|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  638|  31.3k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  31.3k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  639|  33.6k|}
_ZN4chip3TLV9TLVReader4NextENS0_7TLVTypeENS0_3TagE:
  642|  36.5k|{
  643|  36.5k|    ReturnErrorOnFailure(Next());
  ------------------
  |  |  150|  36.5k|    do                                                                                                                             \
  |  |  151|  36.5k|    {                                                                                                                              \
  |  |  152|  36.5k|        auto __err = (expr);                                                                                                       \
  |  |  153|  36.5k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 1.82k, False: 34.7k]
  |  |  ------------------
  |  |  154|  36.5k|        {                                                                                                                          \
  |  |  155|  1.82k|            return __err;                                                                                                          \
  |  |  156|  1.82k|        }                                                                                                                          \
  |  |  157|  36.5k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  644|  34.7k|    ReturnErrorOnFailure(Expect(expectedType, expectedTag));
  ------------------
  |  |  150|  34.7k|    do                                                                                                                             \
  |  |  151|  34.7k|    {                                                                                                                              \
  |  |  152|  34.7k|        auto __err = (expr);                                                                                                       \
  |  |  153|  34.7k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 3.38k, False: 31.3k]
  |  |  ------------------
  |  |  154|  34.7k|        {                                                                                                                          \
  |  |  155|  3.38k|            return __err;                                                                                                          \
  |  |  156|  3.38k|        }                                                                                                                          \
  |  |  157|  34.7k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  645|  31.3k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  31.3k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  646|  34.7k|}
_ZN4chip3TLV9TLVReader4SkipEv:
  649|  34.9M|{
  650|  34.9M|    const TLVElementType elemType = ElementType();
  651|  34.9M|    VerifyOrReturnError(elemType != TLVElementType::EndOfContainer, CHIP_END_OF_TLV);
  ------------------
  |  |  251|  34.9M|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  34.9M|    do                                                                                                                             \
  |  |  |  |  271|  34.9M|    {                                                                                                                              \
  |  |  |  |  272|  34.9M|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 34.9M]
  |  |  |  |  ------------------
  |  |  |  |  273|  34.9M|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  34.9M|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  652|       |
  653|  34.9M|    if (TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (653:9): [True: 34.1M, False: 738k]
  ------------------
  654|  34.1M|    {
  655|  34.1M|        TLVType outerContainerType;
  656|  34.1M|        ReturnErrorOnFailure(EnterContainer(outerContainerType));
  ------------------
  |  |  150|  34.1M|    do                                                                                                                             \
  |  |  151|  34.1M|    {                                                                                                                              \
  |  |  152|  34.1M|        auto __err = (expr);                                                                                                       \
  |  |  153|  34.1M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 34.1M]
  |  |  ------------------
  |  |  154|  34.1M|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  34.1M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  657|  34.1M|        return ExitContainer(outerContainerType);
  658|  34.1M|    }
  659|       |
  660|   738k|    ReturnErrorOnFailure(SkipData());
  ------------------
  |  |  150|   738k|    do                                                                                                                             \
  |  |  151|   738k|    {                                                                                                                              \
  |  |  152|   738k|        auto __err = (expr);                                                                                                       \
  |  |  153|   738k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 738k]
  |  |  ------------------
  |  |  154|   738k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|   738k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  661|   738k|    ClearElementState();
  662|       |
  663|   738k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|   738k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  664|   738k|}
_ZN4chip3TLV9TLVReader17ClearElementStateEv:
  672|  69.6M|{
  673|  69.6M|    mElemTag      = AnonymousTag();
  674|  69.6M|    mControlByte  = kTLVControlByte_NotSpecified;
  675|  69.6M|    mElemLenOrVal = 0;
  676|  69.6M|}
_ZN4chip3TLV9TLVReader8SkipDataEv:
  688|  62.8M|{
  689|  62.8M|    CHIP_ERROR err          = CHIP_NO_ERROR;
  ------------------
  |  |  482|  62.8M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  690|  62.8M|    TLVElementType elemType = ElementType();
  691|       |
  692|  62.8M|    if (TLVTypeHasLength(elemType))
  ------------------
  |  Branch (692:9): [True: 10.4k, False: 62.8M]
  ------------------
  693|  10.4k|    {
  694|  10.4k|        err = ReadData(nullptr, static_cast<uint32_t>(mElemLenOrVal));
  695|  10.4k|    }
  696|       |
  697|  62.8M|    return err;
  698|  62.8M|}
_ZN4chip3TLV9TLVReader20SkipToEndOfContainerEv:
  701|  34.3M|{
  702|  34.3M|    CHIP_ERROR err;
  703|  34.3M|    TLVType outerContainerType = mContainerType;
  704|  34.3M|    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|  34.3M|    SetContainerOpen(false);
  711|       |
  712|  96.4M|    while (true)
  ------------------
  |  Branch (712:12): [Folded - Ignored]
  ------------------
  713|  96.4M|    {
  714|  96.4M|        TLVElementType elemType = ElementType();
  715|       |
  716|  96.4M|        if (elemType == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (716:13): [True: 34.5M, False: 61.9M]
  ------------------
  717|  34.5M|        {
  718|  34.5M|            if (nestLevel == 0)
  ------------------
  |  Branch (718:17): [True: 34.3M, False: 154k]
  ------------------
  719|  34.3M|                return CHIP_NO_ERROR;
  ------------------
  |  |  482|  34.3M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  720|       |
  721|   154k|            nestLevel--;
  722|   154k|            mContainerType = (nestLevel == 0) ? outerContainerType : kTLVType_UnknownContainer;
  ------------------
  |  Branch (722:30): [True: 11.3k, False: 142k]
  ------------------
  723|   154k|        }
  724|       |
  725|  61.9M|        else if (TLVTypeIsContainer(elemType))
  ------------------
  |  Branch (725:18): [True: 27.6M, False: 34.2M]
  ------------------
  726|  27.6M|        {
  727|  27.6M|            nestLevel++;
  728|  27.6M|            mContainerType = static_cast<TLVType>(elemType);
  729|  27.6M|        }
  730|       |
  731|  62.0M|        err = SkipData();
  732|  62.0M|        if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  62.0M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (732:13): [True: 14, False: 62.0M]
  ------------------
  733|     14|            return err;
  734|       |
  735|  62.0M|        err = ReadElement();
  736|  62.0M|        if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  62.0M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (736:13): [True: 29.6k, False: 62.0M]
  ------------------
  737|  29.6k|            return err;
  738|  62.0M|    }
  739|  34.3M|}
_ZN4chip3TLV9TLVReader11ReadElementEv:
  742|  97.0M|{
  743|       |    // Make sure we have input data. Return CHIP_END_OF_TLV if no more data is available.
  744|  97.0M|    ReturnErrorOnFailure(EnsureData(CHIP_END_OF_TLV));
  ------------------
  |  |  150|  97.0M|    do                                                                                                                             \
  |  |  151|  97.0M|    {                                                                                                                              \
  |  |  152|  97.0M|        auto __err = (expr);                                                                                                       \
  |  |  153|  97.0M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 55.1k, False: 96.9M]
  |  |  ------------------
  |  |  154|  97.0M|        {                                                                                                                          \
  |  |  155|  55.1k|            return __err;                                                                                                          \
  |  |  156|  55.1k|        }                                                                                                                          \
  |  |  157|  97.0M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  745|  96.9M|    VerifyOrReturnError(mReadPoint != nullptr, CHIP_ERROR_INVALID_TLV_ELEMENT);
  ------------------
  |  |  251|  96.9M|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  96.9M|    do                                                                                                                             \
  |  |  |  |  271|  96.9M|    {                                                                                                                              \
  |  |  |  |  272|  96.9M|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 0, False: 96.9M]
  |  |  |  |  ------------------
  |  |  |  |  273|  96.9M|        {                                                                                                                          \
  |  |  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|      0|            return (value);                                                                                                        \
  |  |  |  |  276|      0|        }                                                                                                                          \
  |  |  |  |  277|  96.9M|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  746|       |
  747|       |    // Get the element's control byte.
  748|  96.9M|    mControlByte = *mReadPoint;
  749|       |
  750|       |    // Extract the element type from the control byte. Fail if it's invalid.
  751|  96.9M|    TLVElementType elemType = ElementType();
  752|  96.9M|    VerifyOrReturnError(IsValidTLVType(elemType), CHIP_ERROR_INVALID_TLV_ELEMENT);
  ------------------
  |  |  251|  96.9M|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  96.9M|    do                                                                                                                             \
  |  |  |  |  271|  96.9M|    {                                                                                                                              \
  |  |  |  |  272|  96.9M|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:13): [True: 238, False: 96.9M]
  |  |  |  |  ------------------
  |  |  |  |  273|  96.9M|        {                                                                                                                          \
  |  |  |  |  274|    238|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|    238|            return (value);                                                                                                        \
  |  |  |  |  276|    238|        }                                                                                                                          \
  |  |  |  |  277|  96.9M|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  753|       |
  754|       |    // Extract the tag control from the control byte.
  755|  96.9M|    TLVTagControl tagControl = static_cast<TLVTagControl>(mControlByte & kTLVTagControlMask);
  756|       |
  757|       |    // Determine the number of bytes in the element's tag, if any.
  758|  96.9M|    uint8_t tagBytes = sTagSizes[tagControl >> kTLVTagControlShift];
  759|       |
  760|       |    // Extract the size of length/value field from the control byte.
  761|  96.9M|    TLVFieldSize lenOrValFieldSize = GetTLVFieldSize(elemType);
  762|       |
  763|       |    // Determine the number of bytes in the length/value field.
  764|  96.9M|    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|  96.9M|    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|  96.9M|    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|  96.9M|    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|  96.9M|    ReturnErrorOnFailure(ReadData(stagingBuf, elemHeadBytes));
  ------------------
  |  |  150|  96.9M|    do                                                                                                                             \
  |  |  151|  96.9M|    {                                                                                                                              \
  |  |  152|  96.9M|        auto __err = (expr);                                                                                                       \
  |  |  153|  96.9M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 504, False: 96.9M]
  |  |  ------------------
  |  |  154|  96.9M|        {                                                                                                                          \
  |  |  155|    504|            return __err;                                                                                                          \
  |  |  156|    504|        }                                                                                                                          \
  |  |  157|  96.9M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  781|       |
  782|       |    // +1 to skip over the control byte
  783|  96.9M|    const uint8_t * p = stagingBuf + 1;
  784|       |
  785|       |    // Read the tag field, if present.
  786|  96.9M|    mElemTag      = ReadTag(tagControl, p);
  787|  96.9M|    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|  96.9M|    memcpy(&mElemLenOrVal, p, valOrLenBytes);
  795|  96.9M|    LittleEndian::HostSwap(mElemLenOrVal);
  796|       |
  797|  96.9M|    VerifyOrReturnError(!TLVTypeHasLength(elemType) || (mElemLenOrVal <= UINT32_MAX), CHIP_ERROR_NOT_IMPLEMENTED);
  ------------------
  |  |  251|  96.9M|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  96.9M|    do                                                                                                                             \
  |  |  |  |  271|  96.9M|    {                                                                                                                              \
  |  |  |  |  272|  96.9M|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:15): [True: 96.9M, False: 12.1k]
  |  |  |  |  |  Branch (272:15): [True: 11.4k, False: 700]
  |  |  |  |  ------------------
  |  |  |  |  273|  96.9M|        {                                                                                                                          \
  |  |  |  |  274|    700|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|    700|            return (value);                                                                                                        \
  |  |  |  |  276|    700|        }                                                                                                                          \
  |  |  |  |  277|  96.9M|    } while (false)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  798|       |
  799|  96.9M|    return VerifyElement();
  800|  96.9M|}
_ZN4chip3TLV9TLVReader13VerifyElementEv:
  803|  96.9M|{
  804|  96.9M|    if (ElementType() == TLVElementType::EndOfContainer)
  ------------------
  |  Branch (804:9): [True: 34.5M, False: 62.4M]
  ------------------
  805|  34.5M|    {
  806|  34.5M|        if (mContainerType == kTLVType_NotSpecified)
  ------------------
  |  Branch (806:13): [True: 14, False: 34.5M]
  ------------------
  807|     14|            return CHIP_ERROR_INVALID_TLV_ELEMENT;
  ------------------
  |  |  801|     14|#define CHIP_ERROR_INVALID_TLV_ELEMENT                         CHIP_CORE_ERROR(0x23)
  |  |  ------------------
  |  |  |  |  436|     14|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     14|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  808|  34.5M|        if (mElemTag != AnonymousTag())
  ------------------
  |  Branch (808:13): [True: 1.48k, False: 34.4M]
  ------------------
  809|  1.48k|            return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|  1.48k|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|  1.48k|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.48k|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  810|  34.5M|    }
  811|  62.4M|    else
  812|  62.4M|    {
  813|  62.4M|        if (mElemTag == UnknownImplicitTag())
  ------------------
  |  Branch (813:13): [True: 42, False: 62.4M]
  ------------------
  814|     42|            return CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG;
  ------------------
  |  |  820|     42|#define CHIP_ERROR_UNKNOWN_IMPLICIT_TLV_TAG                    CHIP_CORE_ERROR(0x25)
  |  |  ------------------
  |  |  |  |  436|     42|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|     42|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  815|  62.4M|        switch (mContainerType)
  816|  62.4M|        {
  817|  35.6k|        case kTLVType_NotSpecified:
  ------------------
  |  Branch (817:9): [True: 35.6k, False: 62.4M]
  ------------------
  818|  35.6k|            if (IsContextTag(mElemTag))
  ------------------
  |  Branch (818:17): [True: 196, False: 35.4k]
  ------------------
  819|    196|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|    196|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|    196|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    196|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  820|  35.4k|            break;
  821|   117k|        case kTLVType_Structure:
  ------------------
  |  Branch (821:9): [True: 117k, False: 62.3M]
  ------------------
  822|   117k|            if (mElemTag == AnonymousTag())
  ------------------
  |  Branch (822:17): [True: 378, False: 117k]
  ------------------
  823|    378|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|    378|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|    378|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    378|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  824|   117k|            break;
  825|  26.4M|        case kTLVType_Array:
  ------------------
  |  Branch (825:9): [True: 26.4M, False: 36.0M]
  ------------------
  826|  26.4M|            if (mElemTag != AnonymousTag())
  ------------------
  |  Branch (826:17): [True: 1.41k, False: 26.4M]
  ------------------
  827|  1.41k|                return CHIP_ERROR_INVALID_TLV_TAG;
  ------------------
  |  |  810|  1.41k|#define CHIP_ERROR_INVALID_TLV_TAG                             CHIP_CORE_ERROR(0x24)
  |  |  ------------------
  |  |  |  |  436|  1.41k|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|  1.41k|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  828|  26.4M|            break;
  829|  26.4M|        case kTLVType_UnknownContainer:
  ------------------
  |  Branch (829:9): [True: 143k, False: 62.3M]
  ------------------
  830|  35.8M|        case kTLVType_List:
  ------------------
  |  Branch (830:9): [True: 35.7M, False: 26.7M]
  ------------------
  831|  35.8M|            break;
  832|      0|        default:
  ------------------
  |  Branch (832:9): [True: 0, False: 62.4M]
  ------------------
  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|  62.4M|        }
  835|  62.4M|    }
  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|  96.9M|    if (TLVTypeHasLength(ElementType()))
  ------------------
  |  Branch (845:9): [True: 11.3k, False: 96.9M]
  ------------------
  846|  11.3k|    {
  847|  11.3k|        uint32_t overallLenRemaining = mMaxLen - mLenRead;
  848|  11.3k|        if (overallLenRemaining < static_cast<uint32_t>(mElemLenOrVal))
  ------------------
  |  Branch (848:13): [True: 770, False: 10.6k]
  ------------------
  849|    770|            return CHIP_ERROR_TLV_UNDERRUN;
  ------------------
  |  |  792|    770|#define CHIP_ERROR_TLV_UNDERRUN                                CHIP_CORE_ERROR(0x22)
  |  |  ------------------
  |  |  |  |  436|    770|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  ------------------
  |  |  |  |  |  |  171|    770|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  850|  11.3k|    }
  851|       |
  852|  96.9M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  96.9M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  853|  96.9M|}
_ZNK4chip3TLV9TLVReader7ReadTagENS0_13TLVTagControlERPKh:
  856|  96.9M|{
  857|  96.9M|    uint16_t vendorId;
  858|  96.9M|    uint16_t profileNum;
  859|       |
  860|  96.9M|    switch (tagControl)
  861|  96.9M|    {
  862|   191k|    case TLVTagControl::ContextSpecific:
  ------------------
  |  Branch (862:5): [True: 191k, False: 96.7M]
  ------------------
  863|   191k|        return ContextTag(Read8(p));
  864|  4.45k|    case TLVTagControl::CommonProfile_2Bytes:
  ------------------
  |  Branch (864:5): [True: 4.45k, False: 96.9M]
  ------------------
  865|  4.45k|        return CommonTag(LittleEndian::Read16(p));
  866|  6.58k|    case TLVTagControl::CommonProfile_4Bytes:
  ------------------
  |  Branch (866:5): [True: 6.58k, False: 96.9M]
  ------------------
  867|  6.58k|        return CommonTag(LittleEndian::Read32(p));
  868|     42|    case TLVTagControl::ImplicitProfile_2Bytes:
  ------------------
  |  Branch (868:5): [True: 42, False: 96.9M]
  ------------------
  869|     42|        if (ImplicitProfileId == kProfileIdNotSpecified)
  ------------------
  |  Branch (869:13): [True: 42, False: 0]
  ------------------
  870|     42|            return UnknownImplicitTag();
  871|      0|        return ProfileTag(ImplicitProfileId, LittleEndian::Read16(p));
  872|     14|    case TLVTagControl::ImplicitProfile_4Bytes:
  ------------------
  |  Branch (872:5): [True: 14, False: 96.9M]
  ------------------
  873|     14|        if (ImplicitProfileId == kProfileIdNotSpecified)
  ------------------
  |  Branch (873:13): [True: 14, False: 0]
  ------------------
  874|     14|            return UnknownImplicitTag();
  875|      0|        return ProfileTag(ImplicitProfileId, LittleEndian::Read32(p));
  876|  6.52k|    case TLVTagControl::FullyQualified_6Bytes:
  ------------------
  |  Branch (876:5): [True: 6.52k, False: 96.9M]
  ------------------
  877|  6.52k|        vendorId   = LittleEndian::Read16(p);
  878|  6.52k|        profileNum = LittleEndian::Read16(p);
  879|  6.52k|        return ProfileTag(vendorId, profileNum, LittleEndian::Read16(p));
  880|  3.83k|    case TLVTagControl::FullyQualified_8Bytes:
  ------------------
  |  Branch (880:5): [True: 3.83k, False: 96.9M]
  ------------------
  881|  3.83k|        vendorId   = LittleEndian::Read16(p);
  882|  3.83k|        profileNum = LittleEndian::Read16(p);
  883|  3.83k|        return ProfileTag(vendorId, profileNum, LittleEndian::Read32(p));
  884|  96.7M|    case TLVTagControl::Anonymous:
  ------------------
  |  Branch (884:5): [True: 96.7M, False: 212k]
  ------------------
  885|  96.7M|    default:
  ------------------
  |  Branch (885:5): [True: 0, False: 96.9M]
  ------------------
  886|  96.7M|        return AnonymousTag();
  887|  96.9M|    }
  888|  96.9M|}
_ZN4chip3TLV9TLVReader8ReadDataEPhj:
  891|  96.9M|{
  892|   193M|    while (len > 0)
  ------------------
  |  Branch (892:12): [True: 96.9M, False: 96.9M]
  ------------------
  893|  96.9M|    {
  894|  96.9M|        ReturnErrorOnFailure(EnsureData(CHIP_ERROR_TLV_UNDERRUN));
  ------------------
  |  |  150|  96.9M|    do                                                                                                                             \
  |  |  151|  96.9M|    {                                                                                                                              \
  |  |  152|  96.9M|        auto __err = (expr);                                                                                                       \
  |  |  153|  96.9M|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 518, False: 96.9M]
  |  |  ------------------
  |  |  154|  96.9M|        {                                                                                                                          \
  |  |  155|    518|            return __err;                                                                                                          \
  |  |  156|    518|        }                                                                                                                          \
  |  |  157|  96.9M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  895|       |
  896|  96.9M|        uint32_t remainingLen = static_cast<decltype(mMaxLen)>(mBufEnd - mReadPoint);
  897|       |
  898|  96.9M|        uint32_t readLen = len;
  899|  96.9M|        if (readLen > remainingLen)
  ------------------
  |  Branch (899:13): [True: 504, False: 96.9M]
  ------------------
  900|    504|            readLen = remainingLen;
  901|       |
  902|  96.9M|        if (buf != nullptr)
  ------------------
  |  Branch (902:13): [True: 96.9M, False: 5.08k]
  ------------------
  903|  96.9M|        {
  904|  96.9M|            memcpy(buf, mReadPoint, readLen);
  905|  96.9M|            buf += readLen;
  906|  96.9M|        }
  907|  96.9M|        mReadPoint += readLen;
  908|  96.9M|        mLenRead += readLen;
  909|  96.9M|        len -= readLen;
  910|  96.9M|    }
  911|       |
  912|  96.9M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  96.9M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  913|  96.9M|}
_ZN4chip3TLV9TLVReader10EnsureDataENS_9ChipErrorE:
  916|   193M|{
  917|   193M|    if (mReadPoint == mBufEnd)
  ------------------
  |  Branch (917:9): [True: 55.6k, False: 193M]
  ------------------
  918|  55.6k|    {
  919|  55.6k|        VerifyOrReturnError((mLenRead != mMaxLen) && (mBackingStore != nullptr), noDataErr);
  ------------------
  |  |  251|  55.6k|#define VerifyOrReturnError(expr, code, ...) VerifyOrReturnValue(expr, code, ##__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  270|  55.6k|    do                                                                                                                             \
  |  |  |  |  271|  55.6k|    {                                                                                                                              \
  |  |  |  |  272|  55.6k|        if (!(expr))                                                                                                               \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (272:15): [True: 0, False: 55.6k]
  |  |  |  |  |  Branch (272:15): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  273|  55.6k|        {                                                                                                                          \
  |  |  |  |  274|  55.6k|            __VA_ARGS__;                                                                                                           \
  |  |  |  |  275|  55.6k|            return (value);                                                                                                        \
  |  |  |  |  276|  55.6k|        }                                                                                                                          \
  |  |  |  |  277|  55.6k|    } 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|   193M|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|   193M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  932|   193M|}
_ZNK4chip3TLV9TLVReader11ElementTypeEv:
  974|   625M|{
  975|   625M|    if (mControlByte == static_cast<uint16_t>(kTLVControlByte_NotSpecified))
  ------------------
  |  Branch (975:9): [True: 69.4M, False: 555M]
  ------------------
  976|  69.4M|        return TLVElementType::NotSpecified;
  977|   555M|    return static_cast<TLVElementType>(mControlByte & kTLVTypeMask);
  978|   625M|}
TLVReader.cpp:_ZN4chip3TLV12_GLOBAL__N_114BitCastToFloatEm:
  262|  2.73k|{
  263|  2.73k|    float f;
  264|  2.73k|    auto unsigned32 = static_cast<uint32_t>(elemLenOrVal);
  265|  2.73k|    memcpy(&f, &unsigned32, sizeof(f));
  266|  2.73k|    return f;
  267|  2.73k|}

_ZN4chip3TLV9TLVReader4InitERKNS_4SpanIKhEE:
  116|  57.4k|    void Init(const ByteSpan & data) { Init(data.data(), data.size()); }
_ZNK4chip3TLV9TLVReader6GetTagEv:
  258|   102M|    Tag GetTag() const { return mElemTag; }
_ZNK4chip3TLV9TLVReader14GetTotalLengthEv:
  863|  41.7k|    uint32_t GetTotalLength() const { return mMaxLen; }
_ZN4chip3TLV9TLVReader16SetContainerOpenEb:
  971|  68.9M|    void SetContainerOpen(bool aContainerOpen) { mContainerOpen = aContainerOpen; }

_ZN4chip3TLV3Tag8AppendToERNS_17StringBuilderBaseE:
   30|  34.6M|{
   31|  34.6M|    if (TLV::IsProfileTag(*this))
  ------------------
  |  Branch (31:9): [True: 11.2k, False: 34.6M]
  ------------------
   32|  11.2k|    {
   33|  11.2k|        out.AddFormat("ProfileTag(0x%X::0x%X::0x%" PRIX32 ")", TLV::VendorIdFromTag(*this), TLV::ProfileNumFromTag(*this),
   34|  11.2k|                      TLV::TagNumFromTag(*this));
   35|  11.2k|    }
   36|  34.6M|    else if (TLV::IsContextTag(*this))
  ------------------
  |  Branch (36:14): [True: 151k, False: 34.4M]
  ------------------
   37|   151k|    {
   38|   151k|        out.AddFormat("ContextTag(0x%" PRIX32 ")", TLV::TagNumFromTag(*this));
   39|   151k|    }
   40|  34.4M|    else if (*this == TLV::AnonymousTag())
  ------------------
  |  Branch (40:14): [True: 34.4M, False: 2.03k]
  ------------------
   41|  34.4M|    {
   42|  34.4M|        out.Add("AnonymousTag()");
   43|  34.4M|    }
   44|  2.03k|    else
   45|  2.03k|    {
   46|  2.03k|        out.AddFormat("UnknownTag(0x" ChipLogFormatX64 ")", ChipLogValueX64(mVal));
  ------------------
  |  |  235|  2.03k|#define ChipLogValueX64(aValue) static_cast<uint32_t>(aValue >> 32), static_cast<uint32_t>(aValue)
  ------------------
   47|  2.03k|    }
   48|       |
   49|  34.6M|    return out;
   50|  34.6M|}

_ZNK4chip3TLV3TageqERKS1_:
   41|  98.3M|    constexpr bool operator==(const Tag & other) const { return mVal == other.mVal; }
_ZNK4chip3TLV3TagneERKS1_:
   42|  60.9M|    constexpr bool operator!=(const Tag & other) const { return mVal != other.mVal; }
_ZN4chip3TLV3TagC2Em:
   48|   325M|    explicit constexpr Tag(uint64_t val) : mVal(val) {}
_ZN4chip3TLV10ProfileTagEjj:
  136|   325M|{
  137|   325M|    return Tag((static_cast<uint64_t>(~profileId) << Tag::kProfileIdShift) | tagNum);
  138|   325M|}
_ZN4chip3TLV10ProfileTagEttj:
  149|  10.3k|{
  150|  10.3k|    constexpr uint32_t kVendorIdShift = Tag::kVendorIdShift - Tag::kProfileIdShift;
  151|       |
  152|  10.3k|    return ProfileTag((static_cast<uint32_t>(vendorId) << kVendorIdShift) | profileNum, tagNum);
  153|  10.3k|}
_ZN4chip3TLV10ContextTagEh:
  162|   191k|{
  163|   191k|    return ProfileTag(Tag::kSpecialTagProfileId, tagNum);
  164|   191k|}
_ZN4chip3TLV9CommonTagEj:
  202|  77.1k|{
  203|  77.1k|    return ProfileTag(kCommonProfileId, tagNum);
  204|  77.1k|}
_ZN4chip3TLV12AnonymousTagEv:
  210|   263M|{
  211|   263M|    return ProfileTag(Tag::kSpecialTagProfileId, Tag::kAnonymousTagNum);
  212|   263M|}
_ZN4chip3TLV18UnknownImplicitTagEv:
  218|  62.4M|{
  219|  62.4M|    return ProfileTag(Tag::kSpecialTagProfileId, Tag::kUnknownImplicitTagNum);
  220|  62.4M|}
_ZN4chip3TLV16ProfileIdFromTagENS0_3TagE:
  231|  69.2M|{
  232|  69.2M|    return ~static_cast<uint32_t>(tag.mVal >> Tag::kProfileIdShift);
  233|  69.2M|}
_ZN4chip3TLV15VendorIdFromTagENS0_3TagE:
  244|  11.2k|{
  245|  11.2k|    constexpr uint32_t kVendorIdShift = Tag::kVendorIdShift - Tag::kProfileIdShift;
  246|       |
  247|  11.2k|    return static_cast<uint16_t>(ProfileIdFromTag(tag) >> kVendorIdShift);
  248|  11.2k|}
_ZN4chip3TLV17ProfileNumFromTagENS0_3TagE:
  259|  11.2k|{
  260|  11.2k|    return static_cast<uint16_t>(ProfileIdFromTag(tag));
  261|  11.2k|}
_ZN4chip3TLV13TagNumFromTagENS0_3TagE:
  275|  34.7M|{
  276|  34.7M|    return static_cast<uint32_t>(tag.mVal);
  277|  34.7M|}
_ZN4chip3TLV12IsProfileTagENS0_3TagE:
  283|  34.6M|{
  284|  34.6M|    return ProfileIdFromTag(tag) != Tag::kSpecialTagProfileId;
  285|  34.6M|}
_ZN4chip3TLV12IsContextTagENS0_3TagE:
  291|  34.6M|{
  292|  34.6M|    return ProfileIdFromTag(tag) == Tag::kSpecialTagProfileId && TagNumFromTag(tag) <= Tag::kContextTagMaxNum;
  ------------------
  |  Branch (292:12): [True: 34.6M, False: 1.89k]
  |  Branch (292:66): [True: 152k, False: 34.4M]
  ------------------
  293|  34.6M|}
TLVReader.cpp:_ZN4chip3TLVrsINS0_3$_0EEEhNS0_13TLVTagControlERKT_:
  117|  96.9M|{
  118|  96.9M|    return static_cast<uint8_t>(static_cast<uint8_t>(lhs) >> rhs);
  119|  96.9M|}

_ZN4chip3TLV14IsValidTLVTypeENS0_14TLVElementTypeE:
  124|  96.9M|{
  125|  96.9M|    return type <= TLVElementType::EndOfContainer;
  126|  96.9M|}
_ZN4chip3TLV15TLVTypeHasValueENS0_14TLVElementTypeE:
  134|  96.9M|{
  135|  96.9M|    return (type <= TLVElementType::UInt64 ||
  ------------------
  |  Branch (135:13): [True: 116k, False: 96.8M]
  ------------------
  136|  96.9M|            (type >= TLVElementType::FloatingPointNumber32 && type <= TLVElementType::ByteString_8ByteLength));
  ------------------
  |  Branch (136:14): [True: 96.7M, False: 73.4k]
  |  Branch (136:63): [True: 25.4k, False: 96.7M]
  ------------------
  137|  96.9M|}
_ZN4chip3TLV16TLVTypeHasLengthENS0_14TLVElementTypeE:
  145|   292M|{
  146|   292M|    return type >= TLVElementType::UTF8String_1ByteLength && type <= TLVElementType::ByteString_8ByteLength;
  ------------------
  |  Branch (146:12): [True: 257M, False: 35.3M]
  |  Branch (146:62): [True: 35.9M, False: 221M]
  ------------------
  147|   292M|}
_ZN4chip3TLV18TLVTypeIsContainerENS0_14TLVElementTypeE:
  155|   131M|{
  156|   131M|    return type >= TLVElementType::Structure && type <= TLVElementType::List;
  ------------------
  |  Branch (156:12): [True: 96.3M, False: 34.9M]
  |  Branch (156:49): [True: 96.3M, False: 0]
  ------------------
  157|   131M|}
_ZN4chip3TLV18TLVTypeIsContainerENS0_7TLVTypeE:
  160|  34.6M|{
  161|  34.6M|    return type >= kTLVType_Structure && type <= kTLVType_List;
  ------------------
  |  Branch (161:12): [True: 34.4M, False: 204k]
  |  Branch (161:42): [True: 34.4M, False: 0]
  ------------------
  162|  34.6M|}
_ZN4chip3TLV15TLVTypeIsStringENS0_14TLVElementTypeE:
  170|  34.7M|{
  171|  34.7M|    return type >= TLVElementType::UTF8String_1ByteLength && type <= TLVElementType::ByteString_8ByteLength;
  ------------------
  |  Branch (171:12): [True: 34.5M, False: 153k]
  |  Branch (171:62): [True: 14.4k, False: 34.5M]
  ------------------
  172|  34.7M|}
_ZN4chip3TLV15GetTLVFieldSizeENS0_14TLVElementTypeE:
  196|  96.9M|{
  197|  96.9M|    if (TLVTypeHasValue(type))
  ------------------
  |  Branch (197:9): [True: 141k, False: 96.8M]
  ------------------
  198|   141k|        return static_cast<TLVFieldSize>(static_cast<uint8_t>(type) & kTLVTypeSizeMask);
  199|  96.8M|    return kTLVFieldSize_0Byte;
  200|  96.9M|}
_ZN4chip3TLV19TLVFieldSizeToBytesENS0_12TLVFieldSizeE:
  204|  96.9M|{
  205|       |    // We would like to assert fieldSize < 7, but that gives us fatal
  206|       |    // -Wtautological-constant-out-of-range-compare warnings...
  207|  96.9M|    return static_cast<uint8_t>((fieldSize != kTLVFieldSize_0Byte) ? (1 << fieldSize) : 0);
  ------------------
  |  Branch (207:33): [True: 141k, False: 96.8M]
  ------------------
  208|  96.9M|}

protocol_decoder.cpp:_ZN4chip8FlatTree9FindEntryINS_7TLVMeta8ItemInfoENS_8Decoders12_GLOBAL__N_15ByTagEEEPKNS0_5EntryIT_EEPKNS0_4NodeIS8_EEmmT0_:
   79|   246k|{
   80|   246k|    if (idx >= content_size)
  ------------------
  |  Branch (80:9): [True: 30.7k, False: 216k]
  ------------------
   81|  30.7k|    {
   82|  30.7k|        return nullptr;
   83|  30.7k|    }
   84|   216k|    return content[idx].find_entry(matcher);
   85|   246k|}
protocol_decoder.cpp:_ZNK4chip8FlatTree4NodeINS_7TLVMeta8ItemInfoEE10find_entryINS_8Decoders12_GLOBAL__N_15ByTagEEEPKNS0_5EntryIS3_EET_:
   60|   216k|    {
   61|  1.36M|        for (size_t i = 0; i < entry_count; i++)
  ------------------
  |  Branch (61:28): [True: 1.31M, False: 54.9k]
  ------------------
   62|  1.31M|        {
   63|  1.31M|            if (matcher(entries[i].data))
  ------------------
  |  Branch (63:17): [True: 161k, False: 1.15M]
  ------------------
   64|   161k|            {
   65|   161k|                return &entries[i];
   66|   161k|            }
   67|  1.31M|        }
   68|  54.9k|        return nullptr;
   69|   216k|    }

_ZNK4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE3GetEv:
  111|  35.2M|{
  112|  35.2M|    if (mUnknownDescendDepth > 0)
  ------------------
  |  Branch (112:9): [True: 35.0M, False: 178k]
  ------------------
  113|  35.0M|    {
  114|  35.0M|        return nullptr;
  115|  35.0M|    }
  116|       |
  117|   178k|    if (mDescendDepth == 0)
  ------------------
  |  Branch (117:9): [True: 0, False: 178k]
  ------------------
  118|      0|    {
  119|      0|        return nullptr;
  120|      0|    }
  121|       |
  122|   178k|    return &mPositions[mDescendDepth - 1]->data;
  123|   178k|}
protocol_decoder.cpp:_ZN4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE5EnterINS_8Decoders12_GLOBAL__N_15ByTagEEEvT_:
  128|  34.8M|{
  129|  34.8M|    if (mUnknownDescendDepth > 0)
  ------------------
  |  Branch (129:9): [True: 34.5M, False: 246k]
  ------------------
  130|  34.5M|    {
  131|       |        // keep descending into the unknown
  132|  34.5M|        mUnknownDescendDepth++;
  133|  34.5M|        return;
  134|  34.5M|    }
  135|       |
  136|       |    // To be able to descend, we have to be able to remember
  137|       |    // the current position
  138|   246k|    if (mDescendDepth == DESCEND_DEPTH)
  ------------------
  |  Branch (138:9): [True: 0, False: 246k]
  ------------------
  139|      0|    {
  140|      0|        mUnknownDescendDepth = 1;
  141|      0|        return;
  142|      0|    }
  143|       |
  144|   246k|    size_t nodeIdx = 0; // assume root node
  145|   246k|    if (mDescendDepth > 0)
  ------------------
  |  Branch (145:9): [True: 180k, False: 66.1k]
  ------------------
  146|   180k|    {
  147|   180k|        nodeIdx = mPositions[mDescendDepth - 1]->node_index;
  148|   180k|    }
  149|       |
  150|   246k|    const Entry<CONTENT> * child = FindEntry(mTree, mTreeSize, nodeIdx, matcher);
  151|       |
  152|   246k|    if (child == nullptr)
  ------------------
  |  Branch (152:9): [True: 85.6k, False: 161k]
  ------------------
  153|  85.6k|    {
  154|  85.6k|        mUnknownDescendDepth = 1;
  155|  85.6k|        return;
  156|  85.6k|    }
  157|       |
  158|   161k|    mPositions[mDescendDepth++] = child;
  159|   161k|}
_ZN4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE4ExitEv:
  163|   424k|{
  164|   424k|    if (mUnknownDescendDepth > 0)
  ------------------
  |  Branch (164:9): [True: 385k, False: 38.5k]
  ------------------
  165|   385k|    {
  166|   385k|        mUnknownDescendDepth--;
  167|   385k|        return;
  168|   385k|    }
  169|       |
  170|  38.5k|    if (mDescendDepth > 0)
  ------------------
  |  Branch (170:9): [True: 38.5k, False: 0]
  ------------------
  171|  38.5k|    {
  172|  38.5k|        mDescendDepth--;
  173|  38.5k|    }
  174|  38.5k|}
_ZN4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EEC2EPKNS0_4NodeIS3_EEm:
   57|   114k|    Position(const Node<CONTENT> * tree, size_t treeSize) : mTree(tree), mTreeSize(treeSize) {}
_ZN4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE10ResetToTopEv:
   65|   123k|    {
   66|   123k|        mDescendDepth        = 0;
   67|   123k|        mUnknownDescendDepth = 0;
   68|   123k|    }
_ZNK4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE12DescendDepthEv:
   93|  12.7k|    size_t DescendDepth() const { return mDescendDepth + mUnknownDescendDepth; }
_ZNK4chip8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EE12HasValidTreeEv:
   91|  5.08k|    bool HasValidTree() const { return mTree != nullptr; }

_ZN4chip8Decoders18PayloadDecoderBaseC2ERKNS0_24PayloadDecoderInitParamsERNS_17StringBuilderBaseES6_:
  193|  57.4k|    mProtocol(params.GetProtocol()),
  194|  57.4k|    mMessageType(params.GetMessageType()), mNameBuilder(nameBuilder), mValueBuilder(valueBuilder),
  195|       |
  196|  57.4k|    mPayloadPosition(params.GetProtocolDecodeTree(), params.GetProtocolDecodeTreeSize()),
  197|  57.4k|    mIMContentPosition(params.GetClusterDecodeTree(), params.GetClusterDecodeTreeSize())
  198|  57.4k|{}
_ZN4chip8Decoders18PayloadDecoderBase13StartDecodingERKNS_3TLV9TLVReaderE:
  201|  57.4k|{
  202|  57.4k|    mReader = reader;
  203|  57.4k|    mPayloadPosition.ResetToTop();
  204|  57.4k|    mIMContentPosition.ResetToTop();
  205|  57.4k|    mCurrentNesting = 0;
  206|  57.4k|    mClusterId      = 0;
  207|  57.4k|    mAttributeId    = 0;
  208|  57.4k|    mEventId        = 0;
  209|  57.4k|    mCommandId      = 0;
  210|  57.4k|    mState          = State::kStarting;
  211|  57.4k|}
_ZN4chip8Decoders18PayloadDecoderBase4NextERNS0_12PayloadEntryE:
  214|  34.9M|{
  215|  34.9M|    switch (mState)
  ------------------
  |  Branch (215:13): [True: 0, False: 34.9M]
  ------------------
  216|  34.9M|    {
  217|  57.4k|    case State::kStarting:
  ------------------
  |  Branch (217:5): [True: 57.4k, False: 34.9M]
  ------------------
  218|  57.4k|        NextFromStarting(entry);
  219|  57.4k|        return true;
  220|  32.4M|    case State::kValueRead:
  ------------------
  |  Branch (220:5): [True: 32.4M, False: 2.58M]
  ------------------
  221|  32.4M|        NextFromValueRead(entry);
  222|  32.4M|        return true;
  223|  2.46M|    case State::kContentRead:
  ------------------
  |  Branch (223:5): [True: 2.46M, False: 32.5M]
  ------------------
  224|  2.46M|        NextFromContentRead(entry);
  225|  2.46M|        return true;
  226|  57.4k|    case State::kDone:
  ------------------
  |  Branch (226:5): [True: 57.4k, False: 34.9M]
  ------------------
  227|  57.4k|        return false;
  228|  34.9M|    }
  229|       |    // should never happen
  230|      0|    return false;
  231|  34.9M|}
_ZN4chip8Decoders18PayloadDecoderBase16NextFromStartingERNS0_12PayloadEntryE:
  234|  57.4k|{
  235|       |    // Find the right protocol (fake cluster id)
  236|  57.4k|    mPayloadPosition.Enter(ByTag(ClusterTag(0xFFFF0000 | mProtocol.ToFullyQualifiedSpecForm())));
  237|  57.4k|    mPayloadPosition.Enter(ByTag(AttributeTag(mMessageType)));
  238|       |
  239|  57.4k|    auto data = mPayloadPosition.Get();
  240|  57.4k|    if (data == nullptr)
  ------------------
  |  Branch (240:9): [True: 15.6k, False: 41.7k]
  ------------------
  241|  15.6k|    {
  242|       |        // do not try to decode unknown data. assume binary
  243|  15.6k|        mNameBuilder.Reset().AddFormat("PROTO(0x%" PRIX32 ", 0x%X)", mProtocol.ToFullyQualifiedSpecForm(), mMessageType);
  244|  15.6k|        mValueBuilder.Reset().Add("UNKNOWN");
  245|  15.6k|        entry  = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  246|  15.6k|        mState = State::kDone;
  247|  15.6k|        return;
  248|  15.6k|    }
  249|       |
  250|       |    // name is known (so valid protocol)
  251|  41.7k|    if (mReader.GetTotalLength() == 0)
  ------------------
  |  Branch (251:9): [True: 0, False: 41.7k]
  ------------------
  252|      0|    {
  253|      0|        mState = State::kDone;
  254|      0|        entry  = PayloadEntry::SimpleValue(data->name, "");
  255|      0|        return;
  256|      0|    }
  257|       |
  258|  41.7k|    if (data->type == ItemType::kProtocolBinaryData)
  ------------------
  |  Branch (258:9): [True: 5.22k, False: 36.5k]
  ------------------
  259|  5.22k|    {
  260|  5.22k|        mState = State::kDone;
  261|  5.22k|        entry  = PayloadEntry::SimpleValue(data->name, "BINARY DATA");
  262|  5.22k|        return;
  263|  5.22k|    }
  264|       |
  265|  36.5k|    CHIP_ERROR err = mReader.Next(kTLVType_Structure, AnonymousTag());
  266|  36.5k|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  36.5k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (266:9): [True: 5.20k, False: 31.3k]
  ------------------
  267|  5.20k|    {
  268|  5.20k|        mValueBuilder.Reset().AddFormat("ERROR getting Anonymous Structure TLV: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|  5.20k|#define CHIP_ERROR_FORMAT "s"
  ------------------
  269|  5.20k|        mState = State::kDone;
  270|  5.20k|        entry  = PayloadEntry::SimpleValue(data->name, mValueBuilder.c_str());
  271|  5.20k|        return;
  272|  5.20k|    }
  273|       |
  274|  31.3k|    EnterContainer(entry);
  275|  31.3k|}
_ZN4chip8Decoders18PayloadDecoderBase13ExitContainerERNS0_12PayloadEntryE:
  278|   206k|{
  279|   206k|    entry = PayloadEntry::NestingExit();
  280|       |
  281|   206k|    if (mCurrentNesting > 0)
  ------------------
  |  Branch (281:9): [True: 206k, False: 0]
  ------------------
  282|   206k|    {
  283|   206k|        if (mState == State::kContentRead)
  ------------------
  |  Branch (283:13): [True: 12.7k, False: 193k]
  ------------------
  284|  12.7k|        {
  285|  12.7k|            mIMContentPosition.Exit();
  286|  12.7k|            if (mIMContentPosition.DescendDepth() <= 1)
  ------------------
  |  Branch (286:17): [True: 1.11k, False: 11.6k]
  ------------------
  287|  1.11k|            {
  288|       |                // Lever for actual content is 2: cluster::attr/cmd/ev
  289|  1.11k|                mState = State::kValueRead;
  290|  1.11k|                mPayloadPosition.Exit();
  291|  1.11k|            }
  292|  12.7k|        }
  293|   193k|        else
  294|   193k|        {
  295|   193k|            mPayloadPosition.Exit();
  296|   193k|        }
  297|   206k|        CHIP_ERROR err = mReader.ExitContainer(mNestingEnters[--mCurrentNesting]);
  298|   206k|        if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|   206k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (298:13): [True: 27.3k, False: 179k]
  ------------------
  299|  27.3k|        {
  300|  27.3k|            mValueBuilder.Reset().AddFormat("ERROR: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|  27.3k|#define CHIP_ERROR_FORMAT "s"
  ------------------
  301|  27.3k|            mNameBuilder.Reset().AddFormat("END CONTAINER");
  302|  27.3k|            entry  = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  303|  27.3k|            mState = State::kDone;
  304|  27.3k|            return;
  305|  27.3k|        }
  306|   206k|    }
  307|       |
  308|   179k|    if (mCurrentNesting == 0)
  ------------------
  |  Branch (308:9): [True: 140, False: 179k]
  ------------------
  309|    140|    {
  310|    140|        mState = State::kDone;
  311|    140|    }
  312|   179k|}
_ZN4chip8Decoders18PayloadDecoderBase20ReaderEnterContainerERNS0_12PayloadEntryE:
  315|  34.4M|{
  316|  34.4M|    if (mCurrentNesting >= kMaxDecodeDepth)
  ------------------
  |  Branch (316:9): [True: 34.1M, False: 318k]
  ------------------
  317|  34.1M|    {
  318|  34.1M|        mValueBuilder.AddFormat("NESTING DEPTH REACHED");
  319|  34.1M|        mReader.GetTag().AppendTo(mNameBuilder.Reset());
  320|  34.1M|        entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  321|  34.1M|        return false;
  322|  34.1M|    }
  323|       |
  324|   318k|    TLVType containerType;
  325|   318k|    CHIP_ERROR err = mReader.EnterContainer(containerType);
  326|   318k|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|   318k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (326:9): [True: 0, False: 318k]
  ------------------
  327|      0|    {
  328|      0|        mValueBuilder.AddFormat("ERROR entering container: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|      0|#define CHIP_ERROR_FORMAT "s"
  ------------------
  329|      0|        mReader.GetTag().AppendTo(mNameBuilder.Reset()); // assume enter is not done, so tag is correct
  330|      0|        entry  = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  331|      0|        mState = State::kDone;
  332|      0|        return false;
  333|      0|    }
  334|       |
  335|   318k|    mNestingEnters[mCurrentNesting++] = containerType;
  336|       |
  337|   318k|    return true;
  338|   318k|}
_ZN4chip8Decoders18PayloadDecoderBase14EnterContainerERNS0_12PayloadEntryE:
  341|  34.4M|{
  342|       |    // Tag fetch must be done BEFORE entering container
  343|  34.4M|    chip::TLV::Tag tag = mReader.GetTag();
  344|       |
  345|  34.4M|    VerifyOrReturn(ReaderEnterContainer(entry));
  ------------------
  |  |  226|  34.4M|    do                                                                                                                             \
  |  |  227|  34.4M|    {                                                                                                                              \
  |  |  228|  34.4M|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (228:13): [True: 34.1M, False: 316k]
  |  |  ------------------
  |  |  229|  34.4M|        {                                                                                                                          \
  |  |  230|  34.1M|            __VA_ARGS__;                                                                                                           \
  |  |  231|  34.1M|            return;                                                                                                                \
  |  |  232|  34.1M|        }                                                                                                                          \
  |  |  233|  34.4M|    } while (false)
  |  |  ------------------
  |  |  |  Branch (233:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  346|       |
  347|   316k|    const chip::TLVMeta::ItemInfo * data = nullptr;
  348|       |
  349|   316k|    if (mState == State::kContentRead)
  ------------------
  |  Branch (349:9): [True: 13.0k, False: 303k]
  ------------------
  350|  13.0k|    {
  351|  13.0k|        data = mIMContentPosition.Get();
  352|  13.0k|    }
  353|   303k|    else
  354|   303k|    {
  355|   303k|        mState = State::kValueRead;
  356|   303k|        data   = mPayloadPosition.Get();
  357|   303k|    }
  358|       |
  359|   316k|    if (data == nullptr)
  ------------------
  |  Branch (359:9): [True: 260k, False: 56.3k]
  ------------------
  360|   260k|    {
  361|   260k|        tag.AppendTo(mNameBuilder.Reset());
  362|   260k|        entry = PayloadEntry::NestingEnter(mNameBuilder.c_str());
  363|   260k|    }
  364|  56.3k|    else
  365|  56.3k|    {
  366|  56.3k|        entry = PayloadEntry::NestingEnter(data->name);
  367|  56.3k|    }
  368|   316k|}
_ZN4chip8Decoders18PayloadDecoderBase19NextFromContentReadERNS0_12PayloadEntryE:
  371|  2.46M|{
  372|  2.46M|    CHIP_ERROR err = mReader.Next();
  373|  2.46M|    if (err == CHIP_END_OF_TLV)
  ------------------
  |  |  783|  2.46M|#define CHIP_END_OF_TLV CHIP_ERROR_END_OF_TLV
  |  |  ------------------
  |  |  |  |  782|  2.46M|#define CHIP_ERROR_END_OF_TLV                                  CHIP_CORE_ERROR(0x21)
  |  |  |  |  ------------------
  |  |  |  |  |  |  436|  2.46M|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  171|  2.46M|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (373:9): [True: 12.7k, False: 2.45M]
  ------------------
  374|  12.7k|    {
  375|  12.7k|        ExitContainer(entry);
  376|  12.7k|        return;
  377|  12.7k|    }
  378|       |
  379|  2.45M|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  2.45M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (379:9): [True: 16, False: 2.45M]
  ------------------
  380|     16|    {
  381|     16|        mValueBuilder.Reset().AddFormat("ERROR on TLV Next: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|     16|#define CHIP_ERROR_FORMAT "s"
  ------------------
  382|     16|        entry  = PayloadEntry::SimpleValue("TLV_ERR", mValueBuilder.c_str());
  383|     16|        mState = State::kDone;
  384|     16|        return;
  385|     16|    }
  386|       |
  387|  2.45M|    if (mCurrentNesting > 0 && mNestingEnters[mCurrentNesting - 1] == kTLVType_List)
  ------------------
  |  Branch (387:9): [True: 2.45M, False: 0]
  |  Branch (387:32): [True: 1.13M, False: 1.31M]
  ------------------
  388|  1.13M|    {
  389|       |        // Spec A5.3: `The members of a list may be encoded with any form of tag, including an anonymous tag.`
  390|       |        // TLVMeta always uses Anonymous
  391|  1.13M|        mIMContentPosition.Enter(ByTag(AnonymousTag()));
  392|  1.13M|    }
  393|  1.31M|    else
  394|  1.31M|    {
  395|  1.31M|        mIMContentPosition.Enter(ByTag(mReader.GetTag()));
  396|  1.31M|    }
  397|  2.45M|    auto data = mIMContentPosition.Get();
  398|       |
  399|  2.45M|    if (data != nullptr)
  ------------------
  |  Branch (399:9): [True: 1.35k, False: 2.45M]
  ------------------
  400|  1.35k|    {
  401|  1.35k|        if (data->type == ItemType::kProtocolBinaryData)
  ------------------
  |  Branch (401:13): [True: 0, False: 1.35k]
  ------------------
  402|      0|        {
  403|      0|            mIMContentPosition.Exit();
  404|      0|            entry = PayloadEntry::SimpleValue(data->name, "BINARY DATA");
  405|      0|            return;
  406|      0|        }
  407|  1.35k|    }
  408|       |
  409|  2.45M|    if (TLVTypeIsContainer(mReader.GetType()))
  ------------------
  |  Branch (409:9): [True: 2.45M, False: 4.30k]
  ------------------
  410|  2.45M|    {
  411|  2.45M|        EnterContainer(entry);
  412|  2.45M|        return;
  413|  2.45M|    }
  414|       |
  415|  4.30k|    PrettyPrintCurrentValue(mReader, mValueBuilder.Reset(), mIMContentPosition);
  416|  4.30k|    mIMContentPosition.Exit();
  417|       |
  418|  4.30k|    if (data == nullptr)
  ------------------
  |  Branch (418:9): [True: 3.37k, False: 923]
  ------------------
  419|  3.37k|    {
  420|  3.37k|        mReader.GetTag().AppendTo(mNameBuilder.Reset());
  421|  3.37k|        entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  422|  3.37k|        return;
  423|  3.37k|    }
  424|       |
  425|    923|    entry = PayloadEntry::SimpleValue(data->name, mValueBuilder.c_str());
  426|    923|}
_ZN4chip8Decoders18PayloadDecoderBase13MoveToContentERNS0_12PayloadEntryE:
  429|  5.08k|{
  430|  5.08k|    if (!mIMContentPosition.HasValidTree())
  ------------------
  |  Branch (430:9): [True: 0, False: 5.08k]
  ------------------
  431|      0|    {
  432|      0|        mPayloadPosition.Exit();
  433|      0|        return;
  434|      0|    }
  435|       |
  436|  5.08k|    VerifyOrDie((entry.GetType() == PayloadEntry::IMPayloadType::kAttribute) ||
  ------------------
  |  |  497|  5.08k|    nlABORT_ACTION(aCondition, ChipLogError(Support, "VerifyOrDie failure at %s:%d: %s", __FILE__, __LINE__, #aCondition))
  |  |  ------------------
  |  |  |  |  711|  5.08k|#define nlABORT_ACTION(aCondition, anAction)                                    __nlABORT_ACTION(NL_ASSERT_ABORT_PRODUCTION_FLAGS, aCondition, anAction)
  |  |  |  |  ------------------
  |  |  |  |  |  |  487|  5.08k|#define __nlABORT_ACTION(flags, condition, action)                                        __nlPRECONDITION_ACTION(flags, condition, NL_ASSERT_ABORT(), action)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  431|  5.08k|    if (__nlSHOULD_ASSERT(condition))                                                     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  125|  18.1k|#define __nlSHOULD_ASSERT(condition) condition) { /* do nothing */ } else if (1
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 2.95k, False: 2.13k]
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 1.39k, False: 738]
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 738, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:79): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  432|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  433|      0|        __NL_ASSERT_MAYBE_RUN_PRE_ACTION_TRIGGERS((flags),                                \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  203|      0|    do                                                                                    \
  |  |  |  |  |  |  |  |  |  |  204|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  |  |  205|      0|        if ((flags) & NL_ASSERT_FLAG_LOG) {                                               \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  835|      0|#define NL_ASSERT_FLAG_LOG              0x00000002
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (205:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  206|      0|            NL_ASSERT_LOG(prefix, name, condition, label, file, line, message);           \
  |  |  |  |  |  |  |  |  |  |  207|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  208|      0|        if ((flags) & NL_ASSERT_FLAG_BACKTRACE) {                                         \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  815|      0|#define NL_ASSERT_FLAG_BACKTRACE        0x00000001
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (208:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  209|      0|            NL_ASSERT_BACKTRACE();                                                        \
  |  |  |  |  |  |  |  |  |  |  210|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  211|      0|    } while (0)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (211:14): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  434|      0|                                                  NL_ASSERT_PREFIX_STRING,                \
  |  |  |  |  |  |  |  |  435|      0|                                                  NL_ASSERT_COMPONENT_STRING,             \
  |  |  |  |  |  |  |  |  436|      0|                                                  #condition,                             \
  |  |  |  |  |  |  |  |  437|      0|                                                  0,                                      \
  |  |  |  |  |  |  |  |  438|      0|                                                  NL_ASSERT_FILE,                         \
  |  |  |  |  |  |  |  |  439|      0|                                                  __LINE__,                               \
  |  |  |  |  |  |  |  |  440|      0|                                                  0);                                     \
  |  |  |  |  |  |  |  |  441|      0|        {                                                                                 \
  |  |  |  |  |  |  |  |  442|      0|            action;                                                                       \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  443|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  444|      0|        __NL_ASSERT_MAYBE_RUN_POST_ACTION_TRIGGERS((flags),                               \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  214|      0|    do                                                                                    \
  |  |  |  |  |  |  |  |  |  |  215|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  |  |  216|      0|        if ((flags) & NL_ASSERT_FLAG_TRAP) {                                              \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  855|      0|#define NL_ASSERT_FLAG_TRAP             0x00000004
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (216:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  217|      0|            NL_ASSERT_TRAP();                                                             \
  |  |  |  |  |  |  |  |  |  |  218|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  219|      0|    } while (0)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (219:14): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  445|      0|                                                   NL_ASSERT_PREFIX_STRING,               \
  |  |  |  |  |  |  |  |  446|      0|                                                   NL_ASSERT_COMPONENT_STRING,            \
  |  |  |  |  |  |  |  |  447|      0|                                                   #condition,                            \
  |  |  |  |  |  |  |  |  448|      0|                                                   0,                                     \
  |  |  |  |  |  |  |  |  449|      0|                                                   NL_ASSERT_FILE,                        \
  |  |  |  |  |  |  |  |  450|      0|                                                   __LINE__,                              \
  |  |  |  |  |  |  |  |  451|      0|                                                   0);                                    \
  |  |  |  |  |  |  |  |  452|      0|        {                                                                                 \
  |  |  |  |  |  |  |  |  453|      0|            termination;                                                                  \
  |  |  |  |  |  |  |  |  454|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  455|      0|    }                                                                                     \
  |  |  |  |  |  |  |  |  456|      0|    else do {} while (0) /* This is explained in the comment above __nlCHECK */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (456:23): [Folded - Ignored]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  437|  5.08k|                (entry.GetType() == PayloadEntry::IMPayloadType::kCommand) ||
  438|  5.08k|                (entry.GetType() == PayloadEntry::IMPayloadType::kEvent));
  439|       |
  440|  5.08k|    mNameBuilder.Reset();
  441|       |
  442|  5.08k|    mIMContentPosition.ResetToTop();
  443|  5.08k|    mIMContentPosition.Enter(ByTag(ClusterTag(entry.GetClusterId())));
  444|  5.08k|    auto data = mIMContentPosition.Get();
  445|  5.08k|    if (data != nullptr)
  ------------------
  |  Branch (445:9): [True: 3.42k, False: 1.66k]
  ------------------
  446|  3.42k|    {
  447|  3.42k|        mNameBuilder.AddFormat("%s::", data->name);
  448|  3.42k|    }
  449|  1.66k|    else
  450|  1.66k|    {
  451|  1.66k|        mNameBuilder.AddFormat("0x%" PRIx32 "::", entry.GetClusterId());
  452|  1.66k|    }
  453|       |
  454|  5.08k|    uint32_t id          = 0;
  455|  5.08k|    const char * id_type = "UNKNOWN";
  456|       |
  457|  5.08k|    switch (entry.GetType())
  458|  5.08k|    {
  459|  2.95k|    case PayloadEntry::IMPayloadType::kAttribute:
  ------------------
  |  Branch (459:5): [True: 2.95k, False: 2.13k]
  ------------------
  460|  2.95k|        mIMContentPosition.Enter(ByTag(AttributeTag(entry.GetAttributeId())));
  461|  2.95k|        id      = entry.GetAttributeId();
  462|  2.95k|        id_type = "ATTR";
  463|  2.95k|        break;
  464|  1.39k|    case PayloadEntry::IMPayloadType::kCommand:
  ------------------
  |  Branch (464:5): [True: 1.39k, False: 3.69k]
  ------------------
  465|  1.39k|        mIMContentPosition.Enter(ByTag(CommandTag(entry.GetCommandId())));
  466|  1.39k|        id      = entry.GetCommandId();
  467|  1.39k|        id_type = "CMD";
  468|  1.39k|        break;
  469|    738|    case PayloadEntry::IMPayloadType::kEvent:
  ------------------
  |  Branch (469:5): [True: 738, False: 4.35k]
  ------------------
  470|    738|        mIMContentPosition.Enter(ByTag(EventTag(entry.GetEventId())));
  471|    738|        id      = entry.GetEventId();
  472|    738|        id_type = "EV";
  473|    738|        break;
  474|      0|    default:
  ------------------
  |  Branch (474:5): [True: 0, False: 5.08k]
  ------------------
  475|       |        // never happens: verified all case above covered.
  476|      0|        break;
  477|  5.08k|    }
  478|       |
  479|  5.08k|    data = mIMContentPosition.Get();
  480|  5.08k|    if (data != nullptr)
  ------------------
  |  Branch (480:9): [True: 2.70k, False: 2.38k]
  ------------------
  481|  2.70k|    {
  482|  2.70k|        mNameBuilder.AddFormat("%s", data->name);
  483|  2.70k|    }
  484|  2.38k|    else
  485|  2.38k|    {
  486|  2.38k|        mNameBuilder.AddFormat("%s(0x%" PRIx32 ")", id_type, id);
  487|  2.38k|    }
  488|       |
  489|  5.08k|    if (TLVTypeIsContainer(mReader.GetType()))
  ------------------
  |  Branch (489:9): [True: 1.39k, False: 3.69k]
  ------------------
  490|  1.39k|    {
  491|  1.39k|        mState = State::kContentRead;
  492|  1.39k|        entry  = PayloadEntry::NestingEnter(mNameBuilder.c_str());
  493|  1.39k|        ReaderEnterContainer(entry);
  494|  1.39k|    }
  495|  3.69k|    else
  496|  3.69k|    {
  497|  3.69k|        PrettyPrintCurrentValue(mReader, mValueBuilder.Reset(), mIMContentPosition);
  498|  3.69k|        entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  499|       |
  500|       |        // Can simply exit, only one value to return
  501|  3.69k|        mPayloadPosition.Exit();
  502|  3.69k|    }
  503|  5.08k|}
_ZN4chip8Decoders18PayloadDecoderBase17NextFromValueReadERNS0_12PayloadEntryE:
  506|  32.4M|{
  507|  32.4M|    CHIP_ERROR err = mReader.Next();
  508|  32.4M|    if (err == CHIP_END_OF_TLV)
  ------------------
  |  |  783|  32.4M|#define CHIP_END_OF_TLV CHIP_ERROR_END_OF_TLV
  |  |  ------------------
  |  |  |  |  782|  32.4M|#define CHIP_ERROR_END_OF_TLV                                  CHIP_CORE_ERROR(0x21)
  |  |  |  |  ------------------
  |  |  |  |  |  |  436|  32.4M|#define CHIP_CORE_ERROR(e) CHIP_SDK_ERROR(::chip::ChipError::SdkPart::kCore, (e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  171|  32.4M|    (::chip::ChipError(::chip::ChipError::SdkErrorConstant<(part), (code)>::value, __FILE__, __LINE__))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (508:9): [True: 193k, False: 32.2M]
  ------------------
  509|   193k|    {
  510|   193k|        ExitContainer(entry);
  511|   193k|        return;
  512|   193k|    }
  513|       |
  514|  32.2M|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  32.2M|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (514:9): [True: 3.90k, False: 32.2M]
  ------------------
  515|  3.90k|    {
  516|  3.90k|        mValueBuilder.Reset().AddFormat("ERROR on TLV Next: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|  3.90k|#define CHIP_ERROR_FORMAT "s"
  ------------------
  517|  3.90k|        entry  = PayloadEntry::SimpleValue("TLV_ERR", mValueBuilder.c_str());
  518|  3.90k|        mState = State::kDone;
  519|  3.90k|        return;
  520|  3.90k|    }
  521|       |
  522|       |    // Attempt to find information about the current tag
  523|  32.2M|    mPayloadPosition.Enter(ByTag(mReader.GetTag()));
  524|  32.2M|    auto data = mPayloadPosition.Get();
  525|       |
  526|       |    // handle special types
  527|  32.2M|    if (data != nullptr)
  ------------------
  |  Branch (527:9): [True: 46.1k, False: 32.1M]
  ------------------
  528|  46.1k|    {
  529|  46.1k|        if (data->type == ItemType::kProtocolBinaryData)
  ------------------
  |  Branch (529:13): [True: 0, False: 46.1k]
  ------------------
  530|      0|        {
  531|      0|            mPayloadPosition.Exit();
  532|      0|            entry = PayloadEntry::SimpleValue(data->name, "BINARY DATA");
  533|      0|            return;
  534|      0|        }
  535|       |
  536|  46.1k|        if (data->type == ItemType::kProtocolPayloadAttribute)
  ------------------
  |  Branch (536:13): [True: 2.95k, False: 43.1k]
  ------------------
  537|  2.95k|        {
  538|  2.95k|            entry = PayloadEntry::AttributePayload(mClusterId, mAttributeId);
  539|  2.95k|            MoveToContent(entry);
  540|  2.95k|            return;
  541|  2.95k|        }
  542|       |
  543|  43.1k|        if (data->type == ItemType::kProtocolPayloadCommand)
  ------------------
  |  Branch (543:13): [True: 1.39k, False: 41.7k]
  ------------------
  544|  1.39k|        {
  545|  1.39k|            entry = PayloadEntry::CommandPayload(mClusterId, mCommandId);
  546|  1.39k|            MoveToContent(entry);
  547|  1.39k|            return;
  548|  1.39k|        }
  549|       |
  550|  41.7k|        if (data->type == ItemType::kProtocolPayloadEvent)
  ------------------
  |  Branch (550:13): [True: 738, False: 41.0k]
  ------------------
  551|    738|        {
  552|    738|            entry = PayloadEntry::EventPayload(mClusterId, mEventId);
  553|    738|            MoveToContent(entry);
  554|    738|            return;
  555|    738|        }
  556|  41.7k|    }
  557|       |
  558|  32.2M|    if (TLVTypeIsContainer(mReader.GetType()))
  ------------------
  |  Branch (558:9): [True: 32.0M, False: 196k]
  ------------------
  559|  32.0M|    {
  560|  32.0M|        EnterContainer(entry);
  561|  32.0M|        return;
  562|  32.0M|    }
  563|       |
  564|   196k|    if (data == nullptr)
  ------------------
  |  Branch (564:9): [True: 179k, False: 16.5k]
  ------------------
  565|   179k|    {
  566|   179k|        mReader.GetTag().AppendTo(mNameBuilder.Reset());
  567|   179k|        PrettyPrintCurrentValue(mReader, mValueBuilder.Reset(), mPayloadPosition);
  568|   179k|        entry = PayloadEntry::SimpleValue(mNameBuilder.c_str(), mValueBuilder.c_str());
  569|   179k|        mPayloadPosition.Exit();
  570|   179k|        return;
  571|   179k|    }
  572|       |
  573|       |    // at this point, data is "simple data" or "simple data with meaning"
  574|       |
  575|  16.5k|    const chip::TLVMeta::ItemInfo * info = nullptr;
  576|  16.5k|    switch (data->type)
  577|  16.5k|    {
  578|  1.33k|    case ItemType::kProtocolClusterId:
  ------------------
  |  Branch (578:5): [True: 1.33k, False: 15.1k]
  ------------------
  579|  1.33k|        mReader.Get(mClusterId);
  580|  1.33k|        mIMContentPosition.ResetToTop();
  581|  1.33k|        mIMContentPosition.Enter(ByTag(ClusterTag(mClusterId)));
  582|  1.33k|        info = mIMContentPosition.Get();
  583|  1.33k|        break;
  584|  1.19k|    case ItemType::kProtocolAttributeId:
  ------------------
  |  Branch (584:5): [True: 1.19k, False: 15.3k]
  ------------------
  585|  1.19k|        mReader.Get(mAttributeId);
  586|  1.19k|        mIMContentPosition.ResetToTop();
  587|  1.19k|        mIMContentPosition.Enter(ByTag(ClusterTag(mClusterId)));
  588|  1.19k|        mIMContentPosition.Enter(ByTag(AttributeTag(mAttributeId)));
  589|  1.19k|        info = mIMContentPosition.Get();
  590|  1.19k|        break;
  591|    483|    case ItemType::kProtocolCommandId:
  ------------------
  |  Branch (591:5): [True: 483, False: 16.0k]
  ------------------
  592|    483|        mReader.Get(mCommandId);
  593|    483|        mIMContentPosition.ResetToTop();
  594|    483|        mIMContentPosition.Enter(ByTag(ClusterTag(mClusterId)));
  595|    483|        mIMContentPosition.Enter(ByTag(CommandTag(mCommandId)));
  596|    483|        info = mIMContentPosition.Get();
  597|    483|        break;
  598|    541|    case ItemType::kProtocolEventId:
  ------------------
  |  Branch (598:5): [True: 541, False: 15.9k]
  ------------------
  599|    541|        mReader.Get(mEventId);
  600|    541|        mIMContentPosition.ResetToTop();
  601|    541|        mIMContentPosition.Enter(ByTag(ClusterTag(mClusterId)));
  602|    541|        mIMContentPosition.Enter(ByTag(EventTag(mEventId)));
  603|    541|        info = mIMContentPosition.Get();
  604|    541|        break;
  605|  12.9k|    default:
  ------------------
  |  Branch (605:5): [True: 12.9k, False: 3.55k]
  ------------------
  606|  12.9k|        break;
  607|  16.5k|    }
  608|       |
  609|  16.5k|    PrettyPrintCurrentValue(mReader, mValueBuilder.Reset(), mPayloadPosition);
  610|  16.5k|    if (info != nullptr)
  ------------------
  |  Branch (610:9): [True: 2.15k, False: 14.3k]
  ------------------
  611|  2.15k|    {
  612|  2.15k|        mValueBuilder.Add(" == '").Add(info->name).Add("'");
  613|  2.15k|    }
  614|       |
  615|  16.5k|    mPayloadPosition.Exit();
  616|  16.5k|    entry = PayloadEntry::SimpleValue(data->name, mValueBuilder.c_str());
  617|  16.5k|}
protocol_decoder.cpp:_ZN4chip8Decoders12_GLOBAL__N_15ByTagC2ENS_3TLV3TagE:
   41|  34.8M|    constexpr ByTag(Tag tag) : mTag(tag) {}
protocol_decoder.cpp:_ZN4chip8Decoders12_GLOBAL__N_123PrettyPrintCurrentValueERKNS_3TLV9TLVReaderERNS_17StringBuilderBaseERNS_8FlatTree8PositionINS_7TLVMeta8ItemInfoELm16EEE:
  109|   204k|{
  110|   204k|    CHIP_ERROR err = FormatCurrentValue(reader, out);
  111|       |
  112|   204k|    if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|   204k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (112:9): [True: 0, False: 204k]
  ------------------
  113|      0|    {
  114|      0|        out.AddFormat("ERR: %" CHIP_ERROR_FORMAT, err.Format());
  ------------------
  |  |   71|      0|#define CHIP_ERROR_FORMAT "s"
  ------------------
  115|      0|        return;
  116|      0|    }
  117|       |
  118|   204k|    auto data = position.Get();
  119|   204k|    if (data == nullptr)
  ------------------
  |  Branch (119:9): [True: 184k, False: 19.8k]
  ------------------
  120|   184k|    {
  121|   184k|        return;
  122|   184k|    }
  123|       |
  124|       |    // Report enum values in human readable form
  125|  19.8k|    if (data->type == ItemType::kEnum && (reader.GetType() == kTLVType_UnsignedInteger))
  ------------------
  |  Branch (125:9): [True: 1.33k, False: 18.5k]
  |  Branch (125:42): [True: 778, False: 555]
  ------------------
  126|    778|    {
  127|    778|        uint64_t value = 0;
  128|    778|        VerifyOrReturn(reader.Get(value) == CHIP_NO_ERROR);
  ------------------
  |  |  226|    778|    do                                                                                                                             \
  |  |  227|    778|    {                                                                                                                              \
  |  |  228|    778|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (228:13): [True: 0, False: 778]
  |  |  ------------------
  |  |  229|    778|        {                                                                                                                          \
  |  |  230|      0|            __VA_ARGS__;                                                                                                           \
  |  |  231|      0|            return;                                                                                                                \
  |  |  232|      0|        }                                                                                                                          \
  |  |  233|    778|    } while (false)
  |  |  ------------------
  |  |  |  Branch (233:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  129|       |
  130|    778|        position.Enter(ByTag(ConstantValueTag(value)));
  131|    778|        auto enum_data = position.Get();
  132|    778|        if (enum_data != nullptr)
  ------------------
  |  Branch (132:13): [True: 414, False: 364]
  ------------------
  133|    414|        {
  134|    414|            out.Add(" == ").Add(enum_data->name);
  135|    414|        }
  136|    778|        position.Exit();
  137|    778|    }
  138|       |
  139|  19.8k|    if (data->type == ItemType::kBitmap && (reader.GetType() == kTLVType_UnsignedInteger))
  ------------------
  |  Branch (139:9): [True: 1.81k, False: 18.0k]
  |  Branch (139:44): [True: 1.60k, False: 208]
  ------------------
  140|  1.60k|    {
  141|  1.60k|        uint64_t value = 0;
  142|  1.60k|        VerifyOrReturn(reader.Get(value) == CHIP_NO_ERROR);
  ------------------
  |  |  226|  1.60k|    do                                                                                                                             \
  |  |  227|  1.60k|    {                                                                                                                              \
  |  |  228|  1.60k|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (228:13): [True: 0, False: 1.60k]
  |  |  ------------------
  |  |  229|  1.60k|        {                                                                                                                          \
  |  |  230|      0|            __VA_ARGS__;                                                                                                           \
  |  |  231|      0|            return;                                                                                                                \
  |  |  232|      0|        }                                                                                                                          \
  |  |  233|  1.60k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (233:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  143|       |
  144|  1.60k|        uint64_t bit = 0x01;
  145|  1.60k|        bool first   = true;
  146|   104k|        for (unsigned i = 0; i < 64; i++, bit <<= 1)
  ------------------
  |  Branch (146:30): [True: 102k, False: 1.60k]
  ------------------
  147|   102k|        {
  148|   102k|            if ((value & bit) == 0)
  ------------------
  |  Branch (148:17): [True: 91.6k, False: 11.1k]
  ------------------
  149|  91.6k|            {
  150|  91.6k|                continue;
  151|  91.6k|            }
  152|       |
  153|       |            // NOTE: this only can select individual bits;
  154|  11.1k|            position.Enter(ByTag(ConstantValueTag(bit)));
  155|  11.1k|            auto bitmap_data = position.Get();
  156|  11.1k|            if (bitmap_data == nullptr)
  ------------------
  |  Branch (156:17): [True: 6.78k, False: 4.38k]
  ------------------
  157|  6.78k|            {
  158|  6.78k|                position.Exit();
  159|  6.78k|                continue;
  160|  6.78k|            }
  161|       |
  162|       |            // Try to pretty print the value
  163|  4.38k|            if (first)
  ------------------
  |  Branch (163:17): [True: 978, False: 3.40k]
  ------------------
  164|    978|            {
  165|    978|                out.Add(" == ");
  166|    978|                first = false;
  167|    978|            }
  168|  3.40k|            else
  169|  3.40k|            {
  170|  3.40k|                out.Add(" | ");
  171|  3.40k|            }
  172|       |
  173|  4.38k|            out.Add(bitmap_data->name);
  174|  4.38k|            value = value & (~bit);
  175|       |
  176|  4.38k|            position.Exit();
  177|  4.38k|        }
  178|       |
  179|  1.60k|        if (!first && value)
  ------------------
  |  Branch (179:13): [True: 978, False: 628]
  |  Branch (179:23): [True: 389, False: 589]
  ------------------
  180|    389|        {
  181|       |            // Only append if some constants were found.
  182|    389|            out.AddFormat(" | 0x%08" PRIX64, value);
  183|    389|        }
  184|  1.60k|    }
  185|       |
  186|  19.8k|    out.AddMarkerIfOverflow();
  187|  19.8k|}
protocol_decoder.cpp:_ZN4chip8Decoders12_GLOBAL__N_118FormatCurrentValueERKNS_3TLV9TLVReaderERNS_17StringBuilderBaseE:
   49|   204k|{
   50|   204k|    switch (reader.GetType())
   51|   204k|    {
   52|  16.7k|    case kTLVType_SignedInteger: {
  ------------------
  |  Branch (52:5): [True: 16.7k, False: 187k]
  ------------------
   53|  16.7k|        int64_t sVal;
   54|  16.7k|        ReturnErrorOnFailure(reader.Get(sVal));
  ------------------
  |  |  150|  16.7k|    do                                                                                                                             \
  |  |  151|  16.7k|    {                                                                                                                              \
  |  |  152|  16.7k|        auto __err = (expr);                                                                                                       \
  |  |  153|  16.7k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 16.7k]
  |  |  ------------------
  |  |  154|  16.7k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  16.7k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   55|  16.7k|        out.AddFormat("%" PRIi64, sVal);
   56|  16.7k|        break;
   57|  16.7k|    }
   58|  58.3k|    case kTLVType_UnsignedInteger: {
  ------------------
  |  Branch (58:5): [True: 58.3k, False: 146k]
  ------------------
   59|  58.3k|        uint64_t uVal;
   60|  58.3k|        ReturnErrorOnFailure(reader.Get(uVal));
  ------------------
  |  |  150|  58.3k|    do                                                                                                                             \
  |  |  151|  58.3k|    {                                                                                                                              \
  |  |  152|  58.3k|        auto __err = (expr);                                                                                                       \
  |  |  153|  58.3k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 58.3k]
  |  |  ------------------
  |  |  154|  58.3k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  58.3k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   61|  58.3k|        out.AddFormat("%" PRIu64, uVal);
   62|  58.3k|        break;
   63|  58.3k|    }
   64|  69.1k|    case kTLVType_Boolean: {
  ------------------
  |  Branch (64:5): [True: 69.1k, False: 135k]
  ------------------
   65|  69.1k|        bool bVal;
   66|  69.1k|        ReturnErrorOnFailure(reader.Get(bVal));
  ------------------
  |  |  150|  69.1k|    do                                                                                                                             \
  |  |  151|  69.1k|    {                                                                                                                              \
  |  |  152|  69.1k|        auto __err = (expr);                                                                                                       \
  |  |  153|  69.1k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 69.1k]
  |  |  ------------------
  |  |  154|  69.1k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  69.1k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   67|  69.1k|        out.Add(bVal ? "true" : "false");
  ------------------
  |  Branch (67:17): [True: 44.0k, False: 25.0k]
  ------------------
   68|  69.1k|        break;
   69|  69.1k|    }
   70|  9.18k|    case kTLVType_FloatingPointNumber: {
  ------------------
  |  Branch (70:5): [True: 9.18k, False: 195k]
  ------------------
   71|  9.18k|        double fpVal;
   72|  9.18k|        ReturnErrorOnFailure(reader.Get(fpVal));
  ------------------
  |  |  150|  9.18k|    do                                                                                                                             \
  |  |  151|  9.18k|    {                                                                                                                              \
  |  |  152|  9.18k|        auto __err = (expr);                                                                                                       \
  |  |  153|  9.18k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 9.18k]
  |  |  ------------------
  |  |  154|  9.18k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  9.18k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   73|  9.18k|        out.AddFormat("%lf", fpVal);
   74|  9.18k|        break;
   75|  9.18k|    }
   76|  1.98k|    case kTLVType_UTF8String: {
  ------------------
  |  Branch (76:5): [True: 1.98k, False: 202k]
  ------------------
   77|  1.98k|        const uint8_t * strbuf = nullptr;
   78|  1.98k|        ReturnErrorOnFailure(reader.GetDataPtr(strbuf));
  ------------------
  |  |  150|  1.98k|    do                                                                                                                             \
  |  |  151|  1.98k|    {                                                                                                                              \
  |  |  152|  1.98k|        auto __err = (expr);                                                                                                       \
  |  |  153|  1.98k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 1.98k]
  |  |  ------------------
  |  |  154|  1.98k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  1.98k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   79|  1.98k|        out.AddFormat("\"%-.*s\"", static_cast<int>(reader.GetLength()), strbuf);
   80|  1.98k|        break;
   81|  1.98k|    }
   82|  5.05k|    case kTLVType_ByteString: {
  ------------------
  |  Branch (82:5): [True: 5.05k, False: 199k]
  ------------------
   83|  5.05k|        const uint8_t * strbuf = nullptr;
   84|  5.05k|        ReturnErrorOnFailure(reader.GetDataPtr(strbuf));
  ------------------
  |  |  150|  5.05k|    do                                                                                                                             \
  |  |  151|  5.05k|    {                                                                                                                              \
  |  |  152|  5.05k|        auto __err = (expr);                                                                                                       \
  |  |  153|  5.05k|        if (!::chip::ChipError::IsSuccess(__err))                                                                                  \
  |  |  ------------------
  |  |  |  Branch (153:13): [True: 0, False: 5.05k]
  |  |  ------------------
  |  |  154|  5.05k|        {                                                                                                                          \
  |  |  155|      0|            return __err;                                                                                                          \
  |  |  156|      0|        }                                                                                                                          \
  |  |  157|  5.05k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (157:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   85|  5.05k|        out.Add("hex:");
   86|  35.8M|        for (uint32_t i = 0; i < reader.GetLength(); i++)
  ------------------
  |  Branch (86:30): [True: 35.8M, False: 5.05k]
  ------------------
   87|  35.8M|        {
   88|  35.8M|            out.AddFormat("%02X", strbuf[i]);
   89|  35.8M|        }
   90|  5.05k|        break;
   91|  5.05k|    }
   92|  43.9k|    case kTLVType_Null:
  ------------------
  |  Branch (92:5): [True: 43.9k, False: 160k]
  ------------------
   93|  43.9k|        out.Add("NULL");
   94|  43.9k|        break;
   95|       |
   96|      0|    case kTLVType_NotSpecified:
  ------------------
  |  Branch (96:5): [True: 0, False: 204k]
  ------------------
   97|      0|        out.Add("Not Specified");
   98|      0|        break;
   99|      0|    default:
  ------------------
  |  Branch (99:5): [True: 0, False: 204k]
  ------------------
  100|      0|        out.Add("???");
  101|      0|        break;
  102|   204k|    }
  103|       |
  104|   204k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|   204k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  105|   204k|}
protocol_decoder.cpp:_ZN4chip8Decoders12_GLOBAL__N_15ByTagclERKNS_7TLVMeta8ItemInfoE:
   42|  1.31M|    bool operator()(const chip::TLVMeta::ItemInfo & item) { return item.tag == mTag; }

_ZN4chip8Decoders24PayloadDecoderInitParamsC2Ev:
  132|  2.61k|    PayloadDecoderInitParams() = default;
_ZN4chip8Decoders24PayloadDecoderInitParams11SetProtocolENS_9Protocols2IdE:
  135|  7.83k|    {
  136|  7.83k|        mProtocol = value;
  137|  7.83k|        return *this;
  138|  7.83k|    }
_ZN4chip8Decoders14PayloadDecoderILm64ELm128EEC2ERKNS0_24PayloadDecoderInitParamsE:
  281|  57.4k|    PayloadDecoder(const PayloadDecoderInitParams & params) : PayloadDecoderBase(std::move(params), mName, mValue) {}
_ZN4chip8Decoders18PayloadDecoderBase13StartDecodingENS_4SpanIKhEE:
  205|  57.4k|    {
  206|  57.4k|        TLV::TLVReader reader;
  207|  57.4k|        reader.Init(data);
  208|  57.4k|        StartDecoding(reader);
  209|  57.4k|    }
_ZN4chip8Decoders12PayloadEntryC2Ev:
   51|  57.4k|    PayloadEntry() : mType(IMPayloadType::kNone), mName(""), mValue("") {}
_ZN4chip8Decoders24PayloadDecoderInitParams14SetMessageTypeEh:
  141|  57.4k|    {
  142|  57.4k|        mMessageType = value;
  143|  57.4k|        return *this;
  144|  57.4k|    }
_ZN4chip8Decoders24PayloadDecoderInitParams21SetProtocolDecodeTreeILm60EEERS1_RKNSt3__15arrayIKNS_8FlatTree4NodeINS_7TLVMeta8ItemInfoEEEXT_EEE:
  155|  2.61k|    {
  156|  2.61k|        return SetProtocolDecodeTree(a.data(), N);
  157|  2.61k|    }
_ZN4chip8Decoders24PayloadDecoderInitParams21SetProtocolDecodeTreeEPKNS_8FlatTree4NodeINS_7TLVMeta8ItemInfoEEEm:
  147|  2.61k|    {
  148|  2.61k|        mProtocolTree     = tree;
  149|  2.61k|        mProtocolTreeSize = s;
  150|  2.61k|        return *this;
  151|  2.61k|    }
_ZN4chip8Decoders24PayloadDecoderInitParams20SetClusterDecodeTreeILm1295EEERS1_RKNSt3__15arrayIKNS_8FlatTree4NodeINS_7TLVMeta8ItemInfoEEEXT_EEE:
  168|  2.61k|    {
  169|  2.61k|        return SetClusterDecodeTree(a.data(), N);
  170|  2.61k|    }
_ZN4chip8Decoders24PayloadDecoderInitParams20SetClusterDecodeTreeEPKNS_8FlatTree4NodeINS_7TLVMeta8ItemInfoEEEm:
  160|  2.61k|    {
  161|  2.61k|        mClusterTree     = tree;
  162|  2.61k|        mClusterTreeSize = s;
  163|  2.61k|        return *this;
  164|  2.61k|    }
_ZNK4chip8Decoders12PayloadEntry7GetTypeEv:
   53|  13.0k|    IMPayloadType GetType() const { return mType; }
_ZNK4chip8Decoders12PayloadEntry12GetClusterIdEv:
   59|  6.74k|    uint32_t GetClusterId() const { return mClusterId; };
_ZNK4chip8Decoders12PayloadEntry14GetAttributeIdEv:
   63|  5.91k|    {
   64|  5.91k|        VerifyOrReturnValue(mType == IMPayloadType::kAttribute, kInvalidId);
  ------------------
  |  |  270|  5.91k|    do                                                                                                                             \
  |  |  271|  5.91k|    {                                                                                                                              \
  |  |  272|  5.91k|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (272:13): [True: 0, False: 5.91k]
  |  |  ------------------
  |  |  273|  5.91k|        {                                                                                                                          \
  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  275|      0|            return (value);                                                                                                        \
  |  |  276|      0|        }                                                                                                                          \
  |  |  277|  5.91k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   65|  5.91k|        return mSubId;
   66|  5.91k|    }
_ZNK4chip8Decoders12PayloadEntry12GetCommandIdEv:
   70|  2.78k|    {
   71|  2.78k|        VerifyOrReturnValue(mType == IMPayloadType::kCommand, kInvalidId);
  ------------------
  |  |  270|  2.78k|    do                                                                                                                             \
  |  |  271|  2.78k|    {                                                                                                                              \
  |  |  272|  2.78k|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (272:13): [True: 0, False: 2.78k]
  |  |  ------------------
  |  |  273|  2.78k|        {                                                                                                                          \
  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  275|      0|            return (value);                                                                                                        \
  |  |  276|      0|        }                                                                                                                          \
  |  |  277|  2.78k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   72|  2.78k|        return mSubId;
   73|  2.78k|    }
_ZNK4chip8Decoders12PayloadEntry10GetEventIdEv:
   77|  1.47k|    {
   78|  1.47k|        VerifyOrReturnValue(mType == IMPayloadType::kEvent, kInvalidId);
  ------------------
  |  |  270|  1.47k|    do                                                                                                                             \
  |  |  271|  1.47k|    {                                                                                                                              \
  |  |  272|  1.47k|        if (!(expr))                                                                                                               \
  |  |  ------------------
  |  |  |  Branch (272:13): [True: 0, False: 1.47k]
  |  |  ------------------
  |  |  273|  1.47k|        {                                                                                                                          \
  |  |  274|      0|            __VA_ARGS__;                                                                                                           \
  |  |  275|      0|            return (value);                                                                                                        \
  |  |  276|      0|        }                                                                                                                          \
  |  |  277|  1.47k|    } while (false)
  |  |  ------------------
  |  |  |  Branch (277:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
   79|  1.47k|        return mSubId;
   80|  1.47k|    }
_ZN4chip8Decoders12PayloadEntry11SimpleValueEPKcS3_:
   83|  34.4M|    {
   84|  34.4M|        return PayloadEntry(IMPayloadType::kValue, name, value);
   85|  34.4M|    }
_ZN4chip8Decoders12PayloadEntry12NestingEnterEPKc:
   87|   318k|    static PayloadEntry NestingEnter(const char * name) { return PayloadEntry(IMPayloadType::kNestingEnter, name, ""); }
_ZN4chip8Decoders12PayloadEntry11NestingExitEv:
   89|   206k|    static PayloadEntry NestingExit() { return PayloadEntry(IMPayloadType::kNestingExit, "", ""); }
_ZN4chip8Decoders12PayloadEntry16AttributePayloadEjj:
   92|  2.95k|    {
   93|  2.95k|        PayloadEntry result(IMPayloadType::kAttribute, "ATTR_DATA", "");
   94|  2.95k|        result.mClusterId = cluster_id;
   95|  2.95k|        result.mSubId     = attribute_id;
   96|       |
   97|  2.95k|        return result;
   98|  2.95k|    }
_ZN4chip8Decoders12PayloadEntry14CommandPayloadEjj:
  101|  1.39k|    {
  102|  1.39k|        PayloadEntry result(IMPayloadType::kCommand, "COMMAND_DATA", "");
  103|  1.39k|        result.mClusterId = cluster_id;
  104|  1.39k|        result.mSubId     = command_id;
  105|  1.39k|        return result;
  106|  1.39k|    }
_ZN4chip8Decoders12PayloadEntry12EventPayloadEjj:
  109|    738|    {
  110|    738|        PayloadEntry result(IMPayloadType::kEvent, "EVENT_DATA", "");
  111|    738|        result.mClusterId = cluster_id;
  112|    738|        result.mSubId     = event_id;
  113|    738|        return result;
  114|    738|    }
_ZN4chip8Decoders12PayloadEntryC2ENS1_13IMPayloadTypeEPKcS4_:
  117|  34.9M|    PayloadEntry(IMPayloadType type, const char * name, const char * value) : mType(type), mName(name), mValue(value) {}
_ZNK4chip8Decoders24PayloadDecoderInitParams21GetProtocolDecodeTreeEv:
  172|  57.4k|    DecodeTree GetProtocolDecodeTree() const { return mProtocolTree; }
_ZNK4chip8Decoders24PayloadDecoderInitParams25GetProtocolDecodeTreeSizeEv:
  173|  57.4k|    size_t GetProtocolDecodeTreeSize() const { return mProtocolTreeSize; }
_ZNK4chip8Decoders24PayloadDecoderInitParams20GetClusterDecodeTreeEv:
  174|  57.4k|    DecodeTree GetClusterDecodeTree() const { return mClusterTree; }
_ZNK4chip8Decoders24PayloadDecoderInitParams24GetClusterDecodeTreeSizeEv:
  175|  57.4k|    size_t GetClusterDecodeTreeSize() const { return mClusterTreeSize; }
_ZNK4chip8Decoders24PayloadDecoderInitParams11GetProtocolEv:
  177|  57.4k|    Protocols::Id GetProtocol() const { return mProtocol; }
_ZNK4chip8Decoders24PayloadDecoderInitParams14GetMessageTypeEv:
  178|  57.4k|    uint8_t GetMessageType() const { return mMessageType; }

LLVMFuzzerTestOneInput:
   49|  2.61k|{
   50|  2.61k|    PayloadDecoderInitParams params;
   51|  2.61k|    params.SetProtocolDecodeTree(chip::TLVMeta::protocols_meta).SetClusterDecodeTree(chip::TLVMeta::clusters_meta);
   52|       |
   53|  2.61k|    chip::ByteSpan payload(data, len);
   54|       |
   55|       |    // Try all possible IM types (including an invalid one)
   56|  2.61k|    params.SetProtocol(chip::Protocols::InteractionModel::Id);
   57|  31.3k|    for (uint8_t messageType = 0; messageType < 11; messageType++)
  ------------------
  |  Branch (57:35): [True: 28.7k, False: 2.61k]
  ------------------
   58|  28.7k|    {
   59|  28.7k|        RunDecode(params.SetMessageType(messageType), payload);
   60|  28.7k|    }
   61|       |
   62|       |    // Try some SC variants
   63|  2.61k|    params.SetProtocol(chip::Protocols::SecureChannel::Id);
   64|  2.61k|    RunDecode(params.SetMessageType(0), payload);
   65|  2.61k|    RunDecode(params.SetMessageType(1), payload);
   66|  2.61k|    RunDecode(params.SetMessageType(2), payload);
   67|  2.61k|    RunDecode(params.SetMessageType(10), payload);
   68|  2.61k|    RunDecode(params.SetMessageType(11), payload);
   69|  2.61k|    RunDecode(params.SetMessageType(20), payload);
   70|  2.61k|    RunDecode(params.SetMessageType(32), payload);
   71|  2.61k|    RunDecode(params.SetMessageType(33), payload);
   72|       |
   73|  2.61k|    params.SetProtocol(chip::Protocols::BDX::Id);
   74|  2.61k|    RunDecode(params.SetMessageType(1), payload);
   75|  2.61k|    RunDecode(params.SetMessageType(2), payload);
   76|  2.61k|    RunDecode(params.SetMessageType(3), payload);
   77|       |
   78|  2.61k|    return 0;
   79|  2.61k|}
FuzzPayloadDecoder.cpp:_ZN12_GLOBAL__N_19RunDecodeERKN4chip8Decoders24PayloadDecoderInitParamsENS0_4SpanIKhEE:
   34|  57.4k|{
   35|  57.4k|    chip::Decoders::PayloadDecoder<64, 128> decoder(params);
   36|       |
   37|  57.4k|    decoder.StartDecoding(payload);
   38|       |
   39|  57.4k|    PayloadEntry entry;
   40|  34.9M|    while (decoder.Next(entry))
  ------------------
  |  Branch (40:12): [True: 34.9M, False: 57.4k]
  ------------------
   41|  34.9M|    {
   42|       |        // Nothing to do ...
   43|  34.9M|    }
   44|  57.4k|}

_ZN4chip7TLVMeta10ClusterTagEj:
   30|  66.1k|{
   31|  66.1k|    return TLV::CommonTag(cluster_id);
   32|  66.1k|}
_ZN4chip7TLVMeta12AttributeTagEj:
   35|  61.6k|{
   36|  61.6k|    return TLV::ProfileTag(kAttributeProfile, attribute_id);
   37|  61.6k|}
_ZN4chip7TLVMeta10CommandTagEj:
   40|  1.87k|{
   41|  1.87k|    return TLV::ProfileTag(kCommandProfile, command_id);
   42|  1.87k|}
_ZN4chip7TLVMeta8EventTagEj:
   45|  1.27k|{
   46|  1.27k|    return TLV::ProfileTag(kEventProfile, event_id);
   47|  1.27k|}
_ZN4chip7TLVMeta16ConstantValueTagEm:
   50|  11.9k|{
   51|       |    // Re-use common tag for a constant value
   52|       |    // Will make "RawValue be equal to value"
   53|  11.9k|    return TLV::ProfileTag(static_cast<uint32_t>(value >> 32), static_cast<uint32_t>(value & 0xFFFFFFFF));
   54|  11.9k|}

_ZN4chip8Encoding12BufferWriter3PutEPKc:
   24|  34.5M|{
   25|  34.5M|    static_assert(CHAR_BIT == 8, "We're assuming char and uint8_t are the same size");
   26|  34.5M|    return Put(s, strlen(s));
   27|  34.5M|}
_ZN4chip8Encoding12BufferWriter3PutEPKvm:
   30|  34.5M|{
   31|  34.5M|    size_t available = Available();
   32|       |
   33|  34.5M|    if (available > 0)
  ------------------
  |  Branch (33:9): [True: 34.5M, False: 2.11k]
  ------------------
   34|  34.5M|    {
   35|  34.5M|        memmove(mBuf + mNeeded, buf, available < len ? available : len);
  ------------------
  |  Branch (35:38): [True: 316, False: 34.5M]
  ------------------
   36|  34.5M|    }
   37|       |
   38|  34.5M|    mNeeded += len;
   39|  34.5M|    return *this;
   40|  34.5M|}

_ZN4chip8Encoding12BufferWriterC2EPhm:
   32|   114k|    BufferWriter(uint8_t * buf, size_t len) : mBuf(buf), mSize(len), mNeeded(0)
   33|   114k|    {
   34|   114k|        if (buf == nullptr)
  ------------------
  |  Branch (34:13): [True: 0, False: 114k]
  ------------------
   35|      0|        {
   36|      0|            mSize = 0;
   37|      0|        }
   38|   114k|    }
_ZN4chip8Encoding12BufferWriter4SkipEm:
   56|  70.3M|    {
   57|  70.3M|        mNeeded += len;
   58|  70.3M|        return *this;
   59|  70.3M|    }
_ZNK4chip8Encoding12BufferWriter6NeededEv:
   62|  70.3M|    inline size_t Needed() const { return mNeeded; }
_ZNK4chip8Encoding12BufferWriter9AvailableEv:
   68|   175M|    size_t Available() const { return mSize < mNeeded ? 0 : mSize - mNeeded; }
  ------------------
  |  Branch (68:39): [True: 139M, False: 35.4M]
  ------------------
_ZNK4chip8Encoding12BufferWriter3FitEv:
   72|   139M|    {
   73|   139M|        size_t _;
   74|   139M|        return Fit(_);
   75|   139M|    }
_ZNK4chip8Encoding12BufferWriter3FitERm:
   79|   139M|    {
   80|   139M|        actuallyWritten = mSize >= mNeeded ? mNeeded : mSize;
  ------------------
  |  Branch (80:27): [True: 69.9M, False: 69.9M]
  ------------------
   81|   139M|        return mSize >= mNeeded;
   82|   139M|    }
_ZNK4chip8Encoding12BufferWriter4SizeEv:
   85|   139M|    size_t Size() const { return mSize; }
_ZN4chip8Encoding12BufferWriter6BufferEv:
   87|   210M|    uint8_t * Buffer() { return mBuf; }
_ZNK4chip8Encoding12BufferWriter6BufferEv:
   88|  69.0M|    const uint8_t * Buffer() const { return mBuf; }
_ZN4chip8Encoding12BufferWriter5ResetEv:
   90|  34.9M|    void Reset() { mNeeded = 0; }

_ZN4chip12CastToSignedIhEENSt3__19enable_ifIXsr3std11is_unsignedIT_EE5valueENS1_11make_signedIS3_E4typeEE4typeES3_:
  129|  11.2k|{
  130|  11.2k|    using namespace std;
  131|  11.2k|    typedef typename make_signed<T>::type signed_type;
  132|       |
  133|  11.2k|    if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
  ------------------
  |  Branch (133:9): [True: 10.9k, False: 308]
  ------------------
  134|  10.9k|    {
  135|  10.9k|        return static_cast<signed_type>(arg);
  136|  10.9k|    }
  137|       |
  138|       |    // We want to return arg - (numeric_limits<T>::max() + 1), but do it without
  139|       |    // hitting overflow.  We do this by rewriting it as:
  140|       |    //
  141|       |    // -(numeric_limits<T>::max() - arg) - 1
  142|       |    //
  143|       |    // then noting that both (numeric_limits<T>::max() - arg) and its negation
  144|       |    // are guaranteed to fit in signed_type.
  145|    308|    signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
  146|    308|    return static_cast<signed_type>(-diff - 1);
  147|  11.2k|}
_ZN4chip12CastToSignedItEENSt3__19enable_ifIXsr3std11is_unsignedIT_EE5valueENS1_11make_signedIS3_E4typeEE4typeES3_:
  129|  1.82k|{
  130|  1.82k|    using namespace std;
  131|  1.82k|    typedef typename make_signed<T>::type signed_type;
  132|       |
  133|  1.82k|    if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
  ------------------
  |  Branch (133:9): [True: 1.75k, False: 70]
  ------------------
  134|  1.75k|    {
  135|  1.75k|        return static_cast<signed_type>(arg);
  136|  1.75k|    }
  137|       |
  138|       |    // We want to return arg - (numeric_limits<T>::max() + 1), but do it without
  139|       |    // hitting overflow.  We do this by rewriting it as:
  140|       |    //
  141|       |    // -(numeric_limits<T>::max() - arg) - 1
  142|       |    //
  143|       |    // then noting that both (numeric_limits<T>::max() - arg) and its negation
  144|       |    // are guaranteed to fit in signed_type.
  145|     70|    signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
  146|     70|    return static_cast<signed_type>(-diff - 1);
  147|  1.82k|}
_ZN4chip12CastToSignedIjEENSt3__19enable_ifIXsr3std11is_unsignedIT_EE5valueENS1_11make_signedIS3_E4typeEE4typeES3_:
  129|  1.79k|{
  130|  1.79k|    using namespace std;
  131|  1.79k|    typedef typename make_signed<T>::type signed_type;
  132|       |
  133|  1.79k|    if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
  ------------------
  |  Branch (133:9): [True: 1.77k, False: 14]
  ------------------
  134|  1.77k|    {
  135|  1.77k|        return static_cast<signed_type>(arg);
  136|  1.77k|    }
  137|       |
  138|       |    // We want to return arg - (numeric_limits<T>::max() + 1), but do it without
  139|       |    // hitting overflow.  We do this by rewriting it as:
  140|       |    //
  141|       |    // -(numeric_limits<T>::max() - arg) - 1
  142|       |    //
  143|       |    // then noting that both (numeric_limits<T>::max() - arg) and its negation
  144|       |    // are guaranteed to fit in signed_type.
  145|     14|    signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
  146|     14|    return static_cast<signed_type>(-diff - 1);
  147|  1.79k|}
_ZN4chip12CastToSignedImEENSt3__19enable_ifIXsr3std11is_unsignedIT_EE5valueENS1_11make_signedIS3_E4typeEE4typeES3_:
  129|  1.89k|{
  130|  1.89k|    using namespace std;
  131|  1.89k|    typedef typename make_signed<T>::type signed_type;
  132|       |
  133|  1.89k|    if (arg <= static_cast<T>(numeric_limits<signed_type>::max()))
  ------------------
  |  Branch (133:9): [True: 1.70k, False: 182]
  ------------------
  134|  1.70k|    {
  135|  1.70k|        return static_cast<signed_type>(arg);
  136|  1.70k|    }
  137|       |
  138|       |    // We want to return arg - (numeric_limits<T>::max() + 1), but do it without
  139|       |    // hitting overflow.  We do this by rewriting it as:
  140|       |    //
  141|       |    // -(numeric_limits<T>::max() - arg) - 1
  142|       |    //
  143|       |    // then noting that both (numeric_limits<T>::max() - arg) and its negation
  144|       |    // are guaranteed to fit in signed_type.
  145|    182|    signed_type diff = static_cast<signed_type>(numeric_limits<T>::max() - arg);
  146|    182|    return static_cast<signed_type>(-diff - 1);
  147|  1.89k|}
_ZN4chip9CanCastToIjmTnNSt3__19enable_ifIXsr11is_integralIT_EE5valueEiE4typeELi0EEEbT0_:
   39|  3.55k|{
   40|  3.55k|    using namespace std;
   41|       |    // U might be a reference to an integer type, if we're assigning from
   42|       |    // something passed by reference.
   43|  3.55k|    typedef typename remove_reference<U>::type V; // V for "value"
   44|  3.55k|    static_assert(is_integral<V>::value, "Must be assigning from an integral type");
   45|       |
   46|       |    // We want to check that "arg" can fit inside T but without doing any tests
   47|       |    // that are always true or always false due to the types involved, which
   48|       |    // would trigger compiler warnings themselves.  So for example, we can't
   49|       |    // compare arg to max values for T if all U values are representable in T,
   50|       |    // etc, because those trigger warnings on some compilers.
   51|       |
   52|       |    // We also can't directly compare signed to unsigned values in general,
   53|       |    // because that will trigger sign conversion warnings. In fact, it will
   54|       |    // trigger them even on runtime-unreached codepaths, so for example we can't
   55|       |    // directly compare two min() values to each other!
   56|       |
   57|       |    // Oh, and some compilers warn on theoretical signed-to-unsigned compares
   58|       |    // even when those can't be reached, and that's known at compile time.
   59|       |    // Hence all the casts to intmax_t and uintmax_t below.
   60|       |
   61|       |    // A bunch of these tests could sure benefit from "if constexpr", but let's
   62|       |    // hope compilers just manage to optimize them properly anyway.
   63|       |    // We can't blindly compare "arg" to the minimal or maximal value of T one
   64|       |    // of T and V is signed and the other is unsigned: there might not be a
   65|       |    // single integer type that can represent _both_ the value of arg and the
   66|       |    // minimal/maximal value.
   67|  3.55k|    if (numeric_limits<T>::is_signed && numeric_limits<V>::is_signed)
  ------------------
  |  Branch (67:9): [Folded - Ignored]
  |  Branch (67:41): [Folded - Ignored]
  ------------------
   68|      0|    {
   69|      0|        if (static_cast<intmax_t>(numeric_limits<V>::max()) <= static_cast<intmax_t>(numeric_limits<T>::max()) &&
  ------------------
  |  Branch (69:13): [Folded - Ignored]
  ------------------
   70|      0|            static_cast<intmax_t>(numeric_limits<V>::min()) >= static_cast<intmax_t>(numeric_limits<T>::min()))
  ------------------
  |  Branch (70:13): [Folded - Ignored]
  ------------------
   71|      0|        {
   72|       |            // Any checks on arg would be trivially true; don't even do them, to
   73|       |            // avoid warnings.
   74|      0|            return true;
   75|      0|        }
   76|       |
   77|      0|        return static_cast<intmax_t>(numeric_limits<T>::min()) <= static_cast<intmax_t>(arg) &&
  ------------------
  |  Branch (77:16): [True: 0, False: 0]
  ------------------
   78|      0|            static_cast<intmax_t>(arg) <= static_cast<intmax_t>(numeric_limits<T>::max());
  ------------------
  |  Branch (78:13): [True: 0, False: 0]
  ------------------
   79|      0|    }
   80|       |
   81|  3.55k|    if (!numeric_limits<T>::is_signed && !numeric_limits<V>::is_signed)
  ------------------
  |  Branch (81:9): [Folded - Ignored]
  |  Branch (81:42): [Folded - Ignored]
  ------------------
   82|  3.55k|    {
   83|  3.55k|        if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
  ------------------
  |  Branch (83:13): [Folded - Ignored]
  ------------------
   84|      0|        {
   85|       |            // Any checks on arg would be trivially true; don't even do them, to
   86|       |            // avoid warnings.
   87|      0|            return true;
   88|      0|        }
   89|       |
   90|  3.55k|        return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
   91|  3.55k|    }
   92|       |
   93|      0|    if (numeric_limits<T>::is_signed)
  ------------------
  |  Branch (93:9): [Folded - Ignored]
  ------------------
   94|      0|    {
   95|      0|        static_assert(numeric_limits<T>::max() >= 0, "What weird type is this?");
   96|      0|        if (static_cast<uintmax_t>(numeric_limits<V>::max()) <= static_cast<uintmax_t>(numeric_limits<T>::max()))
  ------------------
  |  Branch (96:13): [Folded - Ignored]
  ------------------
   97|      0|        {
   98|      0|            return true;
   99|      0|        }
  100|       |
  101|      0|        return static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
  102|      0|    }
  103|       |
  104|      0|    return 0 <= arg && static_cast<uintmax_t>(arg) <= static_cast<uintmax_t>(numeric_limits<T>::max());
  ------------------
  |  Branch (104:12): [True: 0, False: 0]
  |  Branch (104:24): [True: 0, False: 0]
  ------------------
  105|      0|}

_ZNK4chip4SpanIKhE4dataEv:
  118|  57.4k|    constexpr pointer data() const { return mDataBuf; }
_ZNK4chip4SpanIKhE4sizeEv:
  119|  57.4k|    constexpr size_t size() const { return mDataLen; }
_ZN4chip4SpanIKhEC2EPS1_m:
   52|  2.61k|    Span(pointer databuf, size_t datalen) : mDataBuf(databuf), mDataLen(datalen)
   53|  2.61k|    {
   54|  2.61k|        VerifyOrDie(databuf != nullptr || datalen == 0); // not constexpr on some platforms
  ------------------
  |  |  497|  2.61k|    nlABORT_ACTION(aCondition, ChipLogError(Support, "VerifyOrDie failure at %s:%d: %s", __FILE__, __LINE__, #aCondition))
  |  |  ------------------
  |  |  |  |  711|  2.61k|#define nlABORT_ACTION(aCondition, anAction)                                    __nlABORT_ACTION(NL_ASSERT_ABORT_PRODUCTION_FLAGS, aCondition, anAction)
  |  |  |  |  ------------------
  |  |  |  |  |  |  487|  2.61k|#define __nlABORT_ACTION(flags, condition, action)                                        __nlPRECONDITION_ACTION(flags, condition, NL_ASSERT_ABORT(), action)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  431|  2.61k|    if (__nlSHOULD_ASSERT(condition))                                                     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  125|  5.22k|#define __nlSHOULD_ASSERT(condition) condition) { /* do nothing */ } else if (1
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 2.61k, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:79): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  432|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  433|      0|        __NL_ASSERT_MAYBE_RUN_PRE_ACTION_TRIGGERS((flags),                                \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  203|      0|    do                                                                                    \
  |  |  |  |  |  |  |  |  |  |  204|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  |  |  205|      0|        if ((flags) & NL_ASSERT_FLAG_LOG) {                                               \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  835|      0|#define NL_ASSERT_FLAG_LOG              0x00000002
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (205:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  206|      0|            NL_ASSERT_LOG(prefix, name, condition, label, file, line, message);           \
  |  |  |  |  |  |  |  |  |  |  207|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  208|      0|        if ((flags) & NL_ASSERT_FLAG_BACKTRACE) {                                         \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  815|      0|#define NL_ASSERT_FLAG_BACKTRACE        0x00000001
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (208:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  209|      0|            NL_ASSERT_BACKTRACE();                                                        \
  |  |  |  |  |  |  |  |  |  |  210|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  211|      0|    } while (0)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (211:14): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  434|      0|                                                  NL_ASSERT_PREFIX_STRING,                \
  |  |  |  |  |  |  |  |  435|      0|                                                  NL_ASSERT_COMPONENT_STRING,             \
  |  |  |  |  |  |  |  |  436|      0|                                                  #condition,                             \
  |  |  |  |  |  |  |  |  437|      0|                                                  0,                                      \
  |  |  |  |  |  |  |  |  438|      0|                                                  NL_ASSERT_FILE,                         \
  |  |  |  |  |  |  |  |  439|      0|                                                  __LINE__,                               \
  |  |  |  |  |  |  |  |  440|      0|                                                  0);                                     \
  |  |  |  |  |  |  |  |  441|      0|        {                                                                                 \
  |  |  |  |  |  |  |  |  442|      0|            action;                                                                       \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [True: 0, False: 0]
  |  |  |  |  |  |  |  |  |  Branch (442:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  443|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  444|      0|        __NL_ASSERT_MAYBE_RUN_POST_ACTION_TRIGGERS((flags),                               \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  214|      0|    do                                                                                    \
  |  |  |  |  |  |  |  |  |  |  215|      0|    {                                                                                     \
  |  |  |  |  |  |  |  |  |  |  216|      0|        if ((flags) & NL_ASSERT_FLAG_TRAP) {                                              \
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  855|      0|#define NL_ASSERT_FLAG_TRAP             0x00000004
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (216:13): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  217|      0|            NL_ASSERT_TRAP();                                                             \
  |  |  |  |  |  |  |  |  |  |  218|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  |  |  219|      0|    } while (0)
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (219:14): [Folded - Ignored]
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  445|      0|                                                   NL_ASSERT_PREFIX_STRING,               \
  |  |  |  |  |  |  |  |  446|      0|                                                   NL_ASSERT_COMPONENT_STRING,            \
  |  |  |  |  |  |  |  |  447|      0|                                                   #condition,                            \
  |  |  |  |  |  |  |  |  448|      0|                                                   0,                                     \
  |  |  |  |  |  |  |  |  449|      0|                                                   NL_ASSERT_FILE,                        \
  |  |  |  |  |  |  |  |  450|      0|                                                   __LINE__,                              \
  |  |  |  |  |  |  |  |  451|      0|                                                   0);                                    \
  |  |  |  |  |  |  |  |  452|      0|        {                                                                                 \
  |  |  |  |  |  |  |  |  453|      0|            termination;                                                                  \
  |  |  |  |  |  |  |  |  454|      0|        }                                                                                 \
  |  |  |  |  |  |  |  |  455|      0|    }                                                                                     \
  |  |  |  |  |  |  |  |  456|      0|    else do {} while (0) /* This is explained in the comment above __nlCHECK */
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  Branch (456:23): [Folded - Ignored]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   55|  2.61k|    }

_ZN4chip17StringBuilderBase9AddFormatEPKcz:
   23|  70.3M|{
   24|  70.3M|    va_list args;
   25|  70.3M|    va_start(args, format);
   26|       |
   27|  70.3M|    char * output = nullptr;
   28|  70.3M|    if (mWriter.Available() > 0)
  ------------------
  |  Branch (28:9): [True: 434k, False: 69.9M]
  ------------------
   29|   434k|    {
   30|   434k|        output = reinterpret_cast<char *>(mWriter.Buffer() + mWriter.Needed());
   31|   434k|    }
   32|  69.9M|    else
   33|  69.9M|    {
   34|  69.9M|        output = reinterpret_cast<char *>(mWriter.Buffer() + mWriter.Size());
   35|  69.9M|    }
   36|       |
   37|       |    // the + 1 size here because StringBuilder reserves one byte for final null terminator
   38|  70.3M|    int needed = vsnprintf(output, mWriter.Available() + 1, format, args);
   39|       |
   40|       |    // on invalid formats, printf-style methods return negative numbers
   41|  70.3M|    if (needed > 0)
  ------------------
  |  Branch (41:9): [True: 70.3M, False: 0]
  ------------------
   42|  70.3M|    {
   43|  70.3M|        mWriter.Skip(static_cast<size_t>(needed));
   44|  70.3M|    }
   45|       |
   46|  70.3M|    va_end(args);
   47|  70.3M|    NullTerminate();
   48|  70.3M|    return *this;
   49|  70.3M|}
_ZN4chip17StringBuilderBase19AddMarkerIfOverflowEv:
   52|  19.8k|{
   53|  19.8k|    if (mWriter.Fit())
  ------------------
  |  Branch (53:9): [True: 18.5k, False: 1.34k]
  ------------------
   54|  18.5k|    {
   55|  18.5k|        return *this;
   56|  18.5k|    }
   57|       |
   58|  5.39k|    for (unsigned i = 0; i < 3; i++)
  ------------------
  |  Branch (58:26): [True: 4.04k, False: 1.34k]
  ------------------
   59|  4.04k|    {
   60|  4.04k|        if (mWriter.Size() >= i + 1)
  ------------------
  |  Branch (60:13): [True: 4.04k, False: 0]
  ------------------
   61|  4.04k|        {
   62|  4.04k|            mWriter.Buffer()[mWriter.Size() - i - 1] = '.';
   63|  4.04k|        }
   64|  4.04k|    }
   65|  1.34k|    return *this;
   66|  19.8k|}

_ZN4chip13StringBuilderILm64EEC2Ev:
   97|  57.4k|    StringBuilder() : StringBuilderBase(mBuffer, kSize) {}
_ZN4chip17StringBuilderBaseC2EPcm:
   30|   114k|    StringBuilderBase(char * buffer, size_t size) : mWriter(reinterpret_cast<uint8_t *>(buffer), size - 1)
   31|   114k|    {
   32|   114k|        nlASSERT(size > 0);
  ------------------
  |  |  634|   114k|#define nlASSERT(aCondition)                                                    __nlASSERT_UNUSED(aCondition)
  |  |  ------------------
  |  |  |  |  127|   114k|#define __nlASSERT_UNUSED(condition) do { if (condition) { /* do nothing */ } } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (127:47): [True: 114k, False: 0]
  |  |  |  |  |  Branch (127:88): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   33|   114k|        buffer[0] = 0; // make c-str work by default
   34|   114k|    }
_ZN4chip13StringBuilderILm128EEC2Ev:
   97|  57.4k|    StringBuilder() : StringBuilderBase(mBuffer, kSize) {}
_ZN4chip17StringBuilderBase3AddEPKc:
   38|  34.5M|    {
   39|  34.5M|        mWriter.Put(s);
   40|  34.5M|        NullTerminate();
   41|  34.5M|        return *this;
   42|  34.5M|    }
_ZN4chip17StringBuilderBase5ResetEv:
   67|  34.9M|    {
   68|  34.9M|        mWriter.Reset();
   69|  34.9M|        NullTerminate();
   70|  34.9M|        return *this;
   71|  34.9M|    }
_ZNK4chip17StringBuilderBase5c_strEv:
   74|  69.0M|    const char * c_str() const { return reinterpret_cast<const char *>(mWriter.Buffer()); }
_ZN4chip17StringBuilderBase13NullTerminateEv:
   80|   139M|    {
   81|   139M|        if (mWriter.Fit())
  ------------------
  |  Branch (81:13): [True: 69.9M, False: 69.9M]
  ------------------
   82|  69.9M|        {
   83|  69.9M|            mWriter.Buffer()[mWriter.Needed()] = 0;
   84|  69.9M|        }
   85|  69.9M|        else
   86|  69.9M|        {
   87|  69.9M|            mWriter.Buffer()[mWriter.Size()] = 0;
   88|  69.9M|        }
   89|   139M|    }

_ZNK4chip9Protocols2Id24ToFullyQualifiedSpecFormEv:
   57|  73.1k|    constexpr uint32_t ToFullyQualifiedSpecForm() const { return ToUint32(); }
_ZNK4chip9Protocols2Id8ToUint32Ev:
   71|  73.1k|    constexpr uint32_t ToUint32() const { return (static_cast<uint32_t>(mVendorId) << kVendorIdShift) | mProtocolId; }

TLVReader.cpp:_ZL29nlByteOrderSwap64LittleToHostm:
   79|  96.9M|{
   80|  96.9M|    return inValue;
   81|  96.9M|}
TLVReader.cpp:_ZL29nlByteOrderSwap16LittleToHostt:
   43|  31.6k|{
   44|  31.6k|    return inValue;
   45|  31.6k|}
TLVReader.cpp:_ZL29nlByteOrderSwap32LittleToHostj:
   61|  10.4k|{
   62|  10.4k|    return inValue;
   63|  10.4k|}

_ZN2nl9ByteOrder18Swap16LittleToHostEt:
  160|  31.6k|        {
  161|  31.6k|            return nlByteOrderSwap16LittleToHost(inValue);
  162|  31.6k|        }
_ZN2nl9ByteOrder18Swap32LittleToHostEj:
  178|  10.4k|        {
  179|  10.4k|            return nlByteOrderSwap32LittleToHost(inValue);
  180|  10.4k|        }
_ZN2nl9ByteOrder18Swap64LittleToHostEm:
  196|  96.9M|        {
  197|  96.9M|            return nlByteOrderSwap64LittleToHost(inValue);
  198|  96.9M|        }

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

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

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

