cmetrics.c:cfl_list_init:
   64|  2.13M|{
   65|  2.13M|    list->next = list;
   66|  2.13M|    list->prev = list;
   67|  2.13M|}
cmetrics.c:cfl_list_entry_init:
  171|   426k|{
  172|   426k|    entry->next = NULL;
  173|   426k|    entry->prev = NULL;
  174|   426k|}
cmt_label.c:cfl_list_init:
   64|   426k|{
   65|   426k|    list->next = list;
   66|   426k|    list->prev = list;
   67|   426k|}
cfl_kvlist.c:cfl_list_init:
   64|  1.02M|{
   65|  1.02M|    list->next = list;
   66|  1.02M|    list->prev = list;
   67|  1.02M|}
cfl_kvlist.c:cfl_list_del:
   77|  27.5k|{
   78|  27.5k|    __cfl_list_del(entry->prev, entry->next);
   79|       |
   80|  27.5k|    entry->prev = NULL;
   81|  27.5k|    entry->next = NULL;
   82|  27.5k|}
cfl_kvlist.c:__cfl_list_del:
   71|  27.5k|{
   72|  27.5k|    prev->next = next;
   73|  27.5k|    next->prev = prev;
   74|  27.5k|}
cfl_kvlist.c:cfl_list_add:
   96|  27.5k|{
   97|  27.5k|    __cfl_list_add(_new, head->prev, head);
   98|  27.5k|}
cfl_kvlist.c:__cfl_list_add:
   87|  27.5k|{
   88|  27.5k|    next->prev = _new;
   89|  27.5k|    _new->next = next;
   90|  27.5k|    _new->prev = prev;
   91|  27.5k|    prev->next = _new;
   92|  27.5k|}

cfl_array_create:
   25|  8.64k|{
   26|  8.64k|    struct cfl_array *array;
   27|       |
   28|  8.64k|    array = malloc(sizeof(struct cfl_array));
   29|  8.64k|    if (array == NULL) {
  ------------------
  |  Branch (29:9): [True: 0, False: 8.64k]
  ------------------
   30|      0|        cfl_errno();
  ------------------
  |  |   33|      0|#define cfl_errno() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (33:34): [Folded - Ignored]
  |  |  ------------------
  ------------------
   31|      0|        return NULL;
   32|      0|    }
   33|       |
   34|       |    /* by default arrays are not resizable */
   35|  8.64k|    array->resizable = CFL_FALSE;
  ------------------
  |  |   23|  8.64k|#define CFL_FALSE   0
  ------------------
   36|       |
   37|       |    /* allocate fixed number of entries */
   38|  8.64k|    array->entries = calloc(slot_count, sizeof(void *));
   39|  8.64k|    if (array->entries == NULL) {
  ------------------
  |  Branch (39:9): [True: 0, False: 8.64k]
  ------------------
   40|      0|        cfl_errno();
  ------------------
  |  |   33|      0|#define cfl_errno() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (33:34): [Folded - Ignored]
  |  |  ------------------
  ------------------
   41|      0|        free(array);
   42|      0|        return NULL;
   43|      0|    }
   44|       |
   45|  8.64k|    array->entry_count = 0;
   46|  8.64k|    array->slot_count = slot_count;
   47|       |
   48|  8.64k|    return array;
   49|  8.64k|}
cfl_array_destroy:
   52|  8.64k|{
   53|  8.64k|    size_t index;
   54|       |
   55|  8.64k|    if (!array) {
  ------------------
  |  Branch (55:9): [True: 0, False: 8.64k]
  ------------------
   56|      0|        return;
   57|      0|    }
   58|       |
   59|  8.64k|    if (array->entries != NULL) {
  ------------------
  |  Branch (59:9): [True: 8.64k, False: 0]
  ------------------
   60|   622k|        for (index = 0 ; index < array->entry_count ; index++) {
  ------------------
  |  Branch (60:26): [True: 613k, False: 8.64k]
  ------------------
   61|   613k|            if(array->entries[index] != NULL) {
  ------------------
  |  Branch (61:16): [True: 613k, False: 0]
  ------------------
   62|   613k|                cfl_variant_destroy(array->entries[index]);
   63|   613k|            }
   64|   613k|        }
   65|       |
   66|  8.64k|        free(array->entries);
   67|  8.64k|    }
   68|  8.64k|    free(array);
   69|  8.64k|}
cfl_array_resizable:
   72|    660|{
   73|    660|    if (v != CFL_TRUE && v != CFL_FALSE) {
  ------------------
  |  |   24|  1.32k|#define CFL_TRUE    !CFL_FALSE
  |  |  ------------------
  |  |  |  |   23|  1.32k|#define CFL_FALSE   0
  |  |  ------------------
  ------------------
                  if (v != CFL_TRUE && v != CFL_FALSE) {
  ------------------
  |  |   23|      0|#define CFL_FALSE   0
  ------------------
  |  Branch (73:9): [True: 0, False: 660]
  |  Branch (73:26): [True: 0, False: 0]
  ------------------
   74|      0|        return -1;
   75|      0|    }
   76|       |
   77|    660|    array->resizable = v;
   78|    660|    return 0;
   79|    660|}
cfl_array_append:
  119|   613k|{
  120|   613k|    void *tmp;
  121|   613k|    size_t new_slot_count;
  122|   613k|    size_t new_size;
  123|       |
  124|   613k|    if (array->entry_count >= array->slot_count) {
  ------------------
  |  Branch (124:9): [True: 584, False: 613k]
  ------------------
  125|       |        /*
  126|       |         * if there is no more space but the caller allowed to resize
  127|       |         * the array, just double the size. Yeah, this is scary and should
  128|       |         * be used only when the caller 'knows this is safe to do' because
  129|       |         * it controls the input data.
  130|       |         */
  131|    584|        if (array->resizable) {
  ------------------
  |  Branch (131:13): [True: 584, False: 0]
  ------------------
  132|       |
  133|       |            /*
  134|       |             * if the array size is zero (created as an array of 0 slots),
  135|       |             * change the size to 1 so the resize can work properly
  136|       |             */
  137|    584|            if (array->slot_count == 0) {
  ------------------
  |  Branch (137:17): [True: 0, False: 584]
  ------------------
  138|      0|                array->slot_count = 1;
  139|      0|            }
  140|       |
  141|       |            /* set new number of slots and total size */
  142|    584|            new_slot_count = (array->slot_count * 2);
  143|    584|            new_size = (new_slot_count * sizeof(void *));
  144|       |
  145|    584|            tmp = realloc(array->entries, new_size);
  146|    584|            if (!tmp) {
  ------------------
  |  Branch (146:17): [True: 0, False: 584]
  ------------------
  147|      0|                cfl_report_runtime_error();
  ------------------
  |  |   28|      0|#define cfl_report_runtime_error() cfl_report_runtime_error_impl(errno, __FILENAME__, __LINE__)
  ------------------
  148|      0|                return -1;
  149|      0|            }
  150|    584|            array->slot_count = new_slot_count;
  151|    584|            array->entries = tmp;
  152|    584|        }
  153|      0|        else {
  154|      0|            return -1;
  155|      0|        }
  156|    584|    }
  157|       |
  158|       |    /* this is just a double check to make sure the slot is really available */
  159|   613k|    if (array->entry_count >= array->slot_count) {
  ------------------
  |  Branch (159:9): [True: 0, False: 613k]
  ------------------
  160|      0|        return -1;
  161|      0|    }
  162|       |
  163|   613k|    array->entries[array->entry_count++] = value;
  164|   613k|    return 0;
  165|   613k|}

cfl_kvlist_create:
   27|  1.02M|{
   28|  1.02M|    struct cfl_kvlist *list;
   29|       |
   30|  1.02M|    list = malloc(sizeof(struct cfl_kvlist));
   31|  1.02M|    if (list == NULL) {
  ------------------
  |  Branch (31:9): [True: 0, False: 1.02M]
  ------------------
   32|      0|        cfl_report_runtime_error();
  ------------------
  |  |   28|      0|#define cfl_report_runtime_error() cfl_report_runtime_error_impl(errno, __FILENAME__, __LINE__)
  ------------------
   33|      0|        return NULL;
   34|      0|    }
   35|       |
   36|  1.02M|    cfl_list_init(&list->list);
   37|  1.02M|    return list;
   38|  1.02M|}
cfl_kvlist_destroy:
   41|  1.02M|{
   42|  1.02M|    struct cfl_list *tmp;
   43|  1.02M|    struct cfl_list *head;
   44|  1.02M|    struct cfl_kvpair *pair;
   45|       |
   46|  1.02M|    cfl_list_foreach_safe(head, tmp, &list->list) {
  ------------------
  |  |  199|  1.04M|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 27.5k, False: 1.02M]
  |  |  ------------------
  ------------------
   47|  27.5k|        pair = cfl_list_entry(head, struct cfl_kvpair, _head);
  ------------------
  |  |  206|  27.5k|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|  27.5k|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|  27.5k|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|  27.5k|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
   48|       |
   49|  27.5k|        if (pair->key) {
  ------------------
  |  Branch (49:13): [True: 27.5k, False: 0]
  ------------------
   50|  27.5k|            cfl_sds_destroy(pair->key);
   51|  27.5k|        }
   52|       |
   53|  27.5k|        if (pair->val) {
  ------------------
  |  Branch (53:13): [True: 27.5k, False: 0]
  ------------------
   54|  27.5k|            cfl_variant_destroy(pair->val);
   55|  27.5k|        }
   56|  27.5k|        cfl_list_del(&pair->_head);
   57|  27.5k|        free(pair);
   58|  27.5k|    }
   59|       |
   60|  1.02M|    free(list);
   61|  1.02M|}
cfl_kvlist_insert_s:
  294|  27.5k|{
  295|  27.5k|    struct cfl_kvpair *pair;
  296|       |
  297|  27.5k|    if (list == NULL || key == NULL || value == NULL) {
  ------------------
  |  Branch (297:9): [True: 0, False: 27.5k]
  |  Branch (297:25): [True: 0, False: 27.5k]
  |  Branch (297:40): [True: 0, False: 27.5k]
  ------------------
  298|      0|        return -1;
  299|      0|    }
  300|       |
  301|  27.5k|    pair = malloc(sizeof(struct cfl_kvpair));
  302|  27.5k|    if (pair == NULL) {
  ------------------
  |  Branch (302:9): [True: 0, False: 27.5k]
  ------------------
  303|      0|        cfl_report_runtime_error();
  ------------------
  |  |   28|      0|#define cfl_report_runtime_error() cfl_report_runtime_error_impl(errno, __FILENAME__, __LINE__)
  ------------------
  304|      0|        return -1;
  305|      0|    }
  306|       |
  307|  27.5k|    pair->key = cfl_sds_create_len(key, key_size);
  308|  27.5k|    if (pair->key == NULL) {
  ------------------
  |  Branch (308:9): [True: 0, False: 27.5k]
  ------------------
  309|      0|        free(pair);
  310|       |
  311|      0|        return -2;
  312|      0|    }
  313|       |
  314|  27.5k|    pair->val = value;
  315|       |
  316|  27.5k|    cfl_list_add(&pair->_head, &list->list);
  317|  27.5k|    return 0;
  318|  27.5k|}
cfl_kvlist_insert:
  414|  27.5k|{
  415|  27.5k|    return cfl_kvlist_insert_s(list, key, strlen(key), value);
  416|  27.5k|}

sds_alloc:
   42|  36.2k|{
   43|  36.2k|    void *buf;
   44|  36.2k|    cfl_sds_t s;
   45|  36.2k|    struct cfl_sds *head;
   46|       |
   47|  36.2k|    buf = malloc(CFL_SDS_HEADER_SIZE + size + 1);
  ------------------
  |  |   32|  36.2k|#define CFL_SDS_HEADER_SIZE (sizeof(uint64_t) + sizeof(uint64_t))
  ------------------
   48|  36.2k|    if (!buf) {
  ------------------
  |  Branch (48:9): [True: 0, False: 36.2k]
  ------------------
   49|      0|        return NULL;
   50|      0|    }
   51|       |
   52|  36.2k|    head = buf;
   53|  36.2k|    head->len = 0;
   54|  36.2k|    head->alloc = size;
   55|       |
   56|  36.2k|    s = head->buf;
   57|  36.2k|    *s = '\0';
   58|       |
   59|  36.2k|    return s;
   60|  36.2k|}
cfl_sds_create_len:
   94|  27.5k|{
   95|  27.5k|    cfl_sds_t s;
   96|  27.5k|    struct cfl_sds *head;
   97|       |
   98|  27.5k|    s = sds_alloc(len);
   99|  27.5k|    if (!s) {
  ------------------
  |  Branch (99:9): [True: 0, False: 27.5k]
  ------------------
  100|      0|        return NULL;
  101|      0|    }
  102|       |
  103|  27.5k|    if (str) {
  ------------------
  |  Branch (103:9): [True: 27.5k, False: 0]
  ------------------
  104|  27.5k|        memcpy(s, str, len);
  105|  27.5k|        s[len] = '\0';
  106|       |
  107|  27.5k|        head = CFL_SDS_HEADER(s);
  ------------------
  |  |   44|  27.5k|#define CFL_SDS_HEADER(s)  ((struct cfl_sds *) (s - CFL_SDS_HEADER_SIZE))
  |  |  ------------------
  |  |  |  |   32|  27.5k|#define CFL_SDS_HEADER_SIZE (sizeof(uint64_t) + sizeof(uint64_t))
  |  |  ------------------
  ------------------
  108|  27.5k|        head->len = len;
  109|  27.5k|    }
  110|  27.5k|    return s;
  111|  27.5k|}
cfl_sds_destroy:
  128|  36.2k|{
  129|  36.2k|    struct cfl_sds *head;
  130|       |
  131|  36.2k|    if (!s) {
  ------------------
  |  Branch (131:9): [True: 0, False: 36.2k]
  ------------------
  132|      0|        return;
  133|      0|    }
  134|       |
  135|  36.2k|    head = CFL_SDS_HEADER(s);
  ------------------
  |  |   44|  36.2k|#define CFL_SDS_HEADER(s)  ((struct cfl_sds *) (s - CFL_SDS_HEADER_SIZE))
  |  |  ------------------
  |  |  |  |   32|  36.2k|#define CFL_SDS_HEADER_SIZE (sizeof(uint64_t) + sizeof(uint64_t))
  |  |  ------------------
  ------------------
  136|  36.2k|    free(head);
  137|  36.2k|}
cfl_sds_create_size:
  163|  8.67k|{
  164|  8.67k|    return sds_alloc(size);
  165|  8.67k|}
cfl_sds_set_len:
  168|  8.67k|{
  169|  8.67k|    struct cfl_sds *head;
  170|       |
  171|  8.67k|    head = CFL_SDS_HEADER(s);
  ------------------
  |  |   44|  8.67k|#define CFL_SDS_HEADER(s)  ((struct cfl_sds *) (s - CFL_SDS_HEADER_SIZE))
  |  |  ------------------
  |  |  |  |   32|  8.67k|#define CFL_SDS_HEADER_SIZE (sizeof(uint64_t) + sizeof(uint64_t))
  |  |  ------------------
  ------------------
  172|  8.67k|    head->len = len;
  173|  8.67k|}

cfl_variant_create_from_bool:
  149|  5.23k|{
  150|  5.23k|    struct cfl_variant *instance;
  151|       |
  152|  5.23k|    instance = cfl_variant_create();
  153|  5.23k|    if (instance != NULL) {
  ------------------
  |  Branch (153:9): [True: 5.23k, False: 0]
  ------------------
  154|  5.23k|        instance->data.as_bool = value;
  155|  5.23k|        instance->type = CFL_VARIANT_BOOL;
  ------------------
  |  |   27|  5.23k|#define CFL_VARIANT_BOOL       1
  ------------------
  156|  5.23k|    }
  157|       |
  158|  5.23k|    return instance;
  159|  5.23k|}
cfl_variant_create_from_int64:
  162|   595k|{
  163|   595k|    struct cfl_variant *instance;
  164|       |
  165|   595k|    instance = cfl_variant_create();
  166|   595k|    if (instance != NULL) {
  ------------------
  |  Branch (166:9): [True: 595k, False: 0]
  ------------------
  167|   595k|        instance->data.as_int64 = value;
  168|   595k|        instance->type = CFL_VARIANT_INT;
  ------------------
  |  |   28|   595k|#define CFL_VARIANT_INT        2
  ------------------
  169|   595k|    }
  170|       |
  171|   595k|    return instance;
  172|   595k|}
cfl_variant_create_from_double:
  188|  1.20k|{
  189|  1.20k|    struct cfl_variant *instance;
  190|       |
  191|  1.20k|    instance = cfl_variant_create();
  192|  1.20k|    if (instance != NULL) {
  ------------------
  |  Branch (192:9): [True: 1.20k, False: 0]
  ------------------
  193|  1.20k|        instance->data.as_double = value;
  194|  1.20k|        instance->type = CFL_VARIANT_DOUBLE;
  ------------------
  |  |   30|  1.20k|#define CFL_VARIANT_DOUBLE     4
  ------------------
  195|  1.20k|    }
  196|       |
  197|  1.20k|    return instance;
  198|  1.20k|}
cfl_variant_create_from_array:
  213|  3.15k|{
  214|  3.15k|    struct cfl_variant *instance;
  215|       |
  216|  3.15k|    instance = cfl_variant_create();
  217|  3.15k|    if (instance != NULL) {
  ------------------
  |  Branch (217:9): [True: 3.15k, False: 0]
  ------------------
  218|  3.15k|        instance->data.as_array = value;
  219|  3.15k|        instance->type = CFL_VARIANT_ARRAY;
  ------------------
  |  |   35|  3.15k|#define CFL_VARIANT_ARRAY      9
  ------------------
  220|  3.15k|    }
  221|       |
  222|  3.15k|    return instance;
  223|  3.15k|}
cfl_variant_create_from_kvlist:
  226|  27.5k|{
  227|  27.5k|    struct cfl_variant *instance;
  228|       |
  229|  27.5k|    instance = cfl_variant_create();
  230|  27.5k|    if (instance != NULL) {
  ------------------
  |  Branch (230:9): [True: 27.5k, False: 0]
  ------------------
  231|  27.5k|        instance->data.as_kvlist = value;
  232|  27.5k|        instance->type = CFL_VARIANT_KVLIST;
  ------------------
  |  |   36|  27.5k|#define CFL_VARIANT_KVLIST    10
  ------------------
  233|  27.5k|    }
  234|       |
  235|  27.5k|    return instance;
  236|  27.5k|}
cfl_variant_create_from_reference:
  239|  8.31k|{
  240|  8.31k|    struct cfl_variant *instance;
  241|       |
  242|  8.31k|    instance = cfl_variant_create();
  243|  8.31k|    if (instance != NULL) {
  ------------------
  |  Branch (243:9): [True: 8.31k, False: 0]
  ------------------
  244|  8.31k|        instance->data.as_reference = value;
  245|  8.31k|        instance->type = CFL_VARIANT_REFERENCE;
  ------------------
  |  |   32|  8.31k|#define CFL_VARIANT_REFERENCE  6
  ------------------
  246|  8.31k|    }
  247|       |
  248|  8.31k|    return instance;
  249|  8.31k|}
cfl_variant_create:
  252|   641k|{
  253|   641k|    struct cfl_variant *instance;
  254|       |
  255|   641k|    instance = calloc(1, sizeof(struct cfl_variant));
  256|   641k|    if (instance == NULL) {
  ------------------
  |  Branch (256:9): [True: 0, False: 641k]
  ------------------
  257|      0|        cfl_errno();
  ------------------
  |  |   33|      0|#define cfl_errno() do {} while (0)
  |  |  ------------------
  |  |  |  Branch (33:34): [Folded - Ignored]
  |  |  ------------------
  ------------------
  258|      0|        return NULL;
  259|      0|    }
  260|   641k|    instance->size = 0;
  261|       |
  262|   641k|    return instance;
  263|   641k|}
cfl_variant_destroy:
  266|   641k|{
  267|   641k|    if (!instance) {
  ------------------
  |  Branch (267:9): [True: 0, False: 641k]
  ------------------
  268|      0|        return;
  269|      0|    }
  270|       |
  271|   641k|    if (instance->type == CFL_VARIANT_STRING ||
  ------------------
  |  |   33|  1.28M|#define CFL_VARIANT_STRING     7
  ------------------
  |  Branch (271:9): [True: 3.48k, False: 637k]
  ------------------
  272|   641k|        instance->type == CFL_VARIANT_BYTES) {
  ------------------
  |  |   34|   637k|#define CFL_VARIANT_BYTES      8
  ------------------
  |  Branch (272:9): [True: 4.83k, False: 633k]
  ------------------
  273|  8.31k|        if (instance->data.as_string != NULL && !instance->referenced) {
  ------------------
  |  Branch (273:13): [True: 8.31k, False: 0]
  |  Branch (273:49): [True: 8.31k, False: 0]
  ------------------
  274|  8.31k|            cfl_sds_destroy(instance->data.as_string);
  275|  8.31k|        }
  276|  8.31k|    }
  277|   633k|    else if (instance->type == CFL_VARIANT_ARRAY) {
  ------------------
  |  |   35|   633k|#define CFL_VARIANT_ARRAY      9
  ------------------
  |  Branch (277:14): [True: 3.15k, False: 629k]
  ------------------
  278|  3.15k|        cfl_array_destroy(instance->data.as_array);
  279|  3.15k|    }
  280|   629k|    else if (instance->type == CFL_VARIANT_KVLIST) {
  ------------------
  |  |   36|   629k|#define CFL_VARIANT_KVLIST    10
  ------------------
  |  Branch (280:14): [True: 27.5k, False: 602k]
  ------------------
  281|  27.5k|        cfl_kvlist_destroy(instance->data.as_kvlist);
  282|  27.5k|    }
  283|       |
  284|   641k|    free(instance);
  285|   641k|}

cmt_decode_msgpack.c:unpack_cfl_kvlist:
  285|   169k|{
  286|   169k|    struct cfl_kvlist   *internal_kvlist;
  287|   169k|    char                 key_name[256];
  288|   169k|    size_t               entry_count;
  289|   169k|    size_t               key_length;
  290|   169k|    struct cfl_variant  *key_value;
  291|   169k|    mpack_tag_t          key_tag;
  292|   169k|    int                  result;
  293|   169k|    size_t               index;
  294|   169k|    mpack_tag_t          tag;
  295|       |
  296|   169k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_map);
  297|       |
  298|   169k|    if (result != 0) {
  ------------------
  |  Branch (298:9): [True: 0, False: 169k]
  ------------------
  299|      0|        return result;
  300|      0|    }
  301|       |
  302|   169k|    entry_count = mpack_tag_map_count(&tag);
  303|       |
  304|   169k|    internal_kvlist = cfl_kvlist_create();
  305|       |
  306|   169k|    if (internal_kvlist == NULL) {
  ------------------
  |  Branch (306:9): [True: 0, False: 169k]
  ------------------
  307|      0|        return -3;
  308|      0|    }
  309|       |
  310|   169k|    result = 0;
  311|   169k|    key_value = NULL;
  312|       |
  313|   197k|    for (index = 0 ; index < entry_count ; index++) {
  ------------------
  |  Branch (313:22): [True: 169k, False: 27.5k]
  ------------------
  314|   169k|        result = unpack_cfl_variant_read_tag(reader, &key_tag, mpack_type_str);
  315|       |
  316|   169k|        if (result != 0) {
  ------------------
  |  Branch (316:13): [True: 64, False: 169k]
  ------------------
  317|     64|            result = -4;
  318|       |
  319|     64|            break;
  320|     64|        }
  321|       |
  322|   169k|        key_length = mpack_tag_str_length(&key_tag);
  323|       |
  324|   169k|        if (key_length >= sizeof(key_name)) {
  ------------------
  |  Branch (324:13): [True: 1, False: 169k]
  ------------------
  325|      1|            result = -5;
  326|       |
  327|      1|            break;
  328|      1|        }
  329|       |
  330|   169k|        mpack_read_cstr(reader, key_name, sizeof(key_name), key_length);
  331|       |
  332|   169k|        key_name[key_length] = '\0';
  333|       |
  334|   169k|        mpack_done_str(reader);
  335|       |
  336|   169k|        if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (336:13): [True: 5, False: 169k]
  ------------------
  337|      5|            result = -6;
  338|       |
  339|      5|            break;
  340|      5|        }
  341|       |
  342|   169k|        result = unpack_cfl_variant(reader, &key_value);
  343|       |
  344|   169k|        if (result != 0) {
  ------------------
  |  Branch (344:13): [True: 142k, False: 27.5k]
  ------------------
  345|   142k|            result = -7;
  346|       |
  347|   142k|            break;
  348|   142k|        }
  349|       |
  350|  27.5k|        result = cfl_kvlist_insert(internal_kvlist, key_name, key_value);
  351|       |
  352|  27.5k|        if (result != 0) {
  ------------------
  |  Branch (352:13): [True: 0, False: 27.5k]
  ------------------
  353|      0|            result = -8;
  354|       |
  355|      0|            break;
  356|      0|        }
  357|       |
  358|  27.5k|        key_value = NULL;
  359|  27.5k|    }
  360|       |
  361|   169k|    mpack_done_map(reader);
  362|       |
  363|   169k|    if (mpack_reader_error(reader) != mpack_ok) {
  ------------------
  |  Branch (363:9): [True: 66.9k, False: 102k]
  ------------------
  364|  66.9k|        result = -9;
  365|  66.9k|    }
  366|       |
  367|   169k|    if (result != 0) {
  ------------------
  |  Branch (367:9): [True: 142k, False: 27.5k]
  ------------------
  368|   142k|        cfl_kvlist_destroy(internal_kvlist);
  369|       |
  370|   142k|        if (key_value != NULL) {
  ------------------
  |  Branch (370:13): [True: 0, False: 142k]
  ------------------
  371|      0|            cfl_variant_destroy(key_value);
  372|      0|        }
  373|   142k|    }
  374|  27.5k|    else {
  375|  27.5k|        *result_kvlist = internal_kvlist;
  376|  27.5k|    }
  377|       |
  378|   169k|    return result;
  379|   169k|}
cmt_decode_msgpack.c:unpack_cfl_variant_read_tag:
  201|   958k|{
  202|   958k|    *tag = mpack_read_tag(reader);
  203|       |
  204|   958k|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (204:9): [True: 4, False: 958k]
  ------------------
  205|      4|        return -1;
  206|      4|    }
  207|       |
  208|   958k|    if (mpack_tag_type(tag) != expected_type) {
  ------------------
  |  Branch (208:9): [True: 60, False: 958k]
  ------------------
  209|     60|        return -2;
  210|     60|    }
  211|       |
  212|   958k|    return 0;
  213|   958k|}
cmt_decode_msgpack.c:unpack_cfl_variant:
  599|   789k|{
  600|   789k|    mpack_type_t value_type;
  601|   789k|    int          result;
  602|   789k|    mpack_tag_t  tag;
  603|       |
  604|   789k|    tag = mpack_peek_tag(reader);
  605|       |
  606|   789k|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (606:9): [True: 6, False: 789k]
  ------------------
  607|      6|        return -1;
  608|      6|    }
  609|       |
  610|   789k|    value_type = mpack_tag_type(&tag);
  611|       |
  612|   789k|    if (value_type == mpack_type_str) {
  ------------------
  |  Branch (612:9): [True: 3.52k, False: 785k]
  ------------------
  613|  3.52k|        result = unpack_cfl_variant_string(reader, value);
  614|  3.52k|    }
  615|   785k|    else if (value_type == mpack_type_bool) {
  ------------------
  |  Branch (615:14): [True: 5.23k, False: 780k]
  ------------------
  616|  5.23k|        result = unpack_cfl_variant_boolean(reader, value);
  617|  5.23k|    }
  618|   780k|    else if (value_type == mpack_type_int) {
  ------------------
  |  Branch (618:14): [True: 68.8k, False: 711k]
  ------------------
  619|  68.8k|        result = unpack_cfl_variant_int64(reader, value);
  620|  68.8k|    }
  621|   711k|    else if (value_type == mpack_type_uint) {
  ------------------
  |  Branch (621:14): [True: 527k, False: 184k]
  ------------------
  622|   527k|        result = unpack_cfl_variant_uint64(reader, value);
  623|   527k|    }
  624|   184k|    else if (value_type == mpack_type_double) {
  ------------------
  |  Branch (624:14): [True: 1.20k, False: 183k]
  ------------------
  625|  1.20k|        result = unpack_cfl_variant_double(reader, value);
  626|  1.20k|    }
  627|   183k|    else if (value_type == mpack_type_array) {
  ------------------
  |  Branch (627:14): [True: 8.64k, False: 174k]
  ------------------
  628|  8.64k|        result = unpack_cfl_variant_array(reader, value);
  629|  8.64k|    }
  630|   174k|    else if (value_type == mpack_type_map) {
  ------------------
  |  Branch (630:14): [True: 169k, False: 4.88k]
  ------------------
  631|   169k|        result = unpack_cfl_variant_kvlist(reader, value);
  632|   169k|    }
  633|  4.88k|    else if (value_type == mpack_type_bin) {
  ------------------
  |  Branch (633:14): [True: 4.83k, False: 49]
  ------------------
  634|  4.83k|        result = unpack_cfl_variant_binary(reader, value);
  635|  4.83k|    }
  636|     49|    else {
  637|     49|        result = -1;
  638|     49|    }
  639|       |
  640|   789k|    return result;
  641|   789k|}
cmt_decode_msgpack.c:unpack_cfl_variant_string:
  383|  3.52k|{
  384|  3.52k|    size_t      value_length;
  385|  3.52k|    char       *value_data;
  386|  3.52k|    int         result;
  387|  3.52k|    mpack_tag_t tag;
  388|       |
  389|  3.52k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_str);
  390|       |
  391|  3.52k|    if (result != 0) {
  ------------------
  |  Branch (391:9): [True: 0, False: 3.52k]
  ------------------
  392|      0|        return result;
  393|      0|    }
  394|       |
  395|  3.52k|    value_length = mpack_tag_str_length(&tag);
  396|       |
  397|  3.52k|    value_data = cfl_sds_create_size(value_length + 1);
  398|       |
  399|  3.52k|    if (value_data == NULL) {
  ------------------
  |  Branch (399:9): [True: 0, False: 3.52k]
  ------------------
  400|      0|        return -3;
  401|      0|    }
  402|       |
  403|  3.52k|    cfl_sds_set_len(value_data, value_length);
  404|       |
  405|  3.52k|    mpack_read_cstr(reader, value_data, value_length + 1, value_length);
  406|       |
  407|  3.52k|    mpack_done_str(reader);
  408|       |
  409|  3.52k|    if (mpack_reader_error(reader) != mpack_ok) {
  ------------------
  |  Branch (409:9): [True: 36, False: 3.48k]
  ------------------
  410|     36|        cfl_sds_destroy(value_data);
  411|       |
  412|     36|        return -4;
  413|     36|    }
  414|       |
  415|  3.48k|    *value = cfl_variant_create_from_reference(value_data);
  416|       |
  417|  3.48k|    if (*value == NULL) {
  ------------------
  |  Branch (417:9): [True: 0, False: 3.48k]
  ------------------
  418|      0|        return -5;
  419|      0|    }
  420|       |
  421|  3.48k|    (*value)->type = CFL_VARIANT_STRING;
  ------------------
  |  |   33|  3.48k|#define CFL_VARIANT_STRING     7
  ------------------
  422|       |
  423|  3.48k|    return 0;
  424|  3.48k|}
cmt_decode_msgpack.c:unpack_cfl_variant_boolean:
  473|  5.23k|{
  474|  5.23k|    int         result;
  475|  5.23k|    mpack_tag_t tag;
  476|       |
  477|  5.23k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_bool);
  478|       |
  479|  5.23k|    if (result != 0) {
  ------------------
  |  Branch (479:9): [True: 0, False: 5.23k]
  ------------------
  480|      0|        return result;
  481|      0|    }
  482|       |
  483|  5.23k|    *value = cfl_variant_create_from_bool((unsigned int) mpack_tag_bool_value(&tag));
  484|       |
  485|  5.23k|    if (*value == NULL) {
  ------------------
  |  Branch (485:9): [True: 0, False: 5.23k]
  ------------------
  486|      0|        return -3;
  487|      0|    }
  488|       |
  489|  5.23k|    return 0;
  490|  5.23k|}
cmt_decode_msgpack.c:unpack_cfl_variant_int64:
  515|  68.8k|{
  516|  68.8k|    int         result;
  517|  68.8k|    mpack_tag_t tag;
  518|       |
  519|  68.8k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_int);
  520|       |
  521|  68.8k|    if (result != 0) {
  ------------------
  |  Branch (521:9): [True: 0, False: 68.8k]
  ------------------
  522|      0|        return result;
  523|      0|    }
  524|       |
  525|  68.8k|    *value = cfl_variant_create_from_int64((int64_t) mpack_tag_int_value(&tag));
  526|       |
  527|  68.8k|    if (*value == NULL) {
  ------------------
  |  Branch (527:9): [True: 0, False: 68.8k]
  ------------------
  528|      0|        return -3;
  529|      0|    }
  530|       |
  531|  68.8k|    return 0;
  532|  68.8k|}
cmt_decode_msgpack.c:unpack_cfl_variant_uint64:
  494|   527k|{
  495|   527k|    int         result;
  496|   527k|    mpack_tag_t tag;
  497|       |
  498|   527k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_uint);
  499|       |
  500|   527k|    if (result != 0) {
  ------------------
  |  Branch (500:9): [True: 0, False: 527k]
  ------------------
  501|      0|        return result;
  502|      0|    }
  503|       |
  504|   527k|    *value = cfl_variant_create_from_int64((int64_t) mpack_tag_uint_value(&tag));
  505|       |
  506|   527k|    if (*value == NULL) {
  ------------------
  |  Branch (506:9): [True: 0, False: 527k]
  ------------------
  507|      0|        return -3;
  508|      0|    }
  509|       |
  510|   527k|    return 0;
  511|   527k|}
cmt_decode_msgpack.c:unpack_cfl_variant_double:
  536|  1.20k|{
  537|  1.20k|    int         result;
  538|  1.20k|    mpack_tag_t tag;
  539|       |
  540|  1.20k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_double);
  541|       |
  542|  1.20k|    if (result != 0) {
  ------------------
  |  Branch (542:9): [True: 0, False: 1.20k]
  ------------------
  543|      0|        return result;
  544|      0|    }
  545|       |
  546|  1.20k|    *value = cfl_variant_create_from_double(mpack_tag_double_value(&tag));
  547|       |
  548|  1.20k|    if (*value == NULL) {
  ------------------
  |  Branch (548:9): [True: 0, False: 1.20k]
  ------------------
  549|      0|        return -3;
  550|      0|    }
  551|       |
  552|  1.20k|    return 0;
  553|  1.20k|}
cmt_decode_msgpack.c:unpack_cfl_variant_array:
  557|  8.64k|{
  558|  8.64k|    struct cfl_array *unpacked_array;
  559|  8.64k|    int               result;
  560|       |
  561|  8.64k|    result = unpack_cfl_array(reader, &unpacked_array);
  562|       |
  563|  8.64k|    if (result != 0) {
  ------------------
  |  Branch (563:9): [True: 5.49k, False: 3.15k]
  ------------------
  564|  5.49k|        return result;
  565|  5.49k|    }
  566|       |
  567|  3.15k|    *value = cfl_variant_create_from_array(unpacked_array);
  568|       |
  569|  3.15k|    if (*value == NULL) {
  ------------------
  |  Branch (569:9): [True: 0, False: 3.15k]
  ------------------
  570|      0|        return -3;
  571|      0|    }
  572|       |
  573|  3.15k|    return 0;
  574|  3.15k|}
cmt_decode_msgpack.c:unpack_cfl_array:
  217|  8.64k|{
  218|  8.64k|    struct cfl_array   *internal_array;
  219|  8.64k|    size_t              entry_count;
  220|  8.64k|    struct cfl_variant *entry_value;
  221|  8.64k|    int                 result;
  222|  8.64k|    size_t              index;
  223|  8.64k|    mpack_tag_t         tag;
  224|       |
  225|  8.64k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_array);
  226|       |
  227|  8.64k|    if (result != 0) {
  ------------------
  |  Branch (227:9): [True: 0, False: 8.64k]
  ------------------
  228|      0|        return result;
  229|      0|    }
  230|       |
  231|  8.64k|    entry_count = mpack_tag_array_count(&tag);
  232|       |
  233|  8.64k|    if (entry_count >= CFL_VARIANT_UTILS_SERIALIZED_ARRAY_SIZE_LIMIT) {
  ------------------
  |  |   27|  8.64k|#define CFL_VARIANT_UTILS_SERIALIZED_ARRAY_SIZE_LIMIT 100000
  ------------------
  |  Branch (233:9): [True: 0, False: 8.64k]
  ------------------
  234|      0|        return -2;
  235|      0|    }
  236|       |
  237|  8.64k|    if (entry_count >= CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE) {
  ------------------
  |  |   25|  8.64k|#define CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE    100
  ------------------
  |  Branch (237:9): [True: 660, False: 7.98k]
  ------------------
  238|    660|        internal_array = cfl_array_create(CFL_VARIANT_UTILS_INITIAL_ARRAY_SIZE);
  ------------------
  |  |   26|    660|#define CFL_VARIANT_UTILS_INITIAL_ARRAY_SIZE          100
  ------------------
  239|    660|    }
  240|  7.98k|    else {
  241|  7.98k|        internal_array = cfl_array_create(entry_count);
  242|  7.98k|    }
  243|       |
  244|  8.64k|    if (internal_array == NULL) {
  ------------------
  |  Branch (244:9): [True: 0, False: 8.64k]
  ------------------
  245|      0|        return -3;
  246|      0|    }
  247|       |
  248|  8.64k|    if (entry_count >= CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE) {
  ------------------
  |  |   25|  8.64k|#define CFL_VARIANT_UTILS_MAXIMUM_FIXED_ARRAY_SIZE    100
  ------------------
  |  Branch (248:9): [True: 660, False: 7.98k]
  ------------------
  249|    660|        cfl_array_resizable(internal_array, CFL_TRUE);
  ------------------
  |  |   24|    660|#define CFL_TRUE    !CFL_FALSE
  |  |  ------------------
  |  |  |  |   23|    660|#define CFL_FALSE   0
  |  |  ------------------
  ------------------
  250|    660|    }
  251|       |
  252|   622k|    for (index = 0 ; index < entry_count ; index++) {
  ------------------
  |  Branch (252:22): [True: 619k, False: 3.15k]
  ------------------
  253|   619k|        result = unpack_cfl_variant(reader, &entry_value);
  254|       |
  255|   619k|        if (result != 0) {
  ------------------
  |  Branch (255:13): [True: 5.49k, False: 613k]
  ------------------
  256|  5.49k|            cfl_array_destroy(internal_array);
  257|       |
  258|  5.49k|            return -4;
  259|  5.49k|        }
  260|       |
  261|   613k|        result = cfl_array_append(internal_array, entry_value);
  262|       |
  263|   613k|        if (result != 0) {
  ------------------
  |  Branch (263:13): [True: 0, False: 613k]
  ------------------
  264|      0|            cfl_array_destroy(internal_array);
  265|       |
  266|      0|            return -5;
  267|      0|        }
  268|   613k|    }
  269|       |
  270|  3.15k|    mpack_done_array(reader);
  271|       |
  272|  3.15k|    if (mpack_reader_error(reader) != mpack_ok) {
  ------------------
  |  Branch (272:9): [True: 0, False: 3.15k]
  ------------------
  273|      0|        cfl_array_destroy(internal_array);
  274|       |
  275|      0|        return -6;
  276|      0|    }
  277|       |
  278|  3.15k|    *result_array = internal_array;
  279|       |
  280|  3.15k|    return 0;
  281|  3.15k|}
cmt_decode_msgpack.c:unpack_cfl_variant_kvlist:
  578|   169k|{
  579|   169k|    struct cfl_kvlist *unpacked_kvlist;
  580|   169k|    int                result;
  581|       |
  582|   169k|    result = unpack_cfl_kvlist(reader, &unpacked_kvlist);
  583|       |
  584|   169k|    if (result != 0) {
  ------------------
  |  Branch (584:9): [True: 142k, False: 27.5k]
  ------------------
  585|   142k|        return result;
  586|   142k|    }
  587|       |
  588|  27.5k|    *value = cfl_variant_create_from_kvlist(unpacked_kvlist);
  589|       |
  590|  27.5k|    if (*value == NULL) {
  ------------------
  |  Branch (590:9): [True: 0, False: 27.5k]
  ------------------
  591|      0|        return -3;
  592|      0|    }
  593|       |
  594|  27.5k|    return 0;
  595|  27.5k|}
cmt_decode_msgpack.c:unpack_cfl_variant_binary:
  428|  4.83k|{
  429|  4.83k|    size_t      value_length;
  430|  4.83k|    char       *value_data;
  431|  4.83k|    int         result;
  432|  4.83k|    mpack_tag_t tag;
  433|       |
  434|  4.83k|    result = unpack_cfl_variant_read_tag(reader, &tag, mpack_type_bin);
  435|       |
  436|  4.83k|    if (result != 0) {
  ------------------
  |  Branch (436:9): [True: 0, False: 4.83k]
  ------------------
  437|      0|        return result;
  438|      0|    }
  439|       |
  440|  4.83k|    value_length = mpack_tag_bin_length(&tag);
  441|       |
  442|  4.83k|    value_data = cfl_sds_create_size(value_length);
  443|       |
  444|  4.83k|    if (value_data == NULL) {
  ------------------
  |  Branch (444:9): [True: 0, False: 4.83k]
  ------------------
  445|      0|        return -3;
  446|      0|    }
  447|       |
  448|  4.83k|    cfl_sds_set_len(value_data, value_length);
  449|       |
  450|  4.83k|    mpack_read_bytes(reader, value_data, value_length);
  451|       |
  452|  4.83k|    mpack_done_bin(reader);
  453|       |
  454|  4.83k|    if (mpack_reader_error(reader) != mpack_ok) {
  ------------------
  |  Branch (454:9): [True: 1, False: 4.83k]
  ------------------
  455|      1|        cfl_sds_destroy(value_data);
  456|       |
  457|      1|        return -4;
  458|      1|    }
  459|       |
  460|  4.83k|    *value = cfl_variant_create_from_reference(value_data);
  461|       |
  462|  4.83k|    if (*value == NULL) {
  ------------------
  |  Branch (462:9): [True: 0, False: 4.83k]
  ------------------
  463|      0|        return -5;
  464|      0|    }
  465|       |
  466|  4.83k|    (*value)->type = CFL_VARIANT_BYTES;
  ------------------
  |  |   34|  4.83k|#define CFL_VARIANT_BYTES      8
  ------------------
  467|       |
  468|  4.83k|    return 0;
  469|  4.83k|}

mpack_tag_type:
 1629|  2.17M|MPACK_INLINE mpack_type_t mpack_tag_type(mpack_tag_t* tag) {
 1630|  2.17M|    return tag->type;
 1631|  2.17M|}
mpack_tag_int_value:
 1658|  68.8k|MPACK_INLINE int64_t mpack_tag_int_value(mpack_tag_t* tag) {
 1659|  68.8k|    mpack_assert(tag->type == mpack_type_int, "tag is not an int!");
  ------------------
  |  | 1089|  68.8k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  |  586|   206k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:25): [True: 0, False: 68.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1090|  68.8k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1091|  68.8k|                (void)0))
  ------------------
 1660|  68.8k|    return tag->v.i;
 1661|  68.8k|}
mpack_tag_uint_value:
 1676|   527k|MPACK_INLINE uint64_t mpack_tag_uint_value(mpack_tag_t* tag) {
 1677|   527k|    mpack_assert(tag->type == mpack_type_uint, "tag is not a uint!");
  ------------------
  |  | 1089|   527k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  |  586|  1.58M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:25): [True: 0, False: 527k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1090|   527k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1091|   527k|                (void)0))
  ------------------
 1678|   527k|    return tag->v.u;
 1679|   527k|}
mpack_tag_double_value:
 1708|  1.20k|MPACK_INLINE double mpack_tag_double_value(mpack_tag_t* tag) {
 1709|  1.20k|    mpack_assert(tag->type == mpack_type_double, "tag is not a double!");
  ------------------
  |  | 1089|  1.20k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  |  586|  3.61k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:25): [True: 0, False: 1.20k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1090|  1.20k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1091|  1.20k|                (void)0))
  ------------------
 1710|  1.20k|    return tag->v.d;
 1711|  1.20k|}
mpack_tag_array_count:
 1721|  8.64k|MPACK_INLINE uint32_t mpack_tag_array_count(mpack_tag_t* tag) {
 1722|  8.64k|    mpack_assert(tag->type == mpack_type_array, "tag is not an array!");
  ------------------
  |  | 1089|  8.64k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  |  586|  25.9k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (586:25): [True: 0, False: 8.64k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1090|  8.64k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1091|  8.64k|                (void)0))
  ------------------
 1723|  8.64k|    return tag->v.n;
 1724|  8.64k|}

cmt_create:
   42|   426k|{
   43|   426k|    struct cmt *cmt;
   44|       |
   45|   426k|    cmt = calloc(1, sizeof(struct cmt));
   46|   426k|    if (!cmt) {
  ------------------
  |  Branch (46:9): [True: 0, False: 426k]
  ------------------
   47|      0|        cmt_errno();
  ------------------
  |  |   61|      0|#define cmt_errno() cmt_errno_print(errno, __CMT_FILENAME__, __LINE__)
  ------------------
   48|      0|        return NULL;
   49|      0|    }
   50|       |
   51|   426k|    cmt->static_labels = cmt_labels_create();
   52|   426k|    if (!cmt->static_labels) {
  ------------------
  |  Branch (52:9): [True: 0, False: 426k]
  ------------------
   53|      0|        free(cmt);
   54|      0|        return NULL;
   55|      0|    }
   56|       |
   57|   426k|    cmt->internal_metadata = cfl_kvlist_create();
   58|       |
   59|   426k|    if (cmt->internal_metadata == NULL) {
  ------------------
  |  Branch (59:9): [True: 0, False: 426k]
  ------------------
   60|      0|        cmt_labels_destroy(cmt->static_labels);
   61|       |
   62|      0|        free(cmt);
   63|      0|        return NULL;
   64|      0|    }
   65|       |
   66|   426k|    cmt->external_metadata = cfl_kvlist_create();
   67|       |
   68|   426k|    if (cmt->external_metadata == NULL) {
  ------------------
  |  Branch (68:9): [True: 0, False: 426k]
  ------------------
   69|      0|        cfl_kvlist_destroy(cmt->internal_metadata);
   70|      0|        cmt_labels_destroy(cmt->static_labels);
   71|       |
   72|      0|        free(cmt);
   73|      0|        return NULL;
   74|      0|    }
   75|       |
   76|   426k|    cfl_list_init(&cmt->counters);
   77|   426k|    cfl_list_init(&cmt->gauges);
   78|   426k|    cfl_list_init(&cmt->histograms);
   79|   426k|    cfl_list_init(&cmt->summaries);
   80|   426k|    cfl_list_init(&cmt->untypeds);
   81|       |
   82|   426k|    cmt->log_level = CMT_LOG_ERROR;
  ------------------
  |  |   27|   426k|#define CMT_LOG_ERROR   1
  ------------------
   83|       |
   84|   426k|    cfl_list_entry_init(&cmt->_head);
   85|       |    
   86|   426k|    return cmt;
   87|   426k|}
cmt_destroy:
   90|   426k|{
   91|   426k|    struct cfl_list *tmp;
   92|   426k|    struct cfl_list *head;
   93|   426k|    struct cmt_counter *c;
   94|   426k|    struct cmt_gauge *g;
   95|   426k|    struct cmt_summary *s;
   96|   426k|    struct cmt_histogram *h;
   97|   426k|    struct cmt_untyped *u;
   98|       |
   99|   426k|    cfl_list_foreach_safe(head, tmp, &cmt->counters) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
  100|      0|        c = cfl_list_entry(head, struct cmt_counter, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
  101|      0|        cmt_counter_destroy(c);
  102|      0|    }
  103|       |
  104|   426k|    cfl_list_foreach_safe(head, tmp, &cmt->gauges) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
  105|      0|        g = cfl_list_entry(head, struct cmt_gauge, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
  106|      0|        cmt_gauge_destroy(g);
  107|      0|    }
  108|       |
  109|   426k|    cfl_list_foreach_safe(head, tmp, &cmt->summaries) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
  110|      0|        s = cfl_list_entry(head, struct cmt_summary, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
  111|      0|        cmt_summary_destroy(s);
  112|      0|    }
  113|       |
  114|   426k|    cfl_list_foreach_safe(head, tmp, &cmt->histograms) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
  115|      0|        h = cfl_list_entry(head, struct cmt_histogram, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
  116|      0|        cmt_histogram_destroy(h);
  117|      0|    }
  118|       |
  119|   426k|    cfl_list_foreach_safe(head, tmp, &cmt->untypeds) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
  120|      0|        u = cfl_list_entry(head, struct cmt_untyped, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
  121|      0|        cmt_untyped_destroy(u);
  122|      0|    }
  123|       |
  124|   426k|    if (cmt->static_labels) {
  ------------------
  |  Branch (124:9): [True: 426k, False: 0]
  ------------------
  125|   426k|        cmt_labels_destroy(cmt->static_labels);
  126|   426k|    }
  127|       |
  128|   426k|    if (cmt->internal_metadata != NULL) {
  ------------------
  |  Branch (128:9): [True: 425k, False: 141]
  ------------------
  129|   425k|        cfl_kvlist_destroy(cmt->internal_metadata);
  130|   425k|    }
  131|       |
  132|   426k|    if (cmt->external_metadata != NULL) {
  ------------------
  |  Branch (132:9): [True: 426k, False: 21]
  ------------------
  133|   426k|        cfl_kvlist_destroy(cmt->external_metadata);
  134|   426k|    }
  135|       |
  136|   426k|    free(cmt);
  137|   426k|}

cmt_decode_msgpack_create:
 1428|   426k|{
 1429|   426k|    struct cmt     *cmt;
 1430|   426k|    mpack_reader_t  reader;
 1431|   426k|    int             result;
 1432|   426k|    size_t          remainder;
 1433|       |
 1434|   426k|    if (NULL == out_cmt ||
  ------------------
  |  Branch (1434:9): [True: 0, False: 426k]
  ------------------
 1435|   426k|        NULL == in_buf ||
  ------------------
  |  Branch (1435:9): [True: 0, False: 426k]
  ------------------
 1436|   426k|        NULL == offset ||
  ------------------
  |  Branch (1436:9): [True: 0, False: 426k]
  ------------------
 1437|   426k|        in_size < *offset ) {
  ------------------
  |  Branch (1437:9): [True: 0, False: 426k]
  ------------------
 1438|      0|        return CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR;
  ------------------
  |  |   29|      0|#define CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR     CMT_MPACK_INVALID_ARGUMENT_ERROR
  |  |  ------------------
  |  |  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  |  |  ------------------
  ------------------
 1439|      0|    }
 1440|       |
 1441|   426k|    if (0 == in_size ||
  ------------------
  |  Branch (1441:9): [True: 0, False: 426k]
  ------------------
 1442|   426k|        0 == (in_size - *offset) ) {
  ------------------
  |  Branch (1442:9): [True: 0, False: 426k]
  ------------------
 1443|      0|        return CMT_DECODE_MSGPACK_INSUFFICIENT_DATA;
  ------------------
  |  |   28|      0|#define CMT_DECODE_MSGPACK_INSUFFICIENT_DATA          CMT_MPACK_INSUFFICIENT_DATA
  |  |  ------------------
  |  |  |  |   24|      0|#define CMT_MPACK_INSUFFICIENT_DATA          1
  |  |  ------------------
  ------------------
 1444|      0|    }
 1445|       |
 1446|   426k|    cmt = cmt_create();
 1447|       |
 1448|   426k|    if (NULL == cmt) {
  ------------------
  |  Branch (1448:9): [True: 0, False: 426k]
  ------------------
 1449|      0|        return CMT_DECODE_MSGPACK_ALLOCATION_ERROR;
  ------------------
  |  |   30|      0|#define CMT_DECODE_MSGPACK_ALLOCATION_ERROR           CMT_MPACK_ALLOCATION_ERROR
  |  |  ------------------
  |  |  |  |   26|      0|#define CMT_MPACK_ALLOCATION_ERROR           3
  |  |  ------------------
  ------------------
 1450|      0|    }
 1451|       |
 1452|   426k|    in_size -= *offset;
 1453|       |
 1454|   426k|    mpack_reader_init_data(&reader, &in_buf[*offset], in_size);
 1455|       |
 1456|   426k|    result = unpack_context(&reader, cmt);
 1457|       |
 1458|   426k|    remainder = mpack_reader_remaining(&reader, NULL);
 1459|       |
 1460|   426k|    *offset += in_size - remainder;
 1461|       |
 1462|   426k|    mpack_reader_destroy(&reader);
 1463|       |
 1464|   426k|    if (CMT_DECODE_MSGPACK_SUCCESS != result) {
  ------------------
  |  |   27|   426k|#define CMT_DECODE_MSGPACK_SUCCESS                    CMT_MPACK_SUCCESS
  |  |  ------------------
  |  |  |  |   23|   426k|#define CMT_MPACK_SUCCESS                    0
  |  |  ------------------
  ------------------
  |  Branch (1464:9): [True: 249, False: 425k]
  ------------------
 1465|    249|        cmt_destroy(cmt);
 1466|    249|    }
 1467|   425k|    else {
 1468|   425k|        *out_cmt = cmt;
 1469|   425k|    }
 1470|       |
 1471|   426k|    return result;
 1472|   426k|}
cmt_decode_msgpack.c:unpack_context:
 1409|   426k|{
 1410|   426k|    struct cmt_mpack_map_entry_callback_t callbacks[] = \
 1411|   426k|        {
 1412|   426k|            {"meta",    unpack_context_header},
 1413|   426k|            {"metrics", unpack_context_metrics},
 1414|   426k|            {NULL,      NULL}
 1415|   426k|        };
 1416|       |
 1417|   426k|    if (NULL == reader ||
  ------------------
  |  Branch (1417:9): [True: 0, False: 426k]
  ------------------
 1418|   426k|        NULL == cmt) {
  ------------------
  |  Branch (1418:9): [True: 0, False: 426k]
  ------------------
 1419|      0|        return CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR;
  ------------------
  |  |   29|      0|#define CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR     CMT_MPACK_INVALID_ARGUMENT_ERROR
  |  |  ------------------
  |  |  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  |  |  ------------------
  ------------------
 1420|      0|    }
 1421|       |
 1422|   426k|    return cmt_mpack_unpack_map(reader, callbacks, (void *) cmt);
 1423|   426k|}
cmt_decode_msgpack.c:unpack_context_header:
 1379|    163|{
 1380|    163|    struct cmt_mpack_map_entry_callback_t callbacks[] = \
 1381|    163|        {
 1382|    163|            {"cmetrics",   unpack_context_internal_metadata},
 1383|    163|            {"external",   unpack_context_external_metadata},
 1384|    163|            {"processing", unpack_context_processing_section},
 1385|    163|            {NULL,         NULL}
 1386|    163|        };
 1387|       |
 1388|    163|    if (NULL == reader ||
  ------------------
  |  Branch (1388:9): [True: 0, False: 163]
  ------------------
 1389|    163|        NULL == context) {
  ------------------
  |  Branch (1389:9): [True: 0, False: 163]
  ------------------
 1390|      0|        return CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR;
  ------------------
  |  |   29|      0|#define CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR     CMT_MPACK_INVALID_ARGUMENT_ERROR
  |  |  ------------------
  |  |  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  |  |  ------------------
  ------------------
 1391|      0|    }
 1392|       |
 1393|    163|    return cmt_mpack_unpack_map(reader, callbacks, context);
 1394|    163|}
cmt_decode_msgpack.c:unpack_context_internal_metadata:
 1313|    141|{
 1314|    141|    struct cmt *metrics_context;
 1315|    141|    int         result;
 1316|       |
 1317|    141|    metrics_context = (struct cmt *) context;
 1318|       |
 1319|    141|    if (metrics_context->internal_metadata != NULL) {
  ------------------
  |  Branch (1319:9): [True: 141, False: 0]
  ------------------
 1320|    141|        cfl_kvlist_destroy(metrics_context->internal_metadata);
 1321|       |
 1322|    141|        metrics_context->internal_metadata = NULL;
 1323|    141|    }
 1324|       |
 1325|    141|    result = unpack_cfl_kvlist(reader, &metrics_context->internal_metadata);
 1326|       |
 1327|    141|    if (result == 0) {
  ------------------
  |  Branch (1327:9): [True: 0, False: 141]
  ------------------
 1328|      0|        result = CMT_DECODE_MSGPACK_SUCCESS;
  ------------------
  |  |   27|      0|#define CMT_DECODE_MSGPACK_SUCCESS                    CMT_MPACK_SUCCESS
  |  |  ------------------
  |  |  |  |   23|      0|#define CMT_MPACK_SUCCESS                    0
  |  |  ------------------
  ------------------
 1329|      0|    }
 1330|    141|    else {
 1331|    141|        result = CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR;
  ------------------
  |  |   31|    141|#define CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR   CMT_MPACK_CORRUPT_INPUT_DATA_ERROR
  |  |  ------------------
  |  |  |  |   27|    141|#define CMT_MPACK_CORRUPT_INPUT_DATA_ERROR   4
  |  |  ------------------
  ------------------
 1332|    141|    }
 1333|       |
 1334|    141|    return result;
 1335|    141|}
cmt_decode_msgpack.c:unpack_context_external_metadata:
 1338|     21|{
 1339|     21|    struct cmt *metrics_context;
 1340|     21|    int         result;
 1341|       |
 1342|     21|    metrics_context = (struct cmt *) context;
 1343|       |
 1344|     21|    if (metrics_context->external_metadata != NULL) {
  ------------------
  |  Branch (1344:9): [True: 21, False: 0]
  ------------------
 1345|     21|        cfl_kvlist_destroy(metrics_context->external_metadata);
 1346|       |
 1347|     21|        metrics_context->external_metadata = NULL;
 1348|     21|    }
 1349|       |
 1350|     21|    result = unpack_cfl_kvlist(reader, &metrics_context->external_metadata);
 1351|       |
 1352|     21|    if (result == 0) {
  ------------------
  |  Branch (1352:9): [True: 0, False: 21]
  ------------------
 1353|      0|        result = CMT_DECODE_MSGPACK_SUCCESS;
  ------------------
  |  |   27|      0|#define CMT_DECODE_MSGPACK_SUCCESS                    CMT_MPACK_SUCCESS
  |  |  ------------------
  |  |  |  |   23|      0|#define CMT_MPACK_SUCCESS                    0
  |  |  ------------------
  ------------------
 1354|      0|    }
 1355|     21|    else {
 1356|     21|        result = CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR;
  ------------------
  |  |   31|     21|#define CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR   CMT_MPACK_CORRUPT_INPUT_DATA_ERROR
  |  |  ------------------
  |  |  |  |   27|     21|#define CMT_MPACK_CORRUPT_INPUT_DATA_ERROR   4
  |  |  ------------------
  ------------------
 1357|     21|    }
 1358|       |
 1359|     21|    return result;
 1360|     21|}

cmt_labels_create:
   30|   426k|{
   31|   426k|    struct cmt_labels *l;
   32|       |
   33|   426k|    l = malloc(sizeof(struct cmt_labels));
   34|   426k|    if (!l) {
  ------------------
  |  Branch (34:9): [True: 0, False: 426k]
  ------------------
   35|      0|        cmt_errno();
  ------------------
  |  |   61|      0|#define cmt_errno() cmt_errno_print(errno, __CMT_FILENAME__, __LINE__)
  ------------------
   36|      0|        return NULL;
   37|      0|    }
   38|   426k|    cfl_list_init(&l->list);
   39|   426k|    return l;
   40|   426k|}
cmt_labels_destroy:
   43|   426k|{
   44|   426k|    struct cfl_list *tmp;
   45|   426k|    struct cfl_list *head;
   46|   426k|    struct cmt_label *l;
   47|       |
   48|   426k|    cfl_list_foreach_safe(head, tmp, &labels->list) {
  ------------------
  |  |  199|   426k|    for (curr = (head)->next, n = curr->next; curr != (head); curr = n, n = curr->next)
  |  |  ------------------
  |  |  |  Branch (199:47): [True: 0, False: 426k]
  |  |  ------------------
  ------------------
   49|      0|        l = cfl_list_entry(head, struct cmt_label, _head);
  ------------------
  |  |  206|      0|#define cfl_list_entry( ptr, type, member ) cfl_container_of( ptr, type, member )
  |  |  ------------------
  |  |  |  |   45|      0|#define cfl_container_of(ptr, type, member) ({                  \
  |  |  |  |   46|      0|      const typeof( ((type *)0)->member ) *__mptr = (ptr);      \
  |  |  |  |   47|      0|      (type *)( (char *)__mptr - offsetof(type,member) );})
  |  |  ------------------
  ------------------
   50|      0|        if (l->key) {
  ------------------
  |  Branch (50:13): [True: 0, False: 0]
  ------------------
   51|      0|            cfl_sds_destroy(l->key);
   52|      0|        }
   53|      0|        if (l->val) {
  ------------------
  |  Branch (53:13): [True: 0, False: 0]
  ------------------
   54|      0|            cfl_sds_destroy(l->val);
   55|      0|        }
   56|      0|        cfl_list_del(&l->_head);
   57|      0|        free(l);
   58|      0|    }
   59|       |
   60|   426k|    free(labels);
   61|   426k|}

cmt_mpack_consume_string_tag:
   78|    333|{
   79|    333|    uint32_t    string_length;
   80|    333|    mpack_tag_t tag;
   81|       |
   82|    333|    if (NULL == output_buffer) {
  ------------------
  |  Branch (82:9): [True: 0, False: 333]
  ------------------
   83|      0|        return CMT_MPACK_INVALID_ARGUMENT_ERROR;
  ------------------
  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  ------------------
   84|      0|    }
   85|       |
   86|    333|    if (NULL == reader) {
  ------------------
  |  Branch (86:9): [True: 0, False: 333]
  ------------------
   87|      0|        return CMT_MPACK_INVALID_ARGUMENT_ERROR;
  ------------------
  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  ------------------
   88|      0|    }
   89|       |
   90|    333|    tag = mpack_read_tag(reader);
   91|       |
   92|    333|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (92:9): [True: 1, False: 332]
  ------------------
   93|      1|        return CMT_MPACK_ENGINE_ERROR;
  ------------------
  |  |   29|      1|#define CMT_MPACK_ENGINE_ERROR               6
  ------------------
   94|      1|    }
   95|       |
   96|    332|    if (mpack_type_str != mpack_tag_type(&tag)) {
  ------------------
  |  Branch (96:9): [True: 4, False: 328]
  ------------------
   97|      4|        return CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR;
  ------------------
  |  |   33|      4|#define CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR 10
  ------------------
   98|      4|    }
   99|       |
  100|    328|    string_length = mpack_tag_str_length(&tag);
  101|       |
  102|       |    /* This validation only applies to cmetrics and its use cases, we know
  103|       |     * for a fact that our label names and values are not supposed to be really
  104|       |     * long so a huge value here probably means that the data stream got corrupted.
  105|       |     */
  106|       |
  107|    328|    if (CMT_MPACK_MAX_STRING_LENGTH < string_length) {
  ------------------
  |  |   38|    328|#define CMT_MPACK_MAX_STRING_LENGTH          1024
  ------------------
  |  Branch (107:9): [True: 3, False: 325]
  ------------------
  108|      3|        return CMT_MPACK_CORRUPT_INPUT_DATA_ERROR;
  ------------------
  |  |   27|      3|#define CMT_MPACK_CORRUPT_INPUT_DATA_ERROR   4
  ------------------
  109|      3|    }
  110|       |
  111|    325|    *output_buffer = cfl_sds_create_size(string_length + 1);
  112|       |
  113|    325|    if (NULL == *output_buffer) {
  ------------------
  |  Branch (113:9): [True: 0, False: 325]
  ------------------
  114|      0|        return CMT_MPACK_ALLOCATION_ERROR;
  ------------------
  |  |   26|      0|#define CMT_MPACK_ALLOCATION_ERROR           3
  ------------------
  115|      0|    }
  116|       |
  117|    325|    cfl_sds_set_len(*output_buffer, string_length);
  118|       |
  119|    325|    mpack_read_cstr(reader, *output_buffer, string_length + 1, string_length);
  120|       |
  121|    325|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (121:9): [True: 0, False: 325]
  ------------------
  122|      0|        cfl_sds_destroy(*output_buffer);
  123|       |
  124|      0|        *output_buffer = NULL;
  125|       |
  126|      0|        return CMT_MPACK_ENGINE_ERROR;
  ------------------
  |  |   29|      0|#define CMT_MPACK_ENGINE_ERROR               6
  ------------------
  127|      0|    }
  128|       |
  129|    325|    mpack_done_str(reader);
  130|       |
  131|    325|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (131:9): [True: 0, False: 325]
  ------------------
  132|      0|        cfl_sds_destroy(*output_buffer);
  133|       |
  134|      0|        *output_buffer = NULL;
  135|       |
  136|      0|        return CMT_MPACK_ENGINE_ERROR;
  ------------------
  |  |   29|      0|#define CMT_MPACK_ENGINE_ERROR               6
  ------------------
  137|      0|    }
  138|       |
  139|    325|    return CMT_MPACK_SUCCESS;
  ------------------
  |  |   23|    325|#define CMT_MPACK_SUCCESS                    0
  ------------------
  140|    325|}
cmt_mpack_unpack_map:
  145|   426k|{
  146|   426k|    struct cmt_mpack_map_entry_callback_t *callback_entry;
  147|   426k|    uint32_t                               entry_index;
  148|   426k|    uint32_t                               entry_count;
  149|   426k|    cfl_sds_t                              key_name;
  150|   426k|    int                                    result;
  151|   426k|    mpack_tag_t                            tag;
  152|       |
  153|   426k|    tag = mpack_read_tag(reader);
  154|       |
  155|   426k|    if (mpack_ok != mpack_reader_error(reader)) {
  ------------------
  |  Branch (155:9): [True: 0, False: 426k]
  ------------------
  156|      0|        return CMT_MPACK_ENGINE_ERROR;
  ------------------
  |  |   29|      0|#define CMT_MPACK_ENGINE_ERROR               6
  ------------------
  157|      0|    }
  158|       |
  159|   426k|    if (mpack_type_map != mpack_tag_type(&tag)) {
  ------------------
  |  Branch (159:9): [True: 72, False: 426k]
  ------------------
  160|     72|        return CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR;
  ------------------
  |  |   33|     72|#define CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR 10
  ------------------
  161|     72|    }
  162|       |
  163|   426k|    entry_count = mpack_tag_map_count(&tag);
  164|       |
  165|       |    /* This validation only applies to cmetrics and its use cases, we know
  166|       |     * how our schema looks and how many entries the different fields have and none
  167|       |     * of those exceed the number we set CMT_MPACK_MAX_MAP_ENTRY_COUNT to which is 10.
  168|       |     * Making these sanity checks optional or configurable in runtime might be worth
  169|       |     * the itme and complexity cost but that's something I don't know at the moment.
  170|       |     */
  171|       |
  172|   426k|    if (CMT_MPACK_MAX_MAP_ENTRY_COUNT < entry_count) {
  ------------------
  |  |   37|   426k|#define CMT_MPACK_MAX_MAP_ENTRY_COUNT        10
  ------------------
  |  Branch (172:9): [True: 7, False: 426k]
  ------------------
  173|      7|        return CMT_MPACK_CORRUPT_INPUT_DATA_ERROR;
  ------------------
  |  |   27|      7|#define CMT_MPACK_CORRUPT_INPUT_DATA_ERROR   4
  ------------------
  174|      7|    }
  175|       |
  176|   426k|    result = 0;
  177|       |
  178|   426k|    for (entry_index = 0 ; 0 == result && entry_index < entry_count ; entry_index++) {
  ------------------
  |  Branch (178:28): [True: 426k, False: 333]
  |  Branch (178:43): [True: 333, False: 425k]
  ------------------
  179|    333|        result = cmt_mpack_consume_string_tag(reader, &key_name);
  180|       |
  181|    333|        if (CMT_MPACK_SUCCESS == result) {
  ------------------
  |  |   23|    333|#define CMT_MPACK_SUCCESS                    0
  ------------------
  |  Branch (181:13): [True: 325, False: 8]
  ------------------
  182|    325|            callback_entry = callback_list;
  183|    325|            result = CMT_MPACK_UNEXPECTED_KEY_ERROR;
  ------------------
  |  |   32|    325|#define CMT_MPACK_UNEXPECTED_KEY_ERROR       9
  ------------------
  184|       |
  185|    671|            while (CMT_MPACK_UNEXPECTED_KEY_ERROR == result &&
  ------------------
  |  |   32|    671|#define CMT_MPACK_UNEXPECTED_KEY_ERROR       9
  ------------------
  |  Branch (185:20): [True: 346, False: 325]
  ------------------
  186|    671|                   NULL != callback_entry->identifier) {
  ------------------
  |  Branch (186:20): [True: 346, False: 0]
  ------------------
  187|       |
  188|    346|                if (0 == strcmp(callback_entry->identifier, key_name)) {
  ------------------
  |  Branch (188:21): [True: 325, False: 21]
  ------------------
  189|    325|                    result = callback_entry->handler(reader, entry_index, context);
  190|    325|                }
  191|       |
  192|    346|                callback_entry++;
  193|    346|            }
  194|       |
  195|    325|            cfl_sds_destroy(key_name);
  196|    325|        }
  197|    333|    }
  198|       |
  199|   426k|    if (CMT_MPACK_SUCCESS == result) {
  ------------------
  |  |   23|   426k|#define CMT_MPACK_SUCCESS                    0
  ------------------
  |  Branch (199:9): [True: 425k, False: 333]
  ------------------
  200|   425k|        mpack_done_map(reader);
  201|       |
  202|   425k|        if (mpack_ok != mpack_reader_error(reader))
  ------------------
  |  Branch (202:13): [True: 0, False: 425k]
  ------------------
  203|      0|        {
  204|      0|            return CMT_MPACK_PENDING_MAP_ENTRIES;
  ------------------
  |  |   30|      0|#define CMT_MPACK_PENDING_MAP_ENTRIES        7
  ------------------
  205|      0|        }
  206|   425k|    }
  207|       |
  208|   426k|    return result;
  209|   426k|}

mpack_str_check_no_null:
  920|   173k|bool mpack_str_check_no_null(const char* str, size_t bytes) {
  921|   173k|    size_t i;
  922|   224k|    for (i = 0; i < bytes; ++i)
  ------------------
  |  Branch (922:17): [True: 50.8k, False: 173k]
  ------------------
  923|  50.8k|        if (str[i] == '\0')
  ------------------
  |  Branch (923:13): [True: 33, False: 50.7k]
  ------------------
  924|     33|            return false;
  925|   173k|    return true;
  926|   173k|}
mpack_reader_init_data:
 2823|   426k|void mpack_reader_init_data(mpack_reader_t* reader, const char* data, size_t count) {
 2824|   426k|    mpack_assert(data != NULL, "data is NULL");
  ------------------
  |  | 1735|   426k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  1.27M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 426k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   426k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   426k|                (void)0))
  ------------------
 2825|       |
 2826|   426k|    mpack_memset(reader, 0, sizeof(*reader));
  ------------------
  |  | 1789|   426k|    #define mpack_memset MPACK_MEMSET
  |  |  ------------------
  |  |  |  |  601|   426k|        #define MPACK_MEMSET memset
  |  |  ------------------
  ------------------
 2827|   426k|    reader->data = data;
 2828|   426k|    reader->end = data + count;
 2829|       |
 2830|       |    #if MPACK_READ_TRACKING
 2831|       |    mpack_reader_flag_if_error(reader, mpack_track_init(&reader->track));
 2832|       |    #endif
 2833|       |
 2834|   426k|    mpack_log("===========================\n");
  ------------------
  |  | 1817|   426k|    #define mpack_log(...) ((void)0)
  ------------------
 2835|   426k|    mpack_log("initializing reader with data size %i\n", (int)count);
  ------------------
  |  | 1817|   426k|    #define mpack_log(...) ((void)0)
  ------------------
 2836|   426k|}
mpack_reader_destroy:
 2951|   426k|mpack_error_t mpack_reader_destroy(mpack_reader_t* reader) {
 2952|       |
 2953|       |    // clean up tracking, asserting if we're not already in an error state
 2954|       |    #if MPACK_READ_TRACKING
 2955|       |    mpack_reader_flag_if_error(reader, mpack_track_destroy(&reader->track, mpack_reader_error(reader) != mpack_ok));
 2956|       |    #endif
 2957|       |
 2958|   426k|    if (reader->teardown)
  ------------------
  |  Branch (2958:9): [True: 0, False: 426k]
  ------------------
 2959|      0|        reader->teardown(reader);
 2960|   426k|    reader->teardown = NULL;
 2961|       |
 2962|   426k|    return reader->error;
 2963|   426k|}
mpack_reader_remaining:
 2965|   426k|size_t mpack_reader_remaining(mpack_reader_t* reader, const char** data) {
 2966|   426k|    if (mpack_reader_error(reader) != mpack_ok)
  ------------------
  |  Branch (2966:9): [True: 53, False: 426k]
  ------------------
 2967|     53|        return 0;
 2968|       |
 2969|       |    #if MPACK_READ_TRACKING
 2970|       |    if (mpack_reader_flag_if_error(reader, mpack_track_check_empty(&reader->track)) != mpack_ok)
 2971|       |        return 0;
 2972|       |    #endif
 2973|       |
 2974|   426k|    if (data)
  ------------------
  |  Branch (2974:9): [True: 0, False: 426k]
  ------------------
 2975|      0|        *data = reader->data;
 2976|   426k|    return (size_t)(reader->end - reader->data);
 2977|   426k|}
mpack_reader_flag_error:
 2979|     53|void mpack_reader_flag_error(mpack_reader_t* reader, mpack_error_t error) {
 2980|     53|    mpack_log("reader %p setting error %i: %s\n", (void*)reader, (int)error, mpack_error_to_string(error));
  ------------------
  |  | 1817|     53|    #define mpack_log(...) ((void)0)
  ------------------
 2981|       |
 2982|     53|    if (reader->error == mpack_ok) {
  ------------------
  |  Branch (2982:9): [True: 53, False: 0]
  ------------------
 2983|     53|        reader->error = error;
 2984|     53|        reader->end = reader->data;
 2985|     53|        if (reader->error_fn)
  ------------------
  |  Branch (2985:13): [True: 0, False: 53]
  ------------------
 2986|      0|            reader->error_fn(reader, error);
 2987|     53|    }
 2988|     53|}
mpack_reader_ensure_straddle:
 3016|      8|MPACK_NOINLINE bool mpack_reader_ensure_straddle(mpack_reader_t* reader, size_t count) {
 3017|      8|    mpack_assert(count != 0, "cannot ensure zero bytes!");
  ------------------
  |  | 1735|      8|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|     24|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      8|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      8|                (void)0))
  ------------------
 3018|      8|    mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!");
  ------------------
  |  | 1735|      8|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|     24|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      8|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      8|                (void)0))
  ------------------
 3019|       |
 3020|      8|    mpack_assert(count > (size_t)(reader->end - reader->data),
  ------------------
  |  | 1735|      8|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|     24|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 8]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      8|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      8|                (void)0))
  ------------------
 3021|      8|            "straddling ensure requested for %i bytes, but there are %i bytes "
 3022|      8|            "left in buffer. call mpack_reader_ensure() instead",
 3023|      8|            (int)count, (int)(reader->end - reader->data));
 3024|       |
 3025|       |    // we'll need a fill function to get more data. if there's no
 3026|       |    // fill function, the buffer should contain an entire MessagePack
 3027|       |    // object, so we raise mpack_error_invalid instead of mpack_error_io
 3028|       |    // on truncated data.
 3029|      8|    if (reader->fill == NULL) {
  ------------------
  |  Branch (3029:9): [True: 8, False: 0]
  ------------------
 3030|      8|        mpack_reader_flag_error(reader, mpack_error_invalid);
 3031|      8|        return false;
 3032|      8|    }
 3033|       |
 3034|       |    // we need enough space in the buffer. if the buffer is not
 3035|       |    // big enough, we return mpack_error_too_big (since this is
 3036|       |    // for an in-place read larger than the buffer size.)
 3037|      0|    if (count > reader->size) {
  ------------------
  |  Branch (3037:9): [True: 0, False: 0]
  ------------------
 3038|      0|        mpack_reader_flag_error(reader, mpack_error_too_big);
 3039|      0|        return false;
 3040|      0|    }
 3041|       |
 3042|       |    // move the existing data to the start of the buffer
 3043|      0|    size_t left = (size_t)(reader->end - reader->data);
 3044|      0|    mpack_memmove(reader->buffer, reader->data, left);
  ------------------
  |  | 1783|      0|    #define mpack_memmove MPACK_MEMMOVE
  |  |  ------------------
  |  |  |  |  598|      0|        #define MPACK_MEMMOVE memmove
  |  |  ------------------
  ------------------
 3045|      0|    reader->end -= reader->data - reader->buffer;
 3046|      0|    reader->data = reader->buffer;
 3047|       |
 3048|       |    // read at least the necessary number of bytes, accepting up to the
 3049|       |    // buffer size
 3050|      0|    size_t read = mpack_fill_range(reader, reader->buffer + left,
 3051|      0|            count - left, reader->size - left);
 3052|      0|    if (mpack_reader_error(reader) != mpack_ok)
  ------------------
  |  Branch (3052:9): [True: 0, False: 0]
  ------------------
 3053|      0|        return false;
 3054|      0|    reader->end += read;
 3055|      0|    return true;
 3056|      0|}
mpack_read_native_straddle:
 3060|      9|MPACK_NOINLINE void mpack_read_native_straddle(mpack_reader_t* reader, char* p, size_t count) {
 3061|      9|    mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count);
  ------------------
  |  | 1735|      9|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|     45|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 9]
  |  |  |  |  |  Branch (1193:25): [True: 9, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      9|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      9|                (void)0))
  ------------------
 3062|       |
 3063|      9|    if (mpack_reader_error(reader) != mpack_ok) {
  ------------------
  |  Branch (3063:9): [True: 0, False: 9]
  ------------------
 3064|      0|        mpack_memset(p, 0, count);
  ------------------
  |  | 1789|      0|    #define mpack_memset MPACK_MEMSET
  |  |  ------------------
  |  |  |  |  601|      0|        #define MPACK_MEMSET memset
  |  |  ------------------
  ------------------
 3065|      0|        return;
 3066|      0|    }
 3067|       |
 3068|      9|    size_t left = (size_t)(reader->end - reader->data);
 3069|      9|    mpack_log("big read for %i bytes into %p, %i left in buffer, buffer size %i\n",
  ------------------
  |  | 1817|      9|    #define mpack_log(...) ((void)0)
  ------------------
 3070|      9|            (int)count, p, (int)left, (int)reader->size);
 3071|       |
 3072|      9|    if (count <= left) {
  ------------------
  |  Branch (3072:9): [True: 0, False: 9]
  ------------------
 3073|      0|        mpack_assert(0,
  ------------------
  |  | 1735|      0|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|      0|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      0|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      0|                (void)0))
  ------------------
 3074|      0|                "big read requested for %i bytes, but there are %i bytes "
 3075|      0|                "left in buffer. call mpack_read_native() instead",
 3076|      0|                (int)count, (int)left);
 3077|      0|        mpack_reader_flag_error(reader, mpack_error_bug);
 3078|      0|        mpack_memset(p, 0, count);
  ------------------
  |  | 1789|      0|    #define mpack_memset MPACK_MEMSET
  |  |  ------------------
  |  |  |  |  601|      0|        #define MPACK_MEMSET memset
  |  |  ------------------
  ------------------
 3079|      0|        return;
 3080|      0|    }
 3081|       |
 3082|       |    // we'll need a fill function to get more data. if there's no
 3083|       |    // fill function, the buffer should contain an entire MessagePack
 3084|       |    // object, so we raise mpack_error_invalid instead of mpack_error_io
 3085|       |    // on truncated data.
 3086|      9|    if (reader->fill == NULL) {
  ------------------
  |  Branch (3086:9): [True: 9, False: 0]
  ------------------
 3087|      9|        mpack_reader_flag_error(reader, mpack_error_invalid);
 3088|      9|        mpack_memset(p, 0, count);
  ------------------
  |  | 1789|      9|    #define mpack_memset MPACK_MEMSET
  |  |  ------------------
  |  |  |  |  601|      9|        #define MPACK_MEMSET memset
  |  |  ------------------
  ------------------
 3089|      9|        return;
 3090|      9|    }
 3091|       |
 3092|      0|    if (reader->size == 0) {
  ------------------
  |  Branch (3092:9): [True: 0, False: 0]
  ------------------
 3093|       |        // somewhat debatable what error should be returned here. when
 3094|       |        // initializing a reader with an in-memory buffer it's not
 3095|       |        // necessarily a bug if the data is blank; it might just have
 3096|       |        // been truncated to zero. for this reason we return the same
 3097|       |        // error as if the data was truncated.
 3098|      0|        mpack_reader_flag_error(reader, mpack_error_io);
 3099|      0|        mpack_memset(p, 0, count);
  ------------------
  |  | 1789|      0|    #define mpack_memset MPACK_MEMSET
  |  |  ------------------
  |  |  |  |  601|      0|        #define MPACK_MEMSET memset
  |  |  ------------------
  ------------------
 3100|      0|        return;
 3101|      0|    }
 3102|       |
 3103|       |    // flush what's left of the buffer
 3104|      0|    if (left > 0) {
  ------------------
  |  Branch (3104:9): [True: 0, False: 0]
  ------------------
 3105|      0|        mpack_log("flushing %i bytes remaining in buffer\n", (int)left);
  ------------------
  |  | 1817|      0|    #define mpack_log(...) ((void)0)
  ------------------
 3106|      0|        mpack_memcpy(p, reader->data, left);
  ------------------
  |  | 1777|      0|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|      0|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 3107|      0|        count -= left;
 3108|      0|        p += left;
 3109|      0|        reader->data += left;
 3110|      0|    }
 3111|       |
 3112|       |    // if the remaining data needed is some small fraction of the
 3113|       |    // buffer size, we'll try to fill the buffer as much as possible
 3114|       |    // and copy the needed data out.
 3115|      0|    if (count <= reader->size / MPACK_READER_SMALL_FRACTION_DENOMINATOR) {
  ------------------
  |  | 4361|      0|#define MPACK_READER_SMALL_FRACTION_DENOMINATOR 32
  ------------------
  |  Branch (3115:9): [True: 0, False: 0]
  ------------------
 3116|      0|        size_t read = mpack_fill_range(reader, reader->buffer, count, reader->size);
 3117|      0|        if (mpack_reader_error(reader) != mpack_ok)
  ------------------
  |  Branch (3117:13): [True: 0, False: 0]
  ------------------
 3118|      0|            return;
 3119|      0|        mpack_memcpy(p, reader->buffer, count);
  ------------------
  |  | 1777|      0|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|      0|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 3120|      0|        reader->data = reader->buffer + count;
 3121|      0|        reader->end = reader->buffer + read;
 3122|       |
 3123|       |    // otherwise we read the remaining data directly into the target.
 3124|      0|    } else {
 3125|      0|        mpack_log("reading %i additional bytes\n", (int)count);
  ------------------
  |  | 1817|      0|    #define mpack_log(...) ((void)0)
  ------------------
 3126|      0|        mpack_fill_range(reader, p, count, count);
 3127|      0|    }
 3128|      0|}
mpack_read_bytes:
 3207|  4.83k|void mpack_read_bytes(mpack_reader_t* reader, char* p, size_t count) {
 3208|  4.83k|    mpack_assert(p != NULL, "destination for read of %i bytes is NULL", (int)count);
  ------------------
  |  | 1735|  4.83k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  14.4k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 4.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  4.83k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  4.83k|                (void)0))
  ------------------
 3209|  4.83k|    mpack_reader_track_bytes(reader, count);
 3210|  4.83k|    mpack_read_native(reader, p, count);
 3211|  4.83k|}
mpack_read_cstr:
 3242|   173k|void mpack_read_cstr(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count) {
 3243|   173k|    mpack_read_cstr_unchecked(reader, buf, buffer_size, byte_count);
 3244|       |
 3245|       |    // check for null bytes
 3246|   173k|    if (mpack_reader_error(reader) == mpack_ok && !mpack_str_check_no_null(buf, byte_count)) {
  ------------------
  |  Branch (3246:9): [True: 173k, False: 8]
  |  Branch (3246:51): [True: 33, False: 173k]
  ------------------
 3247|     33|        buf[0] = 0;
 3248|     33|        mpack_reader_flag_error(reader, mpack_error_type);
 3249|     33|    }
 3250|   173k|}
mpack_read_tag:
 3699|  1.38M|mpack_tag_t mpack_read_tag(mpack_reader_t* reader) {
 3700|  1.38M|    mpack_log("reading tag\n");
  ------------------
  |  | 1817|  1.38M|    #define mpack_log(...) ((void)0)
  ------------------
 3701|       |
 3702|       |    // make sure we can read a tag
 3703|  1.38M|    if (mpack_reader_error(reader) != mpack_ok)
  ------------------
  |  Branch (3703:9): [True: 0, False: 1.38M]
  ------------------
 3704|      0|        return mpack_tag_nil();
 3705|  1.38M|    if (mpack_reader_track_element(reader) != mpack_ok)
  ------------------
  |  Branch (3705:9): [True: 0, False: 1.38M]
  ------------------
 3706|      0|        return mpack_tag_nil();
 3707|       |
 3708|  1.38M|    mpack_tag_t tag = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  1.38M|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 3709|  1.38M|    size_t count = mpack_parse_tag(reader, &tag);
 3710|  1.38M|    if (count == 0)
  ------------------
  |  Branch (3710:9): [True: 5, False: 1.38M]
  ------------------
 3711|      5|        return mpack_tag_nil();
 3712|       |
 3713|       |    #if MPACK_READ_TRACKING
 3714|       |    mpack_error_t track_error = mpack_ok;
 3715|       |
 3716|       |    switch (tag.type) {
 3717|       |        case mpack_type_map:
 3718|       |        case mpack_type_array:
 3719|       |            track_error = mpack_track_push(&reader->track, tag.type, tag.v.n);
 3720|       |            break;
 3721|       |        #if MPACK_EXTENSIONS
 3722|       |        case mpack_type_ext:
 3723|       |        #endif
 3724|       |        case mpack_type_str:
 3725|       |        case mpack_type_bin:
 3726|       |            track_error = mpack_track_push(&reader->track, tag.type, tag.v.l);
 3727|       |            break;
 3728|       |        default:
 3729|       |            break;
 3730|       |    }
 3731|       |
 3732|       |    if (track_error != mpack_ok) {
 3733|       |        mpack_reader_flag_error(reader, track_error);
 3734|       |        return mpack_tag_nil();
 3735|       |    }
 3736|       |    #endif
 3737|       |
 3738|  1.38M|    reader->data += count;
 3739|  1.38M|    return tag;
 3740|  1.38M|}
mpack_peek_tag:
 3742|   789k|mpack_tag_t mpack_peek_tag(mpack_reader_t* reader) {
 3743|   789k|    mpack_log("peeking tag\n");
  ------------------
  |  | 1817|   789k|    #define mpack_log(...) ((void)0)
  ------------------
 3744|       |
 3745|       |    // make sure we can peek a tag
 3746|   789k|    if (mpack_reader_error(reader) != mpack_ok)
  ------------------
  |  Branch (3746:9): [True: 0, False: 789k]
  ------------------
 3747|      0|        return mpack_tag_nil();
 3748|   789k|    if (mpack_reader_track_peek_element(reader) != mpack_ok)
  ------------------
  |  Branch (3748:9): [True: 0, False: 789k]
  ------------------
 3749|      0|        return mpack_tag_nil();
 3750|       |
 3751|   789k|    mpack_tag_t tag = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|   789k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 3752|   789k|    if (mpack_parse_tag(reader, &tag) == 0)
  ------------------
  |  Branch (3752:9): [True: 6, False: 789k]
  ------------------
 3753|      6|        return mpack_tag_nil();
 3754|   789k|    return tag;
 3755|   789k|}
mpack.c:mpack_read_cstr_unchecked:
 3222|   173k|static void mpack_read_cstr_unchecked(mpack_reader_t* reader, char* buf, size_t buffer_size, size_t byte_count) {
 3223|   173k|    mpack_assert(buf != NULL, "destination for read of %i bytes is NULL", (int)byte_count);
  ------------------
  |  | 1735|   173k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|   520k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   173k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   173k|                (void)0))
  ------------------
 3224|   173k|    mpack_assert(buffer_size >= 1, "buffer size is zero; you must have room for at least a null-terminator");
  ------------------
  |  | 1735|   173k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|   520k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   173k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   173k|                (void)0))
  ------------------
 3225|       |
 3226|   173k|    if (mpack_reader_error(reader)) {
  ------------------
  |  Branch (3226:9): [True: 0, False: 173k]
  ------------------
 3227|      0|        buf[0] = 0;
 3228|      0|        return;
 3229|      0|    }
 3230|       |
 3231|   173k|    if (byte_count > buffer_size - 1) {
  ------------------
  |  Branch (3231:9): [True: 0, False: 173k]
  ------------------
 3232|      0|        mpack_reader_flag_error(reader, mpack_error_too_big);
 3233|      0|        buf[0] = 0;
 3234|      0|        return;
 3235|      0|    }
 3236|       |
 3237|   173k|    mpack_reader_track_str_bytes_all(reader, byte_count);
 3238|   173k|    mpack_read_native(reader, buf, byte_count);
 3239|   173k|    buf[byte_count] = 0;
 3240|   173k|}
mpack.c:mpack_parse_tag:
 3347|  2.17M|static size_t mpack_parse_tag(mpack_reader_t* reader, mpack_tag_t* tag) {
 3348|  2.17M|    mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!");
  ------------------
  |  | 1735|  2.17M|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  6.52M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 2.17M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  2.17M|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  2.17M|                (void)0))
  ------------------
 3349|       |
 3350|  2.17M|    if (!mpack_reader_ensure(reader, 1))
  ------------------
  |  Branch (3350:9): [True: 8, False: 2.17M]
  ------------------
 3351|      8|        return 0;
 3352|  2.17M|    uint8_t type = mpack_load_u8(reader->data);
 3353|       |
 3354|       |    // unfortunately, by far the fastest way to parse a tag is to switch
 3355|       |    // on the first byte, and to explicitly list every possible byte. so for
 3356|       |    // infix types, the list of cases is quite large.
 3357|       |    //
 3358|       |    // in size-optimized builds, we switch on the top four bits first to
 3359|       |    // handle most infix types with a smaller jump table to save space.
 3360|       |
 3361|       |    #if MPACK_OPTIMIZE_FOR_SIZE
 3362|       |    switch (type >> 4) {
 3363|       |
 3364|       |        // positive fixnum
 3365|       |        case 0x0: case 0x1: case 0x2: case 0x3:
 3366|       |        case 0x4: case 0x5: case 0x6: case 0x7:
 3367|       |            *tag = mpack_tag_make_uint(type);
 3368|       |            return 1;
 3369|       |
 3370|       |        // negative fixnum
 3371|       |        case 0xe: case 0xf:
 3372|       |            *tag = mpack_tag_make_int((int8_t)type);
 3373|       |            return 1;
 3374|       |
 3375|       |        // fixmap
 3376|       |        case 0x8:
 3377|       |            *tag = mpack_tag_make_map(type & ~0xf0u);
 3378|       |            return 1;
 3379|       |
 3380|       |        // fixarray
 3381|       |        case 0x9:
 3382|       |            *tag = mpack_tag_make_array(type & ~0xf0u);
 3383|       |            return 1;
 3384|       |
 3385|       |        // fixstr
 3386|       |        case 0xa: case 0xb:
 3387|       |            *tag = mpack_tag_make_str(type & ~0xe0u);
 3388|       |            return 1;
 3389|       |
 3390|       |        // not one of the common infix types
 3391|       |        default:
 3392|       |            break;
 3393|       |
 3394|       |    }
 3395|       |    #endif
 3396|       |
 3397|       |    // handle individual type tags
 3398|  2.17M|    switch (type) {
  ------------------
  |  Branch (3398:13): [True: 0, False: 2.17M]
  ------------------
 3399|       |
 3400|      0|        #if !MPACK_OPTIMIZE_FOR_SIZE
 3401|       |        // positive fixnum
 3402|  48.8k|        case 0x00: case 0x01: case 0x02: case 0x03: case 0x04: case 0x05: case 0x06: case 0x07:
  ------------------
  |  Branch (3402:9): [True: 44.1k, False: 2.13M]
  |  Branch (3402:20): [True: 968, False: 2.17M]
  |  Branch (3402:31): [True: 1.81k, False: 2.17M]
  |  Branch (3402:42): [True: 78, False: 2.17M]
  |  Branch (3402:53): [True: 280, False: 2.17M]
  |  Branch (3402:64): [True: 962, False: 2.17M]
  |  Branch (3402:75): [True: 414, False: 2.17M]
  |  Branch (3402:86): [True: 212, False: 2.17M]
  ------------------
 3403|  92.7k|        case 0x08: case 0x09: case 0x0a: case 0x0b: case 0x0c: case 0x0d: case 0x0e: case 0x0f:
  ------------------
  |  Branch (3403:9): [True: 17.4k, False: 2.15M]
  |  Branch (3403:20): [True: 800, False: 2.17M]
  |  Branch (3403:31): [True: 452, False: 2.17M]
  |  Branch (3403:42): [True: 19.2k, False: 2.15M]
  |  Branch (3403:53): [True: 68, False: 2.17M]
  |  Branch (3403:64): [True: 160, False: 2.17M]
  |  Branch (3403:75): [True: 5.63k, False: 2.16M]
  |  Branch (3403:86): [True: 27, False: 2.17M]
  ------------------
 3404|   110k|        case 0x10: case 0x11: case 0x12: case 0x13: case 0x14: case 0x15: case 0x16: case 0x17:
  ------------------
  |  Branch (3404:9): [True: 216, False: 2.17M]
  |  Branch (3404:20): [True: 288, False: 2.17M]
  |  Branch (3404:31): [True: 3.03k, False: 2.17M]
  |  Branch (3404:42): [True: 775, False: 2.17M]
  |  Branch (3404:53): [True: 110, False: 2.17M]
  |  Branch (3404:64): [True: 12.5k, False: 2.16M]
  |  Branch (3404:75): [True: 204, False: 2.17M]
  |  Branch (3404:86): [True: 610, False: 2.17M]
  ------------------
 3405|   274k|        case 0x18: case 0x19: case 0x1a: case 0x1b: case 0x1c: case 0x1d: case 0x1e: case 0x1f:
  ------------------
  |  Branch (3405:9): [True: 22, False: 2.17M]
  |  Branch (3405:20): [True: 18, False: 2.17M]
  |  Branch (3405:31): [True: 161k, False: 2.01M]
  |  Branch (3405:42): [True: 52, False: 2.17M]
  |  Branch (3405:53): [True: 358, False: 2.17M]
  |  Branch (3405:64): [True: 1.11k, False: 2.17M]
  |  Branch (3405:75): [True: 486, False: 2.17M]
  |  Branch (3405:86): [True: 530, False: 2.17M]
  ------------------
 3406|   287k|        case 0x20: case 0x21: case 0x22: case 0x23: case 0x24: case 0x25: case 0x26: case 0x27:
  ------------------
  |  Branch (3406:9): [True: 64, False: 2.17M]
  |  Branch (3406:20): [True: 54, False: 2.17M]
  |  Branch (3406:31): [True: 28, False: 2.17M]
  |  Branch (3406:42): [True: 244, False: 2.17M]
  |  Branch (3406:53): [True: 1.73k, False: 2.17M]
  |  Branch (3406:64): [True: 3.12k, False: 2.17M]
  |  Branch (3406:75): [True: 7, False: 2.17M]
  |  Branch (3406:86): [True: 7.09k, False: 2.16M]
  ------------------
 3407|   416k|        case 0x28: case 0x29: case 0x2a: case 0x2b: case 0x2c: case 0x2d: case 0x2e: case 0x2f:
  ------------------
  |  Branch (3407:9): [True: 80, False: 2.17M]
  |  Branch (3407:20): [True: 313, False: 2.17M]
  |  Branch (3407:31): [True: 38, False: 2.17M]
  |  Branch (3407:42): [True: 480, False: 2.17M]
  |  Branch (3407:53): [True: 122k, False: 2.05M]
  |  Branch (3407:64): [True: 2.95k, False: 2.17M]
  |  Branch (3407:75): [True: 2.21k, False: 2.17M]
  |  Branch (3407:86): [True: 240, False: 2.17M]
  ------------------
 3408|   435k|        case 0x30: case 0x31: case 0x32: case 0x33: case 0x34: case 0x35: case 0x36: case 0x37:
  ------------------
  |  Branch (3408:9): [True: 13.7k, False: 2.16M]
  |  Branch (3408:20): [True: 798, False: 2.17M]
  |  Branch (3408:31): [True: 878, False: 2.17M]
  |  Branch (3408:42): [True: 372, False: 2.17M]
  |  Branch (3408:53): [True: 933, False: 2.17M]
  |  Branch (3408:64): [True: 224, False: 2.17M]
  |  Branch (3408:75): [True: 1.15k, False: 2.17M]
  |  Branch (3408:86): [True: 974, False: 2.17M]
  ------------------
 3409|   905k|        case 0x38: case 0x39: case 0x3a: case 0x3b: case 0x3c: case 0x3d: case 0x3e: case 0x3f:
  ------------------
  |  Branch (3409:9): [True: 2.68k, False: 2.17M]
  |  Branch (3409:20): [True: 1.23k, False: 2.17M]
  |  Branch (3409:31): [True: 228, False: 2.17M]
  |  Branch (3409:42): [True: 786, False: 2.17M]
  |  Branch (3409:53): [True: 17.3k, False: 2.15M]
  |  Branch (3409:64): [True: 712, False: 2.17M]
  |  Branch (3409:75): [True: 446k, False: 1.72M]
  |  Branch (3409:86): [True: 208, False: 2.17M]
  ------------------
 3410|   937k|        case 0x40: case 0x41: case 0x42: case 0x43: case 0x44: case 0x45: case 0x46: case 0x47:
  ------------------
  |  Branch (3410:9): [True: 2.23k, False: 2.17M]
  |  Branch (3410:20): [True: 20.2k, False: 2.15M]
  |  Branch (3410:31): [True: 0, False: 2.17M]
  |  Branch (3410:42): [True: 4.10k, False: 2.17M]
  |  Branch (3410:53): [True: 20, False: 2.17M]
  |  Branch (3410:64): [True: 670, False: 2.17M]
  |  Branch (3410:75): [True: 4.68k, False: 2.16M]
  |  Branch (3410:86): [True: 124, False: 2.17M]
  ------------------
 3411|   944k|        case 0x48: case 0x49: case 0x4a: case 0x4b: case 0x4c: case 0x4d: case 0x4e: case 0x4f:
  ------------------
  |  Branch (3411:9): [True: 104, False: 2.17M]
  |  Branch (3411:20): [True: 360, False: 2.17M]
  |  Branch (3411:31): [True: 12, False: 2.17M]
  |  Branch (3411:42): [True: 12, False: 2.17M]
  |  Branch (3411:53): [True: 5.12k, False: 2.16M]
  |  Branch (3411:64): [True: 1.42k, False: 2.17M]
  |  Branch (3411:75): [True: 6, False: 2.17M]
  |  Branch (3411:86): [True: 52, False: 2.17M]
  ------------------
 3412|   957k|        case 0x50: case 0x51: case 0x52: case 0x53: case 0x54: case 0x55: case 0x56: case 0x57:
  ------------------
  |  Branch (3412:9): [True: 24, False: 2.17M]
  |  Branch (3412:20): [True: 444, False: 2.17M]
  |  Branch (3412:31): [True: 328, False: 2.17M]
  |  Branch (3412:42): [True: 2.09k, False: 2.17M]
  |  Branch (3412:53): [True: 4.50k, False: 2.17M]
  |  Branch (3412:64): [True: 5.49k, False: 2.16M]
  |  Branch (3412:75): [True: 14, False: 2.17M]
  |  Branch (3412:86): [True: 622, False: 2.17M]
  ------------------
 3413|   967k|        case 0x58: case 0x59: case 0x5a: case 0x5b: case 0x5c: case 0x5d: case 0x5e: case 0x5f:
  ------------------
  |  Branch (3413:9): [True: 534, False: 2.17M]
  |  Branch (3413:20): [True: 151, False: 2.17M]
  |  Branch (3413:31): [True: 942, False: 2.17M]
  |  Branch (3413:42): [True: 24, False: 2.17M]
  |  Branch (3413:53): [True: 56, False: 2.17M]
  |  Branch (3413:64): [True: 7.69k, False: 2.16M]
  |  Branch (3413:75): [True: 2, False: 2.17M]
  |  Branch (3413:86): [True: 25, False: 2.17M]
  ------------------
 3414|  1.00M|        case 0x60: case 0x61: case 0x62: case 0x63: case 0x64: case 0x65: case 0x66: case 0x67:
  ------------------
  |  Branch (3414:9): [True: 608, False: 2.17M]
  |  Branch (3414:20): [True: 32.5k, False: 2.14M]
  |  Branch (3414:31): [True: 104, False: 2.17M]
  |  Branch (3414:42): [True: 1.41k, False: 2.17M]
  |  Branch (3414:53): [True: 134, False: 2.17M]
  |  Branch (3414:64): [True: 1.38k, False: 2.17M]
  |  Branch (3414:75): [True: 50, False: 2.17M]
  |  Branch (3414:86): [True: 3.67k, False: 2.17M]
  ------------------
 3415|  1.03M|        case 0x68: case 0x69: case 0x6a: case 0x6b: case 0x6c: case 0x6d: case 0x6e: case 0x6f:
  ------------------
  |  Branch (3415:9): [True: 16, False: 2.17M]
  |  Branch (3415:20): [True: 31.0k, False: 2.14M]
  |  Branch (3415:31): [True: 66, False: 2.17M]
  |  Branch (3415:42): [True: 2, False: 2.17M]
  |  Branch (3415:53): [True: 144, False: 2.17M]
  |  Branch (3415:64): [True: 314, False: 2.17M]
  |  Branch (3415:75): [True: 270, False: 2.17M]
  |  Branch (3415:86): [True: 132, False: 2.17M]
  ------------------
 3416|  1.05M|        case 0x70: case 0x71: case 0x72: case 0x73: case 0x74: case 0x75: case 0x76: case 0x77:
  ------------------
  |  Branch (3416:9): [True: 224, False: 2.17M]
  |  Branch (3416:20): [True: 9.50k, False: 2.16M]
  |  Branch (3416:31): [True: 500, False: 2.17M]
  |  Branch (3416:42): [True: 562, False: 2.17M]
  |  Branch (3416:53): [True: 380, False: 2.17M]
  |  Branch (3416:64): [True: 264, False: 2.17M]
  |  Branch (3416:75): [True: 6, False: 2.17M]
  |  Branch (3416:86): [True: 14, False: 2.17M]
  ------------------
 3417|  1.05M|        case 0x78: case 0x79: case 0x7a: case 0x7b: case 0x7c: case 0x7d: case 0x7e: case 0x7f:
  ------------------
  |  Branch (3417:9): [True: 144, False: 2.17M]
  |  Branch (3417:20): [True: 28, False: 2.17M]
  |  Branch (3417:31): [True: 38, False: 2.17M]
  |  Branch (3417:42): [True: 2, False: 2.17M]
  |  Branch (3417:53): [True: 300, False: 2.17M]
  |  Branch (3417:64): [True: 1.12k, False: 2.17M]
  |  Branch (3417:75): [True: 168, False: 2.17M]
  |  Branch (3417:86): [True: 511, False: 2.17M]
  ------------------
 3418|  1.05M|            *tag = mpack_tag_make_uint(type);
 3419|  1.05M|            return 1;
 3420|       |
 3421|       |        // negative fixnum
 3422|  1.95k|        case 0xe0: case 0xe1: case 0xe2: case 0xe3: case 0xe4: case 0xe5: case 0xe6: case 0xe7:
  ------------------
  |  Branch (3422:9): [True: 196, False: 2.17M]
  |  Branch (3422:20): [True: 962, False: 2.17M]
  |  Branch (3422:31): [True: 102, False: 2.17M]
  |  Branch (3422:42): [True: 224, False: 2.17M]
  |  Branch (3422:53): [True: 208, False: 2.17M]
  |  Branch (3422:64): [True: 194, False: 2.17M]
  |  Branch (3422:75): [True: 32, False: 2.17M]
  |  Branch (3422:86): [True: 32, False: 2.17M]
  ------------------
 3423|  37.8k|        case 0xe8: case 0xe9: case 0xea: case 0xeb: case 0xec: case 0xed: case 0xee: case 0xef:
  ------------------
  |  Branch (3423:9): [True: 6.33k, False: 2.16M]
  |  Branch (3423:20): [True: 200, False: 2.17M]
  |  Branch (3423:31): [True: 514, False: 2.17M]
  |  Branch (3423:42): [True: 192, False: 2.17M]
  |  Branch (3423:53): [True: 8, False: 2.17M]
  |  Branch (3423:64): [True: 28.2k, False: 2.14M]
  |  Branch (3423:75): [True: 252, False: 2.17M]
  |  Branch (3423:86): [True: 124, False: 2.17M]
  ------------------
 3424|  41.7k|        case 0xf0: case 0xf1: case 0xf2: case 0xf3: case 0xf4: case 0xf5: case 0xf6: case 0xf7:
  ------------------
  |  Branch (3424:9): [True: 615, False: 2.17M]
  |  Branch (3424:20): [True: 982, False: 2.17M]
  |  Branch (3424:31): [True: 8, False: 2.17M]
  |  Branch (3424:42): [True: 251, False: 2.17M]
  |  Branch (3424:53): [True: 140, False: 2.17M]
  |  Branch (3424:64): [True: 10, False: 2.17M]
  |  Branch (3424:75): [True: 702, False: 2.17M]
  |  Branch (3424:86): [True: 1.25k, False: 2.17M]
  ------------------
 3425|   134k|        case 0xf8: case 0xf9: case 0xfa: case 0xfb: case 0xfc: case 0xfd: case 0xfe: case 0xff:
  ------------------
  |  Branch (3425:9): [True: 132, False: 2.17M]
  |  Branch (3425:20): [True: 2, False: 2.17M]
  |  Branch (3425:31): [True: 50, False: 2.17M]
  |  Branch (3425:42): [True: 580, False: 2.17M]
  |  Branch (3425:53): [True: 59.8k, False: 2.11M]
  |  Branch (3425:64): [True: 46, False: 2.17M]
  |  Branch (3425:75): [True: 776, False: 2.17M]
  |  Branch (3425:86): [True: 31.0k, False: 2.14M]
  ------------------
 3426|   134k|            *tag = mpack_tag_make_int((int8_t)type);
 3427|   134k|            return 1;
 3428|       |
 3429|       |        // fixmap
 3430|   765k|        case 0x80: case 0x81: case 0x82: case 0x83: case 0x84: case 0x85: case 0x86: case 0x87:
  ------------------
  |  Branch (3430:9): [True: 426k, False: 1.74M]
  |  Branch (3430:20): [True: 337k, False: 1.83M]
  |  Branch (3430:31): [True: 381, False: 2.17M]
  |  Branch (3430:42): [True: 11, False: 2.17M]
  |  Branch (3430:53): [True: 23, False: 2.17M]
  |  Branch (3430:64): [True: 736, False: 2.17M]
  |  Branch (3430:75): [True: 367, False: 2.17M]
  |  Branch (3430:86): [True: 16, False: 2.17M]
  ------------------
 3431|   765k|        case 0x88: case 0x89: case 0x8a: case 0x8b: case 0x8c: case 0x8d: case 0x8e: case 0x8f:
  ------------------
  |  Branch (3431:9): [True: 13, False: 2.17M]
  |  Branch (3431:20): [True: 353, False: 2.17M]
  |  Branch (3431:31): [True: 52, False: 2.17M]
  |  Branch (3431:42): [True: 34, False: 2.17M]
  |  Branch (3431:53): [True: 6, False: 2.17M]
  |  Branch (3431:64): [True: 11, False: 2.17M]
  |  Branch (3431:75): [True: 0, False: 2.17M]
  |  Branch (3431:86): [True: 0, False: 2.17M]
  ------------------
 3432|   765k|            *tag = mpack_tag_make_map(type & ~0xf0u);
 3433|   765k|            return 1;
 3434|       |
 3435|       |        // fixarray
 3436|  5.45k|        case 0x90: case 0x91: case 0x92: case 0x93: case 0x94: case 0x95: case 0x96: case 0x97:
  ------------------
  |  Branch (3436:9): [True: 6, False: 2.17M]
  |  Branch (3436:20): [True: 2.40k, False: 2.17M]
  |  Branch (3436:31): [True: 1.12k, False: 2.17M]
  |  Branch (3436:42): [True: 196, False: 2.17M]
  |  Branch (3436:53): [True: 1.13k, False: 2.17M]
  |  Branch (3436:64): [True: 296, False: 2.17M]
  |  Branch (3436:75): [True: 36, False: 2.17M]
  |  Branch (3436:86): [True: 264, False: 2.17M]
  ------------------
 3437|  15.8k|        case 0x98: case 0x99: case 0x9a: case 0x9b: case 0x9c: case 0x9d: case 0x9e: case 0x9f:
  ------------------
  |  Branch (3437:9): [True: 42, False: 2.17M]
  |  Branch (3437:20): [True: 38, False: 2.17M]
  |  Branch (3437:31): [True: 82, False: 2.17M]
  |  Branch (3437:42): [True: 6, False: 2.17M]
  |  Branch (3437:53): [True: 5.75k, False: 2.16M]
  |  Branch (3437:64): [True: 116, False: 2.17M]
  |  Branch (3437:75): [True: 2.60k, False: 2.17M]
  |  Branch (3437:86): [True: 1.72k, False: 2.17M]
  ------------------
 3438|  15.8k|            *tag = mpack_tag_make_array(type & ~0xf0u);
 3439|  15.8k|            return 1;
 3440|       |
 3441|       |        // fixstr
 3442|   170k|        case 0xa0: case 0xa1: case 0xa2: case 0xa3: case 0xa4: case 0xa5: case 0xa6: case 0xa7:
  ------------------
  |  Branch (3442:9): [True: 168k, False: 2.00M]
  |  Branch (3442:20): [True: 1.02k, False: 2.17M]
  |  Branch (3442:31): [True: 28, False: 2.17M]
  |  Branch (3442:42): [True: 446, False: 2.17M]
  |  Branch (3442:53): [True: 516, False: 2.17M]
  |  Branch (3442:64): [True: 24, False: 2.17M]
  |  Branch (3442:75): [True: 2, False: 2.17M]
  |  Branch (3442:86): [True: 14, False: 2.17M]
  ------------------
 3443|   174k|        case 0xa8: case 0xa9: case 0xaa: case 0xab: case 0xac: case 0xad: case 0xae: case 0xaf:
  ------------------
  |  Branch (3443:9): [True: 397, False: 2.17M]
  |  Branch (3443:20): [True: 118, False: 2.17M]
  |  Branch (3443:31): [True: 7, False: 2.17M]
  |  Branch (3443:42): [True: 5, False: 2.17M]
  |  Branch (3443:53): [True: 2.88k, False: 2.17M]
  |  Branch (3443:64): [True: 10, False: 2.17M]
  |  Branch (3443:75): [True: 10, False: 2.17M]
  |  Branch (3443:86): [True: 2, False: 2.17M]
  ------------------
 3444|   174k|        case 0xb0: case 0xb1: case 0xb2: case 0xb3: case 0xb4: case 0xb5: case 0xb6: case 0xb7:
  ------------------
  |  Branch (3444:9): [True: 1, False: 2.17M]
  |  Branch (3444:20): [True: 67, False: 2.17M]
  |  Branch (3444:31): [True: 4, False: 2.17M]
  |  Branch (3444:42): [True: 8, False: 2.17M]
  |  Branch (3444:53): [True: 14, False: 2.17M]
  |  Branch (3444:64): [True: 32, False: 2.17M]
  |  Branch (3444:75): [True: 10, False: 2.17M]
  |  Branch (3444:86): [True: 108, False: 2.17M]
  ------------------
 3445|   175k|        case 0xb8: case 0xb9: case 0xba: case 0xbb: case 0xbc: case 0xbd: case 0xbe: case 0xbf:
  ------------------
  |  Branch (3445:9): [True: 56, False: 2.17M]
  |  Branch (3445:20): [True: 42, False: 2.17M]
  |  Branch (3445:31): [True: 10, False: 2.17M]
  |  Branch (3445:42): [True: 2, False: 2.17M]
  |  Branch (3445:53): [True: 192, False: 2.17M]
  |  Branch (3445:64): [True: 20, False: 2.17M]
  |  Branch (3445:75): [True: 610, False: 2.17M]
  |  Branch (3445:86): [True: 21, False: 2.17M]
  ------------------
 3446|   175k|            *tag = mpack_tag_make_str(type & ~0xe0u);
 3447|   175k|            return 1;
 3448|      0|        #endif
 3449|       |
 3450|       |        // nil
 3451|      2|        case 0xc0:
  ------------------
  |  Branch (3451:9): [True: 2, False: 2.17M]
  ------------------
 3452|      2|            *tag = mpack_tag_make_nil();
 3453|      2|            return 1;
 3454|       |
 3455|       |        // bool
 3456|  10.4k|        case 0xc2: case 0xc3:
  ------------------
  |  Branch (3456:9): [True: 12, False: 2.17M]
  |  Branch (3456:20): [True: 10.4k, False: 2.16M]
  ------------------
 3457|  10.4k|            *tag = mpack_tag_make_bool((bool)(type & 1));
 3458|  10.4k|            return 1;
 3459|       |
 3460|       |        // bin8
 3461|  9.27k|        case 0xc4:
  ------------------
  |  Branch (3461:9): [True: 9.27k, False: 2.16M]
  ------------------
 3462|  9.27k|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN8))
  ------------------
  |  | 2932|  9.27k|#define MPACK_TAG_SIZE_BIN8     2
  ------------------
  |  Branch (3462:17): [True: 0, False: 9.27k]
  ------------------
 3463|      0|                return 0;
 3464|  9.27k|            *tag = mpack_tag_make_bin(mpack_load_u8(reader->data + 1));
 3465|  9.27k|            return MPACK_TAG_SIZE_BIN8;
  ------------------
  |  | 2932|  9.27k|#define MPACK_TAG_SIZE_BIN8     2
  ------------------
 3466|       |
 3467|       |        // bin16
 3468|    194|        case 0xc5:
  ------------------
  |  Branch (3468:9): [True: 194, False: 2.17M]
  ------------------
 3469|    194|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN16))
  ------------------
  |  | 2933|    194|#define MPACK_TAG_SIZE_BIN16    3
  ------------------
  |  Branch (3469:17): [True: 0, False: 194]
  ------------------
 3470|      0|                return 0;
 3471|    194|            *tag = mpack_tag_make_bin(mpack_load_u16(reader->data + 1));
 3472|    194|            return MPACK_TAG_SIZE_BIN16;
  ------------------
  |  | 2933|    194|#define MPACK_TAG_SIZE_BIN16    3
  ------------------
 3473|       |
 3474|       |        // bin32
 3475|    196|        case 0xc6:
  ------------------
  |  Branch (3475:9): [True: 196, False: 2.17M]
  ------------------
 3476|    196|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_BIN32))
  ------------------
  |  | 2934|    196|#define MPACK_TAG_SIZE_BIN32    5
  ------------------
  |  Branch (3476:17): [True: 0, False: 196]
  ------------------
 3477|      0|                return 0;
 3478|    196|            *tag = mpack_tag_make_bin(mpack_load_u32(reader->data + 1));
 3479|    196|            return MPACK_TAG_SIZE_BIN32;
  ------------------
  |  | 2934|    196|#define MPACK_TAG_SIZE_BIN32    5
  ------------------
 3480|       |
 3481|      0|        #if MPACK_EXTENSIONS
 3482|       |        // ext8
 3483|      7|        case 0xc7:
  ------------------
  |  Branch (3483:9): [True: 7, False: 2.17M]
  ------------------
 3484|      7|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT8))
  ------------------
  |  | 2940|      7|#define MPACK_TAG_SIZE_EXT8     3
  ------------------
  |  Branch (3484:17): [True: 0, False: 7]
  ------------------
 3485|      0|                return 0;
 3486|      7|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 2), mpack_load_u8(reader->data + 1));
 3487|      7|            return MPACK_TAG_SIZE_EXT8;
  ------------------
  |  | 2940|      7|#define MPACK_TAG_SIZE_EXT8     3
  ------------------
 3488|       |
 3489|       |        // ext16
 3490|     13|        case 0xc8:
  ------------------
  |  Branch (3490:9): [True: 13, False: 2.17M]
  ------------------
 3491|     13|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT16))
  ------------------
  |  | 2941|     13|#define MPACK_TAG_SIZE_EXT16    4
  ------------------
  |  Branch (3491:17): [True: 0, False: 13]
  ------------------
 3492|      0|                return 0;
 3493|     13|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 3), mpack_load_u16(reader->data + 1));
 3494|     13|            return MPACK_TAG_SIZE_EXT16;
  ------------------
  |  | 2941|     13|#define MPACK_TAG_SIZE_EXT16    4
  ------------------
 3495|       |
 3496|       |        // ext32
 3497|     14|        case 0xc9:
  ------------------
  |  Branch (3497:9): [True: 14, False: 2.17M]
  ------------------
 3498|     14|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_EXT32))
  ------------------
  |  | 2942|     14|#define MPACK_TAG_SIZE_EXT32    6
  ------------------
  |  Branch (3498:17): [True: 0, False: 14]
  ------------------
 3499|      0|                return 0;
 3500|     14|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 5), mpack_load_u32(reader->data + 1));
 3501|     14|            return MPACK_TAG_SIZE_EXT32;
  ------------------
  |  | 2942|     14|#define MPACK_TAG_SIZE_EXT32    6
  ------------------
 3502|      0|        #endif
 3503|       |
 3504|       |        // float
 3505|     14|        case 0xca:
  ------------------
  |  Branch (3505:9): [True: 14, False: 2.17M]
  ------------------
 3506|     14|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FLOAT))
  ------------------
  |  | 2920|     14|#define MPACK_TAG_SIZE_FLOAT    5
  ------------------
  |  Branch (3506:17): [True: 0, False: 14]
  ------------------
 3507|      0|                return 0;
 3508|     14|            #if MPACK_FLOAT
 3509|     14|            *tag = mpack_tag_make_float(mpack_load_float(reader->data + 1));
 3510|       |            #else
 3511|       |            *tag = mpack_tag_make_raw_float(mpack_load_u32(reader->data + 1));
 3512|       |            #endif
 3513|     14|            return MPACK_TAG_SIZE_FLOAT;
  ------------------
  |  | 2920|     14|#define MPACK_TAG_SIZE_FLOAT    5
  ------------------
 3514|       |
 3515|       |        // double
 3516|  2.41k|        case 0xcb:
  ------------------
  |  Branch (3516:9): [True: 2.41k, False: 2.17M]
  ------------------
 3517|  2.41k|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_DOUBLE))
  ------------------
  |  | 2921|  2.41k|#define MPACK_TAG_SIZE_DOUBLE   9
  ------------------
  |  Branch (3517:17): [True: 0, False: 2.41k]
  ------------------
 3518|      0|                return 0;
 3519|  2.41k|            #if MPACK_DOUBLE
 3520|  2.41k|            *tag = mpack_tag_make_double(mpack_load_double(reader->data + 1));
 3521|       |            #else
 3522|       |            *tag = mpack_tag_make_raw_double(mpack_load_u64(reader->data + 1));
 3523|       |            #endif
 3524|  2.41k|            return MPACK_TAG_SIZE_DOUBLE;
  ------------------
  |  | 2921|  2.41k|#define MPACK_TAG_SIZE_DOUBLE   9
  ------------------
 3525|       |
 3526|       |        // uint8
 3527|    605|        case 0xcc:
  ------------------
  |  Branch (3527:9): [True: 605, False: 2.17M]
  ------------------
 3528|    605|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U8))
  ------------------
  |  | 2911|    605|#define MPACK_TAG_SIZE_U8       2
  ------------------
  |  Branch (3528:17): [True: 0, False: 605]
  ------------------
 3529|      0|                return 0;
 3530|    605|            *tag = mpack_tag_make_uint(mpack_load_u8(reader->data + 1));
 3531|    605|            return MPACK_TAG_SIZE_U8;
  ------------------
  |  | 2911|    605|#define MPACK_TAG_SIZE_U8       2
  ------------------
 3532|       |
 3533|       |        // uint16
 3534|    315|        case 0xcd:
  ------------------
  |  Branch (3534:9): [True: 315, False: 2.17M]
  ------------------
 3535|    315|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U16))
  ------------------
  |  | 2912|    315|#define MPACK_TAG_SIZE_U16      3
  ------------------
  |  Branch (3535:17): [True: 0, False: 315]
  ------------------
 3536|      0|                return 0;
 3537|    315|            *tag = mpack_tag_make_uint(mpack_load_u16(reader->data + 1));
 3538|    315|            return MPACK_TAG_SIZE_U16;
  ------------------
  |  | 2912|    315|#define MPACK_TAG_SIZE_U16      3
  ------------------
 3539|       |
 3540|       |        // uint32
 3541|    114|        case 0xce:
  ------------------
  |  Branch (3541:9): [True: 114, False: 2.17M]
  ------------------
 3542|    114|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U32))
  ------------------
  |  | 2913|    114|#define MPACK_TAG_SIZE_U32      5
  ------------------
  |  Branch (3542:17): [True: 0, False: 114]
  ------------------
 3543|      0|                return 0;
 3544|    114|            *tag = mpack_tag_make_uint(mpack_load_u32(reader->data + 1));
 3545|    114|            return MPACK_TAG_SIZE_U32;
  ------------------
  |  | 2913|    114|#define MPACK_TAG_SIZE_U32      5
  ------------------
 3546|       |
 3547|       |        // uint64
 3548|     85|        case 0xcf:
  ------------------
  |  Branch (3548:9): [True: 85, False: 2.17M]
  ------------------
 3549|     85|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_U64))
  ------------------
  |  | 2914|     85|#define MPACK_TAG_SIZE_U64      9
  ------------------
  |  Branch (3549:17): [True: 0, False: 85]
  ------------------
 3550|      0|                return 0;
 3551|     85|            *tag = mpack_tag_make_uint(mpack_load_u64(reader->data + 1));
 3552|     85|            return MPACK_TAG_SIZE_U64;
  ------------------
  |  | 2914|     85|#define MPACK_TAG_SIZE_U64      9
  ------------------
 3553|       |
 3554|       |        // int8
 3555|    165|        case 0xd0:
  ------------------
  |  Branch (3555:9): [True: 165, False: 2.17M]
  ------------------
 3556|    165|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I8))
  ------------------
  |  | 2916|    165|#define MPACK_TAG_SIZE_I8       2
  ------------------
  |  Branch (3556:17): [True: 0, False: 165]
  ------------------
 3557|      0|                return 0;
 3558|    165|            *tag = mpack_tag_make_int(mpack_load_i8(reader->data + 1));
 3559|    165|            return MPACK_TAG_SIZE_I8;
  ------------------
  |  | 2916|    165|#define MPACK_TAG_SIZE_I8       2
  ------------------
 3560|       |
 3561|       |        // int16
 3562|    331|        case 0xd1:
  ------------------
  |  Branch (3562:9): [True: 331, False: 2.17M]
  ------------------
 3563|    331|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I16))
  ------------------
  |  | 2917|    331|#define MPACK_TAG_SIZE_I16      3
  ------------------
  |  Branch (3563:17): [True: 0, False: 331]
  ------------------
 3564|      0|                return 0;
 3565|    331|            *tag = mpack_tag_make_int(mpack_load_i16(reader->data + 1));
 3566|    331|            return MPACK_TAG_SIZE_I16;
  ------------------
  |  | 2917|    331|#define MPACK_TAG_SIZE_I16      3
  ------------------
 3567|       |
 3568|       |        // int32
 3569|  2.63k|        case 0xd2:
  ------------------
  |  Branch (3569:9): [True: 2.63k, False: 2.17M]
  ------------------
 3570|  2.63k|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I32))
  ------------------
  |  | 2918|  2.63k|#define MPACK_TAG_SIZE_I32      5
  ------------------
  |  Branch (3570:17): [True: 0, False: 2.63k]
  ------------------
 3571|      0|                return 0;
 3572|  2.63k|            *tag = mpack_tag_make_int(mpack_load_i32(reader->data + 1));
 3573|  2.63k|            return MPACK_TAG_SIZE_I32;
  ------------------
  |  | 2918|  2.63k|#define MPACK_TAG_SIZE_I32      5
  ------------------
 3574|       |
 3575|       |        // int64
 3576|    300|        case 0xd3:
  ------------------
  |  Branch (3576:9): [True: 300, False: 2.17M]
  ------------------
 3577|    300|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_I64))
  ------------------
  |  | 2919|    300|#define MPACK_TAG_SIZE_I64      9
  ------------------
  |  Branch (3577:17): [True: 0, False: 300]
  ------------------
 3578|      0|                return 0;
 3579|    300|            *tag = mpack_tag_make_int(mpack_load_i64(reader->data + 1));
 3580|    300|            return MPACK_TAG_SIZE_I64;
  ------------------
  |  | 2919|    300|#define MPACK_TAG_SIZE_I64      9
  ------------------
 3581|       |
 3582|      0|        #if MPACK_EXTENSIONS
 3583|       |        // fixext1
 3584|     11|        case 0xd4:
  ------------------
  |  Branch (3584:9): [True: 11, False: 2.17M]
  ------------------
 3585|     11|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT1))
  ------------------
  |  | 2935|     11|#define MPACK_TAG_SIZE_FIXEXT1  2
  ------------------
  |  Branch (3585:17): [True: 0, False: 11]
  ------------------
 3586|      0|                return 0;
 3587|     11|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 1);
 3588|     11|            return MPACK_TAG_SIZE_FIXEXT1;
  ------------------
  |  | 2935|     11|#define MPACK_TAG_SIZE_FIXEXT1  2
  ------------------
 3589|       |
 3590|       |        // fixext2
 3591|      7|        case 0xd5:
  ------------------
  |  Branch (3591:9): [True: 7, False: 2.17M]
  ------------------
 3592|      7|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT2))
  ------------------
  |  | 2936|      7|#define MPACK_TAG_SIZE_FIXEXT2  2
  ------------------
  |  Branch (3592:17): [True: 0, False: 7]
  ------------------
 3593|      0|                return 0;
 3594|      7|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 2);
 3595|      7|            return MPACK_TAG_SIZE_FIXEXT2;
  ------------------
  |  | 2936|      7|#define MPACK_TAG_SIZE_FIXEXT2  2
  ------------------
 3596|       |
 3597|       |        // fixext4
 3598|     12|        case 0xd6:
  ------------------
  |  Branch (3598:9): [True: 12, False: 2.17M]
  ------------------
 3599|     12|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT4))
  ------------------
  |  | 2937|     12|#define MPACK_TAG_SIZE_FIXEXT4  2
  ------------------
  |  Branch (3599:17): [True: 0, False: 12]
  ------------------
 3600|      0|                return 0;
 3601|     12|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 4);
 3602|     12|            return 2;
 3603|       |
 3604|       |        // fixext8
 3605|      8|        case 0xd7:
  ------------------
  |  Branch (3605:9): [True: 8, False: 2.17M]
  ------------------
 3606|      8|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT8))
  ------------------
  |  | 2938|      8|#define MPACK_TAG_SIZE_FIXEXT8  2
  ------------------
  |  Branch (3606:17): [True: 0, False: 8]
  ------------------
 3607|      0|                return 0;
 3608|      8|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 8);
 3609|      8|            return MPACK_TAG_SIZE_FIXEXT8;
  ------------------
  |  | 2938|      8|#define MPACK_TAG_SIZE_FIXEXT8  2
  ------------------
 3610|       |
 3611|       |        // fixext16
 3612|      9|        case 0xd8:
  ------------------
  |  Branch (3612:9): [True: 9, False: 2.17M]
  ------------------
 3613|      9|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_FIXEXT16))
  ------------------
  |  | 2939|      9|#define MPACK_TAG_SIZE_FIXEXT16 2
  ------------------
  |  Branch (3613:17): [True: 0, False: 9]
  ------------------
 3614|      0|                return 0;
 3615|      9|            *tag = mpack_tag_make_ext(mpack_load_i8(reader->data + 1), 16);
 3616|      9|            return MPACK_TAG_SIZE_FIXEXT16;
  ------------------
  |  | 2939|      9|#define MPACK_TAG_SIZE_FIXEXT16 2
  ------------------
 3617|      0|        #endif
 3618|       |
 3619|       |        // str8
 3620|    525|        case 0xd9:
  ------------------
  |  Branch (3620:9): [True: 525, False: 2.17M]
  ------------------
 3621|    525|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR8))
  ------------------
  |  | 2929|    525|#define MPACK_TAG_SIZE_STR8     2
  ------------------
  |  Branch (3621:17): [True: 0, False: 525]
  ------------------
 3622|      0|                return 0;
 3623|    525|            *tag = mpack_tag_make_str(mpack_load_u8(reader->data + 1));
 3624|    525|            return MPACK_TAG_SIZE_STR8;
  ------------------
  |  | 2929|    525|#define MPACK_TAG_SIZE_STR8     2
  ------------------
 3625|       |
 3626|       |        // str16
 3627|  1.05k|        case 0xda:
  ------------------
  |  Branch (3627:9): [True: 1.05k, False: 2.17M]
  ------------------
 3628|  1.05k|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR16))
  ------------------
  |  | 2930|  1.05k|#define MPACK_TAG_SIZE_STR16    3
  ------------------
  |  Branch (3628:17): [True: 0, False: 1.05k]
  ------------------
 3629|      0|                return 0;
 3630|  1.05k|            *tag = mpack_tag_make_str(mpack_load_u16(reader->data + 1));
 3631|  1.05k|            return MPACK_TAG_SIZE_STR16;
  ------------------
  |  | 2930|  1.05k|#define MPACK_TAG_SIZE_STR16    3
  ------------------
 3632|       |
 3633|       |        // str32
 3634|     41|        case 0xdb:
  ------------------
  |  Branch (3634:9): [True: 41, False: 2.17M]
  ------------------
 3635|     41|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_STR32))
  ------------------
  |  | 2931|     41|#define MPACK_TAG_SIZE_STR32    5
  ------------------
  |  Branch (3635:17): [True: 0, False: 41]
  ------------------
 3636|      0|                return 0;
 3637|     41|            *tag = mpack_tag_make_str(mpack_load_u32(reader->data + 1));
 3638|     41|            return MPACK_TAG_SIZE_STR32;
  ------------------
  |  | 2931|     41|#define MPACK_TAG_SIZE_STR32    5
  ------------------
 3639|       |
 3640|       |        // array16
 3641|  1.00k|        case 0xdc:
  ------------------
  |  Branch (3641:9): [True: 1.00k, False: 2.17M]
  ------------------
 3642|  1.00k|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_ARRAY16))
  ------------------
  |  | 2923|  1.00k|#define MPACK_TAG_SIZE_ARRAY16  3
  ------------------
  |  Branch (3642:17): [True: 0, False: 1.00k]
  ------------------
 3643|      0|                return 0;
 3644|  1.00k|            *tag = mpack_tag_make_array(mpack_load_u16(reader->data + 1));
 3645|  1.00k|            return MPACK_TAG_SIZE_ARRAY16;
  ------------------
  |  | 2923|  1.00k|#define MPACK_TAG_SIZE_ARRAY16  3
  ------------------
 3646|       |
 3647|       |        // array32
 3648|    462|        case 0xdd:
  ------------------
  |  Branch (3648:9): [True: 462, False: 2.17M]
  ------------------
 3649|    462|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_ARRAY32))
  ------------------
  |  | 2924|    462|#define MPACK_TAG_SIZE_ARRAY32  5
  ------------------
  |  Branch (3649:17): [True: 0, False: 462]
  ------------------
 3650|      0|                return 0;
 3651|    462|            *tag = mpack_tag_make_array(mpack_load_u32(reader->data + 1));
 3652|    462|            return MPACK_TAG_SIZE_ARRAY32;
  ------------------
  |  | 2924|    462|#define MPACK_TAG_SIZE_ARRAY32  5
  ------------------
 3653|       |
 3654|       |        // map16
 3655|     36|        case 0xde:
  ------------------
  |  Branch (3655:9): [True: 36, False: 2.17M]
  ------------------
 3656|     36|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_MAP16))
  ------------------
  |  | 2926|     36|#define MPACK_TAG_SIZE_MAP16    3
  ------------------
  |  Branch (3656:17): [True: 0, False: 36]
  ------------------
 3657|      0|                return 0;
 3658|     36|            *tag = mpack_tag_make_map(mpack_load_u16(reader->data + 1));
 3659|     36|            return MPACK_TAG_SIZE_MAP16;
  ------------------
  |  | 2926|     36|#define MPACK_TAG_SIZE_MAP16    3
  ------------------
 3660|       |
 3661|       |        // map32
 3662|     39|        case 0xdf:
  ------------------
  |  Branch (3662:9): [True: 39, False: 2.17M]
  ------------------
 3663|     39|            if (!mpack_reader_ensure(reader, MPACK_TAG_SIZE_MAP32))
  ------------------
  |  | 2927|     39|#define MPACK_TAG_SIZE_MAP32    5
  ------------------
  |  Branch (3663:17): [True: 0, False: 39]
  ------------------
 3664|      0|                return 0;
 3665|     39|            *tag = mpack_tag_make_map(mpack_load_u32(reader->data + 1));
 3666|     39|            return MPACK_TAG_SIZE_MAP32;
  ------------------
  |  | 2927|     39|#define MPACK_TAG_SIZE_MAP32    5
  ------------------
 3667|       |
 3668|       |        // reserved
 3669|      3|        case 0xc1:
  ------------------
  |  Branch (3669:9): [True: 3, False: 2.17M]
  ------------------
 3670|      3|            mpack_reader_flag_error(reader, mpack_error_invalid);
 3671|      3|            return 0;
 3672|       |
 3673|       |        #if !MPACK_EXTENSIONS
 3674|       |        // ext
 3675|       |        case 0xc7: // fallthrough
 3676|       |        case 0xc8: // fallthrough
 3677|       |        case 0xc9: // fallthrough
 3678|       |        // fixext
 3679|       |        case 0xd4: // fallthrough
 3680|       |        case 0xd5: // fallthrough
 3681|       |        case 0xd6: // fallthrough
 3682|       |        case 0xd7: // fallthrough
 3683|       |        case 0xd8:
 3684|       |            mpack_reader_flag_error(reader, mpack_error_unsupported);
 3685|       |            return 0;
 3686|       |        #endif
 3687|       |
 3688|       |        #if MPACK_OPTIMIZE_FOR_SIZE
 3689|       |        // any other bytes should have been handled by the infix switch
 3690|       |        default:
 3691|       |            break;
 3692|       |        #endif
 3693|  2.17M|    }
 3694|       |
 3695|      0|    mpack_assert(0, "unreachable");
  ------------------
  |  | 1735|      0|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|      0|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|      0|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|      0|                (void)0))
  ------------------
 3696|      0|    return 0;
 3697|      0|}

mpack_reader_error:
 4708|  5.90M|MPACK_INLINE mpack_error_t mpack_reader_error(mpack_reader_t* reader) {
 4709|  5.90M|    return reader->error;
 4710|  5.90M|}
mpack_tag_make_nil:
 2140|     13|MPACK_INLINE mpack_tag_t mpack_tag_make_nil(void) {
 2141|     13|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|     13|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2142|     13|    ret.type = mpack_type_nil;
 2143|     13|    return ret;
 2144|     13|}
mpack_tag_make_bool:
 2147|  10.4k|MPACK_INLINE mpack_tag_t mpack_tag_make_bool(bool value) {
 2148|  10.4k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  10.4k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2149|  10.4k|    ret.type = mpack_type_bool;
 2150|  10.4k|    ret.v.b = value;
 2151|  10.4k|    return ret;
 2152|  10.4k|}
mpack_tag_make_int:
 2171|   137k|MPACK_INLINE mpack_tag_t mpack_tag_make_int(int64_t value) {
 2172|   137k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|   137k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2173|   137k|    ret.type = mpack_type_int;
 2174|   137k|    ret.v.i = value;
 2175|   137k|    return ret;
 2176|   137k|}
mpack_tag_make_uint:
 2179|  1.05M|MPACK_INLINE mpack_tag_t mpack_tag_make_uint(uint64_t value) {
 2180|  1.05M|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  1.05M|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2181|  1.05M|    ret.type = mpack_type_uint;
 2182|  1.05M|    ret.v.u = value;
 2183|  1.05M|    return ret;
 2184|  1.05M|}
mpack_tag_make_float:
 2193|     14|{
 2194|     14|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|     14|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2195|     14|    ret.type = mpack_type_float;
 2196|     14|    ret.v.f = value;
 2197|     14|    return ret;
 2198|     14|}
mpack_tag_make_double:
 2207|  2.41k|{
 2208|  2.41k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  2.41k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2209|  2.41k|    ret.type = mpack_type_double;
 2210|  2.41k|    ret.v.d = value;
 2211|  2.41k|    return ret;
 2212|  2.41k|}
mpack_tag_make_array:
 2215|  17.2k|MPACK_INLINE mpack_tag_t mpack_tag_make_array(uint32_t count) {
 2216|  17.2k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  17.2k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2217|  17.2k|    ret.type = mpack_type_array;
 2218|  17.2k|    ret.v.n = count;
 2219|  17.2k|    return ret;
 2220|  17.2k|}
mpack_tag_make_map:
 2223|   765k|MPACK_INLINE mpack_tag_t mpack_tag_make_map(uint32_t count) {
 2224|   765k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|   765k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2225|   765k|    ret.type = mpack_type_map;
 2226|   765k|    ret.v.n = count;
 2227|   765k|    return ret;
 2228|   765k|}
mpack_tag_make_str:
 2231|   177k|MPACK_INLINE mpack_tag_t mpack_tag_make_str(uint32_t length) {
 2232|   177k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|   177k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2233|   177k|    ret.type = mpack_type_str;
 2234|   177k|    ret.v.l = length;
 2235|   177k|    return ret;
 2236|   177k|}
mpack_tag_make_bin:
 2239|  9.66k|MPACK_INLINE mpack_tag_t mpack_tag_make_bin(uint32_t length) {
 2240|  9.66k|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|  9.66k|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2241|  9.66k|    ret.type = mpack_type_bin;
 2242|  9.66k|    ret.v.l = length;
 2243|  9.66k|    return ret;
 2244|  9.66k|}
mpack_tag_make_ext:
 2252|     81|MPACK_INLINE mpack_tag_t mpack_tag_make_ext(int8_t exttype, uint32_t length) {
 2253|     81|    mpack_tag_t ret = MPACK_TAG_ZERO;
  ------------------
  |  | 2134|     81|#define MPACK_TAG_ZERO {(mpack_type_t)0, 0, {0}}
  ------------------
 2254|     81|    ret.type = mpack_type_ext;
 2255|     81|    ret.exttype = exttype;
 2256|     81|    ret.v.l = length;
 2257|     81|    return ret;
 2258|     81|}
mpack_tag_bool_value:
 2284|  5.23k|MPACK_INLINE bool mpack_tag_bool_value(mpack_tag_t* tag) {
 2285|  5.23k|    mpack_assert(tag->type == mpack_type_bool, "tag is not a bool!");
  ------------------
  |  | 1735|  5.23k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  15.7k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 5.23k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  5.23k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  5.23k|                (void)0))
  ------------------
 2286|  5.23k|    return tag->v.b;
 2287|  5.23k|}
mpack_tag_map_count:
 2390|   596k|MPACK_INLINE uint32_t mpack_tag_map_count(mpack_tag_t* tag) {
 2391|   596k|    mpack_assert(tag->type == mpack_type_map, "tag is not a map!");
  ------------------
  |  | 1735|   596k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  1.78M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 596k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   596k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   596k|                (void)0))
  ------------------
 2392|   596k|    return tag->v.n;
 2393|   596k|}
mpack_tag_str_length:
 2403|   173k|MPACK_INLINE uint32_t mpack_tag_str_length(mpack_tag_t* tag) {
 2404|   173k|    mpack_assert(tag->type == mpack_type_str, "tag is not a str!");
  ------------------
  |  | 1735|   173k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|   520k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 173k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   173k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   173k|                (void)0))
  ------------------
 2405|   173k|    return tag->v.l;
 2406|   173k|}
mpack_tag_bin_length:
 2416|  4.83k|MPACK_INLINE uint32_t mpack_tag_bin_length(mpack_tag_t* tag) {
 2417|  4.83k|    mpack_assert(tag->type == mpack_type_bin, "tag is not a bin!");
  ------------------
  |  | 1735|  4.83k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  14.4k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 4.83k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  4.83k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  4.83k|                (void)0))
  ------------------
 2418|  4.83k|    return tag->v.l;
 2419|  4.83k|}
mpack_tag_nil:
 2603|     11|MPACK_INLINE mpack_tag_t mpack_tag_nil(void) {
 2604|     11|    return mpack_tag_make_nil();
 2605|     11|}
mpack_load_u8:
 2688|  2.18M|MPACK_INLINE uint8_t mpack_load_u8(const char* p) {
 2689|  2.18M|    return (uint8_t)p[0];
 2690|  2.18M|}
mpack_load_u16:
 2692|  2.95k|MPACK_INLINE uint16_t mpack_load_u16(const char* p) {
 2693|  2.95k|    #ifdef MPACK_NHSWAP16
 2694|  2.95k|    uint16_t val;
 2695|  2.95k|    mpack_memcpy(&val, p, sizeof(val));
  ------------------
  |  | 1777|  2.95k|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|  2.95k|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 2696|  2.95k|    return MPACK_NHSWAP16(val);
  ------------------
  |  | 1584|  2.95k|                        #define MPACK_NHSWAP16(x) __builtin_bswap16(x)
  ------------------
 2697|       |    #else
 2698|       |    return (uint16_t)((((uint16_t)(uint8_t)p[0]) << 8) |
 2699|       |           ((uint16_t)(uint8_t)p[1]));
 2700|       |    #endif
 2701|  2.95k|}
mpack_load_u32:
 2703|  3.51k|MPACK_INLINE uint32_t mpack_load_u32(const char* p) {
 2704|  3.51k|    #ifdef MPACK_NHSWAP32
 2705|  3.51k|    uint32_t val;
 2706|  3.51k|    mpack_memcpy(&val, p, sizeof(val));
  ------------------
  |  | 1777|  3.51k|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|  3.51k|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 2707|  3.51k|    return MPACK_NHSWAP32(val);
  ------------------
  |  | 1587|  3.51k|                        #define MPACK_NHSWAP32(x) __builtin_bswap32(x)
  ------------------
 2708|       |    #else
 2709|       |    return (((uint32_t)(uint8_t)p[0]) << 24) |
 2710|       |           (((uint32_t)(uint8_t)p[1]) << 16) |
 2711|       |           (((uint32_t)(uint8_t)p[2]) <<  8) |
 2712|       |            ((uint32_t)(uint8_t)p[3]);
 2713|       |    #endif
 2714|  3.51k|}
mpack_load_u64:
 2716|  2.79k|MPACK_INLINE uint64_t mpack_load_u64(const char* p) {
 2717|  2.79k|    #ifdef MPACK_NHSWAP64
 2718|  2.79k|    uint64_t val;
 2719|  2.79k|    mpack_memcpy(&val, p, sizeof(val));
  ------------------
  |  | 1777|  2.79k|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|  2.79k|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 2720|  2.79k|    return MPACK_NHSWAP64(val);
  ------------------
  |  | 1590|  2.79k|                        #define MPACK_NHSWAP64(x) __builtin_bswap64(x)
  ------------------
 2721|       |    #else
 2722|       |    return (((uint64_t)(uint8_t)p[0]) << 56) |
 2723|       |           (((uint64_t)(uint8_t)p[1]) << 48) |
 2724|       |           (((uint64_t)(uint8_t)p[2]) << 40) |
 2725|       |           (((uint64_t)(uint8_t)p[3]) << 32) |
 2726|       |           (((uint64_t)(uint8_t)p[4]) << 24) |
 2727|       |           (((uint64_t)(uint8_t)p[5]) << 16) |
 2728|       |           (((uint64_t)(uint8_t)p[6]) <<  8) |
 2729|       |            ((uint64_t)(uint8_t)p[7]);
 2730|       |    #endif
 2731|  2.79k|}
mpack_load_i8:
 2779|    246|MPACK_INLINE int8_t  mpack_load_i8 (const char* p) {return (int8_t) mpack_load_u8 (p);}
mpack_load_i16:
 2780|    331|MPACK_INLINE int16_t mpack_load_i16(const char* p) {return (int16_t)mpack_load_u16(p);}
mpack_load_i32:
 2781|  2.63k|MPACK_INLINE int32_t mpack_load_i32(const char* p) {return (int32_t)mpack_load_u32(p);}
mpack_load_i64:
 2782|    300|MPACK_INLINE int64_t mpack_load_i64(const char* p) {return (int64_t)mpack_load_u64(p);}
mpack_load_float:
 2789|     14|MPACK_INLINE float mpack_load_float(const char* p) {
 2790|     14|    MPACK_CHECK_FLOAT_ORDER();
 2791|     14|    MPACK_STATIC_ASSERT(sizeof(float) == sizeof(uint32_t), "float is wrong size??");
  ------------------
  |  | 1474|     14|                    #define MPACK_STATIC_ASSERT(expr, str) do { \
  |  | 1475|     14|                        _Pragma ("GCC diagnostic push") \
  |  | 1476|     14|                        _Pragma (MPACK_IGNORE_PEDANTIC) \
  |  | 1477|     14|                        _Pragma ("GCC diagnostic ignored \"-Wc++-compat\"") \
  |  | 1478|     14|                        _Static_assert(expr, str); \
  |  | 1479|     14|                        _Pragma ("GCC diagnostic pop") \
  |  | 1480|     14|                    } while (0)
  |  |  ------------------
  |  |  |  Branch (1480:30): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2792|     14|    union {
 2793|     14|        float f;
 2794|     14|        uint32_t u;
 2795|     14|    } v;
 2796|     14|    v.u = mpack_load_u32(p);
 2797|     14|    return v.f;
 2798|     14|}
mpack_load_double:
 2802|  2.41k|MPACK_INLINE double mpack_load_double(const char* p) {
 2803|  2.41k|    MPACK_CHECK_FLOAT_ORDER();
 2804|  2.41k|    MPACK_STATIC_ASSERT(sizeof(double) == sizeof(uint64_t), "double is wrong size??");
  ------------------
  |  | 1474|  2.41k|                    #define MPACK_STATIC_ASSERT(expr, str) do { \
  |  | 1475|  2.41k|                        _Pragma ("GCC diagnostic push") \
  |  | 1476|  2.41k|                        _Pragma (MPACK_IGNORE_PEDANTIC) \
  |  | 1477|  2.41k|                        _Pragma ("GCC diagnostic ignored \"-Wc++-compat\"") \
  |  | 1478|  2.41k|                        _Static_assert(expr, str); \
  |  | 1479|  2.41k|                        _Pragma ("GCC diagnostic pop") \
  |  | 1480|  2.41k|                    } while (0)
  |  |  ------------------
  |  |  |  Branch (1480:30): [Folded - Ignored]
  |  |  ------------------
  ------------------
 2805|  2.41k|    union {
 2806|  2.41k|        double d;
 2807|  2.41k|        uint64_t u;
 2808|  2.41k|    } v;
 2809|  2.41k|    v.u = mpack_load_u64(p);
 2810|  2.41k|    return v.d;
 2811|  2.41k|}
mpack_done_type:
 5067|   777k|MPACK_INLINE void mpack_done_type(mpack_reader_t* reader, mpack_type_t type) {
 5068|   777k|    MPACK_UNUSED(reader);
  ------------------
  |  | 1181|   777k|#define MPACK_UNUSED(var) ((void)(var))
  ------------------
 5069|   777k|    MPACK_UNUSED(type);
  ------------------
  |  | 1181|   777k|#define MPACK_UNUSED(var) ((void)(var))
  ------------------
 5070|   777k|}
mpack_done_array:
 5078|  3.15k|MPACK_INLINE void mpack_done_array(mpack_reader_t* reader) {
 5079|  3.15k|    mpack_done_type(reader, mpack_type_array);
 5080|  3.15k|}
mpack_done_map:
 5089|   595k|MPACK_INLINE void mpack_done_map(mpack_reader_t* reader) {
 5090|   595k|    mpack_done_type(reader, mpack_type_map);
 5091|   595k|}
mpack_done_str:
 5100|   173k|MPACK_INLINE void mpack_done_str(mpack_reader_t* reader) {
 5101|   173k|    mpack_done_type(reader, mpack_type_str);
 5102|   173k|}
mpack_done_bin:
 5111|  4.83k|MPACK_INLINE void mpack_done_bin(mpack_reader_t* reader) {
 5112|  4.83k|    mpack_done_type(reader, mpack_type_bin);
 5113|  4.83k|}
mpack_reader_ensure:
 5222|  2.19M|MPACK_INLINE bool mpack_reader_ensure(mpack_reader_t* reader, size_t count) {
 5223|  2.19M|    mpack_assert(count != 0, "cannot ensure zero bytes!");
  ------------------
  |  | 1735|  2.19M|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  6.58M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 2.19M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  2.19M|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  2.19M|                (void)0))
  ------------------
 5224|  2.19M|    mpack_assert(reader->error == mpack_ok, "reader cannot be in an error state!");
  ------------------
  |  | 1735|  2.19M|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|  6.58M|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 0, False: 2.19M]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|  2.19M|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|  2.19M|                (void)0))
  ------------------
 5225|       |
 5226|  2.19M|    if (count <= (size_t)(reader->end - reader->data))
  ------------------
  |  Branch (5226:9): [True: 2.19M, False: 8]
  ------------------
 5227|  2.19M|        return true;
 5228|      8|    return mpack_reader_ensure_straddle(reader, count);
 5229|  2.19M|}
mpack_read_native:
 5235|   178k|MPACK_INLINE void mpack_read_native(mpack_reader_t* reader, char* p, size_t count) {
 5236|   178k|    mpack_assert(count == 0 || p != NULL, "data pointer for %i bytes is NULL", (int)count);
  ------------------
  |  | 1735|   178k|            (MPACK_EXPAND((!(MPACK_EXTRACT_ARG0(__VA_ARGS__))) ? \
  |  |  ------------------
  |  |  |  | 1193|   718k|#define MPACK_EXPAND(x) x
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (1193:25): [True: 174k, False: 4.38k]
  |  |  |  |  |  Branch (1193:25): [True: 4.38k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  | 1736|   178k|                (MPACK_UNREACHABLE, (void)0) : \
  |  | 1737|   178k|                (void)0))
  ------------------
 5237|       |
 5238|   178k|    if (count > (size_t)(reader->end - reader->data)) {
  ------------------
  |  Branch (5238:9): [True: 9, False: 178k]
  ------------------
 5239|      9|        mpack_read_native_straddle(reader, p, count);
 5240|   178k|    } else {
 5241|   178k|        mpack_memcpy(p, reader->data, count);
  ------------------
  |  | 1777|   178k|    #define mpack_memcpy MPACK_MEMCPY
  |  |  ------------------
  |  |  |  |  595|   178k|        #define MPACK_MEMCPY memcpy
  |  |  ------------------
  ------------------
 5242|   178k|        reader->data += count;
 5243|   178k|    }
 5244|   178k|}
mpack_reader_track_element:
 5253|  1.38M|MPACK_INLINE mpack_error_t mpack_reader_track_element(mpack_reader_t* reader) {
 5254|  1.38M|    return MPACK_READER_TRACK(reader, mpack_track_element(&reader->track, true));
  ------------------
  |  | 5250|  1.38M|#define MPACK_READER_TRACK(reader, error_expr) (MPACK_UNUSED(reader), mpack_ok)
  |  |  ------------------
  |  |  |  | 1181|  1.38M|#define MPACK_UNUSED(var) ((void)(var))
  |  |  ------------------
  ------------------
 5255|  1.38M|}
mpack_reader_track_peek_element:
 5257|   789k|MPACK_INLINE mpack_error_t mpack_reader_track_peek_element(mpack_reader_t* reader) {
 5258|   789k|    return MPACK_READER_TRACK(reader, mpack_track_peek_element(&reader->track, true));
  ------------------
  |  | 5250|   789k|#define MPACK_READER_TRACK(reader, error_expr) (MPACK_UNUSED(reader), mpack_ok)
  |  |  ------------------
  |  |  |  | 1181|   789k|#define MPACK_UNUSED(var) ((void)(var))
  |  |  ------------------
  ------------------
 5259|   789k|}
mpack_reader_track_bytes:
 5261|  4.83k|MPACK_INLINE mpack_error_t mpack_reader_track_bytes(mpack_reader_t* reader, size_t count) {
 5262|  4.83k|    MPACK_UNUSED(count);
  ------------------
  |  | 1181|  4.83k|#define MPACK_UNUSED(var) ((void)(var))
  ------------------
 5263|  4.83k|    return MPACK_READER_TRACK(reader, mpack_track_bytes(&reader->track, true, count));
  ------------------
  |  | 5250|  4.83k|#define MPACK_READER_TRACK(reader, error_expr) (MPACK_UNUSED(reader), mpack_ok)
  |  |  ------------------
  |  |  |  | 1181|  4.83k|#define MPACK_UNUSED(var) ((void)(var))
  |  |  ------------------
  ------------------
 5264|  4.83k|}
mpack_reader_track_str_bytes_all:
 5266|   173k|MPACK_INLINE mpack_error_t mpack_reader_track_str_bytes_all(mpack_reader_t* reader, size_t count) {
 5267|   173k|    MPACK_UNUSED(count);
  ------------------
  |  | 1181|   173k|#define MPACK_UNUSED(var) ((void)(var))
  ------------------
 5268|   173k|    return MPACK_READER_TRACK(reader, mpack_track_str_bytes_all(&reader->track, true, count));
  ------------------
  |  | 5250|   173k|#define MPACK_READER_TRACK(reader, error_expr) (MPACK_UNUSED(reader), mpack_ok)
  |  |  ------------------
  |  |  |  | 1181|   173k|#define MPACK_UNUSED(var) ((void)(var))
  |  |  ------------------
  ------------------
 5269|   173k|}

flb_mp.c:msgpack_unpacked_init:
  253|     43|{
  254|     43|    memset(result, 0, sizeof(msgpack_unpacked));
  255|     43|}
flb_mp.c:msgpack_unpacked_destroy:
  258|     43|{
  259|     43|    if(result->zone != NULL) {
  ------------------
  |  Branch (259:8): [True: 34, False: 9]
  ------------------
  260|     34|        msgpack_zone_free(result->zone);
  261|     34|        result->zone = NULL;
  262|     34|        memset(&result->data, 0, sizeof(msgpack_object));
  263|     34|    }
  264|     43|}
unpack.c:msgpack_unpacked_destroy:
  258|    514|{
  259|    514|    if(result->zone != NULL) {
  ------------------
  |  Branch (259:8): [True: 471, False: 43]
  ------------------
  260|    471|        msgpack_zone_free(result->zone);
  261|    471|        result->zone = NULL;
  262|    471|        memset(&result->data, 0, sizeof(msgpack_object));
  263|    471|    }
  264|    514|}

unpack.c:template_init:
   68|    514|{
   69|    514|    ctx->cs = MSGPACK_CS_HEADER;
   70|    514|    ctx->trail = 0;
   71|    514|    ctx->top = 0;
   72|       |    /*
   73|       |    ctx->stack = ctx->embed_stack;
   74|       |    ctx->stack_size = MSGPACK_EMBED_STACK_SIZE;
   75|       |    */
   76|    514|    ctx->stack[0].obj = msgpack_unpack_callback(_root)(&ctx->user);
  ------------------
  |  |   33|    514|    template_callback ## name
  ------------------
   77|    514|}
unpack.c:template_execute:
   95|    514|{
   96|    514|    assert(len >= *off);
   97|    514|    {
   98|    514|        const unsigned char* p = (unsigned char*)data + *off;
   99|    514|        const unsigned char* const pe = (unsigned char*)data + len;
  100|    514|        const void* n = NULL;
  101|       |
  102|    514|        unsigned int trail = ctx->trail;
  103|    514|        unsigned int cs = ctx->cs;
  104|    514|        unsigned int top = ctx->top;
  105|    514|        msgpack_unpack_struct(_stack)* stack = ctx->stack;
  ------------------
  |  |   27|    514|    struct template ## name
  ------------------
  106|       |        /*
  107|       |        unsigned int stack_size = ctx->stack_size;
  108|       |        */
  109|    514|        msgpack_unpack_user* user = &ctx->user;
  ------------------
  |  |   37|    514|#define msgpack_unpack_user unpack_user
  ------------------
  110|       |
  111|    514|        msgpack_unpack_object obj;
  ------------------
  |  |   35|    514|#define msgpack_unpack_object msgpack_object
  ------------------
  112|    514|        msgpack_unpack_struct(_stack)* c = NULL;
  ------------------
  |  |   27|    514|    struct template ## name
  ------------------
  113|       |
  114|    514|        int ret;
  115|       |
  116|    514|#define push_simple_value(func) \
  117|    514|        ret = msgpack_unpack_callback(func)(user, &obj); \
  118|    514|        if(ret < 0) { goto _failed; } \
  119|    514|        goto _push
  120|    514|#define push_fixed_value(func, arg) \
  121|    514|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  122|    514|        if(ret < 0) { goto _failed; } \
  123|    514|        goto _push
  124|    514|#define push_variable_value(func, base, pos, len) \
  125|    514|        ret = msgpack_unpack_callback(func)(user, \
  126|    514|            (const char*)base, (const char*)pos, len, &obj); \
  127|    514|        if(ret < 0) { goto _failed; } \
  128|    514|        goto _push
  129|       |
  130|    514|#define again_fixed_trail(_cs, trail_len) \
  131|    514|        trail = trail_len; \
  132|    514|        cs = _cs; \
  133|    514|        goto _fixed_trail_again
  134|    514|#define again_fixed_trail_if_zero(_cs, trail_len, ifzero) \
  135|    514|        trail = trail_len; \
  136|    514|        if(trail == 0) { goto ifzero; } \
  137|    514|        cs = _cs; \
  138|    514|        goto _fixed_trail_again
  139|       |
  140|    514|#define start_container(func, count_, ct_) \
  141|    514|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  142|    514|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  143|    514|            goto _failed; \
  144|    514|        } /* FIXME */ \
  145|    514|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  146|    514|        if(ret < 0) { goto _failed; } \
  147|    514|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  148|    514|        stack[top].ct = ct_; \
  149|    514|        stack[top].count = count_; \
  150|    514|        ++top; \
  151|    514|        goto _header_again
  152|       |
  153|    514|#define NEXT_CS(p) \
  154|    514|        ((unsigned int)*p & 0x1f)
  155|       |
  156|    514|#ifdef USE_CASE_RANGE
  157|    514|#define SWITCH_RANGE_BEGIN     switch(*p) {
  158|    514|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  159|    514|#define SWITCH_RANGE_DEFAULT   default:
  160|    514|#define SWITCH_RANGE_END       }
  161|       |#else
  162|       |#define SWITCH_RANGE_BEGIN     { if(0) {
  163|       |#define SWITCH_RANGE(FROM, TO) } else if(FROM <= *p && *p <= TO) {
  164|       |#define SWITCH_RANGE_DEFAULT   } else {
  165|       |#define SWITCH_RANGE_END       } }
  166|       |#endif
  167|       |
  168|    514|        if(p == pe) { goto _out; }
  ------------------
  |  Branch (168:12): [True: 0, False: 514]
  ------------------
  169|   710k|        do {
  170|   710k|            switch(cs) {
  171|   710k|            case MSGPACK_CS_HEADER:
  ------------------
  |  Branch (171:13): [True: 710k, False: 0]
  ------------------
  172|   710k|                SWITCH_RANGE_BEGIN
  ------------------
  |  |  157|  1.42M|#define SWITCH_RANGE_BEGIN     switch(*p) {
  ------------------
  173|   427k|                SWITCH_RANGE(0x00, 0x7f)  // Positive Fixnum
  ------------------
  |  |  158|   427k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 427k, False: 283k]
  |  |  ------------------
  ------------------
  174|   427k|                    push_fixed_value(_uint8, *(uint8_t*)p);
  ------------------
  |  |  121|   427k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|   427k|    template_callback ## name
  |  |  ------------------
  |  |  122|   427k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 427k]
  |  |  ------------------
  |  |  123|   427k|        goto _push
  ------------------
  175|   427k|                SWITCH_RANGE(0xe0, 0xff)  // Negative Fixnum
  ------------------
  |  |  158|   215k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 215k, False: 494k]
  |  |  ------------------
  ------------------
  176|   215k|                    push_fixed_value(_int8, *(int8_t*)p);
  ------------------
  |  |  121|   215k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|   215k|    template_callback ## name
  |  |  ------------------
  |  |  122|   215k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 215k]
  |  |  ------------------
  |  |  123|   215k|        goto _push
  ------------------
  177|   215k|                SWITCH_RANGE(0xc0, 0xdf)  // Variable
  ------------------
  |  |  158|  12.7k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 12.7k, False: 697k]
  |  |  ------------------
  ------------------
  178|  12.7k|                    switch(*p) {
  179|      8|                    case 0xc0:  // nil
  ------------------
  |  Branch (179:21): [True: 8, False: 12.7k]
  ------------------
  180|      8|                        push_simple_value(_nil);
  ------------------
  |  |  117|      8|        ret = msgpack_unpack_callback(func)(user, &obj); \
  |  |  ------------------
  |  |  |  |   33|      8|    template_callback ## name
  |  |  ------------------
  |  |  118|      8|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (118:12): [True: 0, False: 8]
  |  |  ------------------
  |  |  119|      8|        goto _push
  ------------------
  181|       |                    //case 0xc1:  // string
  182|       |                    //  again_terminal_trail(NEXT_CS(p), p+1);
  183|    382|                    case 0xc2:  // false
  ------------------
  |  Branch (183:21): [True: 382, False: 12.3k]
  ------------------
  184|    382|                        push_simple_value(_false);
  ------------------
  |  |  117|    382|        ret = msgpack_unpack_callback(func)(user, &obj); \
  |  |  ------------------
  |  |  |  |   33|    382|    template_callback ## name
  |  |  ------------------
  |  |  118|    382|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (118:12): [True: 0, False: 382]
  |  |  ------------------
  |  |  119|    382|        goto _push
  ------------------
  185|    382|                    case 0xc3:  // true
  ------------------
  |  Branch (185:21): [True: 14, False: 12.7k]
  ------------------
  186|     14|                        push_simple_value(_true);
  ------------------
  |  |  117|     14|        ret = msgpack_unpack_callback(func)(user, &obj); \
  |  |  ------------------
  |  |  |  |   33|     14|    template_callback ## name
  |  |  ------------------
  |  |  118|     14|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (118:12): [True: 0, False: 14]
  |  |  ------------------
  |  |  119|     14|        goto _push
  ------------------
  187|     21|                    case 0xc4: // bin 8
  ------------------
  |  Branch (187:21): [True: 21, False: 12.7k]
  ------------------
  188|    117|                    case 0xc5: // bin 16
  ------------------
  |  Branch (188:21): [True: 96, False: 12.6k]
  ------------------
  189|    120|                    case 0xc6: // bin 32
  ------------------
  |  Branch (189:21): [True: 3, False: 12.7k]
  ------------------
  190|    120|                        again_fixed_trail(NEXT_CS(p), 1 << (((unsigned int)*p) & 0x03));
  ------------------
  |  |  131|    120|        trail = trail_len; \
  |  |  132|    120|        cs = _cs; \
  |  |  133|    120|        goto _fixed_trail_again
  ------------------
  191|      7|                    case 0xc7: // ext 8
  ------------------
  |  Branch (191:21): [True: 7, False: 12.7k]
  ------------------
  192|     86|                    case 0xc8: // ext 16
  ------------------
  |  Branch (192:21): [True: 79, False: 12.7k]
  ------------------
  193|     89|                    case 0xc9: // ext 32
  ------------------
  |  Branch (193:21): [True: 3, False: 12.7k]
  ------------------
  194|     89|                        again_fixed_trail(NEXT_CS(p), 1 << ((((unsigned int)*p) + 1) & 0x03));
  ------------------
  |  |  131|     89|        trail = trail_len; \
  |  |  132|     89|        cs = _cs; \
  |  |  133|     89|        goto _fixed_trail_again
  ------------------
  195|  1.61k|                    case 0xca:  // float
  ------------------
  |  Branch (195:21): [True: 1.61k, False: 11.1k]
  ------------------
  196|  1.79k|                    case 0xcb:  // double
  ------------------
  |  Branch (196:21): [True: 174, False: 12.6k]
  ------------------
  197|  3.23k|                    case 0xcc:  // unsigned int  8
  ------------------
  |  Branch (197:21): [True: 1.44k, False: 11.3k]
  ------------------
  198|  3.35k|                    case 0xcd:  // unsigned int 16
  ------------------
  |  Branch (198:21): [True: 120, False: 12.6k]
  ------------------
  199|  3.42k|                    case 0xce:  // unsigned int 32
  ------------------
  |  Branch (199:21): [True: 67, False: 12.7k]
  ------------------
  200|  4.46k|                    case 0xcf:  // unsigned int 64
  ------------------
  |  Branch (200:21): [True: 1.04k, False: 11.7k]
  ------------------
  201|  4.60k|                    case 0xd0:  // signed int  8
  ------------------
  |  Branch (201:21): [True: 146, False: 12.6k]
  ------------------
  202|  4.67k|                    case 0xd1:  // signed int 16
  ------------------
  |  Branch (202:21): [True: 68, False: 12.7k]
  ------------------
  203|  4.76k|                    case 0xd2:  // signed int 32
  ------------------
  |  Branch (203:21): [True: 88, False: 12.6k]
  ------------------
  204|  8.90k|                    case 0xd3:  // signed int 64
  ------------------
  |  Branch (204:21): [True: 4.14k, False: 8.63k]
  ------------------
  205|  8.90k|                        again_fixed_trail(NEXT_CS(p), 1 << (((unsigned int)*p) & 0x03));
  ------------------
  |  |  131|  8.90k|        trail = trail_len; \
  |  |  132|  8.90k|        cs = _cs; \
  |  |  133|  8.90k|        goto _fixed_trail_again
  ------------------
  206|     65|                    case 0xd4:  // fixext 1
  ------------------
  |  Branch (206:21): [True: 65, False: 12.7k]
  ------------------
  207|    365|                    case 0xd5:  // fixext 2
  ------------------
  |  Branch (207:21): [True: 300, False: 12.4k]
  ------------------
  208|    388|                    case 0xd6:  // fixext 4
  ------------------
  |  Branch (208:21): [True: 23, False: 12.7k]
  ------------------
  209|    397|                    case 0xd7:  // fixext 8
  ------------------
  |  Branch (209:21): [True: 9, False: 12.7k]
  ------------------
  210|    397|                        again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE,
  ------------------
  |  |  135|    397|        trail = trail_len; \
  |  |  136|    397|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 397]
  |  |  ------------------
  |  |  137|    397|        cs = _cs; \
  |  |  138|    397|        goto _fixed_trail_again
  ------------------
  211|    397|                            (1 << (((unsigned int)*p) & 0x03)) + 1, _ext_zero);
  212|     65|                    case 0xd8:  // fixext 16
  ------------------
  |  Branch (212:21): [True: 65, False: 12.7k]
  ------------------
  213|     65|                        again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 16+1, _ext_zero);
  ------------------
  |  |  135|     65|        trail = trail_len; \
  |  |  136|     65|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 65]
  |  |  ------------------
  |  |  137|     65|        cs = _cs; \
  |  |  138|     65|        goto _fixed_trail_again
  ------------------
  214|       |
  215|    827|                    case 0xd9:  // str 8
  ------------------
  |  Branch (215:21): [True: 827, False: 11.9k]
  ------------------
  216|    832|                    case 0xda:  // str 16
  ------------------
  |  Branch (216:21): [True: 5, False: 12.7k]
  ------------------
  217|    833|                    case 0xdb:  // str 32
  ------------------
  |  Branch (217:21): [True: 1, False: 12.7k]
  ------------------
  218|    833|                        again_fixed_trail(NEXT_CS(p), 1 << ((((unsigned int)*p) & 0x03) - 1));
  ------------------
  |  |  131|    833|        trail = trail_len; \
  |  |  132|    833|        cs = _cs; \
  |  |  133|    833|        goto _fixed_trail_again
  ------------------
  219|    207|                    case 0xdc:  // array 16
  ------------------
  |  Branch (219:21): [True: 207, False: 12.5k]
  ------------------
  220|    247|                    case 0xdd:  // array 32
  ------------------
  |  Branch (220:21): [True: 40, False: 12.7k]
  ------------------
  221|    267|                    case 0xde:  // map 16
  ------------------
  |  Branch (221:21): [True: 20, False: 12.7k]
  ------------------
  222|  1.96k|                    case 0xdf:  // map 32
  ------------------
  |  Branch (222:21): [True: 1.69k, False: 11.0k]
  ------------------
  223|  1.96k|                        again_fixed_trail(NEXT_CS(p), 2u << (((unsigned int)*p) & 0x01));
  ------------------
  |  |  131|  1.96k|        trail = trail_len; \
  |  |  132|  1.96k|        cs = _cs; \
  |  |  133|  1.96k|        goto _fixed_trail_again
  ------------------
  224|      0|                    default:
  ------------------
  |  Branch (224:21): [True: 0, False: 12.7k]
  ------------------
  225|      0|                        ret = MSGPACK_UNPACK_PARSE_ERROR;
  226|      0|                        goto _failed;
  227|  12.7k|                    }
  228|  8.02k|                SWITCH_RANGE(0xa0, 0xbf)  // FixStr
  ------------------
  |  |  158|  8.02k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 8.02k, False: 702k]
  |  |  ------------------
  ------------------
  229|  8.02k|                    again_fixed_trail_if_zero(MSGPACK_ACS_STR_VALUE, ((unsigned int)*p & 0x1f), _str_zero);
  ------------------
  |  |  135|  8.02k|        trail = trail_len; \
  |  |  136|  8.02k|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 87, False: 7.93k]
  |  |  ------------------
  |  |  137|  8.02k|        cs = _cs; \
  |  |  138|  7.93k|        goto _fixed_trail_again
  ------------------
  230|  37.7k|                SWITCH_RANGE(0x90, 0x9f)  // FixArray
  ------------------
  |  |  158|  37.7k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 37.7k, False: 672k]
  |  |  ------------------
  ------------------
  231|  75.5k|                    start_container(_array, ((unsigned int)*p) & 0x0f, MSGPACK_CT_ARRAY_ITEM);
  ------------------
  |  |  141|  37.7k|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|  37.7k|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 3, False: 37.7k]
  |  |  ------------------
  |  |  142|      3|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      3|            goto _failed; \
  |  |  144|      3|        } /* FIXME */ \
  |  |  145|  37.7k|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|  37.7k|    template_callback ## name
  |  |  ------------------
  |  |  146|  37.7k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 0, False: 37.7k]
  |  |  ------------------
  |  |  147|  37.7k|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 343, False: 37.4k]
  |  |  ------------------
  |  |  148|  37.7k|        stack[top].ct = ct_; \
  |  |  149|  37.4k|        stack[top].count = count_; \
  |  |  150|  37.4k|        ++top; \
  |  |  151|  37.4k|        goto _header_again
  ------------------
  232|  8.67k|                SWITCH_RANGE(0x80, 0x8f)  // FixMap
  ------------------
  |  |  158|  8.67k|#define SWITCH_RANGE(FROM, TO) case FROM ... TO:
  |  |  ------------------
  |  |  |  Branch (158:32): [True: 8.67k, False: 701k]
  |  |  ------------------
  ------------------
  233|  17.3k|                    start_container(_map, ((unsigned int)*p) & 0x0f, MSGPACK_CT_MAP_KEY);
  ------------------
  |  |  141|  8.67k|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|  8.67k|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 0, False: 8.67k]
  |  |  ------------------
  |  |  142|      0|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      0|            goto _failed; \
  |  |  144|      0|        } /* FIXME */ \
  |  |  145|  8.67k|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|  8.67k|    template_callback ## name
  |  |  ------------------
  |  |  146|  8.67k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 0, False: 8.67k]
  |  |  ------------------
  |  |  147|  8.67k|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 661, False: 8.01k]
  |  |  ------------------
  |  |  148|  8.67k|        stack[top].ct = ct_; \
  |  |  149|  8.01k|        stack[top].count = count_; \
  |  |  150|  8.01k|        ++top; \
  |  |  151|  8.01k|        goto _header_again
  ------------------
  234|       |
  235|      0|                SWITCH_RANGE_DEFAULT
  ------------------
  |  |  159|      0|#define SWITCH_RANGE_DEFAULT   default:
  |  |  ------------------
  |  |  |  Branch (159:32): [True: 0, False: 710k]
  |  |  ------------------
  ------------------
  236|      0|                    ret = MSGPACK_UNPACK_PARSE_ERROR;
  237|      0|                    goto _failed;
  238|   710k|                SWITCH_RANGE_END
  ------------------
  |  |  160|   710k|#define SWITCH_RANGE_END       }
  ------------------
  239|       |                // end MSGPACK_CS_HEADER
  240|       |
  241|       |
  242|  20.4k|            _fixed_trail_again:
  243|  20.4k|                ++p;
  244|       |                // fallthrough
  245|       |
  246|  20.4k|            default:
  ------------------
  |  Branch (246:13): [True: 0, False: 710k]
  ------------------
  247|  20.4k|                if((size_t)(pe - p) < trail) { goto _out; }
  ------------------
  |  Branch (247:20): [True: 12, False: 20.4k]
  ------------------
  248|  20.4k|                n = p;  p += trail - 1;
  249|  20.4k|                switch(cs) {
  250|       |                //case MSGPACK_CS_
  251|       |                //case MSGPACK_CS_
  252|  1.61k|                case MSGPACK_CS_FLOAT: {
  ------------------
  |  Branch (252:17): [True: 1.61k, False: 18.8k]
  ------------------
  253|  1.61k|                        union { uint32_t i; float f; } mem;
  254|  1.61k|                        _msgpack_load32(uint32_t, n, &mem.i);
  ------------------
  |  |  172|  1.61k|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|  1.61k|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|  1.61k|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|  1.61k|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|  1.61k|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  255|  1.61k|                        push_fixed_value(_float, mem.f); }
  ------------------
  |  |  121|  1.61k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|  1.61k|    template_callback ## name
  |  |  ------------------
  |  |  122|  1.61k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 1.61k]
  |  |  ------------------
  |  |  123|  1.61k|        goto _push
  ------------------
  256|  1.61k|                case MSGPACK_CS_DOUBLE: {
  ------------------
  |  Branch (256:17): [True: 174, False: 20.2k]
  ------------------
  257|    174|                        union { uint64_t i; double f; } mem;
  258|    174|                        _msgpack_load64(uint64_t, n, &mem.i);
  ------------------
  |  |  176|    174|#define _msgpack_load64(cast, from, to) do {       \
  |  |  177|    174|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  178|    174|        *(to) = (cast)_msgpack_be64(*(to));        \
  |  |  ------------------
  |  |  |  |  142|    174|#        define _msgpack_be64(x) bswap_64(x)
  |  |  ------------------
  |  |  179|    174|    } while (0);
  |  |  ------------------
  |  |  |  Branch (179:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  259|       |#if defined(TARGET_OS_IPHONE)
  260|       |                    // ok
  261|       |#elif defined(__arm__) && !(__ARM_EABI__) // arm-oabi
  262|       |                        // https://github.com/msgpack/msgpack-perl/pull/1
  263|       |                        mem.i = (mem.i & 0xFFFFFFFFUL) << 32UL | (mem.i >> 32UL);
  264|       |#endif
  265|    174|                        push_fixed_value(_double, mem.f); }
  ------------------
  |  |  121|    174|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|    174|    template_callback ## name
  |  |  ------------------
  |  |  122|    174|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 174]
  |  |  ------------------
  |  |  123|    174|        goto _push
  ------------------
  266|  1.44k|                case MSGPACK_CS_UINT_8:
  ------------------
  |  Branch (266:17): [True: 1.44k, False: 18.9k]
  ------------------
  267|  1.44k|                    push_fixed_value(_uint8, *(uint8_t*)n);
  ------------------
  |  |  121|  1.44k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|  1.44k|    template_callback ## name
  |  |  ------------------
  |  |  122|  1.44k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 1.44k]
  |  |  ------------------
  |  |  123|  1.44k|        goto _push
  ------------------
  268|  1.44k|                case MSGPACK_CS_UINT_16:{
  ------------------
  |  Branch (268:17): [True: 120, False: 20.3k]
  ------------------
  269|    120|                    uint16_t tmp;
  270|    120|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|    120|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|    120|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|    120|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|    120|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|    120|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  271|    120|                    push_fixed_value(_uint16, tmp);
  ------------------
  |  |  121|    120|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|    120|    template_callback ## name
  |  |  ------------------
  |  |  122|    120|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 120]
  |  |  ------------------
  |  |  123|    120|        goto _push
  ------------------
  272|    120|                }
  273|    120|                case MSGPACK_CS_UINT_32:{
  ------------------
  |  Branch (273:17): [True: 67, False: 20.3k]
  ------------------
  274|     67|                    uint32_t tmp;
  275|     67|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|     67|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|     67|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|     67|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|     67|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|     67|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  276|     67|                    push_fixed_value(_uint32, tmp);
  ------------------
  |  |  121|     67|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|     67|    template_callback ## name
  |  |  ------------------
  |  |  122|     67|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 67]
  |  |  ------------------
  |  |  123|     67|        goto _push
  ------------------
  277|     67|                }
  278|  1.04k|                case MSGPACK_CS_UINT_64:{
  ------------------
  |  Branch (278:17): [True: 1.04k, False: 19.3k]
  ------------------
  279|  1.04k|                    uint64_t tmp;
  280|  1.04k|                    _msgpack_load64(uint64_t,n,&tmp);
  ------------------
  |  |  176|  1.04k|#define _msgpack_load64(cast, from, to) do {       \
  |  |  177|  1.04k|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  178|  1.04k|        *(to) = (cast)_msgpack_be64(*(to));        \
  |  |  ------------------
  |  |  |  |  142|  1.04k|#        define _msgpack_be64(x) bswap_64(x)
  |  |  ------------------
  |  |  179|  1.04k|    } while (0);
  |  |  ------------------
  |  |  |  Branch (179:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  281|  1.04k|                    push_fixed_value(_uint64, tmp);
  ------------------
  |  |  121|  1.04k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|  1.04k|    template_callback ## name
  |  |  ------------------
  |  |  122|  1.04k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 1.04k]
  |  |  ------------------
  |  |  123|  1.04k|        goto _push
  ------------------
  282|  1.04k|                }
  283|  1.04k|                case MSGPACK_CS_INT_8:
  ------------------
  |  Branch (283:17): [True: 146, False: 20.2k]
  ------------------
  284|    146|                    push_fixed_value(_int8, *(int8_t*)n);
  ------------------
  |  |  121|    146|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|    146|    template_callback ## name
  |  |  ------------------
  |  |  122|    146|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 146]
  |  |  ------------------
  |  |  123|    146|        goto _push
  ------------------
  285|    146|                case MSGPACK_CS_INT_16:{
  ------------------
  |  Branch (285:17): [True: 68, False: 20.3k]
  ------------------
  286|     68|                    int16_t tmp;
  287|     68|                    _msgpack_load16(int16_t,n,&tmp);
  ------------------
  |  |  167|     68|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|     68|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|     68|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|     68|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|     68|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  288|     68|                    push_fixed_value(_int16, tmp);
  ------------------
  |  |  121|     68|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|     68|    template_callback ## name
  |  |  ------------------
  |  |  122|     68|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 68]
  |  |  ------------------
  |  |  123|     68|        goto _push
  ------------------
  289|     68|                }
  290|     88|                case MSGPACK_CS_INT_32:{
  ------------------
  |  Branch (290:17): [True: 88, False: 20.3k]
  ------------------
  291|     88|                    int32_t tmp;
  292|     88|                    _msgpack_load32(int32_t,n,&tmp);
  ------------------
  |  |  172|     88|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|     88|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|     88|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|     88|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|     88|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  293|     88|                    push_fixed_value(_int32, tmp);
  ------------------
  |  |  121|     88|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|     88|    template_callback ## name
  |  |  ------------------
  |  |  122|     88|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 88]
  |  |  ------------------
  |  |  123|     88|        goto _push
  ------------------
  294|     88|                }
  295|  4.14k|                case MSGPACK_CS_INT_64:{
  ------------------
  |  Branch (295:17): [True: 4.14k, False: 16.2k]
  ------------------
  296|  4.14k|                    int64_t tmp;
  297|  4.14k|                    _msgpack_load64(int64_t,n,&tmp);
  ------------------
  |  |  176|  4.14k|#define _msgpack_load64(cast, from, to) do {       \
  |  |  177|  4.14k|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  178|  4.14k|        *(to) = (cast)_msgpack_be64(*(to));        \
  |  |  ------------------
  |  |  |  |  142|  4.14k|#        define _msgpack_be64(x) bswap_64(x)
  |  |  ------------------
  |  |  179|  4.14k|    } while (0);
  |  |  ------------------
  |  |  |  Branch (179:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  298|  4.14k|                    push_fixed_value(_int64, tmp);
  ------------------
  |  |  121|  4.14k|        ret = msgpack_unpack_callback(func)(user, arg, &obj); \
  |  |  ------------------
  |  |  |  |   33|  4.14k|    template_callback ## name
  |  |  ------------------
  |  |  122|  4.14k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (122:12): [True: 0, False: 4.14k]
  |  |  ------------------
  |  |  123|  4.14k|        goto _push
  ------------------
  299|  4.14k|                }
  300|  4.14k|                case MSGPACK_CS_FIXEXT_1:
  ------------------
  |  Branch (300:17): [True: 0, False: 20.4k]
  ------------------
  301|      0|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 1+1, _ext_zero);
  ------------------
  |  |  135|      0|        trail = trail_len; \
  |  |  136|      0|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  137|      0|        cs = _cs; \
  |  |  138|      0|        goto _fixed_trail_again
  ------------------
  302|      0|                case MSGPACK_CS_FIXEXT_2:
  ------------------
  |  Branch (302:17): [True: 0, False: 20.4k]
  ------------------
  303|      0|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 2+1, _ext_zero);
  ------------------
  |  |  135|      0|        trail = trail_len; \
  |  |  136|      0|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  137|      0|        cs = _cs; \
  |  |  138|      0|        goto _fixed_trail_again
  ------------------
  304|      0|                case MSGPACK_CS_FIXEXT_4:
  ------------------
  |  Branch (304:17): [True: 0, False: 20.4k]
  ------------------
  305|      0|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 4+1, _ext_zero);
  ------------------
  |  |  135|      0|        trail = trail_len; \
  |  |  136|      0|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  137|      0|        cs = _cs; \
  |  |  138|      0|        goto _fixed_trail_again
  ------------------
  306|      0|                case MSGPACK_CS_FIXEXT_8:
  ------------------
  |  Branch (306:17): [True: 0, False: 20.4k]
  ------------------
  307|      0|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 8+1, _ext_zero);
  ------------------
  |  |  135|      0|        trail = trail_len; \
  |  |  136|      0|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  137|      0|        cs = _cs; \
  |  |  138|      0|        goto _fixed_trail_again
  ------------------
  308|      0|                case MSGPACK_CS_FIXEXT_16:
  ------------------
  |  Branch (308:17): [True: 0, False: 20.4k]
  ------------------
  309|      0|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, 16+1, _ext_zero);
  ------------------
  |  |  135|      0|        trail = trail_len; \
  |  |  136|      0|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 0]
  |  |  ------------------
  |  |  137|      0|        cs = _cs; \
  |  |  138|      0|        goto _fixed_trail_again
  ------------------
  310|    827|                case MSGPACK_CS_STR_8:
  ------------------
  |  Branch (310:17): [True: 827, False: 19.6k]
  ------------------
  311|    827|                    again_fixed_trail_if_zero(MSGPACK_ACS_STR_VALUE, *(uint8_t*)n, _str_zero);
  ------------------
  |  |  135|    827|        trail = trail_len; \
  |  |  136|    827|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 819, False: 8]
  |  |  ------------------
  |  |  137|    827|        cs = _cs; \
  |  |  138|      8|        goto _fixed_trail_again
  ------------------
  312|     21|                case MSGPACK_CS_BIN_8:
  ------------------
  |  Branch (312:17): [True: 21, False: 20.4k]
  ------------------
  313|     21|                    again_fixed_trail_if_zero(MSGPACK_ACS_BIN_VALUE, *(uint8_t*)n, _bin_zero);
  ------------------
  |  |  135|     21|        trail = trail_len; \
  |  |  136|     21|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 15, False: 6]
  |  |  ------------------
  |  |  137|     21|        cs = _cs; \
  |  |  138|      6|        goto _fixed_trail_again
  ------------------
  314|      7|                case MSGPACK_CS_EXT_8:
  ------------------
  |  Branch (314:17): [True: 7, False: 20.4k]
  ------------------
  315|      7|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, (*(uint8_t*)n) + 1, _ext_zero);
  ------------------
  |  |  135|      7|        trail = trail_len; \
  |  |  136|      7|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 7]
  |  |  ------------------
  |  |  137|      7|        cs = _cs; \
  |  |  138|      7|        goto _fixed_trail_again
  ------------------
  316|      5|                case MSGPACK_CS_STR_16:{
  ------------------
  |  Branch (316:17): [True: 5, False: 20.4k]
  ------------------
  317|      5|                    uint16_t tmp;
  318|      5|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|      5|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|      5|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|      5|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|      5|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|      5|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|      5|                    again_fixed_trail_if_zero(MSGPACK_ACS_STR_VALUE, tmp, _str_zero);
  ------------------
  |  |  135|      5|        trail = trail_len; \
  |  |  136|      5|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 3, False: 2]
  |  |  ------------------
  |  |  137|      5|        cs = _cs; \
  |  |  138|      2|        goto _fixed_trail_again
  ------------------
  320|      5|                }
  321|     96|                case MSGPACK_CS_BIN_16:{
  ------------------
  |  Branch (321:17): [True: 96, False: 20.3k]
  ------------------
  322|     96|                    uint16_t tmp;
  323|     96|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|     96|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|     96|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|     96|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|     96|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|     96|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  324|     96|                    again_fixed_trail_if_zero(MSGPACK_ACS_BIN_VALUE, tmp, _bin_zero);
  ------------------
  |  |  135|     96|        trail = trail_len; \
  |  |  136|     96|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 65, False: 31]
  |  |  ------------------
  |  |  137|     96|        cs = _cs; \
  |  |  138|     31|        goto _fixed_trail_again
  ------------------
  325|     96|                }
  326|     79|                case MSGPACK_CS_EXT_16:{
  ------------------
  |  Branch (326:17): [True: 79, False: 20.3k]
  ------------------
  327|     79|                    uint16_t tmp;
  328|     79|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|     79|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|     79|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|     79|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|     79|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|     79|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  329|     79|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, tmp + 1, _ext_zero);
  ------------------
  |  |  135|     79|        trail = trail_len; \
  |  |  136|     79|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 79]
  |  |  ------------------
  |  |  137|     79|        cs = _cs; \
  |  |  138|     79|        goto _fixed_trail_again
  ------------------
  330|     79|                }
  331|      1|                case MSGPACK_CS_STR_32:{
  ------------------
  |  Branch (331:17): [True: 1, False: 20.4k]
  ------------------
  332|      1|                    uint32_t tmp;
  333|      1|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|      1|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|      1|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|      1|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|      1|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|      1|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  334|      1|                    again_fixed_trail_if_zero(MSGPACK_ACS_STR_VALUE, tmp, _str_zero);
  ------------------
  |  |  135|      1|        trail = trail_len; \
  |  |  136|      1|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 1]
  |  |  ------------------
  |  |  137|      1|        cs = _cs; \
  |  |  138|      1|        goto _fixed_trail_again
  ------------------
  335|      1|                }
  336|      3|                case MSGPACK_CS_BIN_32:{
  ------------------
  |  Branch (336:17): [True: 3, False: 20.4k]
  ------------------
  337|      3|                    uint32_t tmp;
  338|      3|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|      3|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|      3|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|      3|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|      3|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|      3|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  339|      3|                    again_fixed_trail_if_zero(MSGPACK_ACS_BIN_VALUE, tmp, _bin_zero);
  ------------------
  |  |  135|      3|        trail = trail_len; \
  |  |  136|      3|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 3]
  |  |  ------------------
  |  |  137|      3|        cs = _cs; \
  |  |  138|      3|        goto _fixed_trail_again
  ------------------
  340|      3|                }
  341|      3|                case MSGPACK_CS_EXT_32:{
  ------------------
  |  Branch (341:17): [True: 3, False: 20.4k]
  ------------------
  342|      3|                    uint32_t tmp;
  343|      3|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|      3|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|      3|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|      3|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|      3|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|      3|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  344|      3|                    again_fixed_trail_if_zero(MSGPACK_ACS_EXT_VALUE, tmp + 1, _ext_zero);
  ------------------
  |  |  135|      3|        trail = trail_len; \
  |  |  136|      3|        if(trail == 0) { goto ifzero; } \
  |  |  ------------------
  |  |  |  Branch (136:12): [True: 0, False: 3]
  |  |  ------------------
  |  |  137|      3|        cs = _cs; \
  |  |  138|      3|        goto _fixed_trail_again
  ------------------
  345|      3|                }
  346|  7.94k|                case MSGPACK_ACS_STR_VALUE:
  ------------------
  |  Branch (346:17): [True: 7.94k, False: 12.4k]
  ------------------
  347|  8.85k|                _str_zero:
  348|  8.85k|                    push_variable_value(_str, data, n, trail);
  ------------------
  |  |  125|  8.85k|        ret = msgpack_unpack_callback(func)(user, \
  |  |  ------------------
  |  |  |  |   33|  8.85k|    template_callback ## name
  |  |  ------------------
  |  |  126|  8.85k|            (const char*)base, (const char*)pos, len, &obj); \
  |  |  127|  8.85k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (127:12): [True: 0, False: 8.85k]
  |  |  ------------------
  |  |  128|  8.85k|        goto _push
  ------------------
  349|  8.85k|                case MSGPACK_ACS_BIN_VALUE:
  ------------------
  |  Branch (349:17): [True: 36, False: 20.4k]
  ------------------
  350|    116|                _bin_zero:
  351|    116|                    push_variable_value(_bin, data, n, trail);
  ------------------
  |  |  125|    116|        ret = msgpack_unpack_callback(func)(user, \
  |  |  ------------------
  |  |  |  |   33|    116|    template_callback ## name
  |  |  ------------------
  |  |  126|    116|            (const char*)base, (const char*)pos, len, &obj); \
  |  |  127|    116|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (127:12): [True: 0, False: 116]
  |  |  ------------------
  |  |  128|    116|        goto _push
  ------------------
  352|    548|                case MSGPACK_ACS_EXT_VALUE:
  ------------------
  |  Branch (352:17): [True: 548, False: 19.8k]
  ------------------
  353|    548|                _ext_zero:
  354|    548|                    push_variable_value(_ext, data, n, trail);
  ------------------
  |  |  125|    548|        ret = msgpack_unpack_callback(func)(user, \
  |  |  ------------------
  |  |  |  |   33|    548|    template_callback ## name
  |  |  ------------------
  |  |  126|    548|            (const char*)base, (const char*)pos, len, &obj); \
  |  |  127|    548|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (127:12): [True: 0, False: 548]
  |  |  ------------------
  |  |  128|    548|        goto _push
  ------------------
  355|       |
  356|    548|                case MSGPACK_CS_ARRAY_16:{
  ------------------
  |  Branch (356:17): [True: 207, False: 20.2k]
  ------------------
  357|    207|                    uint16_t tmp;
  358|    207|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|    207|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|    207|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|    207|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|    207|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|    207|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  359|    414|                    start_container(_array, tmp, MSGPACK_CT_ARRAY_ITEM);
  ------------------
  |  |  141|    207|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|    207|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 0, False: 207]
  |  |  ------------------
  |  |  142|      0|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      0|            goto _failed; \
  |  |  144|      0|        } /* FIXME */ \
  |  |  145|    207|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|    207|    template_callback ## name
  |  |  ------------------
  |  |  146|    207|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 0, False: 207]
  |  |  ------------------
  |  |  147|    207|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 43, False: 164]
  |  |  ------------------
  |  |  148|    207|        stack[top].ct = ct_; \
  |  |  149|    164|        stack[top].count = count_; \
  |  |  150|    164|        ++top; \
  |  |  151|    164|        goto _header_again
  ------------------
  360|    414|                }
  361|     40|                case MSGPACK_CS_ARRAY_32:{
  ------------------
  |  Branch (361:17): [True: 40, False: 20.4k]
  ------------------
  362|       |                    /* FIXME security guard */
  363|     40|                    uint32_t tmp;
  364|     40|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|     40|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|     40|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|     40|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|     40|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|     40|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  365|     80|                    start_container(_array, tmp, MSGPACK_CT_ARRAY_ITEM);
  ------------------
  |  |  141|     40|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|     40|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 0, False: 40]
  |  |  ------------------
  |  |  142|      0|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      0|            goto _failed; \
  |  |  144|      0|        } /* FIXME */ \
  |  |  145|     40|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|     40|    template_callback ## name
  |  |  ------------------
  |  |  146|     40|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 0, False: 40]
  |  |  ------------------
  |  |  147|     40|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 9, False: 31]
  |  |  ------------------
  |  |  148|     40|        stack[top].ct = ct_; \
  |  |  149|     31|        stack[top].count = count_; \
  |  |  150|     31|        ++top; \
  |  |  151|     31|        goto _header_again
  ------------------
  366|     80|                }
  367|       |
  368|     20|                case MSGPACK_CS_MAP_16:{
  ------------------
  |  Branch (368:17): [True: 20, False: 20.4k]
  ------------------
  369|     20|                    uint16_t tmp;
  370|     20|                    _msgpack_load16(uint16_t,n,&tmp);
  ------------------
  |  |  167|     20|#define _msgpack_load16(cast, from, to) do {       \
  |  |  168|     20|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  169|     20|        *(to) = (cast)_msgpack_be16(*(to));      \
  |  |  ------------------
  |  |  |  |  110|     20|#       define _msgpack_be16(x) ntohs((uint16_t)x)
  |  |  ------------------
  |  |  170|     20|    } while (0);
  |  |  ------------------
  |  |  |  Branch (170:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  371|     40|                    start_container(_map, tmp, MSGPACK_CT_MAP_KEY);
  ------------------
  |  |  141|     20|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|     20|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 0, False: 20]
  |  |  ------------------
  |  |  142|      0|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      0|            goto _failed; \
  |  |  144|      0|        } /* FIXME */ \
  |  |  145|     20|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|     20|    template_callback ## name
  |  |  ------------------
  |  |  146|     20|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 0, False: 20]
  |  |  ------------------
  |  |  147|     20|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 8, False: 12]
  |  |  ------------------
  |  |  148|     20|        stack[top].ct = ct_; \
  |  |  149|     12|        stack[top].count = count_; \
  |  |  150|     12|        ++top; \
  |  |  151|     12|        goto _header_again
  ------------------
  372|     40|                }
  373|  1.69k|                case MSGPACK_CS_MAP_32:{
  ------------------
  |  Branch (373:17): [True: 1.69k, False: 18.7k]
  ------------------
  374|       |                    /* FIXME security guard */
  375|  1.69k|                    uint32_t tmp;
  376|  1.69k|                    _msgpack_load32(uint32_t,n,&tmp);
  ------------------
  |  |  172|  1.69k|#define _msgpack_load32(cast, from, to) do {       \
  |  |  173|  1.69k|        memcpy((cast*)(to), (from), sizeof(cast)); \
  |  |  174|  1.69k|        *(to) = (cast)_msgpack_be32(*(to));        \
  |  |  ------------------
  |  |  |  |  124|  1.69k|#       define _msgpack_be32(x) ntohl((uint32_t)x)
  |  |  ------------------
  |  |  175|  1.69k|    } while (0);
  |  |  ------------------
  |  |  |  Branch (175:14): [Folded - Ignored]
  |  |  ------------------
  ------------------
  377|  3.39k|                    start_container(_map, tmp, MSGPACK_CT_MAP_KEY);
  ------------------
  |  |  141|  1.69k|        if(top >= MSGPACK_EMBED_STACK_SIZE) { \
  |  |  ------------------
  |  |  |  |   25|  1.69k|#define MSGPACK_EMBED_STACK_SIZE 32
  |  |  ------------------
  |  |  |  Branch (141:12): [True: 0, False: 1.69k]
  |  |  ------------------
  |  |  142|      0|            ret = MSGPACK_UNPACK_NOMEM_ERROR; \
  |  |  143|      0|            goto _failed; \
  |  |  144|      0|        } /* FIXME */ \
  |  |  145|  1.69k|        ret = msgpack_unpack_callback(func)(user, count_, &stack[top].obj); \
  |  |  ------------------
  |  |  |  |   33|  1.69k|    template_callback ## name
  |  |  ------------------
  |  |  146|  1.69k|        if(ret < 0) { goto _failed; } \
  |  |  ------------------
  |  |  |  Branch (146:12): [True: 1, False: 1.69k]
  |  |  ------------------
  |  |  147|  1.69k|        if((count_) == 0) { obj = stack[top].obj; goto _push; } \
  |  |  ------------------
  |  |  |  Branch (147:12): [True: 0, False: 1.69k]
  |  |  ------------------
  |  |  148|  1.69k|        stack[top].ct = ct_; \
  |  |  149|  1.69k|        stack[top].count = count_; \
  |  |  150|  1.69k|        ++top; \
  |  |  151|  1.69k|        goto _header_again
  ------------------
  378|  3.39k|                }
  379|       |
  380|      0|                default:
  ------------------
  |  Branch (380:17): [True: 0, False: 20.4k]
  ------------------
  381|      0|                    ret = MSGPACK_UNPACK_PARSE_ERROR;
  382|      0|                    goto _failed;
  383|  20.4k|                }
  384|   710k|            }
  385|       |
  386|   710k|    _push:
  387|   710k|        if(top == 0) { goto _finish; }
  ------------------
  |  Branch (387:12): [True: 490, False: 709k]
  ------------------
  388|   709k|        c = &stack[top-1];
  389|   709k|        switch(c->ct) {
  390|   464k|        case MSGPACK_CT_ARRAY_ITEM:
  ------------------
  |  Branch (390:9): [True: 464k, False: 245k]
  ------------------
  391|   464k|            ret = msgpack_unpack_callback(_array_item)(user, &c->obj, obj); \
  ------------------
  |  |   33|   464k|    template_callback ## name
  ------------------
  392|   464k|            if(ret < 0) { goto _failed; }
  ------------------
  |  Branch (392:16): [True: 0, False: 464k]
  ------------------
  393|   464k|            if(--c->count == 0) {
  ------------------
  |  Branch (393:16): [True: 37.4k, False: 426k]
  ------------------
  394|  37.4k|                obj = c->obj;
  395|  37.4k|                --top;
  396|       |                /*printf("stack pop %d\n", top);*/
  397|  37.4k|                goto _push;
  398|  37.4k|            }
  399|   426k|            goto _header_again;
  400|   426k|        case MSGPACK_CT_MAP_KEY:
  ------------------
  |  Branch (400:9): [True: 122k, False: 586k]
  ------------------
  401|   122k|            c->map_key = obj;
  402|   122k|            c->ct = MSGPACK_CT_MAP_VALUE;
  403|   122k|            goto _header_again;
  404|   122k|        case MSGPACK_CT_MAP_VALUE:
  ------------------
  |  Branch (404:9): [True: 122k, False: 586k]
  ------------------
  405|   122k|            ret = msgpack_unpack_callback(_map_item)(user, &c->obj, c->map_key, obj); \
  ------------------
  |  |   33|   122k|    template_callback ## name
  ------------------
  406|   122k|            if(ret < 0) { goto _failed; }
  ------------------
  |  Branch (406:16): [True: 0, False: 122k]
  ------------------
  407|   122k|            if(--c->count == 0) {
  ------------------
  |  Branch (407:16): [True: 9.49k, False: 113k]
  ------------------
  408|  9.49k|                obj = c->obj;
  409|  9.49k|                --top;
  410|       |                /*printf("stack pop %d\n", top);*/
  411|  9.49k|                goto _push;
  412|  9.49k|            }
  413|   113k|            c->ct = MSGPACK_CT_MAP_KEY;
  414|   113k|            goto _header_again;
  415|       |
  416|      0|        default:
  ------------------
  |  Branch (416:9): [True: 0, False: 709k]
  ------------------
  417|      0|            ret = MSGPACK_UNPACK_PARSE_ERROR;
  418|      0|            goto _failed;
  419|   709k|        }
  420|       |
  421|   710k|    _header_again:
  422|   710k|            cs = MSGPACK_CS_HEADER;
  423|   710k|            ++p;
  424|   710k|        } while(p != pe);
  ------------------
  |  Branch (424:17): [True: 710k, False: 8]
  ------------------
  425|      8|        goto _out;
  426|       |
  427|       |
  428|    490|    _finish:
  429|    490|        stack[0].obj = obj;
  430|    490|        ++p;
  431|    490|        ret = 1;
  432|       |        /*printf("-- finish --\n"); */
  433|    490|        goto _end;
  434|       |
  435|      4|    _failed:
  436|       |        /*printf("** FAILED **\n"); */
  437|      4|        goto _end;
  438|       |
  439|     20|    _out:
  440|     20|        ret = 0;
  441|     20|        goto _end;
  442|       |
  443|    514|    _end:
  444|    514|        ctx->cs = cs;
  445|    514|        ctx->trail = trail;
  446|    514|        ctx->top = top;
  447|    514|        *off = (size_t)(p - (const unsigned char*)data);
  448|       |
  449|    514|        return ret;
  450|    514|    }
  451|    514|}
unpack.c:template_data:
   89|    490|{
   90|    490|    return (ctx)->stack[0].obj;
   91|    490|}

unpack.c:msgpack_zone_malloc:
  107|  48.3k|{
  108|  48.3k|    char* aligned =
  109|  48.3k|        (char*)(
  110|  48.3k|            (size_t)(
  111|  48.3k|                zone->chunk_list.ptr + (MSGPACK_ZONE_ALIGN - 1)
  ------------------
  |  |   84|  48.3k|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
  112|  48.3k|            ) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN
  ------------------
  |  |   84|  48.3k|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
                          ) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN
  ------------------
  |  |   84|  48.3k|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
  113|  48.3k|        );
  114|  48.3k|    size_t adjusted_size = size + (size_t)(aligned - zone->chunk_list.ptr);
  115|  48.3k|    if(zone->chunk_list.free >= adjusted_size) {
  ------------------
  |  Branch (115:8): [True: 47.4k, False: 903]
  ------------------
  116|  47.4k|        zone->chunk_list.free -= adjusted_size;
  117|  47.4k|        zone->chunk_list.ptr  += adjusted_size;
  118|  47.4k|        return aligned;
  119|  47.4k|    }
  120|    903|    {
  121|    903|        void* ptr = msgpack_zone_malloc_expand(zone, size + (MSGPACK_ZONE_ALIGN - 1));
  ------------------
  |  |   84|    903|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
  122|    903|        if (ptr) {
  ------------------
  |  Branch (122:13): [True: 902, False: 1]
  ------------------
  123|    902|            return (char*)((size_t)(ptr) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN);
  ------------------
  |  |   84|    902|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
                          return (char*)((size_t)(ptr) / MSGPACK_ZONE_ALIGN * MSGPACK_ZONE_ALIGN);
  ------------------
  |  |   84|    902|#define MSGPACK_ZONE_ALIGN sizeof(void*)
  ------------------
  124|    902|        }
  125|    903|    }
  126|      1|    return NULL;
  127|    903|}

msgpack_unpack_next:
  659|    514|{
  660|    514|    size_t noff = 0;
  661|    514|    msgpack_unpacked_destroy(result);
  662|       |
  663|    514|    if(off != NULL) { noff = *off; }
  ------------------
  |  Branch (663:8): [True: 514, False: 0]
  ------------------
  664|       |
  665|    514|    if(len <= noff) {
  ------------------
  |  Branch (665:8): [True: 0, False: 514]
  ------------------
  666|      0|        return MSGPACK_UNPACK_CONTINUE;
  667|      0|    }
  668|       |
  669|    514|    {
  670|    514|        int e;
  671|    514|        template_context ctx;
  672|    514|        template_init(&ctx);
  673|       |
  674|    514|        ctx.user.z = &result->zone;
  675|    514|        ctx.user.referenced = false;
  676|       |
  677|    514|        e = template_execute(&ctx, data, len, &noff);
  678|       |
  679|    514|        if(off != NULL) { *off = noff; }
  ------------------
  |  Branch (679:12): [True: 514, False: 0]
  ------------------
  680|       |
  681|    514|        if(e < 0) {
  ------------------
  |  Branch (681:12): [True: 4, False: 510]
  ------------------
  682|      4|            msgpack_zone_free(result->zone);
  683|      4|            result->zone = NULL;
  684|      4|            return (msgpack_unpack_return)e;
  685|      4|        }
  686|       |
  687|    510|        if(e == 0) {
  ------------------
  |  Branch (687:12): [True: 20, False: 490]
  ------------------
  688|     20|            return MSGPACK_UNPACK_CONTINUE;
  689|     20|        }
  690|       |
  691|    490|        result->data = template_data(&ctx);
  692|       |
  693|    490|        return MSGPACK_UNPACK_SUCCESS;
  694|    510|    }
  695|    510|}
unpack.c:template_callback_root:
   52|    514|{
   53|    514|    msgpack_object o;
   54|    514|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|    514|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   55|    514|    o.type = MSGPACK_OBJECT_NIL;
   56|    514|    return o;
   57|    514|}
unpack.c:template_callback_uint8:
   60|   428k|{
   61|   428k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|   428k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   62|   428k|    o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
   63|   428k|    o->via.u64 = d;
   64|   428k|    return 0;
   65|   428k|}
unpack.c:template_callback_int8:
   92|   215k|{
   93|   215k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|   215k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   94|   215k|    if(d >= 0) {
  ------------------
  |  Branch (94:8): [True: 101, False: 215k]
  ------------------
   95|    101|        o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
   96|    101|        o->via.u64 = (uint64_t)d;
   97|    101|        return 0;
   98|    101|    }
   99|   215k|    else {
  100|   215k|        o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER;
  101|   215k|        o->via.i64 = d;
  102|   215k|        return 0;
  103|   215k|    }
  104|   215k|}
unpack.c:template_callback_nil:
  168|      8|{
  169|      8|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|      8|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  170|      8|    o->type = MSGPACK_OBJECT_NIL;
  171|      8|    return 0;
  172|      8|}
unpack.c:template_callback_false:
  183|    382|{
  184|    382|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|    382|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  185|    382|    o->type = MSGPACK_OBJECT_BOOLEAN;
  186|    382|    o->via.boolean = false;
  187|    382|    return 0;
  188|    382|}
unpack.c:template_callback_true:
  175|     14|{
  176|     14|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|     14|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  177|     14|    o->type = MSGPACK_OBJECT_BOOLEAN;
  178|     14|    o->via.boolean = true;
  179|     14|    return 0;
  180|     14|}
unpack.c:template_callback_array:
  191|  38.0k|{
  192|  38.0k|    size_t size;
  193|       |    // Let's leverage the fact that sizeof(msgpack_object) is a compile time constant
  194|       |    // to check for int overflows.
  195|       |    // Note - while n is constrained to 32-bit, the product of n * sizeof(msgpack_object)
  196|       |    // might not be constrained to 4GB on 64-bit systems
  197|       |#if SIZE_MAX == UINT_MAX
  198|       |    if (n > SIZE_MAX/sizeof(msgpack_object))
  199|       |        return MSGPACK_UNPACK_NOMEM_ERROR;
  200|       |#endif
  201|       |
  202|  38.0k|    o->type = MSGPACK_OBJECT_ARRAY;
  203|  38.0k|    o->via.array.size = 0;
  204|       |
  205|  38.0k|    size = n * sizeof(msgpack_object);
  206|       |
  207|  38.0k|    if (*u->z == NULL) {
  ------------------
  |  Branch (207:9): [True: 488, False: 37.5k]
  ------------------
  208|    488|        *u->z = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
  ------------------
  |  |   53|    488|#define MSGPACK_ZONE_CHUNK_SIZE 8192
  ------------------
  209|    488|        if(*u->z == NULL) {
  ------------------
  |  Branch (209:12): [True: 0, False: 488]
  ------------------
  210|      0|            return MSGPACK_UNPACK_NOMEM_ERROR;
  211|      0|        }
  212|    488|    }
  213|       |
  214|       |    // Unsure whether size = 0 should be an error, and if so, what to return
  215|  38.0k|    o->via.array.ptr = (msgpack_object*)msgpack_zone_malloc(*u->z, size);
  216|  38.0k|    if(o->via.array.ptr == NULL) { return MSGPACK_UNPACK_NOMEM_ERROR; }
  ------------------
  |  Branch (216:8): [True: 0, False: 38.0k]
  ------------------
  217|  38.0k|    return 0;
  218|  38.0k|}
unpack.c:template_callback_map:
  233|  10.3k|{
  234|  10.3k|    size_t size;
  235|       |    // Let's leverage the fact that sizeof(msgpack_object_kv) is a compile time constant
  236|       |    // to check for int overflows
  237|       |    // Note - while n is constrained to 32-bit, the product of n * sizeof(msgpack_object)
  238|       |    // might not be constrained to 4GB on 64-bit systems
  239|       |
  240|       |    // Note - this will always be false on 64-bit systems
  241|       |#if SIZE_MAX == UINT_MAX
  242|       |    if (n > SIZE_MAX/sizeof(msgpack_object_kv))
  243|       |        return MSGPACK_UNPACK_NOMEM_ERROR;
  244|       |#endif
  245|       |
  246|  10.3k|    o->type = MSGPACK_OBJECT_MAP;
  247|  10.3k|    o->via.map.size = 0;
  248|       |
  249|  10.3k|    size = n * sizeof(msgpack_object_kv);
  250|       |
  251|  10.3k|    if (*u->z == NULL) {
  ------------------
  |  Branch (251:9): [True: 20, False: 10.3k]
  ------------------
  252|     20|        *u->z = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
  ------------------
  |  |   53|     20|#define MSGPACK_ZONE_CHUNK_SIZE 8192
  ------------------
  253|     20|        if(*u->z == NULL) {
  ------------------
  |  Branch (253:12): [True: 0, False: 20]
  ------------------
  254|      0|            return MSGPACK_UNPACK_NOMEM_ERROR;
  255|      0|        }
  256|     20|    }
  257|       |
  258|       |    // Should size = 0 be an error? If so, what error to return?
  259|  10.3k|    o->via.map.ptr = (msgpack_object_kv*)msgpack_zone_malloc(*u->z, size);
  260|  10.3k|    if(o->via.map.ptr == NULL) { return MSGPACK_UNPACK_NOMEM_ERROR; }
  ------------------
  |  Branch (260:8): [True: 1, False: 10.3k]
  ------------------
  261|  10.3k|    return 0;
  262|  10.3k|}
unpack.c:template_callback_float:
  152|  1.61k|{
  153|  1.61k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|  1.61k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  154|  1.61k|    o->type = MSGPACK_OBJECT_FLOAT32;
  155|  1.61k|    o->via.f64 = d;
  156|  1.61k|    return 0;
  157|  1.61k|}
unpack.c:template_callback_double:
  160|    174|{
  161|    174|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|    174|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  162|    174|    o->type = MSGPACK_OBJECT_FLOAT64;
  163|    174|    o->via.f64 = d;
  164|    174|    return 0;
  165|    174|}
unpack.c:template_callback_uint16:
   68|    120|{
   69|    120|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|    120|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   70|    120|    o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
   71|    120|    o->via.u64 = d;
   72|    120|    return 0;
   73|    120|}
unpack.c:template_callback_uint32:
   76|     67|{
   77|     67|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|     67|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   78|     67|    o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
   79|     67|    o->via.u64 = d;
   80|     67|    return 0;
   81|     67|}
unpack.c:template_callback_uint64:
   84|  1.04k|{
   85|  1.04k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|  1.04k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
   86|  1.04k|    o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
   87|  1.04k|    o->via.u64 = d;
   88|  1.04k|    return 0;
   89|  1.04k|}
unpack.c:template_callback_int16:
  107|     68|{
  108|     68|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|     68|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  109|     68|    if(d >= 0) {
  ------------------
  |  Branch (109:8): [True: 18, False: 50]
  ------------------
  110|     18|        o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
  111|     18|        o->via.u64 = (uint64_t)d;
  112|     18|        return 0;
  113|     18|    }
  114|     50|    else {
  115|     50|        o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER;
  116|     50|        o->via.i64 = d;
  117|     50|        return 0;
  118|     50|    }
  119|     68|}
unpack.c:template_callback_int32:
  122|     88|{
  123|     88|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|     88|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  124|     88|    if(d >= 0) {
  ------------------
  |  Branch (124:8): [True: 10, False: 78]
  ------------------
  125|     10|        o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
  126|     10|        o->via.u64 = (uint64_t)d;
  127|     10|        return 0;
  128|     10|    }
  129|     78|    else {
  130|     78|        o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER;
  131|     78|        o->via.i64 = d;
  132|     78|        return 0;
  133|     78|    }
  134|     88|}
unpack.c:template_callback_int64:
  137|  4.14k|{
  138|  4.14k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|  4.14k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  139|  4.14k|    if(d >= 0) {
  ------------------
  |  Branch (139:8): [True: 14, False: 4.12k]
  ------------------
  140|     14|        o->type = MSGPACK_OBJECT_POSITIVE_INTEGER;
  141|     14|        o->via.u64 = (uint64_t)d;
  142|     14|        return 0;
  143|     14|    }
  144|  4.12k|    else {
  145|  4.12k|        o->type = MSGPACK_OBJECT_NEGATIVE_INTEGER;
  146|  4.12k|        o->via.i64 = d;
  147|  4.12k|        return 0;
  148|  4.12k|    }
  149|  4.14k|}
unpack.c:template_callback_str:
  279|  8.85k|{
  280|  8.85k|    MSGPACK_UNUSED(b);
  ------------------
  |  |   13|  8.85k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  281|  8.85k|    if (*u->z == NULL) {
  ------------------
  |  Branch (281:9): [True: 1, False: 8.85k]
  ------------------
  282|      1|        *u->z = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
  ------------------
  |  |   53|      1|#define MSGPACK_ZONE_CHUNK_SIZE 8192
  ------------------
  283|      1|        if(*u->z == NULL) {
  ------------------
  |  Branch (283:12): [True: 0, False: 1]
  ------------------
  284|      0|            return MSGPACK_UNPACK_NOMEM_ERROR;
  285|      0|        }
  286|      1|    }
  287|  8.85k|    o->type = MSGPACK_OBJECT_STR;
  288|  8.85k|    o->via.str.ptr = p;
  289|  8.85k|    o->via.str.size = l;
  290|  8.85k|    u->referenced = true;
  291|  8.85k|    return 0;
  292|  8.85k|}
unpack.c:template_callback_bin:
  295|    116|{
  296|    116|    MSGPACK_UNUSED(b);
  ------------------
  |  |   13|    116|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  297|    116|    if (*u->z == NULL) {
  ------------------
  |  Branch (297:9): [True: 0, False: 116]
  ------------------
  298|      0|        *u->z = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
  ------------------
  |  |   53|      0|#define MSGPACK_ZONE_CHUNK_SIZE 8192
  ------------------
  299|      0|        if(*u->z == NULL) {
  ------------------
  |  Branch (299:12): [True: 0, False: 0]
  ------------------
  300|      0|            return MSGPACK_UNPACK_NOMEM_ERROR;
  301|      0|        }
  302|      0|    }
  303|    116|    o->type = MSGPACK_OBJECT_BIN;
  304|    116|    o->via.bin.ptr = p;
  305|    116|    o->via.bin.size = l;
  306|    116|    u->referenced = true;
  307|    116|    return 0;
  308|    116|}
unpack.c:template_callback_ext:
  311|    548|{
  312|    548|    MSGPACK_UNUSED(b);
  ------------------
  |  |   13|    548|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  313|    548|    if (l == 0) {
  ------------------
  |  Branch (313:9): [True: 0, False: 548]
  ------------------
  314|      0|        return MSGPACK_UNPACK_PARSE_ERROR;
  315|      0|    }
  316|    548|    if (*u->z == NULL) {
  ------------------
  |  Branch (316:9): [True: 0, False: 548]
  ------------------
  317|      0|        *u->z = msgpack_zone_new(MSGPACK_ZONE_CHUNK_SIZE);
  ------------------
  |  |   53|      0|#define MSGPACK_ZONE_CHUNK_SIZE 8192
  ------------------
  318|      0|        if(*u->z == NULL) {
  ------------------
  |  Branch (318:12): [True: 0, False: 0]
  ------------------
  319|      0|            return MSGPACK_UNPACK_NOMEM_ERROR;
  320|      0|        }
  321|      0|    }
  322|    548|    o->type = MSGPACK_OBJECT_EXT;
  323|    548|    o->via.ext.type = *p;
  324|    548|    o->via.ext.ptr = p + 1;
  325|    548|    o->via.ext.size = l - 1;
  326|    548|    u->referenced = true;
  327|    548|    return 0;
  328|    548|}
unpack.c:template_callback_array_item:
  221|   464k|{
  222|   464k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|   464k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  223|       |#if defined(__GNUC__) && !defined(__clang__)
  224|       |    memcpy(&c->via.array.ptr[c->via.array.size], &o, sizeof(msgpack_object));
  225|       |#else  /* __GNUC__ && !__clang__ */
  226|   464k|    c->via.array.ptr[c->via.array.size] = o;
  227|   464k|#endif /* __GNUC__ && !__clang__ */
  228|   464k|    ++c->via.array.size;
  229|   464k|    return 0;
  230|   464k|}
unpack.c:template_callback_map_item:
  265|   122k|{
  266|   122k|    MSGPACK_UNUSED(u);
  ------------------
  |  |   13|   122k|#define MSGPACK_UNUSED(a) (void)(a)
  ------------------
  267|       |#if defined(__GNUC__) && !defined(__clang__)
  268|       |    memcpy(&c->via.map.ptr[c->via.map.size].key, &k, sizeof(msgpack_object));
  269|       |    memcpy(&c->via.map.ptr[c->via.map.size].val, &v, sizeof(msgpack_object));
  270|       |#else  /* __GNUC__ && !__clang__ */
  271|   122k|    c->via.map.ptr[c->via.map.size].key = k;
  272|   122k|    c->via.map.ptr[c->via.map.size].val = v;
  273|   122k|#endif /* __GNUC__ && !__clang__ */
  274|   122k|    ++c->via.map.size;
  275|   122k|    return 0;
  276|   122k|}

fuzz_malloc:
   14|  1.92k|void *fuzz_malloc(size_t size) {if (size > 0xa00000) return NULL;
  ------------------
  |  Branch (14:37): [True: 1, False: 1.92k]
  ------------------
   15|  1.92k|return malloc(size);}
msgpack_zone_malloc_expand:
   70|    903|{
   71|    903|    msgpack_zone_chunk_list* const cl = &zone->chunk_list;
   72|    903|    msgpack_zone_chunk* chunk;
   73|       |
   74|    903|    size_t sz = zone->chunk_size;
   75|       |
   76|  1.25k|    while(sz < size) {
  ------------------
  |  Branch (76:11): [True: 347, False: 903]
  ------------------
   77|    347|        size_t tmp_sz = sz * 2;
   78|    347|        if (tmp_sz <= sz) {
  ------------------
  |  Branch (78:13): [True: 0, False: 347]
  ------------------
   79|      0|            sz = size;
   80|      0|            break;
   81|      0|        }
   82|    347|        sz = tmp_sz;
   83|    347|    }
   84|       |
   85|    903|    chunk = (msgpack_zone_chunk*)fuzz_malloc(
   86|    903|            sizeof(msgpack_zone_chunk) + sz);
   87|    903|    if (chunk == NULL) {
  ------------------
  |  Branch (87:9): [True: 1, False: 902]
  ------------------
   88|      1|        return NULL;
   89|      1|    }
   90|    902|    else {
   91|    902|        char* ptr = ((char*)chunk) + sizeof(msgpack_zone_chunk);
   92|    902|        chunk->next = cl->head;
   93|    902|        cl->head = chunk;
   94|    902|        cl->free = sz - size;
   95|    902|        cl->ptr  = ptr + size;
   96|       |
   97|    902|        return ptr;
   98|    902|    }
   99|    903|}
msgpack_zone_destroy:
  175|    509|{
  176|    509|    destroy_finalizer_array(&zone->finalizer_array);
  177|    509|    destroy_chunk_list(&zone->chunk_list);
  178|    509|}
msgpack_zone_new:
  200|    509|{
  201|    509|    msgpack_zone* zone = (msgpack_zone*)fuzz_malloc(
  202|    509|            sizeof(msgpack_zone));
  203|    509|    if(zone == NULL) {
  ------------------
  |  Branch (203:8): [True: 0, False: 509]
  ------------------
  204|      0|        return NULL;
  205|      0|    }
  206|       |
  207|    509|    zone->chunk_size = chunk_size;
  208|       |
  209|    509|    if(!init_chunk_list(&zone->chunk_list, chunk_size)) {
  ------------------
  |  Branch (209:8): [True: 0, False: 509]
  ------------------
  210|      0|        free(zone);
  211|      0|        return NULL;
  212|      0|    }
  213|       |
  214|    509|    init_finalizer_array(&zone->finalizer_array);
  215|       |
  216|    509|    return zone;
  217|    509|}
msgpack_zone_free:
  220|    509|{
  221|    509|    if(zone == NULL) { return; }
  ------------------
  |  Branch (221:8): [True: 0, False: 509]
  ------------------
  222|    509|    msgpack_zone_destroy(zone);
  223|    509|    free(zone);
  224|    509|}
zone.c:destroy_finalizer_array:
  118|    509|{
  119|    509|    call_finalizer_array(fa);
  120|    509|    free(fa->array);
  121|    509|}
zone.c:call_finalizer_array:
  110|    509|{
  111|    509|    msgpack_zone_finalizer* fin = fa->tail;
  112|    509|    for(; fin != fa->array; --fin) {
  ------------------
  |  Branch (112:11): [True: 0, False: 509]
  ------------------
  113|      0|        (*(fin-1)->func)((fin-1)->data);
  114|      0|    }
  115|    509|}
zone.c:destroy_chunk_list:
   38|    509|{
   39|    509|    msgpack_zone_chunk* c = cl->head;
   40|  1.41k|    while(true) {
   41|  1.41k|        msgpack_zone_chunk* n = c->next;
   42|  1.41k|        free(c);
   43|  1.41k|        if(n != NULL) {
  ------------------
  |  Branch (43:12): [True: 902, False: 509]
  ------------------
   44|    902|            c = n;
   45|    902|        } else {
   46|    509|            break;
   47|    509|        }
   48|  1.41k|    }
   49|    509|}
zone.c:init_chunk_list:
   22|    509|{
   23|    509|    msgpack_zone_chunk* chunk = (msgpack_zone_chunk*)fuzz_malloc(
   24|    509|            sizeof(msgpack_zone_chunk) + chunk_size);
   25|    509|    if(chunk == NULL) {
  ------------------
  |  Branch (25:8): [True: 0, False: 509]
  ------------------
   26|      0|        return false;
   27|      0|    }
   28|       |
   29|    509|    cl->head = chunk;
   30|    509|    cl->free = chunk_size;
   31|    509|    cl->ptr  = ((char*)chunk) + sizeof(msgpack_zone_chunk);
   32|    509|    chunk->next = NULL;
   33|       |
   34|    509|    return true;
   35|    509|}
zone.c:init_finalizer_array:
  103|    509|{
  104|    509|    fa->tail  = NULL;
  105|    509|    fa->end   = NULL;
  106|    509|    fa->array = NULL;
  107|    509|}

flb_mp_validate_metric_chunk:
   75|    249|{
   76|    249|    int ret;
   77|    249|    int ok = CMT_DECODE_MSGPACK_SUCCESS;
  ------------------
  |  |   27|    249|#define CMT_DECODE_MSGPACK_SUCCESS                    CMT_MPACK_SUCCESS
  |  |  ------------------
  |  |  |  |   23|    249|#define CMT_MPACK_SUCCESS                    0
  |  |  ------------------
  ------------------
   78|    249|    int count = 0;
   79|    249|    size_t off = 0;
   80|    249|    size_t pre_off = 0;
   81|    249|    struct cmt *cmt;
   82|       |
   83|   426k|    while ((ret = cmt_decode_msgpack_create(&cmt,
  ------------------
  |  Branch (83:12): [True: 425k, False: 249]
  ------------------
   84|   426k|                                            (char *) data, bytes, &off)) == ok) {
   85|   425k|        cmt_destroy(cmt);
   86|   425k|        count++;
   87|   425k|        pre_off = off;
   88|   425k|    }
   89|       |
   90|    249|    switch (ret) {
  ------------------
  |  Branch (90:13): [True: 0, False: 249]
  ------------------
   91|      0|        case CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR:
  ------------------
  |  |   29|      0|#define CMT_DECODE_MSGPACK_INVALID_ARGUMENT_ERROR     CMT_MPACK_INVALID_ARGUMENT_ERROR
  |  |  ------------------
  |  |  |  |   25|      0|#define CMT_MPACK_INVALID_ARGUMENT_ERROR     2
  |  |  ------------------
  ------------------
  |  Branch (91:9): [True: 0, False: 249]
  ------------------
   92|    172|        case CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR:
  ------------------
  |  |   31|    172|#define CMT_DECODE_MSGPACK_CORRUPT_INPUT_DATA_ERROR   CMT_MPACK_CORRUPT_INPUT_DATA_ERROR
  |  |  ------------------
  |  |  |  |   27|    172|#define CMT_MPACK_CORRUPT_INPUT_DATA_ERROR   4
  |  |  ------------------
  ------------------
  |  Branch (92:9): [True: 172, False: 77]
  ------------------
   93|    172|        case CMT_DECODE_MSGPACK_CONSUME_ERROR:
  ------------------
  |  |   32|    172|#define CMT_DECODE_MSGPACK_CONSUME_ERROR              CMT_MPACK_CONSUME_ERROR
  |  |  ------------------
  |  |  |  |   28|    172|#define CMT_MPACK_CONSUME_ERROR              5
  |  |  ------------------
  ------------------
  |  Branch (93:9): [True: 0, False: 249]
  ------------------
   94|    173|        case CMT_DECODE_MSGPACK_ENGINE_ERROR:
  ------------------
  |  |   33|    173|#define CMT_DECODE_MSGPACK_ENGINE_ERROR               CMT_MPACK_ENGINE_ERROR
  |  |  ------------------
  |  |  |  |   29|    173|#define CMT_MPACK_ENGINE_ERROR               6
  |  |  ------------------
  ------------------
  |  Branch (94:9): [True: 1, False: 248]
  ------------------
   95|    173|        case CMT_DECODE_MSGPACK_PENDING_MAP_ENTRIES:
  ------------------
  |  |   34|    173|#define CMT_DECODE_MSGPACK_PENDING_MAP_ENTRIES        CMT_MPACK_PENDING_MAP_ENTRIES
  |  |  ------------------
  |  |  |  |   30|    173|#define CMT_MPACK_PENDING_MAP_ENTRIES        7
  |  |  ------------------
  ------------------
  |  Branch (95:9): [True: 0, False: 249]
  ------------------
   96|    173|        case CMT_DECODE_MSGPACK_PENDING_ARRAY_ENTRIES:
  ------------------
  |  |   35|    173|#define CMT_DECODE_MSGPACK_PENDING_ARRAY_ENTRIES      CMT_MPACK_PENDING_ARRAY_ENTRIES
  |  |  ------------------
  |  |  |  |   31|    173|#define CMT_MPACK_PENDING_ARRAY_ENTRIES      8
  |  |  ------------------
  ------------------
  |  Branch (96:9): [True: 0, False: 249]
  ------------------
   97|    173|        case CMT_DECODE_MSGPACK_UNEXPECTED_KEY_ERROR:
  ------------------
  |  |   36|    173|#define CMT_DECODE_MSGPACK_UNEXPECTED_KEY_ERROR       CMT_MPACK_UNEXPECTED_KEY_ERROR
  |  |  ------------------
  |  |  |  |   32|    173|#define CMT_MPACK_UNEXPECTED_KEY_ERROR       9
  |  |  ------------------
  ------------------
  |  Branch (97:9): [True: 0, False: 249]
  ------------------
   98|    249|        case CMT_DECODE_MSGPACK_UNEXPECTED_DATA_TYPE_ERROR:
  ------------------
  |  |   37|    249|#define CMT_DECODE_MSGPACK_UNEXPECTED_DATA_TYPE_ERROR CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR
  |  |  ------------------
  |  |  |  |   33|    249|#define CMT_MPACK_UNEXPECTED_DATA_TYPE_ERROR 10
  |  |  ------------------
  ------------------
  |  Branch (98:9): [True: 76, False: 173]
  ------------------
   99|    249|        case CMT_DECODE_MSGPACK_DICTIONARY_LOOKUP_ERROR:
  ------------------
  |  |   39|    249|#define CMT_DECODE_MSGPACK_DICTIONARY_LOOKUP_ERROR    CMT_MPACK_ERROR_CUTOFF + 1
  |  |  ------------------
  |  |  |  |   34|    249|#define CMT_MPACK_ERROR_CUTOFF               20
  |  |  ------------------
  ------------------
  |  Branch (99:9): [True: 0, False: 249]
  ------------------
  100|    249|        case CMT_DECODE_MSGPACK_VERSION_ERROR:
  ------------------
  |  |   40|    249|#define CMT_DECODE_MSGPACK_VERSION_ERROR              CMT_MPACK_ERROR_CUTOFF + 2
  |  |  ------------------
  |  |  |  |   34|    249|#define CMT_MPACK_ERROR_CUTOFF               20
  |  |  ------------------
  ------------------
  |  Branch (100:9): [True: 0, False: 249]
  ------------------
  101|    249|            goto error;
  102|    249|    }
  103|       |
  104|      0|    if (ret == CMT_DECODE_MSGPACK_INSUFFICIENT_DATA && off == bytes) {
  ------------------
  |  |   28|      0|#define CMT_DECODE_MSGPACK_INSUFFICIENT_DATA          CMT_MPACK_INSUFFICIENT_DATA
  |  |  ------------------
  |  |  |  |   24|      0|#define CMT_MPACK_INSUFFICIENT_DATA          1
  |  |  ------------------
  ------------------
  |  Branch (104:9): [True: 0, False: 0]
  |  Branch (104:56): [True: 0, False: 0]
  ------------------
  105|      0|        *out_series = count;
  106|      0|        *processed_bytes = pre_off;
  107|      0|        return 0;
  108|      0|    }
  109|       |
  110|    249|error:
  111|    249|    *out_series = count;
  112|    249|    *processed_bytes = pre_off;
  113|       |
  114|    249|    return -1;
  115|      0|}
flb_mp_validate_log_chunk:
  119|     43|{
  120|     43|    int ret;
  121|     43|    int count = 0;
  122|     43|    size_t off = 0;
  123|     43|    size_t pre_off = 0;
  124|     43|    size_t ptr_size;
  125|     43|    unsigned char *ptr;
  126|     43|    msgpack_object array;
  127|     43|    msgpack_object ts;
  128|     43|    msgpack_object header;
  129|     43|    msgpack_object record;
  130|     43|    msgpack_object metadata;
  131|     43|    msgpack_unpacked result;
  132|       |
  133|     43|    msgpack_unpacked_init(&result);
  134|    514|    while (msgpack_unpack_next(&result, data, bytes, &off) == MSGPACK_UNPACK_SUCCESS) {
  ------------------
  |  Branch (134:12): [True: 490, False: 24]
  ------------------
  135|    490|        array = result.data;
  136|       |
  137|    490|        if (array.type != MSGPACK_OBJECT_ARRAY) {
  ------------------
  |  Branch (137:13): [True: 12, False: 478]
  ------------------
  138|       |            /*
  139|       |             * Sometimes there is a special case: Chunks might have extra zero
  140|       |             * bytes at the end of a record, meaning: no more records. This is not
  141|       |             * an error and actually it happens if a previous run of Fluent Bit
  142|       |             * was stopped/killed before to adjust the file size.
  143|       |             *
  144|       |             * Just validate if all bytes are zero, if so, adjust counters
  145|       |             * and return zero.
  146|       |             */
  147|     12|            ptr = (unsigned char *) (data);
  148|     12|            ptr += pre_off;
  149|     12|            if (ptr[0] != 0) {
  ------------------
  |  Branch (149:17): [True: 8, False: 4]
  ------------------
  150|      8|                goto error;
  151|      8|            }
  152|       |
  153|      4|            ptr_size = bytes - pre_off;
  154|      4|            ret = memcmp(ptr, ptr + 1, ptr_size - 1);
  155|      4|            if (ret == 0) {
  ------------------
  |  Branch (155:17): [True: 0, False: 4]
  ------------------
  156|       |                /*
  157|       |                 * The chunk is valid, just let the caller know the last processed
  158|       |                 * valid byte.
  159|       |                 */
  160|      0|                msgpack_unpacked_destroy(&result);
  161|      0|                *out_records = count;
  162|      0|                *processed_bytes = pre_off;
  163|      0|                return 0;
  164|      0|            }
  165|      4|            goto error;
  166|      4|        }
  167|       |
  168|    478|        if (array.via.array.size != 2) {
  ------------------
  |  Branch (168:13): [True: 6, False: 472]
  ------------------
  169|      6|            goto error;
  170|      6|        }
  171|       |
  172|    472|        header = array.via.array.ptr[0];
  173|    472|        record = array.via.array.ptr[1];
  174|       |
  175|    472|        if (header.type == MSGPACK_OBJECT_ARRAY) {
  ------------------
  |  Branch (175:13): [True: 0, False: 472]
  ------------------
  176|      0|            if (header.via.array.size != 2) {
  ------------------
  |  Branch (176:17): [True: 0, False: 0]
  ------------------
  177|      0|                goto error;
  178|      0|            }
  179|       |
  180|      0|            ts = header.via.array.ptr[0];
  181|      0|            metadata = header.via.array.ptr[1];
  182|       |
  183|      0|            if (metadata.type != MSGPACK_OBJECT_MAP) {
  ------------------
  |  Branch (183:17): [True: 0, False: 0]
  ------------------
  184|      0|                goto error;
  185|      0|            }
  186|      0|        }
  187|    472|        else {
  188|    472|            ts = header;
  189|    472|        }
  190|       |
  191|    472|        if (ts.type != MSGPACK_OBJECT_POSITIVE_INTEGER &&
  ------------------
  |  Branch (191:13): [True: 287, False: 185]
  ------------------
  192|    472|            ts.type != MSGPACK_OBJECT_FLOAT &&
  ------------------
  |  Branch (192:13): [True: 287, False: 0]
  ------------------
  193|    472|            ts.type != MSGPACK_OBJECT_EXT) {
  ------------------
  |  Branch (193:13): [True: 0, False: 287]
  ------------------
  194|      0|            goto error;
  195|      0|        }
  196|       |
  197|    472|        if (record.type != MSGPACK_OBJECT_MAP) {
  ------------------
  |  Branch (197:13): [True: 1, False: 471]
  ------------------
  198|      1|            goto error;
  199|      1|        }
  200|       |
  201|    471|        count++;
  202|    471|        pre_off = off;
  203|    471|    }
  204|       |
  205|     24|    msgpack_unpacked_destroy(&result);
  206|     24|    *out_records = count;
  207|     24|    *processed_bytes = pre_off;
  208|     24|    return 0;
  209|       |
  210|     19| error:
  211|     19|    msgpack_unpacked_destroy(&result);
  212|     19|    *out_records = count;
  213|     19|    *processed_bytes = pre_off;
  214|       |
  215|     19|    return -1;
  216|     43|}

LLVMFuzzerTestOneInput:
   27|    292|{
   28|       |    /* Set flb_malloc_mod to be fuzzer-data dependent */
   29|    292|    if (size < 5) {
  ------------------
  |  Branch (29:9): [True: 0, False: 292]
  ------------------
   30|      0|        return 0;
   31|      0|    }
   32|    292|    flb_malloc_p = 0;
   33|    292|    flb_malloc_mod = *(int*)data;
   34|    292|    data += 4;
   35|    292|    size -= 4;
   36|       |
   37|       |    /* Avoid division by zero for modulo operations */
   38|    292|    if (flb_malloc_mod == 0) {
  ------------------
  |  Branch (38:9): [True: 2, False: 290]
  ------------------
   39|      2|        flb_malloc_mod = 1;
   40|      2|    }
   41|       |
   42|    292|    unsigned char decider = *data;
   43|    292|    data++;
   44|    292|    size--;
   45|       |
   46|    292|    int out_records;
   47|    292|    size_t processed_bytes;
   48|    292|    if (decider % 2 == 0) {
  ------------------
  |  Branch (48:9): [True: 43, False: 249]
  ------------------
   49|     43|      flb_mp_validate_log_chunk(data, size, &out_records, &processed_bytes);
   50|     43|    }
   51|    249|    else if (decider % 2 == 1) {
  ------------------
  |  Branch (51:14): [True: 249, False: 0]
  ------------------
   52|    249|        flb_mp_validate_metric_chunk(data, size, &out_records, &processed_bytes);
   53|    249|    }
   54|    292|    return 0;
   55|    292|}

