_ZNK4chip9ChipErrorneERKS0_:
  204|  13.5k|    bool operator!=(const ChipError & other) const { return mError != other.mError; }
_ZN4chip9ChipErrorC2EjPKcj:
  190|  27.2k|        mError(error) CHIP_INITIALIZE_ERROR_SOURCE(file, line, /*loc=*/nullptr)
  ------------------
  |  |  122|  27.2k|#define CHIP_INITIALIZE_ERROR_SOURCE(f, l, loc) , mFile((f)), mLine((l))
  ------------------
  191|  27.2k|    {}
_ZNK4chip9ChipErroreqERKS0_:
  203|     92|    bool operator==(const ChipError & other) const { return mError == other.mError; }

_ZN4chip4SpanIcEC2IcLm512ETnNSt3__19enable_ifIXaaaantsr3stdE9is_same_vIT_KcEeqstS5_Lm1Esr3stdE16is_convertible_vIPS5_PcEEbE4typeELb1EEERAT0__S5_:
   67|     92|    constexpr explicit Span(U (&databuf)[N]) : mDataBuf(databuf), mDataLen(N)
   68|     92|    {}
_ZNK4chip4SpanIcE4dataEv:
  118|  13.6k|    constexpr pointer data() const { return mDataBuf; }
_ZNK4chip4SpanIcE4sizeEv:
  119|  3.00k|    constexpr size_t size() const { return mDataLen; }
_ZN4chip4SpanIKhEC2EPS1_m:
   52|     92|    Span(pointer databuf, size_t datalen) : mDataBuf(databuf), mDataLen(datalen)
   53|     92|    {
   54|     92|        VerifyOrDie(databuf != nullptr || datalen == 0); // not constexpr on some platforms
  ------------------
  |  |  497|     92|    nlABORT_ACTION(aCondition, ChipLogError(Support, "VerifyOrDie failure at %s:%d: %s", __FILE__, __LINE__, #aCondition))
  |  |  ------------------
  |  |  |  |  711|     92|#define nlABORT_ACTION(aCondition, anAction)                                    __nlABORT_ACTION(NL_ASSERT_ABORT_PRODUCTION_FLAGS, aCondition, anAction)
  |  |  |  |  ------------------
  |  |  |  |  |  |  487|     92|#define __nlABORT_ACTION(flags, condition, action)                                        __nlPRECONDITION_ACTION(flags, condition, NL_ASSERT_ABORT(), action)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  431|     92|    if (__nlSHOULD_ASSERT(condition))                                                     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  125|    184|#define __nlSHOULD_ASSERT(condition) condition) { /* do nothing */ } else if (1
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 92, 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|     92|    }
_ZNK4chip4SpanIKhE4sizeEv:
  119|     92|    constexpr size_t size() const { return mDataLen; }
_ZNK4chip4SpanIKhE4dataEv:
  118|     92|    constexpr pointer data() const { return mDataBuf; }
_ZN4chip4SpanIcE11reduce_sizeEm:
  153|     92|    {
  154|     92|        VerifyOrDie(new_size <= size());
  ------------------
  |  |  497|     92|    nlABORT_ACTION(aCondition, ChipLogError(Support, "VerifyOrDie failure at %s:%d: %s", __FILE__, __LINE__, #aCondition))
  |  |  ------------------
  |  |  |  |  711|     92|#define nlABORT_ACTION(aCondition, anAction)                                    __nlABORT_ACTION(NL_ASSERT_ABORT_PRODUCTION_FLAGS, aCondition, anAction)
  |  |  |  |  ------------------
  |  |  |  |  |  |  487|     92|#define __nlABORT_ACTION(flags, condition, action)                                        __nlPRECONDITION_ACTION(flags, condition, NL_ASSERT_ABORT(), action)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  431|     92|    if (__nlSHOULD_ASSERT(condition))                                                     \
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  125|     92|#define __nlSHOULD_ASSERT(condition) condition) { /* do nothing */ } else if (1
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  Branch (125:38): [True: 92, 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]
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  155|     92|        mDataLen = new_size;
  156|     92|    }

_ZN4chip12base38DecodeENSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEERNS0_6vectorIhNS4_IhEEEE:
   99|     92|{
  100|     92|    result.clear();
  101|       |
  102|     92|    size_t base38CharactersNumber  = base38.length();
  103|     92|    size_t decodedBase38Characters = 0;
  104|  2.82k|    while (base38CharactersNumber > 0)
  ------------------
  |  Branch (104:12): [True: 2.72k, False: 92]
  ------------------
  105|  2.72k|    {
  106|  2.72k|        uint8_t base38CharactersInChunk;
  107|  2.72k|        uint8_t bytesInDecodedChunk;
  108|       |
  109|  2.72k|        if (base38CharactersNumber >= kBase38CharactersNeededInNBytesChunk[2])
  ------------------
  |  Branch (109:13): [True: 2.66k, False: 68]
  ------------------
  110|  2.66k|        {
  111|  2.66k|            base38CharactersInChunk = kBase38CharactersNeededInNBytesChunk[2];
  112|  2.66k|            bytesInDecodedChunk     = 3;
  113|  2.66k|        }
  114|     68|        else if (base38CharactersNumber == kBase38CharactersNeededInNBytesChunk[1])
  ------------------
  |  Branch (114:18): [True: 25, False: 43]
  ------------------
  115|     25|        {
  116|     25|            base38CharactersInChunk = kBase38CharactersNeededInNBytesChunk[1];
  117|     25|            bytesInDecodedChunk     = 2;
  118|     25|        }
  119|     43|        else if (base38CharactersNumber == kBase38CharactersNeededInNBytesChunk[0])
  ------------------
  |  Branch (119:18): [True: 43, False: 0]
  ------------------
  120|     43|        {
  121|     43|            base38CharactersInChunk = kBase38CharactersNeededInNBytesChunk[0];
  122|     43|            bytesInDecodedChunk     = 1;
  123|     43|        }
  124|      0|        else
  125|      0|        {
  126|      0|            return CHIP_ERROR_INVALID_STRING_LENGTH;
  ------------------
  |  |  754|      0|#define CHIP_ERROR_INVALID_STRING_LENGTH                       CHIP_CORE_ERROR(0x1e)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  127|      0|        }
  128|       |
  129|  2.72k|        uint32_t value = 0;
  130|       |
  131|  16.2k|        for (size_t i = base38CharactersInChunk; i > 0; i--)
  ------------------
  |  Branch (131:50): [True: 13.4k, False: 2.72k]
  ------------------
  132|  13.4k|        {
  133|  13.4k|            uint8_t v      = 0;
  134|  13.4k|            CHIP_ERROR err = decodeChar(base38[decodedBase38Characters + i - 1], v);
  135|       |
  136|  13.4k|            if (err != CHIP_NO_ERROR)
  ------------------
  |  |  482|  13.4k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (136:17): [True: 0, False: 13.4k]
  ------------------
  137|      0|            {
  138|      0|                return err;
  139|      0|            }
  140|       |
  141|  13.4k|            value = value * kRadix + v;
  142|  13.4k|        }
  143|  2.72k|        decodedBase38Characters += base38CharactersInChunk;
  144|  2.72k|        base38CharactersNumber -= base38CharactersInChunk;
  145|       |
  146|  10.8k|        for (size_t i = 0; i < bytesInDecodedChunk; i++)
  ------------------
  |  Branch (146:28): [True: 8.07k, False: 2.72k]
  ------------------
  147|  8.07k|        {
  148|  8.07k|            result.push_back(static_cast<uint8_t>(value));
  149|  8.07k|            value >>= 8;
  150|  8.07k|        }
  151|       |
  152|  2.72k|        if (value > 0)
  ------------------
  |  Branch (152:13): [True: 0, False: 2.72k]
  ------------------
  153|      0|        {
  154|       |            // encoded value is too big to represent a correct chunk of size 1, 2 or 3 bytes
  155|      0|            return CHIP_ERROR_INVALID_ARGUMENT;
  ------------------
  |  |  888|      0|#define CHIP_ERROR_INVALID_ARGUMENT                            CHIP_CORE_ERROR(0x2f)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  156|      0|        }
  157|  2.72k|    }
  158|     92|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|     92|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  159|     92|}
Base38Decode.cpp:_ZN12_GLOBAL__N_110decodeCharEcRh:
   29|  13.4k|{
   30|  13.4k|    static const int kBogus = 255;
   31|       |    // map of base38 charater to numeric value
   32|       |    // subtract 45 from the charater, then index into this array, if possible
   33|  13.4k|    const uint8_t decodes[] = {
   34|  13.4k|        36,     // '-', =45
   35|  13.4k|        37,     // '.', =46
   36|  13.4k|        kBogus, // '/', =47
   37|  13.4k|        0,      // '0', =48
   38|  13.4k|        1,      // '1', =49
   39|  13.4k|        2,      // '2', =50
   40|  13.4k|        3,      // '3', =51
   41|  13.4k|        4,      // '4', =52
   42|  13.4k|        5,      // '5', =53
   43|  13.4k|        6,      // '6', =54
   44|  13.4k|        7,      // '7', =55
   45|  13.4k|        8,      // '8', =56
   46|  13.4k|        9,      // '9', =57
   47|  13.4k|        kBogus, // ':', =58
   48|  13.4k|        kBogus, // ';', =59
   49|  13.4k|        kBogus, // '<', =50
   50|  13.4k|        kBogus, // '=', =61
   51|  13.4k|        kBogus, // '>', =62
   52|  13.4k|        kBogus, // '?', =63
   53|  13.4k|        kBogus, // '@', =64
   54|  13.4k|        10,     // 'A', =65
   55|  13.4k|        11,     // 'B', =66
   56|  13.4k|        12,     // 'C', =67
   57|  13.4k|        13,     // 'D', =68
   58|  13.4k|        14,     // 'E', =69
   59|  13.4k|        15,     // 'F', =70
   60|  13.4k|        16,     // 'G', =71
   61|  13.4k|        17,     // 'H', =72
   62|  13.4k|        18,     // 'I', =73
   63|  13.4k|        19,     // 'J', =74
   64|  13.4k|        20,     // 'K', =75
   65|  13.4k|        21,     // 'L', =76
   66|  13.4k|        22,     // 'M', =77
   67|  13.4k|        23,     // 'N', =78
   68|  13.4k|        24,     // 'O', =79
   69|  13.4k|        25,     // 'P', =80
   70|  13.4k|        26,     // 'Q', =81
   71|  13.4k|        27,     // 'R', =82
   72|  13.4k|        28,     // 'S', =83
   73|  13.4k|        29,     // 'T', =84
   74|  13.4k|        30,     // 'U', =85
   75|  13.4k|        31,     // 'V', =86
   76|  13.4k|        32,     // 'W', =87
   77|  13.4k|        33,     // 'X', =88
   78|  13.4k|        34,     // 'Y', =89
   79|  13.4k|        35,     // 'Z', =90
   80|  13.4k|    };
   81|  13.4k|    if (c < '-' || c > 'Z')
  ------------------
  |  Branch (81:9): [True: 0, False: 13.4k]
  |  Branch (81:20): [True: 0, False: 13.4k]
  ------------------
   82|      0|    {
   83|      0|        return CHIP_ERROR_INVALID_INTEGER_VALUE;
  ------------------
  |  | 1388|      0|#define CHIP_ERROR_INVALID_INTEGER_VALUE                       CHIP_CORE_ERROR(0x8f)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   84|      0|    }
   85|  13.4k|    uint8_t v = decodes[c - '-'];
   86|  13.4k|    if (v == kBogus)
  ------------------
  |  Branch (86:9): [True: 0, False: 13.4k]
  ------------------
   87|      0|    {
   88|      0|        return CHIP_ERROR_INVALID_INTEGER_VALUE;
  ------------------
  |  | 1388|      0|#define CHIP_ERROR_INVALID_INTEGER_VALUE                       CHIP_CORE_ERROR(0x8f)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   89|      0|    }
   90|  13.4k|    value = v;
   91|  13.4k|    return CHIP_NO_ERROR;
  ------------------
  |  |  482|  13.4k|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
   92|  13.4k|}

_ZN4chip12base38EncodeENS_4SpanIKhEERNS0_IcEE:
   45|     92|{
   46|     92|    CHIP_ERROR err             = CHIP_NO_ERROR;
  ------------------
  |  |  482|     92|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
   47|     92|    const uint8_t * in_buf_ptr = in_buf.data();
   48|     92|    size_t in_buf_len          = in_buf.size();
   49|     92|    size_t out_idx             = 0;
   50|       |
   51|  2.82k|    while (in_buf_len > 0)
  ------------------
  |  Branch (51:12): [True: 2.72k, False: 92]
  ------------------
   52|  2.72k|    {
   53|  2.72k|        uint32_t value = 0;
   54|  2.72k|        static_assert((sizeof(value) * CHAR_BIT) >= (kMaxBytesSingleChunkLen * 8), "Type for value is too small for conversions");
   55|       |
   56|  2.72k|        size_t bytesInChunk = (in_buf_len >= kMaxBytesSingleChunkLen) ? kMaxBytesSingleChunkLen : in_buf_len;
  ------------------
  |  Branch (56:31): [True: 2.66k, False: 68]
  ------------------
   57|       |
   58|  10.8k|        for (size_t byte_idx = 0; byte_idx < bytesInChunk; byte_idx++)
  ------------------
  |  Branch (58:35): [True: 8.07k, False: 2.72k]
  ------------------
   59|  8.07k|        {
   60|  8.07k|            value += static_cast<uint32_t>(in_buf_ptr[byte_idx] << (8 * byte_idx));
   61|  8.07k|        }
   62|  2.72k|        in_buf_len -= bytesInChunk;
   63|  2.72k|        in_buf_ptr += bytesInChunk;
   64|       |
   65|       |        // Without code length optimization there is constant characters number needed for specific chunk size.
   66|  2.72k|        const uint8_t base38CharactersNeeded = kBase38CharactersNeededInNBytesChunk[bytesInChunk - 1];
   67|       |
   68|  2.72k|        if ((out_idx + base38CharactersNeeded) >= out_buf.size())
  ------------------
  |  Branch (68:13): [True: 0, False: 2.72k]
  ------------------
   69|      0|        {
   70|      0|            err = CHIP_ERROR_BUFFER_TOO_SMALL;
  ------------------
  |  |  709|      0|#define CHIP_ERROR_BUFFER_TOO_SMALL                            CHIP_CORE_ERROR(0x19)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   71|      0|            break;
   72|      0|        }
   73|       |
   74|  16.2k|        for (uint8_t character = 0; character < base38CharactersNeeded; character++)
  ------------------
  |  Branch (74:37): [True: 13.4k, False: 2.72k]
  ------------------
   75|  13.4k|        {
   76|  13.4k|            out_buf.data()[out_idx++] = kCodes[value % kRadix];
   77|  13.4k|            value /= kRadix;
   78|  13.4k|        }
   79|  2.72k|    }
   80|       |
   81|     92|    if (out_idx < out_buf.size())
  ------------------
  |  Branch (81:9): [True: 92, False: 0]
  ------------------
   82|     92|    {
   83|     92|        out_buf.data()[out_idx] = '\0';
   84|       |        // Reduce output span size to be the size of written data and to not include null-terminator.
   85|     92|        out_buf.reduce_size(out_idx);
   86|     92|    }
   87|      0|    else
   88|      0|    {
   89|       |        // out_buf size is zero.
   90|      0|        err = CHIP_ERROR_BUFFER_TOO_SMALL;
  ------------------
  |  |  709|      0|#define CHIP_ERROR_BUFFER_TOO_SMALL                            CHIP_CORE_ERROR(0x19)
  |  |  ------------------
  |  |  |  |  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__))
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   91|      0|    }
   92|       |
   93|     92|    return err;
   94|     92|}
_ZN4chip19base38EncodedLengthEm:
   97|    103|{
   98|       |    // Each group of 3 bytes converts to 5 chars, and each remaining byte converts to 2 chars.
   99|       |    // Add one for the null terminator.
  100|    103|    return (num_bytes / 3) * 5 + (num_bytes % 3) * 2 + 1;
  101|    103|}

LLVMFuzzerTestOneInput:
   22|    103|{
   23|    103|    size_t outputSizeNeeded     = base38EncodedLength(len);
   24|    103|    const size_t kMaxOutputSize = 512;
   25|       |
   26|    103|    if (outputSizeNeeded > kMaxOutputSize)
  ------------------
  |  Branch (26:9): [True: 11, False: 92]
  ------------------
   27|     11|    {
   28|     11|        return 0;
   29|     11|    }
   30|       |
   31|     92|    ByteSpan span(data, len);
   32|     92|    char encodedBuf[kMaxOutputSize];
   33|     92|    MutableCharSpan encodedSpan(encodedBuf);
   34|     92|    CHIP_ERROR encodingError = base38Encode(span, encodedSpan);
   35|       |
   36|     92|    if (encodingError != CHIP_NO_ERROR)
  ------------------
  |  |  482|     92|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (36:9): [True: 0, False: 92]
  ------------------
   37|      0|    {
   38|      0|        __builtin_trap();
   39|      0|    }
   40|       |
   41|     92|    std::string base38EncodedString(encodedSpan.data(), encodedSpan.size());
   42|       |
   43|     92|    std::vector<uint8_t> decodedData;
   44|     92|    CHIP_ERROR decodingError = base38Decode(base38EncodedString, decodedData);
   45|       |
   46|     92|    if (decodingError == CHIP_NO_ERROR)
  ------------------
  |  |  482|     92|#define CHIP_NO_ERROR                                          CHIP_ERROR(0, __FILE__, __LINE__)
  ------------------
  |  Branch (46:9): [True: 92, False: 0]
  ------------------
   47|     92|    {
   48|     92|        if (decodedData.size() != len)
  ------------------
  |  Branch (48:13): [True: 0, False: 92]
  ------------------
   49|      0|        {
   50|      0|            __builtin_trap();
   51|      0|        }
   52|       |
   53|     92|        if (memcmp(data, decodedData.data(), len) != 0)
  ------------------
  |  Branch (53:13): [True: 0, False: 92]
  ------------------
   54|      0|        {
   55|      0|            __builtin_trap();
   56|      0|        }
   57|     92|    }
   58|      0|    else
   59|      0|    {
   60|      0|        __builtin_trap();
   61|      0|    }
   62|     92|    return 0;
   63|     92|}

