_Z14limited_mallocm:
   12|  80.2M|void *limited_malloc(size_t size) {
   13|  80.2M|    if (size + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (13:9): [True: 74, False: 80.2M]
  ------------------
   14|     74|        return nullptr;
   15|     74|    }
   16|  80.2M|    if (size == 0) {
  ------------------
  |  Branch (16:9): [True: 85, False: 80.2M]
  ------------------
   17|     85|        return nullptr;
   18|     85|    }
   19|  80.2M|    void* m = malloc(size);
   20|  80.2M|    if (m != nullptr) {
  ------------------
  |  Branch (20:9): [True: 80.2M, False: 0]
  ------------------
   21|  80.2M|        allocated_mem += size;
   22|  80.2M|        allocated_len_map[m] = size;
   23|  80.2M|    }
   24|  80.2M|    return m;
   25|  80.2M|}
_Z12limited_freePv:
   27|  80.6M|void limited_free(void *ptr) {
   28|  80.6M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (28:9): [True: 80.2M, False: 342k]
  |  Branch (28:9): [True: 0, False: 80.6M]
  |  Branch (28:24): [True: 0, False: 80.2M]
  ------------------
   29|      0|        abort();
   30|      0|    }
   31|  80.6M|    free(ptr);
   32|  80.6M|    if (ptr != NULL) {
  ------------------
  |  Branch (32:9): [True: 80.2M, False: 342k]
  ------------------
   33|  80.2M|        allocated_mem -= allocated_len_map[ptr];
   34|  80.2M|        allocated_len_map.erase(ptr);
   35|  80.2M|    }
   36|  80.6M|}
_Z15limited_reallocPvm:
   38|  2.88M|void *limited_realloc(void *ptr, size_t size) {
   39|  2.88M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (39:9): [True: 1.86M, False: 1.01M]
  |  Branch (39:9): [True: 0, False: 2.88M]
  |  Branch (39:24): [True: 0, False: 1.86M]
  ------------------
   40|      0|        abort();
   41|      0|    }
   42|  2.88M|    if (ptr == NULL) {
  ------------------
  |  Branch (42:9): [True: 1.01M, False: 1.86M]
  ------------------
   43|  1.01M|        return limited_malloc(size);
   44|  1.01M|    }
   45|  1.86M|    long delta = (long) size - allocated_len_map[ptr];
   46|  1.86M|    if (delta + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (46:9): [True: 1, False: 1.86M]
  ------------------
   47|      1|        return nullptr;
   48|      1|    }
   49|  1.86M|    void* new_ptr = realloc(ptr, size);
   50|  1.86M|    if (size > 0 && new_ptr == nullptr) {
  ------------------
  |  Branch (50:9): [True: 1.86M, False: 0]
  |  Branch (50:21): [True: 0, False: 1.86M]
  ------------------
   51|      0|        return nullptr;
   52|      0|    }
   53|  1.86M|    allocated_mem += delta;
   54|  1.86M|    allocated_len_map.erase(ptr);
   55|  1.86M|    if (size > 0) {
  ------------------
  |  Branch (55:9): [True: 1.86M, False: 0]
  ------------------
   56|  1.86M|        allocated_len_map[new_ptr] = size;
   57|  1.86M|    }
   58|  1.86M|    return new_ptr;
   59|  1.86M|}
LLVMFuzzerTestOneInput:
   71|  3.77k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   72|  3.77k|    cbor_load_result result;
   73|  3.77k|    cbor_item_t *item = cbor_load(Data, Size, &result);
   74|  3.77k|    if (result.error.code == CBOR_ERR_NONE) {
  ------------------
  |  Branch (74:9): [True: 1.35k, False: 2.41k]
  ------------------
   75|  1.35k|        cbor_describe(item, kState.fout);
   76|  1.35k|        unsigned char *buffer;
   77|  1.35k|        size_t buffer_size;
   78|  1.35k|        cbor_serialize_alloc(item, &buffer, &buffer_size);
   79|  1.35k|        free(buffer);
   80|  1.35k|        cbor_item_t *copied = cbor_copy(item);
   81|  1.35k|        cbor_decref(&copied);
   82|  1.35k|        cbor_decref(&item);
   83|  1.35k|    }
   84|  3.77k|    return 0;
   85|  3.77k|}
_ZN5StateC2Ev:
   64|      2|    State() : fout(fopen("/dev/null", "r")) {
   65|      2|        cbor_set_allocs(limited_malloc, limited_realloc, limited_free);
   66|      2|    }

cbor_set_allocs:
   15|      2|                     _cbor_realloc_t custom_realloc, _cbor_free_t custom_free) {
   16|      2|  _cbor_malloc = custom_malloc;
   17|      2|  _cbor_realloc = custom_realloc;
   18|      2|  _cbor_free = custom_free;
   19|      2|}

cbor_load:
   14|  3.77k|                       struct cbor_load_result *result) {
   15|       |  /* Context stack */
   16|  3.77k|  static struct cbor_callbacks callbacks = {
   17|  3.77k|      .uint8 = &cbor_builder_uint8_callback,
   18|  3.77k|      .uint16 = &cbor_builder_uint16_callback,
   19|  3.77k|      .uint32 = &cbor_builder_uint32_callback,
   20|  3.77k|      .uint64 = &cbor_builder_uint64_callback,
   21|       |
   22|  3.77k|      .negint8 = &cbor_builder_negint8_callback,
   23|  3.77k|      .negint16 = &cbor_builder_negint16_callback,
   24|  3.77k|      .negint32 = &cbor_builder_negint32_callback,
   25|  3.77k|      .negint64 = &cbor_builder_negint64_callback,
   26|       |
   27|  3.77k|      .byte_string = &cbor_builder_byte_string_callback,
   28|  3.77k|      .byte_string_start = &cbor_builder_byte_string_start_callback,
   29|       |
   30|  3.77k|      .string = &cbor_builder_string_callback,
   31|  3.77k|      .string_start = &cbor_builder_string_start_callback,
   32|       |
   33|  3.77k|      .array_start = &cbor_builder_array_start_callback,
   34|  3.77k|      .indef_array_start = &cbor_builder_indef_array_start_callback,
   35|       |
   36|  3.77k|      .map_start = &cbor_builder_map_start_callback,
   37|  3.77k|      .indef_map_start = &cbor_builder_indef_map_start_callback,
   38|       |
   39|  3.77k|      .tag = &cbor_builder_tag_callback,
   40|       |
   41|  3.77k|      .null = &cbor_builder_null_callback,
   42|  3.77k|      .undefined = &cbor_builder_undefined_callback,
   43|  3.77k|      .boolean = &cbor_builder_boolean_callback,
   44|  3.77k|      .float2 = &cbor_builder_float2_callback,
   45|  3.77k|      .float4 = &cbor_builder_float4_callback,
   46|  3.77k|      .float8 = &cbor_builder_float8_callback,
   47|  3.77k|      .indef_break = &cbor_builder_indef_break_callback};
   48|       |
   49|  3.77k|  if (source_size == 0) {
  ------------------
  |  Branch (49:7): [True: 0, False: 3.77k]
  ------------------
   50|      0|    result->error.code = CBOR_ERR_NODATA;
   51|      0|    return NULL;
   52|      0|  }
   53|  3.77k|  struct _cbor_stack stack = _cbor_stack_init();
   54|       |
   55|       |  /* Target for callbacks */
   56|  3.77k|  struct _cbor_decoder_context context = (struct _cbor_decoder_context){
   57|  3.77k|      .stack = &stack, .creation_failed = false, .syntax_error = false};
   58|  3.77k|  struct cbor_decoder_result decode_result;
   59|  3.77k|  *result =
   60|  3.77k|      (struct cbor_load_result){.read = 0, .error = {.code = CBOR_ERR_NONE}};
   61|       |
   62|  30.5M|  do {
   63|  30.5M|    if (source_size > result->read) { /* Check for overflows */
  ------------------
  |  Branch (63:9): [True: 30.5M, False: 1.44k]
  ------------------
   64|  30.5M|      decode_result =
   65|  30.5M|          cbor_stream_decode(source + result->read, source_size - result->read,
   66|  30.5M|                             &callbacks, &context);
   67|  30.5M|    } else {
   68|  1.44k|      result->error = (struct cbor_error){.code = CBOR_ERR_NOTENOUGHDATA,
   69|  1.44k|                                          .position = result->read};
   70|  1.44k|      goto error;
   71|  1.44k|    }
   72|       |
   73|  30.5M|    switch (decode_result.status) {
  ------------------
  |  Branch (73:13): [True: 0, False: 30.5M]
  ------------------
   74|  30.5M|      case CBOR_DECODER_FINISHED:
  ------------------
  |  Branch (74:7): [True: 30.5M, False: 618]
  ------------------
   75|       |        /* Everything OK */
   76|  30.5M|        {
   77|  30.5M|          result->read += decode_result.read;
   78|  30.5M|          break;
   79|      0|        }
   80|    550|      case CBOR_DECODER_NEDATA:
  ------------------
  |  Branch (80:7): [True: 550, False: 30.5M]
  ------------------
   81|       |        /* Data length doesn't match MTB expectation */
   82|    550|        {
   83|    550|          result->error.code = CBOR_ERR_NOTENOUGHDATA;
   84|    550|          goto error;
   85|      0|        }
   86|     68|      case CBOR_DECODER_ERROR:
  ------------------
  |  Branch (86:7): [True: 68, False: 30.5M]
  ------------------
   87|       |        /* Reserved/malformed item */
   88|     68|        {
   89|     68|          result->error.code = CBOR_ERR_MALFORMATED;
   90|     68|          goto error;
   91|      0|        }
   92|  30.5M|    }
   93|       |
   94|  30.5M|    if (context.creation_failed) {
  ------------------
  |  Branch (94:9): [True: 247, False: 30.5M]
  ------------------
   95|       |      /* Most likely unsuccessful allocation - our callback has failed */
   96|    247|      result->error.code = CBOR_ERR_MEMERROR;
   97|    247|      goto error;
   98|  30.5M|    } else if (context.syntax_error) {
  ------------------
  |  Branch (98:16): [True: 111, False: 30.5M]
  ------------------
   99|    111|      result->error.code = CBOR_ERR_SYNTAXERROR;
  100|    111|      goto error;
  101|    111|    }
  102|  30.5M|  } while (stack.size > 0);
  ------------------
  |  Branch (102:12): [True: 30.5M, False: 1.35k]
  ------------------
  103|       |
  104|  1.35k|  return context.root;
  105|       |
  106|  2.41k|error:
  107|  2.41k|  result->error.position = result->read;
  108|       |  // debug_print("Failed with decoder error %d at %d\n", result->error.code,
  109|       |  // result->error.position); cbor_describe(stack.top->item, stdout);
  110|       |  /* Free the stack */
  111|  87.7k|  while (stack.size > 0) {
  ------------------
  |  Branch (111:10): [True: 85.3k, False: 2.41k]
  ------------------
  112|  85.3k|    cbor_decref(&stack.top->item);
  113|  85.3k|    _cbor_stack_pop(&stack);
  114|  85.3k|  }
  115|  2.41k|  return NULL;
  116|  3.77k|}
cbor_copy:
  154|  20.0M|cbor_item_t *cbor_copy(cbor_item_t *item) {
  155|       |  // cppcheck-suppress missingReturn
  156|  20.0M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (156:11): [True: 0, False: 20.0M]
  ------------------
  157|  8.38M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (157:5): [True: 8.38M, False: 11.6M]
  ------------------
  158|  8.38M|      return _cbor_copy_int(item, false);
  159|   998k|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (159:5): [True: 998k, False: 19.0M]
  ------------------
  160|   998k|      return _cbor_copy_int(item, true);
  161|   524k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (161:5): [True: 524k, False: 19.4M]
  ------------------
  162|   524k|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (162:11): [True: 523k, False: 466]
  ------------------
  163|   523k|        return cbor_build_bytestring(cbor_bytestring_handle(item),
  164|   523k|                                     cbor_bytestring_length(item));
  165|   523k|      } else {
  166|    466|        cbor_item_t *res = cbor_new_indefinite_bytestring();
  167|    466|        if (res == NULL) {
  ------------------
  |  Branch (167:13): [True: 0, False: 466]
  ------------------
  168|      0|          return NULL;
  169|      0|        }
  170|       |
  171|   275k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (171:28): [True: 275k, False: 466]
  ------------------
  172|   275k|          cbor_item_t *chunk_copy =
  173|   275k|              cbor_copy(cbor_bytestring_chunks_handle(item)[i]);
  174|   275k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (174:15): [True: 0, False: 275k]
  ------------------
  175|      0|            cbor_decref(&res);
  176|      0|            return NULL;
  177|      0|          }
  178|   275k|          if (!cbor_bytestring_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (178:15): [True: 0, False: 275k]
  ------------------
  179|      0|            cbor_decref(&chunk_copy);
  180|      0|            cbor_decref(&res);
  181|      0|            return NULL;
  182|      0|          }
  183|   275k|          cbor_decref(&chunk_copy);
  184|   275k|        }
  185|    466|        return res;
  186|    466|      }
  187|   570k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (187:5): [True: 570k, False: 19.4M]
  ------------------
  188|   570k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (188:11): [True: 561k, False: 8.49k]
  ------------------
  189|   561k|        return cbor_build_stringn((const char *)cbor_string_handle(item),
  190|   561k|                                  cbor_string_length(item));
  191|   561k|      } else {
  192|  8.49k|        cbor_item_t *res = cbor_new_indefinite_string();
  193|  8.49k|        if (res == NULL) {
  ------------------
  |  Branch (193:13): [True: 0, False: 8.49k]
  ------------------
  194|      0|          return NULL;
  195|      0|        }
  196|       |
  197|   538k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (197:28): [True: 530k, False: 8.49k]
  ------------------
  198|   530k|          cbor_item_t *chunk_copy =
  199|   530k|              cbor_copy(cbor_string_chunks_handle(item)[i]);
  200|   530k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (200:15): [True: 0, False: 530k]
  ------------------
  201|      0|            cbor_decref(&res);
  202|      0|            return NULL;
  203|      0|          }
  204|   530k|          if (!cbor_string_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (204:15): [True: 0, False: 530k]
  ------------------
  205|      0|            cbor_decref(&chunk_copy);
  206|      0|            cbor_decref(&res);
  207|      0|            return NULL;
  208|      0|          }
  209|   530k|          cbor_decref(&chunk_copy);
  210|   530k|        }
  211|  8.49k|        return res;
  212|  8.49k|      }
  213|  7.51M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (213:5): [True: 7.51M, False: 12.4M]
  ------------------
  214|  7.51M|      cbor_item_t *res;
  215|  7.51M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (215:11): [True: 7.06M, False: 449k]
  ------------------
  216|  7.06M|        res = cbor_new_definite_array(cbor_array_size(item));
  217|  7.06M|      } else {
  218|   449k|        res = cbor_new_indefinite_array();
  219|   449k|      }
  220|  7.51M|      if (res == NULL) {
  ------------------
  |  Branch (220:11): [True: 0, False: 7.51M]
  ------------------
  221|      0|        return NULL;
  222|      0|      }
  223|       |
  224|  24.7M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (224:26): [True: 17.2M, False: 7.51M]
  ------------------
  225|  17.2M|        cbor_item_t *entry_copy = cbor_copy(cbor_move(cbor_array_get(item, i)));
  226|  17.2M|        if (entry_copy == NULL) {
  ------------------
  |  Branch (226:13): [True: 0, False: 17.2M]
  ------------------
  227|      0|          cbor_decref(&res);
  228|      0|          return NULL;
  229|      0|        }
  230|  17.2M|        if (!cbor_array_push(res, entry_copy)) {
  ------------------
  |  Branch (230:13): [True: 0, False: 17.2M]
  ------------------
  231|      0|          cbor_decref(&entry_copy);
  232|      0|          cbor_decref(&res);
  233|      0|          return NULL;
  234|      0|        }
  235|  17.2M|        cbor_decref(&entry_copy);
  236|  17.2M|      }
  237|  7.51M|      return res;
  238|  7.51M|    }
  239|  37.9k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (239:5): [True: 37.9k, False: 19.9M]
  ------------------
  240|  37.9k|      cbor_item_t *res;
  241|  37.9k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (241:11): [True: 35.2k, False: 2.69k]
  ------------------
  242|  35.2k|        res = cbor_new_definite_map(cbor_map_size(item));
  243|  35.2k|      } else {
  244|  2.69k|        res = cbor_new_indefinite_map();
  245|  2.69k|      }
  246|  37.9k|      if (res == NULL) {
  ------------------
  |  Branch (246:11): [True: 0, False: 37.9k]
  ------------------
  247|      0|        return NULL;
  248|      0|      }
  249|       |
  250|  37.9k|      struct cbor_pair *it = cbor_map_handle(item);
  251|   941k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (251:26): [True: 903k, False: 37.9k]
  ------------------
  252|   903k|        cbor_item_t *key_copy = cbor_copy(it[i].key);
  253|   903k|        if (key_copy == NULL) {
  ------------------
  |  Branch (253:13): [True: 0, False: 903k]
  ------------------
  254|      0|          cbor_decref(&res);
  255|      0|          return NULL;
  256|      0|        }
  257|   903k|        cbor_item_t *value_copy = cbor_copy(it[i].value);
  258|   903k|        if (value_copy == NULL) {
  ------------------
  |  Branch (258:13): [True: 0, False: 903k]
  ------------------
  259|      0|          cbor_decref(&res);
  260|      0|          cbor_decref(&key_copy);
  261|      0|          return NULL;
  262|      0|        }
  263|   903k|        if (!cbor_map_add(res, (struct cbor_pair){.key = key_copy,
  ------------------
  |  Branch (263:13): [True: 0, False: 903k]
  ------------------
  264|   903k|                                                  .value = value_copy})) {
  265|      0|          cbor_decref(&res);
  266|      0|          cbor_decref(&key_copy);
  267|      0|          cbor_decref(&value_copy);
  268|      0|          return NULL;
  269|      0|        }
  270|   903k|        cbor_decref(&key_copy);
  271|   903k|        cbor_decref(&value_copy);
  272|   903k|      }
  273|  37.9k|      return res;
  274|  37.9k|    }
  275|   108k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (275:5): [True: 108k, False: 19.8M]
  ------------------
  276|   108k|      cbor_item_t *item_copy = cbor_copy(cbor_move(cbor_tag_item(item)));
  277|   108k|      if (item_copy == NULL) {
  ------------------
  |  Branch (277:11): [True: 0, False: 108k]
  ------------------
  278|      0|        return NULL;
  279|      0|      }
  280|   108k|      cbor_item_t *tag = cbor_build_tag(cbor_tag_value(item), item_copy);
  281|   108k|      cbor_decref(&item_copy);
  282|   108k|      return tag;
  283|   108k|    }
  284|  1.86M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (284:5): [True: 1.86M, False: 18.1M]
  ------------------
  285|  1.86M|      return _cbor_copy_float_ctrl(item);
  286|  20.0M|  }
  287|  20.0M|}
cbor_describe:
  421|  1.35k|void cbor_describe(cbor_item_t *item, FILE *out) {
  422|  1.35k|  _cbor_nested_describe(item, out, 0);
  423|  1.35k|}
cbor.c:_cbor_copy_int:
  118|  9.38M|static cbor_item_t *_cbor_copy_int(cbor_item_t *item, bool negative) {
  119|  9.38M|  cbor_item_t *res = NULL;
  120|  9.38M|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (120:11): [True: 0, False: 9.38M]
  ------------------
  121|  9.19M|    case CBOR_INT_8:
  ------------------
  |  Branch (121:5): [True: 9.19M, False: 192k]
  ------------------
  122|  9.19M|      res = cbor_build_uint8(cbor_get_uint8(item));
  123|  9.19M|      break;
  124|  27.7k|    case CBOR_INT_16:
  ------------------
  |  Branch (124:5): [True: 27.7k, False: 9.35M]
  ------------------
  125|  27.7k|      res = cbor_build_uint16(cbor_get_uint16(item));
  126|  27.7k|      break;
  127|   158k|    case CBOR_INT_32:
  ------------------
  |  Branch (127:5): [True: 158k, False: 9.22M]
  ------------------
  128|   158k|      res = cbor_build_uint32(cbor_get_uint32(item));
  129|   158k|      break;
  130|  6.07k|    case CBOR_INT_64:
  ------------------
  |  Branch (130:5): [True: 6.07k, False: 9.37M]
  ------------------
  131|  6.07k|      res = cbor_build_uint64(cbor_get_uint64(item));
  132|  6.07k|      break;
  133|  9.38M|  }
  134|       |
  135|  9.38M|  if (negative) cbor_mark_negint(res);
  ------------------
  |  Branch (135:7): [True: 998k, False: 8.38M]
  ------------------
  136|       |
  137|  9.38M|  return res;
  138|  9.38M|}
cbor.c:_cbor_copy_float_ctrl:
  140|  1.86M|static cbor_item_t *_cbor_copy_float_ctrl(cbor_item_t *item) {
  141|       |  // cppcheck-suppress missingReturn
  142|  1.86M|  switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (142:11): [True: 0, False: 1.86M]
  ------------------
  143|  1.78M|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (143:5): [True: 1.78M, False: 76.1k]
  ------------------
  144|  1.78M|      return cbor_build_ctrl(cbor_ctrl_value(item));
  145|  43.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (145:5): [True: 43.9k, False: 1.81M]
  ------------------
  146|  43.9k|      return cbor_build_float2(cbor_float_get_float2(item));
  147|  8.27k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (147:5): [True: 8.27k, False: 1.85M]
  ------------------
  148|  8.27k|      return cbor_build_float4(cbor_float_get_float4(item));
  149|  23.9k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (149:5): [True: 23.9k, False: 1.83M]
  ------------------
  150|  23.9k|      return cbor_build_float8(cbor_float_get_float8(item));
  151|  1.86M|  }
  152|  1.86M|}
cbor.c:_cbor_nested_describe:
  308|  20.0M|static void _cbor_nested_describe(cbor_item_t *item, FILE *out, int indent) {
  309|  20.0M|  const int indent_offset = 4;
  310|  20.0M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (310:11): [True: 0, False: 20.0M]
  ------------------
  311|  8.38M|    case CBOR_TYPE_UINT: {
  ------------------
  |  Branch (311:5): [True: 8.38M, False: 11.6M]
  ------------------
  312|  8.38M|      _cbor_type_marquee(out, "CBOR_TYPE_UINT", indent);
  313|  8.38M|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  314|  8.38M|      fprintf(out, "Value: %" PRIu64 "\n", cbor_get_int(item));
  315|  8.38M|      break;
  316|      0|    }
  317|   998k|    case CBOR_TYPE_NEGINT: {
  ------------------
  |  Branch (317:5): [True: 998k, False: 19.0M]
  ------------------
  318|   998k|      _cbor_type_marquee(out, "CBOR_TYPE_NEGINT", indent);
  319|   998k|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  320|   998k|      fprintf(out, "Value: -%" PRIu64 " - 1\n", cbor_get_int(item));
  321|   998k|      break;
  322|      0|    }
  323|   524k|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (323:5): [True: 524k, False: 19.4M]
  ------------------
  324|   524k|      _cbor_type_marquee(out, "CBOR_TYPE_BYTESTRING", indent);
  325|   524k|      if (cbor_bytestring_is_indefinite(item)) {
  ------------------
  |  Branch (325:11): [True: 466, False: 523k]
  ------------------
  326|    466|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  327|    466|                cbor_bytestring_chunk_count(item));
  328|   275k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (328:28): [True: 275k, False: 466]
  ------------------
  329|   275k|          _cbor_nested_describe(cbor_bytestring_chunks_handle(item)[i], out,
  330|   275k|                                indent + indent_offset);
  331|   523k|      } else {
  332|   523k|        const unsigned char *data = cbor_bytestring_handle(item);
  333|   523k|        fprintf(out, "Definite, Length: %zuB, Data:\n",
  334|   523k|                cbor_bytestring_length(item));
  335|   523k|        fprintf(out, "%*s", indent + indent_offset, " ");
  336|  3.50M|        for (size_t i = 0; i < cbor_bytestring_length(item); i++)
  ------------------
  |  Branch (336:28): [True: 2.98M, False: 523k]
  ------------------
  337|  2.98M|          fprintf(out, "%02x", (int)(data[i] & 0xff));
  338|   523k|        fprintf(out, "\n");
  339|   523k|      }
  340|   524k|      break;
  341|      0|    }
  342|   570k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (342:5): [True: 570k, False: 19.4M]
  ------------------
  343|   570k|      _cbor_type_marquee(out, "CBOR_TYPE_STRING", indent);
  344|   570k|      if (cbor_string_is_indefinite(item)) {
  ------------------
  |  Branch (344:11): [True: 8.49k, False: 561k]
  ------------------
  345|  8.49k|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  346|  8.49k|                cbor_string_chunk_count(item));
  347|   538k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (347:28): [True: 530k, False: 8.49k]
  ------------------
  348|   530k|          _cbor_nested_describe(cbor_string_chunks_handle(item)[i], out,
  349|   530k|                                indent + indent_offset);
  350|   561k|      } else {
  351|   561k|        fprintf(out, "Definite, Length: %zuB, Codepoints: %zu, Data:\n",
  352|   561k|                cbor_string_length(item), cbor_string_codepoint_count(item));
  353|   561k|        fprintf(out, "%*s", indent + indent_offset, " ");
  354|       |        // Note: The string is not escaped, whitespace and control character
  355|       |        // will be printed in verbatim and take effect.
  356|   561k|        fwrite(cbor_string_handle(item), sizeof(unsigned char),
  357|   561k|               cbor_string_length(item), out);
  358|   561k|        fprintf(out, "\n");
  359|   561k|      }
  360|   570k|      break;
  361|      0|    }
  362|  7.51M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (362:5): [True: 7.51M, False: 12.4M]
  ------------------
  363|  7.51M|      _cbor_type_marquee(out, "CBOR_TYPE_ARRAY", indent);
  364|  7.51M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (364:11): [True: 7.06M, False: 449k]
  ------------------
  365|  7.06M|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_array_size(item));
  366|  7.06M|      } else {
  367|   449k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n",
  368|   449k|                cbor_array_size(item));
  369|   449k|      }
  370|       |
  371|  24.7M|      for (size_t i = 0; i < cbor_array_size(item); i++)
  ------------------
  |  Branch (371:26): [True: 17.2M, False: 7.51M]
  ------------------
  372|  17.2M|        _cbor_nested_describe(cbor_array_handle(item)[i], out,
  373|  17.2M|                              indent + indent_offset);
  374|  7.51M|      break;
  375|      0|    }
  376|  37.9k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (376:5): [True: 37.9k, False: 19.9M]
  ------------------
  377|  37.9k|      _cbor_type_marquee(out, "CBOR_TYPE_MAP", indent);
  378|  37.9k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (378:11): [True: 35.2k, False: 2.69k]
  ------------------
  379|  35.2k|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_map_size(item));
  380|  35.2k|      } else {
  381|  2.69k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n", cbor_map_size(item));
  382|  2.69k|      }
  383|       |
  384|       |      // TODO: Label and group keys and values
  385|   941k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (385:26): [True: 903k, False: 37.9k]
  ------------------
  386|   903k|        fprintf(out, "%*sMap entry %zu\n", indent + indent_offset, " ", i);
  387|   903k|        _cbor_nested_describe(cbor_map_handle(item)[i].key, out,
  388|   903k|                              indent + 2 * indent_offset);
  389|   903k|        _cbor_nested_describe(cbor_map_handle(item)[i].value, out,
  390|   903k|                              indent + 2 * indent_offset);
  391|   903k|      }
  392|  37.9k|      break;
  393|      0|    }
  394|   108k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (394:5): [True: 108k, False: 19.8M]
  ------------------
  395|   108k|      _cbor_type_marquee(out, "CBOR_TYPE_TAG", indent);
  396|   108k|      fprintf(out, "Value: %" PRIu64 "\n", cbor_tag_value(item));
  397|   108k|      _cbor_nested_describe(cbor_move(cbor_tag_item(item)), out,
  398|   108k|                            indent + indent_offset);
  399|   108k|      break;
  400|      0|    }
  401|  1.86M|    case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (401:5): [True: 1.86M, False: 18.1M]
  ------------------
  402|  1.86M|      _cbor_type_marquee(out, "CBOR_TYPE_FLOAT_CTRL", indent);
  403|  1.86M|      if (cbor_float_ctrl_is_ctrl(item)) {
  ------------------
  |  Branch (403:11): [True: 1.78M, False: 76.1k]
  ------------------
  404|  1.78M|        if (cbor_is_bool(item))
  ------------------
  |  Branch (404:13): [True: 1.73M, False: 44.5k]
  ------------------
  405|  1.73M|          fprintf(out, "Bool: %s\n", cbor_get_bool(item) ? "true" : "false");
  ------------------
  |  Branch (405:38): [True: 1.67M, False: 65.9k]
  ------------------
  406|  44.5k|        else if (cbor_is_undef(item))
  ------------------
  |  Branch (406:18): [True: 28.5k, False: 16.0k]
  ------------------
  407|  28.5k|          fprintf(out, "Undefined\n");
  408|  16.0k|        else if (cbor_is_null(item))
  ------------------
  |  Branch (408:18): [True: 16.0k, False: 0]
  ------------------
  409|  16.0k|          fprintf(out, "Null\n");
  410|      0|        else
  411|      0|          fprintf(out, "Simple value: %d\n", cbor_ctrl_value(item));
  412|  1.78M|      } else {
  413|  76.1k|        fprintf(out, "Width: %dB, ", _pow(2, cbor_float_get_width(item)));
  414|  76.1k|        fprintf(out, "Value: %lf\n", cbor_float_get_float(item));
  415|  76.1k|      }
  416|  1.86M|      break;
  417|      0|    }
  418|  20.0M|  }
  419|  20.0M|}
cbor.c:_cbor_type_marquee:
  304|  20.0M|static void _cbor_type_marquee(FILE *out, char *label, int indent) {
  305|  20.0M|  fprintf(out, "%*.*s[%s] ", indent, indent, " ", label);
  306|  20.0M|}
cbor.c:_pow:
  297|  9.45M|static int _pow(int b, int ex) {
  298|  9.45M|  if (ex == 0) return 1;
  ------------------
  |  Branch (298:7): [True: 9.19M, False: 268k]
  ------------------
  299|   268k|  int res = b;
  300|   495k|  while (--ex > 0) res *= b;
  ------------------
  |  Branch (300:10): [True: 226k, False: 268k]
  ------------------
  301|   268k|  return res;
  302|  9.45M|}

cbor_array_size:
   12|   120M|size_t cbor_array_size(const cbor_item_t *item) {
   13|   120M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|   120M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   14|   120M|  return item->metadata.array_metadata.end_ptr;
   15|   120M|}
cbor_array_get:
   22|  17.2M|cbor_item_t *cbor_array_get(const cbor_item_t *item, size_t index) {
   23|  17.2M|  return cbor_incref(((cbor_item_t **)item->data)[index]);
   24|  17.2M|}
cbor_array_push:
   44|  41.8M|bool cbor_array_push(cbor_item_t *array, cbor_item_t *pushee) {
   45|  41.8M|  CBOR_ASSERT(cbor_isa_array(array));
  ------------------
  |  |   63|  41.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   46|  41.8M|  struct _cbor_array_metadata *metadata =
   47|  41.8M|      (struct _cbor_array_metadata *)&array->metadata;
   48|  41.8M|  cbor_item_t **data = (cbor_item_t **)array->data;
   49|  41.8M|  if (cbor_array_is_definite(array)) {
  ------------------
  |  Branch (49:7): [True: 17.0M, False: 24.7M]
  ------------------
   50|       |    /* Do not reallocate definite arrays */
   51|  17.0M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (51:9): [True: 0, False: 17.0M]
  ------------------
   52|      0|      return false;
   53|      0|    }
   54|  17.0M|    data[metadata->end_ptr++] = pushee;
   55|  24.7M|  } else {
   56|       |    /* Exponential realloc */
   57|  24.7M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (57:9): [True: 2.87M, False: 21.9M]
  ------------------
   58|       |      // Check for overflows first
   59|  2.87M|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  2.87M|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (59:11): [True: 0, False: 2.87M]
  ------------------
   60|      0|        return false;
   61|      0|      }
   62|       |
   63|  2.87M|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (63:31): [True: 1.01M, False: 1.86M]
  ------------------
   64|  2.87M|                                  ? 1
   65|  2.87M|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  1.86M|#define CBOR_BUFFER_GROWTH 2
  ------------------
   66|       |
   67|  2.87M|      unsigned char *new_data = _cbor_realloc_multiple(
   68|  2.87M|          array->data, sizeof(cbor_item_t *), new_allocation);
   69|  2.87M|      if (new_data == NULL) {
  ------------------
  |  Branch (69:11): [True: 0, False: 2.87M]
  ------------------
   70|      0|        return false;
   71|      0|      }
   72|       |
   73|  2.87M|      array->data = new_data;
   74|  2.87M|      metadata->allocated = new_allocation;
   75|  2.87M|    }
   76|  24.7M|    ((cbor_item_t **)array->data)[metadata->end_ptr++] = pushee;
   77|  24.7M|  }
   78|  41.8M|  cbor_incref(pushee);
   79|  41.8M|  return true;
   80|  41.8M|}
cbor_array_is_definite:
   82|   104M|bool cbor_array_is_definite(const cbor_item_t *item) {
   83|   104M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|   104M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   84|   104M|  return item->metadata.array_metadata.type == _CBOR_METADATA_DEFINITE;
   85|   104M|}
cbor_array_is_indefinite:
   87|  1.45M|bool cbor_array_is_indefinite(const cbor_item_t *item) {
   88|  1.45M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|  1.45M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   89|  1.45M|  return item->metadata.array_metadata.type == _CBOR_METADATA_INDEFINITE;
   90|  1.45M|}
cbor_array_handle:
   92|  49.7M|cbor_item_t **cbor_array_handle(const cbor_item_t *item) {
   93|  49.7M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|  49.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   94|  49.7M|  return (cbor_item_t **)item->data;
   95|  49.7M|}
cbor_new_definite_array:
   97|  16.3M|cbor_item_t *cbor_new_definite_array(size_t size) {
   98|  16.3M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   99|  16.3M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  16.3M|  do {                           \
  |  |  107|  16.3M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 1, False: 16.3M]
  |  |  ------------------
  |  |  108|      1|      return NULL;               \
  |  |  109|      1|    }                            \
  |  |  110|  16.3M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  100|  16.3M|  cbor_item_t **data = _cbor_alloc_multiple(sizeof(cbor_item_t *), size);
  101|  16.3M|  _CBOR_DEPENDENT_NOTNULL(item, data);
  ------------------
  |  |  114|  16.3M|  do {                                              \
  |  |  115|  16.3M|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 73, False: 16.3M]
  |  |  ------------------
  |  |  116|     73|      _cbor_free(cbor_item);                        \
  |  |  117|     73|      return NULL;                                  \
  |  |  118|     73|    }                                               \
  |  |  119|  16.3M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  102|       |
  103|  3.29G|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (103:22): [True: 3.27G, False: 16.3M]
  ------------------
  104|  3.27G|    data[i] = NULL;
  105|  3.27G|  }
  106|       |
  107|  16.3M|  *item = (cbor_item_t){
  108|  16.3M|      .refcount = 1,
  109|  16.3M|      .type = CBOR_TYPE_ARRAY,
  110|  16.3M|      .metadata = {.array_metadata = {.type = _CBOR_METADATA_DEFINITE,
  111|  16.3M|                                      .allocated = size,
  112|  16.3M|                                      .end_ptr = 0}},
  113|  16.3M|      .data = (unsigned char *)data};
  114|       |
  115|  16.3M|  return item;
  116|  16.3M|}
cbor_new_indefinite_array:
  118|  1.01M|cbor_item_t *cbor_new_indefinite_array(void) {
  119|  1.01M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
  120|  1.01M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  1.01M|  do {                           \
  |  |  107|  1.01M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 1.01M]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  1.01M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|       |
  122|  1.01M|  *item = (cbor_item_t){
  123|  1.01M|      .refcount = 1,
  124|  1.01M|      .type = CBOR_TYPE_ARRAY,
  125|  1.01M|      .metadata = {.array_metadata = {.type = _CBOR_METADATA_INDEFINITE,
  126|  1.01M|                                      .allocated = 0,
  127|  1.01M|                                      .end_ptr = 0}},
  128|       |      .data = NULL /* Can be safely realloc-ed */
  129|  1.01M|  };
  130|  1.01M|  return item;
  131|  1.01M|}

cbor_bytestring_length:
   12|  6.64M|size_t cbor_bytestring_length(const cbor_item_t *item) {
   13|  6.64M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|  6.64M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   14|  6.64M|  return item->metadata.bytestring_metadata.length;
   15|  6.64M|}
cbor_bytestring_handle:
   17|  1.57M|unsigned char *cbor_bytestring_handle(const cbor_item_t *item) {
   18|  1.57M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|  1.57M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   19|  1.57M|  return item->data;
   20|  1.57M|}
cbor_bytestring_is_definite:
   22|  9.69M|bool cbor_bytestring_is_definite(const cbor_item_t *item) {
   23|  9.69M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|  9.69M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   24|  9.69M|  return item->metadata.bytestring_metadata.type == _CBOR_METADATA_DEFINITE;
   25|  9.69M|}
cbor_bytestring_is_indefinite:
   27|  4.36M|bool cbor_bytestring_is_indefinite(const cbor_item_t *item) {
   28|  4.36M|  return !cbor_bytestring_is_definite(item);
   29|  4.36M|}
cbor_new_definite_bytestring:
   31|  1.41M|cbor_item_t *cbor_new_definite_bytestring(void) {
   32|  1.41M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   33|  1.41M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  1.41M|  do {                           \
  |  |  107|  1.41M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 1.41M]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  1.41M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   34|  1.41M|  *item = (cbor_item_t){
   35|  1.41M|      .refcount = 1,
   36|  1.41M|      .type = CBOR_TYPE_BYTESTRING,
   37|  1.41M|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_DEFINITE,
   38|  1.41M|                                           .length = 0}}};
   39|  1.41M|  return item;
   40|  1.41M|}
cbor_new_indefinite_bytestring:
   42|  2.03k|cbor_item_t *cbor_new_indefinite_bytestring(void) {
   43|  2.03k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   44|  2.03k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  2.03k|  do {                           \
  |  |  107|  2.03k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 2.03k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  2.03k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   45|  2.03k|  *item = (cbor_item_t){
   46|  2.03k|      .refcount = 1,
   47|  2.03k|      .type = CBOR_TYPE_BYTESTRING,
   48|  2.03k|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_INDEFINITE,
   49|  2.03k|                                           .length = 0}},
   50|  2.03k|      .data = _cbor_malloc(sizeof(struct cbor_indefinite_string_data))};
   51|  2.03k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  114|  2.03k|  do {                                              \
  |  |  115|  2.03k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 0, False: 2.03k]
  |  |  ------------------
  |  |  116|      0|      _cbor_free(cbor_item);                        \
  |  |  117|      0|      return NULL;                                  \
  |  |  118|      0|    }                                               \
  |  |  119|  2.03k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   52|  2.03k|  *((struct cbor_indefinite_string_data *)item->data) =
   53|  2.03k|      (struct cbor_indefinite_string_data){
   54|  2.03k|          .chunk_count = 0,
   55|  2.03k|          .chunk_capacity = 0,
   56|  2.03k|          .chunks = NULL,
   57|  2.03k|      };
   58|  2.03k|  return item;
   59|  2.03k|}
cbor_build_bytestring:
   61|   523k|cbor_item_t *cbor_build_bytestring(cbor_data handle, size_t length) {
   62|   523k|  cbor_item_t *item = cbor_new_definite_bytestring();
   63|   523k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   523k|  do {                           \
  |  |  107|   523k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 523k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   523k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   64|   523k|  void *content = _cbor_malloc(length);
   65|   523k|  _CBOR_DEPENDENT_NOTNULL(item, content);
  ------------------
  |  |  114|   523k|  do {                                              \
  |  |  115|   523k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 0, False: 523k]
  |  |  ------------------
  |  |  116|      0|      _cbor_free(cbor_item);                        \
  |  |  117|      0|      return NULL;                                  \
  |  |  118|      0|    }                                               \
  |  |  119|   523k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   66|   523k|  memcpy(content, handle, length);
   67|   523k|  cbor_bytestring_set_handle(item, content, length);
   68|   523k|  return item;
   69|   523k|}
cbor_bytestring_set_handle:
   73|  1.41M|                                size_t length) {
   74|  1.41M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|  1.41M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   75|  1.41M|  CBOR_ASSERT(cbor_bytestring_is_definite(item));
  ------------------
  |  |   63|  1.41M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   76|  1.41M|  item->data = data;
   77|  1.41M|  item->metadata.bytestring_metadata.length = length;
   78|  1.41M|}
cbor_bytestring_chunks_handle:
   80|   553k|cbor_item_t **cbor_bytestring_chunks_handle(const cbor_item_t *item) {
   81|   553k|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|   553k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   82|   553k|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   63|   553k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   83|   553k|  return ((struct cbor_indefinite_string_data *)item->data)->chunks;
   84|   553k|}
cbor_bytestring_chunk_count:
   86|  1.74M|size_t cbor_bytestring_chunk_count(const cbor_item_t *item) {
   87|  1.74M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|  1.74M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   88|  1.74M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   63|  1.74M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   89|  1.74M|  return ((struct cbor_indefinite_string_data *)item->data)->chunk_count;
   90|  1.74M|}
cbor_bytestring_add_chunk:
   92|   911k|bool cbor_bytestring_add_chunk(cbor_item_t *item, cbor_item_t *chunk) {
   93|   911k|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|   911k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   94|   911k|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   63|   911k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   95|   911k|  CBOR_ASSERT(cbor_isa_bytestring(chunk));
  ------------------
  |  |   63|   911k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   96|   911k|  CBOR_ASSERT(cbor_bytestring_is_definite(chunk));
  ------------------
  |  |   63|   911k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   97|   911k|  struct cbor_indefinite_string_data *data =
   98|   911k|      (struct cbor_indefinite_string_data *)item->data;
   99|   911k|  if (data->chunk_count == data->chunk_capacity) {
  ------------------
  |  Branch (99:7): [True: 1.82k, False: 909k]
  ------------------
  100|  1.82k|    if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, data->chunk_capacity)) {
  ------------------
  |  |    8|  1.82k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (100:9): [True: 0, False: 1.82k]
  ------------------
  101|      0|      return false;
  102|      0|    }
  103|       |
  104|  1.82k|    size_t new_chunk_capacity =
  105|  1.82k|        data->chunk_capacity == 0 ? 1
  ------------------
  |  Branch (105:9): [True: 552, False: 1.26k]
  ------------------
  106|  1.82k|                                  : CBOR_BUFFER_GROWTH * (data->chunk_capacity);
  ------------------
  |  |    8|  1.26k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  107|       |
  108|  1.82k|    cbor_item_t **new_chunks_data = _cbor_realloc_multiple(
  109|  1.82k|        data->chunks, sizeof(cbor_item_t *), new_chunk_capacity);
  110|       |
  111|  1.82k|    if (new_chunks_data == NULL) {
  ------------------
  |  Branch (111:9): [True: 0, False: 1.82k]
  ------------------
  112|      0|      return false;
  113|      0|    }
  114|  1.82k|    data->chunk_capacity = new_chunk_capacity;
  115|  1.82k|    data->chunks = new_chunks_data;
  116|  1.82k|  }
  117|   911k|  data->chunks[data->chunk_count++] = cbor_incref(chunk);
  118|   911k|  return true;
  119|   911k|}

cbor_isa_uint:
   22|   213M|bool cbor_isa_uint(const cbor_item_t *item) {
   23|   213M|  return item->type == CBOR_TYPE_UINT;
   24|   213M|}
cbor_isa_negint:
   26|  18.8M|bool cbor_isa_negint(const cbor_item_t *item) {
   27|  18.8M|  return item->type == CBOR_TYPE_NEGINT;
   28|  18.8M|}
cbor_isa_bytestring:
   30|  24.8M|bool cbor_isa_bytestring(const cbor_item_t *item) {
   31|  24.8M|  return item->type == CBOR_TYPE_BYTESTRING;
   32|  24.8M|}
cbor_isa_string:
   34|  23.8M|bool cbor_isa_string(const cbor_item_t *item) {
   35|  23.8M|  return item->type == CBOR_TYPE_STRING;
   36|  23.8M|}
cbor_isa_array:
   38|   325M|bool cbor_isa_array(const cbor_item_t *item) {
   39|   325M|  return item->type == CBOR_TYPE_ARRAY;
   40|   325M|}
cbor_isa_map:
   42|  24.3M|bool cbor_isa_map(const cbor_item_t *item) {
   43|  24.3M|  return item->type == CBOR_TYPE_MAP;
   44|  24.3M|}
cbor_isa_tag:
   46|  1.25M|bool cbor_isa_tag(const cbor_item_t *item) {
   47|  1.25M|  return item->type == CBOR_TYPE_TAG;
   48|  1.25M|}
cbor_isa_float_ctrl:
   50|  51.2M|bool cbor_isa_float_ctrl(const cbor_item_t *item) {
   51|  51.2M|  return item->type == CBOR_TYPE_FLOAT_CTRL;
   52|  51.2M|}
cbor_typeof:
   54|  79.2M|cbor_type cbor_typeof(const cbor_item_t *item) { return item->type; }
cbor_is_int:
   56|   205M|bool cbor_is_int(const cbor_item_t *item) {
   57|   205M|  return cbor_isa_uint(item) || cbor_isa_negint(item);
  ------------------
  |  Branch (57:10): [True: 187M, False: 17.8M]
  |  Branch (57:33): [True: 17.8M, False: 0]
  ------------------
   58|   205M|}
cbor_is_bool:
   60|  3.52M|bool cbor_is_bool(const cbor_item_t *item) {
   61|  3.52M|  return cbor_isa_float_ctrl(item) &&
  ------------------
  |  Branch (61:10): [True: 3.52M, False: 0]
  ------------------
   62|  3.52M|         (cbor_ctrl_value(item) == CBOR_CTRL_FALSE ||
  ------------------
  |  Branch (62:11): [True: 131k, False: 3.39M]
  ------------------
   63|  3.52M|          cbor_ctrl_value(item) == CBOR_CTRL_TRUE);
  ------------------
  |  Branch (63:11): [True: 3.34M, False: 44.5k]
  ------------------
   64|  3.52M|}
cbor_is_null:
   66|  16.0k|bool cbor_is_null(const cbor_item_t *item) {
   67|  16.0k|  return cbor_isa_float_ctrl(item) && cbor_ctrl_value(item) == CBOR_CTRL_NULL;
  ------------------
  |  Branch (67:10): [True: 16.0k, False: 0]
  |  Branch (67:39): [True: 16.0k, False: 0]
  ------------------
   68|  16.0k|}
cbor_is_undef:
   70|  44.5k|bool cbor_is_undef(const cbor_item_t *item) {
   71|  44.5k|  return cbor_isa_float_ctrl(item) && cbor_ctrl_value(item) == CBOR_CTRL_UNDEF;
  ------------------
  |  Branch (71:10): [True: 44.5k, False: 0]
  |  Branch (71:39): [True: 28.5k, False: 16.0k]
  ------------------
   72|  44.5k|}
cbor_is_float:
   74|   477k|bool cbor_is_float(const cbor_item_t *item) {
   75|   477k|  return cbor_isa_float_ctrl(item) && !cbor_float_ctrl_is_ctrl(item);
  ------------------
  |  Branch (75:10): [True: 477k, False: 0]
  |  Branch (75:39): [True: 477k, False: 0]
  ------------------
   76|   477k|}
cbor_incref:
   78|  67.5M|cbor_item_t *cbor_incref(cbor_item_t *item) {
   79|  67.5M|  item->refcount++;
   80|  67.5M|  return item;
   81|  67.5M|}
cbor_decref:
   83|  99.8M|void cbor_decref(cbor_item_t **item_ref) {
   84|  99.8M|  cbor_item_t *item = *item_ref;
   85|  99.8M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   63|  99.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   86|  99.8M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (86:7): [True: 49.9M, False: 49.8M]
  ------------------
   87|  49.9M|    switch (item->type) {
  ------------------
  |  Branch (87:13): [True: 0, False: 49.9M]
  ------------------
   88|  21.4M|      case CBOR_TYPE_UINT:
  ------------------
  |  Branch (88:7): [True: 21.4M, False: 28.5M]
  ------------------
   89|       |        /* Fallthrough */
   90|  24.4M|      case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (90:7): [True: 2.94M, False: 47.0M]
  ------------------
   91|       |        /* Combined allocation, freeing the item suffices */
   92|  24.4M|        { break; }
   93|  1.42M|      case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (93:7): [True: 1.42M, False: 48.5M]
  ------------------
   94|  1.42M|        if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (94:13): [True: 1.41M, False: 2.03k]
  ------------------
   95|  1.41M|          _cbor_free(item->data);
   96|  1.41M|        } else {
   97|       |          /* We need to decref all chunks */
   98|  2.03k|          cbor_item_t **handle = cbor_bytestring_chunks_handle(item);
   99|   913k|          for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (99:30): [True: 911k, False: 2.03k]
  ------------------
  100|   911k|            cbor_decref(&handle[i]);
  101|  2.03k|          _cbor_free(
  102|  2.03k|              ((struct cbor_indefinite_string_data *)item->data)->chunks);
  103|  2.03k|          _cbor_free(item->data);
  104|  2.03k|        }
  105|  1.42M|        break;
  106|  21.4M|      }
  107|  1.24M|      case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (107:7): [True: 1.24M, False: 48.7M]
  ------------------
  108|  1.24M|        if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (108:13): [True: 1.21M, False: 27.7k]
  ------------------
  109|  1.21M|          _cbor_free(item->data);
  110|  1.21M|        } else {
  111|       |          /* We need to decref all chunks */
  112|  27.7k|          cbor_item_t **handle = cbor_string_chunks_handle(item);
  113|  1.12M|          for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (113:30): [True: 1.09M, False: 27.7k]
  ------------------
  114|  1.09M|            cbor_decref(&handle[i]);
  115|  27.7k|          _cbor_free(
  116|  27.7k|              ((struct cbor_indefinite_string_data *)item->data)->chunks);
  117|  27.7k|          _cbor_free(item->data);
  118|  27.7k|        }
  119|  1.24M|        break;
  120|  21.4M|      }
  121|  17.4M|      case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (121:7): [True: 17.4M, False: 32.5M]
  ------------------
  122|       |        /* Get all items and decref them */
  123|  17.4M|        cbor_item_t **handle = cbor_array_handle(item);
  124|  17.4M|        size_t size = cbor_array_size(item);
  125|  59.2M|        for (size_t i = 0; i < size; i++)
  ------------------
  |  Branch (125:28): [True: 41.8M, False: 17.4M]
  ------------------
  126|  41.8M|          if (handle[i] != NULL) cbor_decref(&handle[i]);
  ------------------
  |  Branch (126:15): [True: 41.8M, False: 0]
  ------------------
  127|  17.4M|        _cbor_free(item->data);
  128|  17.4M|        break;
  129|  21.4M|      }
  130|  98.1k|      case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (130:7): [True: 98.1k, False: 49.8M]
  ------------------
  131|  98.1k|        struct cbor_pair *handle = cbor_map_handle(item);
  132|  2.96M|        for (size_t i = 0; i < item->metadata.map_metadata.end_ptr;
  ------------------
  |  Branch (132:28): [True: 2.86M, False: 98.1k]
  ------------------
  133|  2.86M|             i++, handle++) {
  134|  2.86M|          cbor_decref(&handle->key);
  135|  2.86M|          if (handle->value != NULL) cbor_decref(&handle->value);
  ------------------
  |  Branch (135:15): [True: 2.86M, False: 569]
  ------------------
  136|  2.86M|        }
  137|  98.1k|        _cbor_free(item->data);
  138|  98.1k|        break;
  139|  21.4M|      }
  140|   299k|      case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (140:7): [True: 299k, False: 49.6M]
  ------------------
  141|   299k|        if (item->metadata.tag_metadata.tagged_item != NULL)
  ------------------
  |  Branch (141:13): [True: 277k, False: 22.3k]
  ------------------
  142|   277k|          cbor_decref(&item->metadata.tag_metadata.tagged_item);
  143|   299k|        _cbor_free(item->data);
  144|   299k|        break;
  145|  21.4M|      }
  146|  5.07M|      case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (146:7): [True: 5.07M, False: 44.8M]
  ------------------
  147|       |        /* Floats have combined allocation */
  148|  5.07M|        break;
  149|  21.4M|      }
  150|  49.9M|    }
  151|  49.9M|    _cbor_free(item);
  152|  49.9M|    *item_ref = NULL;
  153|  49.9M|  }
  154|  99.8M|}
cbor_move:
  160|  17.7M|cbor_item_t *cbor_move(cbor_item_t *item) {
  161|  17.7M|  item->refcount--;
  162|  17.7M|  return item;
  163|  17.7M|}

cbor_encode_uint8:
   12|  8.22M|                         size_t buffer_size) {
   13|  8.22M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x00);
   14|  8.22M|}
cbor_encode_uint16:
   17|  5.07k|                          size_t buffer_size) {
   18|  5.07k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x00);
   19|  5.07k|}
cbor_encode_uint32:
   22|   150k|                          size_t buffer_size) {
   23|   150k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x00);
   24|   150k|}
cbor_encode_uint64:
   27|  4.36k|                          size_t buffer_size) {
   28|  4.36k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x00);
   29|  4.36k|}
cbor_encode_negint8:
   37|   966k|                           size_t buffer_size) {
   38|   966k|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x20);
   39|   966k|}
cbor_encode_negint16:
   42|  22.7k|                            size_t buffer_size) {
   43|  22.7k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x20);
   44|  22.7k|}
cbor_encode_negint32:
   47|  7.67k|                            size_t buffer_size) {
   48|  7.67k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x20);
   49|  7.67k|}
cbor_encode_negint64:
   52|  1.71k|                            size_t buffer_size) {
   53|  1.71k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x20);
   54|  1.71k|}
cbor_encode_bytestring_start:
   62|   523k|                                    size_t buffer_size) {
   63|   523k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x40);
   64|   523k|}
_cbor_encode_byte:
   67|   921k|                         size_t buffer_size) {
   68|   921k|  if (buffer_size >= 1) {
  ------------------
  |  Branch (68:7): [True: 921k, False: 0]
  ------------------
   69|   921k|    buffer[0] = value;
   70|   921k|    return 1;
   71|   921k|  } else
   72|      0|    return 0;
   73|   921k|}
cbor_encode_indef_bytestring_start:
   76|    466|                                          size_t buffer_size) {
   77|    466|  return _cbor_encode_byte(0x5F, buffer, buffer_size);
   78|    466|}
cbor_encode_string_start:
   81|   561k|                                size_t buffer_size) {
   82|   561k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x60);
   83|   561k|}
cbor_encode_indef_string_start:
   86|  8.49k|                                      size_t buffer_size) {
   87|  8.49k|  return _cbor_encode_byte(0x7F, buffer, buffer_size);
   88|  8.49k|}
cbor_encode_array_start:
   91|  7.06M|                               size_t buffer_size) {
   92|  7.06M|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x80);
   93|  7.06M|}
cbor_encode_indef_array_start:
   96|   449k|                                     size_t buffer_size) {
   97|   449k|  return _cbor_encode_byte(0x9F, buffer, buffer_size);
   98|   449k|}
cbor_encode_map_start:
  101|  35.2k|                             size_t buffer_size) {
  102|  35.2k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0xA0);
  103|  35.2k|}
cbor_encode_indef_map_start:
  105|  2.69k|size_t cbor_encode_indef_map_start(unsigned char *buffer, size_t buffer_size) {
  106|  2.69k|  return _cbor_encode_byte(0xBF, buffer, buffer_size);
  107|  2.69k|}
cbor_encode_tag:
  110|   108k|                       size_t buffer_size) {
  111|   108k|  return _cbor_encode_uint(value, buffer, buffer_size, 0xC0);
  112|   108k|}
cbor_encode_half:
  128|  43.9k|                        size_t buffer_size) {
  129|       |  /* Assuming value is normalized */
  130|  43.9k|  uint32_t val = ((union _cbor_float_helper){.as_float = value}).as_uint;
  131|  43.9k|  uint16_t res;
  132|  43.9k|  uint8_t exp = (uint8_t)((val & 0x7F800000u) >>
  133|  43.9k|                          23u); /* 0b0111_1111_1000_0000_0000_0000_0000_0000 */
  134|  43.9k|  uint32_t mant =
  135|  43.9k|      val & 0x7FFFFFu; /* 0b0000_0000_0111_1111_1111_1111_1111_1111 */
  136|  43.9k|  if (exp == 0xFF) {   /* Infinity or NaNs */
  ------------------
  |  Branch (136:7): [True: 2.75k, False: 41.1k]
  ------------------
  137|  2.75k|    if (value != value) {
  ------------------
  |  Branch (137:9): [True: 1.91k, False: 840]
  ------------------
  138|       |      // We discard information bits in half-float NaNs. This is
  139|       |      // not required for the core CBOR protocol (it is only a suggestion in
  140|       |      // Section 3.9).
  141|       |      // See https://github.com/PJK/libcbor/issues/215
  142|  1.91k|      res = (uint16_t)0x007e00;
  143|  1.91k|    } else {
  144|       |      // If the mantissa is non-zero, we have a NaN, but those are handled
  145|       |      // above. See
  146|       |      // https://en.wikipedia.org/wiki/Half-precision_floating-point_format
  147|    840|      CBOR_ASSERT(mant == 0u);
  ------------------
  |  |   63|    840|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  148|    840|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u);
  149|    840|    }
  150|  41.1k|  } else if (exp == 0x00) { /* Zeroes or subnorms */
  ------------------
  |  Branch (150:14): [True: 306, False: 40.8k]
  ------------------
  151|    306|    res = (uint16_t)((val & 0x80000000u) >> 16u | mant >> 13u);
  152|  40.8k|  } else { /* Normal numbers */
  153|  40.8k|    int8_t logical_exp = (int8_t)(exp - 127);
  154|  40.8k|    CBOR_ASSERT(logical_exp == exp - 127);
  ------------------
  |  |   63|  40.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  155|       |
  156|       |    // Now we know that 2^exp <= 0 logically
  157|  40.8k|    if (logical_exp < -24) {
  ------------------
  |  Branch (157:9): [True: 0, False: 40.8k]
  ------------------
  158|       |      /* No unambiguous representation exists, this float is not a half float
  159|       |         and is too small to be represented using a half, round off to zero.
  160|       |         Consistent with the reference implementation. */
  161|      0|      res = 0;
  162|  40.8k|    } else if (logical_exp < -14) {
  ------------------
  |  Branch (162:16): [True: 8.52k, False: 32.3k]
  ------------------
  163|       |      /* Offset the remaining decimal places by shifting the significand, the
  164|       |         value is lost. This is an implementation decision that works around the
  165|       |         absence of standard half-float in the language. */
  166|  8.52k|      res = (uint16_t)((val & 0x80000000u) >> 16u) |  // Extract sign bit
  167|  8.52k|            ((uint16_t)(1u << (24u + logical_exp)) +
  168|  8.52k|             (uint16_t)(((mant >> (-logical_exp - 2)) + 1) >>
  169|  8.52k|                        1));  // Round half away from zero for simplicity
  170|  32.3k|    } else {
  171|  32.3k|      res = (uint16_t)((val & 0x80000000u) >> 16u |
  172|  32.3k|                       ((((uint8_t)logical_exp) + 15u) << 10u) |
  173|  32.3k|                       (uint16_t)(mant >> 13u));
  174|  32.3k|    }
  175|  40.8k|  }
  176|  43.9k|  return _cbor_encode_uint16(res, buffer, buffer_size, 0xE0);
  177|  43.9k|}
cbor_encode_single:
  180|  8.27k|                          size_t buffer_size) {
  181|  8.27k|  return _cbor_encode_uint32(
  182|  8.27k|      ((union _cbor_float_helper){.as_float = value}).as_uint, buffer,
  183|  8.27k|      buffer_size, 0xE0);
  184|  8.27k|}
cbor_encode_double:
  187|  23.9k|                          size_t buffer_size) {
  188|  23.9k|  return _cbor_encode_uint64(
  189|  23.9k|      ((union _cbor_double_helper){.as_double = value}).as_uint, buffer,
  190|  23.9k|      buffer_size, 0xE0);
  191|  23.9k|}
cbor_encode_break:
  193|   460k|size_t cbor_encode_break(unsigned char *buffer, size_t buffer_size) {
  194|   460k|  return _cbor_encode_byte(0xFF, buffer, buffer_size);
  195|   460k|}
cbor_encode_ctrl:
  198|  1.78M|                        size_t buffer_size) {
  199|  1.78M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0xE0);
  200|  1.78M|}

cbor_float_get_width:
   12|  25.7M|cbor_float_width cbor_float_get_width(const cbor_item_t *item) {
   13|  25.7M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  25.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   14|  25.7M|  return item->metadata.float_ctrl_metadata.width;
   15|  25.7M|}
cbor_ctrl_value:
   17|  12.3M|uint8_t cbor_ctrl_value(const cbor_item_t *item) {
   18|  12.3M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  12.3M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   19|  12.3M|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_0);
  ------------------
  |  |   63|  12.3M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   20|  12.3M|  return item->metadata.float_ctrl_metadata.ctrl;
   21|  12.3M|}
cbor_float_ctrl_is_ctrl:
   23|  2.33M|bool cbor_float_ctrl_is_ctrl(const cbor_item_t *item) {
   24|  2.33M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  2.33M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   25|  2.33M|  return cbor_float_get_width(item) == CBOR_FLOAT_0;
   26|  2.33M|}
cbor_float_get_float2:
   28|   131k|float cbor_float_get_float2(const cbor_item_t *item) {
   29|   131k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|   131k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   30|   131k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_16);
  ------------------
  |  |   63|   131k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   31|   131k|  return *(float *)item->data;
   32|   131k|}
cbor_float_get_float4:
   34|  24.8k|float cbor_float_get_float4(const cbor_item_t *item) {
   35|  24.8k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|  24.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   36|  24.8k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_32);
  ------------------
  |  |   63|  24.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   37|  24.8k|  return *(float *)item->data;
   38|  24.8k|}
cbor_float_get_float8:
   40|  71.8k|double cbor_float_get_float8(const cbor_item_t *item) {
   41|  71.8k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|  71.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   42|  71.8k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_64);
  ------------------
  |  |   63|  71.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   43|  71.8k|  return *(double *)item->data;
   44|  71.8k|}
cbor_float_get_float:
   46|  76.1k|double cbor_float_get_float(const cbor_item_t *item) {
   47|  76.1k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|  76.1k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   48|       |  // cppcheck-suppress missingReturn
   49|  76.1k|  switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (49:11): [True: 0, False: 76.1k]
  ------------------
   50|      0|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (50:5): [True: 0, False: 76.1k]
  ------------------
   51|      0|      return NAN;
   52|  43.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (52:5): [True: 43.9k, False: 32.2k]
  ------------------
   53|  43.9k|      return cbor_float_get_float2(item);
   54|  8.27k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (54:5): [True: 8.27k, False: 67.8k]
  ------------------
   55|  8.27k|      return cbor_float_get_float4(item);
   56|  23.9k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (56:5): [True: 23.9k, False: 52.1k]
  ------------------
   57|  23.9k|      return cbor_float_get_float8(item);
   58|  76.1k|  }
   59|  76.1k|}
cbor_get_bool:
   61|  1.73M|bool cbor_get_bool(const cbor_item_t *item) {
   62|  1.73M|  CBOR_ASSERT(cbor_is_bool(item));
  ------------------
  |  |   63|  1.73M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   63|  1.73M|  return item->metadata.float_ctrl_metadata.ctrl == CBOR_CTRL_TRUE;
   64|  1.73M|}
cbor_set_float2:
   66|   100k|void cbor_set_float2(cbor_item_t *item, float value) {
   67|   100k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|   100k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   68|   100k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_16);
  ------------------
  |  |   63|   100k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   69|   100k|  *((float *)item->data) = value;
   70|   100k|}
cbor_set_float4:
   72|  17.4k|void cbor_set_float4(cbor_item_t *item, float value) {
   73|  17.4k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|  17.4k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   74|  17.4k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_32);
  ------------------
  |  |   63|  17.4k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   75|  17.4k|  *((float *)item->data) = value;
   76|  17.4k|}
cbor_set_float8:
   78|  54.9k|void cbor_set_float8(cbor_item_t *item, double value) {
   79|  54.9k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   63|  54.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   80|  54.9k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_64);
  ------------------
  |  |   63|  54.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   81|  54.9k|  *((double *)item->data) = value;
   82|  54.9k|}
cbor_set_ctrl:
   84|  4.90M|void cbor_set_ctrl(cbor_item_t *item, uint8_t value) {
   85|  4.90M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  4.90M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   86|  4.90M|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_0);
  ------------------
  |  |   63|  4.90M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   87|  4.90M|  item->metadata.float_ctrl_metadata.ctrl = value;
   88|  4.90M|}
cbor_new_ctrl:
   96|  4.90M|cbor_item_t *cbor_new_ctrl(void) {
   97|  4.90M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   98|  4.90M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  4.90M|  do {                           \
  |  |  107|  4.90M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 4, False: 4.90M]
  |  |  ------------------
  |  |  108|      4|      return NULL;               \
  |  |  109|      4|    }                            \
  |  |  110|  4.90M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   99|       |
  100|  4.90M|  *item = (cbor_item_t){
  101|  4.90M|      .type = CBOR_TYPE_FLOAT_CTRL,
  102|  4.90M|      .data = NULL,
  103|  4.90M|      .refcount = 1,
  104|  4.90M|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_0,
  105|  4.90M|                                           .ctrl = CBOR_CTRL_NONE}}};
  106|  4.90M|  return item;
  107|  4.90M|}
cbor_new_float2:
  109|   100k|cbor_item_t *cbor_new_float2(void) {
  110|   100k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  111|   100k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   100k|  do {                           \
  |  |  107|   100k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 100k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   100k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  112|       |
  113|   100k|  *item = (cbor_item_t){
  114|   100k|      .type = CBOR_TYPE_FLOAT_CTRL,
  115|   100k|      .data = (unsigned char *)item + sizeof(cbor_item_t),
  116|   100k|      .refcount = 1,
  117|   100k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_16}}};
  118|   100k|  return item;
  119|   100k|}
cbor_new_float4:
  121|  17.4k|cbor_item_t *cbor_new_float4(void) {
  122|  17.4k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  123|  17.4k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  17.4k|  do {                           \
  |  |  107|  17.4k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 17.4k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  17.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  124|       |
  125|  17.4k|  *item = (cbor_item_t){
  126|  17.4k|      .type = CBOR_TYPE_FLOAT_CTRL,
  127|  17.4k|      .data = (unsigned char *)item + sizeof(cbor_item_t),
  128|  17.4k|      .refcount = 1,
  129|  17.4k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_32}}};
  130|  17.4k|  return item;
  131|  17.4k|}
cbor_new_float8:
  133|  54.9k|cbor_item_t *cbor_new_float8(void) {
  134|  54.9k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 8);
  135|  54.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  54.9k|  do {                           \
  |  |  107|  54.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 54.9k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  54.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  136|       |
  137|  54.9k|  *item = (cbor_item_t){
  138|  54.9k|      .type = CBOR_TYPE_FLOAT_CTRL,
  139|  54.9k|      .data = (unsigned char *)item + sizeof(cbor_item_t),
  140|  54.9k|      .refcount = 1,
  141|  54.9k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_64}}};
  142|  54.9k|  return item;
  143|  54.9k|}
cbor_new_null:
  145|   372k|cbor_item_t *cbor_new_null(void) {
  146|   372k|  cbor_item_t *item = cbor_new_ctrl();
  147|   372k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   372k|  do {                           \
  |  |  107|   372k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 4, False: 372k]
  |  |  ------------------
  |  |  108|      4|      return NULL;               \
  |  |  109|      4|    }                            \
  |  |  110|   372k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  148|   372k|  cbor_set_ctrl(item, CBOR_CTRL_NULL);
  149|   372k|  return item;
  150|   372k|}
cbor_new_undef:
  152|  30.3k|cbor_item_t *cbor_new_undef(void) {
  153|  30.3k|  cbor_item_t *item = cbor_new_ctrl();
  154|  30.3k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  30.3k|  do {                           \
  |  |  107|  30.3k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 30.3k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  30.3k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  30.3k|  cbor_set_ctrl(item, CBOR_CTRL_UNDEF);
  156|  30.3k|  return item;
  157|  30.3k|}
cbor_build_bool:
  159|  2.71M|cbor_item_t *cbor_build_bool(bool value) {
  160|  2.71M|  return cbor_build_ctrl(value ? CBOR_CTRL_TRUE : CBOR_CTRL_FALSE);
  ------------------
  |  Branch (160:26): [True: 2.63M, False: 83.5k]
  ------------------
  161|  2.71M|}
cbor_build_float2:
  163|  43.9k|cbor_item_t *cbor_build_float2(float value) {
  164|  43.9k|  cbor_item_t *item = cbor_new_float2();
  165|  43.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  43.9k|  do {                           \
  |  |  107|  43.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 43.9k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  43.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  166|  43.9k|  cbor_set_float2(item, value);
  167|  43.9k|  return item;
  168|  43.9k|}
cbor_build_float4:
  170|  8.27k|cbor_item_t *cbor_build_float4(float value) {
  171|  8.27k|  cbor_item_t *item = cbor_new_float4();
  172|  8.27k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  8.27k|  do {                           \
  |  |  107|  8.27k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 8.27k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  8.27k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  8.27k|  cbor_set_float4(item, value);
  174|  8.27k|  return item;
  175|  8.27k|}
cbor_build_float8:
  177|  23.9k|cbor_item_t *cbor_build_float8(double value) {
  178|  23.9k|  cbor_item_t *item = cbor_new_float8();
  179|  23.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  23.9k|  do {                           \
  |  |  107|  23.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 23.9k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  23.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  180|  23.9k|  cbor_set_float8(item, value);
  181|  23.9k|  return item;
  182|  23.9k|}
cbor_build_ctrl:
  184|  4.50M|cbor_item_t *cbor_build_ctrl(uint8_t value) {
  185|  4.50M|  cbor_item_t *item = cbor_new_ctrl();
  186|  4.50M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  4.50M|  do {                           \
  |  |  107|  4.50M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 4.50M]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  4.50M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  187|  4.50M|  cbor_set_ctrl(item, value);
  188|  4.50M|  return item;
  189|  4.50M|}

_cbor_builder_append:
   25|  28.6M|                          struct _cbor_decoder_context *ctx) {
   26|  28.6M|  if (ctx->stack->size == 0) {
  ------------------
  |  Branch (26:7): [True: 1.35k, False: 28.6M]
  ------------------
   27|       |    /* Top level item */
   28|  1.35k|    ctx->root = item;
   29|  1.35k|    return;
   30|  1.35k|  }
   31|       |  /* Part of a bigger structure */
   32|  28.6M|  switch (ctx->stack->top->item->type) {
   33|       |    // Handle Arrays and Maps since they can contain subitems of any type.
   34|       |    // Byte/string construction from chunks is handled in the respective chunk
   35|       |    // handlers.
   36|  24.5M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (36:5): [True: 24.5M, False: 4.09M]
  ------------------
   37|  24.5M|      if (cbor_array_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (37:11): [True: 9.70M, False: 14.8M]
  ------------------
   38|       |        // We don't need an explicit check for whether the item still belongs
   39|       |        // into this array because if there are extra items, they will cause a
   40|       |        // syntax error when decoded.
   41|  9.70M|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   63|  9.70M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   42|       |        // This should never happen since the definite array should be
   43|       |        // preallocated for the expected number of items.
   44|  9.70M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (44:13): [True: 0, False: 9.70M]
  ------------------
   45|      0|          ctx->creation_failed = true;
   46|      0|          cbor_decref(&item);
   47|      0|          break;
   48|      0|        }
   49|  9.70M|        cbor_decref(&item);
   50|  9.70M|        ctx->stack->top->subitems--;
   51|  9.70M|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (51:13): [True: 9.31M, False: 388k]
  ------------------
   52|  9.31M|          cbor_item_t *stack_item = ctx->stack->top->item;
   53|  9.31M|          _cbor_stack_pop(ctx->stack);
   54|  9.31M|          _cbor_builder_append(stack_item, ctx);
   55|  9.31M|        }
   56|  14.8M|      } else {
   57|       |        /* Indefinite array, don't bother with subitems */
   58|  14.8M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (58:13): [True: 0, False: 14.8M]
  ------------------
   59|      0|          ctx->creation_failed = true;
   60|      0|        }
   61|  14.8M|        cbor_decref(&item);
   62|  14.8M|      }
   63|  24.5M|      break;
   64|  24.5M|    }
   65|  24.5M|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (65:5): [True: 3.92M, False: 24.7M]
  ------------------
   66|       |      // Handle both definite and indefinite maps the same initially.
   67|       |      // Note: We use 0 and 1 subitems to distinguish between keys and values in
   68|       |      // indefinite items
   69|  3.92M|      if (ctx->stack->top->subitems % 2) {
  ------------------
  |  Branch (69:11): [True: 1.96M, False: 1.96M]
  ------------------
   70|       |        // Odd record, this is a value.
   71|  1.96M|        ctx->creation_failed =
   72|  1.96M|            !_cbor_map_add_value(ctx->stack->top->item, item);
   73|       |        // Adding a value never fails since the memory is allocated when the
   74|       |        // key is added
   75|  1.96M|        CBOR_ASSERT(!ctx->creation_failed);
  ------------------
  |  |   63|  1.96M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   76|  1.96M|      } else {
   77|       |        // Even record, this is a key.
   78|  1.96M|        if (!_cbor_map_add_key(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (78:13): [True: 1, False: 1.96M]
  ------------------
   79|      1|          ctx->creation_failed = true;
   80|      1|          cbor_decref(&item);
   81|      1|          break;
   82|      1|        }
   83|  1.96M|      }
   84|  3.92M|      cbor_decref(&item);
   85|  3.92M|      if (cbor_map_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (85:11): [True: 739k, False: 3.18M]
  ------------------
   86|   739k|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   63|   739k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   87|   739k|        ctx->stack->top->subitems--;
   88|   739k|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (88:13): [True: 36.9k, False: 702k]
  ------------------
   89|  36.9k|          cbor_item_t *map_entry = ctx->stack->top->item;
   90|  36.9k|          _cbor_stack_pop(ctx->stack);
   91|  36.9k|          _cbor_builder_append(map_entry, ctx);
   92|  36.9k|        }
   93|  3.18M|      } else {
   94|  3.18M|        ctx->stack->top->subitems ^=
   95|  3.18M|            1; /* Flip the indicator for indefinite items */
   96|  3.18M|      }
   97|  3.92M|      break;
   98|  3.92M|    }
   99|  3.92M|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (99:5): [True: 168k, False: 28.4M]
  ------------------
  100|   168k|      CBOR_ASSERT(ctx->stack->top->subitems == 1);
  ------------------
  |  |   63|   168k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  101|   168k|      cbor_tag_set_item(ctx->stack->top->item, item);
  102|   168k|      cbor_decref(&item); /* Give up on our reference */
  103|   168k|      cbor_item_t *tagged_item = ctx->stack->top->item;
  104|   168k|      _cbor_stack_pop(ctx->stack);
  105|   168k|      _cbor_builder_append(tagged_item, ctx);
  106|   168k|      break;
  107|   168k|    }
  108|       |    // We have an item to append but nothing to append it to.
  109|     91|    default: {
  ------------------
  |  Branch (109:5): [True: 91, False: 28.6M]
  ------------------
  110|     91|      cbor_decref(&item);
  111|     91|      ctx->syntax_error = true;
  112|     91|    }
  113|  28.6M|  }
  114|  28.6M|}
cbor_builder_uint8_callback:
  142|  12.8M|void cbor_builder_uint8_callback(void *context, uint8_t value) {
  143|  12.8M|  struct _cbor_decoder_context *ctx = context;
  144|  12.8M|  cbor_item_t *res = cbor_new_int8();
  145|  12.8M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  12.8M|  do {                             \
  |  |  118|  12.8M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 12.8M]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  12.8M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  146|  12.8M|  cbor_mark_uint(res);
  147|  12.8M|  cbor_set_uint8(res, value);
  148|  12.8M|  _cbor_builder_append(res, ctx);
  149|  12.8M|}
cbor_builder_uint16_callback:
  151|  5.99k|void cbor_builder_uint16_callback(void *context, uint16_t value) {
  152|  5.99k|  struct _cbor_decoder_context *ctx = context;
  153|  5.99k|  cbor_item_t *res = cbor_new_int16();
  154|  5.99k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  5.99k|  do {                             \
  |  |  118|  5.99k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 5.99k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  5.99k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  5.99k|  cbor_mark_uint(res);
  156|  5.99k|  cbor_set_uint16(res, value);
  157|  5.99k|  _cbor_builder_append(res, ctx);
  158|  5.99k|}
cbor_builder_uint32_callback:
  160|   196k|void cbor_builder_uint32_callback(void *context, uint32_t value) {
  161|   196k|  struct _cbor_decoder_context *ctx = context;
  162|   196k|  cbor_item_t *res = cbor_new_int32();
  163|   196k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   196k|  do {                             \
  |  |  118|   196k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 196k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   196k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|   196k|  cbor_mark_uint(res);
  165|   196k|  cbor_set_uint32(res, value);
  166|   196k|  _cbor_builder_append(res, ctx);
  167|   196k|}
cbor_builder_uint64_callback:
  169|  5.48k|void cbor_builder_uint64_callback(void *context, uint64_t value) {
  170|  5.48k|  struct _cbor_decoder_context *ctx = context;
  171|  5.48k|  cbor_item_t *res = cbor_new_int64();
  172|  5.48k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  5.48k|  do {                             \
  |  |  118|  5.48k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 5.48k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  5.48k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  5.48k|  cbor_mark_uint(res);
  174|  5.48k|  cbor_set_uint64(res, value);
  175|  5.48k|  _cbor_builder_append(res, ctx);
  176|  5.48k|}
cbor_builder_negint8_callback:
  178|  1.90M|void cbor_builder_negint8_callback(void *context, uint8_t value) {
  179|  1.90M|  struct _cbor_decoder_context *ctx = context;
  180|  1.90M|  cbor_item_t *res = cbor_new_int8();
  181|  1.90M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.90M|  do {                             \
  |  |  118|  1.90M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 1, False: 1.90M]
  |  |  ------------------
  |  |  119|      1|      ctx->creation_failed = true; \
  |  |  120|      1|      return;                      \
  |  |  121|      1|    }                              \
  |  |  122|  1.90M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  182|  1.90M|  cbor_mark_negint(res);
  183|  1.90M|  cbor_set_uint8(res, value);
  184|  1.90M|  _cbor_builder_append(res, ctx);
  185|  1.90M|}
cbor_builder_negint16_callback:
  187|  28.7k|void cbor_builder_negint16_callback(void *context, uint16_t value) {
  188|  28.7k|  struct _cbor_decoder_context *ctx = context;
  189|  28.7k|  cbor_item_t *res = cbor_new_int16();
  190|  28.7k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  28.7k|  do {                             \
  |  |  118|  28.7k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 28.7k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  28.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  28.7k|  cbor_mark_negint(res);
  192|  28.7k|  cbor_set_uint16(res, value);
  193|  28.7k|  _cbor_builder_append(res, ctx);
  194|  28.7k|}
cbor_builder_negint32_callback:
  196|  8.04k|void cbor_builder_negint32_callback(void *context, uint32_t value) {
  197|  8.04k|  struct _cbor_decoder_context *ctx = context;
  198|  8.04k|  cbor_item_t *res = cbor_new_int32();
  199|  8.04k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  8.04k|  do {                             \
  |  |  118|  8.04k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 8.04k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  8.04k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  200|  8.04k|  cbor_mark_negint(res);
  201|  8.04k|  cbor_set_uint32(res, value);
  202|  8.04k|  _cbor_builder_append(res, ctx);
  203|  8.04k|}
cbor_builder_negint64_callback:
  205|  2.54k|void cbor_builder_negint64_callback(void *context, uint64_t value) {
  206|  2.54k|  struct _cbor_decoder_context *ctx = context;
  207|  2.54k|  cbor_item_t *res = cbor_new_int64();
  208|  2.54k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.54k|  do {                             \
  |  |  118|  2.54k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 2.54k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  2.54k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  209|  2.54k|  cbor_mark_negint(res);
  210|  2.54k|  cbor_set_uint64(res, value);
  211|  2.54k|  _cbor_builder_append(res, ctx);
  212|  2.54k|}
cbor_builder_byte_string_callback:
  215|   895k|                                       uint64_t length) {
  216|   895k|  struct _cbor_decoder_context *ctx = context;
  217|   895k|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  127|   895k|  do {                             \
  |  |  128|   895k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 895k]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|   895k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|   895k|  unsigned char *new_handle = _cbor_malloc(length);
  219|   895k|  if (new_handle == NULL) {
  ------------------
  |  Branch (219:7): [True: 38, False: 895k]
  ------------------
  220|     38|    ctx->creation_failed = true;
  221|     38|    return;
  222|     38|  }
  223|       |
  224|   895k|  memcpy(new_handle, data, length);
  225|   895k|  cbor_item_t *new_chunk = cbor_new_definite_bytestring();
  226|       |
  227|   895k|  if (new_chunk == NULL) {
  ------------------
  |  Branch (227:7): [True: 0, False: 895k]
  ------------------
  228|      0|    _cbor_free(new_handle);
  229|      0|    ctx->creation_failed = true;
  230|      0|    return;
  231|      0|  }
  232|       |
  233|   895k|  cbor_bytestring_set_handle(new_chunk, new_handle, length);
  234|       |
  235|       |  // If an indef bytestring is on the stack, extend it (if it were closed, it
  236|       |  // would have been popped). Handle any syntax errors upstream.
  237|   895k|  if (ctx->stack->size > 0 && cbor_isa_bytestring(ctx->stack->top->item) &&
  ------------------
  |  Branch (237:7): [True: 895k, False: 26]
  |  Branch (237:31): [True: 636k, False: 259k]
  ------------------
  238|   895k|      cbor_bytestring_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (238:7): [True: 636k, False: 0]
  ------------------
  239|   636k|    if (!cbor_bytestring_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (239:9): [True: 0, False: 636k]
  ------------------
  240|      0|      ctx->creation_failed = true;
  241|      0|    }
  242|   636k|    cbor_decref(&new_chunk);
  243|   636k|  } else {
  244|   259k|    _cbor_builder_append(new_chunk, ctx);
  245|   259k|  }
  246|   895k|}
cbor_builder_byte_string_start_callback:
  248|  1.57k|void cbor_builder_byte_string_start_callback(void *context) {
  249|  1.57k|  struct _cbor_decoder_context *ctx = context;
  250|  1.57k|  cbor_item_t *res = cbor_new_indefinite_bytestring();
  251|  1.57k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.57k|  do {                             \
  |  |  118|  1.57k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 1.57k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  1.57k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  252|  1.57k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  1.57k|  do {                                                         \
  |  |  136|  1.57k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 1.56k]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|  1.57k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  253|  1.57k|}
cbor_builder_string_callback:
  256|   654k|                                  uint64_t length) {
  257|   654k|  struct _cbor_decoder_context *ctx = context;
  258|   654k|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  127|   654k|  do {                             \
  |  |  128|   654k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 654k]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|   654k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  259|       |
  260|   654k|  unsigned char *new_handle = _cbor_malloc(length);
  261|   654k|  if (new_handle == NULL) {
  ------------------
  |  Branch (261:7): [True: 41, False: 654k]
  ------------------
  262|     41|    ctx->creation_failed = true;
  263|     41|    return;
  264|     41|  }
  265|       |
  266|   654k|  memcpy(new_handle, data, length);
  267|   654k|  cbor_item_t *new_chunk = cbor_new_definite_string();
  268|   654k|  if (new_chunk == NULL) {
  ------------------
  |  Branch (268:7): [True: 0, False: 654k]
  ------------------
  269|      0|    _cbor_free(new_handle);
  270|      0|    ctx->creation_failed = true;
  271|      0|    return;
  272|      0|  }
  273|   654k|  cbor_string_set_handle(new_chunk, new_handle, length);
  274|       |
  275|       |  // If an indef string is on the stack, extend it (if it were closed, it would
  276|       |  // have been popped). Handle any syntax errors upstream.
  277|   654k|  if (ctx->stack->size > 0 && cbor_isa_string(ctx->stack->top->item) &&
  ------------------
  |  Branch (277:7): [True: 654k, False: 32]
  |  Branch (277:31): [True: 563k, False: 90.4k]
  ------------------
  278|   654k|      cbor_string_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (278:7): [True: 563k, False: 0]
  ------------------
  279|   563k|    if (!cbor_string_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (279:9): [True: 0, False: 563k]
  ------------------
  280|      0|      ctx->creation_failed = true;
  281|      0|    }
  282|   563k|    cbor_decref(&new_chunk);
  283|   563k|  } else {
  284|  90.5k|    _cbor_builder_append(new_chunk, ctx);
  285|  90.5k|  }
  286|   654k|}
cbor_builder_string_start_callback:
  288|  19.2k|void cbor_builder_string_start_callback(void *context) {
  289|  19.2k|  struct _cbor_decoder_context *ctx = context;
  290|  19.2k|  cbor_item_t *res = cbor_new_indefinite_string();
  291|  19.2k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  19.2k|  do {                             \
  |  |  118|  19.2k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 19.2k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  19.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  292|  19.2k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  19.2k|  do {                                                         \
  |  |  136|  19.2k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 19.2k]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|  19.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  293|  19.2k|}
cbor_builder_array_start_callback:
  295|  9.32M|void cbor_builder_array_start_callback(void *context, uint64_t size) {
  296|  9.32M|  struct _cbor_decoder_context *ctx = context;
  297|  9.32M|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  127|  9.32M|  do {                             \
  |  |  128|  9.32M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 9.32M]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|  9.32M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  298|  9.32M|  cbor_item_t *res = cbor_new_definite_array(size);
  299|  9.32M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  9.32M|  do {                             \
  |  |  118|  9.32M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 74, False: 9.32M]
  |  |  ------------------
  |  |  119|     74|      ctx->creation_failed = true; \
  |  |  120|     74|      return;                      \
  |  |  121|     74|    }                              \
  |  |  122|  9.32M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  300|  9.32M|  if (size > 0) {
  ------------------
  |  Branch (300:7): [True: 9.32M, False: 0]
  ------------------
  301|  9.32M|    PUSH_CTX_STACK(ctx, res, size);
  ------------------
  |  |  135|  9.32M|  do {                                                         \
  |  |  136|  9.32M|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 2, False: 9.32M]
  |  |  ------------------
  |  |  137|      2|      cbor_decref(&res);                                       \
  |  |  138|      2|      ctx->creation_failed = true;                             \
  |  |  139|      2|    }                                                          \
  |  |  140|  9.32M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  302|  9.32M|  } else {
  303|      0|    _cbor_builder_append(res, ctx);
  304|      0|  }
  305|  9.32M|}
cbor_builder_indef_array_start_callback:
  307|   569k|void cbor_builder_indef_array_start_callback(void *context) {
  308|   569k|  struct _cbor_decoder_context *ctx = context;
  309|   569k|  cbor_item_t *res = cbor_new_indefinite_array();
  310|   569k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   569k|  do {                             \
  |  |  118|   569k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 569k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   569k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  311|   569k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|   569k|  do {                                                         \
  |  |  136|   569k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 4, False: 569k]
  |  |  ------------------
  |  |  137|      4|      cbor_decref(&res);                                       \
  |  |  138|      4|      ctx->creation_failed = true;                             \
  |  |  139|      4|    }                                                          \
  |  |  140|   569k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  312|   569k|}
cbor_builder_indef_map_start_callback:
  314|  10.7k|void cbor_builder_indef_map_start_callback(void *context) {
  315|  10.7k|  struct _cbor_decoder_context *ctx = context;
  316|  10.7k|  cbor_item_t *res = cbor_new_indefinite_map();
  317|  10.7k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  10.7k|  do {                             \
  |  |  118|  10.7k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 10.7k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  10.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  10.7k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  10.7k|  do {                                                         \
  |  |  136|  10.7k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 10.7k]
  |  |  ------------------
  |  |  137|      0|      cbor_decref(&res);                                       \
  |  |  138|      0|      ctx->creation_failed = true;                             \
  |  |  139|      0|    }                                                          \
  |  |  140|  10.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|  10.7k|}
cbor_builder_map_start_callback:
  321|  49.4k|void cbor_builder_map_start_callback(void *context, uint64_t size) {
  322|  49.4k|  struct _cbor_decoder_context *ctx = context;
  323|  49.4k|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  127|  49.4k|  do {                             \
  |  |  128|  49.4k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 49.4k]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|  49.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  324|  49.4k|  cbor_item_t *res = cbor_new_definite_map(size);
  325|  49.4k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  49.4k|  do {                             \
  |  |  118|  49.4k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 80, False: 49.4k]
  |  |  ------------------
  |  |  119|     80|      ctx->creation_failed = true; \
  |  |  120|     80|      return;                      \
  |  |  121|     80|    }                              \
  |  |  122|  49.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  326|  49.4k|  if (size > 0) {
  ------------------
  |  Branch (326:7): [True: 49.4k, False: 0]
  ------------------
  327|  49.4k|    PUSH_CTX_STACK(ctx, res, size * 2);
  ------------------
  |  |  135|  49.4k|  do {                                                         \
  |  |  136|  49.4k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 49.4k]
  |  |  ------------------
  |  |  137|      0|      cbor_decref(&res);                                       \
  |  |  138|      0|      ctx->creation_failed = true;                             \
  |  |  139|      0|    }                                                          \
  |  |  140|  49.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  328|  49.4k|  } else {
  329|      0|    _cbor_builder_append(res, ctx);
  330|      0|  }
  331|  49.4k|}
_cbor_is_indefinite:
  336|   565k|bool _cbor_is_indefinite(cbor_item_t *item) {
  337|   565k|  switch (item->type) {
  338|    611|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (338:5): [True: 611, False: 565k]
  ------------------
  339|    611|      return cbor_bytestring_is_indefinite(item);
  340|  9.56k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (340:5): [True: 9.56k, False: 556k]
  ------------------
  341|  9.56k|      return cbor_string_is_indefinite(item);
  342|   552k|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (342:5): [True: 552k, False: 13.6k]
  ------------------
  343|   552k|      return cbor_array_is_indefinite(item);
  344|  3.43k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (344:5): [True: 3.43k, False: 562k]
  ------------------
  345|  3.43k|      return cbor_map_is_indefinite(item);
  346|      4|    default:
  ------------------
  |  Branch (346:5): [True: 4, False: 565k]
  ------------------
  347|       |      // Should never happen since a non-nested item cannot be on top of the
  348|       |      // stack.
  349|      4|      return false;
  350|   565k|  }
  351|   565k|}
cbor_builder_indef_break_callback:
  353|   565k|void cbor_builder_indef_break_callback(void *context) {
  354|   565k|  struct _cbor_decoder_context *ctx = context;
  355|       |  /* There must be an item to break out of*/
  356|   565k|  if (ctx->stack->size > 0) {
  ------------------
  |  Branch (356:7): [True: 565k, False: 1]
  ------------------
  357|   565k|    cbor_item_t *item = ctx->stack->top->item;
  358|   565k|    if (_cbor_is_indefinite(
  ------------------
  |  Branch (358:9): [True: 565k, False: 11]
  ------------------
  359|   565k|            item) && /* Only indefinite items can be terminated by 0xFF */
  360|       |        /* Special case: we cannot append up if an indefinite map is incomplete
  361|       |           (we are expecting a value). */
  362|   565k|        (item->type != CBOR_TYPE_MAP || ctx->stack->top->subitems % 2 == 0)) {
  ------------------
  |  Branch (362:10): [True: 562k, False: 3.43k]
  |  Branch (362:41): [True: 3.42k, False: 8]
  ------------------
  363|   565k|      _cbor_stack_pop(ctx->stack);
  364|   565k|      _cbor_builder_append(item, ctx);
  365|   565k|      return;
  366|   565k|    }
  367|   565k|  }
  368|       |
  369|     20|  ctx->syntax_error = true;
  370|     20|}
cbor_builder_float2_callback:
  372|  56.5k|void cbor_builder_float2_callback(void *context, float value) {
  373|  56.5k|  struct _cbor_decoder_context *ctx = context;
  374|  56.5k|  cbor_item_t *res = cbor_new_float2();
  375|  56.5k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  56.5k|  do {                             \
  |  |  118|  56.5k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 56.5k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  56.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  376|  56.5k|  cbor_set_float2(res, value);
  377|  56.5k|  _cbor_builder_append(res, ctx);
  378|  56.5k|}
cbor_builder_float4_callback:
  380|  9.17k|void cbor_builder_float4_callback(void *context, float value) {
  381|  9.17k|  struct _cbor_decoder_context *ctx = context;
  382|  9.17k|  cbor_item_t *res = cbor_new_float4();
  383|  9.17k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  9.17k|  do {                             \
  |  |  118|  9.17k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 9.17k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  9.17k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  384|  9.17k|  cbor_set_float4(res, value);
  385|  9.17k|  _cbor_builder_append(res, ctx);
  386|  9.17k|}
cbor_builder_float8_callback:
  388|  31.0k|void cbor_builder_float8_callback(void *context, double value) {
  389|  31.0k|  struct _cbor_decoder_context *ctx = context;
  390|  31.0k|  cbor_item_t *res = cbor_new_float8();
  391|  31.0k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  31.0k|  do {                             \
  |  |  118|  31.0k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 31.0k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  31.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  392|  31.0k|  cbor_set_float8(res, value);
  393|  31.0k|  _cbor_builder_append(res, ctx);
  394|  31.0k|}
cbor_builder_null_callback:
  396|   372k|void cbor_builder_null_callback(void *context) {
  397|   372k|  struct _cbor_decoder_context *ctx = context;
  398|   372k|  cbor_item_t *res = cbor_new_null();
  399|   372k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   372k|  do {                             \
  |  |  118|   372k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 4, False: 372k]
  |  |  ------------------
  |  |  119|      4|      ctx->creation_failed = true; \
  |  |  120|      4|      return;                      \
  |  |  121|      4|    }                              \
  |  |  122|   372k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  400|   372k|  _cbor_builder_append(res, ctx);
  401|   372k|}
cbor_builder_undefined_callback:
  403|  30.3k|void cbor_builder_undefined_callback(void *context) {
  404|  30.3k|  struct _cbor_decoder_context *ctx = context;
  405|  30.3k|  cbor_item_t *res = cbor_new_undef();
  406|  30.3k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  30.3k|  do {                             \
  |  |  118|  30.3k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 30.3k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  30.3k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  407|  30.3k|  _cbor_builder_append(res, ctx);
  408|  30.3k|}
cbor_builder_boolean_callback:
  410|  2.71M|void cbor_builder_boolean_callback(void *context, bool value) {
  411|  2.71M|  struct _cbor_decoder_context *ctx = context;
  412|  2.71M|  cbor_item_t *res = cbor_build_bool(value);
  413|  2.71M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.71M|  do {                             \
  |  |  118|  2.71M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 2.71M]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  2.71M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  414|  2.71M|  _cbor_builder_append(res, ctx);
  415|  2.71M|}
cbor_builder_tag_callback:
  417|   191k|void cbor_builder_tag_callback(void *context, uint64_t value) {
  418|   191k|  struct _cbor_decoder_context *ctx = context;
  419|   191k|  cbor_item_t *res = cbor_new_tag(value);
  420|   191k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   191k|  do {                             \
  |  |  118|   191k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 191k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   191k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  421|   191k|  PUSH_CTX_STACK(ctx, res, 1);
  ------------------
  |  |  135|   191k|  do {                                                         \
  |  |  136|   191k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 191k]
  |  |  ------------------
  |  |  137|      0|      cbor_decref(&res);                                       \
  |  |  138|      0|      ctx->creation_failed = true;                             \
  |  |  139|      0|    }                                                          \
  |  |  140|   191k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  422|   191k|}

_cbor_encode_uint8:
   12|  19.2M|                          size_t buffer_size, uint8_t offset) {
   13|  19.2M|  if (value <= 23) {
  ------------------
  |  Branch (13:7): [True: 19.2M, False: 18.2k]
  ------------------
   14|  19.2M|    if (buffer_size >= 1) {
  ------------------
  |  Branch (14:9): [True: 19.2M, False: 0]
  ------------------
   15|  19.2M|      buffer[0] = value + offset;
   16|  19.2M|      return 1;
   17|  19.2M|    }
   18|  19.2M|  } else {
   19|  18.2k|    if (buffer_size >= 2) {
  ------------------
  |  Branch (19:9): [True: 18.2k, False: 0]
  ------------------
   20|  18.2k|      buffer[0] = 0x18 + offset;
   21|  18.2k|      buffer[1] = value;
   22|  18.2k|      return 2;
   23|  18.2k|    }
   24|  18.2k|  }
   25|      0|  return 0;
   26|  19.2M|}
_cbor_encode_uint16:
   29|  73.5k|                           size_t buffer_size, uint8_t offset) {
   30|  73.5k|  if (buffer_size >= 3) {
  ------------------
  |  Branch (30:7): [True: 73.5k, False: 0]
  ------------------
   31|  73.5k|    buffer[0] = 0x19 + offset;
   32|       |
   33|       |#ifdef IS_BIG_ENDIAN
   34|       |    memcpy(buffer + 1, &value, 2);
   35|       |#else
   36|  73.5k|    buffer[1] = (unsigned char)(value >> 8);
   37|  73.5k|    buffer[2] = (unsigned char)value;
   38|  73.5k|#endif
   39|       |
   40|  73.5k|    return 3;
   41|  73.5k|  } else
   42|      0|    return 0;
   43|  73.5k|}
_cbor_encode_uint32:
   46|   175k|                           size_t buffer_size, uint8_t offset) {
   47|   175k|  if (buffer_size >= 5) {
  ------------------
  |  Branch (47:7): [True: 175k, False: 0]
  ------------------
   48|   175k|    buffer[0] = 0x1A + offset;
   49|       |
   50|       |#ifdef IS_BIG_ENDIAN
   51|       |    memcpy(buffer + 1, &value, 4);
   52|       |#else
   53|   175k|    buffer[1] = (unsigned char)(value >> 24);
   54|   175k|    buffer[2] = (unsigned char)(value >> 16);
   55|   175k|    buffer[3] = (unsigned char)(value >> 8);
   56|   175k|    buffer[4] = (unsigned char)value;
   57|   175k|#endif
   58|       |
   59|   175k|    return 5;
   60|   175k|  } else
   61|      0|    return 0;
   62|   175k|}
_cbor_encode_uint64:
   65|  32.3k|                           size_t buffer_size, uint8_t offset) {
   66|  32.3k|  if (buffer_size >= 9) {
  ------------------
  |  Branch (66:7): [True: 32.3k, False: 0]
  ------------------
   67|  32.3k|    buffer[0] = 0x1B + offset;
   68|       |
   69|       |#ifdef IS_BIG_ENDIAN
   70|       |    memcpy(buffer + 1, &value, 8);
   71|       |#else
   72|  32.3k|    buffer[1] = (unsigned char)(value >> 56);
   73|  32.3k|    buffer[2] = (unsigned char)(value >> 48);
   74|  32.3k|    buffer[3] = (unsigned char)(value >> 40);
   75|  32.3k|    buffer[4] = (unsigned char)(value >> 32);
   76|  32.3k|    buffer[5] = (unsigned char)(value >> 24);
   77|  32.3k|    buffer[6] = (unsigned char)(value >> 16);
   78|  32.3k|    buffer[7] = (unsigned char)(value >> 8);
   79|  32.3k|    buffer[8] = (unsigned char)value;
   80|  32.3k|#endif
   81|       |
   82|  32.3k|    return 9;
   83|  32.3k|  } else
   84|      0|    return 0;
   85|  32.3k|}
_cbor_encode_uint:
   88|  8.29M|                         size_t buffer_size, uint8_t offset) {
   89|  8.29M|  if (value <= UINT16_MAX)
  ------------------
  |  Branch (89:7): [True: 8.28M, False: 10.9k]
  ------------------
   90|  8.28M|    if (value <= UINT8_MAX)
  ------------------
  |  Branch (90:9): [True: 8.28M, False: 1.87k]
  ------------------
   91|  8.28M|      return _cbor_encode_uint8((uint8_t)value, buffer, buffer_size, offset);
   92|  1.87k|    else
   93|  1.87k|      return _cbor_encode_uint16((uint16_t)value, buffer, buffer_size, offset);
   94|  10.9k|  else if (value <= UINT32_MAX)
  ------------------
  |  Branch (94:12): [True: 8.61k, False: 2.34k]
  ------------------
   95|  8.61k|    return _cbor_encode_uint32((uint32_t)value, buffer, buffer_size, offset);
   96|  2.34k|  else
   97|  2.34k|    return _cbor_encode_uint64((uint64_t)value, buffer, buffer_size, offset);
   98|  8.29M|}

_cbor_load_uint8:
   12|  25.8M|uint8_t _cbor_load_uint8(cbor_data source) { return (uint8_t)*source; }
_cbor_load_uint16:
   14|  38.4k|uint16_t _cbor_load_uint16(const unsigned char *source) {
   15|       |#ifdef IS_BIG_ENDIAN
   16|       |  uint16_t result;
   17|       |  memcpy(&result, source, 2);
   18|       |  return result;
   19|       |#else
   20|  38.4k|  return ((uint16_t) * (source + 0) << 8) + (uint8_t) * (source + 1);
   21|  38.4k|#endif
   22|  38.4k|}
_cbor_load_uint32:
   24|   224k|uint32_t _cbor_load_uint32(const unsigned char *source) {
   25|       |#ifdef IS_BIG_ENDIAN
   26|       |  uint32_t result;
   27|       |  memcpy(&result, source, 4);
   28|       |  return result;
   29|       |#else
   30|   224k|  return ((uint32_t) * (source + 0) << 0x18) +
   31|   224k|         ((uint32_t) * (source + 1) << 0x10) +
   32|   224k|         ((uint16_t) * (source + 2) << 0x08) + (uint8_t) * (source + 3);
   33|   224k|#endif
   34|   224k|}
_cbor_load_uint64:
   36|  42.6k|uint64_t _cbor_load_uint64(const unsigned char *source) {
   37|       |#ifdef IS_BIG_ENDIAN
   38|       |  uint64_t result;
   39|       |  memcpy(&result, source, 8);
   40|       |  return result;
   41|       |#else
   42|  42.6k|  return ((uint64_t) * (source + 0) << 0x38) +
   43|  42.6k|         ((uint64_t) * (source + 1) << 0x30) +
   44|  42.6k|         ((uint64_t) * (source + 2) << 0x28) +
   45|  42.6k|         ((uint64_t) * (source + 3) << 0x20) +
   46|  42.6k|         ((uint32_t) * (source + 4) << 0x18) +
   47|  42.6k|         ((uint32_t) * (source + 5) << 0x10) +
   48|  42.6k|         ((uint16_t) * (source + 6) << 0x08) + (uint8_t) * (source + 7);
   49|  42.6k|#endif
   50|  42.6k|}
_cbor_decode_half:
   53|  56.5k|float _cbor_decode_half(unsigned char *halfp) {
   54|  56.5k|  int half = (halfp[0] << 8) + halfp[1];
   55|  56.5k|  int exp = (half >> 10) & 0x1f;
   56|  56.5k|  int mant = half & 0x3ff;
   57|  56.5k|  double val;
   58|  56.5k|  if (exp == 0)
  ------------------
  |  Branch (58:7): [True: 11.5k, False: 44.9k]
  ------------------
   59|  11.5k|    val = ldexp(mant, -24);
   60|  44.9k|  else if (exp != 31)
  ------------------
  |  Branch (60:12): [True: 41.5k, False: 3.41k]
  ------------------
   61|  41.5k|    val = ldexp(mant + 1024, exp - 25);
   62|  3.41k|  else
   63|  3.41k|    val = mant == 0 ? INFINITY : NAN;
  ------------------
  |  Branch (63:11): [True: 927, False: 2.48k]
  ------------------
   64|  56.5k|  return (float)(half & 0x8000 ? -val : val);
  ------------------
  |  Branch (64:18): [True: 36.0k, False: 20.4k]
  ------------------
   65|  56.5k|}
_cbor_load_half:
   67|  56.5k|float _cbor_load_half(cbor_data source) {
   68|       |  /* Discard const */
   69|  56.5k|  return _cbor_decode_half((unsigned char *)source);
   70|  56.5k|}
_cbor_load_float:
   72|  9.17k|float _cbor_load_float(cbor_data source) {
   73|  9.17k|  union _cbor_float_helper helper = {.as_uint = _cbor_load_uint32(source)};
   74|  9.17k|  return helper.as_float;
   75|  9.17k|}
_cbor_load_double:
   77|  31.0k|double _cbor_load_double(cbor_data source) {
   78|  31.0k|  union _cbor_double_helper helper = {.as_uint = _cbor_load_uint64(source)};
   79|  31.0k|  return helper.as_double;
   80|  31.0k|}

_cbor_highest_bit:
   15|  5.97M|size_t _cbor_highest_bit(size_t number) {
   16|  5.97M|  size_t bit = 0;
   17|  23.9M|  while (number != 0) {
  ------------------
  |  Branch (17:10): [True: 18.0M, False: 5.97M]
  ------------------
   18|  18.0M|    bit++;
   19|  18.0M|    number >>= 1;
   20|  18.0M|  }
   21|       |
   22|  5.97M|  return bit;
   23|  5.97M|}
_cbor_safe_to_multiply:
   25|  22.2M|bool _cbor_safe_to_multiply(size_t a, size_t b) {
   26|  22.2M|  if (a <= 1 || b <= 1) return true;
  ------------------
  |  Branch (26:7): [True: 0, False: 22.2M]
  |  Branch (26:17): [True: 19.2M, False: 2.98M]
  ------------------
   27|  2.98M|  return _cbor_highest_bit(a) + _cbor_highest_bit(b) <= sizeof(size_t) * 8;
   28|  22.2M|}
_cbor_safe_to_add:
   30|  21.0M|bool _cbor_safe_to_add(size_t a, size_t b) {
   31|       |  // Unsigned integer overflow doesn't constitute UB
   32|  21.0M|  size_t sum = a + b;
   33|  21.0M|  return sum >= a && sum >= b;
  ------------------
  |  Branch (33:10): [True: 21.0M, False: 0]
  |  Branch (33:22): [True: 21.0M, False: 0]
  ------------------
   34|  21.0M|}
_cbor_safe_signaling_add:
   36|  21.0M|size_t _cbor_safe_signaling_add(size_t a, size_t b) {
   37|  21.0M|  if (a == 0 || b == 0) return 0;
  ------------------
  |  Branch (37:7): [True: 0, False: 21.0M]
  |  Branch (37:17): [True: 0, False: 21.0M]
  ------------------
   38|  21.0M|  if (_cbor_safe_to_add(a, b)) return a + b;
  ------------------
  |  Branch (38:7): [True: 21.0M, False: 0]
  ------------------
   39|      0|  return 0;
   40|  21.0M|}
_cbor_alloc_multiple:
   42|  16.4M|void* _cbor_alloc_multiple(size_t item_size, size_t item_count) {
   43|  16.4M|  if (_cbor_safe_to_multiply(item_size, item_count)) {
  ------------------
  |  Branch (43:7): [True: 16.4M, False: 79]
  ------------------
   44|  16.4M|    return _cbor_malloc(item_size * item_count);
   45|  16.4M|  } else {
   46|     79|    return NULL;
   47|     79|  }
   48|  16.4M|}
_cbor_realloc_multiple:
   51|  2.88M|                             size_t item_count) {
   52|  2.88M|  if (_cbor_safe_to_multiply(item_size, item_count)) {
  ------------------
  |  Branch (52:7): [True: 2.88M, False: 0]
  ------------------
   53|  2.88M|    return _cbor_realloc(pointer, item_size * item_count);
   54|  2.88M|  } else {
   55|      0|    return NULL;
   56|      0|  }
   57|  2.88M|}

_cbor_stack_init:
   10|  3.77k|struct _cbor_stack _cbor_stack_init(void) {
   11|  3.77k|  return (struct _cbor_stack){.top = NULL, .size = 0};
   12|  3.77k|}
_cbor_stack_pop:
   14|  10.1M|void _cbor_stack_pop(struct _cbor_stack *stack) {
   15|  10.1M|  struct _cbor_stack_record *top = stack->top;
   16|  10.1M|  stack->top = stack->top->lower;
   17|  10.1M|  _cbor_free(top);
   18|  10.1M|  stack->size--;
   19|  10.1M|}
_cbor_stack_push:
   23|  10.1M|                                            size_t subitems) {
   24|  10.1M|  if (stack->size == CBOR_MAX_STACK_SIZE) return NULL;
  ------------------
  |  |    9|  10.1M|#define CBOR_MAX_STACK_SIZE 2048
  ------------------
  |  Branch (24:7): [True: 8, False: 10.1M]
  ------------------
   25|  10.1M|  struct _cbor_stack_record *new_top =
   26|  10.1M|      _cbor_malloc(sizeof(struct _cbor_stack_record));
   27|  10.1M|  if (new_top == NULL) return NULL;
  ------------------
  |  Branch (27:7): [True: 0, False: 10.1M]
  ------------------
   28|       |
   29|  10.1M|  *new_top = (struct _cbor_stack_record){stack->top, item, subitems};
   30|  10.1M|  stack->top = new_top;
   31|  10.1M|  stack->size++;
   32|  10.1M|  return new_top;
   33|  10.1M|}

_cbor_unicode_decode:
   59|  2.95M|uint32_t _cbor_unicode_decode(uint32_t* state, uint32_t* codep, uint32_t byte) {
   60|  2.95M|  uint32_t type = utf8d[byte];
   61|       |
   62|  2.95M|  *codep = (*state != UTF8_ACCEPT) ? (byte & 0x3fu) | (*codep << 6)
  ------------------
  |  |   11|  2.95M|#define UTF8_ACCEPT 0
  ------------------
  |  Branch (62:12): [True: 3.39k, False: 2.94M]
  ------------------
   63|  2.95M|                                   : (0xff >> type) & (byte);
   64|       |
   65|  2.95M|  *state = utf8d[256 + *state * 16 + type];
   66|  2.95M|  return *state;
   67|  2.95M|}
_cbor_unicode_codepoint_count:
   70|  1.21M|                                     struct _cbor_unicode_status* status) {
   71|  1.21M|  *status =
   72|  1.21M|      (struct _cbor_unicode_status){.location = 0, .status = _CBOR_UNICODE_OK};
   73|  1.21M|  uint32_t codepoint, state = UTF8_ACCEPT, res;
  ------------------
  |  |   11|  1.21M|#define UTF8_ACCEPT 0
  ------------------
   74|  1.21M|  size_t pos = 0, count = 0;
   75|       |
   76|  4.15M|  for (; pos < source_length; pos++) {
  ------------------
  |  Branch (76:10): [True: 2.95M, False: 1.20M]
  ------------------
   77|  2.95M|    res = _cbor_unicode_decode(&state, &codepoint, source[pos]);
   78|       |
   79|  2.95M|    if (res == UTF8_ACCEPT) {
  ------------------
  |  |   11|  2.95M|#define UTF8_ACCEPT 0
  ------------------
  |  Branch (79:9): [True: 2.93M, False: 16.9k]
  ------------------
   80|  2.93M|      count++;
   81|  2.93M|    } else if (res == UTF8_REJECT) {
  ------------------
  |  |   12|  16.9k|#define UTF8_REJECT 1
  ------------------
  |  Branch (81:16): [True: 11.3k, False: 5.65k]
  ------------------
   82|  11.3k|      goto error;
   83|  11.3k|    }
   84|  2.95M|  }
   85|       |
   86|       |  /* Unfinished multibyte codepoint */
   87|  1.20M|  if (state != UTF8_ACCEPT) goto error;
  ------------------
  |  |   11|  1.20M|#define UTF8_ACCEPT 0
  ------------------
  |  Branch (87:7): [True: 2.25k, False: 1.20M]
  ------------------
   88|       |
   89|  1.20M|  return count;
   90|       |
   91|  13.5k|error:
   92|  13.5k|  *status = (struct _cbor_unicode_status){.location = pos,
   93|  13.5k|                                          .status = _CBOR_UNICODE_BADCP};
   94|  13.5k|  return 0;
   95|  1.20M|}

cbor_int_get_width:
   10|   108M|cbor_int_width cbor_int_get_width(const cbor_item_t *item) {
   11|   108M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|   108M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   12|   108M|  return item->metadata.int_metadata.width;
   13|   108M|}
cbor_get_uint8:
   15|  36.7M|uint8_t cbor_get_uint8(const cbor_item_t *item) {
   16|  36.7M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  36.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   17|  36.7M|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
  ------------------
  |  |   63|  36.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   18|  36.7M|  return *item->data;
   19|  36.7M|}
cbor_get_uint16:
   21|  83.3k|uint16_t cbor_get_uint16(const cbor_item_t *item) {
   22|  83.3k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  83.3k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   23|  83.3k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
  ------------------
  |  |   63|  83.3k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   24|  83.3k|  return *(uint16_t *)item->data;
   25|  83.3k|}
cbor_get_uint32:
   27|   475k|uint32_t cbor_get_uint32(const cbor_item_t *item) {
   28|   475k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|   475k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   29|   475k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
  ------------------
  |  |   63|   475k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   30|   475k|  return *(uint32_t *)item->data;
   31|   475k|}
cbor_get_uint64:
   33|  18.2k|uint64_t cbor_get_uint64(const cbor_item_t *item) {
   34|  18.2k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  18.2k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   35|  18.2k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
  ------------------
  |  |   63|  18.2k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   36|  18.2k|  return *(uint64_t *)item->data;
   37|  18.2k|}
cbor_get_int:
   39|  9.38M|uint64_t cbor_get_int(const cbor_item_t *item) {
   40|  9.38M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  9.38M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   41|       |  // cppcheck-suppress missingReturn
   42|  9.38M|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (42:11): [True: 0, False: 9.38M]
  ------------------
   43|  9.19M|    case CBOR_INT_8:
  ------------------
  |  Branch (43:5): [True: 9.19M, False: 192k]
  ------------------
   44|  9.19M|      return cbor_get_uint8(item);
   45|  27.7k|    case CBOR_INT_16:
  ------------------
  |  Branch (45:5): [True: 27.7k, False: 9.35M]
  ------------------
   46|  27.7k|      return cbor_get_uint16(item);
   47|   158k|    case CBOR_INT_32:
  ------------------
  |  Branch (47:5): [True: 158k, False: 9.22M]
  ------------------
   48|   158k|      return cbor_get_uint32(item);
   49|  6.07k|    case CBOR_INT_64:
  ------------------
  |  Branch (49:5): [True: 6.07k, False: 9.37M]
  ------------------
   50|  6.07k|      return cbor_get_uint64(item);
   51|  9.38M|  }
   52|  9.38M|}
cbor_set_uint8:
   54|  23.9M|void cbor_set_uint8(cbor_item_t *item, uint8_t value) {
   55|  23.9M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  23.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   56|  23.9M|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
  ------------------
  |  |   63|  23.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   57|  23.9M|  *item->data = value;
   58|  23.9M|}
cbor_set_uint16:
   60|  62.5k|void cbor_set_uint16(cbor_item_t *item, uint16_t value) {
   61|  62.5k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  62.5k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   62|  62.5k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
  ------------------
  |  |   63|  62.5k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   63|  62.5k|  *(uint16_t *)item->data = value;
   64|  62.5k|}
cbor_set_uint32:
   66|   363k|void cbor_set_uint32(cbor_item_t *item, uint32_t value) {
   67|   363k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|   363k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   68|   363k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
  ------------------
  |  |   63|   363k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   69|   363k|  *(uint32_t *)item->data = value;
   70|   363k|}
cbor_set_uint64:
   72|  14.1k|void cbor_set_uint64(cbor_item_t *item, uint64_t value) {
   73|  14.1k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  14.1k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   74|  14.1k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
  ------------------
  |  |   63|  14.1k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   75|  14.1k|  *(uint64_t *)item->data = value;
   76|  14.1k|}
cbor_mark_uint:
   78|  22.4M|void cbor_mark_uint(cbor_item_t *item) {
   79|  22.4M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  22.4M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   80|  22.4M|  item->type = CBOR_TYPE_UINT;
   81|  22.4M|}
cbor_mark_negint:
   83|  2.94M|void cbor_mark_negint(cbor_item_t *item) {
   84|  2.94M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   63|  2.94M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   85|  2.94M|  item->type = CBOR_TYPE_NEGINT;
   86|  2.94M|}
cbor_new_int8:
   88|  23.9M|cbor_item_t *cbor_new_int8(void) {
   89|  23.9M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 1);
   90|  23.9M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  23.9M|  do {                           \
  |  |  107|  23.9M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 1, False: 23.9M]
  |  |  ------------------
  |  |  108|      1|      return NULL;               \
  |  |  109|      1|    }                            \
  |  |  110|  23.9M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   91|  23.9M|  *item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
   92|  23.9M|                        .refcount = 1,
   93|  23.9M|                        .metadata = {.int_metadata = {.width = CBOR_INT_8}},
   94|  23.9M|                        .type = CBOR_TYPE_UINT};
   95|  23.9M|  return item;
   96|  23.9M|}
cbor_new_int16:
   98|  62.5k|cbor_item_t *cbor_new_int16(void) {
   99|  62.5k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 2);
  100|  62.5k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  62.5k|  do {                           \
  |  |  107|  62.5k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 62.5k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  62.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  101|  62.5k|  *item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
  102|  62.5k|                        .refcount = 1,
  103|  62.5k|                        .metadata = {.int_metadata = {.width = CBOR_INT_16}},
  104|  62.5k|                        .type = CBOR_TYPE_UINT};
  105|  62.5k|  return item;
  106|  62.5k|}
cbor_new_int32:
  108|   363k|cbor_item_t *cbor_new_int32(void) {
  109|   363k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  110|   363k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   363k|  do {                           \
  |  |  107|   363k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 363k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   363k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  111|   363k|  *item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
  112|   363k|                        .refcount = 1,
  113|   363k|                        .metadata = {.int_metadata = {.width = CBOR_INT_32}},
  114|   363k|                        .type = CBOR_TYPE_UINT};
  115|   363k|  return item;
  116|   363k|}
cbor_new_int64:
  118|  14.1k|cbor_item_t *cbor_new_int64(void) {
  119|  14.1k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t) + 8);
  120|  14.1k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  14.1k|  do {                           \
  |  |  107|  14.1k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 14.1k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  14.1k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  121|  14.1k|  *item = (cbor_item_t){.data = (unsigned char *)item + sizeof(cbor_item_t),
  122|  14.1k|                        .refcount = 1,
  123|  14.1k|                        .metadata = {.int_metadata = {.width = CBOR_INT_64}},
  124|  14.1k|                        .type = CBOR_TYPE_UINT};
  125|  14.1k|  return item;
  126|  14.1k|}
cbor_build_uint8:
  128|  9.19M|cbor_item_t *cbor_build_uint8(uint8_t value) {
  129|  9.19M|  cbor_item_t *item = cbor_new_int8();
  130|  9.19M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  9.19M|  do {                           \
  |  |  107|  9.19M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 9.19M]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  9.19M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  131|  9.19M|  cbor_set_uint8(item, value);
  132|  9.19M|  cbor_mark_uint(item);
  133|  9.19M|  return item;
  134|  9.19M|}
cbor_build_uint16:
  136|  27.7k|cbor_item_t *cbor_build_uint16(uint16_t value) {
  137|  27.7k|  cbor_item_t *item = cbor_new_int16();
  138|  27.7k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  27.7k|  do {                           \
  |  |  107|  27.7k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 27.7k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  27.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  139|  27.7k|  cbor_set_uint16(item, value);
  140|  27.7k|  cbor_mark_uint(item);
  141|  27.7k|  return item;
  142|  27.7k|}
cbor_build_uint32:
  144|   158k|cbor_item_t *cbor_build_uint32(uint32_t value) {
  145|   158k|  cbor_item_t *item = cbor_new_int32();
  146|   158k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   158k|  do {                           \
  |  |  107|   158k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 158k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   158k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  147|   158k|  cbor_set_uint32(item, value);
  148|   158k|  cbor_mark_uint(item);
  149|   158k|  return item;
  150|   158k|}
cbor_build_uint64:
  152|  6.07k|cbor_item_t *cbor_build_uint64(uint64_t value) {
  153|  6.07k|  cbor_item_t *item = cbor_new_int64();
  154|  6.07k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  6.07k|  do {                           \
  |  |  107|  6.07k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 6.07k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  6.07k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  6.07k|  cbor_set_uint64(item, value);
  156|  6.07k|  cbor_mark_uint(item);
  157|  6.07k|  return item;
  158|  6.07k|}

cbor_map_size:
   11|  2.97M|size_t cbor_map_size(const cbor_item_t *item) {
   12|  2.97M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.97M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   13|  2.97M|  return item->metadata.map_metadata.end_ptr;
   14|  2.97M|}
cbor_new_definite_map:
   21|  84.7k|cbor_item_t *cbor_new_definite_map(size_t size) {
   22|  84.7k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   23|  84.7k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  84.7k|  do {                           \
  |  |  107|  84.7k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 84.7k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  84.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   24|       |
   25|  84.7k|  *item = (cbor_item_t){
   26|  84.7k|      .refcount = 1,
   27|  84.7k|      .type = CBOR_TYPE_MAP,
   28|  84.7k|      .metadata = {.map_metadata = {.allocated = size,
   29|  84.7k|                                    .type = _CBOR_METADATA_DEFINITE,
   30|  84.7k|                                    .end_ptr = 0}},
   31|  84.7k|      .data = _cbor_alloc_multiple(sizeof(struct cbor_pair), size)};
   32|  84.7k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  114|  84.7k|  do {                                              \
  |  |  115|  84.7k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 80, False: 84.6k]
  |  |  ------------------
  |  |  116|     80|      _cbor_free(cbor_item);                        \
  |  |  117|     80|      return NULL;                                  \
  |  |  118|     80|    }                                               \
  |  |  119|  84.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   33|       |
   34|  84.6k|  return item;
   35|  84.7k|}
cbor_new_indefinite_map:
   37|  13.4k|cbor_item_t *cbor_new_indefinite_map(void) {
   38|  13.4k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   39|  13.4k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  13.4k|  do {                           \
  |  |  107|  13.4k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 13.4k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  13.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   40|       |
   41|  13.4k|  *item = (cbor_item_t){
   42|  13.4k|      .refcount = 1,
   43|  13.4k|      .type = CBOR_TYPE_MAP,
   44|  13.4k|      .metadata = {.map_metadata = {.allocated = 0,
   45|  13.4k|                                    .type = _CBOR_METADATA_INDEFINITE,
   46|  13.4k|                                    .end_ptr = 0}},
   47|  13.4k|      .data = NULL};
   48|       |
   49|  13.4k|  return item;
   50|  13.4k|}
_cbor_map_add_key:
   52|  2.86M|bool _cbor_map_add_key(cbor_item_t *item, cbor_item_t *key) {
   53|  2.86M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   54|  2.86M|  struct _cbor_map_metadata *metadata =
   55|  2.86M|      (struct _cbor_map_metadata *)&item->metadata;
   56|  2.86M|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (56:7): [True: 723k, False: 2.14M]
  ------------------
   57|   723k|    struct cbor_pair *data = cbor_map_handle(item);
   58|   723k|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (58:9): [True: 0, False: 723k]
  ------------------
   59|       |      /* Don't realloc definite preallocated map */
   60|      0|      return false;
   61|      0|    }
   62|       |
   63|   723k|    data[metadata->end_ptr].key = key;
   64|   723k|    data[metadata->end_ptr++].value = NULL;
   65|  2.14M|  } else {
   66|  2.14M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (66:9): [True: 4.46k, False: 2.13M]
  ------------------
   67|       |      /* Exponential realloc */
   68|       |      // Check for overflows first
   69|  4.46k|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  4.46k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (69:11): [True: 0, False: 4.46k]
  ------------------
   70|      0|        return false;
   71|      0|      }
   72|       |
   73|  4.46k|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (73:31): [True: 1.40k, False: 3.06k]
  ------------------
   74|  4.46k|                                  ? 1
   75|  4.46k|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  3.06k|#define CBOR_BUFFER_GROWTH 2
  ------------------
   76|       |
   77|  4.46k|      unsigned char *new_data = _cbor_realloc_multiple(
   78|  4.46k|          item->data, sizeof(struct cbor_pair), new_allocation);
   79|       |
   80|  4.46k|      if (new_data == NULL) {
  ------------------
  |  Branch (80:11): [True: 1, False: 4.46k]
  ------------------
   81|      1|        return false;
   82|      1|      }
   83|       |
   84|  4.46k|      item->data = new_data;
   85|  4.46k|      metadata->allocated = new_allocation;
   86|  4.46k|    }
   87|  2.14M|    struct cbor_pair *data = cbor_map_handle(item);
   88|  2.14M|    data[metadata->end_ptr].key = key;
   89|  2.14M|    data[metadata->end_ptr++].value = NULL;
   90|  2.14M|  }
   91|  2.86M|  cbor_incref(key);
   92|  2.86M|  return true;
   93|  2.86M|}
_cbor_map_add_value:
   95|  2.86M|bool _cbor_map_add_value(cbor_item_t *item, cbor_item_t *value) {
   96|  2.86M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   97|  2.86M|  cbor_incref(value);
   98|  2.86M|  cbor_map_handle(item)[
   99|       |      /* Move one back since we are assuming _add_key (which increased the ptr)
  100|       |       * was the previous operation on this object */
  101|  2.86M|      item->metadata.map_metadata.end_ptr - 1]
  102|  2.86M|      .value = value;
  103|  2.86M|  return true;
  104|  2.86M|}
cbor_map_add:
  107|   903k|bool cbor_map_add(cbor_item_t *item, struct cbor_pair pair) {
  108|   903k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|   903k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  109|   903k|  if (!_cbor_map_add_key(item, pair.key)) return false;
  ------------------
  |  Branch (109:7): [True: 0, False: 903k]
  ------------------
  110|   903k|  return _cbor_map_add_value(item, pair.value);
  111|   903k|}
cbor_map_is_definite:
  113|  6.98M|bool cbor_map_is_definite(const cbor_item_t *item) {
  114|  6.98M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  6.98M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  115|  6.98M|  return item->metadata.map_metadata.type == _CBOR_METADATA_DEFINITE;
  116|  6.98M|}
cbor_map_is_indefinite:
  118|  8.83k|bool cbor_map_is_indefinite(const cbor_item_t *item) {
  119|  8.83k|  return !cbor_map_is_definite(item);
  120|  8.83k|}
cbor_map_handle:
  122|  7.74M|struct cbor_pair *cbor_map_handle(const cbor_item_t *item) {
  123|  7.74M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  7.74M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  124|  7.74M|  return (struct cbor_pair *)item->data;
  125|  7.74M|}

cbor_serialize:
   21|  19.1M|                      size_t buffer_size) {
   22|       |  // cppcheck-suppress missingReturn
   23|  19.1M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (23:11): [True: 0, False: 19.1M]
  ------------------
   24|  8.38M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (24:5): [True: 8.38M, False: 10.8M]
  ------------------
   25|  8.38M|      return cbor_serialize_uint(item, buffer, buffer_size);
   26|   998k|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (26:5): [True: 998k, False: 18.1M]
  ------------------
   27|   998k|      return cbor_serialize_negint(item, buffer, buffer_size);
   28|   249k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (28:5): [True: 249k, False: 18.9M]
  ------------------
   29|   249k|      return cbor_serialize_bytestring(item, buffer, buffer_size);
   30|  39.6k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (30:5): [True: 39.6k, False: 19.1M]
  ------------------
   31|  39.6k|      return cbor_serialize_string(item, buffer, buffer_size);
   32|  7.51M|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (32:5): [True: 7.51M, False: 11.6M]
  ------------------
   33|  7.51M|      return cbor_serialize_array(item, buffer, buffer_size);
   34|  37.9k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (34:5): [True: 37.9k, False: 19.1M]
  ------------------
   35|  37.9k|      return cbor_serialize_map(item, buffer, buffer_size);
   36|   108k|    case CBOR_TYPE_TAG:
  ------------------
  |  Branch (36:5): [True: 108k, False: 19.0M]
  ------------------
   37|   108k|      return cbor_serialize_tag(item, buffer, buffer_size);
   38|  1.86M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (38:5): [True: 1.86M, False: 17.3M]
  ------------------
   39|  1.86M|      return cbor_serialize_float_ctrl(item, buffer, buffer_size);
   40|  19.1M|  }
   41|  19.1M|}
_cbor_encoded_header_size:
   48|  10.0M|size_t _cbor_encoded_header_size(uint64_t size) {
   49|  10.0M|  if (size <= kMaxEmbeddedInt)
  ------------------
  |  Branch (49:7): [True: 10.0M, False: 17.1k]
  ------------------
   50|  10.0M|    return 1;
   51|  17.1k|  else if (size <= UINT8_MAX)
  ------------------
  |  Branch (51:12): [True: 4.29k, False: 12.8k]
  ------------------
   52|  4.29k|    return 2;
   53|  12.8k|  else if (size <= UINT16_MAX)
  ------------------
  |  Branch (53:12): [True: 1.87k, False: 10.9k]
  ------------------
   54|  1.87k|    return 3;
   55|  10.9k|  else if (size <= UINT32_MAX)
  ------------------
  |  Branch (55:12): [True: 8.61k, False: 2.34k]
  ------------------
   56|  8.61k|    return 5;
   57|  2.34k|  else
   58|  2.34k|    return 9;
   59|  10.0M|}
cbor_serialized_size:
   61|  20.0M|size_t cbor_serialized_size(const cbor_item_t *item) {
   62|       |  // cppcheck-suppress missingReturn
   63|  20.0M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (63:11): [True: 0, False: 20.0M]
  ------------------
   64|  8.38M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (64:5): [True: 8.38M, False: 11.6M]
  ------------------
   65|  9.38M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (65:5): [True: 998k, False: 19.0M]
  ------------------
   66|  9.38M|      switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (66:15): [True: 0, False: 9.38M]
  ------------------
   67|  9.19M|        case CBOR_INT_8:
  ------------------
  |  Branch (67:9): [True: 9.19M, False: 192k]
  ------------------
   68|  9.19M|          if (cbor_get_uint8(item) <= kMaxEmbeddedInt) return 1;
  ------------------
  |  Branch (68:15): [True: 9.17M, False: 13.9k]
  ------------------
   69|  13.9k|          return 2;
   70|  27.7k|        case CBOR_INT_16:
  ------------------
  |  Branch (70:9): [True: 27.7k, False: 9.35M]
  ------------------
   71|  27.7k|          return 3;
   72|   158k|        case CBOR_INT_32:
  ------------------
  |  Branch (72:9): [True: 158k, False: 9.22M]
  ------------------
   73|   158k|          return 5;
   74|  6.07k|        case CBOR_INT_64:
  ------------------
  |  Branch (74:9): [True: 6.07k, False: 9.37M]
  ------------------
   75|  6.07k|          return 9;
   76|  9.38M|      }
   77|       |    // Note: We do not _cbor_safe_signaling_add zero-length definite strings,
   78|       |    // they would cause zeroes to propagate. All other items are at least one
   79|       |    // byte.
   80|   524k|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (80:5): [True: 524k, False: 19.4M]
  ------------------
   81|   524k|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (81:11): [True: 523k, False: 466]
  ------------------
   82|   523k|        size_t header_size =
   83|   523k|            _cbor_encoded_header_size(cbor_bytestring_length(item));
   84|   523k|        if (cbor_bytestring_length(item) == 0) return header_size;
  ------------------
  |  Branch (84:13): [True: 0, False: 523k]
  ------------------
   85|   523k|        return _cbor_safe_signaling_add(header_size,
   86|   523k|                                        cbor_bytestring_length(item));
   87|   523k|      }
   88|    466|      size_t indef_bytestring_size = 2;  // Leading byte + break
   89|    466|      cbor_item_t **chunks = cbor_bytestring_chunks_handle(item);
   90|   275k|      for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (90:26): [True: 275k, False: 466]
  ------------------
   91|   275k|        indef_bytestring_size = _cbor_safe_signaling_add(
   92|   275k|            indef_bytestring_size, cbor_serialized_size(chunks[i]));
   93|   275k|      }
   94|    466|      return indef_bytestring_size;
   95|   524k|    }
   96|   570k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (96:5): [True: 570k, False: 19.4M]
  ------------------
   97|   570k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (97:11): [True: 561k, False: 8.49k]
  ------------------
   98|   561k|        size_t header_size =
   99|   561k|            _cbor_encoded_header_size(cbor_string_length(item));
  100|   561k|        if (cbor_string_length(item) == 0) return header_size;
  ------------------
  |  Branch (100:13): [True: 0, False: 561k]
  ------------------
  101|   561k|        return _cbor_safe_signaling_add(header_size, cbor_string_length(item));
  102|   561k|      }
  103|  8.49k|      size_t indef_string_size = 2;  // Leading byte + break
  104|  8.49k|      cbor_item_t **chunks = cbor_string_chunks_handle(item);
  105|   538k|      for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (105:26): [True: 530k, False: 8.49k]
  ------------------
  106|   530k|        indef_string_size = _cbor_safe_signaling_add(
  107|   530k|            indef_string_size, cbor_serialized_size(chunks[i]));
  108|   530k|      }
  109|  8.49k|      return indef_string_size;
  110|   570k|    }
  111|  7.51M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (111:5): [True: 7.51M, False: 12.4M]
  ------------------
  112|  7.51M|      size_t array_size = cbor_array_is_definite(item)
  ------------------
  |  Branch (112:27): [True: 7.06M, False: 449k]
  ------------------
  113|  7.51M|                              ? _cbor_encoded_header_size(cbor_array_size(item))
  114|  7.51M|                              : 2;  // Leading byte + break
  115|  7.51M|      cbor_item_t **items = cbor_array_handle(item);
  116|  24.7M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (116:26): [True: 17.2M, False: 7.51M]
  ------------------
  117|  17.2M|        array_size = _cbor_safe_signaling_add(array_size,
  118|  17.2M|                                              cbor_serialized_size(items[i]));
  119|  17.2M|      }
  120|  7.51M|      return array_size;
  121|   570k|    }
  122|  37.9k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (122:5): [True: 37.9k, False: 19.9M]
  ------------------
  123|  37.9k|      size_t map_size = cbor_map_is_definite(item)
  ------------------
  |  Branch (123:25): [True: 35.2k, False: 2.69k]
  ------------------
  124|  37.9k|                            ? _cbor_encoded_header_size(cbor_map_size(item))
  125|  37.9k|                            : 2;  // Leading byte + break
  126|  37.9k|      struct cbor_pair *items = cbor_map_handle(item);
  127|   941k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (127:26): [True: 903k, False: 37.9k]
  ------------------
  128|   903k|        map_size = _cbor_safe_signaling_add(
  129|   903k|            map_size,
  130|   903k|            _cbor_safe_signaling_add(cbor_serialized_size(items[i].key),
  131|   903k|                                     cbor_serialized_size(items[i].value)));
  132|   903k|      }
  133|  37.9k|      return map_size;
  134|   570k|    }
  135|   108k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (135:5): [True: 108k, False: 19.8M]
  ------------------
  136|   108k|      return _cbor_safe_signaling_add(
  137|   108k|          _cbor_encoded_header_size(cbor_tag_value(item)),
  138|   108k|          cbor_serialized_size(cbor_move(cbor_tag_item(item))));
  139|   570k|    }
  140|  1.86M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (140:5): [True: 1.86M, False: 18.1M]
  ------------------
  141|  1.86M|      switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (141:15): [True: 0, False: 1.86M]
  ------------------
  142|  1.78M|        case CBOR_FLOAT_0:
  ------------------
  |  Branch (142:9): [True: 1.78M, False: 76.1k]
  ------------------
  143|  1.78M|          return _cbor_encoded_header_size(cbor_ctrl_value(item));
  144|  43.9k|        case CBOR_FLOAT_16:
  ------------------
  |  Branch (144:9): [True: 43.9k, False: 1.81M]
  ------------------
  145|  43.9k|          return 3;
  146|  8.27k|        case CBOR_FLOAT_32:
  ------------------
  |  Branch (146:9): [True: 8.27k, False: 1.85M]
  ------------------
  147|  8.27k|          return 5;
  148|  23.9k|        case CBOR_FLOAT_64:
  ------------------
  |  Branch (148:9): [True: 23.9k, False: 1.83M]
  ------------------
  149|  23.9k|          return 9;
  150|  1.86M|      }
  151|  20.0M|  }
  152|  20.0M|}
cbor_serialize_alloc:
  155|  1.35k|                            size_t *buffer_size) {
  156|  1.35k|  *buffer = NULL;
  157|  1.35k|  size_t serialized_size = cbor_serialized_size(item);
  158|  1.35k|  if (serialized_size == 0) {
  ------------------
  |  Branch (158:7): [True: 0, False: 1.35k]
  ------------------
  159|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|    return 0;
  161|      0|  }
  162|  1.35k|  *buffer = _cbor_malloc(serialized_size);
  163|  1.35k|  if (*buffer == NULL) {
  ------------------
  |  Branch (163:7): [True: 0, False: 1.35k]
  ------------------
  164|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (164:9): [True: 0, False: 0]
  ------------------
  165|      0|    return 0;
  166|      0|  }
  167|       |
  168|  1.35k|  size_t written = cbor_serialize(item, *buffer, serialized_size);
  169|  1.35k|  CBOR_ASSERT(written == serialized_size);
  ------------------
  |  |   63|  1.35k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  170|  1.35k|  if (buffer_size != NULL) *buffer_size = serialized_size;
  ------------------
  |  Branch (170:7): [True: 1.35k, False: 0]
  ------------------
  171|  1.35k|  return written;
  172|  1.35k|}
cbor_serialize_uint:
  175|  8.38M|                           size_t buffer_size) {
  176|  8.38M|  CBOR_ASSERT(cbor_isa_uint(item));
  ------------------
  |  |   63|  8.38M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  177|       |  // cppcheck-suppress missingReturn
  178|  8.38M|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (178:11): [True: 0, False: 8.38M]
  ------------------
  179|  8.22M|    case CBOR_INT_8:
  ------------------
  |  Branch (179:5): [True: 8.22M, False: 160k]
  ------------------
  180|  8.22M|      return cbor_encode_uint8(cbor_get_uint8(item), buffer, buffer_size);
  181|  5.07k|    case CBOR_INT_16:
  ------------------
  |  Branch (181:5): [True: 5.07k, False: 8.37M]
  ------------------
  182|  5.07k|      return cbor_encode_uint16(cbor_get_uint16(item), buffer, buffer_size);
  183|   150k|    case CBOR_INT_32:
  ------------------
  |  Branch (183:5): [True: 150k, False: 8.23M]
  ------------------
  184|   150k|      return cbor_encode_uint32(cbor_get_uint32(item), buffer, buffer_size);
  185|  4.36k|    case CBOR_INT_64:
  ------------------
  |  Branch (185:5): [True: 4.36k, False: 8.38M]
  ------------------
  186|  4.36k|      return cbor_encode_uint64(cbor_get_uint64(item), buffer, buffer_size);
  187|  8.38M|  }
  188|  8.38M|}
cbor_serialize_negint:
  191|   998k|                             size_t buffer_size) {
  192|   998k|  CBOR_ASSERT(cbor_isa_negint(item));
  ------------------
  |  |   63|   998k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  193|       |  // cppcheck-suppress missingReturn
  194|   998k|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (194:11): [True: 0, False: 998k]
  ------------------
  195|   966k|    case CBOR_INT_8:
  ------------------
  |  Branch (195:5): [True: 966k, False: 32.0k]
  ------------------
  196|   966k|      return cbor_encode_negint8(cbor_get_uint8(item), buffer, buffer_size);
  197|  22.7k|    case CBOR_INT_16:
  ------------------
  |  Branch (197:5): [True: 22.7k, False: 975k]
  ------------------
  198|  22.7k|      return cbor_encode_negint16(cbor_get_uint16(item), buffer, buffer_size);
  199|  7.67k|    case CBOR_INT_32:
  ------------------
  |  Branch (199:5): [True: 7.67k, False: 990k]
  ------------------
  200|  7.67k|      return cbor_encode_negint32(cbor_get_uint32(item), buffer, buffer_size);
  201|  1.71k|    case CBOR_INT_64:
  ------------------
  |  Branch (201:5): [True: 1.71k, False: 996k]
  ------------------
  202|  1.71k|      return cbor_encode_negint64(cbor_get_uint64(item), buffer, buffer_size);
  203|   998k|  }
  204|   998k|}
cbor_serialize_bytestring:
  207|   524k|                                 size_t buffer_size) {
  208|   524k|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|   524k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  209|   524k|  if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (209:7): [True: 523k, False: 466]
  ------------------
  210|   523k|    size_t length = cbor_bytestring_length(item);
  211|   523k|    size_t written = cbor_encode_bytestring_start(length, buffer, buffer_size);
  212|   523k|    if (written > 0 && (buffer_size - written >= length)) {
  ------------------
  |  Branch (212:9): [True: 523k, False: 0]
  |  Branch (212:24): [True: 523k, False: 0]
  ------------------
  213|   523k|      memcpy(buffer + written, cbor_bytestring_handle(item), length);
  214|   523k|      return written + length;
  215|   523k|    }
  216|      0|    return 0;
  217|   523k|  } else {
  218|    466|    CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   63|    466|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  219|    466|    size_t chunk_count = cbor_bytestring_chunk_count(item);
  220|    466|    size_t written = cbor_encode_indef_bytestring_start(buffer, buffer_size);
  221|    466|    if (written == 0) return 0;
  ------------------
  |  Branch (221:9): [True: 0, False: 466]
  ------------------
  222|       |
  223|    466|    cbor_item_t **chunks = cbor_bytestring_chunks_handle(item);
  224|   275k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (224:24): [True: 275k, False: 466]
  ------------------
  225|   275k|      size_t chunk_written = cbor_serialize_bytestring(
  226|   275k|          chunks[i], buffer + written, buffer_size - written);
  227|   275k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (227:11): [True: 0, False: 275k]
  ------------------
  228|   275k|      written += chunk_written;
  229|   275k|    }
  230|       |
  231|    466|    size_t break_written =
  232|    466|        cbor_encode_break(buffer + written, buffer_size - written);
  233|    466|    if (break_written == 0) return 0;
  ------------------
  |  Branch (233:9): [True: 0, False: 466]
  ------------------
  234|    466|    return written + break_written;
  235|    466|  }
  236|   524k|}
cbor_serialize_string:
  239|   570k|                             size_t buffer_size) {
  240|   570k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|   570k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  241|   570k|  if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (241:7): [True: 561k, False: 8.49k]
  ------------------
  242|   561k|    size_t length = cbor_string_length(item);
  243|   561k|    size_t written = cbor_encode_string_start(length, buffer, buffer_size);
  244|   561k|    if (written && (buffer_size - written >= length)) {
  ------------------
  |  Branch (244:9): [True: 561k, False: 0]
  |  Branch (244:20): [True: 561k, False: 0]
  ------------------
  245|   561k|      memcpy(buffer + written, cbor_string_handle(item), length);
  246|   561k|      return written + length;
  247|   561k|    }
  248|      0|    return 0;
  249|   561k|  } else {
  250|  8.49k|    CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   63|  8.49k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  251|  8.49k|    size_t chunk_count = cbor_string_chunk_count(item);
  252|  8.49k|    size_t written = cbor_encode_indef_string_start(buffer, buffer_size);
  253|  8.49k|    if (written == 0) return 0;
  ------------------
  |  Branch (253:9): [True: 0, False: 8.49k]
  ------------------
  254|       |
  255|  8.49k|    cbor_item_t **chunks = cbor_string_chunks_handle(item);
  256|   538k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (256:24): [True: 530k, False: 8.49k]
  ------------------
  257|   530k|      size_t chunk_written = cbor_serialize_string(chunks[i], buffer + written,
  258|   530k|                                                   buffer_size - written);
  259|   530k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (259:11): [True: 0, False: 530k]
  ------------------
  260|   530k|      written += chunk_written;
  261|   530k|    }
  262|       |
  263|  8.49k|    size_t break_written =
  264|  8.49k|        cbor_encode_break(buffer + written, buffer_size - written);
  265|  8.49k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (265:9): [True: 0, False: 8.49k]
  ------------------
  266|  8.49k|    return written + break_written;
  267|  8.49k|  }
  268|   570k|}
cbor_serialize_array:
  271|  7.51M|                            size_t buffer_size) {
  272|  7.51M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|  7.51M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  273|  7.51M|  size_t size = cbor_array_size(item), written = 0;
  274|  7.51M|  cbor_item_t **handle = cbor_array_handle(item);
  275|  7.51M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (275:7): [True: 7.06M, False: 449k]
  ------------------
  276|  7.06M|    written = cbor_encode_array_start(size, buffer, buffer_size);
  277|  7.06M|  } else {
  278|   449k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   63|   449k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  279|   449k|    written = cbor_encode_indef_array_start(buffer, buffer_size);
  280|   449k|  }
  281|  7.51M|  if (written == 0) return 0;
  ------------------
  |  Branch (281:7): [True: 0, False: 7.51M]
  ------------------
  282|       |
  283|  24.7M|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (283:22): [True: 17.2M, False: 7.51M]
  ------------------
  284|  17.2M|    size_t item_written =
  285|  17.2M|        cbor_serialize(*(handle++), buffer + written, buffer_size - written);
  286|  17.2M|    if (item_written == 0) return 0;
  ------------------
  |  Branch (286:9): [True: 0, False: 17.2M]
  ------------------
  287|  17.2M|    written += item_written;
  288|  17.2M|  }
  289|       |
  290|  7.51M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (290:7): [True: 7.06M, False: 449k]
  ------------------
  291|  7.06M|    return written;
  292|  7.06M|  } else {
  293|   449k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   63|   449k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  294|   449k|    size_t break_written =
  295|   449k|        cbor_encode_break(buffer + written, buffer_size - written);
  296|   449k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (296:9): [True: 0, False: 449k]
  ------------------
  297|   449k|    return written + break_written;
  298|   449k|  }
  299|  7.51M|}
cbor_serialize_map:
  302|  37.9k|                          size_t buffer_size) {
  303|  37.9k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  37.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  304|  37.9k|  size_t size = cbor_map_size(item), written = 0;
  305|  37.9k|  struct cbor_pair *handle = cbor_map_handle(item);
  306|       |
  307|  37.9k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (307:7): [True: 35.2k, False: 2.69k]
  ------------------
  308|  35.2k|    written = cbor_encode_map_start(size, buffer, buffer_size);
  309|  35.2k|  } else {
  310|  2.69k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   63|  2.69k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  311|  2.69k|    written = cbor_encode_indef_map_start(buffer, buffer_size);
  312|  2.69k|  }
  313|  37.9k|  if (written == 0) return 0;
  ------------------
  |  Branch (313:7): [True: 0, False: 37.9k]
  ------------------
  314|       |
  315|   941k|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (315:22): [True: 903k, False: 37.9k]
  ------------------
  316|   903k|    size_t item_written =
  317|   903k|        cbor_serialize(handle->key, buffer + written, buffer_size - written);
  318|   903k|    if (item_written == 0) {
  ------------------
  |  Branch (318:9): [True: 0, False: 903k]
  ------------------
  319|      0|      return 0;
  320|      0|    }
  321|   903k|    written += item_written;
  322|   903k|    item_written = cbor_serialize((handle++)->value, buffer + written,
  323|   903k|                                  buffer_size - written);
  324|   903k|    if (item_written == 0) return 0;
  ------------------
  |  Branch (324:9): [True: 0, False: 903k]
  ------------------
  325|   903k|    written += item_written;
  326|   903k|  }
  327|       |
  328|  37.9k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (328:7): [True: 35.2k, False: 2.69k]
  ------------------
  329|  35.2k|    return written;
  330|  35.2k|  } else {
  331|  2.69k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   63|  2.69k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  332|  2.69k|    size_t break_written =
  333|  2.69k|        cbor_encode_break(buffer + written, buffer_size - written);
  334|  2.69k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (334:9): [True: 0, False: 2.69k]
  ------------------
  335|  2.69k|    return written + break_written;
  336|  2.69k|  }
  337|  37.9k|}
cbor_serialize_tag:
  340|   108k|                          size_t buffer_size) {
  341|   108k|  CBOR_ASSERT(cbor_isa_tag(item));
  ------------------
  |  |   63|   108k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  342|   108k|  size_t written = cbor_encode_tag(cbor_tag_value(item), buffer, buffer_size);
  343|   108k|  if (written == 0) return 0;
  ------------------
  |  Branch (343:7): [True: 0, False: 108k]
  ------------------
  344|       |
  345|   108k|  size_t item_written = cbor_serialize(cbor_move(cbor_tag_item(item)),
  346|   108k|                                       buffer + written, buffer_size - written);
  347|   108k|  if (item_written == 0) return 0;
  ------------------
  |  Branch (347:7): [True: 0, False: 108k]
  ------------------
  348|   108k|  return written + item_written;
  349|   108k|}
cbor_serialize_float_ctrl:
  352|  1.86M|                                 size_t buffer_size) {
  353|  1.86M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  1.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  354|       |  // cppcheck-suppress missingReturn
  355|  1.86M|  switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (355:11): [True: 0, False: 1.86M]
  ------------------
  356|  1.78M|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (356:5): [True: 1.78M, False: 76.1k]
  ------------------
  357|       |      /* CTRL - special treatment */
  358|  1.78M|      return cbor_encode_ctrl(cbor_ctrl_value(item), buffer, buffer_size);
  359|  43.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (359:5): [True: 43.9k, False: 1.81M]
  ------------------
  360|  43.9k|      return cbor_encode_half(cbor_float_get_float2(item), buffer, buffer_size);
  361|  8.27k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (361:5): [True: 8.27k, False: 1.85M]
  ------------------
  362|  8.27k|      return cbor_encode_single(cbor_float_get_float4(item), buffer,
  363|  8.27k|                                buffer_size);
  364|  23.9k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (364:5): [True: 23.9k, False: 1.83M]
  ------------------
  365|  23.9k|      return cbor_encode_double(cbor_float_get_float8(item), buffer,
  366|  23.9k|                                buffer_size);
  367|  1.86M|  }
  368|  1.86M|}

cbor_stream_decode:
   45|  30.5M|    const struct cbor_callbacks *callbacks, void *context) {
   46|       |  // Attempt to claim the initial MTB byte
   47|  30.5M|  struct cbor_decoder_result result = {.status = CBOR_DECODER_FINISHED};
   48|  30.5M|  if (!claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (48:7): [True: 0, False: 30.5M]
  ------------------
   49|      0|    return result;
   50|      0|  }
   51|       |
   52|  30.5M|  switch (*source) {
   53|  12.1M|    case 0x00: /* Fallthrough */
  ------------------
  |  Branch (53:5): [True: 12.1M, False: 18.3M]
  ------------------
   54|  12.1M|    case 0x01: /* Fallthrough */
  ------------------
  |  Branch (54:5): [True: 18.8k, False: 30.5M]
  ------------------
   55|  12.2M|    case 0x02: /* Fallthrough */
  ------------------
  |  Branch (55:5): [True: 24.5k, False: 30.4M]
  ------------------
   56|  12.2M|    case 0x03: /* Fallthrough */
  ------------------
  |  Branch (56:5): [True: 4.90k, False: 30.5M]
  ------------------
   57|  12.2M|    case 0x04: /* Fallthrough */
  ------------------
  |  Branch (57:5): [True: 7.96k, False: 30.5M]
  ------------------
   58|  12.2M|    case 0x05: /* Fallthrough */
  ------------------
  |  Branch (58:5): [True: 3.06k, False: 30.5M]
  ------------------
   59|  12.2M|    case 0x06: /* Fallthrough */
  ------------------
  |  Branch (59:5): [True: 17.5k, False: 30.5M]
  ------------------
   60|  12.2M|    case 0x07: /* Fallthrough */
  ------------------
  |  Branch (60:5): [True: 11.0k, False: 30.5M]
  ------------------
   61|  12.2M|    case 0x08: /* Fallthrough */
  ------------------
  |  Branch (61:5): [True: 21.5k, False: 30.4M]
  ------------------
   62|  12.2M|    case 0x09: /* Fallthrough */
  ------------------
  |  Branch (62:5): [True: 11.5k, False: 30.5M]
  ------------------
   63|  12.3M|    case 0x0A: /* Fallthrough */
  ------------------
  |  Branch (63:5): [True: 45.1k, False: 30.4M]
  ------------------
   64|  12.3M|    case 0x0B: /* Fallthrough */
  ------------------
  |  Branch (64:5): [True: 1.50k, False: 30.5M]
  ------------------
   65|  12.3M|    case 0x0C: /* Fallthrough */
  ------------------
  |  Branch (65:5): [True: 7.50k, False: 30.5M]
  ------------------
   66|  12.5M|    case 0x0D: /* Fallthrough */
  ------------------
  |  Branch (66:5): [True: 193k, False: 30.3M]
  ------------------
   67|  12.5M|    case 0x0E: /* Fallthrough */
  ------------------
  |  Branch (67:5): [True: 11.7k, False: 30.5M]
  ------------------
   68|  12.5M|    case 0x0F: /* Fallthrough */
  ------------------
  |  Branch (68:5): [True: 3.02k, False: 30.5M]
  ------------------
   69|  12.6M|    case 0x10: /* Fallthrough */
  ------------------
  |  Branch (69:5): [True: 57.9k, False: 30.4M]
  ------------------
   70|  12.6M|    case 0x11: /* Fallthrough */
  ------------------
  |  Branch (70:5): [True: 21.3k, False: 30.4M]
  ------------------
   71|  12.6M|    case 0x12: /* Fallthrough */
  ------------------
  |  Branch (71:5): [True: 14.4k, False: 30.5M]
  ------------------
   72|  12.6M|    case 0x13: /* Fallthrough */
  ------------------
  |  Branch (72:5): [True: 4.89k, False: 30.5M]
  ------------------
   73|  12.6M|    case 0x14: /* Fallthrough */
  ------------------
  |  Branch (73:5): [True: 39.7k, False: 30.4M]
  ------------------
   74|  12.8M|    case 0x15: /* Fallthrough */
  ------------------
  |  Branch (74:5): [True: 113k, False: 30.4M]
  ------------------
   75|  12.8M|    case 0x16: /* Fallthrough */
  ------------------
  |  Branch (75:5): [True: 34.3k, False: 30.4M]
  ------------------
   76|  12.8M|    case 0x17:
  ------------------
  |  Branch (76:5): [True: 13.1k, False: 30.5M]
  ------------------
   77|       |      /* Embedded one byte unsigned integer */
   78|  12.8M|      {
   79|  12.8M|        callbacks->uint8(context, _cbor_load_uint8(source));
   80|  12.8M|        return result;
   81|  12.8M|      }
   82|  7.02k|    case 0x18:
  ------------------
  |  Branch (82:5): [True: 7.02k, False: 30.5M]
  ------------------
   83|       |      /* One byte unsigned integer */
   84|  7.02k|      {
   85|  7.02k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (85:13): [True: 7.02k, False: 1]
  ------------------
   86|  7.02k|          callbacks->uint8(context, _cbor_load_uint8(source + 1));
   87|  7.02k|        }
   88|  7.02k|        return result;
   89|  12.8M|      }
   90|  5.99k|    case 0x19:
  ------------------
  |  Branch (90:5): [True: 5.99k, False: 30.5M]
  ------------------
   91|       |      /* Two bytes unsigned integer */
   92|  5.99k|      {
   93|  5.99k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (93:13): [True: 5.99k, False: 3]
  ------------------
   94|  5.99k|          callbacks->uint16(context, _cbor_load_uint16(source + 1));
   95|  5.99k|        }
   96|  5.99k|        return result;
   97|  12.8M|      }
   98|   196k|    case 0x1A:
  ------------------
  |  Branch (98:5): [True: 196k, False: 30.3M]
  ------------------
   99|       |      /* Four bytes unsigned integer */
  100|   196k|      {
  101|   196k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (101:13): [True: 196k, False: 3]
  ------------------
  102|   196k|          callbacks->uint32(context, _cbor_load_uint32(source + 1));
  103|   196k|        }
  104|   196k|        return result;
  105|  12.8M|      }
  106|  5.48k|    case 0x1B:
  ------------------
  |  Branch (106:5): [True: 5.48k, False: 30.5M]
  ------------------
  107|       |      /* Eight bytes unsigned integer */
  108|  5.48k|      {
  109|  5.48k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (109:13): [True: 5.48k, False: 1]
  ------------------
  110|  5.48k|          callbacks->uint64(context, _cbor_load_uint64(source + 1));
  111|  5.48k|        }
  112|  5.48k|        return result;
  113|  12.8M|      }
  114|      1|    case 0x1C: /* Fallthrough */
  ------------------
  |  Branch (114:5): [True: 1, False: 30.5M]
  ------------------
  115|      2|    case 0x1D: /* Fallthrough */
  ------------------
  |  Branch (115:5): [True: 1, False: 30.5M]
  ------------------
  116|      4|    case 0x1E: /* Fallthrough */
  ------------------
  |  Branch (116:5): [True: 2, False: 30.5M]
  ------------------
  117|      5|    case 0x1F:
  ------------------
  |  Branch (117:5): [True: 1, False: 30.5M]
  ------------------
  118|       |      /* Reserved */
  119|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  120|  2.55k|    case 0x20: /* Fallthrough */
  ------------------
  |  Branch (120:5): [True: 2.55k, False: 30.5M]
  ------------------
  121|  3.49k|    case 0x21: /* Fallthrough */
  ------------------
  |  Branch (121:5): [True: 941, False: 30.5M]
  ------------------
  122|  5.40k|    case 0x22: /* Fallthrough */
  ------------------
  |  Branch (122:5): [True: 1.91k, False: 30.5M]
  ------------------
  123|  10.7k|    case 0x23: /* Fallthrough */
  ------------------
  |  Branch (123:5): [True: 5.32k, False: 30.5M]
  ------------------
  124|  19.2k|    case 0x24: /* Fallthrough */
  ------------------
  |  Branch (124:5): [True: 8.53k, False: 30.5M]
  ------------------
  125|   196k|    case 0x25: /* Fallthrough */
  ------------------
  |  Branch (125:5): [True: 177k, False: 30.3M]
  ------------------
  126|   340k|    case 0x26: /* Fallthrough */
  ------------------
  |  Branch (126:5): [True: 143k, False: 30.3M]
  ------------------
  127|   343k|    case 0x27: /* Fallthrough */
  ------------------
  |  Branch (127:5): [True: 2.51k, False: 30.5M]
  ------------------
  128|   350k|    case 0x28: /* Fallthrough */
  ------------------
  |  Branch (128:5): [True: 7.22k, False: 30.5M]
  ------------------
  129|   351k|    case 0x29: /* Fallthrough */
  ------------------
  |  Branch (129:5): [True: 920, False: 30.5M]
  ------------------
  130|   352k|    case 0x2A: /* Fallthrough */
  ------------------
  |  Branch (130:5): [True: 1.39k, False: 30.5M]
  ------------------
  131|   398k|    case 0x2B: /* Fallthrough */
  ------------------
  |  Branch (131:5): [True: 45.8k, False: 30.4M]
  ------------------
  132|   487k|    case 0x2C: /* Fallthrough */
  ------------------
  |  Branch (132:5): [True: 88.9k, False: 30.4M]
  ------------------
  133|   498k|    case 0x2D: /* Fallthrough */
  ------------------
  |  Branch (133:5): [True: 11.0k, False: 30.5M]
  ------------------
  134|   559k|    case 0x2E: /* Fallthrough */
  ------------------
  |  Branch (134:5): [True: 61.3k, False: 30.4M]
  ------------------
  135|  1.05M|    case 0x2F: /* Fallthrough */
  ------------------
  |  Branch (135:5): [True: 492k, False: 30.0M]
  ------------------
  136|  1.24M|    case 0x30: /* Fallthrough */
  ------------------
  |  Branch (136:5): [True: 194k, False: 30.3M]
  ------------------
  137|  1.27M|    case 0x31: /* Fallthrough */
  ------------------
  |  Branch (137:5): [True: 26.8k, False: 30.4M]
  ------------------
  138|  1.34M|    case 0x32: /* Fallthrough */
  ------------------
  |  Branch (138:5): [True: 73.3k, False: 30.4M]
  ------------------
  139|  1.60M|    case 0x33: /* Fallthrough */
  ------------------
  |  Branch (139:5): [True: 257k, False: 30.2M]
  ------------------
  140|  1.61M|    case 0x34: /* Fallthrough */
  ------------------
  |  Branch (140:5): [True: 11.5k, False: 30.5M]
  ------------------
  141|  1.73M|    case 0x35: /* Fallthrough */
  ------------------
  |  Branch (141:5): [True: 113k, False: 30.4M]
  ------------------
  142|  1.83M|    case 0x36: /* Fallthrough */
  ------------------
  |  Branch (142:5): [True: 100k, False: 30.4M]
  ------------------
  143|  1.89M|    case 0x37:
  ------------------
  |  Branch (143:5): [True: 65.9k, False: 30.4M]
  ------------------
  144|       |      /* Embedded one byte negative integer */
  145|  1.89M|      {
  146|  1.89M|        callbacks->negint8(context,
  147|  1.89M|                           _cbor_load_uint8(source) - 0x20); /* 0x20 offset */
  148|  1.89M|        return result;
  149|  1.83M|      }
  150|  10.2k|    case 0x38:
  ------------------
  |  Branch (150:5): [True: 10.2k, False: 30.5M]
  ------------------
  151|       |      /* One byte negative integer */
  152|  10.2k|      {
  153|  10.2k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (153:13): [True: 10.2k, False: 1]
  ------------------
  154|  10.2k|          callbacks->negint8(context, _cbor_load_uint8(source + 1));
  155|  10.2k|        }
  156|  10.2k|        return result;
  157|  1.83M|      }
  158|  28.7k|    case 0x39:
  ------------------
  |  Branch (158:5): [True: 28.7k, False: 30.4M]
  ------------------
  159|       |      /* Two bytes negative integer */
  160|  28.7k|      {
  161|  28.7k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (161:13): [True: 28.7k, False: 1]
  ------------------
  162|  28.7k|          callbacks->negint16(context, _cbor_load_uint16(source + 1));
  163|  28.7k|        }
  164|  28.7k|        return result;
  165|  1.83M|      }
  166|  8.04k|    case 0x3A:
  ------------------
  |  Branch (166:5): [True: 8.04k, False: 30.5M]
  ------------------
  167|       |      /* Four bytes negative integer */
  168|  8.04k|      {
  169|  8.04k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (169:13): [True: 8.04k, False: 1]
  ------------------
  170|  8.04k|          callbacks->negint32(context, _cbor_load_uint32(source + 1));
  171|  8.04k|        }
  172|  8.04k|        return result;
  173|  1.83M|      }
  174|  2.54k|    case 0x3B:
  ------------------
  |  Branch (174:5): [True: 2.54k, False: 30.5M]
  ------------------
  175|       |      /* Eight bytes negative integer */
  176|  2.54k|      {
  177|  2.54k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (177:13): [True: 2.54k, False: 1]
  ------------------
  178|  2.54k|          callbacks->negint64(context, _cbor_load_uint64(source + 1));
  179|  2.54k|        }
  180|  2.54k|        return result;
  181|  1.83M|      }
  182|      1|    case 0x3C: /* Fallthrough */
  ------------------
  |  Branch (182:5): [True: 1, False: 30.5M]
  ------------------
  183|      2|    case 0x3D: /* Fallthrough */
  ------------------
  |  Branch (183:5): [True: 1, False: 30.5M]
  ------------------
  184|      3|    case 0x3E: /* Fallthrough */
  ------------------
  |  Branch (184:5): [True: 1, False: 30.5M]
  ------------------
  185|      4|    case 0x3F:
  ------------------
  |  Branch (185:5): [True: 1, False: 30.5M]
  ------------------
  186|       |      /* Reserved */
  187|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  188|     11|    case 0x40: /* Fallthrough */
  ------------------
  |  Branch (188:5): [True: 11, False: 30.5M]
  ------------------
  189|   878k|    case 0x41: /* Fallthrough */
  ------------------
  |  Branch (189:5): [True: 878k, False: 29.6M]
  ------------------
  190|   878k|    case 0x42: /* Fallthrough */
  ------------------
  |  Branch (190:5): [True: 390, False: 30.5M]
  ------------------
  191|   879k|    case 0x43: /* Fallthrough */
  ------------------
  |  Branch (191:5): [True: 406, False: 30.5M]
  ------------------
  192|   879k|    case 0x44: /* Fallthrough */
  ------------------
  |  Branch (192:5): [True: 845, False: 30.5M]
  ------------------
  193|   880k|    case 0x45: /* Fallthrough */
  ------------------
  |  Branch (193:5): [True: 235, False: 30.5M]
  ------------------
  194|   883k|    case 0x46: /* Fallthrough */
  ------------------
  |  Branch (194:5): [True: 3.71k, False: 30.5M]
  ------------------
  195|   884k|    case 0x47: /* Fallthrough */
  ------------------
  |  Branch (195:5): [True: 345, False: 30.5M]
  ------------------
  196|   884k|    case 0x48: /* Fallthrough */
  ------------------
  |  Branch (196:5): [True: 717, False: 30.5M]
  ------------------
  197|   885k|    case 0x49: /* Fallthrough */
  ------------------
  |  Branch (197:5): [True: 316, False: 30.5M]
  ------------------
  198|   885k|    case 0x4A: /* Fallthrough */
  ------------------
  |  Branch (198:5): [True: 568, False: 30.5M]
  ------------------
  199|   886k|    case 0x4B: /* Fallthrough */
  ------------------
  |  Branch (199:5): [True: 601, False: 30.5M]
  ------------------
  200|   886k|    case 0x4C: /* Fallthrough */
  ------------------
  |  Branch (200:5): [True: 271, False: 30.5M]
  ------------------
  201|   888k|    case 0x4D: /* Fallthrough */
  ------------------
  |  Branch (201:5): [True: 1.64k, False: 30.5M]
  ------------------
  202|   888k|    case 0x4E: /* Fallthrough */
  ------------------
  |  Branch (202:5): [True: 435, False: 30.5M]
  ------------------
  203|   889k|    case 0x4F: /* Fallthrough */
  ------------------
  |  Branch (203:5): [True: 451, False: 30.5M]
  ------------------
  204|   889k|    case 0x50: /* Fallthrough */
  ------------------
  |  Branch (204:5): [True: 641, False: 30.5M]
  ------------------
  205|   891k|    case 0x51: /* Fallthrough */
  ------------------
  |  Branch (205:5): [True: 1.36k, False: 30.5M]
  ------------------
  206|   891k|    case 0x52: /* Fallthrough */
  ------------------
  |  Branch (206:5): [True: 247, False: 30.5M]
  ------------------
  207|   891k|    case 0x53: /* Fallthrough */
  ------------------
  |  Branch (207:5): [True: 322, False: 30.5M]
  ------------------
  208|   893k|    case 0x54: /* Fallthrough */
  ------------------
  |  Branch (208:5): [True: 2.06k, False: 30.5M]
  ------------------
  209|   894k|    case 0x55: /* Fallthrough */
  ------------------
  |  Branch (209:5): [True: 334, False: 30.5M]
  ------------------
  210|   894k|    case 0x56: /* Fallthrough */
  ------------------
  |  Branch (210:5): [True: 249, False: 30.5M]
  ------------------
  211|   894k|    case 0x57:
  ------------------
  |  Branch (211:5): [True: 260, False: 30.5M]
  ------------------
  212|       |      /* Embedded length byte string */
  213|   894k|      {
  214|   894k|        uint64_t length = _cbor_load_uint8(source) - 0x40; /* 0x40 offset */
  215|   894k|        CLAIM_BYTES_AND_INVOKE(byte_string, length, 0);
  ------------------
  |  |   27|   894k|  do {                                                                     \
  |  |   28|   894k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 894k, False: 193]
  |  |  ------------------
  |  |   29|   894k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   30|   894k|                               length);                                    \
  |  |   31|   894k|    }                                                                      \
  |  |   32|   894k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  216|   894k|        return result;
  217|   894k|      }
  218|    336|    case 0x58:
  ------------------
  |  Branch (218:5): [True: 336, False: 30.5M]
  ------------------
  219|       |      /* One byte length byte string */
  220|    336|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint8, 1);
  ------------------
  |  |   35|    336|  do {                                                                \
  |  |   36|    336|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 335, False: 1]
  |  |  ------------------
  |  |   37|    335|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    335|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    335|  do {                                                                     \
  |  |  |  |   28|    335|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 334, False: 1]
  |  |  |  |  ------------------
  |  |  |  |   29|    334|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    334|                               length);                                    \
  |  |  |  |   31|    334|    }                                                                      \
  |  |  |  |   32|    335|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    335|    }                                                                 \
  |  |   40|    336|    return result;                                                    \
  |  |   41|    336|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  221|    306|    case 0x59:
  ------------------
  |  Branch (221:5): [True: 306, False: 30.5M]
  ------------------
  222|       |      /* Two bytes length byte string */
  223|    306|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint16, 2);
  ------------------
  |  |   35|    306|  do {                                                                \
  |  |   36|    306|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 305, False: 1]
  |  |  ------------------
  |  |   37|    305|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    305|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    305|  do {                                                                     \
  |  |  |  |   28|    305|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 291, False: 14]
  |  |  |  |  ------------------
  |  |  |  |   29|    291|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    291|                               length);                                    \
  |  |  |  |   31|    291|    }                                                                      \
  |  |  |  |   32|    305|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    305|    }                                                                 \
  |  |   40|    306|    return result;                                                    \
  |  |   41|    306|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  224|    344|    case 0x5A:
  ------------------
  |  Branch (224:5): [True: 344, False: 30.5M]
  ------------------
  225|       |      /* Four bytes length byte string */
  226|    344|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint32, 4);
  ------------------
  |  |   35|    344|  do {                                                                \
  |  |   36|    344|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 342, False: 2]
  |  |  ------------------
  |  |   37|    342|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    342|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    342|  do {                                                                     \
  |  |  |  |   28|    342|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 328, False: 14]
  |  |  |  |  ------------------
  |  |  |  |   29|    328|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    328|                               length);                                    \
  |  |  |  |   31|    328|    }                                                                      \
  |  |  |  |   32|    342|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    342|    }                                                                 \
  |  |   40|    344|    return result;                                                    \
  |  |   41|    344|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  227|    235|    case 0x5B:
  ------------------
  |  Branch (227:5): [True: 235, False: 30.5M]
  ------------------
  228|       |      /* Eight bytes length byte string */
  229|    235|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint64, 8);
  ------------------
  |  |   35|    235|  do {                                                                \
  |  |   36|    235|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 234, False: 1]
  |  |  ------------------
  |  |   37|    234|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    234|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    234|  do {                                                                     \
  |  |  |  |   28|    234|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 201, False: 33]
  |  |  |  |  ------------------
  |  |  |  |   29|    201|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    201|                               length);                                    \
  |  |  |  |   31|    201|    }                                                                      \
  |  |  |  |   32|    234|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    234|    }                                                                 \
  |  |   40|    235|    return result;                                                    \
  |  |   41|    235|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  230|      1|    case 0x5C: /* Fallthrough */
  ------------------
  |  Branch (230:5): [True: 1, False: 30.5M]
  ------------------
  231|      4|    case 0x5D: /* Fallthrough */
  ------------------
  |  Branch (231:5): [True: 3, False: 30.5M]
  ------------------
  232|      5|    case 0x5E:
  ------------------
  |  Branch (232:5): [True: 1, False: 30.5M]
  ------------------
  233|       |      /* Reserved */
  234|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  235|  1.57k|    case 0x5F:
  ------------------
  |  Branch (235:5): [True: 1.57k, False: 30.5M]
  ------------------
  236|       |      /* Indefinite byte string */
  237|  1.57k|      {
  238|  1.57k|        callbacks->byte_string_start(context);
  239|  1.57k|        return result;
  240|      4|      }
  241|     11|    case 0x60: /* Fallthrough */
  ------------------
  |  Branch (241:5): [True: 11, False: 30.5M]
  ------------------
  242|   566k|    case 0x61: /* Fallthrough */
  ------------------
  |  Branch (242:5): [True: 566k, False: 29.9M]
  ------------------
  243|   567k|    case 0x62: /* Fallthrough */
  ------------------
  |  Branch (243:5): [True: 892, False: 30.5M]
  ------------------
  244|   578k|    case 0x63: /* Fallthrough */
  ------------------
  |  Branch (244:5): [True: 10.8k, False: 30.5M]
  ------------------
  245|   578k|    case 0x64: /* Fallthrough */
  ------------------
  |  Branch (245:5): [True: 407, False: 30.5M]
  ------------------
  246|   578k|    case 0x65: /* Fallthrough */
  ------------------
  |  Branch (246:5): [True: 296, False: 30.5M]
  ------------------
  247|   579k|    case 0x66: /* Fallthrough */
  ------------------
  |  Branch (247:5): [True: 256, False: 30.5M]
  ------------------
  248|   579k|    case 0x67: /* Fallthrough */
  ------------------
  |  Branch (248:5): [True: 307, False: 30.5M]
  ------------------
  249|   580k|    case 0x68: /* Fallthrough */
  ------------------
  |  Branch (249:5): [True: 709, False: 30.5M]
  ------------------
  250|   581k|    case 0x69: /* Fallthrough */
  ------------------
  |  Branch (250:5): [True: 1.50k, False: 30.5M]
  ------------------
  251|   584k|    case 0x6A: /* Fallthrough */
  ------------------
  |  Branch (251:5): [True: 2.69k, False: 30.5M]
  ------------------
  252|   584k|    case 0x6B: /* Fallthrough */
  ------------------
  |  Branch (252:5): [True: 543, False: 30.5M]
  ------------------
  253|   585k|    case 0x6C: /* Fallthrough */
  ------------------
  |  Branch (253:5): [True: 912, False: 30.5M]
  ------------------
  254|   586k|    case 0x6D: /* Fallthrough */
  ------------------
  |  Branch (254:5): [True: 261, False: 30.5M]
  ------------------
  255|   586k|    case 0x6E: /* Fallthrough */
  ------------------
  |  Branch (255:5): [True: 345, False: 30.5M]
  ------------------
  256|   586k|    case 0x6F: /* Fallthrough */
  ------------------
  |  Branch (256:5): [True: 212, False: 30.5M]
  ------------------
  257|   588k|    case 0x70: /* Fallthrough */
  ------------------
  |  Branch (257:5): [True: 2.24k, False: 30.5M]
  ------------------
  258|   590k|    case 0x71: /* Fallthrough */
  ------------------
  |  Branch (258:5): [True: 1.43k, False: 30.5M]
  ------------------
  259|   590k|    case 0x72: /* Fallthrough */
  ------------------
  |  Branch (259:5): [True: 425, False: 30.5M]
  ------------------
  260|   642k|    case 0x73: /* Fallthrough */
  ------------------
  |  Branch (260:5): [True: 52.1k, False: 30.4M]
  ------------------
  261|   646k|    case 0x74: /* Fallthrough */
  ------------------
  |  Branch (261:5): [True: 3.39k, False: 30.5M]
  ------------------
  262|   647k|    case 0x75: /* Fallthrough */
  ------------------
  |  Branch (262:5): [True: 1.10k, False: 30.5M]
  ------------------
  263|   647k|    case 0x76: /* Fallthrough */
  ------------------
  |  Branch (263:5): [True: 620, False: 30.5M]
  ------------------
  264|   649k|    case 0x77:
  ------------------
  |  Branch (264:5): [True: 1.74k, False: 30.5M]
  ------------------
  265|       |      /* Embedded one byte length string */
  266|   649k|      {
  267|   649k|        uint64_t length = _cbor_load_uint8(source) - 0x60; /* 0x60 offset */
  268|   649k|        CLAIM_BYTES_AND_INVOKE(string, length, 0);
  ------------------
  |  |   27|   649k|  do {                                                                     \
  |  |   28|   649k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 649k, False: 190]
  |  |  ------------------
  |  |   29|   649k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   30|   649k|                               length);                                    \
  |  |   31|   649k|    }                                                                      \
  |  |   32|   649k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  269|   649k|        return result;
  270|   647k|      }
  271|  4.28k|    case 0x78:
  ------------------
  |  Branch (271:5): [True: 4.28k, False: 30.5M]
  ------------------
  272|       |      /* One byte length string */
  273|  4.28k|      READ_CLAIM_INVOKE(string, _cbor_load_uint8, 1);
  ------------------
  |  |   35|  4.28k|  do {                                                                \
  |  |   36|  4.28k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 4.27k, False: 2]
  |  |  ------------------
  |  |   37|  4.27k|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|  4.27k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|  4.27k|  do {                                                                     \
  |  |  |  |   28|  4.27k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 4.27k, False: 5]
  |  |  |  |  ------------------
  |  |  |  |   29|  4.27k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|  4.27k|                               length);                                    \
  |  |  |  |   31|  4.27k|    }                                                                      \
  |  |  |  |   32|  4.27k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|  4.27k|    }                                                                 \
  |  |   40|  4.28k|    return result;                                                    \
  |  |   41|  4.28k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  274|    366|    case 0x79:
  ------------------
  |  Branch (274:5): [True: 366, False: 30.5M]
  ------------------
  275|       |      /* Two bytes length string */
  276|    366|      READ_CLAIM_INVOKE(string, _cbor_load_uint16, 2);
  ------------------
  |  |   35|    366|  do {                                                                \
  |  |   36|    366|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 365, False: 1]
  |  |  ------------------
  |  |   37|    365|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    365|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    365|  do {                                                                     \
  |  |  |  |   28|    365|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 355, False: 10]
  |  |  |  |  ------------------
  |  |  |  |   29|    355|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    355|                               length);                                    \
  |  |  |  |   31|    355|    }                                                                      \
  |  |  |  |   32|    365|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    365|    }                                                                 \
  |  |   40|    366|    return result;                                                    \
  |  |   41|    366|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  277|    224|    case 0x7A:
  ------------------
  |  Branch (277:5): [True: 224, False: 30.5M]
  ------------------
  278|       |      /* Four bytes length string */
  279|    224|      READ_CLAIM_INVOKE(string, _cbor_load_uint32, 4);
  ------------------
  |  |   35|    224|  do {                                                                \
  |  |   36|    224|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 223, False: 1]
  |  |  ------------------
  |  |   37|    223|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    223|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    223|  do {                                                                     \
  |  |  |  |   28|    223|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 204, False: 19]
  |  |  |  |  ------------------
  |  |  |  |   29|    204|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    204|                               length);                                    \
  |  |  |  |   31|    204|    }                                                                      \
  |  |  |  |   32|    223|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    223|    }                                                                 \
  |  |   40|    224|    return result;                                                    \
  |  |   41|    224|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  280|    245|    case 0x7B:
  ------------------
  |  Branch (280:5): [True: 245, False: 30.5M]
  ------------------
  281|       |      /* Eight bytes length string */
  282|    245|      READ_CLAIM_INVOKE(string, _cbor_load_uint64, 8);
  ------------------
  |  |   35|    245|  do {                                                                \
  |  |   36|    245|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 244, False: 1]
  |  |  ------------------
  |  |   37|    244|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    244|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    244|  do {                                                                     \
  |  |  |  |   28|    244|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 217, False: 27]
  |  |  |  |  ------------------
  |  |  |  |   29|    217|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    217|                               length);                                    \
  |  |  |  |   31|    217|    }                                                                      \
  |  |  |  |   32|    244|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    244|    }                                                                 \
  |  |   40|    245|    return result;                                                    \
  |  |   41|    245|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  283|      2|    case 0x7C: /* Fallthrough */
  ------------------
  |  Branch (283:5): [True: 2, False: 30.5M]
  ------------------
  284|      3|    case 0x7D: /* Fallthrough */
  ------------------
  |  Branch (284:5): [True: 1, False: 30.5M]
  ------------------
  285|      6|    case 0x7E:
  ------------------
  |  Branch (285:5): [True: 3, False: 30.5M]
  ------------------
  286|       |      /* Reserved */
  287|      6|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  288|  19.2k|    case 0x7F:
  ------------------
  |  Branch (288:5): [True: 19.2k, False: 30.5M]
  ------------------
  289|       |      /* Indefinite length string */
  290|  19.2k|      {
  291|  19.2k|        callbacks->string_start(context);
  292|  19.2k|        return result;
  293|      3|      }
  294|      1|    case 0x80: /* Fallthrough */
  ------------------
  |  Branch (294:5): [True: 1, False: 30.5M]
  ------------------
  295|  9.26M|    case 0x81: /* Fallthrough */
  ------------------
  |  Branch (295:5): [True: 9.26M, False: 21.2M]
  ------------------
  296|  9.27M|    case 0x82: /* Fallthrough */
  ------------------
  |  Branch (296:5): [True: 9.12k, False: 30.5M]
  ------------------
  297|  9.27M|    case 0x83: /* Fallthrough */
  ------------------
  |  Branch (297:5): [True: 7.53k, False: 30.5M]
  ------------------
  298|  9.29M|    case 0x84: /* Fallthrough */
  ------------------
  |  Branch (298:5): [True: 17.8k, False: 30.5M]
  ------------------
  299|  9.30M|    case 0x85: /* Fallthrough */
  ------------------
  |  Branch (299:5): [True: 3.92k, False: 30.5M]
  ------------------
  300|  9.30M|    case 0x86: /* Fallthrough */
  ------------------
  |  Branch (300:5): [True: 818, False: 30.5M]
  ------------------
  301|  9.30M|    case 0x87: /* Fallthrough */
  ------------------
  |  Branch (301:5): [True: 311, False: 30.5M]
  ------------------
  302|  9.30M|    case 0x88: /* Fallthrough */
  ------------------
  |  Branch (302:5): [True: 3.25k, False: 30.5M]
  ------------------
  303|  9.30M|    case 0x89: /* Fallthrough */
  ------------------
  |  Branch (303:5): [True: 807, False: 30.5M]
  ------------------
  304|  9.30M|    case 0x8A: /* Fallthrough */
  ------------------
  |  Branch (304:5): [True: 371, False: 30.5M]
  ------------------
  305|  9.30M|    case 0x8B: /* Fallthrough */
  ------------------
  |  Branch (305:5): [True: 716, False: 30.5M]
  ------------------
  306|  9.30M|    case 0x8C: /* Fallthrough */
  ------------------
  |  Branch (306:5): [True: 1.62k, False: 30.5M]
  ------------------
  307|  9.30M|    case 0x8D: /* Fallthrough */
  ------------------
  |  Branch (307:5): [True: 547, False: 30.5M]
  ------------------
  308|  9.30M|    case 0x8E: /* Fallthrough */
  ------------------
  |  Branch (308:5): [True: 1.30k, False: 30.5M]
  ------------------
  309|  9.31M|    case 0x8F: /* Fallthrough */
  ------------------
  |  Branch (309:5): [True: 276, False: 30.5M]
  ------------------
  310|  9.31M|    case 0x90: /* Fallthrough */
  ------------------
  |  Branch (310:5): [True: 256, False: 30.5M]
  ------------------
  311|  9.31M|    case 0x91: /* Fallthrough */
  ------------------
  |  Branch (311:5): [True: 800, False: 30.5M]
  ------------------
  312|  9.31M|    case 0x92: /* Fallthrough */
  ------------------
  |  Branch (312:5): [True: 469, False: 30.5M]
  ------------------
  313|  9.31M|    case 0x93: /* Fallthrough */
  ------------------
  |  Branch (313:5): [True: 288, False: 30.5M]
  ------------------
  314|  9.31M|    case 0x94: /* Fallthrough */
  ------------------
  |  Branch (314:5): [True: 325, False: 30.5M]
  ------------------
  315|  9.32M|    case 0x95: /* Fallthrough */
  ------------------
  |  Branch (315:5): [True: 10.2k, False: 30.5M]
  ------------------
  316|  9.32M|    case 0x96: /* Fallthrough */
  ------------------
  |  Branch (316:5): [True: 3.51k, False: 30.5M]
  ------------------
  317|  9.32M|    case 0x97:
  ------------------
  |  Branch (317:5): [True: 394, False: 30.5M]
  ------------------
  318|       |      /* Embedded one byte length array */
  319|  9.32M|      {
  320|  9.32M|        callbacks->array_start(
  321|  9.32M|            context, _cbor_load_uint8(source) - 0x80); /* 0x40 offset */
  322|  9.32M|        return result;
  323|  9.32M|      }
  324|    365|    case 0x98:
  ------------------
  |  Branch (324:5): [True: 365, False: 30.5M]
  ------------------
  325|       |      /* One byte length array */
  326|    365|      {
  327|    365|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (327:13): [True: 364, False: 1]
  ------------------
  328|    364|          callbacks->array_start(context, _cbor_load_uint8(source + 1));
  329|    364|        }
  330|    365|        return result;
  331|  9.32M|      }
  332|    233|    case 0x99:
  ------------------
  |  Branch (332:5): [True: 233, False: 30.5M]
  ------------------
  333|       |      /* Two bytes length array */
  334|    233|      {
  335|    233|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (335:13): [True: 231, False: 2]
  ------------------
  336|    231|          callbacks->array_start(context, _cbor_load_uint16(source + 1));
  337|    231|        }
  338|    233|        return result;
  339|  9.32M|      }
  340|    447|    case 0x9A:
  ------------------
  |  Branch (340:5): [True: 447, False: 30.5M]
  ------------------
  341|       |      /* Four bytes length array */
  342|    447|      {
  343|    447|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (343:13): [True: 446, False: 1]
  ------------------
  344|    446|          callbacks->array_start(context, _cbor_load_uint32(source + 1));
  345|    446|        }
  346|    447|        return result;
  347|  9.32M|      }
  348|    256|    case 0x9B:
  ------------------
  |  Branch (348:5): [True: 256, False: 30.5M]
  ------------------
  349|       |      /* Eight bytes length array */
  350|    256|      {
  351|    256|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (351:13): [True: 255, False: 1]
  ------------------
  352|    255|          callbacks->array_start(context, _cbor_load_uint64(source + 1));
  353|    255|        }
  354|    256|        return result;
  355|  9.32M|      }
  356|      1|    case 0x9C: /* Fallthrough */
  ------------------
  |  Branch (356:5): [True: 1, False: 30.5M]
  ------------------
  357|      3|    case 0x9D: /* Fallthrough */
  ------------------
  |  Branch (357:5): [True: 2, False: 30.5M]
  ------------------
  358|      4|    case 0x9E:
  ------------------
  |  Branch (358:5): [True: 1, False: 30.5M]
  ------------------
  359|       |      /* Reserved */
  360|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  361|   569k|    case 0x9F:
  ------------------
  |  Branch (361:5): [True: 569k, False: 29.9M]
  ------------------
  362|       |      /* Indefinite length array */
  363|   569k|      {
  364|   569k|        callbacks->indef_array_start(context);
  365|   569k|        return result;
  366|      3|      }
  367|      3|    case 0xA0: /* Fallthrough */
  ------------------
  |  Branch (367:5): [True: 3, False: 30.5M]
  ------------------
  368|  9.11k|    case 0xA1: /* Fallthrough */
  ------------------
  |  Branch (368:5): [True: 9.11k, False: 30.5M]
  ------------------
  369|  11.2k|    case 0xA2: /* Fallthrough */
  ------------------
  |  Branch (369:5): [True: 2.14k, False: 30.5M]
  ------------------
  370|  11.5k|    case 0xA3: /* Fallthrough */
  ------------------
  |  Branch (370:5): [True: 258, False: 30.5M]
  ------------------
  371|  15.1k|    case 0xA4: /* Fallthrough */
  ------------------
  |  Branch (371:5): [True: 3.58k, False: 30.5M]
  ------------------
  372|  19.3k|    case 0xA5: /* Fallthrough */
  ------------------
  |  Branch (372:5): [True: 4.26k, False: 30.5M]
  ------------------
  373|  19.7k|    case 0xA6: /* Fallthrough */
  ------------------
  |  Branch (373:5): [True: 355, False: 30.5M]
  ------------------
  374|  20.1k|    case 0xA7: /* Fallthrough */
  ------------------
  |  Branch (374:5): [True: 473, False: 30.5M]
  ------------------
  375|  20.6k|    case 0xA8: /* Fallthrough */
  ------------------
  |  Branch (375:5): [True: 458, False: 30.5M]
  ------------------
  376|  20.9k|    case 0xA9: /* Fallthrough */
  ------------------
  |  Branch (376:5): [True: 326, False: 30.5M]
  ------------------
  377|  21.2k|    case 0xAA: /* Fallthrough */
  ------------------
  |  Branch (377:5): [True: 269, False: 30.5M]
  ------------------
  378|  22.3k|    case 0xAB: /* Fallthrough */
  ------------------
  |  Branch (378:5): [True: 1.13k, False: 30.5M]
  ------------------
  379|  22.6k|    case 0xAC: /* Fallthrough */
  ------------------
  |  Branch (379:5): [True: 273, False: 30.5M]
  ------------------
  380|  23.1k|    case 0xAD: /* Fallthrough */
  ------------------
  |  Branch (380:5): [True: 468, False: 30.5M]
  ------------------
  381|  23.6k|    case 0xAE: /* Fallthrough */
  ------------------
  |  Branch (381:5): [True: 487, False: 30.5M]
  ------------------
  382|  24.1k|    case 0xAF: /* Fallthrough */
  ------------------
  |  Branch (382:5): [True: 529, False: 30.5M]
  ------------------
  383|  40.9k|    case 0xB0: /* Fallthrough */
  ------------------
  |  Branch (383:5): [True: 16.8k, False: 30.5M]
  ------------------
  384|  41.2k|    case 0xB1: /* Fallthrough */
  ------------------
  |  Branch (384:5): [True: 272, False: 30.5M]
  ------------------
  385|  44.0k|    case 0xB2: /* Fallthrough */
  ------------------
  |  Branch (385:5): [True: 2.79k, False: 30.5M]
  ------------------
  386|  45.3k|    case 0xB3: /* Fallthrough */
  ------------------
  |  Branch (386:5): [True: 1.31k, False: 30.5M]
  ------------------
  387|  45.8k|    case 0xB4: /* Fallthrough */
  ------------------
  |  Branch (387:5): [True: 456, False: 30.5M]
  ------------------
  388|  46.4k|    case 0xB5: /* Fallthrough */
  ------------------
  |  Branch (388:5): [True: 645, False: 30.5M]
  ------------------
  389|  47.5k|    case 0xB6: /* Fallthrough */
  ------------------
  |  Branch (389:5): [True: 1.13k, False: 30.5M]
  ------------------
  390|  48.2k|    case 0xB7:
  ------------------
  |  Branch (390:5): [True: 662, False: 30.5M]
  ------------------
  391|       |      /* Embedded one byte length map */
  392|  48.2k|      {
  393|  48.2k|        callbacks->map_start(context,
  394|  48.2k|                             _cbor_load_uint8(source) - 0xA0); /* 0xA0 offset */
  395|  48.2k|        return result;
  396|  47.5k|      }
  397|    279|    case 0xB8:
  ------------------
  |  Branch (397:5): [True: 279, False: 30.5M]
  ------------------
  398|       |      /* One byte length map */
  399|    279|      {
  400|    279|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (400:13): [True: 276, False: 3]
  ------------------
  401|    276|          callbacks->map_start(context, _cbor_load_uint8(source + 1));
  402|    276|        }
  403|    279|        return result;
  404|  47.5k|      }
  405|    349|    case 0xB9:
  ------------------
  |  Branch (405:5): [True: 349, False: 30.5M]
  ------------------
  406|       |      /* Two bytes length map */
  407|    349|      {
  408|    349|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (408:13): [True: 348, False: 1]
  ------------------
  409|    348|          callbacks->map_start(context, _cbor_load_uint16(source + 1));
  410|    348|        }
  411|    349|        return result;
  412|  47.5k|      }
  413|    372|    case 0xBA:
  ------------------
  |  Branch (413:5): [True: 372, False: 30.5M]
  ------------------
  414|       |      /* Four bytes length map */
  415|    372|      {
  416|    372|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (416:13): [True: 371, False: 1]
  ------------------
  417|    371|          callbacks->map_start(context, _cbor_load_uint32(source + 1));
  418|    371|        }
  419|    372|        return result;
  420|  47.5k|      }
  421|    237|    case 0xBB:
  ------------------
  |  Branch (421:5): [True: 237, False: 30.5M]
  ------------------
  422|       |      /* Eight bytes length map */
  423|    237|      {
  424|    237|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (424:13): [True: 236, False: 1]
  ------------------
  425|    236|          callbacks->map_start(context, _cbor_load_uint64(source + 1));
  426|    236|        }
  427|    237|        return result;
  428|  47.5k|      }
  429|      1|    case 0xBC: /* Fallthrough */
  ------------------
  |  Branch (429:5): [True: 1, False: 30.5M]
  ------------------
  430|      2|    case 0xBD: /* Fallthrough */
  ------------------
  |  Branch (430:5): [True: 1, False: 30.5M]
  ------------------
  431|      3|    case 0xBE:
  ------------------
  |  Branch (431:5): [True: 1, False: 30.5M]
  ------------------
  432|       |      /* Reserved */
  433|      3|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  434|  10.7k|    case 0xBF:
  ------------------
  |  Branch (434:5): [True: 10.7k, False: 30.5M]
  ------------------
  435|       |      /* Indefinite length map */
  436|  10.7k|      {
  437|  10.7k|        callbacks->indef_map_start(context);
  438|  10.7k|        return result;
  439|      2|      }
  440|       |      /* See https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml for tag
  441|       |       * assignment. All well-formed tags are processed regardless of validity
  442|       |       * since maintaining the known mapping would be impractical.
  443|       |       *
  444|       |       * Moreover, even tags in the reserved "standard" range are not assigned
  445|       |       * but may get assigned in the future (see e.g.
  446|       |       * https://github.com/PJK/libcbor/issues/307), so processing all tags
  447|       |       * improves forward compatibility.
  448|       |       */
  449|  22.3k|    case 0xC0: /* Fallthrough */
  ------------------
  |  Branch (449:5): [True: 22.3k, False: 30.4M]
  ------------------
  450|  24.9k|    case 0xC1: /* Fallthrough */
  ------------------
  |  Branch (450:5): [True: 2.61k, False: 30.5M]
  ------------------
  451|  40.0k|    case 0xC2: /* Fallthrough */
  ------------------
  |  Branch (451:5): [True: 15.0k, False: 30.5M]
  ------------------
  452|  45.5k|    case 0xC3: /* Fallthrough */
  ------------------
  |  Branch (452:5): [True: 5.54k, False: 30.5M]
  ------------------
  453|  52.8k|    case 0xC4: /* Fallthrough */
  ------------------
  |  Branch (453:5): [True: 7.27k, False: 30.5M]
  ------------------
  454|   103k|    case 0xC5: /* Fallthrough */
  ------------------
  |  Branch (454:5): [True: 50.3k, False: 30.4M]
  ------------------
  455|   105k|    case 0xC6: /* Fallthrough */
  ------------------
  |  Branch (455:5): [True: 2.18k, False: 30.5M]
  ------------------
  456|   105k|    case 0xC7: /* Fallthrough */
  ------------------
  |  Branch (456:5): [True: 303, False: 30.5M]
  ------------------
  457|   106k|    case 0xC8: /* Fallthrough */
  ------------------
  |  Branch (457:5): [True: 684, False: 30.5M]
  ------------------
  458|   106k|    case 0xC9: /* Fallthrough */
  ------------------
  |  Branch (458:5): [True: 485, False: 30.5M]
  ------------------
  459|   107k|    case 0xCA: /* Fallthrough */
  ------------------
  |  Branch (459:5): [True: 382, False: 30.5M]
  ------------------
  460|   107k|    case 0xCB: /* Fallthrough */
  ------------------
  |  Branch (460:5): [True: 321, False: 30.5M]
  ------------------
  461|   111k|    case 0xCC: /* Fallthrough */
  ------------------
  |  Branch (461:5): [True: 4.46k, False: 30.5M]
  ------------------
  462|   112k|    case 0xCD: /* Fallthrough */
  ------------------
  |  Branch (462:5): [True: 694, False: 30.5M]
  ------------------
  463|   113k|    case 0xCE: /* Fallthrough */
  ------------------
  |  Branch (463:5): [True: 861, False: 30.5M]
  ------------------
  464|   114k|    case 0xCF: /* Fallthrough */
  ------------------
  |  Branch (464:5): [True: 843, False: 30.5M]
  ------------------
  465|   114k|    case 0xD0: /* Fallthrough */
  ------------------
  |  Branch (465:5): [True: 507, False: 30.5M]
  ------------------
  466|   115k|    case 0xD1: /* Fallthrough */
  ------------------
  |  Branch (466:5): [True: 428, False: 30.5M]
  ------------------
  467|   115k|    case 0xD2: /* Fallthrough */
  ------------------
  |  Branch (467:5): [True: 331, False: 30.5M]
  ------------------
  468|   116k|    case 0xD3: /* Fallthrough */
  ------------------
  |  Branch (468:5): [True: 485, False: 30.5M]
  ------------------
  469|   116k|    case 0xD4: /* Fallthrough */
  ------------------
  |  Branch (469:5): [True: 705, False: 30.5M]
  ------------------
  470|   117k|    case 0xD5: /* Fallthrough */
  ------------------
  |  Branch (470:5): [True: 896, False: 30.5M]
  ------------------
  471|   119k|    case 0xD6: /* Fallthrough */
  ------------------
  |  Branch (471:5): [True: 1.36k, False: 30.5M]
  ------------------
  472|   175k|    case 0xD7: /* Fallthrough */
  ------------------
  |  Branch (472:5): [True: 56.1k, False: 30.4M]
  ------------------
  473|   175k|    {
  474|   175k|      callbacks->tag(context, (uint64_t)(_cbor_load_uint8(source) -
  475|   175k|                                         0xC0)); /* 0xC0 offset */
  476|   175k|      return result;
  477|   119k|    }
  478|  1.34k|    case 0xD8: /* 1B tag */
  ------------------
  |  Branch (478:5): [True: 1.34k, False: 30.5M]
  ------------------
  479|  1.34k|    {
  480|  1.34k|      if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (480:11): [True: 1.33k, False: 3]
  ------------------
  481|  1.33k|        callbacks->tag(context, _cbor_load_uint8(source + 1));
  482|  1.33k|      }
  483|  1.34k|      return result;
  484|   119k|    }
  485|  2.45k|    case 0xD9: /* 2B tag */
  ------------------
  |  Branch (485:5): [True: 2.45k, False: 30.5M]
  ------------------
  486|  2.45k|    {
  487|  2.45k|      if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (487:11): [True: 2.45k, False: 1]
  ------------------
  488|  2.45k|        callbacks->tag(context, _cbor_load_uint16(source + 1));
  489|  2.45k|      }
  490|  2.45k|      return result;
  491|   119k|    }
  492|  9.37k|    case 0xDA: /* 4B tag */
  ------------------
  |  Branch (492:5): [True: 9.37k, False: 30.5M]
  ------------------
  493|  9.37k|    {
  494|  9.37k|      if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (494:11): [True: 9.36k, False: 1]
  ------------------
  495|  9.36k|        callbacks->tag(context, _cbor_load_uint32(source + 1));
  496|  9.36k|      }
  497|  9.37k|      return result;
  498|   119k|    }
  499|  2.59k|    case 0xDB: /* 8B tag */
  ------------------
  |  Branch (499:5): [True: 2.59k, False: 30.5M]
  ------------------
  500|  2.59k|    {
  501|  2.59k|      if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (501:11): [True: 2.59k, False: 1]
  ------------------
  502|  2.59k|        callbacks->tag(context, _cbor_load_uint64(source + 1));
  503|  2.59k|      }
  504|  2.59k|      return result;
  505|   119k|    }
  506|      1|    case 0xDC: /* Fallthrough */
  ------------------
  |  Branch (506:5): [True: 1, False: 30.5M]
  ------------------
  507|      2|    case 0xDD: /* Fallthrough */
  ------------------
  |  Branch (507:5): [True: 1, False: 30.5M]
  ------------------
  508|      3|    case 0xDE: /* Fallthrough */
  ------------------
  |  Branch (508:5): [True: 1, False: 30.5M]
  ------------------
  509|      4|    case 0xDF: /* Reserved */
  ------------------
  |  Branch (509:5): [True: 1, False: 30.5M]
  ------------------
  510|      4|    {
  511|      4|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  512|      3|    }
  513|      1|    case 0xE0: /* Fallthrough */
  ------------------
  |  Branch (513:5): [True: 1, False: 30.5M]
  ------------------
  514|      4|    case 0xE1: /* Fallthrough */
  ------------------
  |  Branch (514:5): [True: 3, False: 30.5M]
  ------------------
  515|      5|    case 0xE2: /* Fallthrough */
  ------------------
  |  Branch (515:5): [True: 1, False: 30.5M]
  ------------------
  516|      6|    case 0xE3: /* Fallthrough */
  ------------------
  |  Branch (516:5): [True: 1, False: 30.5M]
  ------------------
  517|      7|    case 0xE4: /* Fallthrough */
  ------------------
  |  Branch (517:5): [True: 1, False: 30.5M]
  ------------------
  518|      8|    case 0xE5: /* Fallthrough */
  ------------------
  |  Branch (518:5): [True: 1, False: 30.5M]
  ------------------
  519|      9|    case 0xE6: /* Fallthrough */
  ------------------
  |  Branch (519:5): [True: 1, False: 30.5M]
  ------------------
  520|     10|    case 0xE7: /* Fallthrough */
  ------------------
  |  Branch (520:5): [True: 1, False: 30.5M]
  ------------------
  521|     11|    case 0xE8: /* Fallthrough */
  ------------------
  |  Branch (521:5): [True: 1, False: 30.5M]
  ------------------
  522|     12|    case 0xE9: /* Fallthrough */
  ------------------
  |  Branch (522:5): [True: 1, False: 30.5M]
  ------------------
  523|     13|    case 0xEA: /* Fallthrough */
  ------------------
  |  Branch (523:5): [True: 1, False: 30.5M]
  ------------------
  524|     15|    case 0xEB: /* Fallthrough */
  ------------------
  |  Branch (524:5): [True: 2, False: 30.5M]
  ------------------
  525|     16|    case 0xEC: /* Fallthrough */
  ------------------
  |  Branch (525:5): [True: 1, False: 30.5M]
  ------------------
  526|     18|    case 0xED: /* Fallthrough */
  ------------------
  |  Branch (526:5): [True: 2, False: 30.5M]
  ------------------
  527|     19|    case 0xEE: /* Fallthrough */
  ------------------
  |  Branch (527:5): [True: 1, False: 30.5M]
  ------------------
  528|     21|    case 0xEF: /* Fallthrough */
  ------------------
  |  Branch (528:5): [True: 2, False: 30.5M]
  ------------------
  529|     22|    case 0xF0: /* Fallthrough */
  ------------------
  |  Branch (529:5): [True: 1, False: 30.5M]
  ------------------
  530|     23|    case 0xF1: /* Fallthrough */
  ------------------
  |  Branch (530:5): [True: 1, False: 30.5M]
  ------------------
  531|     24|    case 0xF2: /* Fallthrough */
  ------------------
  |  Branch (531:5): [True: 1, False: 30.5M]
  ------------------
  532|     32|    case 0xF3: /* Simple value - unassigned */
  ------------------
  |  Branch (532:5): [True: 8, False: 30.5M]
  ------------------
  533|     32|    {
  534|     32|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  535|     24|    }
  536|  83.5k|    case 0xF4:
  ------------------
  |  Branch (536:5): [True: 83.5k, False: 30.4M]
  ------------------
  537|       |      /* False */
  538|  83.5k|      {
  539|  83.5k|        callbacks->boolean(context, false);
  540|  83.5k|        return result;
  541|     24|      }
  542|  2.63M|    case 0xF5:
  ------------------
  |  Branch (542:5): [True: 2.63M, False: 27.8M]
  ------------------
  543|       |      /* True */
  544|  2.63M|      {
  545|  2.63M|        callbacks->boolean(context, true);
  546|  2.63M|        return result;
  547|     24|      }
  548|   372k|    case 0xF6:
  ------------------
  |  Branch (548:5): [True: 372k, False: 30.1M]
  ------------------
  549|       |      /* Null */
  550|   372k|      {
  551|   372k|        callbacks->null(context);
  552|   372k|        return result;
  553|     24|      }
  554|  30.3k|    case 0xF7:
  ------------------
  |  Branch (554:5): [True: 30.3k, False: 30.4M]
  ------------------
  555|       |      /* Undefined */
  556|  30.3k|      {
  557|  30.3k|        callbacks->undefined(context);
  558|  30.3k|        return result;
  559|     24|      }
  560|      1|    case 0xF8:
  ------------------
  |  Branch (560:5): [True: 1, False: 30.5M]
  ------------------
  561|       |      /* 1B simple value, unassigned */
  562|      1|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  563|  56.5k|    case 0xF9:
  ------------------
  |  Branch (563:5): [True: 56.5k, False: 30.4M]
  ------------------
  564|       |      /* 2B float */
  565|  56.5k|      {
  566|  56.5k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (566:13): [True: 56.5k, False: 2]
  ------------------
  567|  56.5k|          callbacks->float2(context, _cbor_load_half(source + 1));
  568|  56.5k|        }
  569|  56.5k|        return result;
  570|     24|      }
  571|  9.17k|    case 0xFA:
  ------------------
  |  Branch (571:5): [True: 9.17k, False: 30.5M]
  ------------------
  572|       |      /* 4B float */
  573|  9.17k|      {
  574|  9.17k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (574:13): [True: 9.17k, False: 2]
  ------------------
  575|  9.17k|          callbacks->float4(context, _cbor_load_float(source + 1));
  576|  9.17k|        }
  577|  9.17k|        return result;
  578|     24|      }
  579|  31.0k|    case 0xFB:
  ------------------
  |  Branch (579:5): [True: 31.0k, False: 30.4M]
  ------------------
  580|       |      /* 8B float */
  581|  31.0k|      {
  582|  31.0k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (582:13): [True: 31.0k, False: 1]
  ------------------
  583|  31.0k|          callbacks->float8(context, _cbor_load_double(source + 1));
  584|  31.0k|        }
  585|  31.0k|        return result;
  586|     24|      }
  587|      1|    case 0xFC: /* Fallthrough */
  ------------------
  |  Branch (587:5): [True: 1, False: 30.5M]
  ------------------
  588|      2|    case 0xFD: /* Fallthrough */
  ------------------
  |  Branch (588:5): [True: 1, False: 30.5M]
  ------------------
  589|      4|    case 0xFE:
  ------------------
  |  Branch (589:5): [True: 2, False: 30.5M]
  ------------------
  590|       |      /* Reserved */
  591|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  592|   565k|    case 0xFF:
  ------------------
  |  Branch (592:5): [True: 565k, False: 29.9M]
  ------------------
  593|       |      /* Break */
  594|   565k|      callbacks->indef_break(context);
  595|       |      // Never happens, the switch statement is exhaustive on the 1B range; make
  596|       |      // compiler happy
  597|   565k|    default:
  ------------------
  |  Branch (597:5): [True: 0, False: 30.5M]
  ------------------
  598|   565k|      return result;
  599|  30.5M|  }
  600|  30.5M|}
streaming.c:claim_bytes:
   12|  32.4M|                        struct cbor_decoder_result *result) {
   13|  32.4M|  if (required > (provided - result->read)) {
  ------------------
  |  Branch (13:7): [True: 550, False: 32.4M]
  ------------------
   14|    550|    result->required = required + result->read;
   15|    550|    result->read = 0;
   16|    550|    result->status = CBOR_DECODER_NEDATA;
   17|    550|    return false;
   18|  32.4M|  } else {
   19|  32.4M|    result->read += required;
   20|  32.4M|    result->required = 0;
   21|  32.4M|    return true;
   22|  32.4M|  }
   23|  32.4M|}

cbor_new_definite_string:
   13|  1.21M|cbor_item_t *cbor_new_definite_string(void) {
   14|  1.21M|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   15|  1.21M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  1.21M|  do {                           \
  |  |  107|  1.21M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 1.21M]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  1.21M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   16|  1.21M|  *item = (cbor_item_t){
   17|  1.21M|      .refcount = 1,
   18|  1.21M|      .type = CBOR_TYPE_STRING,
   19|  1.21M|      .metadata = {.string_metadata = {_CBOR_METADATA_DEFINITE, 0}}};
   20|  1.21M|  return item;
   21|  1.21M|}
cbor_new_indefinite_string:
   23|  27.7k|cbor_item_t *cbor_new_indefinite_string(void) {
   24|  27.7k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   25|  27.7k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  27.7k|  do {                           \
  |  |  107|  27.7k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 27.7k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  27.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   26|  27.7k|  *item = (cbor_item_t){
   27|  27.7k|      .refcount = 1,
   28|  27.7k|      .type = CBOR_TYPE_STRING,
   29|  27.7k|      .metadata = {.string_metadata = {.type = _CBOR_METADATA_INDEFINITE,
   30|  27.7k|                                       .length = 0}},
   31|  27.7k|      .data = _cbor_malloc(sizeof(struct cbor_indefinite_string_data))};
   32|  27.7k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  114|  27.7k|  do {                                              \
  |  |  115|  27.7k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 0, False: 27.7k]
  |  |  ------------------
  |  |  116|      0|      _cbor_free(cbor_item);                        \
  |  |  117|      0|      return NULL;                                  \
  |  |  118|      0|    }                                               \
  |  |  119|  27.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   33|  27.7k|  *((struct cbor_indefinite_string_data *)item->data) =
   34|  27.7k|      (struct cbor_indefinite_string_data){
   35|  27.7k|          .chunk_count = 0,
   36|  27.7k|          .chunk_capacity = 0,
   37|  27.7k|          .chunks = NULL,
   38|  27.7k|      };
   39|  27.7k|  return item;
   40|  27.7k|}
cbor_build_stringn:
   53|   561k|cbor_item_t *cbor_build_stringn(const char *val, size_t length) {
   54|   561k|  cbor_item_t *item = cbor_new_definite_string();
   55|   561k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   561k|  do {                           \
  |  |  107|   561k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 561k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   561k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   56|   561k|  unsigned char *handle = _cbor_malloc(length);
   57|   561k|  _CBOR_DEPENDENT_NOTNULL(item, handle);
  ------------------
  |  |  114|   561k|  do {                                              \
  |  |  115|   561k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 0, False: 561k]
  |  |  ------------------
  |  |  116|      0|      _cbor_free(cbor_item);                        \
  |  |  117|      0|      return NULL;                                  \
  |  |  118|      0|    }                                               \
  |  |  119|   561k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   58|   561k|  memcpy(handle, val, length);
   59|   561k|  cbor_string_set_handle(item, handle, length);
   60|   561k|  return item;
   61|   561k|}
cbor_string_set_handle:
   65|  1.21M|                            size_t length) {
   66|  1.21M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  1.21M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   67|  1.21M|  CBOR_ASSERT(cbor_string_is_definite(item));
  ------------------
  |  |   63|  1.21M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   68|  1.21M|  item->data = data;
   69|  1.21M|  item->metadata.string_metadata.length = length;
   70|  1.21M|  struct _cbor_unicode_status unicode_status;
   71|  1.21M|  size_t codepoint_count =
   72|  1.21M|      _cbor_unicode_codepoint_count(data, length, &unicode_status);
   73|  1.21M|  CBOR_ASSERT(codepoint_count <= length);
  ------------------
  |  |   63|  1.21M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   74|  1.21M|  if (unicode_status.status == _CBOR_UNICODE_OK) {
  ------------------
  |  Branch (74:7): [True: 1.20M, False: 13.5k]
  ------------------
   75|  1.20M|    item->metadata.string_metadata.codepoint_count = codepoint_count;
   76|  1.20M|  } else {
   77|  13.5k|    item->metadata.string_metadata.codepoint_count = 0;
   78|  13.5k|  }
   79|  1.21M|}
cbor_string_chunks_handle:
   81|  1.10M|cbor_item_t **cbor_string_chunks_handle(const cbor_item_t *item) {
   82|  1.10M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  1.10M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   83|  1.10M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   63|  1.10M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   84|  1.10M|  return ((struct cbor_indefinite_string_data *)item->data)->chunks;
   85|  1.10M|}
cbor_string_chunk_count:
   87|  2.75M|size_t cbor_string_chunk_count(const cbor_item_t *item) {
   88|  2.75M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  2.75M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   89|  2.75M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   63|  2.75M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   90|  2.75M|  return ((struct cbor_indefinite_string_data *)item->data)->chunk_count;
   91|  2.75M|}
cbor_string_add_chunk:
   93|  1.09M|bool cbor_string_add_chunk(cbor_item_t *item, cbor_item_t *chunk) {
   94|  1.09M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  1.09M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   95|  1.09M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   63|  1.09M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   96|  1.09M|  struct cbor_indefinite_string_data *data =
   97|  1.09M|      (struct cbor_indefinite_string_data *)item->data;
   98|  1.09M|  if (data->chunk_count == data->chunk_capacity) {
  ------------------
  |  Branch (98:7): [True: 1.89k, False: 1.09M]
  ------------------
   99|  1.89k|    if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, data->chunk_capacity)) {
  ------------------
  |  |    8|  1.89k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (99:9): [True: 0, False: 1.89k]
  ------------------
  100|      0|      return false;
  101|      0|    }
  102|       |
  103|  1.89k|    size_t new_chunk_capacity =
  104|  1.89k|        data->chunk_capacity == 0 ? 1
  ------------------
  |  Branch (104:9): [True: 611, False: 1.28k]
  ------------------
  105|  1.89k|                                  : CBOR_BUFFER_GROWTH * (data->chunk_capacity);
  ------------------
  |  |    8|  1.28k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  106|  1.89k|    cbor_item_t **new_chunks_data = _cbor_realloc_multiple(
  107|  1.89k|        data->chunks, sizeof(cbor_item_t *), new_chunk_capacity);
  108|       |
  109|  1.89k|    if (new_chunks_data == NULL) {
  ------------------
  |  Branch (109:9): [True: 0, False: 1.89k]
  ------------------
  110|      0|      return false;
  111|      0|    }
  112|       |
  113|  1.89k|    data->chunk_capacity = new_chunk_capacity;
  114|  1.89k|    data->chunks = new_chunks_data;
  115|  1.89k|  }
  116|  1.09M|  data->chunks[data->chunk_count++] = cbor_incref(chunk);
  117|  1.09M|  return true;
  118|  1.09M|}
cbor_string_length:
  120|  3.93M|size_t cbor_string_length(const cbor_item_t *item) {
  121|  3.93M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  3.93M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  122|  3.93M|  return item->metadata.string_metadata.length;
  123|  3.93M|}
cbor_string_handle:
  125|  1.68M|unsigned char *cbor_string_handle(const cbor_item_t *item) {
  126|  1.68M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  1.68M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  127|  1.68M|  return item->data;
  128|  1.68M|}
cbor_string_codepoint_count:
  130|   561k|size_t cbor_string_codepoint_count(const cbor_item_t *item) {
  131|   561k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|   561k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  132|   561k|  return item->metadata.string_metadata.codepoint_count;
  133|   561k|}
cbor_string_is_definite:
  135|  10.2M|bool cbor_string_is_definite(const cbor_item_t *item) {
  136|  10.2M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|  10.2M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  137|  10.2M|  return item->metadata.string_metadata.type == _CBOR_METADATA_DEFINITE;
  138|  10.2M|}
cbor_string_is_indefinite:
  140|  6.10M|bool cbor_string_is_indefinite(const cbor_item_t *item) {
  141|  6.10M|  return !cbor_string_is_definite(item);
  142|  6.10M|}

cbor_new_tag:
   10|   299k|cbor_item_t *cbor_new_tag(uint64_t value) {
   11|   299k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   12|   299k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|   299k|  do {                           \
  |  |  107|   299k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 299k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|   299k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   13|       |
   14|   299k|  *item = (cbor_item_t){
   15|   299k|      .refcount = 1,
   16|   299k|      .type = CBOR_TYPE_TAG,
   17|   299k|      .metadata = {.tag_metadata = {.value = value, .tagged_item = NULL}},
   18|       |      .data = NULL /* Never used */
   19|   299k|  };
   20|   299k|  return item;
   21|   299k|}
cbor_tag_item:
   23|   434k|cbor_item_t *cbor_tag_item(const cbor_item_t *tag) {
   24|   434k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   63|   434k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   25|   434k|  return cbor_incref(tag->metadata.tag_metadata.tagged_item);
   26|   434k|}
cbor_tag_value:
   28|   434k|uint64_t cbor_tag_value(const cbor_item_t *tag) {
   29|   434k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   63|   434k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   30|   434k|  return tag->metadata.tag_metadata.value;
   31|   434k|}
cbor_tag_set_item:
   33|   277k|void cbor_tag_set_item(cbor_item_t *tag, cbor_item_t *tagged_item) {
   34|   277k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   63|   277k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   35|   277k|  cbor_incref(tagged_item);
   36|   277k|  tag->metadata.tag_metadata.tagged_item = tagged_item;
   37|   277k|}
cbor_build_tag:
   39|   108k|cbor_item_t *cbor_build_tag(uint64_t value, cbor_item_t *item) {
   40|   108k|  cbor_item_t *res = cbor_new_tag(value);
   41|   108k|  if (res == NULL) {
  ------------------
  |  Branch (41:7): [True: 0, False: 108k]
  ------------------
   42|      0|    return NULL;
   43|      0|  }
   44|   108k|  cbor_tag_set_item(res, item);
   45|   108k|  return res;
   46|   108k|}

