pb_field_iter_begin:
  157|   609k|{
  158|   609k|    memset(iter, 0, sizeof(*iter));
  159|       |
  160|   609k|    iter->descriptor = desc;
  161|   609k|    iter->message = message;
  162|       |
  163|   609k|    return load_descriptor_values(iter);
  164|   609k|}
pb_field_iter_begin_extension:
  167|   140k|{
  168|   140k|    const pb_msgdesc_t *msg = (const pb_msgdesc_t*)extension->type->arg;
  169|   140k|    bool status;
  170|       |
  171|   140k|    uint32_t word0 = PB_PROGMEM_READU32(msg->field_info[0]);
  ------------------
  |  |  191|   140k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
  172|   140k|    if (PB_ATYPE(word0 >> 8) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|   140k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   140k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(word0 >> 8) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|   140k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (172:9): [True: 0, False: 140k]
  ------------------
  173|      0|    {
  174|       |        /* For pointer extensions, the pointer is stored directly
  175|       |         * in the extension structure. This avoids having an extra
  176|       |         * indirection. */
  177|      0|        status = pb_field_iter_begin(iter, msg, &extension->dest);
  178|      0|    }
  179|   140k|    else
  180|   140k|    {
  181|   140k|        status = pb_field_iter_begin(iter, msg, extension->dest);
  182|   140k|    }
  183|       |
  184|   140k|    iter->pSize = &extension->found;
  185|   140k|    return status;
  186|   140k|}
pb_field_iter_next:
  189|  1.78M|{
  190|  1.78M|    advance_iterator(iter);
  191|  1.78M|    (void)load_descriptor_values(iter);
  192|  1.78M|    return iter->index != 0;
  193|  1.78M|}
pb_field_iter_find:
  196|  7.11M|{
  197|  7.11M|    if (iter->tag == tag)
  ------------------
  |  Branch (197:9): [True: 4.22M, False: 2.88M]
  ------------------
  198|  4.22M|    {
  199|  4.22M|        return true; /* Nothing to do, correct field already. */
  200|  4.22M|    }
  201|  2.88M|    else if (tag > iter->descriptor->largest_tag)
  ------------------
  |  Branch (201:14): [True: 890k, False: 1.99M]
  ------------------
  202|   890k|    {
  203|   890k|        return false;
  204|   890k|    }
  205|  1.99M|    else
  206|  1.99M|    {
  207|  1.99M|        pb_size_t start = iter->index;
  208|  1.99M|        uint32_t fieldinfo;
  209|       |
  210|  1.99M|        if (tag < iter->tag)
  ------------------
  |  Branch (210:13): [True: 564k, False: 1.43M]
  ------------------
  211|   564k|        {
  212|       |            /* Fields are in tag number order, so we know that tag is between
  213|       |             * 0 and our start position. Setting index to end forces
  214|       |             * advance_iterator() call below to restart from beginning. */
  215|   564k|            iter->index = iter->descriptor->field_count;
  216|   564k|        }
  217|       |
  218|  1.99M|        do
  219|  27.6M|        {
  220|       |            /* Advance iterator but don't load values yet */
  221|  27.6M|            advance_iterator(iter);
  222|       |
  223|       |            /* Do fast check for tag number match */
  224|  27.6M|            fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
  ------------------
  |  |  191|  27.6M|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
  225|       |
  226|  27.6M|            if (((fieldinfo >> 2) & 0x3F) == (tag & 0x3F))
  ------------------
  |  Branch (226:17): [True: 2.07M, False: 25.6M]
  ------------------
  227|  2.07M|            {
  228|       |                /* Good candidate, check further */
  229|  2.07M|                (void)load_descriptor_values(iter);
  230|       |
  231|  2.07M|                if (iter->tag == tag &&
  ------------------
  |  Branch (231:21): [True: 1.90M, False: 171k]
  ------------------
  232|  1.90M|                    PB_LTYPE(iter->type) != PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|  1.90M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  1.90M|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                                  PB_LTYPE(iter->type) != PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|  1.90M|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (232:21): [True: 1.88M, False: 21.4k]
  ------------------
  233|  1.88M|                {
  234|       |                    /* Found it */
  235|  1.88M|                    return true;
  236|  1.88M|                }
  237|  2.07M|            }
  238|  27.6M|        } while (iter->index != start);
  ------------------
  |  Branch (238:18): [True: 25.6M, False: 116k]
  ------------------
  239|       |
  240|       |        /* Searched all the way back to start, and found nothing. */
  241|   116k|        (void)load_descriptor_values(iter);
  242|       |        return false;
  243|  1.99M|    }
  244|  7.11M|}
pb_field_iter_find_extension:
  247|  27.2k|{
  248|  27.2k|    if (PB_LTYPE(iter->type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|  27.2k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  27.2k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(iter->type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|  27.2k|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (248:9): [True: 0, False: 27.2k]
  ------------------
  249|      0|    {
  250|      0|        return true;
  251|      0|    }
  252|  27.2k|    else
  253|  27.2k|    {
  254|  27.2k|        pb_size_t start = iter->index;
  255|  27.2k|        uint32_t fieldinfo;
  256|       |
  257|  27.2k|        do
  258|   167k|        {
  259|       |            /* Advance iterator but don't load values yet */
  260|   167k|            advance_iterator(iter);
  261|       |
  262|       |            /* Do fast check for field type */
  263|   167k|            fieldinfo = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
  ------------------
  |  |  191|   167k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
  264|       |
  265|   167k|            if (PB_LTYPE((fieldinfo >> 8) & 0xFF) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|   167k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   167k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                          if (PB_LTYPE((fieldinfo >> 8) & 0xFF) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|   167k|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (265:17): [True: 3.64k, False: 163k]
  ------------------
  266|  3.64k|            {
  267|  3.64k|                return load_descriptor_values(iter);
  268|  3.64k|            }
  269|   167k|        } while (iter->index != start);
  ------------------
  |  Branch (269:18): [True: 139k, False: 23.6k]
  ------------------
  270|       |
  271|       |        /* Searched all the way back to start, and found nothing. */
  272|  23.6k|        (void)load_descriptor_values(iter);
  273|       |        return false;
  274|  27.2k|    }
  275|  27.2k|}
pb_field_iter_begin_const:
  291|  88.9k|{
  292|  88.9k|    return pb_field_iter_begin(iter, desc, pb_const_cast(message));
  293|  88.9k|}
pb_field_iter_begin_extension_const:
  296|  2.57k|{
  297|  2.57k|    return pb_field_iter_begin_extension(iter, (pb_extension_t*)pb_const_cast(extension));
  298|  2.57k|}
pb_default_field_callback:
  301|  79.1k|{
  302|  79.1k|    if (field->data_size == sizeof(pb_callback_t))
  ------------------
  |  Branch (302:9): [True: 79.1k, False: 0]
  ------------------
  303|  79.1k|    {
  304|  79.1k|        pb_callback_t *pCallback = (pb_callback_t*)field->pData;
  305|       |
  306|  79.1k|        if (pCallback != NULL)
  ------------------
  |  Branch (306:13): [True: 79.1k, False: 0]
  ------------------
  307|  79.1k|        {
  308|  79.1k|            if (istream != NULL && pCallback->funcs.decode != NULL)
  ------------------
  |  Branch (308:17): [True: 79.0k, False: 133]
  |  Branch (308:36): [True: 6.72k, False: 72.2k]
  ------------------
  309|  6.72k|            {
  310|  6.72k|                return pCallback->funcs.decode(istream, field, &pCallback->arg);
  311|  6.72k|            }
  312|       |
  313|  72.4k|            if (ostream != NULL && pCallback->funcs.encode != NULL)
  ------------------
  |  Branch (313:17): [True: 133, False: 72.2k]
  |  Branch (313:36): [True: 0, False: 133]
  ------------------
  314|      0|            {
  315|      0|                return pCallback->funcs.encode(ostream, field, &pCallback->arg);
  316|      0|            }
  317|  72.4k|        }
  318|  79.1k|    }
  319|       |
  320|  72.4k|    return true; /* Success, but didn't do anything */
  321|       |
  322|  79.1k|}
pb_common.c:load_descriptor_values:
    9|  4.61M|{
   10|  4.61M|    uint32_t word0;
   11|  4.61M|    uint32_t data_offset;
   12|  4.61M|    int_least8_t size_offset;
   13|       |
   14|  4.61M|    if (iter->index >= iter->descriptor->field_count)
  ------------------
  |  Branch (14:9): [True: 173k, False: 4.44M]
  ------------------
   15|   173k|        return false;
   16|       |
   17|  4.44M|    word0 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
  ------------------
  |  |  191|  4.44M|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   18|  4.44M|    iter->type = (pb_type_t)((word0 >> 8) & 0xFF);
   19|       |
   20|  4.44M|    switch(word0 & 3)
   21|  4.44M|    {
   22|   479k|        case 0: {
  ------------------
  |  Branch (22:9): [True: 479k, False: 3.96M]
  ------------------
   23|       |            /* 1-word format */
   24|   479k|            iter->array_size = 1;
   25|   479k|            iter->tag = (pb_size_t)((word0 >> 2) & 0x3F);
   26|   479k|            size_offset = (int_least8_t)((word0 >> 24) & 0x0F);
   27|   479k|            data_offset = (word0 >> 16) & 0xFF;
   28|   479k|            iter->data_size = (pb_size_t)((word0 >> 28) & 0x0F);
   29|   479k|            break;
   30|      0|        }
   31|       |
   32|  3.47M|        case 1: {
  ------------------
  |  Branch (32:9): [True: 3.47M, False: 971k]
  ------------------
   33|       |            /* 2-word format */
   34|  3.47M|            uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
  ------------------
  |  |  191|  3.47M|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   35|       |
   36|  3.47M|            iter->array_size = (pb_size_t)((word0 >> 16) & 0x0FFF);
   37|  3.47M|            iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 28) << 6));
   38|  3.47M|            size_offset = (int_least8_t)((word0 >> 28) & 0x0F);
   39|  3.47M|            data_offset = word1 & 0xFFFF;
   40|  3.47M|            iter->data_size = (pb_size_t)((word1 >> 16) & 0x0FFF);
   41|  3.47M|            break;
   42|      0|        }
   43|       |
   44|   425k|        case 2: {
  ------------------
  |  Branch (44:9): [True: 425k, False: 4.01M]
  ------------------
   45|       |            /* 4-word format */
   46|   425k|            uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
  ------------------
  |  |  191|   425k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   47|   425k|            uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
  ------------------
  |  |  191|   425k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   48|   425k|            uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
  ------------------
  |  |  191|   425k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   49|       |
   50|   425k|            iter->array_size = (pb_size_t)(word0 >> 16);
   51|   425k|            iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
   52|   425k|            size_offset = (int_least8_t)(word1 & 0xFF);
   53|   425k|            data_offset = word2;
   54|   425k|            iter->data_size = (pb_size_t)word3;
   55|   425k|            break;
   56|      0|        }
   57|       |
   58|  66.1k|        default: {
  ------------------
  |  Branch (58:9): [True: 66.1k, False: 4.37M]
  ------------------
   59|       |            /* 8-word format */
   60|  66.1k|            uint32_t word1 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 1]);
  ------------------
  |  |  191|  66.1k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   61|  66.1k|            uint32_t word2 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 2]);
  ------------------
  |  |  191|  66.1k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   62|  66.1k|            uint32_t word3 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 3]);
  ------------------
  |  |  191|  66.1k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   63|  66.1k|            uint32_t word4 = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index + 4]);
  ------------------
  |  |  191|  66.1k|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
   64|       |
   65|  66.1k|            iter->array_size = (pb_size_t)word4;
   66|  66.1k|            iter->tag = (pb_size_t)(((word0 >> 2) & 0x3F) | ((word1 >> 8) << 6));
   67|  66.1k|            size_offset = (int_least8_t)(word1 & 0xFF);
   68|  66.1k|            data_offset = word2;
   69|  66.1k|            iter->data_size = (pb_size_t)word3;
   70|  66.1k|            break;
   71|      0|        }
   72|  4.44M|    }
   73|       |
   74|  4.44M|    if (!iter->message)
  ------------------
  |  Branch (74:9): [True: 0, False: 4.44M]
  ------------------
   75|      0|    {
   76|       |        /* Avoid doing arithmetic on null pointers, it is undefined */
   77|      0|        iter->pField = NULL;
   78|      0|        iter->pSize = NULL;
   79|      0|    }
   80|  4.44M|    else
   81|  4.44M|    {
   82|  4.44M|        iter->pField = (char*)iter->message + data_offset;
   83|       |
   84|  4.44M|        if (size_offset)
  ------------------
  |  Branch (84:13): [True: 1.38M, False: 3.05M]
  ------------------
   85|  1.38M|        {
   86|  1.38M|            iter->pSize = (char*)iter->pField - size_offset;
   87|  1.38M|        }
   88|  3.05M|        else if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  334|  3.05M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  3.05M|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      else if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  321|  6.11M|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (88:18): [True: 91.7k, False: 2.96M]
  ------------------
   89|  91.7k|                 (PB_ATYPE(iter->type) == PB_ATYPE_STATIC ||
  ------------------
  |  |  333|  91.7k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  91.7k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                               (PB_ATYPE(iter->type) == PB_ATYPE_STATIC ||
  ------------------
  |  |  328|   183k|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (89:19): [True: 43.1k, False: 48.5k]
  ------------------
   90|  48.5k|                  PB_ATYPE(iter->type) == PB_ATYPE_POINTER))
  ------------------
  |  |  333|  48.5k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  48.5k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                                PB_ATYPE(iter->type) == PB_ATYPE_POINTER))
  ------------------
  |  |  329|  48.5k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (90:19): [True: 0, False: 48.5k]
  ------------------
   91|  43.1k|        {
   92|       |            /* Fixed count array */
   93|  43.1k|            iter->pSize = &iter->array_size;
   94|  43.1k|        }
   95|  3.01M|        else
   96|  3.01M|        {
   97|  3.01M|            iter->pSize = NULL;
   98|  3.01M|        }
   99|       |
  100|  4.44M|        if (PB_ATYPE(iter->type) == PB_ATYPE_POINTER && iter->pField != NULL)
  ------------------
  |  |  333|  4.44M|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  4.44M|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                      if (PB_ATYPE(iter->type) == PB_ATYPE_POINTER && iter->pField != NULL)
  ------------------
  |  |  329|  8.88M|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (100:13): [True: 0, False: 4.44M]
  |  Branch (100:57): [True: 0, False: 0]
  ------------------
  101|      0|        {
  102|      0|            iter->pData = *(void**)iter->pField;
  103|      0|        }
  104|  4.44M|        else
  105|  4.44M|        {
  106|  4.44M|            iter->pData = iter->pField;
  107|  4.44M|        }
  108|  4.44M|    }
  109|       |
  110|  4.44M|    if (PB_LTYPE_IS_SUBMSG(iter->type))
  ------------------
  |  |  336|  4.44M|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|  4.44M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  4.44M|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|  8.88M|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 650k, False: 3.79M]
  |  |  ------------------
  |  |  337|  4.44M|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|  3.79M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  3.79M|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|  3.79M|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 47.3k, False: 3.74M]
  |  |  ------------------
  ------------------
  111|   697k|    {
  112|   697k|        iter->submsg_desc = iter->descriptor->submsg_info[iter->submessage_index];
  113|   697k|    }
  114|  3.74M|    else
  115|  3.74M|    {
  116|  3.74M|        iter->submsg_desc = NULL;
  117|  3.74M|    }
  118|       |
  119|       |    return true;
  120|  4.44M|}
pb_common.c:advance_iterator:
  123|  29.6M|{
  124|  29.6M|    iter->index++;
  125|       |
  126|  29.6M|    if (iter->index >= iter->descriptor->field_count)
  ------------------
  |  Branch (126:9): [True: 880k, False: 28.7M]
  ------------------
  127|   880k|    {
  128|       |        /* Restart */
  129|   880k|        iter->index = 0;
  130|   880k|        iter->field_info_index = 0;
  131|   880k|        iter->submessage_index = 0;
  132|   880k|        iter->required_field_index = 0;
  133|   880k|    }
  134|  28.7M|    else
  135|  28.7M|    {
  136|       |        /* Increment indexes based on previous field type.
  137|       |         * All field info formats have the following fields:
  138|       |         * - lowest 2 bits tell the amount of words in the descriptor (2^n words)
  139|       |         * - bits 2..7 give the lowest bits of tag number.
  140|       |         * - bits 8..15 give the field type.
  141|       |         */
  142|  28.7M|        uint32_t prev_descriptor = PB_PROGMEM_READU32(iter->descriptor->field_info[iter->field_info_index]);
  ------------------
  |  |  191|  28.7M|#define PB_PROGMEM_READU32(x)  (x)
  ------------------
  143|  28.7M|        pb_type_t prev_type = (prev_descriptor >> 8) & 0xFF;
  144|  28.7M|        pb_size_t descriptor_len = (pb_size_t)(1 << (prev_descriptor & 3));
  145|       |
  146|       |        /* Add to fields.
  147|       |         * The cast to pb_size_t is needed to avoid -Wconversion warning.
  148|       |         * Because the data is is constants from generator, there is no danger of overflow.
  149|       |         */
  150|  28.7M|        iter->field_info_index = (pb_size_t)(iter->field_info_index + descriptor_len);
  151|  28.7M|        iter->required_field_index = (pb_size_t)(iter->required_field_index + (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED));
  ------------------
  |  |  334|  28.7M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  28.7M|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      iter->required_field_index = (pb_size_t)(iter->required_field_index + (PB_HTYPE(prev_type) == PB_HTYPE_REQUIRED));
  ------------------
  |  |  318|  28.7M|#define PB_HTYPE_REQUIRED 0x00U
  ------------------
  152|  28.7M|        iter->submessage_index = (pb_size_t)(iter->submessage_index + PB_LTYPE_IS_SUBMSG(prev_type));
  ------------------
  |  |  336|  28.7M|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|  28.7M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  28.7M|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|  57.5M|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 3.62M, False: 25.1M]
  |  |  ------------------
  |  |  337|  28.7M|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|  25.1M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  25.1M|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|  25.1M|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 143k, False: 25.0M]
  |  |  ------------------
  ------------------
  153|  28.7M|    }
  154|  29.6M|}
pb_common.c:pb_const_cast:
  278|  91.5k|{
  279|       |    /* Note: this casts away const, in order to use the common field iterator
  280|       |     * logic for both encoding and decoding. The cast is done using union
  281|       |     * to avoid spurious compiler warnings. */
  282|  91.5k|    union {
  283|  91.5k|        void *p1;
  284|  91.5k|        const void *p2;
  285|  91.5k|    } t;
  286|  91.5k|    t.p2 = p;
  287|  91.5k|    return t.p1;
  288|  91.5k|}

pb_read:
   83|  2.63M|{
   84|  2.63M|    if (count == 0)
  ------------------
  |  Branch (84:9): [True: 186k, False: 2.44M]
  ------------------
   85|   186k|        return true;
   86|       |
   87|  2.44M|#ifndef PB_BUFFER_ONLY
   88|  2.44M|	if (buf == NULL && stream->callback != buf_read)
  ------------------
  |  Branch (88:6): [True: 306k, False: 2.13M]
  |  Branch (88:21): [True: 68.6k, False: 238k]
  ------------------
   89|  68.6k|	{
   90|       |		/* Skip input bytes */
   91|  68.6k|		pb_byte_t tmp[16];
   92|   567k|		while (count > 16)
  ------------------
  |  Branch (92:10): [True: 499k, False: 68.6k]
  ------------------
   93|   499k|		{
   94|   499k|			if (!pb_read(stream, tmp, 16))
  ------------------
  |  Branch (94:8): [True: 0, False: 499k]
  ------------------
   95|      0|				return false;
   96|       |			
   97|   499k|			count -= 16;
   98|   499k|		}
   99|       |		
  100|  68.6k|		return pb_read(stream, tmp, count);
  101|  68.6k|	}
  102|  2.37M|#endif
  103|       |
  104|  2.37M|    if (stream->bytes_left < count)
  ------------------
  |  Branch (104:9): [True: 251, False: 2.37M]
  ------------------
  105|    251|        PB_RETURN_ERROR(stream, "end-of-stream");
  ------------------
  |  |  937|    251|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|    251|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 251]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  106|       |    
  107|  2.37M|#ifndef PB_BUFFER_ONLY
  108|  2.37M|    if (!stream->callback(stream, buf, count))
  ------------------
  |  Branch (108:9): [True: 0, False: 2.37M]
  ------------------
  109|      0|        PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  110|       |#else
  111|       |    if (!buf_read(stream, buf, count))
  112|       |        return false;
  113|       |#endif
  114|       |    
  115|  2.37M|    if (stream->bytes_left < count)
  ------------------
  |  Branch (115:9): [True: 0, False: 2.37M]
  ------------------
  116|      0|        stream->bytes_left = 0;
  117|  2.37M|    else
  118|  2.37M|        stream->bytes_left -= count;
  119|       |
  120|       |    return true;
  121|  2.37M|}
pb_istream_from_buffer:
  144|   125k|{
  145|   125k|    pb_istream_t stream;
  146|       |    /* Cast away the const from buf without a compiler error.  We are
  147|       |     * careful to use it only in a const manner in the callbacks.
  148|       |     */
  149|   125k|    union {
  150|   125k|        void *state;
  151|   125k|        const void *c_state;
  152|   125k|    } state;
  153|       |#ifdef PB_BUFFER_ONLY
  154|       |    stream.callback = NULL;
  155|       |#else
  156|   125k|    stream.callback = &buf_read;
  157|   125k|#endif
  158|   125k|    state.c_state = buf;
  159|   125k|    stream.state = state.state;
  160|   125k|    stream.bytes_left = msglen;
  161|   125k|#ifndef PB_NO_ERRMSG
  162|   125k|    stream.errmsg = NULL;
  163|   125k|#endif
  164|       |#ifdef PB_MESSAGE_NESTING_MAX
  165|       |    stream.depth = 0;
  166|       |#endif
  167|   125k|    return stream;
  168|   125k|}
pb_decode_varint32:
  250|  1.11M|{
  251|       |    return pb_decode_varint32_eof(stream, dest, NULL);
  252|  1.11M|}
pb_decode_varint:
  256|  5.11M|{
  257|  5.11M|    pb_byte_t byte;
  258|  5.11M|    uint_fast8_t bitpos = 0;
  259|  5.11M|    uint64_t result = 0;
  260|       |    
  261|  5.11M|    do
  262|  6.27M|    {
  263|  6.27M|        if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (263:13): [True: 64, False: 6.27M]
  ------------------
  264|     64|            return false;
  265|       |
  266|  6.27M|        if (bitpos >= 63 && (byte & 0xFE) != 0)
  ------------------
  |  Branch (266:13): [True: 49.9k, False: 6.22M]
  |  Branch (266:29): [True: 25, False: 49.8k]
  ------------------
  267|     25|            PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  937|     25|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     25|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 25]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  268|       |
  269|  6.27M|        result |= (uint64_t)(byte & 0x7F) << bitpos;
  270|  6.27M|        bitpos = (uint_fast8_t)(bitpos + 7);
  271|  6.27M|    } while (byte & 0x80);
  ------------------
  |  Branch (271:14): [True: 1.16M, False: 5.11M]
  ------------------
  272|       |    
  273|  5.11M|    *dest = result;
  274|       |    return true;
  275|  5.11M|}
pb_decode_tag:
  304|  7.97M|{
  305|  7.97M|    uint32_t temp;
  306|  7.97M|    *eof = false;
  307|  7.97M|    *wire_type = (pb_wire_type_t) 0;
  308|  7.97M|    *tag = 0;
  309|       |
  310|  7.97M|    if (stream->bytes_left == 0)
  ------------------
  |  Branch (310:9): [True: 281k, False: 7.69M]
  ------------------
  311|   281k|    {
  312|   281k|        *eof = true;
  313|   281k|        return false;
  314|   281k|    }
  315|       |
  316|  7.69M|    if (!pb_decode_varint32_eof(stream, &temp, eof))
  ------------------
  |  Branch (316:9): [True: 1.40k, False: 7.69M]
  ------------------
  317|  1.40k|    {
  318|  1.40k|        return false;
  319|  1.40k|    }
  320|       |    
  321|  7.69M|    *tag = temp >> 3;
  322|  7.69M|    *wire_type = (pb_wire_type_t)(temp & 7);
  323|       |    return true;
  324|  7.69M|}
pb_skip_field:
  327|  1.00M|{
  328|  1.00M|    switch (wire_type)
  329|  1.00M|    {
  330|   644k|        case PB_WT_VARINT: return pb_skip_varint(stream);
  ------------------
  |  Branch (330:9): [True: 644k, False: 357k]
  ------------------
  331|  74.5k|        case PB_WT_64BIT: return pb_read(stream, NULL, 8);
  ------------------
  |  Branch (331:9): [True: 74.5k, False: 927k]
  ------------------
  332|   162k|        case PB_WT_STRING: return pb_skip_string(stream);
  ------------------
  |  Branch (332:9): [True: 162k, False: 839k]
  ------------------
  333|   120k|        case PB_WT_32BIT: return pb_read(stream, NULL, 4);
  ------------------
  |  Branch (333:9): [True: 120k, False: 881k]
  ------------------
  334|      0|	case PB_WT_PACKED: 
  ------------------
  |  Branch (334:2): [True: 0, False: 1.00M]
  ------------------
  335|       |            /* Calling pb_skip_field with a PB_WT_PACKED is an error.
  336|       |             * Explicitly handle this case and fallthrough to default to avoid
  337|       |             * compiler warnings.
  338|       |             */
  339|     83|        default: PB_RETURN_ERROR(stream, "invalid wire_type");
  ------------------
  |  |  937|     83|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     83|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 83]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (339:9): [True: 83, False: 1.00M]
  ------------------
  340|  1.00M|    }
  341|  1.00M|}
pb_make_string_substream:
  392|   379k|{
  393|   379k|    uint32_t size;
  394|   379k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (394:9): [True: 80, False: 379k]
  ------------------
  395|     80|        return false;
  396|       |    
  397|   379k|    *substream = *stream;
  398|   379k|    if (substream->bytes_left < size)
  ------------------
  |  Branch (398:9): [True: 127, False: 379k]
  ------------------
  399|    127|        PB_RETURN_ERROR(stream, "parent stream too short");
  ------------------
  |  |  937|    127|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|    127|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 127]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  400|       |    
  401|       |#ifdef PB_MESSAGE_NESTING_MAX
  402|       |    substream->depth++;
  403|       |    if (substream->depth > PB_MESSAGE_NESTING_MAX)
  404|       |        PB_RETURN_ERROR(stream, "max depth");
  405|       |#endif
  406|       |
  407|   379k|    substream->bytes_left = (size_t)size;
  408|   379k|    stream->bytes_left -= (size_t)size;
  409|       |    return true;
  410|   379k|}
pb_close_string_substream:
  413|   379k|{
  414|   379k|    if (substream->bytes_left) {
  ------------------
  |  Branch (414:9): [True: 23.7k, False: 355k]
  ------------------
  415|  23.7k|        if (!pb_read(substream, NULL, substream->bytes_left))
  ------------------
  |  Branch (415:13): [True: 0, False: 23.7k]
  ------------------
  416|      0|            return false;
  417|  23.7k|    }
  418|       |
  419|   379k|    stream->state = substream->state;
  420|       |
  421|   379k|#ifndef PB_NO_ERRMSG
  422|   379k|    stream->errmsg = substream->errmsg;
  423|   379k|#endif
  424|       |    return true;
  425|   379k|}
pb_decode_ex:
 1304|  8.32k|{
 1305|  8.32k|    bool status;
 1306|       |
 1307|  8.32k|    if ((flags & PB_DECODE_DELIMITED) == 0)
  ------------------
  |  |  123|  8.32k|#define PB_DECODE_DELIMITED       0x02U
  ------------------
  |  Branch (1307:9): [True: 8.32k, False: 0]
  ------------------
 1308|  8.32k|    {
 1309|  8.32k|      status = pb_decode_inner(stream, fields, dest_struct, flags);
 1310|  8.32k|    }
 1311|      0|    else
 1312|      0|    {
 1313|      0|      pb_istream_t substream;
 1314|      0|      if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (1314:11): [True: 0, False: 0]
  ------------------
 1315|      0|        return false;
 1316|       |
 1317|      0|      status = pb_decode_inner(&substream, fields, dest_struct, flags);
 1318|       |
 1319|      0|      if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (1319:11): [True: 0, False: 0]
  ------------------
 1320|      0|        status = false;
 1321|      0|    }
 1322|       |    
 1323|       |#ifdef PB_ENABLE_MALLOC
 1324|       |    if (!status)
 1325|       |        pb_release(fields, dest_struct);
 1326|       |#endif
 1327|       |    
 1328|  8.32k|    return status;
 1329|  8.32k|}
pb_decode:
 1332|  3.86k|{
 1333|  3.86k|    return pb_decode_ex(stream, fields, dest_struct, 0);
 1334|  3.86k|}
pb_release:
 1483|  6.44k|{
 1484|       |    /* Nothing to release without PB_ENABLE_MALLOC. */
 1485|  6.44k|    PB_UNUSED(fields);
  ------------------
  |  |  179|  6.44k|#define PB_UNUSED(x) (void)(x)
  ------------------
 1486|  6.44k|    PB_UNUSED(dest_struct);
  ------------------
  |  |  179|  6.44k|#define PB_UNUSED(x) (void)(x)
  ------------------
 1487|  6.44k|}
pb_decode_bool:
 1493|   292k|{
 1494|   292k|    uint32_t value;
 1495|   292k|    if (!pb_decode_varint32(stream, &value))
  ------------------
  |  Branch (1495:9): [True: 14, False: 292k]
  ------------------
 1496|     14|        return false;
 1497|       |
 1498|   292k|    *(bool*)dest = (value != 0);
 1499|       |    return true;
 1500|   292k|}
pb_decode_svarint:
 1503|   167k|{
 1504|   167k|    pb_uint64_t value;
  ------------------
  |  |   58|   167k|#define pb_uint64_t uint64_t
  ------------------
 1505|   167k|    if (!pb_decode_varint(stream, &value))
  ------------------
  |  Branch (1505:9): [True: 25, False: 167k]
  ------------------
 1506|     25|        return false;
 1507|       |    
 1508|   167k|    if (value & 1)
  ------------------
  |  Branch (1508:9): [True: 29.1k, False: 138k]
  ------------------
 1509|  29.1k|        *dest = (pb_int64_t)(~(value >> 1));
 1510|   138k|    else
 1511|   138k|        *dest = (pb_int64_t)(value >> 1);
 1512|       |    
 1513|       |    return true;
 1514|   167k|}
pb_decode_fixed32:
 1517|   296k|{
 1518|   296k|    union {
 1519|   296k|        uint32_t fixed32;
 1520|   296k|        pb_byte_t bytes[4];
 1521|   296k|    } u;
 1522|       |
 1523|   296k|    if (!pb_read(stream, u.bytes, 4))
  ------------------
  |  Branch (1523:9): [True: 13, False: 296k]
  ------------------
 1524|     13|        return false;
 1525|       |
 1526|   296k|#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
 1527|       |    /* fast path - if we know that we're on little endian, assign directly */
 1528|   296k|    *(uint32_t*)dest = u.fixed32;
 1529|       |#else
 1530|       |    *(uint32_t*)dest = ((uint32_t)u.bytes[0] << 0) |
 1531|       |                       ((uint32_t)u.bytes[1] << 8) |
 1532|       |                       ((uint32_t)u.bytes[2] << 16) |
 1533|       |                       ((uint32_t)u.bytes[3] << 24);
 1534|       |#endif
 1535|       |    return true;
 1536|   296k|}
pb_decode_fixed64:
 1540|   240k|{
 1541|   240k|    union {
 1542|   240k|        uint64_t fixed64;
 1543|   240k|        pb_byte_t bytes[8];
 1544|   240k|    } u;
 1545|       |
 1546|   240k|    if (!pb_read(stream, u.bytes, 8))
  ------------------
  |  Branch (1546:9): [True: 16, False: 240k]
  ------------------
 1547|     16|        return false;
 1548|       |
 1549|   240k|#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
 1550|       |    /* fast path - if we know that we're on little endian, assign directly */
 1551|   240k|    *(uint64_t*)dest = u.fixed64;
 1552|       |#else
 1553|       |    *(uint64_t*)dest = ((uint64_t)u.bytes[0] << 0) |
 1554|       |                       ((uint64_t)u.bytes[1] << 8) |
 1555|       |                       ((uint64_t)u.bytes[2] << 16) |
 1556|       |                       ((uint64_t)u.bytes[3] << 24) |
 1557|       |                       ((uint64_t)u.bytes[4] << 32) |
 1558|       |                       ((uint64_t)u.bytes[5] << 40) |
 1559|       |                       ((uint64_t)u.bytes[6] << 48) |
 1560|       |                       ((uint64_t)u.bytes[7] << 56);
 1561|       |#endif
 1562|       |    return true;
 1563|   240k|}
pb_decode.c:buf_read:
   70|  14.5M|{
   71|  14.5M|    const pb_byte_t *source = (const pb_byte_t*)stream->state;
   72|  14.5M|    stream->state = (pb_byte_t*)stream->state + count;
   73|       |    
   74|  14.5M|    if (buf != NULL)
  ------------------
  |  Branch (74:9): [True: 14.3M, False: 238k]
  ------------------
   75|  14.3M|    {
   76|  14.3M|        memcpy(buf, source, count * sizeof(pb_byte_t));
   77|  14.3M|    }
   78|       |    
   79|       |    return true;
   80|  14.5M|}
pb_decode.c:pb_decode_varint32_eof:
  178|  8.81M|{
  179|  8.81M|    pb_byte_t byte;
  180|  8.81M|    uint32_t result;
  181|       |
  182|       |#ifdef PB_BUFFER_ONLY
  183|       |    (void)eof;
  184|       |#endif
  185|       |    
  186|  8.81M|    if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (186:9): [True: 1.44k, False: 8.81M]
  ------------------
  187|  1.44k|    {
  188|  1.44k|#ifndef PB_BUFFER_ONLY
  189|  1.44k|        if (eof != NULL && stream->callback != buf_read && stream->bytes_left == 0)
  ------------------
  |  Branch (189:13): [True: 1.28k, False: 155]
  |  Branch (189:28): [True: 1.28k, False: 0]
  |  Branch (189:60): [True: 1.28k, False: 0]
  ------------------
  190|  1.28k|        {
  191|  1.28k|#ifndef PB_NO_ERRMSG
  192|  1.28k|            if (strcmp(stream->errmsg, "io error") == 0)
  ------------------
  |  Branch (192:17): [True: 1.28k, False: 0]
  ------------------
  193|  1.28k|                stream->errmsg = NULL;
  194|  1.28k|#endif
  195|  1.28k|            *eof = true;
  196|  1.28k|        }
  197|  1.44k|#endif
  198|  1.44k|        return false;
  199|  1.44k|    }
  200|       |    
  201|  8.81M|    if ((byte & 0x80) == 0)
  ------------------
  |  Branch (201:9): [True: 7.56M, False: 1.24M]
  ------------------
  202|  7.56M|    {
  203|       |        /* Quick case, 1 byte value */
  204|  7.56M|        result = byte;
  205|  7.56M|    }
  206|  1.24M|    else
  207|  1.24M|    {
  208|       |        /* Multibyte case */
  209|  1.24M|        uint_fast8_t bitpos = 7;
  210|  1.24M|        result = byte & 0x7F;
  211|       |        
  212|  1.24M|        do
  213|  1.56M|        {
  214|  1.56M|            if (!pb_readbyte(stream, &byte))
  ------------------
  |  Branch (214:17): [True: 43, False: 1.56M]
  ------------------
  215|     43|                return false;
  216|       |            
  217|  1.56M|            if (bitpos >= 32)
  ------------------
  |  Branch (217:17): [True: 18.2k, False: 1.54M]
  ------------------
  218|  18.2k|            {
  219|       |                /* Note: The varint could have trailing 0x80 bytes, or 0xFF for negative. */
  220|  18.2k|                pb_byte_t sign_extension = (bitpos < 63) ? 0xFF : 0x01;
  ------------------
  |  Branch (220:44): [True: 17.7k, False: 497]
  ------------------
  221|  18.2k|                bool valid_extension = ((byte & 0x7F) == 0x00 ||
  ------------------
  |  Branch (221:41): [True: 4.80k, False: 13.3k]
  ------------------
  222|  13.3k|                         ((result >> 31) != 0 && byte == sign_extension));
  ------------------
  |  Branch (222:27): [True: 13.3k, False: 12]
  |  Branch (222:50): [True: 13.3k, False: 54]
  ------------------
  223|       |
  224|  18.2k|                if (bitpos >= 64 || !valid_extension)
  ------------------
  |  Branch (224:21): [True: 3, False: 18.2k]
  |  Branch (224:37): [True: 65, False: 18.1k]
  ------------------
  225|     68|                {
  226|     68|                    PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  937|     68|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     68|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 68]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  227|     68|                }
  228|  18.2k|            }
  229|  1.54M|            else if (bitpos == 28)
  ------------------
  |  Branch (229:22): [True: 11.7k, False: 1.53M]
  ------------------
  230|  11.7k|            {
  231|  11.7k|                if ((byte & 0x70) != 0 && (byte & 0x78) != 0x78)
  ------------------
  |  Branch (231:21): [True: 4.71k, False: 7.00k]
  |  Branch (231:43): [True: 18, False: 4.69k]
  ------------------
  232|     18|                {
  233|     18|                    PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  937|     18|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     18|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 18]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  234|     18|                }
  235|  11.6k|                result |= (uint32_t)(byte & 0x0F) << bitpos;
  236|  11.6k|            }
  237|  1.53M|            else
  238|  1.53M|            {
  239|  1.53M|                result |= (uint32_t)(byte & 0x7F) << bitpos;
  240|  1.53M|            }
  241|  1.56M|            bitpos = (uint_fast8_t)(bitpos + 7);
  242|  1.56M|        } while (byte & 0x80);
  ------------------
  |  Branch (242:18): [True: 317k, False: 1.24M]
  ------------------
  243|  1.24M|   }
  244|       |   
  245|  8.81M|   *dest = result;
  246|       |   return true;
  247|  8.81M|}
pb_decode.c:pb_readbyte:
  126|  16.6M|{
  127|  16.6M|    if (stream->bytes_left == 0)
  ------------------
  |  Branch (127:9): [True: 262, False: 16.6M]
  ------------------
  128|    262|        PB_RETURN_ERROR(stream, "end-of-stream");
  ------------------
  |  |  937|    262|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|    262|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 262]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  129|       |
  130|  16.6M|#ifndef PB_BUFFER_ONLY
  131|  16.6M|    if (!stream->callback(stream, buf, 1))
  ------------------
  |  Branch (131:9): [True: 1.28k, False: 16.6M]
  ------------------
  132|  1.28k|        PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  937|  1.28k|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|  1.28k|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 1.28k]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  133|       |#else
  134|       |    *buf = *(const pb_byte_t*)stream->state;
  135|       |    stream->state = (pb_byte_t*)stream->state + 1;
  136|       |#endif
  137|       |
  138|  16.6M|    stream->bytes_left--;
  139|       |    
  140|       |    return true;    
  141|  16.6M|}
pb_decode.c:pb_skip_varint:
  279|   644k|{
  280|   644k|    pb_byte_t byte;
  281|   644k|    do
  282|   840k|    {
  283|   840k|        if (!pb_read(stream, &byte, 1))
  ------------------
  |  Branch (283:13): [True: 62, False: 840k]
  ------------------
  284|     62|            return false;
  285|   840k|    } while (byte & 0x80);
  ------------------
  |  Branch (285:14): [True: 196k, False: 644k]
  ------------------
  286|   644k|    return true;
  287|   644k|}
pb_decode.c:pb_skip_string:
  290|   162k|{
  291|   162k|    uint32_t length;
  292|   162k|    if (!pb_decode_varint32(stream, &length))
  ------------------
  |  Branch (292:9): [True: 67, False: 162k]
  ------------------
  293|     67|        return false;
  294|       |    
  295|   162k|    if ((size_t)length != length)
  ------------------
  |  Branch (295:9): [True: 0, False: 162k]
  ------------------
  296|      0|    {
  297|      0|        PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  298|      0|    }
  299|       |
  300|   162k|    return pb_read(stream, NULL, (size_t)length);
  301|   162k|}
pb_decode.c:pb_decode_inner:
 1133|   284k|{
 1134|       |    /* If the message contains extension fields, the extension handlers
 1135|       |     * are called when tag number is >= extension_range_start. This precheck
 1136|       |     * is just for speed, and the handlers will check for precise match.
 1137|       |     */
 1138|   284k|    uint32_t extension_range_start = 0;
 1139|   284k|    pb_extension_t *extensions = NULL;
 1140|       |
 1141|       |    /* 'fixed_count_field' and 'fixed_count_size' track position of a repeated fixed
 1142|       |     * count field. This can only handle _one_ repeated fixed count field that
 1143|       |     * is unpacked and unordered among other (non repeated fixed count) fields.
 1144|       |     */
 1145|   284k|    pb_size_t fixed_count_field = PB_SIZE_MAX;
  ------------------
  |  |  349|   284k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
 1146|   284k|    pb_size_t fixed_count_size = 0;
 1147|   284k|    pb_size_t fixed_count_total_size = 0;
 1148|       |
 1149|       |    /* Tag and wire type of next field from the input stream */
 1150|   284k|    uint32_t tag;
 1151|   284k|    pb_wire_type_t wire_type;
 1152|   284k|    bool eof;
 1153|       |
 1154|       |    /* Track presence of required fields */
 1155|   284k|    pb_fields_seen_t fields_seen = {{0, 0}};
 1156|   284k|    const uint32_t allbits = ~(uint32_t)0;
 1157|       |
 1158|       |    /* Descriptor for the structure field matching the tag decoded from stream */
 1159|   284k|    pb_field_iter_t iter;
 1160|       |
 1161|   284k|    if (pb_field_iter_begin(&iter, fields, dest_struct))
  ------------------
  |  Branch (1161:9): [True: 154k, False: 130k]
  ------------------
 1162|   154k|    {
 1163|   154k|        if ((flags & PB_DECODE_NOINIT) == 0)
  ------------------
  |  |  122|   154k|#define PB_DECODE_NOINIT          0x01U
  ------------------
  |  Branch (1163:13): [True: 8.32k, False: 145k]
  ------------------
 1164|  8.32k|        {
 1165|  8.32k|            if (!pb_message_set_to_defaults(&iter))
  ------------------
  |  Branch (1165:17): [True: 0, False: 8.32k]
  ------------------
 1166|      0|                PB_RETURN_ERROR(stream, "failed to set defaults");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1167|  8.32k|        }
 1168|   154k|    }
 1169|       |
 1170|  7.39M|    while (decode_next_tag(stream, flags, &wire_type, &tag, &eof))
  ------------------
  |  Branch (1170:12): [True: 7.11M, False: 283k]
  ------------------
 1171|  7.11M|    {
 1172|  7.11M|        if (tag == 0)
  ------------------
  |  Branch (1172:13): [True: 69, False: 7.11M]
  ------------------
 1173|     69|        {
 1174|     69|          if (flags & PB_DECODE_NULLTERMINATED)
  ------------------
  |  |  124|     69|#define PB_DECODE_NULLTERMINATED  0x04U
  ------------------
  |  Branch (1174:15): [True: 0, False: 69]
  ------------------
 1175|      0|          {
 1176|      0|            eof = true;
 1177|      0|            break;
 1178|      0|          }
 1179|     69|          else
 1180|     69|          {
 1181|     69|            PB_RETURN_ERROR(stream, "zero tag");
  ------------------
  |  |  937|     69|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     69|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 69]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1182|     69|          }
 1183|     69|        }
 1184|       |
 1185|  7.11M|        if (!pb_field_iter_find(&iter, tag) || PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|  6.10M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  6.10M|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (!pb_field_iter_find(&iter, tag) || PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|  6.10M|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (1185:13): [True: 1.00M, False: 6.10M]
  |  Branch (1185:48): [True: 441, False: 6.10M]
  ------------------
 1186|  1.00M|        {
 1187|       |            /* No match found, check if it matches an extension. */
 1188|  1.00M|            if (extension_range_start == 0)
  ------------------
  |  Branch (1188:17): [True: 27.2k, False: 980k]
  ------------------
 1189|  27.2k|            {
 1190|  27.2k|                if (pb_field_iter_find_extension(&iter))
  ------------------
  |  Branch (1190:21): [True: 3.64k, False: 23.6k]
  ------------------
 1191|  3.64k|                {
 1192|  3.64k|                    extensions = *(pb_extension_t* const *)iter.pData;
 1193|  3.64k|                    extension_range_start = iter.tag;
 1194|  3.64k|                }
 1195|       |
 1196|  27.2k|                if (!extensions)
  ------------------
  |  Branch (1196:21): [True: 24.5k, False: 2.69k]
  ------------------
 1197|  24.5k|                {
 1198|  24.5k|                    extension_range_start = (uint32_t)-1;
 1199|  24.5k|                }
 1200|  27.2k|            }
 1201|       |
 1202|  1.00M|            if (tag >= extension_range_start)
  ------------------
  |  Branch (1202:17): [True: 132k, False: 875k]
  ------------------
 1203|   132k|            {
 1204|   132k|                size_t pos = stream->bytes_left;
 1205|       |
 1206|   132k|                if (!decode_extension(stream, tag, wire_type, extensions))
  ------------------
  |  Branch (1206:21): [True: 39, False: 132k]
  ------------------
 1207|     39|                    return false;
 1208|       |
 1209|   132k|                if (pos != stream->bytes_left)
  ------------------
  |  Branch (1209:21): [True: 5.59k, False: 126k]
  ------------------
 1210|  5.59k|                {
 1211|       |                    /* The field was handled */
 1212|  5.59k|                    continue;
 1213|  5.59k|                }
 1214|   132k|            }
 1215|       |
 1216|       |            /* No match found, skip data */
 1217|  1.00M|            if (!pb_skip_field(stream, wire_type))
  ------------------
  |  Branch (1217:17): [True: 318, False: 1.00M]
  ------------------
 1218|    318|                return false;
 1219|  1.00M|            continue;
 1220|  1.00M|        }
 1221|       |
 1222|       |        /* If a repeated fixed count field was found, get size from
 1223|       |         * 'fixed_count_field' as there is no counter contained in the struct.
 1224|       |         */
 1225|  6.10M|        if (PB_HTYPE(iter.type) == PB_HTYPE_REPEATED && iter.pSize == &iter.array_size)
  ------------------
  |  |  334|  6.10M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  6.10M|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(iter.type) == PB_HTYPE_REPEATED && iter.pSize == &iter.array_size)
  ------------------
  |  |  321|  12.2M|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (1225:13): [True: 42.5k, False: 6.06M]
  |  Branch (1225:57): [True: 3.96k, False: 38.5k]
  ------------------
 1226|  3.96k|        {
 1227|  3.96k|            if (fixed_count_field != iter.index) {
  ------------------
  |  Branch (1227:17): [True: 3.25k, False: 710]
  ------------------
 1228|       |                /* If the new fixed count field does not match the previous one,
 1229|       |                 * check that the previous one is NULL or that it finished
 1230|       |                 * receiving all the expected data.
 1231|       |                 */
 1232|  3.25k|                if (fixed_count_field != PB_SIZE_MAX &&
  ------------------
  |  |  349|  6.51k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (1232:21): [True: 1.65k, False: 1.60k]
  ------------------
 1233|  1.65k|                    fixed_count_size != fixed_count_total_size)
  ------------------
  |  Branch (1233:21): [True: 4, False: 1.64k]
  ------------------
 1234|      4|                {
 1235|      4|                    PB_RETURN_ERROR(stream, "wrong size for fixed count field");
  ------------------
  |  |  937|      4|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      4|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1236|      4|                }
 1237|       |
 1238|  3.25k|                fixed_count_field = iter.index;
 1239|  3.25k|                fixed_count_size = 0;
 1240|  3.25k|                fixed_count_total_size = iter.array_size;
 1241|  3.25k|            }
 1242|       |
 1243|  3.96k|            iter.pSize = &fixed_count_size;
 1244|  3.96k|        }
 1245|       |
 1246|  6.10M|        if (PB_HTYPE(iter.type) == PB_HTYPE_REQUIRED
  ------------------
  |  |  334|  6.10M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  6.10M|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(iter.type) == PB_HTYPE_REQUIRED
  ------------------
  |  |  318|  12.2M|#define PB_HTYPE_REQUIRED 0x00U
  ------------------
  |  Branch (1246:13): [True: 5.59M, False: 512k]
  ------------------
 1247|  5.59M|            && iter.required_field_index < PB_MAX_REQUIRED_FIELDS)
  ------------------
  |  |  240|  5.59M|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
  |  Branch (1247:16): [True: 5.59M, False: 0]
  ------------------
 1248|  5.59M|        {
 1249|  5.59M|            uint32_t tmp = ((uint32_t)1 << (iter.required_field_index & 31));
 1250|  5.59M|            fields_seen.bitfield[iter.required_field_index >> 5] |= tmp;
 1251|  5.59M|        }
 1252|       |
 1253|  6.10M|        if (!decode_field(stream, wire_type, &iter))
  ------------------
  |  Branch (1253:13): [True: 1.26k, False: 6.10M]
  ------------------
 1254|  1.26k|            return false;
 1255|  6.10M|    }
 1256|       |
 1257|   283k|    if (!eof)
  ------------------
  |  Branch (1257:9): [True: 111, False: 283k]
  ------------------
 1258|    111|    {
 1259|       |        /* pb_decode_tag() returned error before end of stream */
 1260|    111|        return false;
 1261|    111|    }
 1262|       |
 1263|       |    /* Check that all elements of the last decoded fixed count field were present. */
 1264|   283k|    if (fixed_count_field != PB_SIZE_MAX &&
  ------------------
  |  |  349|   566k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (1264:9): [True: 1.54k, False: 281k]
  ------------------
 1265|  1.54k|        fixed_count_size != fixed_count_total_size)
  ------------------
  |  Branch (1265:9): [True: 10, False: 1.53k]
  ------------------
 1266|     10|    {
 1267|     10|        PB_RETURN_ERROR(stream, "wrong size for fixed count field");
  ------------------
  |  |  937|     10|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     10|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1268|     10|    }
 1269|       |
 1270|       |    /* Check that all required fields were present. */
 1271|   283k|    {
 1272|   283k|        pb_size_t req_field_count = iter.descriptor->required_field_count;
 1273|       |
 1274|   283k|        if (req_field_count > 0)
  ------------------
  |  Branch (1274:13): [True: 145k, False: 137k]
  ------------------
 1275|   145k|        {
 1276|   145k|            pb_size_t i;
 1277|       |
 1278|   145k|            if (req_field_count > PB_MAX_REQUIRED_FIELDS)
  ------------------
  |  |  240|   145k|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
  |  Branch (1278:17): [True: 0, False: 145k]
  ------------------
 1279|      0|                req_field_count = PB_MAX_REQUIRED_FIELDS;
  ------------------
  |  |  240|      0|#define PB_MAX_REQUIRED_FIELDS 64
  ------------------
 1280|       |
 1281|       |            /* Check the whole words */
 1282|   145k|            for (i = 0; i < (req_field_count >> 5); i++)
  ------------------
  |  Branch (1282:25): [True: 0, False: 145k]
  ------------------
 1283|      0|            {
 1284|      0|                if (fields_seen.bitfield[i] != allbits)
  ------------------
  |  Branch (1284:21): [True: 0, False: 0]
  ------------------
 1285|      0|                    PB_RETURN_ERROR(stream, "missing required field");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1286|      0|            }
 1287|       |
 1288|       |            /* Check the remaining bits (if any) */
 1289|   145k|            if ((req_field_count & 31) != 0)
  ------------------
  |  Branch (1289:17): [True: 145k, False: 0]
  ------------------
 1290|   145k|            {
 1291|   145k|                if (fields_seen.bitfield[req_field_count >> 5] !=
  ------------------
  |  Branch (1291:21): [True: 327, False: 145k]
  ------------------
 1292|   145k|                    (allbits >> (uint_least8_t)(32 - (req_field_count & 31))))
 1293|    327|                {
 1294|    327|                    PB_RETURN_ERROR(stream, "missing required field");
  ------------------
  |  |  937|    327|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|    327|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 327]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1295|    327|                }
 1296|   145k|            }
 1297|   145k|        }
 1298|   283k|    }
 1299|       |
 1300|   282k|    return true;
 1301|   283k|}
pb_decode.c:pb_message_set_to_defaults:
 1076|   108k|{
 1077|   108k|    pb_istream_t defstream = PB_ISTREAM_EMPTY;
  ------------------
  |  |   71|   108k|#  define PB_ISTREAM_EMPTY {0,0,0,0}
  ------------------
 1078|   108k|    uint32_t tag = 0;
 1079|   108k|    pb_wire_type_t wire_type = PB_WT_VARINT;
 1080|   108k|    bool eof;
 1081|       |
 1082|   108k|    if (iter->descriptor->default_value)
  ------------------
  |  Branch (1082:9): [True: 102k, False: 5.74k]
  ------------------
 1083|   102k|    {
 1084|   102k|        defstream = pb_istream_from_buffer(iter->descriptor->default_value, (size_t)-1);
 1085|   102k|        if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof))
  ------------------
  |  Branch (1085:13): [True: 0, False: 102k]
  ------------------
 1086|      0|            return false;
 1087|   102k|    }
 1088|       |
 1089|   108k|    do
 1090|   954k|    {
 1091|   954k|        if (!pb_field_set_to_default(iter))
  ------------------
  |  Branch (1091:13): [True: 0, False: 954k]
  ------------------
 1092|      0|            return false;
 1093|       |
 1094|   954k|        if (tag != 0 && iter->tag == tag)
  ------------------
  |  Branch (1094:13): [True: 857k, False: 97.2k]
  |  Branch (1094:25): [True: 476k, False: 380k]
  ------------------
 1095|   476k|        {
 1096|       |            /* We have a default value for this field in the defstream */
 1097|   476k|            if (!decode_field(&defstream, wire_type, iter))
  ------------------
  |  Branch (1097:17): [True: 0, False: 476k]
  ------------------
 1098|      0|                return false;
 1099|   476k|            if (!pb_decode_tag(&defstream, &wire_type, &tag, &eof))
  ------------------
  |  Branch (1099:17): [True: 0, False: 476k]
  ------------------
 1100|      0|                return false;
 1101|       |
 1102|   476k|            if (iter->pSize)
  ------------------
  |  Branch (1102:17): [True: 231k, False: 244k]
  ------------------
 1103|   231k|                *(bool*)iter->pSize = false;
 1104|   476k|        }
 1105|   954k|    } while (pb_field_iter_next(iter));
  ------------------
  |  Branch (1105:14): [True: 846k, False: 108k]
  ------------------
 1106|       |
 1107|   108k|    return true;
 1108|   108k|}
pb_decode.c:pb_field_set_to_default:
  972|   954k|{
  973|   954k|    pb_type_t type;
  974|   954k|    type = field->type;
  975|       |
  976|   954k|    if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|   954k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   954k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|   954k|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (976:9): [True: 8.32k, False: 946k]
  ------------------
  977|  8.32k|    {
  978|  8.32k|        pb_extension_t *ext = *(pb_extension_t* const *)field->pData;
  979|  14.0k|        while (ext != NULL)
  ------------------
  |  Branch (979:16): [True: 5.74k, False: 8.32k]
  ------------------
  980|  5.74k|        {
  981|  5.74k|            pb_field_iter_t ext_iter;
  982|  5.74k|            if (ext->type->decode != NULL)
  ------------------
  |  Branch (982:17): [True: 0, False: 5.74k]
  ------------------
  983|      0|                ext->found = false; /* Custom type: arg is not a message descriptor */
  984|  5.74k|            else if (pb_field_iter_begin_extension(&ext_iter, ext))
  ------------------
  |  Branch (984:22): [True: 5.74k, False: 0]
  ------------------
  985|  5.74k|            {
  986|  5.74k|                ext->found = false;
  987|  5.74k|                if (!pb_message_set_to_defaults(&ext_iter))
  ------------------
  |  Branch (987:21): [True: 0, False: 5.74k]
  ------------------
  988|      0|                    return false;
  989|  5.74k|            }
  990|  5.74k|            ext = ext->next;
  991|  5.74k|        }
  992|  8.32k|    }
  993|   946k|    else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
  ------------------
  |  |  333|   946k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   946k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_STATIC)
  ------------------
  |  |  328|   946k|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (993:14): [True: 875k, False: 70.5k]
  ------------------
  994|   875k|    {
  995|   875k|        bool init_data = true;
  996|   875k|        if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->pSize != NULL)
  ------------------
  |  |  334|   875k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   875k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_OPTIONAL && field->pSize != NULL)
  ------------------
  |  |  319|  1.75M|#define PB_HTYPE_OPTIONAL 0x10U
  ------------------
  |  Branch (996:13): [True: 248k, False: 627k]
  |  Branch (996:52): [True: 248k, False: 0]
  ------------------
  997|   248k|        {
  998|       |            /* Set has_field to false. Still initialize the optional field
  999|       |             * itself also. */
 1000|   248k|            *(bool*)field->pSize = false;
 1001|   248k|        }
 1002|   627k|        else if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  334|   627k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   627k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      else if (PB_HTYPE(type) == PB_HTYPE_REPEATED &&
  ------------------
  |  |  321|  1.25M|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (1002:18): [True: 147k, False: 479k]
  ------------------
 1003|   147k|                 field->pSize == &field->array_size &&
  ------------------
  |  Branch (1003:18): [True: 14.0k, False: 133k]
  ------------------
 1004|  14.0k|                 PB_LTYPE_IS_SUBMSG(type))
  ------------------
  |  |  336|  14.0k|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|  14.0k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  14.0k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|  28.1k|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 0, False: 14.0k]
  |  |  ------------------
  |  |  337|  14.0k|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|  14.0k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  14.0k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|  14.0k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 0, False: 14.0k]
  |  |  ------------------
  ------------------
 1005|      0|        {
 1006|       |            /* Fixed count array: there is no count field, so pb_release()
 1007|       |             * walks all array_size entries even if they were not decoded.
 1008|       |             * Initialize all submessages so that their pointers are valid. */
 1009|      0|            pb_size_t i;
 1010|      0|            for (i = 0; i < field->array_size; i++)
  ------------------
  |  Branch (1010:25): [True: 0, False: 0]
  ------------------
 1011|      0|            {
 1012|      0|                pb_field_iter_t submsg_iter;
 1013|      0|                if (pb_field_iter_begin(&submsg_iter, field->submsg_desc,
  ------------------
  |  Branch (1013:21): [True: 0, False: 0]
  ------------------
 1014|      0|                                        (char*)field->pData + field->data_size * i))
 1015|      0|                {
 1016|      0|                    if (!pb_message_set_to_defaults(&submsg_iter))
  ------------------
  |  Branch (1016:25): [True: 0, False: 0]
  ------------------
 1017|      0|                        return false;
 1018|      0|                }
 1019|      0|            }
 1020|      0|            init_data = false;
 1021|      0|        }
 1022|   627k|        else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  334|   627k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   627k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      else if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  321|  1.25M|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (1022:18): [True: 147k, False: 479k]
  ------------------
 1023|   479k|                 PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  334|   479k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   479k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                               PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  323|   479k|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (1023:18): [True: 41.6k, False: 437k]
  ------------------
 1024|   189k|        {
 1025|       |            /* REPEATED: Set array count to 0, no need to initialize contents.
 1026|       |               ONEOF: Set which_field to 0. */
 1027|   189k|            *(pb_size_t*)field->pSize = 0;
 1028|   189k|            init_data = false;
 1029|   189k|        }
 1030|       |
 1031|   875k|        if (init_data)
  ------------------
  |  Branch (1031:13): [True: 686k, False: 189k]
  ------------------
 1032|   686k|        {
 1033|   686k|            if (PB_LTYPE_IS_SUBMSG(field->type) &&
  ------------------
  |  |  336|  1.37M|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|   686k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|   686k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|  1.37M|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 63.9k, False: 622k]
  |  |  ------------------
  |  |  337|  1.37M|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|   622k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|   622k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|   622k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 0, False: 622k]
  |  |  ------------------
  ------------------
 1034|  63.9k|                (field->submsg_desc->default_value != NULL ||
  ------------------
  |  Branch (1034:18): [True: 24.9k, False: 39.0k]
  ------------------
 1035|  39.0k|                 field->submsg_desc->field_callback != NULL ||
  ------------------
  |  Branch (1035:18): [True: 0, False: 39.0k]
  ------------------
 1036|  39.0k|                 field->submsg_desc->submsg_info[0] != NULL))
  ------------------
  |  Branch (1036:18): [True: 0, False: 39.0k]
  ------------------
 1037|  24.9k|            {
 1038|       |                /* Initialize submessage to defaults.
 1039|       |                 * Only needed if it has default values
 1040|       |                 * or callback/submessage fields. */
 1041|  24.9k|                pb_field_iter_t submsg_iter;
 1042|  24.9k|                if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
  ------------------
  |  Branch (1042:21): [True: 24.9k, False: 0]
  ------------------
 1043|  24.9k|                {
 1044|  24.9k|                    if (!pb_message_set_to_defaults(&submsg_iter))
  ------------------
  |  Branch (1044:25): [True: 0, False: 24.9k]
  ------------------
 1045|      0|                        return false;
 1046|  24.9k|                }
 1047|  24.9k|            }
 1048|   661k|            else
 1049|   661k|            {
 1050|       |                /* Initialize to zeros */
 1051|   661k|                memset(field->pData, 0, (size_t)field->data_size);
 1052|   661k|            }
 1053|   686k|        }
 1054|   875k|    }
 1055|  70.5k|    else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|  70.5k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  70.5k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|  70.5k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (1055:14): [True: 0, False: 70.5k]
  ------------------
 1056|      0|    {
 1057|       |        /* Initialize the pointer to NULL. */
 1058|      0|        *(void**)field->pField = NULL;
 1059|       |
 1060|       |        /* Initialize array count to 0. */
 1061|      0|        if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  334|      0|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|      0|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(type) == PB_HTYPE_REPEATED ||
  ------------------
  |  |  321|      0|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (1061:13): [True: 0, False: 0]
  ------------------
 1062|      0|            PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  334|      0|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|      0|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                          PB_HTYPE(type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  323|      0|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (1062:13): [True: 0, False: 0]
  ------------------
 1063|      0|        {
 1064|      0|            *(pb_size_t*)field->pSize = 0;
 1065|      0|        }
 1066|      0|    }
 1067|  70.5k|    else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  333|  70.5k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  70.5k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  else if (PB_ATYPE(type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  330|  70.5k|#define PB_ATYPE_CALLBACK 0x40U
  ------------------
  |  Branch (1067:14): [True: 70.5k, False: 0]
  ------------------
 1068|  70.5k|    {
 1069|       |        /* Don't overwrite callback */
 1070|  70.5k|    }
 1071|       |
 1072|   954k|    return true;
 1073|   954k|}
pb_decode.c:decode_next_tag:
 1116|  7.39M|{
 1117|       |    /* Length-delimited messages must consume their full advertised size. */
 1118|  7.39M|    bool delimited_not_done = (flags & PB_DECODE_DELIMITED) != 0 && stream->bytes_left > 0;
  ------------------
  |  |  123|  7.39M|#define PB_DECODE_DELIMITED       0x02U
  ------------------
  |  Branch (1118:31): [True: 1.49M, False: 5.90M]
  |  Branch (1118:69): [True: 1.21M, False: 276k]
  ------------------
 1119|       |
 1120|  7.39M|    if (pb_decode_tag(stream, wire_type, tag, eof))
  ------------------
  |  Branch (1120:9): [True: 7.11M, False: 283k]
  ------------------
 1121|  7.11M|        return true;
 1122|       |
 1123|   283k|    if (*eof && delimited_not_done)
  ------------------
  |  Branch (1123:9): [True: 283k, False: 111]
  |  Branch (1123:17): [True: 0, False: 283k]
  ------------------
 1124|      0|    {
 1125|      0|        *eof = false;
 1126|      0|        PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1127|      0|    }
 1128|       |
 1129|   283k|    return false;
 1130|   283k|}
pb_decode.c:decode_extension:
  950|   132k|{
  951|   132k|    size_t pos = stream->bytes_left;
  952|       |    
  953|   264k|    while (extension != NULL && pos == stream->bytes_left)
  ------------------
  |  Branch (953:12): [True: 132k, False: 132k]
  |  Branch (953:33): [True: 132k, False: 0]
  ------------------
  954|   132k|    {
  955|   132k|        bool status;
  956|   132k|        if (extension->type->decode)
  ------------------
  |  Branch (956:13): [True: 0, False: 132k]
  ------------------
  957|      0|            status = extension->type->decode(stream, extension, tag, wire_type);
  958|   132k|        else
  959|   132k|            status = default_extension_decoder(stream, extension, tag, wire_type);
  960|       |
  961|   132k|        if (!status)
  ------------------
  |  Branch (961:13): [True: 39, False: 132k]
  ------------------
  962|     39|            return false;
  963|       |        
  964|   132k|        extension = extension->next;
  965|   132k|    }
  966|       |    
  967|   132k|    return true;
  968|   132k|}
pb_decode.c:default_extension_decoder:
  933|   132k|{
  934|   132k|    pb_field_iter_t iter;
  935|       |
  936|   132k|    if (!pb_field_iter_begin_extension(&iter, extension))
  ------------------
  |  Branch (936:9): [True: 0, False: 132k]
  ------------------
  937|      0|        PB_RETURN_ERROR(stream, "invalid extension");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  938|       |
  939|   132k|    if (iter.tag != tag || !iter.message)
  ------------------
  |  Branch (939:9): [True: 126k, False: 5.63k]
  |  Branch (939:28): [True: 0, False: 5.63k]
  ------------------
  940|   126k|        return true;
  941|       |
  942|  5.63k|    extension->found = true;
  943|  5.63k|    return decode_field(stream, wire_type, &iter);
  944|   132k|}
pb_decode.c:decode_field:
  901|  6.58M|{
  902|       |#ifdef PB_ENABLE_MALLOC
  903|       |    /* When decoding an oneof field, check if there is old data that must be
  904|       |     * released first. */
  905|       |    if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
  906|       |    {
  907|       |        if (!pb_release_union_field(stream, field))
  908|       |            return false;
  909|       |    }
  910|       |#endif
  911|       |
  912|  6.58M|    switch (PB_ATYPE(field->type))
  ------------------
  |  |  333|  6.58M|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  6.58M|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
  913|  6.58M|    {
  914|  6.50M|        case PB_ATYPE_STATIC:
  ------------------
  |  |  328|  6.50M|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (914:9): [True: 6.50M, False: 79.0k]
  ------------------
  915|  6.50M|            return decode_static_field(stream, wire_type, field);
  916|       |        
  917|      0|        case PB_ATYPE_POINTER:
  ------------------
  |  |  329|      0|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (917:9): [True: 0, False: 6.58M]
  ------------------
  918|      0|            return decode_pointer_field(stream, wire_type, field);
  919|       |        
  920|  79.0k|        case PB_ATYPE_CALLBACK:
  ------------------
  |  |  330|  79.0k|#define PB_ATYPE_CALLBACK 0x40U
  ------------------
  |  Branch (920:9): [True: 79.0k, False: 6.50M]
  ------------------
  921|  79.0k|            return decode_callback_field(stream, wire_type, field);
  922|       |        
  923|      0|        default:
  ------------------
  |  Branch (923:9): [True: 0, False: 6.58M]
  ------------------
  924|       |            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  925|  6.58M|    }
  926|  6.58M|}
pb_decode.c:decode_static_field:
  503|  6.50M|{
  504|  6.50M|    switch (PB_HTYPE(field->type))
  ------------------
  |  |  334|  6.50M|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  6.50M|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
  505|  6.50M|    {
  506|  5.79M|        case PB_HTYPE_REQUIRED:
  ------------------
  |  |  318|  5.79M|#define PB_HTYPE_REQUIRED 0x00U
  ------------------
  |  Branch (506:9): [True: 5.79M, False: 713k]
  ------------------
  507|  5.79M|            return decode_basic_field(stream, wire_type, field);
  508|       |            
  509|   480k|        case PB_HTYPE_OPTIONAL:
  ------------------
  |  |  319|   480k|#define PB_HTYPE_OPTIONAL 0x10U
  ------------------
  |  Branch (509:9): [True: 480k, False: 6.02M]
  ------------------
  510|   480k|            if (field->pSize != NULL)
  ------------------
  |  Branch (510:17): [True: 480k, False: 0]
  ------------------
  511|   480k|                *(bool*)field->pSize = true;
  512|   480k|            return decode_basic_field(stream, wire_type, field);
  513|       |    
  514|  34.0k|        case PB_HTYPE_REPEATED:
  ------------------
  |  |  321|  34.0k|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (514:9): [True: 34.0k, False: 6.47M]
  ------------------
  515|  34.0k|            if (wire_type == PB_WT_STRING
  ------------------
  |  Branch (515:17): [True: 25.4k, False: 8.59k]
  ------------------
  516|  25.4k|                && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  335|  25.4k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  25.4k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                              && PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  283|  25.4k|#define PB_LTYPE_LAST_PACKABLE 0x05U
  ------------------
  |  Branch (516:20): [True: 13.4k, False: 12.0k]
  ------------------
  517|  13.4k|            {
  518|       |                /* Packed array */
  519|  13.4k|                bool status = true;
  520|  13.4k|                pb_istream_t substream;
  521|  13.4k|                pb_size_t *size = (pb_size_t*)field->pSize;
  522|  13.4k|                field->pData = (char*)field->pField + field->data_size * (*size);
  523|       |
  524|  13.4k|                if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (524:21): [True: 61, False: 13.4k]
  ------------------
  525|     61|                    return false;
  526|       |
  527|  48.1k|                while (substream.bytes_left > 0 && *size < field->array_size)
  ------------------
  |  Branch (527:24): [True: 34.8k, False: 13.3k]
  |  Branch (527:52): [True: 34.7k, False: 23]
  ------------------
  528|  34.7k|                {
  529|  34.7k|                    if (!decode_basic_field(&substream, PB_WT_PACKED, field))
  ------------------
  |  Branch (529:25): [True: 29, False: 34.7k]
  ------------------
  530|     29|                    {
  531|     29|                        status = false;
  532|     29|                        break;
  533|     29|                    }
  534|  34.7k|                    (*size)++;
  535|  34.7k|                    field->pData = (char*)field->pData + field->data_size;
  536|  34.7k|                }
  537|       |
  538|  13.4k|                if (substream.bytes_left != 0)
  ------------------
  |  Branch (538:21): [True: 44, False: 13.3k]
  ------------------
  539|     44|                    PB_RETURN_ERROR(stream, "array overflow");
  ------------------
  |  |  937|     44|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     44|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 44]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  540|  13.3k|                if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (540:21): [True: 0, False: 13.3k]
  ------------------
  541|      0|                    return false;
  542|       |
  543|  13.3k|                return status;
  544|  13.3k|            }
  545|  20.6k|            else
  546|  20.6k|            {
  547|       |                /* Repeated field */
  548|  20.6k|                pb_size_t *size = (pb_size_t*)field->pSize;
  549|  20.6k|                field->pData = (char*)field->pField + field->data_size * (*size);
  550|       |
  551|  20.6k|                if ((*size)++ >= field->array_size)
  ------------------
  |  Branch (551:21): [True: 4, False: 20.5k]
  ------------------
  552|      4|                    PB_RETURN_ERROR(stream, "array overflow");
  ------------------
  |  |  937|      4|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      4|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 4]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  553|       |
  554|  20.5k|                if (PB_LTYPE_IS_SUBMSG(field->type))
  ------------------
  |  |  336|  20.5k|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|  20.5k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  20.5k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|  41.1k|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 5.37k, False: 15.2k]
  |  |  ------------------
  |  |  337|  20.5k|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|  15.2k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  15.2k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|  15.2k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 0, False: 15.2k]
  |  |  ------------------
  ------------------
  555|  5.37k|                {
  556|       |                    /* The entry is now counted, so pb_release() will walk it
  557|       |                     * even if decoding fails before pb_dec_submessage().
  558|       |                     * Set defaults here so that its pointers are valid. */
  559|  5.37k|                    pb_field_iter_t submsg_iter;
  560|  5.37k|                    if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
  ------------------
  |  Branch (560:25): [True: 4.13k, False: 1.23k]
  ------------------
  561|  4.13k|                    {
  562|  4.13k|                        if (!pb_message_set_to_defaults(&submsg_iter))
  ------------------
  |  Branch (562:29): [True: 0, False: 4.13k]
  ------------------
  563|      0|                            PB_RETURN_ERROR(stream, "failed to set defaults");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  564|  4.13k|                    }
  565|  5.37k|                }
  566|       |
  567|  20.5k|                return decode_basic_field(stream, wire_type, field);
  568|  20.5k|            }
  569|       |
  570|   198k|        case PB_HTYPE_ONEOF:
  ------------------
  |  |  323|   198k|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (570:9): [True: 198k, False: 6.31M]
  ------------------
  571|   198k|            if (PB_LTYPE_IS_SUBMSG(field->type) &&
  ------------------
  |  |  336|   397k|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|   198k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|   198k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|   397k|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 153k, False: 45.7k]
  |  |  ------------------
  |  |  337|   397k|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|  45.7k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|  45.7k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|  45.7k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 44.5k, False: 1.19k]
  |  |  ------------------
  ------------------
  572|   197k|                *(pb_size_t*)field->pSize != field->tag)
  ------------------
  |  Branch (572:17): [True: 113k, False: 84.0k]
  ------------------
  573|   113k|            {
  574|       |                /* We memset to zero so that any callbacks are set to NULL.
  575|       |                 * This is because the callbacks might otherwise have values
  576|       |                 * from some other union field.
  577|       |                 * If callbacks are needed inside oneof field, use .proto
  578|       |                 * option submsg_callback to have a separate callback function
  579|       |                 * that can set the fields before submessage is decoded.
  580|       |                 * pb_dec_submessage() will set any default values. */
  581|   113k|                memset(field->pData, 0, (size_t)field->data_size);
  582|       |
  583|       |                /* Set default values for the submessage fields. */
  584|   113k|                if (field->submsg_desc->default_value != NULL ||
  ------------------
  |  Branch (584:21): [True: 65.2k, False: 48.3k]
  ------------------
  585|  48.3k|                    field->submsg_desc->field_callback != NULL ||
  ------------------
  |  Branch (585:21): [True: 0, False: 48.3k]
  ------------------
  586|  48.3k|                    field->submsg_desc->submsg_info[0] != NULL)
  ------------------
  |  Branch (586:21): [True: 0, False: 48.3k]
  ------------------
  587|  65.2k|                {
  588|  65.2k|                    pb_field_iter_t submsg_iter;
  589|  65.2k|                    if (pb_field_iter_begin(&submsg_iter, field->submsg_desc, field->pData))
  ------------------
  |  Branch (589:25): [True: 65.2k, False: 0]
  ------------------
  590|  65.2k|                    {
  591|  65.2k|                        if (!pb_message_set_to_defaults(&submsg_iter))
  ------------------
  |  Branch (591:29): [True: 0, False: 65.2k]
  ------------------
  592|      0|                            PB_RETURN_ERROR(stream, "failed to set defaults");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  593|  65.2k|                    }
  594|  65.2k|                }
  595|   113k|            }
  596|   198k|            *(pb_size_t*)field->pSize = field->tag;
  597|       |
  598|   198k|            return decode_basic_field(stream, wire_type, field);
  599|       |
  600|      0|        default:
  ------------------
  |  Branch (600:9): [True: 0, False: 6.50M]
  ------------------
  601|       |            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  602|  6.50M|    }
  603|  6.50M|}
pb_decode.c:decode_basic_field:
  432|  6.53M|{
  433|  6.53M|    switch (PB_LTYPE(field->type))
  ------------------
  |  |  335|  6.53M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  6.53M|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
  434|  6.53M|    {
  435|   292k|        case PB_LTYPE_BOOL:
  ------------------
  |  |  275|   292k|#define PB_LTYPE_BOOL    0x00U /* bool */
  ------------------
  |  Branch (435:9): [True: 292k, False: 6.23M]
  ------------------
  436|   292k|            if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED)
  ------------------
  |  Branch (436:17): [True: 1.49k, False: 290k]
  |  Branch (436:46): [True: 11, False: 1.48k]
  ------------------
  437|     11|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     11|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     11|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 11]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  438|       |
  439|   292k|            return pb_dec_bool(stream, field);
  440|       |
  441|  4.59M|        case PB_LTYPE_VARINT:
  ------------------
  |  |  276|  4.59M|#define PB_LTYPE_VARINT  0x01U /* int32, int64, enum, bool */
  ------------------
  |  Branch (441:9): [True: 4.59M, False: 1.93M]
  ------------------
  442|  4.94M|        case PB_LTYPE_UVARINT:
  ------------------
  |  |  277|  4.94M|#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
  ------------------
  |  Branch (442:9): [True: 352k, False: 6.17M]
  ------------------
  443|  5.11M|        case PB_LTYPE_SVARINT:
  ------------------
  |  |  278|  5.11M|#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
  ------------------
  |  Branch (443:9): [True: 167k, False: 6.36M]
  ------------------
  444|  5.11M|            if (wire_type != PB_WT_VARINT && wire_type != PB_WT_PACKED)
  ------------------
  |  Branch (444:17): [True: 23.0k, False: 5.08M]
  |  Branch (444:46): [True: 49, False: 23.0k]
  ------------------
  445|     49|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     49|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     49|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 49]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  446|       |
  447|  5.11M|            return pb_dec_varint(stream, field);
  448|       |
  449|   296k|        case PB_LTYPE_FIXED32:
  ------------------
  |  |  279|   296k|#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
  ------------------
  |  Branch (449:9): [True: 296k, False: 6.23M]
  ------------------
  450|   296k|            if (wire_type != PB_WT_32BIT && wire_type != PB_WT_PACKED)
  ------------------
  |  Branch (450:17): [True: 5.72k, False: 290k]
  |  Branch (450:45): [True: 16, False: 5.70k]
  ------------------
  451|     16|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     16|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     16|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  452|       |
  453|   296k|            return pb_decode_fixed32(stream, field->pData);
  454|       |
  455|   240k|        case PB_LTYPE_FIXED64:
  ------------------
  |  |  280|   240k|#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
  ------------------
  |  Branch (455:9): [True: 240k, False: 6.28M]
  ------------------
  456|   240k|            if (wire_type != PB_WT_64BIT && wire_type != PB_WT_PACKED)
  ------------------
  |  Branch (456:17): [True: 4.60k, False: 236k]
  |  Branch (456:45): [True: 10, False: 4.59k]
  ------------------
  457|     10|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     10|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     10|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  458|       |
  459|       |#ifdef PB_CONVERT_DOUBLE_FLOAT
  460|       |            if (field->data_size == sizeof(float))
  461|       |            {
  462|       |                return pb_decode_double_as_float(stream, (float*)field->pData);
  463|       |            }
  464|       |#endif
  465|       |
  466|       |#ifdef PB_WITHOUT_64BIT
  467|       |            PB_RETURN_ERROR(stream, "invalid data_size");
  468|       |#else
  469|   240k|            return pb_decode_fixed64(stream, field->pData);
  470|      0|#endif
  471|       |
  472|  47.7k|        case PB_LTYPE_BYTES:
  ------------------
  |  |  287|  47.7k|#define PB_LTYPE_BYTES 0x06U
  ------------------
  |  Branch (472:9): [True: 47.7k, False: 6.48M]
  ------------------
  473|  47.7k|            if (wire_type != PB_WT_STRING)
  ------------------
  |  Branch (473:17): [True: 10, False: 47.6k]
  ------------------
  474|     10|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     10|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     10|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 10]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  475|       |
  476|  47.6k|            return pb_dec_bytes(stream, field);
  477|       |
  478|   210k|        case PB_LTYPE_STRING:
  ------------------
  |  |  291|   210k|#define PB_LTYPE_STRING 0x07U
  ------------------
  |  Branch (478:9): [True: 210k, False: 6.32M]
  ------------------
  479|   210k|            if (wire_type != PB_WT_STRING)
  ------------------
  |  Branch (479:17): [True: 16, False: 210k]
  ------------------
  480|     16|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     16|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     16|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 16]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  481|       |
  482|   210k|            return pb_dec_string(stream, field);
  483|       |
  484|   257k|        case PB_LTYPE_SUBMESSAGE:
  ------------------
  |  |  295|   257k|#define PB_LTYPE_SUBMESSAGE 0x08U
  ------------------
  |  Branch (484:9): [True: 257k, False: 6.27M]
  ------------------
  485|   302k|        case PB_LTYPE_SUBMSG_W_CB:
  ------------------
  |  |  300|   302k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (485:9): [True: 44.5k, False: 6.48M]
  ------------------
  486|   302k|            if (wire_type != PB_WT_STRING)
  ------------------
  |  Branch (486:17): [True: 17, False: 302k]
  ------------------
  487|     17|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|     17|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     17|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 17]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  488|       |
  489|   302k|            return pb_dec_submessage(stream, field);
  490|       |
  491|  27.8k|        case PB_LTYPE_FIXED_LENGTH_BYTES:
  ------------------
  |  |  310|  27.8k|#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0BU
  ------------------
  |  Branch (491:9): [True: 27.8k, False: 6.50M]
  ------------------
  492|  27.8k|            if (wire_type != PB_WT_STRING)
  ------------------
  |  Branch (492:17): [True: 5, False: 27.8k]
  ------------------
  493|      5|                PB_RETURN_ERROR(stream, "wrong wire type");
  ------------------
  |  |  937|      5|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      5|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 5]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  494|       |
  495|  27.8k|            return pb_dec_fixed_length_bytes(stream, field);
  496|       |
  497|      0|        default:
  ------------------
  |  Branch (497:9): [True: 0, False: 6.53M]
  ------------------
  498|       |            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  499|  6.53M|    }
  500|  6.53M|}
pb_decode.c:pb_dec_bool:
 1567|   292k|{
 1568|   292k|    return pb_decode_bool(stream, (bool*)field->pData);
 1569|   292k|}
pb_decode.c:pb_dec_varint:
 1572|  5.11M|{
 1573|  5.11M|    if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT)
  ------------------
  |  |  335|  5.11M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  5.11M|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT)
  ------------------
  |  |  277|  5.11M|#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
  ------------------
  |  Branch (1573:9): [True: 352k, False: 4.76M]
  ------------------
 1574|   352k|    {
 1575|   352k|        pb_uint64_t value, clamped;
  ------------------
  |  |   58|   352k|#define pb_uint64_t uint64_t
  ------------------
 1576|   352k|        if (!pb_decode_varint(stream, &value))
  ------------------
  |  Branch (1576:13): [True: 23, False: 352k]
  ------------------
 1577|     23|            return false;
 1578|       |
 1579|       |        /* Cast to the proper field size, while checking for overflows */
 1580|   352k|        if (field->data_size == sizeof(pb_uint64_t))
  ------------------
  |  Branch (1580:13): [True: 156k, False: 196k]
  ------------------
 1581|   156k|            clamped = *(pb_uint64_t*)field->pData = value;
 1582|   196k|        else if (field->data_size == sizeof(uint32_t))
  ------------------
  |  Branch (1582:18): [True: 171k, False: 24.1k]
  ------------------
 1583|   171k|            clamped = *(uint32_t*)field->pData = (uint32_t)value;
 1584|  24.1k|        else if (field->data_size == sizeof(uint_least16_t))
  ------------------
  |  Branch (1584:18): [True: 12.0k, False: 12.1k]
  ------------------
 1585|  12.0k|            clamped = *(uint_least16_t*)field->pData = (uint_least16_t)value;
 1586|  12.1k|        else if (field->data_size == sizeof(uint_least8_t))
  ------------------
  |  Branch (1586:18): [True: 12.1k, False: 0]
  ------------------
 1587|  12.1k|            clamped = *(uint_least8_t*)field->pData = (uint_least8_t)value;
 1588|      0|        else
 1589|      0|            PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1590|       |
 1591|   352k|        if (clamped != value)
  ------------------
  |  Branch (1591:13): [True: 111, False: 352k]
  ------------------
 1592|    111|            PB_RETURN_ERROR(stream, "integer too large");
  ------------------
  |  |  937|    111|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|    111|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 111]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1593|       |
 1594|   352k|        return true;
 1595|   352k|    }
 1596|  4.76M|    else
 1597|  4.76M|    {
 1598|  4.76M|        pb_uint64_t value;
  ------------------
  |  |   58|  4.76M|#define pb_uint64_t uint64_t
  ------------------
 1599|  4.76M|        pb_int64_t svalue;
  ------------------
  |  |   57|  4.76M|#define pb_int64_t int64_t
  ------------------
 1600|  4.76M|        pb_int64_t clamped;
  ------------------
  |  |   57|  4.76M|#define pb_int64_t int64_t
  ------------------
 1601|       |
 1602|  4.76M|        if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT)
  ------------------
  |  |  335|  4.76M|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  4.76M|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT)
  ------------------
  |  |  278|  4.76M|#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
  ------------------
  |  Branch (1602:13): [True: 167k, False: 4.59M]
  ------------------
 1603|   167k|        {
 1604|   167k|            if (!pb_decode_svarint(stream, &svalue))
  ------------------
  |  Branch (1604:17): [True: 25, False: 167k]
  ------------------
 1605|     25|                return false;
 1606|   167k|        }
 1607|  4.59M|        else
 1608|  4.59M|        {
 1609|  4.59M|            if (!pb_decode_varint(stream, &value))
  ------------------
  |  Branch (1609:17): [True: 41, False: 4.59M]
  ------------------
 1610|     41|                return false;
 1611|       |
 1612|       |            /* See issue 97: Google's C++ protobuf allows negative varint values to
 1613|       |            * be cast as int32_t, instead of the int64_t that should be used when
 1614|       |            * encoding. Nanopb versions before 0.2.5 had a bug in encoding. In order to
 1615|       |            * not break decoding of such messages, we cast <=32 bit fields to
 1616|       |            * int32_t first to get the sign correct.
 1617|       |            */
 1618|  4.59M|            if (field->data_size == sizeof(pb_int64_t))
  ------------------
  |  Branch (1618:17): [True: 157k, False: 4.43M]
  ------------------
 1619|   157k|                svalue = (pb_int64_t)value;
 1620|  4.43M|            else
 1621|  4.43M|                svalue = (int32_t)value;
 1622|  4.59M|        }
 1623|       |
 1624|       |        /* Cast to the proper field size, while checking for overflows */
 1625|  4.76M|        if (field->data_size == sizeof(pb_int64_t))
  ------------------
  |  Branch (1625:13): [True: 230k, False: 4.53M]
  ------------------
 1626|   230k|            clamped = *(pb_int64_t*)field->pData = svalue;
 1627|  4.53M|        else if (field->data_size == sizeof(int32_t))
  ------------------
  |  Branch (1627:18): [True: 4.48M, False: 47.9k]
  ------------------
 1628|  4.48M|            clamped = *(int32_t*)field->pData = (int32_t)svalue;
 1629|  47.9k|        else if (field->data_size == sizeof(int_least16_t))
  ------------------
  |  Branch (1629:18): [True: 23.9k, False: 23.9k]
  ------------------
 1630|  23.9k|            clamped = *(int_least16_t*)field->pData = (int_least16_t)svalue;
 1631|  23.9k|        else if (field->data_size == sizeof(int_least8_t))
  ------------------
  |  Branch (1631:18): [True: 23.9k, False: 0]
  ------------------
 1632|  23.9k|            clamped = *(int_least8_t*)field->pData = (int_least8_t)svalue;
 1633|      0|        else
 1634|      0|            PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1635|       |
 1636|  4.76M|        if (clamped != svalue)
  ------------------
  |  Branch (1636:13): [True: 95, False: 4.76M]
  ------------------
 1637|     95|            PB_RETURN_ERROR(stream, "integer too large");
  ------------------
  |  |  937|     95|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     95|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 95]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1638|       |
 1639|  4.76M|        return true;
 1640|  4.76M|    }
 1641|  5.11M|}
pb_decode.c:pb_dec_bytes:
 1644|  47.6k|{
 1645|  47.6k|    uint32_t size;
 1646|  47.6k|    size_t alloc_size;
 1647|  47.6k|    pb_bytes_array_t *dest;
 1648|       |    
 1649|  47.6k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (1649:9): [True: 5, False: 47.6k]
  ------------------
 1650|      5|        return false;
 1651|       |    
 1652|  47.6k|    if (size > PB_SIZE_MAX)
  ------------------
  |  |  349|  47.6k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (1652:9): [True: 30, False: 47.6k]
  ------------------
 1653|     30|        PB_RETURN_ERROR(stream, "bytes overflow");
  ------------------
  |  |  937|     30|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     30|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 30]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1654|       |    
 1655|  47.6k|    alloc_size = PB_BYTES_ARRAY_T_ALLOCSIZE(size);
  ------------------
  |  |  418|  47.6k|    (((size_t)(n) + offsetof(pb_bytes_array_t, bytes)) < sizeof(pb_bytes_array_t) \
  |  |  ------------------
  |  |  |  Branch (418:6): [True: 22.1k, False: 25.5k]
  |  |  ------------------
  |  |  419|  47.6k|        ? sizeof(pb_bytes_array_t) \
  |  |  420|  47.6k|        : ((size_t)(n) + offsetof(pb_bytes_array_t, bytes)))
  ------------------
 1656|  47.6k|    if (size > alloc_size)
  ------------------
  |  Branch (1656:9): [True: 0, False: 47.6k]
  ------------------
 1657|      0|        PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1658|       |    
 1659|  47.6k|    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|  47.6k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  47.6k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|  47.6k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (1659:9): [True: 0, False: 47.6k]
  ------------------
 1660|      0|    {
 1661|      0|#ifndef PB_ENABLE_MALLOC
 1662|      0|        PB_RETURN_ERROR(stream, "no malloc support");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1663|       |#else
 1664|       |        if (stream->bytes_left < size)
 1665|       |            PB_RETURN_ERROR(stream, "end-of-stream");
 1666|       |
 1667|       |        if (!allocate_field(stream, field->pData, alloc_size, 1))
 1668|       |            return false;
 1669|       |        dest = *(pb_bytes_array_t**)field->pData;
 1670|       |#endif
 1671|      0|    }
 1672|  47.6k|    else
 1673|  47.6k|    {
 1674|  47.6k|        if (alloc_size > field->data_size)
  ------------------
  |  Branch (1674:13): [True: 60, False: 47.6k]
  ------------------
 1675|     60|            PB_RETURN_ERROR(stream, "bytes overflow");
  ------------------
  |  |  937|     60|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     60|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 60]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1676|  47.6k|        dest = (pb_bytes_array_t*)field->pData;
 1677|  47.6k|    }
 1678|       |
 1679|  47.6k|    dest->size = (pb_size_t)size;
 1680|  47.6k|    return pb_read(stream, dest->bytes, (size_t)size);
 1681|  47.6k|}
pb_decode.c:pb_dec_string:
 1684|   210k|{
 1685|   210k|    uint32_t size;
 1686|   210k|    size_t alloc_size;
 1687|   210k|    pb_byte_t *dest = (pb_byte_t*)field->pData;
 1688|       |
 1689|   210k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (1689:9): [True: 3, False: 210k]
  ------------------
 1690|      3|        return false;
 1691|       |
 1692|   210k|    if (size == (uint32_t)-1)
  ------------------
  |  Branch (1692:9): [True: 2, False: 210k]
  ------------------
 1693|      2|        PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  937|      2|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      2|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 2]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1694|       |
 1695|       |    /* Space for null terminator */
 1696|   210k|    alloc_size = (size_t)(size + 1);
 1697|       |
 1698|   210k|    if (alloc_size < size)
  ------------------
  |  Branch (1698:9): [True: 0, False: 210k]
  ------------------
 1699|      0|        PB_RETURN_ERROR(stream, "size too large");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1700|       |
 1701|   210k|    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|   210k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   210k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|   210k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (1701:9): [True: 0, False: 210k]
  ------------------
 1702|      0|    {
 1703|      0|#ifndef PB_ENABLE_MALLOC
 1704|      0|        PB_RETURN_ERROR(stream, "no malloc support");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1705|       |#else
 1706|       |        if (stream->bytes_left < size)
 1707|       |            PB_RETURN_ERROR(stream, "end-of-stream");
 1708|       |
 1709|       |        if (!allocate_field(stream, field->pData, alloc_size, 1))
 1710|       |            return false;
 1711|       |        dest = *(pb_byte_t**)field->pData;
 1712|       |#endif
 1713|      0|    }
 1714|   210k|    else
 1715|   210k|    {
 1716|   210k|        if (alloc_size > field->data_size)
  ------------------
  |  Branch (1716:13): [True: 89, False: 209k]
  ------------------
 1717|     89|            PB_RETURN_ERROR(stream, "string overflow");
  ------------------
  |  |  937|     89|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     89|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 89]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1718|   210k|    }
 1719|       |    
 1720|   209k|    dest[size] = 0;
 1721|       |
 1722|   209k|    if (!pb_read(stream, dest, (size_t)size))
  ------------------
  |  Branch (1722:9): [True: 8, False: 209k]
  ------------------
 1723|      8|        return false;
 1724|       |
 1725|       |#ifdef PB_VALIDATE_UTF8
 1726|       |    if (!pb_validate_utf8((const char*)dest))
 1727|       |        PB_RETURN_ERROR(stream, "invalid utf8");
 1728|       |#endif
 1729|       |
 1730|   209k|    return true;
 1731|   209k|}
pb_decode.c:pb_dec_submessage:
 1734|   302k|{
 1735|   302k|    bool status = true;
 1736|   302k|    bool submsg_consumed = false;
 1737|   302k|    pb_istream_t substream;
 1738|       |
 1739|   302k|    if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (1739:9): [True: 104, False: 302k]
  ------------------
 1740|    104|        return false;
 1741|       |    
 1742|   302k|    if (field->submsg_desc == NULL)
  ------------------
  |  Branch (1742:9): [True: 0, False: 302k]
  ------------------
 1743|      0|        PB_RETURN_ERROR(stream, "invalid field descriptor");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1744|       |    
 1745|       |    /* Submessages can have a separate message-level callback that is called
 1746|       |     * before decoding the message. Typically it is used to set callback fields
 1747|       |     * inside oneofs. */
 1748|   302k|    if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL)
  ------------------
  |  |  335|   302k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   302k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL)
  ------------------
  |  |  300|   604k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (1748:9): [True: 44.5k, False: 257k]
  |  Branch (1748:58): [True: 44.5k, False: 0]
  ------------------
 1749|  44.5k|    {
 1750|       |        /* Message callback is stored right before pSize. */
 1751|  44.5k|        pb_callback_t *callback = (pb_callback_t*)field->pSize - 1;
 1752|  44.5k|        if (callback->funcs.decode)
  ------------------
  |  Branch (1752:13): [True: 44.5k, False: 0]
  ------------------
 1753|  44.5k|        {
 1754|  44.5k|            status = callback->funcs.decode(&substream, field, &callback->arg);
 1755|       |
 1756|  44.5k|            if (substream.bytes_left == 0)
  ------------------
  |  Branch (1756:17): [True: 25.9k, False: 18.6k]
  ------------------
 1757|  25.9k|            {
 1758|  25.9k|                submsg_consumed = true;
 1759|  25.9k|            }
 1760|  44.5k|        }
 1761|  44.5k|    }
 1762|       |
 1763|       |    /* Now decode the submessage contents */
 1764|   302k|    if (status && !submsg_consumed)
  ------------------
  |  Branch (1764:9): [True: 302k, False: 0]
  |  Branch (1764:19): [True: 276k, False: 25.9k]
  ------------------
 1765|   276k|    {
 1766|   276k|        unsigned int flags = PB_DECODE_DELIMITED;
  ------------------
  |  |  123|   276k|#define PB_DECODE_DELIMITED       0x02U
  ------------------
 1767|       |
 1768|       |        /* Static required/optional fields are already initialized by top-level
 1769|       |         * pb_decode() and repeated/oneof fields by decode_static_field(), no
 1770|       |         * need to initialize them again. */
 1771|   276k|        if (PB_ATYPE(field->type) == PB_ATYPE_STATIC)
  ------------------
  |  |  333|   276k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   276k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                      if (PB_ATYPE(field->type) == PB_ATYPE_STATIC)
  ------------------
  |  |  328|   276k|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (1771:13): [True: 276k, False: 0]
  ------------------
 1772|   276k|        {
 1773|   276k|            flags |= PB_DECODE_NOINIT;
  ------------------
  |  |  122|   276k|#define PB_DECODE_NOINIT          0x01U
  ------------------
 1774|   276k|        }
 1775|       |
 1776|   276k|        status = pb_decode_inner(&substream, field->submsg_desc, field->pData, flags);
 1777|   276k|    }
 1778|       |    
 1779|   302k|    if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (1779:9): [True: 0, False: 302k]
  ------------------
 1780|      0|        return false;
 1781|       |
 1782|   302k|    return status;
 1783|   302k|}
pb_decode.c:pb_dec_fixed_length_bytes:
 1786|  27.8k|{
 1787|  27.8k|    uint32_t size;
 1788|       |
 1789|  27.8k|    if (!pb_decode_varint32(stream, &size))
  ------------------
  |  Branch (1789:9): [True: 4, False: 27.8k]
  ------------------
 1790|      4|        return false;
 1791|       |
 1792|  27.8k|    if (size > PB_SIZE_MAX)
  ------------------
  |  |  349|  27.8k|#define PB_SIZE_MAX ((pb_size_t)-1)
  ------------------
  |  Branch (1792:9): [True: 34, False: 27.8k]
  ------------------
 1793|     34|        PB_RETURN_ERROR(stream, "bytes overflow");
  ------------------
  |  |  937|     34|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     34|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 34]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1794|       |
 1795|  27.8k|    if (size == 0)
  ------------------
  |  Branch (1795:9): [True: 16.2k, False: 11.5k]
  ------------------
 1796|  16.2k|    {
 1797|       |        /* As a special case, treat empty bytes string as all zeros for fixed_length_bytes. */
 1798|  16.2k|        memset(field->pData, 0, (size_t)field->data_size);
 1799|  16.2k|        return true;
 1800|  16.2k|    }
 1801|       |
 1802|  11.5k|    if (size != field->data_size)
  ------------------
  |  Branch (1802:9): [True: 46, False: 11.5k]
  ------------------
 1803|     46|        PB_RETURN_ERROR(stream, "incorrect fixed length bytes size");
  ------------------
  |  |  937|     46|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|     46|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 46]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1804|       |
 1805|  11.5k|    return pb_read(stream, (pb_byte_t*)field->pData, (size_t)field->data_size);
 1806|  11.5k|}
pb_decode.c:decode_callback_field:
  821|  79.0k|{
  822|       |    /* Clear any data that may have been decoded for another oneof field
  823|       |     * that has come before this callback field.
  824|       |     */
  825|  79.0k|    if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  334|  79.0k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|  79.0k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  323|  79.0k|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (825:9): [True: 11.9k, False: 67.1k]
  ------------------
  826|  11.9k|    {
  827|  11.9k|        bool clear_data = (*(pb_size_t*)field->pSize != field->tag);
  828|       |
  829|       |#ifdef PB_ENABLE_UNSAFE_DECODE_ONEOF_CALLBACKS
  830|       |        if (*(pb_size_t*)field->pSize == 0) clear_data = false;
  831|       |#endif
  832|       |
  833|  11.9k|        if (clear_data)
  ------------------
  |  Branch (833:13): [True: 2.52k, False: 9.40k]
  ------------------
  834|  2.52k|        {
  835|  2.52k|            memset(field->pData, 0, (size_t)field->data_size);
  836|  2.52k|        }
  837|  11.9k|        *(pb_size_t*)field->pSize = field->tag;
  838|  11.9k|    }
  839|       |
  840|  79.0k|    if (!field->descriptor->field_callback)
  ------------------
  |  Branch (840:9): [True: 0, False: 79.0k]
  ------------------
  841|      0|        return pb_skip_field(stream, wire_type);
  842|       |
  843|  79.0k|    if (wire_type == PB_WT_STRING)
  ------------------
  |  Branch (843:9): [True: 63.3k, False: 15.7k]
  ------------------
  844|  63.3k|    {
  845|  63.3k|        pb_istream_t substream;
  846|  63.3k|        size_t prev_bytes_left;
  847|       |        
  848|  63.3k|        if (!pb_make_string_substream(stream, &substream))
  ------------------
  |  Branch (848:13): [True: 42, False: 63.2k]
  ------------------
  849|     42|            return false;
  850|       |
  851|       |        /* If the callback field is inside a submsg, first call the submsg_callback which
  852|       |         * should set the decoder for the callback field. */
  853|  63.2k|        if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL) {
  ------------------
  |  |  335|  63.2k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  63.2k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL) {
  ------------------
  |  |  300|   126k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (853:13): [True: 0, False: 63.2k]
  |  Branch (853:62): [True: 0, False: 0]
  ------------------
  854|      0|            pb_callback_t* callback;
  855|      0|            *(pb_size_t*)field->pSize = field->tag;
  856|      0|            callback = (pb_callback_t*)field->pSize - 1;
  857|       |
  858|      0|            if (callback->funcs.decode)
  ------------------
  |  Branch (858:17): [True: 0, False: 0]
  ------------------
  859|      0|            {
  860|      0|                if (!callback->funcs.decode(&substream, field, &callback->arg)) {
  ------------------
  |  Branch (860:21): [True: 0, False: 0]
  ------------------
  861|      0|                    PB_SET_ERROR(stream, substream.errmsg ? substream.errmsg : "submsg callback failed");
  ------------------
  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  ------------------
  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  Branch (933:92): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  862|      0|                    return false;
  863|      0|                }
  864|      0|            }
  865|      0|        }
  866|       |        
  867|  63.2k|        do
  868|  63.2k|        {
  869|  63.2k|            prev_bytes_left = substream.bytes_left;
  870|  63.2k|            if (!field->descriptor->field_callback(&substream, NULL, field))
  ------------------
  |  Branch (870:17): [True: 0, False: 63.2k]
  ------------------
  871|      0|            {
  872|      0|                PB_SET_ERROR(stream, substream.errmsg ? substream.errmsg : "callback failed");
  ------------------
  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  ------------------
  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  Branch (933:92): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  873|      0|                return false;
  874|      0|            }
  875|  63.2k|        } while (substream.bytes_left > 0 && substream.bytes_left < prev_bytes_left);
  ------------------
  |  Branch (875:18): [True: 23.6k, False: 39.6k]
  |  Branch (875:46): [True: 0, False: 23.6k]
  ------------------
  876|       |        
  877|  63.2k|        if (!pb_close_string_substream(stream, &substream))
  ------------------
  |  Branch (877:13): [True: 0, False: 63.2k]
  ------------------
  878|      0|            return false;
  879|       |
  880|  63.2k|        return true;
  881|  63.2k|    }
  882|  15.7k|    else
  883|  15.7k|    {
  884|       |        /* Copy the single scalar value to stack.
  885|       |         * This is required so that we can limit the stream length,
  886|       |         * which in turn allows to use same callback for packed and
  887|       |         * not-packed fields. */
  888|  15.7k|        pb_istream_t substream;
  889|  15.7k|        pb_byte_t buffer[10];
  890|  15.7k|        size_t size = sizeof(buffer);
  891|       |        
  892|  15.7k|        if (!read_raw_value(stream, wire_type, buffer, &size))
  ------------------
  |  Branch (892:13): [True: 35, False: 15.7k]
  ------------------
  893|     35|            return false;
  894|  15.7k|        substream = pb_istream_from_buffer(buffer, size);
  895|       |        
  896|       |        return field->descriptor->field_callback(&substream, NULL, field);
  897|  15.7k|    }
  898|  79.0k|}
pb_decode.c:read_raw_value:
  347|  15.7k|{
  348|  15.7k|    size_t max_size = *size;
  349|  15.7k|    switch (wire_type)
  350|  15.7k|    {
  351|  10.3k|        case PB_WT_VARINT:
  ------------------
  |  Branch (351:9): [True: 10.3k, False: 5.40k]
  ------------------
  352|  10.3k|            *size = 0;
  353|  10.3k|            do
  354|  23.4k|            {
  355|  23.4k|                (*size)++;
  356|  23.4k|                if (*size > max_size)
  ------------------
  |  Branch (356:21): [True: 3, False: 23.4k]
  ------------------
  357|      3|                    PB_RETURN_ERROR(stream, "varint overflow");
  ------------------
  |  |  937|      3|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      3|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 3]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  358|       |
  359|  23.4k|                if (!pb_read(stream, buf, 1))
  ------------------
  |  Branch (359:21): [True: 20, False: 23.4k]
  ------------------
  360|     20|                    return false;
  361|  23.4k|            } while (*buf++ & 0x80);
  ------------------
  |  Branch (361:22): [True: 13.1k, False: 10.3k]
  ------------------
  362|  10.3k|            return true;
  363|       |            
  364|  3.79k|        case PB_WT_64BIT:
  ------------------
  |  Branch (364:9): [True: 3.79k, False: 11.9k]
  ------------------
  365|  3.79k|            *size = 8;
  366|  3.79k|            return pb_read(stream, buf, 8);
  367|       |        
  368|  1.61k|        case PB_WT_32BIT:
  ------------------
  |  Branch (368:9): [True: 1.61k, False: 14.1k]
  ------------------
  369|  1.61k|            *size = 4;
  370|  1.61k|            return pb_read(stream, buf, 4);
  371|       |        
  372|      0|        case PB_WT_STRING:
  ------------------
  |  Branch (372:9): [True: 0, False: 15.7k]
  ------------------
  373|       |            /* Calling read_raw_value with a PB_WT_STRING is an error.
  374|       |             * Explicitly handle this case and fallthrough to default to avoid
  375|       |             * compiler warnings.
  376|       |             */
  377|       |
  378|      0|	case PB_WT_PACKED: 
  ------------------
  |  Branch (378:2): [True: 0, False: 15.7k]
  ------------------
  379|       |            /* Calling read_raw_value with a PB_WT_PACKED is an error.
  380|       |             * Explicitly handle this case and fallthrough to default to avoid
  381|       |             * compiler warnings.
  382|       |             */
  383|       |
  384|      1|        default: PB_RETURN_ERROR(stream, "invalid wire_type");
  ------------------
  |  |  937|      1|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      1|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 1]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (384:9): [True: 1, False: 15.7k]
  ------------------
  385|  15.7k|    }
  386|  15.7k|}

pb_ostream_from_buffer:
   73|  2.57k|{
   74|  2.57k|    pb_ostream_t stream;
   75|       |#ifdef PB_BUFFER_ONLY
   76|       |    /* In PB_BUFFER_ONLY configuration the callback pointer is just int*.
   77|       |     * NULL pointer marks a sizing field, so put a non-NULL value to mark a buffer stream.
   78|       |     */
   79|       |    static const int marker = 0;
   80|       |    stream.callback = &marker;
   81|       |#else
   82|  2.57k|    stream.callback = &buf_write;
   83|  2.57k|#endif
   84|  2.57k|    stream.state = buf;
   85|  2.57k|    stream.max_size = bufsize;
   86|  2.57k|    stream.bytes_written = 0;
   87|  2.57k|#ifndef PB_NO_ERRMSG
   88|       |    stream.errmsg = NULL;
   89|  2.57k|#endif
   90|  2.57k|    return stream;
   91|  2.57k|}
pb_write:
   94|   486k|{
   95|   486k|    if (count > 0 && stream->callback != NULL)
  ------------------
  |  Branch (95:9): [True: 473k, False: 13.1k]
  |  Branch (95:22): [True: 327k, False: 146k]
  ------------------
   96|   327k|    {
   97|   327k|        if (stream->bytes_written + count < stream->bytes_written ||
  ------------------
  |  Branch (97:13): [True: 0, False: 327k]
  ------------------
   98|   327k|            stream->bytes_written + count > stream->max_size)
  ------------------
  |  Branch (98:13): [True: 0, False: 327k]
  ------------------
   99|      0|        {
  100|      0|            PB_RETURN_ERROR(stream, "stream full");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  101|      0|        }
  102|       |
  103|       |#ifdef PB_BUFFER_ONLY
  104|       |        if (!buf_write(stream, buf, count))
  105|       |            PB_RETURN_ERROR(stream, "io error");
  106|       |#else        
  107|   327k|        if (!stream->callback(stream, buf, count))
  ------------------
  |  Branch (107:13): [True: 0, False: 327k]
  ------------------
  108|      0|            PB_RETURN_ERROR(stream, "io error");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  109|   327k|#endif
  110|   327k|    }
  111|       |    
  112|   486k|    stream->bytes_written += count;
  113|       |    return true;
  114|   486k|}
pb_encode:
  522|  41.0k|{
  523|  41.0k|    pb_field_iter_t iter;
  524|  41.0k|    if (!pb_field_iter_begin_const(&iter, fields, src_struct))
  ------------------
  |  Branch (524:9): [True: 7.67k, False: 33.4k]
  ------------------
  525|  7.67k|        return true; /* Empty message type */
  526|       |    
  527|   319k|    do {
  528|   319k|        if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  335|   319k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   319k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(iter.type) == PB_LTYPE_EXTENSION)
  ------------------
  |  |  304|   319k|#define PB_LTYPE_EXTENSION 0x0AU
  ------------------
  |  Branch (528:13): [True: 2.57k, False: 316k]
  ------------------
  529|  2.57k|        {
  530|       |            /* Special case for the extension field placeholder */
  531|  2.57k|            if (!encode_extension_field(stream, &iter))
  ------------------
  |  Branch (531:17): [True: 0, False: 2.57k]
  ------------------
  532|      0|                return false;
  533|  2.57k|        }
  534|   316k|        else
  535|   316k|        {
  536|       |            /* Regular field */
  537|   316k|            if (!encode_field(stream, &iter))
  ------------------
  |  Branch (537:17): [True: 0, False: 316k]
  ------------------
  538|      0|                return false;
  539|   316k|        }
  540|   319k|    } while (pb_field_iter_next(&iter));
  ------------------
  |  Branch (540:14): [True: 285k, False: 33.4k]
  ------------------
  541|       |    
  542|  33.4k|    return true;
  543|  33.4k|}
pb_encode_varint:
  617|   432k|{
  618|   432k|    if (value <= 0x7F)
  ------------------
  |  Branch (618:9): [True: 357k, False: 75.5k]
  ------------------
  619|   357k|    {
  620|       |        /* Fast path: single byte */
  621|   357k|        pb_byte_t byte = (pb_byte_t)value;
  622|   357k|        return pb_write(stream, &byte, 1);
  623|   357k|    }
  624|  75.5k|    else
  625|  75.5k|    {
  626|       |#ifdef PB_WITHOUT_64BIT
  627|       |        return pb_encode_varint_32(stream, value, 0);
  628|       |#else
  629|  75.5k|        return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)(value >> 32));
  630|  75.5k|#endif
  631|  75.5k|    }
  632|   432k|}
pb_encode_svarint:
  635|  22.1k|{
  636|  22.1k|    pb_uint64_t zigzagged;
  ------------------
  |  |   46|  22.1k|#define pb_uint64_t uint64_t
  ------------------
  637|  22.1k|    pb_uint64_t mask = ((pb_uint64_t)-1) >> 1; /* Satisfy clang -fsanitize=integer */
  ------------------
  |  |   46|  22.1k|#define pb_uint64_t uint64_t
  ------------------
  638|  22.1k|    if (value < 0)
  ------------------
  |  Branch (638:9): [True: 9.37k, False: 12.7k]
  ------------------
  639|  9.37k|        zigzagged = ~(((pb_uint64_t)value & mask) << 1);
  640|  12.7k|    else
  641|  12.7k|        zigzagged = (pb_uint64_t)value << 1;
  642|       |    
  643|  22.1k|    return pb_encode_varint(stream, zigzagged);
  644|  22.1k|}
pb_encode_fixed32:
  647|  19.9k|{
  648|  19.9k|#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
  649|       |    /* Fast path if we know that we're on little endian */
  650|  19.9k|    return pb_write(stream, (const pb_byte_t*)value, 4);
  651|       |#else
  652|       |    uint32_t val = *(const uint32_t*)value;
  653|       |    pb_byte_t bytes[4];
  654|       |    bytes[0] = (pb_byte_t)(val & 0xFF);
  655|       |    bytes[1] = (pb_byte_t)((val >> 8) & 0xFF);
  656|       |    bytes[2] = (pb_byte_t)((val >> 16) & 0xFF);
  657|       |    bytes[3] = (pb_byte_t)((val >> 24) & 0xFF);
  658|       |    return pb_write(stream, bytes, 4);
  659|       |#endif
  660|  19.9k|}
pb_encode_fixed64:
  664|  11.4k|{
  665|  11.4k|#if defined(PB_LITTLE_ENDIAN_8BIT) && PB_LITTLE_ENDIAN_8BIT == 1
  666|       |    /* Fast path if we know that we're on little endian */
  667|  11.4k|    return pb_write(stream, (const pb_byte_t*)value, 8);
  668|       |#else
  669|       |    uint64_t val = *(const uint64_t*)value;
  670|       |    pb_byte_t bytes[8];
  671|       |    bytes[0] = (pb_byte_t)(val & 0xFF);
  672|       |    bytes[1] = (pb_byte_t)((val >> 8) & 0xFF);
  673|       |    bytes[2] = (pb_byte_t)((val >> 16) & 0xFF);
  674|       |    bytes[3] = (pb_byte_t)((val >> 24) & 0xFF);
  675|       |    bytes[4] = (pb_byte_t)((val >> 32) & 0xFF);
  676|       |    bytes[5] = (pb_byte_t)((val >> 40) & 0xFF);
  677|       |    bytes[6] = (pb_byte_t)((val >> 48) & 0xFF);
  678|       |    bytes[7] = (pb_byte_t)((val >> 56) & 0xFF);
  679|       |    return pb_write(stream, bytes, 8);
  680|       |#endif
  681|  11.4k|}
pb_encode_tag:
  685|   202k|{
  686|   202k|    pb_uint64_t tag = ((pb_uint64_t)field_number << 3) | wiretype;
  ------------------
  |  |   46|   202k|#define pb_uint64_t uint64_t
  ------------------
  687|   202k|    return pb_encode_varint(stream, tag);
  688|   202k|}
pb_encode_tag_for_field:
  691|   194k|{
  692|   194k|    pb_wire_type_t wiretype;
  693|   194k|    switch (PB_LTYPE(field->type))
  ------------------
  |  |  335|   194k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   194k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
  694|   194k|    {
  695|  2.71k|        case PB_LTYPE_BOOL:
  ------------------
  |  |  275|  2.71k|#define PB_LTYPE_BOOL    0x00U /* bool */
  ------------------
  |  Branch (695:9): [True: 2.71k, False: 191k]
  ------------------
  696|  77.5k|        case PB_LTYPE_VARINT:
  ------------------
  |  |  276|  77.5k|#define PB_LTYPE_VARINT  0x01U /* int32, int64, enum, bool */
  ------------------
  |  Branch (696:9): [True: 74.8k, False: 119k]
  ------------------
  697|   117k|        case PB_LTYPE_UVARINT:
  ------------------
  |  |  277|   117k|#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
  ------------------
  |  Branch (697:9): [True: 39.4k, False: 154k]
  ------------------
  698|   132k|        case PB_LTYPE_SVARINT:
  ------------------
  |  |  278|   132k|#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
  ------------------
  |  Branch (698:9): [True: 15.7k, False: 178k]
  ------------------
  699|   132k|            wiretype = PB_WT_VARINT;
  700|   132k|            break;
  701|       |        
  702|  10.9k|        case PB_LTYPE_FIXED32:
  ------------------
  |  |  279|  10.9k|#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
  ------------------
  |  Branch (702:9): [True: 10.9k, False: 183k]
  ------------------
  703|  10.9k|            wiretype = PB_WT_32BIT;
  704|  10.9k|            break;
  705|       |        
  706|  8.69k|        case PB_LTYPE_FIXED64:
  ------------------
  |  |  280|  8.69k|#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
  ------------------
  |  Branch (706:9): [True: 8.69k, False: 185k]
  ------------------
  707|  8.69k|            wiretype = PB_WT_64BIT;
  708|  8.69k|            break;
  709|       |        
  710|  3.78k|        case PB_LTYPE_BYTES:
  ------------------
  |  |  287|  3.78k|#define PB_LTYPE_BYTES 0x06U
  ------------------
  |  Branch (710:9): [True: 3.78k, False: 190k]
  ------------------
  711|  18.5k|        case PB_LTYPE_STRING:
  ------------------
  |  |  291|  18.5k|#define PB_LTYPE_STRING 0x07U
  ------------------
  |  Branch (711:9): [True: 14.7k, False: 179k]
  ------------------
  712|  37.7k|        case PB_LTYPE_SUBMESSAGE:
  ------------------
  |  |  295|  37.7k|#define PB_LTYPE_SUBMESSAGE 0x08U
  ------------------
  |  Branch (712:9): [True: 19.2k, False: 174k]
  ------------------
  713|  37.7k|        case PB_LTYPE_SUBMSG_W_CB:
  ------------------
  |  |  300|  37.7k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (713:9): [True: 0, False: 194k]
  ------------------
  714|  41.7k|        case PB_LTYPE_FIXED_LENGTH_BYTES:
  ------------------
  |  |  310|  41.7k|#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0BU
  ------------------
  |  Branch (714:9): [True: 3.97k, False: 190k]
  ------------------
  715|  41.7k|            wiretype = PB_WT_STRING;
  716|  41.7k|            break;
  717|       |        
  718|      0|        default:
  ------------------
  |  Branch (718:9): [True: 0, False: 194k]
  ------------------
  719|      0|            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  720|   194k|    }
  721|       |    
  722|   194k|    return pb_encode_tag(stream, wiretype, field->tag);
  723|   194k|}
pb_encode_string:
  726|  22.4k|{
  727|  22.4k|    if (!pb_encode_varint(stream, (pb_uint64_t)size))
  ------------------
  |  Branch (727:9): [True: 0, False: 22.4k]
  ------------------
  728|      0|        return false;
  729|       |    
  730|  22.4k|    return pb_write(stream, buffer, size);
  731|  22.4k|}
pb_encode_submessage:
  734|  19.2k|{
  735|       |    /* First calculate the message size using a non-writing substream. */
  736|  19.2k|    pb_ostream_t substream = PB_OSTREAM_SIZING;
  ------------------
  |  |  126|  19.2k|#define PB_OSTREAM_SIZING {0,0,0,0,0}
  ------------------
  737|  19.2k|#if !defined(PB_NO_ENCODE_SIZE_CHECK) || PB_NO_ENCODE_SIZE_CHECK == 0
  738|  19.2k|    bool status;
  739|  19.2k|    size_t size;
  740|  19.2k|#endif
  741|       |    
  742|  19.2k|    if (!pb_encode(&substream, fields, src_struct))
  ------------------
  |  Branch (742:9): [True: 0, False: 19.2k]
  ------------------
  743|      0|    {
  744|      0|#ifndef PB_NO_ERRMSG
  745|      0|        stream->errmsg = substream.errmsg;
  746|      0|#endif
  747|      0|        return false;
  748|      0|    }
  749|       |    
  750|  19.2k|    if (!pb_encode_varint(stream, (pb_uint64_t)substream.bytes_written))
  ------------------
  |  Branch (750:9): [True: 0, False: 19.2k]
  ------------------
  751|      0|        return false;
  752|       |    
  753|  19.2k|    if (stream->callback == NULL)
  ------------------
  |  Branch (753:9): [True: 0, False: 19.2k]
  ------------------
  754|      0|        return pb_write(stream, NULL, substream.bytes_written); /* Just sizing */
  755|       |    
  756|  19.2k|    if (stream->bytes_written + substream.bytes_written > stream->max_size)
  ------------------
  |  Branch (756:9): [True: 0, False: 19.2k]
  ------------------
  757|      0|        PB_RETURN_ERROR(stream, "stream full");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  758|       |        
  759|       |#if defined(PB_NO_ENCODE_SIZE_CHECK) && PB_NO_ENCODE_SIZE_CHECK == 1
  760|       |    return pb_encode(stream, fields, src_struct);
  761|       |#else
  762|  19.2k|    size = substream.bytes_written;
  763|       |    /* Use a substream to verify that a callback doesn't write more than
  764|       |     * what it did the first time. */
  765|  19.2k|    substream.callback = stream->callback;
  766|  19.2k|    substream.state = stream->state;
  767|  19.2k|    substream.max_size = size;
  768|  19.2k|    substream.bytes_written = 0;
  769|  19.2k|#ifndef PB_NO_ERRMSG
  770|  19.2k|    substream.errmsg = NULL;
  771|  19.2k|#endif
  772|       |    
  773|  19.2k|    status = pb_encode(&substream, fields, src_struct);
  774|       |    
  775|  19.2k|    stream->bytes_written += substream.bytes_written;
  776|  19.2k|    stream->state = substream.state;
  777|  19.2k|#ifndef PB_NO_ERRMSG
  778|  19.2k|    stream->errmsg = substream.errmsg;
  779|  19.2k|#endif
  780|       |    
  781|  19.2k|    if (substream.bytes_written != size)
  ------------------
  |  Branch (781:9): [True: 0, False: 19.2k]
  ------------------
  782|      0|        PB_RETURN_ERROR(stream, "submsg size changed");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  783|       |
  784|  19.2k|    return status;
  785|  19.2k|#endif
  786|  19.2k|}
pb_encode.c:buf_write:
   54|   327k|{
   55|   327k|    pb_byte_t *dest = (pb_byte_t*)stream->state;
   56|   327k|    stream->state = dest + count;
   57|       |
   58|       |    /* Skip the copy if buf is NULL. Callers should not invoke this with NULL,
   59|       |     * but pb_write may pass NULL for sizing passes. Some compilers
   60|       |     * (e.g. picolibc/arm-zephyr-eabi GCC 12.2) emit a -Wnonnull warning
   61|       |     * against memcpy's nonnull argument even though count would be 0 in
   62|       |     * that case. See #1141.
   63|       |     */
   64|   327k|    if (buf != NULL)
  ------------------
  |  Branch (64:9): [True: 327k, False: 0]
  ------------------
   65|   327k|    {
   66|   327k|        memcpy(dest, buf, count * sizeof(pb_byte_t));
   67|   327k|    }
   68|       |
   69|       |    return true;
   70|   327k|}
pb_encode.c:encode_extension_field:
  497|  2.57k|{
  498|  2.57k|    const pb_extension_t *extension = *(const pb_extension_t* const *)field->pData;
  499|       |
  500|  5.15k|    while (extension)
  ------------------
  |  Branch (500:12): [True: 2.57k, False: 2.57k]
  ------------------
  501|  2.57k|    {
  502|  2.57k|        bool status;
  503|  2.57k|        if (extension->type->encode)
  ------------------
  |  Branch (503:13): [True: 0, False: 2.57k]
  ------------------
  504|      0|            status = extension->type->encode(stream, extension);
  505|  2.57k|        else
  506|  2.57k|            status = default_extension_encoder(stream, extension);
  507|       |
  508|  2.57k|        if (!status)
  ------------------
  |  Branch (508:13): [True: 0, False: 2.57k]
  ------------------
  509|      0|            return false;
  510|       |        
  511|  2.57k|        extension = extension->next;
  512|  2.57k|    }
  513|       |    
  514|  2.57k|    return true;
  515|  2.57k|}
pb_encode.c:default_extension_encoder:
  484|  2.57k|{
  485|  2.57k|    pb_field_iter_t iter;
  486|       |
  487|  2.57k|    if (!pb_field_iter_begin_extension_const(&iter, extension))
  ------------------
  |  Branch (487:9): [True: 0, False: 2.57k]
  ------------------
  488|      0|        PB_RETURN_ERROR(stream, "invalid extension");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  489|       |
  490|  2.57k|    return encode_field(stream, &iter);
  491|  2.57k|}
pb_encode.c:encode_field:
  428|   319k|{
  429|       |    /* Check field presence */
  430|   319k|    if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  334|   319k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   319k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(field->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  323|   319k|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (430:9): [True: 18.0k, False: 301k]
  ------------------
  431|  18.0k|    {
  432|  18.0k|        if (*(const pb_size_t*)field->pSize != field->tag)
  ------------------
  |  Branch (432:13): [True: 17.1k, False: 877]
  ------------------
  433|  17.1k|        {
  434|       |            /* Different type oneof field */
  435|  17.1k|            return true;
  436|  17.1k|        }
  437|  18.0k|    }
  438|   301k|    else if (PB_HTYPE(field->type) == PB_HTYPE_OPTIONAL)
  ------------------
  |  |  334|   301k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   301k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  else if (PB_HTYPE(field->type) == PB_HTYPE_OPTIONAL)
  ------------------
  |  |  319|   301k|#define PB_HTYPE_OPTIONAL 0x10U
  ------------------
  |  Branch (438:14): [True: 66.9k, False: 234k]
  ------------------
  439|  66.9k|    {
  440|  66.9k|        if (field->pSize)
  ------------------
  |  Branch (440:13): [True: 66.9k, False: 0]
  ------------------
  441|  66.9k|        {
  442|  66.9k|            if (safe_read_bool(field->pSize) == false)
  ------------------
  |  Branch (442:17): [True: 59.4k, False: 7.45k]
  ------------------
  443|  59.4k|            {
  444|       |                /* Missing optional field */
  445|  59.4k|                return true;
  446|  59.4k|            }
  447|  66.9k|        }
  448|      0|        else if (PB_ATYPE(field->type) == PB_ATYPE_STATIC)
  ------------------
  |  |  333|      0|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|      0|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                      else if (PB_ATYPE(field->type) == PB_ATYPE_STATIC)
  ------------------
  |  |  328|      0|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (448:18): [True: 0, False: 0]
  ------------------
  449|      0|        {
  450|       |            /* Proto3 singular field */
  451|      0|            if (pb_check_proto3_default_value(field))
  ------------------
  |  Branch (451:17): [True: 0, False: 0]
  ------------------
  452|      0|                return true;
  453|      0|        }
  454|  66.9k|    }
  455|       |
  456|   242k|    if (!field->pData)
  ------------------
  |  Branch (456:9): [True: 0, False: 242k]
  ------------------
  457|      0|    {
  458|      0|        if (PB_HTYPE(field->type) == PB_HTYPE_REQUIRED)
  ------------------
  |  |  334|      0|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|      0|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                      if (PB_HTYPE(field->type) == PB_HTYPE_REQUIRED)
  ------------------
  |  |  318|      0|#define PB_HTYPE_REQUIRED 0x00U
  ------------------
  |  Branch (458:13): [True: 0, False: 0]
  ------------------
  459|      0|            PB_RETURN_ERROR(stream, "missing required field");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  460|       |
  461|       |        /* Pointer field set to NULL */
  462|      0|        return true;
  463|      0|    }
  464|       |
  465|       |    /* Then encode field contents */
  466|   242k|    if (PB_ATYPE(field->type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  333|   242k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   242k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_CALLBACK)
  ------------------
  |  |  330|   242k|#define PB_ATYPE_CALLBACK 0x40U
  ------------------
  |  Branch (466:9): [True: 133, False: 242k]
  ------------------
  467|    133|    {
  468|    133|        return encode_callback_field(stream, field);
  469|    133|    }
  470|   242k|    else if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  334|   242k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   242k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  else if (PB_HTYPE(field->type) == PB_HTYPE_REPEATED)
  ------------------
  |  |  321|   242k|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (470:14): [True: 54.1k, False: 188k]
  ------------------
  471|  54.1k|    {
  472|  54.1k|        return encode_array(stream, field);
  473|  54.1k|    }
  474|   188k|    else
  475|   188k|    {
  476|   188k|        return encode_basic_field(stream, field);
  477|   188k|    }
  478|   242k|}
pb_encode.c:safe_read_bool:
  125|  69.6k|{
  126|  69.6k|    const char *p = (const char *)pSize;
  127|  69.6k|    size_t i;
  128|   129k|    for (i = 0; i < sizeof(bool); i++)
  ------------------
  |  Branch (128:17): [True: 69.6k, False: 60.2k]
  ------------------
  129|  69.6k|    {
  130|  69.6k|        if (p[i] != 0)
  ------------------
  |  Branch (130:13): [True: 9.40k, False: 60.2k]
  ------------------
  131|  9.40k|            return true;
  132|  69.6k|    }
  133|  60.2k|    return false;
  134|  69.6k|}
pb_encode.c:encode_callback_field:
  417|    133|{
  418|    133|    if (field->descriptor->field_callback != NULL)
  ------------------
  |  Branch (418:9): [True: 133, False: 0]
  ------------------
  419|    133|    {
  420|    133|        if (!field->descriptor->field_callback(NULL, stream, field))
  ------------------
  |  Branch (420:13): [True: 0, False: 133]
  ------------------
  421|      0|            PB_RETURN_ERROR(stream, "callback error");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  422|    133|    }
  423|    133|    return true;
  424|    133|}
pb_encode.c:encode_array:
  138|  54.1k|{
  139|  54.1k|    pb_size_t i;
  140|  54.1k|    pb_size_t count;
  141|  54.1k|#ifndef PB_ENCODE_ARRAYS_UNPACKED
  142|  54.1k|    size_t size;
  143|  54.1k|#endif
  144|       |
  145|  54.1k|    count = *(pb_size_t*)field->pSize;
  146|       |
  147|  54.1k|    if (count == 0)
  ------------------
  |  Branch (147:9): [True: 43.7k, False: 10.4k]
  ------------------
  148|  43.7k|        return true;
  149|       |
  150|  10.4k|    if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size)
  ------------------
  |  |  333|  10.4k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  10.4k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) != PB_ATYPE_POINTER && count > field->array_size)
  ------------------
  |  |  329|  20.8k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (150:9): [True: 10.4k, False: 0]
  |  Branch (150:54): [True: 0, False: 10.4k]
  ------------------
  151|      0|        PB_RETURN_ERROR(stream, "array max size exceeded");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  152|       |    
  153|  10.4k|#ifndef PB_ENCODE_ARRAYS_UNPACKED
  154|       |    /* We always pack arrays if the datatype allows it. */
  155|  10.4k|    if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  335|  10.4k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  10.4k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(field->type) <= PB_LTYPE_LAST_PACKABLE)
  ------------------
  |  |  283|  10.4k|#define PB_LTYPE_LAST_PACKABLE 0x05U
  ------------------
  |  Branch (155:9): [True: 8.83k, False: 1.57k]
  ------------------
  156|  8.83k|    {
  157|  8.83k|        if (!pb_encode_tag(stream, PB_WT_STRING, field->tag))
  ------------------
  |  Branch (157:13): [True: 0, False: 8.83k]
  ------------------
  158|      0|            return false;
  159|       |        
  160|       |        /* Determine the total size of packed array. */
  161|  8.83k|        if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32)
  ------------------
  |  |  335|  8.83k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  8.83k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32)
  ------------------
  |  |  279|  8.83k|#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
  ------------------
  |  Branch (161:13): [True: 3.07k, False: 5.76k]
  ------------------
  162|  3.07k|        {
  163|  3.07k|            size = 4 * (size_t)count;
  164|  3.07k|        }
  165|  5.76k|        else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  335|  5.76k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  5.76k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      else if (PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  280|  5.76k|#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
  ------------------
  |  Branch (165:18): [True: 732, False: 5.03k]
  ------------------
  166|    732|        {
  167|    732|            size = 8 * (size_t)count;
  168|    732|        }
  169|  5.03k|        else
  170|  5.03k|        { 
  171|  5.03k|            pb_ostream_t sizestream = PB_OSTREAM_SIZING;
  ------------------
  |  |  126|  5.03k|#define PB_OSTREAM_SIZING {0,0,0,0,0}
  ------------------
  172|  5.03k|            void *pData_orig = field->pData;
  173|  28.2k|            for (i = 0; i < count; i++)
  ------------------
  |  Branch (173:25): [True: 23.2k, False: 5.03k]
  ------------------
  174|  23.2k|            {
  175|  23.2k|                if (!pb_enc_varint(&sizestream, field))
  ------------------
  |  Branch (175:21): [True: 0, False: 23.2k]
  ------------------
  176|      0|                    PB_RETURN_ERROR(stream, PB_GET_ERROR(&sizestream));
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  |  Branch (933:92): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  177|  23.2k|                field->pData = (char*)field->pData + field->data_size;
  178|  23.2k|            }
  179|  5.03k|            field->pData = pData_orig;
  180|  5.03k|            size = sizestream.bytes_written;
  181|  5.03k|        }
  182|       |        
  183|  8.83k|        if (!pb_encode_varint(stream, (pb_uint64_t)size))
  ------------------
  |  Branch (183:13): [True: 0, False: 8.83k]
  ------------------
  184|      0|            return false;
  185|       |        
  186|  8.83k|        if (stream->callback == NULL)
  ------------------
  |  Branch (186:13): [True: 0, False: 8.83k]
  ------------------
  187|      0|            return pb_write(stream, NULL, size); /* Just sizing.. */
  188|       |        
  189|       |        /* Write the data */
  190|  43.9k|        for (i = 0; i < count; i++)
  ------------------
  |  Branch (190:21): [True: 35.0k, False: 8.83k]
  ------------------
  191|  35.0k|        {
  192|  35.0k|            if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32 || PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  335|  35.0k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  35.0k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32 || PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  279|  70.1k|#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
  ------------------
                          if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32 || PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  335|  26.0k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  26.0k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                          if (PB_LTYPE(field->type) == PB_LTYPE_FIXED32 || PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  ------------------
  |  |  280|  26.0k|#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
  ------------------
  |  Branch (192:17): [True: 9.02k, False: 26.0k]
  |  Branch (192:62): [True: 2.79k, False: 23.2k]
  ------------------
  193|  11.8k|            {
  194|  11.8k|                if (!pb_enc_fixed(stream, field))
  ------------------
  |  Branch (194:21): [True: 0, False: 11.8k]
  ------------------
  195|      0|                    return false;
  196|  11.8k|            }
  197|  23.2k|            else
  198|  23.2k|            {
  199|  23.2k|                if (!pb_enc_varint(stream, field))
  ------------------
  |  Branch (199:21): [True: 0, False: 23.2k]
  ------------------
  200|      0|                    return false;
  201|  23.2k|            }
  202|       |
  203|  35.0k|            field->pData = (char*)field->pData + field->data_size;
  204|  35.0k|        }
  205|  8.83k|    }
  206|  1.57k|    else /* Unpacked fields */
  207|  1.57k|#endif
  208|  1.57k|    {
  209|  7.37k|        for (i = 0; i < count; i++)
  ------------------
  |  Branch (209:21): [True: 5.79k, False: 1.57k]
  ------------------
  210|  5.79k|        {
  211|       |            /* Normally the data is stored directly in the array entries, but
  212|       |             * for pointer-type string and bytes fields, the array entries are
  213|       |             * actually pointers themselves also. So we have to dereference once
  214|       |             * more to get to the actual data. */
  215|  5.79k|            if (PB_ATYPE(field->type) == PB_ATYPE_POINTER &&
  ------------------
  |  |  333|  5.79k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  5.79k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                          if (PB_ATYPE(field->type) == PB_ATYPE_POINTER &&
  ------------------
  |  |  329|  11.5k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (215:17): [True: 0, False: 5.79k]
  ------------------
  216|      0|                (PB_LTYPE(field->type) == PB_LTYPE_STRING ||
  ------------------
  |  |  335|      0|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|      0|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                              (PB_LTYPE(field->type) == PB_LTYPE_STRING ||
  ------------------
  |  |  291|      0|#define PB_LTYPE_STRING 0x07U
  ------------------
  |  Branch (216:18): [True: 0, False: 0]
  ------------------
  217|      0|                 PB_LTYPE(field->type) == PB_LTYPE_BYTES))
  ------------------
  |  |  335|      0|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|      0|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                               PB_LTYPE(field->type) == PB_LTYPE_BYTES))
  ------------------
  |  |  287|      0|#define PB_LTYPE_BYTES 0x06U
  ------------------
  |  Branch (217:18): [True: 0, False: 0]
  ------------------
  218|      0|            {
  219|      0|                bool status;
  220|      0|                void *pData_orig = field->pData;
  221|      0|                field->pData = *(void* const*)field->pData;
  222|       |
  223|      0|                if (!field->pData)
  ------------------
  |  Branch (223:21): [True: 0, False: 0]
  ------------------
  224|      0|                {
  225|       |                    /* Null pointer in array is treated as empty string / bytes */
  226|      0|                    status = pb_encode_tag_for_field(stream, field) &&
  ------------------
  |  Branch (226:30): [True: 0, False: 0]
  ------------------
  227|      0|                             pb_encode_varint(stream, 0);
  ------------------
  |  Branch (227:30): [True: 0, False: 0]
  ------------------
  228|      0|                }
  229|      0|                else
  230|      0|                {
  231|      0|                    status = encode_basic_field(stream, field);
  232|      0|                }
  233|       |
  234|      0|                field->pData = pData_orig;
  235|       |
  236|      0|                if (!status)
  ------------------
  |  Branch (236:21): [True: 0, False: 0]
  ------------------
  237|      0|                    return false;
  238|      0|            }
  239|  5.79k|            else
  240|  5.79k|            {
  241|  5.79k|                if (!encode_basic_field(stream, field))
  ------------------
  |  Branch (241:21): [True: 0, False: 5.79k]
  ------------------
  242|      0|                    return false;
  243|  5.79k|            }
  244|  5.79k|            field->pData = (char*)field->pData + field->data_size;
  245|  5.79k|        }
  246|  1.57k|    }
  247|       |    
  248|  10.4k|    return true;
  249|  10.4k|}
pb_encode.c:pb_enc_varint:
  798|   176k|{
  799|   176k|    if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT)
  ------------------
  |  |  335|   176k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   176k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(field->type) == PB_LTYPE_UVARINT)
  ------------------
  |  |  277|   176k|#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
  ------------------
  |  Branch (799:9): [True: 45.2k, False: 131k]
  ------------------
  800|  45.2k|    {
  801|       |        /* Perform unsigned integer extension */
  802|  45.2k|        pb_uint64_t value = 0;
  ------------------
  |  |   46|  45.2k|#define pb_uint64_t uint64_t
  ------------------
  803|       |
  804|  45.2k|        if (field->data_size == sizeof(uint_least8_t))
  ------------------
  |  Branch (804:13): [True: 5.15k, False: 40.1k]
  ------------------
  805|  5.15k|            value = *(const uint_least8_t*)field->pData;
  806|  40.1k|        else if (field->data_size == sizeof(uint_least16_t))
  ------------------
  |  Branch (806:18): [True: 5.15k, False: 34.9k]
  ------------------
  807|  5.15k|            value = *(const uint_least16_t*)field->pData;
  808|  34.9k|        else if (field->data_size == sizeof(uint32_t))
  ------------------
  |  Branch (808:18): [True: 19.3k, False: 15.6k]
  ------------------
  809|  19.3k|            value = *(const uint32_t*)field->pData;
  810|  15.6k|        else if (field->data_size == sizeof(pb_uint64_t))
  ------------------
  |  Branch (810:18): [True: 15.6k, False: 0]
  ------------------
  811|  15.6k|            value = *(const pb_uint64_t*)field->pData;
  812|      0|        else
  813|      0|            PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  814|       |
  815|  45.2k|        return pb_encode_varint(stream, value);
  816|  45.2k|    }
  817|   131k|    else
  818|   131k|    {
  819|       |        /* Perform signed integer extension */
  820|   131k|        pb_int64_t value = 0;
  ------------------
  |  |   45|   131k|#define pb_int64_t int64_t
  ------------------
  821|       |
  822|   131k|        if (field->data_size == sizeof(int_least8_t))
  ------------------
  |  Branch (822:13): [True: 11.8k, False: 119k]
  ------------------
  823|  11.8k|            value = *(const int_least8_t*)field->pData;
  824|   119k|        else if (field->data_size == sizeof(int_least16_t))
  ------------------
  |  Branch (824:18): [True: 10.3k, False: 109k]
  ------------------
  825|  10.3k|            value = *(const int_least16_t*)field->pData;
  826|   109k|        else if (field->data_size == sizeof(int32_t))
  ------------------
  |  Branch (826:18): [True: 87.0k, False: 21.9k]
  ------------------
  827|  87.0k|            value = *(const int32_t*)field->pData;
  828|  21.9k|        else if (field->data_size == sizeof(pb_int64_t))
  ------------------
  |  Branch (828:18): [True: 21.9k, False: 0]
  ------------------
  829|  21.9k|            value = *(const pb_int64_t*)field->pData;
  830|      0|        else
  831|      0|            PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  832|       |
  833|   131k|        if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT)
  ------------------
  |  |  335|   131k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   131k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(field->type) == PB_LTYPE_SVARINT)
  ------------------
  |  |  278|   131k|#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
  ------------------
  |  Branch (833:13): [True: 22.1k, False: 109k]
  ------------------
  834|  22.1k|            return pb_encode_svarint(stream, value);
  835|       |#ifdef PB_WITHOUT_64BIT
  836|       |        else if (value < 0)
  837|       |            return pb_encode_varint_32(stream, (uint32_t)value, (uint32_t)-1);
  838|       |#endif
  839|   109k|        else
  840|   109k|            return pb_encode_varint(stream, (pb_uint64_t)value);
  841|       |
  842|   131k|    }
  843|   176k|}
pb_encode.c:pb_enc_fixed:
  846|  31.4k|{
  847|       |#ifdef PB_CONVERT_DOUBLE_FLOAT
  848|       |    if (field->data_size == sizeof(float) && PB_LTYPE(field->type) == PB_LTYPE_FIXED64)
  849|       |    {
  850|       |        return pb_encode_float_as_double(stream, *(float*)field->pData);
  851|       |    }
  852|       |#endif
  853|       |
  854|  31.4k|    if (field->data_size == sizeof(uint32_t))
  ------------------
  |  Branch (854:9): [True: 19.9k, False: 11.4k]
  ------------------
  855|  19.9k|    {
  856|  19.9k|        return pb_encode_fixed32(stream, field->pData);
  857|  19.9k|    }
  858|  11.4k|#ifndef PB_WITHOUT_64BIT
  859|  11.4k|    else if (field->data_size == sizeof(uint64_t))
  ------------------
  |  Branch (859:14): [True: 11.4k, False: 0]
  ------------------
  860|  11.4k|    {
  861|  11.4k|        return pb_encode_fixed64(stream, field->pData);
  862|  11.4k|    }
  863|      0|#endif
  864|      0|    else
  865|      0|    {
  866|       |        PB_RETURN_ERROR(stream, "invalid data_size");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  867|      0|    }
  868|  31.4k|}
pb_encode.c:encode_basic_field:
  372|   194k|{
  373|   194k|    if (!field->pData)
  ------------------
  |  Branch (373:9): [True: 0, False: 194k]
  ------------------
  374|      0|    {
  375|       |        /* Missing pointer field */
  376|      0|        return true;
  377|      0|    }
  378|       |
  379|   194k|    if (!pb_encode_tag_for_field(stream, field))
  ------------------
  |  Branch (379:9): [True: 0, False: 194k]
  ------------------
  380|      0|        return false;
  381|       |
  382|   194k|    switch (PB_LTYPE(field->type))
  ------------------
  |  |  335|   194k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   194k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
  383|   194k|    {
  384|  2.71k|        case PB_LTYPE_BOOL:
  ------------------
  |  |  275|  2.71k|#define PB_LTYPE_BOOL    0x00U /* bool */
  ------------------
  |  Branch (384:9): [True: 2.71k, False: 191k]
  ------------------
  385|  2.71k|            return pb_enc_bool(stream, field);
  386|       |
  387|  74.8k|        case PB_LTYPE_VARINT:
  ------------------
  |  |  276|  74.8k|#define PB_LTYPE_VARINT  0x01U /* int32, int64, enum, bool */
  ------------------
  |  Branch (387:9): [True: 74.8k, False: 119k]
  ------------------
  388|   114k|        case PB_LTYPE_UVARINT:
  ------------------
  |  |  277|   114k|#define PB_LTYPE_UVARINT 0x02U /* uint32, uint64 */
  ------------------
  |  Branch (388:9): [True: 39.4k, False: 154k]
  ------------------
  389|   130k|        case PB_LTYPE_SVARINT:
  ------------------
  |  |  278|   130k|#define PB_LTYPE_SVARINT 0x03U /* sint32, sint64 */
  ------------------
  |  Branch (389:9): [True: 15.7k, False: 178k]
  ------------------
  390|   130k|            return pb_enc_varint(stream, field);
  391|       |
  392|  10.9k|        case PB_LTYPE_FIXED32:
  ------------------
  |  |  279|  10.9k|#define PB_LTYPE_FIXED32 0x04U /* fixed32, sfixed32, float */
  ------------------
  |  Branch (392:9): [True: 10.9k, False: 183k]
  ------------------
  393|  19.6k|        case PB_LTYPE_FIXED64:
  ------------------
  |  |  280|  19.6k|#define PB_LTYPE_FIXED64 0x05U /* fixed64, sfixed64, double */
  ------------------
  |  Branch (393:9): [True: 8.69k, False: 185k]
  ------------------
  394|  19.6k|            return pb_enc_fixed(stream, field);
  395|       |
  396|  3.78k|        case PB_LTYPE_BYTES:
  ------------------
  |  |  287|  3.78k|#define PB_LTYPE_BYTES 0x06U
  ------------------
  |  Branch (396:9): [True: 3.78k, False: 190k]
  ------------------
  397|  3.78k|            return pb_enc_bytes(stream, field);
  398|       |
  399|  14.7k|        case PB_LTYPE_STRING:
  ------------------
  |  |  291|  14.7k|#define PB_LTYPE_STRING 0x07U
  ------------------
  |  Branch (399:9): [True: 14.7k, False: 179k]
  ------------------
  400|  14.7k|            return pb_enc_string(stream, field);
  401|       |
  402|  19.2k|        case PB_LTYPE_SUBMESSAGE:
  ------------------
  |  |  295|  19.2k|#define PB_LTYPE_SUBMESSAGE 0x08U
  ------------------
  |  Branch (402:9): [True: 19.2k, False: 174k]
  ------------------
  403|  19.2k|        case PB_LTYPE_SUBMSG_W_CB:
  ------------------
  |  |  300|  19.2k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (403:9): [True: 0, False: 194k]
  ------------------
  404|  19.2k|            return pb_enc_submessage(stream, field);
  405|       |
  406|  3.97k|        case PB_LTYPE_FIXED_LENGTH_BYTES:
  ------------------
  |  |  310|  3.97k|#define PB_LTYPE_FIXED_LENGTH_BYTES 0x0BU
  ------------------
  |  Branch (406:9): [True: 3.97k, False: 190k]
  ------------------
  407|  3.97k|            return pb_enc_fixed_length_bytes(stream, field);
  408|       |
  409|      0|        default:
  ------------------
  |  Branch (409:9): [True: 0, False: 194k]
  ------------------
  410|       |            PB_RETURN_ERROR(stream, "invalid field type");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  411|   194k|    }
  412|   194k|}
pb_encode.c:pb_enc_bool:
  791|  2.71k|{
  792|  2.71k|    uint32_t value = safe_read_bool(field->pData) ? 1 : 0;
  ------------------
  |  Branch (792:22): [True: 1.94k, False: 768]
  ------------------
  793|  2.71k|    PB_UNUSED(field);
  ------------------
  |  |  179|  2.71k|#define PB_UNUSED(x) (void)(x)
  ------------------
  794|  2.71k|    return pb_encode_varint(stream, value);
  795|  2.71k|}
pb_encode.c:pb_enc_bytes:
  871|  3.78k|{
  872|  3.78k|    const pb_bytes_array_t *bytes = NULL;
  873|       |
  874|  3.78k|    bytes = (const pb_bytes_array_t*)field->pData;
  875|       |    
  876|  3.78k|    if (bytes == NULL)
  ------------------
  |  Branch (876:9): [True: 0, False: 3.78k]
  ------------------
  877|      0|    {
  878|       |        /* Treat null pointer as an empty bytes field */
  879|      0|        return pb_encode_string(stream, NULL, 0);
  880|      0|    }
  881|       |    
  882|  3.78k|    if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
  ------------------
  |  |  333|  3.78k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  3.78k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_STATIC &&
  ------------------
  |  |  328|  7.56k|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (882:9): [True: 3.78k, False: 0]
  ------------------
  883|  3.78k|        bytes->size > field->data_size - offsetof(pb_bytes_array_t, bytes))
  ------------------
  |  Branch (883:9): [True: 0, False: 3.78k]
  ------------------
  884|      0|    {
  885|      0|        PB_RETURN_ERROR(stream, "bytes size exceeded");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  886|      0|    }
  887|       |    
  888|  3.78k|    return pb_encode_string(stream, bytes->bytes, (size_t)bytes->size);
  889|  3.78k|}
pb_encode.c:pb_enc_string:
  892|  14.7k|{
  893|  14.7k|    size_t size = 0;
  894|  14.7k|    size_t max_size = (size_t)field->data_size;
  895|  14.7k|    const char *str = (const char*)field->pData;
  896|       |    
  897|  14.7k|    if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|  14.7k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  14.7k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                  if (PB_ATYPE(field->type) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|  14.7k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (897:9): [True: 0, False: 14.7k]
  ------------------
  898|      0|    {
  899|      0|        max_size = (size_t)-1;
  900|      0|    }
  901|  14.7k|    else
  902|  14.7k|    {
  903|       |        /* pb_dec_string() assumes string fields end with a null
  904|       |         * terminator when the type isn't PB_ATYPE_POINTER, so we
  905|       |         * shouldn't allow more than max-1 bytes to be written to
  906|       |         * allow space for the null terminator.
  907|       |         */
  908|  14.7k|        if (max_size == 0)
  ------------------
  |  Branch (908:13): [True: 0, False: 14.7k]
  ------------------
  909|      0|            PB_RETURN_ERROR(stream, "zero-length string");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  910|       |
  911|  14.7k|        max_size -= 1;
  912|  14.7k|    }
  913|       |
  914|       |
  915|  14.7k|    if (str == NULL)
  ------------------
  |  Branch (915:9): [True: 0, False: 14.7k]
  ------------------
  916|      0|    {
  917|      0|        size = 0; /* Treat null pointer as an empty string */
  918|      0|    }
  919|  14.7k|    else
  920|  14.7k|    {
  921|  14.7k|        const char *p = str;
  922|       |
  923|       |        /* strnlen() is not always available, so just use a loop */
  924|  68.6k|        while (size < max_size && *p != '\0')
  ------------------
  |  Branch (924:16): [True: 68.4k, False: 264]
  |  Branch (924:35): [True: 53.9k, False: 14.4k]
  ------------------
  925|  53.9k|        {
  926|  53.9k|            size++;
  927|  53.9k|            p++;
  928|  53.9k|        }
  929|       |
  930|  14.7k|        if (*p != '\0')
  ------------------
  |  Branch (930:13): [True: 0, False: 14.7k]
  ------------------
  931|      0|        {
  932|      0|            PB_RETURN_ERROR(stream, "unterminated string");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  933|      0|        }
  934|  14.7k|    }
  935|       |
  936|       |#ifdef PB_VALIDATE_UTF8
  937|       |    if (!pb_validate_utf8(str))
  938|       |        PB_RETURN_ERROR(stream, "invalid utf8");
  939|       |#endif
  940|       |
  941|  14.7k|    return pb_encode_string(stream, (const pb_byte_t*)str, size);
  942|  14.7k|}
pb_encode.c:pb_enc_submessage:
  945|  19.2k|{
  946|  19.2k|    if (field->submsg_desc == NULL)
  ------------------
  |  Branch (946:9): [True: 0, False: 19.2k]
  ------------------
  947|      0|        PB_RETURN_ERROR(stream, "invalid field descriptor");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  948|       |
  949|  19.2k|    if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL)
  ------------------
  |  |  335|  19.2k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|  19.2k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                  if (PB_LTYPE(field->type) == PB_LTYPE_SUBMSG_W_CB && field->pSize != NULL)
  ------------------
  |  |  300|  38.5k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  ------------------
  |  Branch (949:9): [True: 0, False: 19.2k]
  |  Branch (949:58): [True: 0, False: 0]
  ------------------
  950|      0|    {
  951|       |        /* Message callback is stored right before pSize. */
  952|      0|        pb_callback_t *callback = (pb_callback_t*)field->pSize - 1;
  953|      0|        if (callback->funcs.encode)
  ------------------
  |  Branch (953:13): [True: 0, False: 0]
  ------------------
  954|      0|        {
  955|      0|            if (!callback->funcs.encode(stream, field, &callback->arg))
  ------------------
  |  Branch (955:17): [True: 0, False: 0]
  ------------------
  956|      0|                return false;
  957|      0|        }
  958|      0|    }
  959|       |    
  960|  19.2k|    return pb_encode_submessage(stream, field->submsg_desc, field->pData);
  961|  19.2k|}
pb_encode.c:pb_enc_fixed_length_bytes:
  964|  3.97k|{
  965|  3.97k|    return pb_encode_string(stream, (const pb_byte_t*)field->pData, (size_t)field->data_size);
  966|  3.97k|}
pb_encode.c:pb_encode_varint_32:
  583|  75.5k|{
  584|  75.5k|    size_t i = 0;
  585|  75.5k|    pb_byte_t buffer[10];
  586|  75.5k|    pb_byte_t byte = (pb_byte_t)(low & 0x7F);
  587|  75.5k|    low >>= 7;
  588|       |
  589|   204k|    while (i < 4 && (low != 0 || high != 0))
  ------------------
  |  Branch (589:12): [True: 192k, False: 12.7k]
  |  Branch (589:22): [True: 128k, False: 63.2k]
  |  Branch (589:34): [True: 414, False: 62.8k]
  ------------------
  590|   129k|    {
  591|   129k|        byte |= 0x80;
  592|   129k|        buffer[i++] = byte;
  593|   129k|        byte = (pb_byte_t)(low & 0x7F);
  594|   129k|        low >>= 7;
  595|   129k|    }
  596|       |
  597|  75.5k|    if (high)
  ------------------
  |  Branch (597:9): [True: 11.0k, False: 64.5k]
  ------------------
  598|  11.0k|    {
  599|  11.0k|        byte = (pb_byte_t)(byte | ((high & 0x07) << 4));
  600|  11.0k|        high >>= 3;
  601|       |
  602|  55.3k|        while (high)
  ------------------
  |  Branch (602:16): [True: 44.3k, False: 11.0k]
  ------------------
  603|  44.3k|        {
  604|  44.3k|            byte |= 0x80;
  605|  44.3k|            buffer[i++] = byte;
  606|  44.3k|            byte = (pb_byte_t)(high & 0x7F);
  607|  44.3k|            high >>= 7;
  608|  44.3k|        }
  609|  11.0k|    }
  610|       |
  611|  75.5k|    buffer[i++] = byte;
  612|       |
  613|  75.5k|    return pb_write(stream, buffer, i);
  614|  75.5k|}

malloc_with_check:
   58|  11.4k|{
   59|  11.4k|    const size_t check2 = CHECK2;
  ------------------
  |  |   18|  11.4k|#define CHECK2 ((size_t)0x600DCAFE)
  ------------------
   60|  11.4k|    char *buf = NULL;
   61|       |
   62|  11.4k|    if (size <= g_max_alloc_bytes - g_alloc_bytes)
  ------------------
  |  Branch (62:9): [True: 11.4k, False: 0]
  ------------------
   63|  11.4k|    {
   64|  11.4k|        buf = malloc(round_blocksize(size + GUARD_SIZE));
  ------------------
  |  |   15|  11.4k|#define GUARD_SIZE (sizeof(size_t)*3)
  ------------------
   65|  11.4k|    }
   66|       |
   67|  11.4k|    if (buf)
  ------------------
  |  Branch (67:9): [True: 11.4k, False: 0]
  ------------------
   68|  11.4k|    {
   69|  11.4k|        ((size_t*)buf)[0] = size;
   70|  11.4k|        ((size_t*)buf)[1] = CHECK1;
  ------------------
  |  |   17|  11.4k|#define CHECK1 ((size_t)0xDEADBEEF)
  ------------------
   71|  11.4k|        memcpy(buf + PREFIX_SIZE + size, &check2, sizeof(check2));
  ------------------
  |  |   16|  11.4k|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
   72|       |
   73|  11.4k|        g_alloc_count++;
   74|  11.4k|        g_alloc_bytes += size;
   75|  11.4k|        if (DEBUG_MALLOC) fprintf(stderr, "Alloc 0x%04x/%u\n", (unsigned)(uintptr_t)(buf + PREFIX_SIZE), (unsigned)size);
  ------------------
  |  |   25|  11.4k|#define DEBUG_MALLOC 0
  |  |  ------------------
  |  |  |  Branch (25:22): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
                      if (DEBUG_MALLOC) fprintf(stderr, "Alloc 0x%04x/%u\n", (unsigned)(uintptr_t)(buf + PREFIX_SIZE), (unsigned)size);
  ------------------
  |  |   16|      0|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
   76|  11.4k|        return buf + PREFIX_SIZE;
  ------------------
  |  |   16|  11.4k|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
   77|  11.4k|    }
   78|      0|    else
   79|      0|    {
   80|      0|        if (DEBUG_MALLOC) fprintf(stderr, "malloc(%u) failed\n", (unsigned)size);
  ------------------
  |  |   25|      0|#define DEBUG_MALLOC 0
  |  |  ------------------
  |  |  |  Branch (25:22): [Folded, False: 0]
  |  |  ------------------
  ------------------
   81|       |        return NULL;
   82|      0|    }
   83|  11.4k|}
free_with_check:
   87|  11.4k|{
   88|  11.4k|    if (mem)
  ------------------
  |  Branch (88:9): [True: 11.4k, False: 0]
  ------------------
   89|  11.4k|    {
   90|  11.4k|        char *buf = (char*)mem - PREFIX_SIZE;
  ------------------
  |  |   16|  11.4k|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
   91|  11.4k|        size_t check2 = 0;
   92|  11.4k|        size_t size = ((size_t*)buf)[0];
   93|  11.4k|        if (DEBUG_MALLOC) fprintf(stderr, "Release 0x%04x/%u\n", (unsigned)(uintptr_t)mem, (unsigned)size);
  ------------------
  |  |   25|  11.4k|#define DEBUG_MALLOC 0
  |  |  ------------------
  |  |  |  Branch (25:22): [Folded, False: 11.4k]
  |  |  ------------------
  ------------------
   94|  11.4k|        assert(((size_t*)buf)[1] == CHECK1);
  ------------------
  |  Branch (94:9): [True: 0, False: 11.4k]
  |  Branch (94:9): [True: 11.4k, False: 0]
  ------------------
   95|  11.4k|        memcpy(&check2, buf + PREFIX_SIZE + size, sizeof(check2));
  ------------------
  |  |   16|  11.4k|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
   96|  11.4k|        assert(check2 == CHECK2);
  ------------------
  |  Branch (96:9): [True: 0, False: 11.4k]
  |  Branch (96:9): [True: 11.4k, False: 0]
  ------------------
   97|  11.4k|        assert(g_alloc_count > 0);
  ------------------
  |  Branch (97:9): [True: 0, False: 11.4k]
  |  Branch (97:9): [True: 11.4k, False: 0]
  ------------------
   98|  11.4k|        assert(g_alloc_bytes >= size);
  ------------------
  |  Branch (98:9): [True: 0, False: 11.4k]
  |  Branch (98:9): [True: 11.4k, False: 0]
  ------------------
   99|  11.4k|        ((size_t*)buf)[1] = 0;
  100|  11.4k|        memset(buf + PREFIX_SIZE + size, 0, sizeof(check2));
  ------------------
  |  |   16|  11.4k|#define PREFIX_SIZE (sizeof(size_t)*2)
  ------------------
  101|  11.4k|        g_alloc_count--;
  102|  11.4k|        g_alloc_bytes -= size;
  103|  11.4k|        free(buf);
  104|  11.4k|    }
  105|  11.4k|}
get_alloc_count:
  172|  17.8k|{
  173|  17.8k|    return g_alloc_count;
  174|  17.8k|}
malloc_wrappers.c:round_blocksize:
   39|  11.4k|{
   40|  11.4k|    if (size < 256)
  ------------------
  |  Branch (40:9): [True: 0, False: 11.4k]
  ------------------
   41|      0|    {
   42|      0|        return size;
   43|      0|    }
   44|  11.4k|    else
   45|  11.4k|    {
   46|  11.4k|        return (size + 1023) / 1024 * 1024;
   47|  11.4k|    }
   48|  11.4k|}

flakystream_callback:
    5|  4.44M|{
    6|  4.44M|    flakystream_t *state = stream->state;
    7|       |
    8|  4.44M|    if (state->position + count > state->msglen)
  ------------------
  |  Branch (8:9): [True: 1.28k, False: 4.44M]
  ------------------
    9|  1.28k|    {
   10|  1.28k|        stream->bytes_left = 0;
   11|  1.28k|        return false;
   12|  1.28k|    }
   13|  4.44M|    else if (state->position + count > state->fail_after)
  ------------------
  |  Branch (13:14): [True: 0, False: 4.44M]
  ------------------
   14|      0|    {
   15|      0|        PB_RETURN_ERROR(stream, "flaky error");
  ------------------
  |  |  937|      0|#define PB_RETURN_ERROR(stream, msg) return PB_SET_ERROR(stream, msg), false
  |  |  ------------------
  |  |  |  |  933|      0|#define PB_SET_ERROR(stream, msg) (stream->errmsg = (stream)->errmsg ? (stream)->errmsg : (msg))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (933:53): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   16|      0|    }
   17|       |
   18|  4.44M|    memcpy(buf, state->buffer + state->position, count);
   19|  4.44M|    state->position += count;
   20|       |    return true;
   21|  4.44M|}
flakystream_init:
   24|  1.28k|{
   25|  1.28k|    memset(stream, 0, sizeof(*stream));
   26|  1.28k|    stream->stream.callback = flakystream_callback;
   27|       |    stream->stream.bytes_left = SIZE_MAX;
   28|  1.28k|    stream->stream.state = stream;
   29|  1.28k|    stream->buffer = buffer;
   30|  1.28k|    stream->position = 0;
   31|  1.28k|    stream->msglen = msglen;
   32|  1.28k|    stream->fail_after = fail_after;
   33|  1.28k|}

do_callback_decode:
  172|  1.28k|{
  173|  1.28k|    bool status;
  174|  1.28k|    pb_istream_t stream;
  175|  1.28k|    size_t initial_alloc_count = get_alloc_count();
  176|  1.28k|    alltypes_callback_AllTypes *msg = malloc_with_check(sizeof(alltypes_callback_AllTypes));
  177|  1.28k|    assert(msg);
  ------------------
  |  Branch (177:5): [True: 0, False: 1.28k]
  |  Branch (177:5): [True: 1.28k, False: 0]
  ------------------
  178|       |
  179|  1.28k|    memset(msg, 0, sizeof(alltypes_callback_AllTypes));
  180|  1.28k|    stream = pb_istream_from_buffer(buffer, msglen);
  181|       |
  182|  1.28k|    msg->rep_int32.funcs.decode = &field_callback;
  183|  1.28k|    msg->rep_int32.arg = &g_sentinel;
  184|  1.28k|    msg->rep_string.funcs.decode = &field_callback;
  185|  1.28k|    msg->rep_string.arg = &g_sentinel;
  186|  1.28k|    msg->rep_farray.funcs.decode = &field_callback;
  187|  1.28k|    msg->rep_farray.arg = &g_sentinel;
  188|  1.28k|    msg->req_limits.int64_min.funcs.decode = &field_callback;
  189|  1.28k|    msg->req_limits.int64_min.arg = &g_sentinel;
  190|  1.28k|    msg->cb_oneof.funcs.decode = &submsg_callback;
  191|  1.28k|    msg->cb_oneof.arg = &g_sentinel;
  192|       |
  193|  1.28k|    status = pb_decode(&stream, alltypes_callback_AllTypes_fields, msg);
  ------------------
  |  |  495|  1.28k|#define alltypes_callback_AllTypes_fields &alltypes_callback_AllTypes_msg
  ------------------
  194|       |
  195|  1.28k|    if (assert_success)
  ------------------
  |  Branch (195:9): [True: 1.28k, False: 0]
  ------------------
  196|  1.28k|    {
  197|  1.28k|        if (!status) fprintf(stderr, "pb_decode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (197:13): [True: 0, False: 1.28k]
  ------------------
  198|  1.28k|        assert(status);
  ------------------
  |  Branch (198:9): [True: 0, False: 1.28k]
  |  Branch (198:9): [True: 1.28k, False: 0]
  ------------------
  199|  1.28k|    }
  200|       |
  201|  1.28k|    pb_release(alltypes_callback_AllTypes_fields, msg);
  ------------------
  |  |  495|  1.28k|#define alltypes_callback_AllTypes_fields &alltypes_callback_AllTypes_msg
  ------------------
  202|  1.28k|    free_with_check(msg);
  203|  1.28k|    assert(get_alloc_count() == initial_alloc_count);
  ------------------
  |  Branch (203:5): [True: 0, False: 1.28k]
  |  Branch (203:5): [True: 1.28k, False: 0]
  ------------------
  204|       |
  205|  1.28k|    return status;
  206|  1.28k|}
do_roundtrip:
  210|  1.28k|{
  211|  1.28k|    bool status;
  212|  1.28k|    uint32_t checksum2, checksum3;
  213|  1.28k|    size_t msglen2, msglen3;
  214|  1.28k|    uint8_t *buf2 = malloc_with_check(g_bufsize);
  215|  1.28k|    void *msg = malloc_with_check(structsize);
  216|       |
  217|       |    /* For proto2 types, we also test extension fields */
  218|  1.28k|    alltypes_static_TestExtension extmsg = alltypes_static_TestExtension_init_zero;
  ------------------
  |  |  260|  1.28k|#define alltypes_static_TestExtension_init_zero  {false, ""}
  ------------------
  219|  1.28k|    pb_extension_t ext = pb_extension_init_zero;
  ------------------
  |  |  520|  1.28k|#define pb_extension_init_zero {NULL,NULL,NULL,false}
  ------------------
  220|  1.28k|    pb_extension_t **ext_field = NULL;
  221|  1.28k|    ext.type = &alltypes_static_TestExtension_testextension;
  222|  1.28k|    ext.dest = &extmsg;
  223|  1.28k|    ext.next = NULL;
  224|       |
  225|  1.28k|    assert(buf2 && msg);
  ------------------
  |  Branch (225:5): [True: 0, False: 1.28k]
  |  Branch (225:5): [True: 0, False: 0]
  |  Branch (225:5): [True: 1.28k, False: 0]
  |  Branch (225:5): [True: 1.28k, False: 0]
  ------------------
  226|       |
  227|  1.28k|    if (msgtype == alltypes_static_AllTypes_fields)
  ------------------
  |  |  520|  1.28k|#define alltypes_static_AllTypes_fields &alltypes_static_AllTypes_msg
  ------------------
  |  Branch (227:9): [True: 1.28k, False: 0]
  ------------------
  228|  1.28k|    {
  229|  1.28k|        ext_field = &((alltypes_static_AllTypes*)msg)->extensions;
  230|  1.28k|    }
  231|      0|    else if (msgtype == alltypes_pointer_AllTypes_fields)
  ------------------
  |  |  494|      0|#define alltypes_pointer_AllTypes_fields &alltypes_pointer_AllTypes_msg
  ------------------
  |  Branch (231:14): [True: 0, False: 0]
  ------------------
  232|      0|    {
  233|      0|        ext_field = &((alltypes_pointer_AllTypes*)msg)->extensions;
  234|      0|    }
  235|       |    
  236|       |    /* Decode and encode the input data.
  237|       |     * This will bring it into canonical format.
  238|       |     */
  239|  1.28k|    {
  240|  1.28k|        pb_istream_t stream = pb_istream_from_buffer(buffer, msglen);
  241|  1.28k|        memset(msg, 0, structsize);
  242|  1.28k|        if (ext_field) *ext_field = &ext;
  ------------------
  |  Branch (242:13): [True: 1.28k, False: 0]
  ------------------
  243|  1.28k|        status = pb_decode(&stream, msgtype, msg);
  244|  1.28k|        if (!status) fprintf(stderr, "pb_decode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (244:13): [True: 0, False: 1.28k]
  ------------------
  245|  1.28k|        assert(status);
  ------------------
  |  Branch (245:9): [True: 0, False: 1.28k]
  |  Branch (245:9): [True: 1.28k, False: 0]
  ------------------
  246|       |
  247|  1.28k|        validate_message(msg, structsize, msgtype);
  248|  1.28k|    }
  249|       |    
  250|  1.28k|    {
  251|  1.28k|        pb_ostream_t stream = pb_ostream_from_buffer(buf2, g_bufsize);
  252|  1.28k|        status = pb_encode(&stream, msgtype, msg);
  253|       |
  254|       |        /* Some messages expand when re-encoding and might no longer fit
  255|       |         * in the buffer. */
  256|  1.28k|        if (!status && strcmp(PB_GET_ERROR(&stream), "stream full") != 0)
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (256:13): [True: 0, False: 1.28k]
  |  Branch (256:24): [True: 0, False: 0]
  ------------------
  257|      0|        {
  258|      0|            fprintf(stderr, "pb_encode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  259|      0|            assert(status);
  ------------------
  |  Branch (259:13): [True: 0, False: 0]
  |  Branch (259:13): [True: 0, False: 0]
  ------------------
  260|      0|        }
  261|       |
  262|  1.28k|        msglen2 = stream.bytes_written;
  263|  1.28k|        checksum2 = xor32_checksum(buf2, msglen2);
  264|  1.28k|    }
  265|       |    
  266|  1.28k|    pb_release(msgtype, msg);
  267|       |
  268|       |    /* Then decode from canonical format and re-encode. Result should remain the same. */
  269|  1.28k|    if (status)
  ------------------
  |  Branch (269:9): [True: 1.28k, False: 0]
  ------------------
  270|  1.28k|    {
  271|  1.28k|        pb_istream_t stream = pb_istream_from_buffer(buf2, msglen2);
  272|  1.28k|        memset(msg, 0, structsize);
  273|  1.28k|        if (ext_field) *ext_field = &ext;
  ------------------
  |  Branch (273:13): [True: 1.28k, False: 0]
  ------------------
  274|  1.28k|        status = pb_decode(&stream, msgtype, msg);
  275|  1.28k|        if (!status) fprintf(stderr, "pb_decode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (275:13): [True: 0, False: 1.28k]
  ------------------
  276|  1.28k|        assert(status);
  ------------------
  |  Branch (276:9): [True: 0, False: 1.28k]
  |  Branch (276:9): [True: 1.28k, False: 0]
  ------------------
  277|       |
  278|  1.28k|        validate_message(msg, structsize, msgtype);
  279|  1.28k|    }
  280|       |    
  281|  1.28k|    if (status)
  ------------------
  |  Branch (281:9): [True: 1.28k, False: 0]
  ------------------
  282|  1.28k|    {
  283|  1.28k|        pb_ostream_t stream = pb_ostream_from_buffer(buf2, g_bufsize);
  284|  1.28k|        status = pb_encode(&stream, msgtype, msg);
  285|  1.28k|        if (!status) fprintf(stderr, "pb_encode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (285:13): [True: 0, False: 1.28k]
  ------------------
  286|  1.28k|        assert(status);
  ------------------
  |  Branch (286:9): [True: 0, False: 1.28k]
  |  Branch (286:9): [True: 1.28k, False: 0]
  ------------------
  287|  1.28k|        msglen3 = stream.bytes_written;
  288|  1.28k|        checksum3 = xor32_checksum(buf2, msglen3);
  289|       |
  290|  1.28k|        assert(msglen2 == msglen3);
  ------------------
  |  Branch (290:9): [True: 0, False: 1.28k]
  |  Branch (290:9): [True: 1.28k, False: 0]
  ------------------
  291|  1.28k|        assert(checksum2 == checksum3);
  ------------------
  |  Branch (291:9): [True: 0, False: 1.28k]
  |  Branch (291:9): [True: 1.28k, False: 0]
  ------------------
  292|  1.28k|    }
  293|       |    
  294|  1.28k|    pb_release(msgtype, msg);
  295|  1.28k|    free_with_check(msg);
  296|  1.28k|    free_with_check(buf2);
  297|  1.28k|}
do_roundtrips:
  301|  3.16k|{
  302|  3.16k|    size_t initial_alloc_count = get_alloc_count();
  303|  3.16k|    PB_UNUSED(expect_valid); /* Potentially unused depending on configuration */
  ------------------
  |  |  179|  3.16k|#define PB_UNUSED(x) (void)(x)
  ------------------
  304|       |
  305|  3.16k|#ifdef FUZZTEST_PROTO2_STATIC
  306|  3.16k|    if (do_decode(data, size, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields, 0, expect_valid))
  ------------------
  |  |  520|  3.16k|#define alltypes_static_AllTypes_fields &alltypes_static_AllTypes_msg
  ------------------
  |  Branch (306:9): [True: 1.28k, False: 1.87k]
  ------------------
  307|  1.28k|    {
  308|  1.28k|        do_roundtrip(data, size, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields);
  ------------------
  |  |  520|  1.28k|#define alltypes_static_AllTypes_fields &alltypes_static_AllTypes_msg
  ------------------
  309|  1.28k|        do_stream_decode(data, size, SIZE_MAX, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields, 0, true);
  ------------------
  |  |  520|  1.28k|#define alltypes_static_AllTypes_fields &alltypes_static_AllTypes_msg
  ------------------
  310|  1.28k|        do_callback_decode(data, size, true);
  311|  1.28k|    }
  312|  3.16k|#endif
  313|       |
  314|       |#ifdef FUZZTEST_PROTO3_STATIC
  315|       |    if (do_decode(data, size, sizeof(alltypes_proto3_static_AllTypes), alltypes_proto3_static_AllTypes_fields, 0, expect_valid))
  316|       |    {
  317|       |        do_roundtrip(data, size, sizeof(alltypes_proto3_static_AllTypes), alltypes_proto3_static_AllTypes_fields);
  318|       |        do_stream_decode(data, size, SIZE_MAX, sizeof(alltypes_proto3_static_AllTypes), alltypes_proto3_static_AllTypes_fields, 0, true);
  319|       |    }
  320|       |#endif
  321|       |
  322|       |#ifdef FUZZTEST_PROTO2_POINTER
  323|       |    if (do_decode(data, size, sizeof(alltypes_pointer_AllTypes), alltypes_pointer_AllTypes_fields, 0, expect_valid))
  324|       |    {
  325|       |        do_roundtrip(data, size, sizeof(alltypes_pointer_AllTypes), alltypes_pointer_AllTypes_fields);
  326|       |        do_stream_decode(data, size, SIZE_MAX, sizeof(alltypes_pointer_AllTypes), alltypes_pointer_AllTypes_fields, 0, true);
  327|       |    }
  328|       |#endif
  329|       |
  330|       |#ifdef FUZZTEST_PROTO3_POINTER
  331|       |    if (do_decode(data, size, sizeof(alltypes_proto3_pointer_AllTypes), alltypes_proto3_pointer_AllTypes_fields, 0, expect_valid))
  332|       |    {
  333|       |        do_roundtrip(data, size, sizeof(alltypes_proto3_pointer_AllTypes), alltypes_proto3_pointer_AllTypes_fields);
  334|       |        do_stream_decode(data, size, SIZE_MAX, sizeof(alltypes_proto3_pointer_AllTypes), alltypes_proto3_pointer_AllTypes_fields, 0, true);
  335|       |    }
  336|       |#endif
  337|       |
  338|       |#ifdef FUZZTEST_IO_ERRORS
  339|       |    {
  340|       |        size_t orig_max_alloc_bytes = get_max_alloc_bytes();
  341|       |        /* Test decoding when error conditions occur.
  342|       |         * The decoding will end either when running out of memory or when stream returns IO error.
  343|       |         * Testing proto2 is enough for good coverage here, as it has a superset of the field types of proto3.
  344|       |         */
  345|       |        set_max_alloc_bytes(get_alloc_bytes() + 4096);
  346|       |        do_stream_decode(data, size, size - 16, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields, 0, false);
  347|       |        do_stream_decode(data, size, size - 16, sizeof(alltypes_pointer_AllTypes), alltypes_pointer_AllTypes_fields, 0, false);
  348|       |        do_stream_decode(data, size, size - 16, sizeof(alltypes_pointer_AllTypes), alltypes_pointer_AllTypes_fields, PB_DECODE_DELIMITED, false);
  349|       |        set_max_alloc_bytes(orig_max_alloc_bytes);
  350|       |    }
  351|       |
  352|       |    /* Test pb_decode_ex() modes */
  353|       |    do_decode(data, size, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields, PB_DECODE_NOINIT | PB_DECODE_DELIMITED, false);
  354|       |    do_decode(data, size, sizeof(alltypes_static_AllTypes), alltypes_static_AllTypes_fields, PB_DECODE_NULLTERMINATED, false);
  355|       |
  356|       |    /* Test callbacks also when message is not valid */
  357|       |    do_callback_decode(data, size, false);
  358|       |#endif
  359|       |
  360|       |    assert(get_alloc_count() == initial_alloc_count);
  ------------------
  |  Branch (360:5): [True: 0, False: 3.16k]
  |  Branch (360:5): [True: 3.16k, False: 0]
  ------------------
  361|  3.16k|}
LLVMFuzzerTestOneInput:
  365|  3.16k|{
  366|  3.16k|    if (size > g_bufsize)
  ------------------
  |  Branch (366:9): [True: 4, False: 3.16k]
  ------------------
  367|      4|        return 0;
  368|       |
  369|  3.16k|    do_roundtrips(data, size, false);
  370|       |
  371|  3.16k|    return 0;
  372|  3.16k|}
fuzztest.c:field_callback:
  156|  6.72k|{
  157|  6.72k|    assert(stream);
  ------------------
  |  Branch (157:5): [True: 0, False: 6.72k]
  |  Branch (157:5): [True: 6.72k, False: 0]
  ------------------
  158|  6.72k|    assert(field);
  ------------------
  |  Branch (158:5): [True: 0, False: 6.72k]
  |  Branch (158:5): [True: 6.72k, False: 0]
  ------------------
  159|  6.72k|    assert(*arg == &g_sentinel);
  ------------------
  |  Branch (159:5): [True: 0, False: 6.72k]
  |  Branch (159:5): [True: 6.72k, False: 0]
  ------------------
  160|  6.72k|    return pb_read(stream, NULL, stream->bytes_left);
  161|  6.72k|}
fuzztest.c:submsg_callback:
  164|  44.5k|{
  165|  44.5k|    assert(stream);
  ------------------
  |  Branch (165:5): [True: 0, False: 44.5k]
  |  Branch (165:5): [True: 44.5k, False: 0]
  ------------------
  166|  44.5k|    assert(field);
  ------------------
  |  Branch (166:5): [True: 0, False: 44.5k]
  |  Branch (166:5): [True: 44.5k, False: 0]
  ------------------
  167|  44.5k|    assert(*arg == &g_sentinel);
  ------------------
  |  Branch (167:5): [True: 0, False: 44.5k]
  |  Branch (167:5): [True: 44.5k, False: 0]
  ------------------
  168|  44.5k|    return true;
  169|  44.5k|}
fuzztest.c:xor32_checksum:
   53|  2.57k|{
   54|  2.57k|    const uint8_t *buf = (const uint8_t*)data;
   55|  2.57k|    uint32_t checksum = 1234;
   56|   642k|    for (; len > 0; len--)
  ------------------
  |  Branch (56:12): [True: 639k, False: 2.57k]
  ------------------
   57|   639k|    {
   58|   639k|        checksum ^= checksum << 13;
   59|   639k|        checksum ^= checksum >> 17;
   60|   639k|        checksum ^= checksum << 5;
   61|   639k|        checksum += *buf++;
   62|   639k|    }
   63|  2.57k|    return checksum;
   64|  2.57k|}
fuzztest.c:do_decode:
   67|  3.16k|{
   68|  3.16k|    bool status;
   69|  3.16k|    pb_istream_t stream;
   70|  3.16k|    size_t initial_alloc_count = get_alloc_count();
   71|  3.16k|    uint8_t *buf2 = malloc_with_check(g_bufsize); /* This is just to match the amount of memory allocations in do_roundtrips(). */
   72|  3.16k|    void *msg = malloc_with_check(structsize);
   73|  3.16k|    alltypes_static_TestExtension extmsg = alltypes_static_TestExtension_init_zero;
  ------------------
  |  |  260|  3.16k|#define alltypes_static_TestExtension_init_zero  {false, ""}
  ------------------
   74|  3.16k|    pb_extension_t ext = pb_extension_init_zero;
  ------------------
  |  |  520|  3.16k|#define pb_extension_init_zero {NULL,NULL,NULL,false}
  ------------------
   75|  3.16k|    assert(msg);
  ------------------
  |  Branch (75:5): [True: 0, False: 3.16k]
  |  Branch (75:5): [True: 3.16k, False: 0]
  ------------------
   76|       |
   77|  3.16k|    memset(msg, 0, structsize);
   78|  3.16k|    ext.type = &alltypes_static_TestExtension_testextension;
   79|  3.16k|    ext.dest = &extmsg;
   80|  3.16k|    ext.next = NULL;
   81|       |
   82|  3.16k|    if (msgtype == alltypes_static_AllTypes_fields)
  ------------------
  |  |  520|  3.16k|#define alltypes_static_AllTypes_fields &alltypes_static_AllTypes_msg
  ------------------
  |  Branch (82:9): [True: 3.16k, False: 0]
  ------------------
   83|  3.16k|    {
   84|  3.16k|        ((alltypes_static_AllTypes*)msg)->extensions = &ext;
   85|  3.16k|    }
   86|      0|    else if (msgtype == alltypes_pointer_AllTypes_fields)
  ------------------
  |  |  494|      0|#define alltypes_pointer_AllTypes_fields &alltypes_pointer_AllTypes_msg
  ------------------
  |  Branch (86:14): [True: 0, False: 0]
  ------------------
   87|      0|    {
   88|      0|        ((alltypes_pointer_AllTypes*)msg)->extensions = &ext;
   89|      0|    }
   90|       |
   91|  3.16k|    stream = pb_istream_from_buffer(buffer, msglen);
   92|  3.16k|    status = pb_decode_ex(&stream, msgtype, msg, flags);
   93|       |
   94|  3.16k|    if (status)
  ------------------
  |  Branch (94:9): [True: 1.28k, False: 1.87k]
  ------------------
   95|  1.28k|    {
   96|  1.28k|        validate_message(msg, structsize, msgtype);
   97|  1.28k|    }
   98|       |
   99|  3.16k|    if (assert_success)
  ------------------
  |  Branch (99:9): [True: 0, False: 3.16k]
  ------------------
  100|      0|    {
  101|      0|        if (!status) fprintf(stderr, "pb_decode: %s\n", PB_GET_ERROR(&stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (101:13): [True: 0, False: 0]
  ------------------
  102|      0|        assert(status);
  ------------------
  |  Branch (102:9): [True: 0, False: 0]
  |  Branch (102:9): [True: 0, False: 0]
  ------------------
  103|      0|    }
  104|       |
  105|  3.16k|    if (status)
  ------------------
  |  Branch (105:9): [True: 1.28k, False: 1.87k]
  ------------------
  106|  1.28k|    {
  107|       |        /* On error return, pb_release() should be called automatically. */
  108|  1.28k|        pb_release(msgtype, msg);
  109|  1.28k|    }
  110|       |
  111|  3.16k|    free_with_check(msg);
  112|  3.16k|    free_with_check(buf2);
  113|  3.16k|    assert(get_alloc_count() == initial_alloc_count);
  ------------------
  |  Branch (113:5): [True: 0, False: 3.16k]
  |  Branch (113:5): [True: 3.16k, False: 0]
  ------------------
  114|       |    
  115|  3.16k|    return status;
  116|  3.16k|}
fuzztest.c:do_stream_decode:
  119|  1.28k|{
  120|  1.28k|    bool status;
  121|  1.28k|    flakystream_t stream;
  122|  1.28k|    size_t initial_alloc_count = get_alloc_count();
  123|  1.28k|    void *msg = malloc_with_check(structsize);
  124|  1.28k|    assert(msg);
  ------------------
  |  Branch (124:5): [True: 0, False: 1.28k]
  |  Branch (124:5): [True: 1.28k, False: 0]
  ------------------
  125|       |
  126|  1.28k|    memset(msg, 0, structsize);
  127|  1.28k|    flakystream_init(&stream, buffer, msglen, fail_after);
  128|  1.28k|    status = pb_decode_ex(&stream.stream, msgtype, msg, flags);
  129|       |
  130|  1.28k|    if (status)
  ------------------
  |  Branch (130:9): [True: 1.28k, False: 0]
  ------------------
  131|  1.28k|    {
  132|  1.28k|        validate_message(msg, structsize, msgtype);
  133|  1.28k|    }
  134|       |
  135|  1.28k|    if (assert_success)
  ------------------
  |  Branch (135:9): [True: 1.28k, False: 0]
  ------------------
  136|  1.28k|    {
  137|  1.28k|        if (!status) fprintf(stderr, "pb_decode: %s\n", PB_GET_ERROR(&stream.stream));
  ------------------
  |  |  934|      0|#define PB_GET_ERROR(stream) ((stream)->errmsg ? (stream)->errmsg : "(none)")
  |  |  ------------------
  |  |  |  Branch (934:31): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  |  Branch (137:13): [True: 0, False: 1.28k]
  ------------------
  138|  1.28k|        assert(status);
  ------------------
  |  Branch (138:9): [True: 0, False: 1.28k]
  |  Branch (138:9): [True: 1.28k, False: 0]
  ------------------
  139|  1.28k|    }
  140|       |
  141|  1.28k|    if (status)
  ------------------
  |  Branch (141:9): [True: 1.28k, False: 0]
  ------------------
  142|  1.28k|    {
  143|       |        /* On error return, pb_release() should be called automatically. */
  144|  1.28k|        pb_release(msgtype, msg);
  145|  1.28k|    }
  146|       |
  147|  1.28k|    free_with_check(msg);
  148|  1.28k|    assert(get_alloc_count() == initial_alloc_count);
  ------------------
  |  Branch (148:5): [True: 0, False: 1.28k]
  |  Branch (148:5): [True: 1.28k, False: 0]
  ------------------
  149|       |
  150|  1.28k|    return status;
  151|  1.28k|}

validate_static:
    7|   498k|{
    8|   498k|    pb_size_t count = 1;
    9|   498k|    pb_size_t i;
   10|   498k|    bool truebool = true;
   11|   498k|    bool falsebool = false;
   12|       |
   13|   498k|    if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED && iter->pSize)
  ------------------
  |  |  334|   498k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   498k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  if (PB_HTYPE(iter->type) == PB_HTYPE_REPEATED && iter->pSize)
  ------------------
  |  |  321|   996k|#define PB_HTYPE_REPEATED 0x20U
  ------------------
  |  Branch (13:9): [True: 108k, False: 390k]
  |  Branch (13:54): [True: 108k, False: 0]
  ------------------
   14|   108k|    {
   15|       |        /* Array count must be between 0 and statically allocated size */
   16|   108k|        count = *(pb_size_t*)iter->pSize;
   17|   108k|        assert(count <= iter->array_size);
  ------------------
  |  Branch (17:9): [True: 0, False: 108k]
  |  Branch (17:9): [True: 108k, False: 0]
  ------------------
   18|   108k|    }
   19|   390k|    else if (PB_HTYPE(iter->type) == PB_HTYPE_OPTIONAL && iter->pSize)
  ------------------
  |  |  334|   390k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   390k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  else if (PB_HTYPE(iter->type) == PB_HTYPE_OPTIONAL && iter->pSize)
  ------------------
  |  |  319|   780k|#define PB_HTYPE_OPTIONAL 0x10U
  ------------------
  |  Branch (19:14): [True: 118k, False: 272k]
  |  Branch (19:59): [True: 118k, False: 0]
  ------------------
   20|   118k|    {
   21|       |        /* Boolean has_ field must have a valid value */
   22|   118k|        assert(memcmp(iter->pSize, &truebool, sizeof(bool)) == 0 ||
  ------------------
  |  Branch (22:9): [True: 118k, False: 0]
  |  Branch (22:9): [True: 0, False: 0]
  |  Branch (22:9): [True: 11.3k, False: 106k]
  |  Branch (22:9): [True: 106k, False: 0]
  ------------------
   23|   118k|               memcmp(iter->pSize, &falsebool, sizeof(bool)) == 0);
   24|   118k|    }
   25|   272k|    else if (PB_HTYPE(iter->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  334|   272k|#define PB_HTYPE(x) ((x) & PB_HTYPE_MASK)
  |  |  ------------------
  |  |  |  |  324|   272k|#define PB_HTYPE_MASK     0x30U
  |  |  ------------------
  ------------------
                  else if (PB_HTYPE(iter->type) == PB_HTYPE_ONEOF)
  ------------------
  |  |  323|   272k|#define PB_HTYPE_ONEOF    0x30U
  ------------------
  |  Branch (25:14): [True: 25.7k, False: 246k]
  ------------------
   26|  25.7k|    {
   27|  25.7k|        if (*(pb_size_t*)iter->pSize != iter->tag)
  ------------------
  |  Branch (27:13): [True: 24.2k, False: 1.48k]
  ------------------
   28|  24.2k|        {
   29|       |            /* Some different field in oneof */
   30|  24.2k|            return;
   31|  24.2k|        }
   32|  25.7k|    }
   33|       |
   34|   921k|    for (i = 0; i < count; i++)
  ------------------
  |  Branch (34:17): [True: 447k, False: 474k]
  ------------------
   35|   447k|    {
   36|   447k|        void *pData = (char*)iter->pData + iter->data_size * i;
   37|       |
   38|   447k|        if (PB_LTYPE(iter->type) == PB_LTYPE_STRING)
  ------------------
  |  |  335|   447k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   447k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      if (PB_LTYPE(iter->type) == PB_LTYPE_STRING)
  ------------------
  |  |  291|   447k|#define PB_LTYPE_STRING 0x07U
  ------------------
  |  Branch (38:13): [True: 27.4k, False: 420k]
  ------------------
   39|  27.4k|        {
   40|       |            /* String length must be at most statically allocated size */
   41|  27.4k|            assert(strlen(pData) + 1 <= iter->data_size);
  ------------------
  |  Branch (41:13): [True: 0, False: 27.4k]
  |  Branch (41:13): [True: 27.4k, False: 0]
  ------------------
   42|  27.4k|        }
   43|   420k|        else if (PB_LTYPE(iter->type) == PB_LTYPE_BYTES)
  ------------------
  |  |  335|   420k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   420k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      else if (PB_LTYPE(iter->type) == PB_LTYPE_BYTES)
  ------------------
  |  |  287|   420k|#define PB_LTYPE_BYTES 0x06U
  ------------------
  |  Branch (43:18): [True: 12.1k, False: 407k]
  ------------------
   44|  12.1k|        {
   45|       |            /* Bytes length must be at most statically allocated size */
   46|  12.1k|            pb_bytes_array_t *bytes = pData;
   47|  12.1k|            assert(PB_BYTES_ARRAY_T_ALLOCSIZE(bytes->size) <= iter->data_size);
  ------------------
  |  Branch (47:13): [True: 0, False: 12.1k]
  |  Branch (47:13): [True: 0, False: 12.1k]
  |  Branch (47:13): [True: 5.96k, False: 6.23k]
  |  Branch (47:13): [True: 12.1k, False: 0]
  ------------------
   48|  12.1k|        }
   49|   407k|        else if (PB_LTYPE(iter->type) == PB_LTYPE_BOOL)
  ------------------
  |  |  335|   407k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  ------------------
  |  |  |  |  314|   407k|#define PB_LTYPE_MASK 0x0FU
  |  |  ------------------
  ------------------
                      else if (PB_LTYPE(iter->type) == PB_LTYPE_BOOL)
  ------------------
  |  |  275|   407k|#define PB_LTYPE_BOOL    0x00U /* bool */
  ------------------
  |  Branch (49:18): [True: 11.8k, False: 396k]
  ------------------
   50|  11.8k|        {
   51|       |            /* Bool fields must have valid value */
   52|  11.8k|            assert(memcmp(pData, &truebool, sizeof(bool)) == 0 ||
  ------------------
  |  Branch (52:13): [True: 11.8k, False: 0]
  |  Branch (52:13): [True: 0, False: 0]
  |  Branch (52:13): [True: 5.02k, False: 6.83k]
  |  Branch (52:13): [True: 6.83k, False: 0]
  ------------------
   53|  11.8k|                   memcmp(pData, &falsebool, sizeof(bool)) == 0);
   54|  11.8k|        }
   55|   396k|        else if (PB_LTYPE_IS_SUBMSG(iter->type))
  ------------------
  |  |  336|   396k|#define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  335|   396k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|   396k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define PB_LTYPE_IS_SUBMSG(x) (PB_LTYPE(x) == PB_LTYPE_SUBMESSAGE || \
  |  |  ------------------
  |  |  |  |  295|   792k|#define PB_LTYPE_SUBMESSAGE 0x08U
  |  |  ------------------
  |  |  |  Branch (336:32): [True: 42.7k, False: 353k]
  |  |  ------------------
  |  |  337|   396k|                               PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  335|   353k|#define PB_LTYPE(x) ((x) & PB_LTYPE_MASK)
  |  |  |  |  ------------------
  |  |  |  |  |  |  314|   353k|#define PB_LTYPE_MASK 0x0FU
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                              PB_LTYPE(x) == PB_LTYPE_SUBMSG_W_CB)
  |  |  ------------------
  |  |  |  |  300|   353k|#define PB_LTYPE_SUBMSG_W_CB 0x09U
  |  |  ------------------
  |  |  |  Branch (337:32): [True: 0, False: 353k]
  |  |  ------------------
  ------------------
   56|  42.7k|        {
   57|  42.7k|            validate_message(pData, 0, iter->submsg_desc);
   58|  42.7k|        }
   59|   447k|    }
   60|   474k|}
validate_message:
  145|  47.8k|{
  146|  47.8k|    pb_field_iter_t iter;
  147|       |
  148|  47.8k|    if (pb_field_iter_begin_const(&iter, msgtype, msg))
  ------------------
  |  Branch (148:9): [True: 35.5k, False: 12.3k]
  ------------------
  149|  35.5k|    {
  150|  35.5k|        do
  151|   513k|        {
  152|   513k|            if (PB_ATYPE(iter.type) == PB_ATYPE_STATIC)
  ------------------
  |  |  333|   513k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|   513k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                          if (PB_ATYPE(iter.type) == PB_ATYPE_STATIC)
  ------------------
  |  |  328|   513k|#define PB_ATYPE_STATIC   0x00U
  ------------------
  |  Branch (152:17): [True: 498k, False: 15.4k]
  ------------------
  153|   498k|            {
  154|   498k|                validate_static(&iter);
  155|   498k|            }
  156|  15.4k|            else if (PB_ATYPE(iter.type) == PB_ATYPE_POINTER)
  ------------------
  |  |  333|  15.4k|#define PB_ATYPE(x) ((x) & PB_ATYPE_MASK)
  |  |  ------------------
  |  |  |  |  331|  15.4k|#define PB_ATYPE_MASK     0xC0U
  |  |  ------------------
  ------------------
                          else if (PB_ATYPE(iter.type) == PB_ATYPE_POINTER)
  ------------------
  |  |  329|  15.4k|#define PB_ATYPE_POINTER  0x80U
  ------------------
  |  Branch (156:22): [True: 0, False: 15.4k]
  ------------------
  157|      0|            {
  158|      0|                validate_pointer(&iter);
  159|      0|            }
  160|   513k|        } while (pb_field_iter_next(&iter));
  ------------------
  |  Branch (160:18): [True: 478k, False: 35.5k]
  ------------------
  161|  35.5k|    }
  162|  47.8k|}

