_Z14limited_mallocm:
   12|  87.1M|void *limited_malloc(size_t size) {
   13|  87.1M|    if (size + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (13:9): [True: 73, False: 87.1M]
  ------------------
   14|     73|        return nullptr;
   15|     73|    }
   16|  87.1M|    if (size == 0) {
  ------------------
  |  Branch (16:9): [True: 86, False: 87.1M]
  ------------------
   17|     86|        return nullptr;
   18|     86|    }
   19|  87.1M|    void* m = malloc(size);
   20|  87.1M|    if (m != nullptr) {
  ------------------
  |  Branch (20:9): [True: 87.1M, False: 0]
  ------------------
   21|  87.1M|        allocated_mem += size;
   22|  87.1M|        allocated_len_map[m] = size;
   23|  87.1M|    }
   24|  87.1M|    return m;
   25|  87.1M|}
_Z12limited_freePv:
   27|  87.7M|void limited_free(void *ptr) {
   28|  87.7M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (28:9): [True: 87.1M, False: 555k]
  |  Branch (28:9): [True: 0, False: 87.7M]
  |  Branch (28:24): [True: 0, False: 87.1M]
  ------------------
   29|      0|        abort();
   30|      0|    }
   31|  87.7M|    free(ptr);
   32|  87.7M|    if (ptr != NULL) {
  ------------------
  |  Branch (32:9): [True: 87.1M, False: 555k]
  ------------------
   33|  87.1M|        allocated_mem -= allocated_len_map[ptr];
   34|  87.1M|        allocated_len_map.erase(ptr);
   35|  87.1M|    }
   36|  87.7M|}
_Z15limited_reallocPvm:
   38|  1.50M|void *limited_realloc(void *ptr, size_t size) {
   39|  1.50M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (39:9): [True: 967k, False: 534k]
  |  Branch (39:9): [True: 0, False: 1.50M]
  |  Branch (39:24): [True: 0, False: 967k]
  ------------------
   40|      0|        abort();
   41|      0|    }
   42|  1.50M|    if (ptr == NULL) {
  ------------------
  |  Branch (42:9): [True: 534k, False: 967k]
  ------------------
   43|   534k|        return limited_malloc(size);
   44|   534k|    }
   45|   967k|    long delta = (long) size - allocated_len_map[ptr];
   46|   967k|    if (delta + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (46:9): [True: 8, False: 967k]
  ------------------
   47|      8|        return nullptr;
   48|      8|    }
   49|   967k|    void* new_ptr = realloc(ptr, size);
   50|   967k|    if (size > 0 && new_ptr == nullptr) {
  ------------------
  |  Branch (50:9): [True: 967k, False: 0]
  |  Branch (50:21): [True: 0, False: 967k]
  ------------------
   51|      0|        return nullptr;
   52|      0|    }
   53|   967k|    allocated_mem += delta;
   54|   967k|    allocated_len_map.erase(ptr);
   55|   967k|    if (size > 0) {
  ------------------
  |  Branch (55:9): [True: 967k, False: 0]
  ------------------
   56|   967k|        allocated_len_map[new_ptr] = size;
   57|   967k|    }
   58|   967k|    return new_ptr;
   59|   967k|}
LLVMFuzzerTestOneInput:
   71|  3.63k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   72|  3.63k|    cbor_load_result result;
   73|  3.63k|    cbor_item_t *item = cbor_load(Data, Size, &result);
   74|  3.63k|    if (result.error.code == CBOR_ERR_NONE) {
  ------------------
  |  Branch (74:9): [True: 1.32k, False: 2.31k]
  ------------------
   75|  1.32k|        cbor_describe(item, kState.fout);
   76|  1.32k|        unsigned char *buffer;
   77|  1.32k|        size_t buffer_size;
   78|  1.32k|        cbor_serialize_alloc(item, &buffer, &buffer_size);
   79|  1.32k|        free(buffer);
   80|  1.32k|        cbor_item_t *copied = cbor_copy(item);
   81|  1.32k|        cbor_decref(&copied);
   82|  1.32k|        cbor_decref(&item);
   83|  1.32k|    }
   84|  3.63k|    return 0;
   85|  3.63k|}
_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.63k|                       struct cbor_load_result *result) {
   15|       |  /* Context stack */
   16|  3.63k|  static struct cbor_callbacks callbacks = {
   17|  3.63k|      .uint8 = &cbor_builder_uint8_callback,
   18|  3.63k|      .uint16 = &cbor_builder_uint16_callback,
   19|  3.63k|      .uint32 = &cbor_builder_uint32_callback,
   20|  3.63k|      .uint64 = &cbor_builder_uint64_callback,
   21|       |
   22|  3.63k|      .negint8 = &cbor_builder_negint8_callback,
   23|  3.63k|      .negint16 = &cbor_builder_negint16_callback,
   24|  3.63k|      .negint32 = &cbor_builder_negint32_callback,
   25|  3.63k|      .negint64 = &cbor_builder_negint64_callback,
   26|       |
   27|  3.63k|      .byte_string = &cbor_builder_byte_string_callback,
   28|  3.63k|      .byte_string_start = &cbor_builder_byte_string_start_callback,
   29|       |
   30|  3.63k|      .string = &cbor_builder_string_callback,
   31|  3.63k|      .string_start = &cbor_builder_string_start_callback,
   32|       |
   33|  3.63k|      .array_start = &cbor_builder_array_start_callback,
   34|  3.63k|      .indef_array_start = &cbor_builder_indef_array_start_callback,
   35|       |
   36|  3.63k|      .map_start = &cbor_builder_map_start_callback,
   37|  3.63k|      .indef_map_start = &cbor_builder_indef_map_start_callback,
   38|       |
   39|  3.63k|      .tag = &cbor_builder_tag_callback,
   40|       |
   41|  3.63k|      .null = &cbor_builder_null_callback,
   42|  3.63k|      .undefined = &cbor_builder_undefined_callback,
   43|  3.63k|      .boolean = &cbor_builder_boolean_callback,
   44|  3.63k|      .float2 = &cbor_builder_float2_callback,
   45|  3.63k|      .float4 = &cbor_builder_float4_callback,
   46|  3.63k|      .float8 = &cbor_builder_float8_callback,
   47|  3.63k|      .indef_break = &cbor_builder_indef_break_callback};
   48|       |
   49|  3.63k|  if (source_size == 0) {
  ------------------
  |  Branch (49:7): [True: 0, False: 3.63k]
  ------------------
   50|      0|    result->error.code = CBOR_ERR_NODATA;
   51|      0|    return NULL;
   52|      0|  }
   53|  3.63k|  struct _cbor_stack stack = _cbor_stack_init();
   54|       |
   55|       |  /* Target for callbacks */
   56|  3.63k|  struct _cbor_decoder_context context = (struct _cbor_decoder_context){
   57|  3.63k|      .stack = &stack, .creation_failed = false, .syntax_error = false};
   58|  3.63k|  struct cbor_decoder_result decode_result;
   59|  3.63k|  *result =
   60|  3.63k|      (struct cbor_load_result){.read = 0, .error = {.code = CBOR_ERR_NONE}};
   61|       |
   62|  36.7M|  do {
   63|  36.7M|    if (source_size > result->read) { /* Check for overflows */
  ------------------
  |  Branch (63:9): [True: 36.7M, False: 1.30k]
  ------------------
   64|  36.7M|      decode_result =
   65|  36.7M|          cbor_stream_decode(source + result->read, source_size - result->read,
   66|  36.7M|                             &callbacks, &context);
   67|  36.7M|    } else {
   68|  1.30k|      result->error = (struct cbor_error){.code = CBOR_ERR_NOTENOUGHDATA,
   69|  1.30k|                                          .position = result->read};
   70|  1.30k|      goto error;
   71|  1.30k|    }
   72|       |
   73|  36.7M|    switch (decode_result.status) {
  ------------------
  |  Branch (73:13): [True: 0, False: 36.7M]
  ------------------
   74|  36.7M|      case CBOR_DECODER_FINISHED:
  ------------------
  |  Branch (74:7): [True: 36.7M, False: 634]
  ------------------
   75|       |        /* Everything OK */
   76|  36.7M|        {
   77|  36.7M|          result->read += decode_result.read;
   78|  36.7M|          break;
   79|      0|        }
   80|    554|      case CBOR_DECODER_NEDATA:
  ------------------
  |  Branch (80:7): [True: 554, False: 36.7M]
  ------------------
   81|       |        /* Data length doesn't match MTB expectation */
   82|    554|        {
   83|    554|          result->error.code = CBOR_ERR_NOTENOUGHDATA;
   84|    554|          goto error;
   85|      0|        }
   86|     80|      case CBOR_DECODER_ERROR:
  ------------------
  |  Branch (86:7): [True: 80, False: 36.7M]
  ------------------
   87|       |        /* Reserved/malformed item */
   88|     80|        {
   89|     80|          result->error.code = CBOR_ERR_MALFORMATED;
   90|     80|          goto error;
   91|      0|        }
   92|  36.7M|    }
   93|       |
   94|  36.7M|    if (context.creation_failed) {
  ------------------
  |  Branch (94:9): [True: 250, False: 36.7M]
  ------------------
   95|       |      /* Most likely unsuccessful allocation - our callback has failed */
   96|    250|      result->error.code = CBOR_ERR_MEMERROR;
   97|    250|      goto error;
   98|  36.7M|    } else if (context.syntax_error) {
  ------------------
  |  Branch (98:16): [True: 117, False: 36.7M]
  ------------------
   99|    117|      result->error.code = CBOR_ERR_SYNTAXERROR;
  100|    117|      goto error;
  101|    117|    }
  102|  36.7M|  } while (stack.size > 0);
  ------------------
  |  Branch (102:12): [True: 36.7M, False: 1.32k]
  ------------------
  103|       |
  104|  1.32k|  return context.root;
  105|       |
  106|  2.31k|error:
  107|  2.31k|  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|  80.5k|  while (stack.size > 0) {
  ------------------
  |  Branch (111:10): [True: 78.2k, False: 2.31k]
  ------------------
  112|  78.2k|    cbor_decref(&stack.top->item);
  113|  78.2k|    _cbor_stack_pop(&stack);
  114|  78.2k|  }
  115|  2.31k|  return NULL;
  116|  3.63k|}
cbor_copy:
  154|  22.7M|cbor_item_t *cbor_copy(cbor_item_t *item) {
  155|       |  // cppcheck-suppress missingReturn
  156|  22.7M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (156:11): [True: 0, False: 22.7M]
  ------------------
  157|  13.0M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (157:5): [True: 13.0M, False: 9.76M]
  ------------------
  158|  13.0M|      return _cbor_copy_int(item, false);
  159|   594k|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (159:5): [True: 594k, False: 22.1M]
  ------------------
  160|   594k|      return _cbor_copy_int(item, true);
  161|   547k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (161:5): [True: 547k, False: 22.2M]
  ------------------
  162|   547k|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (162:11): [True: 547k, False: 531]
  ------------------
  163|   547k|        return cbor_build_bytestring(cbor_bytestring_handle(item),
  164|   547k|                                     cbor_bytestring_length(item));
  165|   547k|      } else {
  166|    531|        cbor_item_t *res = cbor_new_indefinite_bytestring();
  167|    531|        if (res == NULL) {
  ------------------
  |  Branch (167:13): [True: 0, False: 531]
  ------------------
  168|      0|          return NULL;
  169|      0|        }
  170|       |
  171|   529k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (171:28): [True: 529k, False: 531]
  ------------------
  172|   529k|          cbor_item_t *chunk_copy =
  173|   529k|              cbor_copy(cbor_bytestring_chunks_handle(item)[i]);
  174|   529k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (174:15): [True: 0, False: 529k]
  ------------------
  175|      0|            cbor_decref(&res);
  176|      0|            return NULL;
  177|      0|          }
  178|   529k|          if (!cbor_bytestring_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (178:15): [True: 0, False: 529k]
  ------------------
  179|      0|            cbor_decref(&chunk_copy);
  180|      0|            cbor_decref(&res);
  181|      0|            return NULL;
  182|      0|          }
  183|   529k|          cbor_decref(&chunk_copy);
  184|   529k|        }
  185|    531|        return res;
  186|    531|      }
  187|   738k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (187:5): [True: 738k, False: 22.0M]
  ------------------
  188|   738k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (188:11): [True: 724k, False: 14.7k]
  ------------------
  189|   724k|        return cbor_build_stringn((const char *)cbor_string_handle(item),
  190|   724k|                                  cbor_string_length(item));
  191|   724k|      } else {
  192|  14.7k|        cbor_item_t *res = cbor_new_indefinite_string();
  193|  14.7k|        if (res == NULL) {
  ------------------
  |  Branch (193:13): [True: 0, False: 14.7k]
  ------------------
  194|      0|          return NULL;
  195|      0|        }
  196|       |
  197|   564k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (197:28): [True: 549k, False: 14.7k]
  ------------------
  198|   549k|          cbor_item_t *chunk_copy =
  199|   549k|              cbor_copy(cbor_string_chunks_handle(item)[i]);
  200|   549k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (200:15): [True: 0, False: 549k]
  ------------------
  201|      0|            cbor_decref(&res);
  202|      0|            return NULL;
  203|      0|          }
  204|   549k|          if (!cbor_string_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (204:15): [True: 0, False: 549k]
  ------------------
  205|      0|            cbor_decref(&chunk_copy);
  206|      0|            cbor_decref(&res);
  207|      0|            return NULL;
  208|      0|          }
  209|   549k|          cbor_decref(&chunk_copy);
  210|   549k|        }
  211|  14.7k|        return res;
  212|  14.7k|      }
  213|  6.15M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (213:5): [True: 6.15M, False: 16.6M]
  ------------------
  214|  6.15M|      cbor_item_t *res;
  215|  6.15M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (215:11): [True: 5.91M, False: 235k]
  ------------------
  216|  5.91M|        res = cbor_new_definite_array(cbor_array_size(item));
  217|  5.91M|      } else {
  218|   235k|        res = cbor_new_indefinite_array();
  219|   235k|      }
  220|  6.15M|      if (res == NULL) {
  ------------------
  |  Branch (220:11): [True: 0, False: 6.15M]
  ------------------
  221|      0|        return NULL;
  222|      0|      }
  223|       |
  224|  25.8M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (224:26): [True: 19.7M, False: 6.15M]
  ------------------
  225|  19.7M|        cbor_item_t *entry_copy = cbor_copy(cbor_move(cbor_array_get(item, i)));
  226|  19.7M|        if (entry_copy == NULL) {
  ------------------
  |  Branch (226:13): [True: 0, False: 19.7M]
  ------------------
  227|      0|          cbor_decref(&res);
  228|      0|          return NULL;
  229|      0|        }
  230|  19.7M|        if (!cbor_array_push(res, entry_copy)) {
  ------------------
  |  Branch (230:13): [True: 0, False: 19.7M]
  ------------------
  231|      0|          cbor_decref(&entry_copy);
  232|      0|          cbor_decref(&res);
  233|      0|          return NULL;
  234|      0|        }
  235|  19.7M|        cbor_decref(&entry_copy);
  236|  19.7M|      }
  237|  6.15M|      return res;
  238|  6.15M|    }
  239|  21.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (239:5): [True: 21.4k, False: 22.7M]
  ------------------
  240|  21.4k|      cbor_item_t *res;
  241|  21.4k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (241:11): [True: 20.2k, False: 1.15k]
  ------------------
  242|  20.2k|        res = cbor_new_definite_map(cbor_map_size(item));
  243|  20.2k|      } else {
  244|  1.15k|        res = cbor_new_indefinite_map();
  245|  1.15k|      }
  246|  21.4k|      if (res == NULL) {
  ------------------
  |  Branch (246:11): [True: 0, False: 21.4k]
  ------------------
  247|      0|        return NULL;
  248|      0|      }
  249|       |
  250|  21.4k|      struct cbor_pair *it = cbor_map_handle(item);
  251|   950k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (251:26): [True: 929k, False: 21.4k]
  ------------------
  252|   929k|        cbor_item_t *key_copy = cbor_copy(it[i].key);
  253|   929k|        if (key_copy == NULL) {
  ------------------
  |  Branch (253:13): [True: 0, False: 929k]
  ------------------
  254|      0|          cbor_decref(&res);
  255|      0|          return NULL;
  256|      0|        }
  257|   929k|        cbor_item_t *value_copy = cbor_copy(it[i].value);
  258|   929k|        if (value_copy == NULL) {
  ------------------
  |  Branch (258:13): [True: 0, False: 929k]
  ------------------
  259|      0|          cbor_decref(&res);
  260|      0|          cbor_decref(&key_copy);
  261|      0|          return NULL;
  262|      0|        }
  263|   929k|        if (!cbor_map_add(res, (struct cbor_pair){.key = key_copy,
  ------------------
  |  Branch (263:13): [True: 0, False: 929k]
  ------------------
  264|   929k|                                                  .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|   929k|        cbor_decref(&key_copy);
  271|   929k|        cbor_decref(&value_copy);
  272|   929k|      }
  273|  21.4k|      return res;
  274|  21.4k|    }
  275|   127k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (275:5): [True: 127k, False: 22.6M]
  ------------------
  276|   127k|      cbor_item_t *item_copy = cbor_copy(cbor_move(cbor_tag_item(item)));
  277|   127k|      if (item_copy == NULL) {
  ------------------
  |  Branch (277:11): [True: 0, False: 127k]
  ------------------
  278|      0|        return NULL;
  279|      0|      }
  280|   127k|      cbor_item_t *tag = cbor_build_tag(cbor_tag_value(item), item_copy);
  281|   127k|      cbor_decref(&item_copy);
  282|   127k|      return tag;
  283|   127k|    }
  284|  1.58M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (284:5): [True: 1.58M, False: 21.2M]
  ------------------
  285|  1.58M|      return _cbor_copy_float_ctrl(item);
  286|  22.7M|  }
  287|  22.7M|}
cbor_describe:
  421|  1.32k|void cbor_describe(cbor_item_t *item, FILE *out) {
  422|  1.32k|  _cbor_nested_describe(item, out, 0);
  423|  1.32k|}
cbor.c:_cbor_copy_int:
  118|  13.6M|static cbor_item_t *_cbor_copy_int(cbor_item_t *item, bool negative) {
  119|  13.6M|  cbor_item_t *res;
  120|  13.6M|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (120:11): [True: 0, False: 13.6M]
  ------------------
  121|  13.2M|    case CBOR_INT_8:
  ------------------
  |  Branch (121:5): [True: 13.2M, False: 342k]
  ------------------
  122|  13.2M|      res = cbor_build_uint8(cbor_get_uint8(item));
  123|  13.2M|      break;
  124|  7.47k|    case CBOR_INT_16:
  ------------------
  |  Branch (124:5): [True: 7.47k, False: 13.6M]
  ------------------
  125|  7.47k|      res = cbor_build_uint16(cbor_get_uint16(item));
  126|  7.47k|      break;
  127|   325k|    case CBOR_INT_32:
  ------------------
  |  Branch (127:5): [True: 325k, False: 13.2M]
  ------------------
  128|   325k|      res = cbor_build_uint32(cbor_get_uint32(item));
  129|   325k|      break;
  130|  9.23k|    case CBOR_INT_64:
  ------------------
  |  Branch (130:5): [True: 9.23k, False: 13.6M]
  ------------------
  131|  9.23k|      res = cbor_build_uint64(cbor_get_uint64(item));
  132|  9.23k|      break;
  133|  13.6M|  }
  134|       |
  135|  13.6M|  if (negative) cbor_mark_negint(res);
  ------------------
  |  Branch (135:7): [True: 594k, False: 13.0M]
  ------------------
  136|       |
  137|  13.6M|  return res;
  138|  13.6M|}
cbor.c:_cbor_copy_float_ctrl:
  140|  1.58M|static cbor_item_t *_cbor_copy_float_ctrl(cbor_item_t *item) {
  141|       |  // cppcheck-suppress missingReturn
  142|  1.58M|  switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (142:11): [True: 0, False: 1.58M]
  ------------------
  143|  1.45M|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (143:5): [True: 1.45M, False: 123k]
  ------------------
  144|  1.45M|      return cbor_build_ctrl(cbor_ctrl_value(item));
  145|  82.8k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (145:5): [True: 82.8k, False: 1.49M]
  ------------------
  146|  82.8k|      return cbor_build_float2(cbor_float_get_float2(item));
  147|  5.85k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (147:5): [True: 5.85k, False: 1.57M]
  ------------------
  148|  5.85k|      return cbor_build_float4(cbor_float_get_float4(item));
  149|  34.7k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (149:5): [True: 34.7k, False: 1.54M]
  ------------------
  150|  34.7k|      return cbor_build_float8(cbor_float_get_float8(item));
  151|  1.58M|  }
  152|  1.58M|}
cbor.c:_cbor_nested_describe:
  308|  22.7M|static void _cbor_nested_describe(cbor_item_t *item, FILE *out, int indent) {
  309|  22.7M|  const int indent_offset = 4;
  310|  22.7M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (310:11): [True: 0, False: 22.7M]
  ------------------
  311|  13.0M|    case CBOR_TYPE_UINT: {
  ------------------
  |  Branch (311:5): [True: 13.0M, False: 9.76M]
  ------------------
  312|  13.0M|      _cbor_type_marquee(out, "CBOR_TYPE_UINT", indent);
  313|  13.0M|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  314|  13.0M|      fprintf(out, "Value: %" PRIu64 "\n", cbor_get_int(item));
  315|  13.0M|      break;
  316|      0|    }
  317|   594k|    case CBOR_TYPE_NEGINT: {
  ------------------
  |  Branch (317:5): [True: 594k, False: 22.1M]
  ------------------
  318|   594k|      _cbor_type_marquee(out, "CBOR_TYPE_NEGINT", indent);
  319|   594k|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  320|   594k|      fprintf(out, "Value: -%" PRIu64 " - 1\n", cbor_get_int(item));
  321|   594k|      break;
  322|      0|    }
  323|   547k|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (323:5): [True: 547k, False: 22.2M]
  ------------------
  324|   547k|      _cbor_type_marquee(out, "CBOR_TYPE_BYTESTRING", indent);
  325|   547k|      if (cbor_bytestring_is_indefinite(item)) {
  ------------------
  |  Branch (325:11): [True: 531, False: 547k]
  ------------------
  326|    531|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  327|    531|                cbor_bytestring_chunk_count(item));
  328|   529k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (328:28): [True: 529k, False: 531]
  ------------------
  329|   529k|          _cbor_nested_describe(cbor_bytestring_chunks_handle(item)[i], out,
  330|   529k|                                indent + indent_offset);
  331|   547k|      } else {
  332|   547k|        const unsigned char *data = cbor_bytestring_handle(item);
  333|   547k|        fprintf(out, "Definite, Length: %zuB, Data:\n",
  334|   547k|                cbor_bytestring_length(item));
  335|   547k|        fprintf(out, "%*s", indent + indent_offset, " ");
  336|  3.48M|        for (size_t i = 0; i < cbor_bytestring_length(item); i++)
  ------------------
  |  Branch (336:28): [True: 2.93M, False: 547k]
  ------------------
  337|  2.93M|          fprintf(out, "%02x", (int)(data[i] & 0xff));
  338|   547k|        fprintf(out, "\n");
  339|   547k|      }
  340|   547k|      break;
  341|      0|    }
  342|   738k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (342:5): [True: 738k, False: 22.0M]
  ------------------
  343|   738k|      _cbor_type_marquee(out, "CBOR_TYPE_STRING", indent);
  344|   738k|      if (cbor_string_is_indefinite(item)) {
  ------------------
  |  Branch (344:11): [True: 14.7k, False: 724k]
  ------------------
  345|  14.7k|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  346|  14.7k|                cbor_string_chunk_count(item));
  347|   564k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (347:28): [True: 549k, False: 14.7k]
  ------------------
  348|   549k|          _cbor_nested_describe(cbor_string_chunks_handle(item)[i], out,
  349|   549k|                                indent + indent_offset);
  350|   724k|      } else {
  351|   724k|        fprintf(out, "Definite, Length: %zuB, Codepoints: %zu, Data:\n",
  352|   724k|                cbor_string_length(item), cbor_string_codepoint_count(item));
  353|   724k|        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|   724k|        fwrite(cbor_string_handle(item), sizeof(unsigned char),
  357|   724k|               cbor_string_length(item), out);
  358|   724k|        fprintf(out, "\n");
  359|   724k|      }
  360|   738k|      break;
  361|      0|    }
  362|  6.15M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (362:5): [True: 6.15M, False: 16.6M]
  ------------------
  363|  6.15M|      _cbor_type_marquee(out, "CBOR_TYPE_ARRAY", indent);
  364|  6.15M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (364:11): [True: 5.91M, False: 235k]
  ------------------
  365|  5.91M|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_array_size(item));
  366|  5.91M|      } else {
  367|   235k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n",
  368|   235k|                cbor_array_size(item));
  369|   235k|      }
  370|       |
  371|  25.8M|      for (size_t i = 0; i < cbor_array_size(item); i++)
  ------------------
  |  Branch (371:26): [True: 19.7M, False: 6.15M]
  ------------------
  372|  19.7M|        _cbor_nested_describe(cbor_array_handle(item)[i], out,
  373|  19.7M|                              indent + indent_offset);
  374|  6.15M|      break;
  375|      0|    }
  376|  21.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (376:5): [True: 21.4k, False: 22.7M]
  ------------------
  377|  21.4k|      _cbor_type_marquee(out, "CBOR_TYPE_MAP", indent);
  378|  21.4k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (378:11): [True: 20.2k, False: 1.15k]
  ------------------
  379|  20.2k|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_map_size(item));
  380|  20.2k|      } else {
  381|  1.15k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n", cbor_map_size(item));
  382|  1.15k|      }
  383|       |
  384|       |      // TODO: Label and group keys and values
  385|   950k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (385:26): [True: 929k, False: 21.4k]
  ------------------
  386|   929k|        fprintf(out, "%*sMap entry %zu\n", indent + indent_offset, " ", i);
  387|   929k|        _cbor_nested_describe(cbor_map_handle(item)[i].key, out,
  388|   929k|                              indent + 2 * indent_offset);
  389|   929k|        _cbor_nested_describe(cbor_map_handle(item)[i].value, out,
  390|   929k|                              indent + 2 * indent_offset);
  391|   929k|      }
  392|  21.4k|      break;
  393|      0|    }
  394|   127k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (394:5): [True: 127k, False: 22.6M]
  ------------------
  395|   127k|      _cbor_type_marquee(out, "CBOR_TYPE_TAG", indent);
  396|   127k|      fprintf(out, "Value: %" PRIu64 "\n", cbor_tag_value(item));
  397|   127k|      _cbor_nested_describe(cbor_move(cbor_tag_item(item)), out,
  398|   127k|                            indent + indent_offset);
  399|   127k|      break;
  400|      0|    }
  401|  1.58M|    case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (401:5): [True: 1.58M, False: 21.2M]
  ------------------
  402|  1.58M|      _cbor_type_marquee(out, "CBOR_TYPE_FLOAT_CTRL", indent);
  403|  1.58M|      if (cbor_float_ctrl_is_ctrl(item)) {
  ------------------
  |  Branch (403:11): [True: 1.45M, False: 123k]
  ------------------
  404|  1.45M|        if (cbor_is_bool(item))
  ------------------
  |  Branch (404:13): [True: 1.37M, False: 79.1k]
  ------------------
  405|  1.37M|          fprintf(out, "Bool: %s\n", cbor_get_bool(item) ? "true" : "false");
  ------------------
  |  Branch (405:38): [True: 1.34M, False: 33.7k]
  ------------------
  406|  79.1k|        else if (cbor_is_undef(item))
  ------------------
  |  Branch (406:18): [True: 61.4k, False: 17.6k]
  ------------------
  407|  61.4k|          fprintf(out, "Undefined\n");
  408|  17.6k|        else if (cbor_is_null(item))
  ------------------
  |  Branch (408:18): [True: 17.6k, False: 0]
  ------------------
  409|  17.6k|          fprintf(out, "Null\n");
  410|      0|        else
  411|      0|          fprintf(out, "Simple value: %d\n", cbor_ctrl_value(item));
  412|  1.45M|      } else {
  413|   123k|        fprintf(out, "Width: %dB, ", _pow(2, cbor_float_get_width(item)));
  414|   123k|        fprintf(out, "Value: %lf\n", cbor_float_get_float(item));
  415|   123k|      }
  416|  1.58M|      break;
  417|      0|    }
  418|  22.7M|  }
  419|  22.7M|}
cbor.c:_cbor_type_marquee:
  304|  22.7M|static void _cbor_type_marquee(FILE *out, char *label, int indent) {
  305|  22.7M|  fprintf(out, "%*.*s[%s] ", indent, indent, " ", label);
  306|  22.7M|}
cbor.c:_pow:
  297|  13.7M|static int _pow(int b, int ex) {
  298|  13.7M|  if (ex == 0) return 1;
  ------------------
  |  Branch (298:7): [True: 13.2M, False: 465k]
  ------------------
  299|   465k|  int res = b;
  300|   885k|  while (--ex > 0) res *= b;
  ------------------
  |  Branch (300:10): [True: 419k, False: 465k]
  ------------------
  301|   465k|  return res;
  302|  13.7M|}

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

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

cbor_isa_uint:
   22|   305M|bool cbor_isa_uint(const cbor_item_t *item) {
   23|   305M|  return item->type == CBOR_TYPE_UINT;
   24|   305M|}
cbor_isa_negint:
   26|  10.8M|bool cbor_isa_negint(const cbor_item_t *item) {
   27|  10.8M|  return item->type == CBOR_TYPE_NEGINT;
   28|  10.8M|}
cbor_isa_bytestring:
   30|  27.6M|bool cbor_isa_bytestring(const cbor_item_t *item) {
   31|  27.6M|  return item->type == CBOR_TYPE_BYTESTRING;
   32|  27.6M|}
cbor_isa_string:
   34|  30.5M|bool cbor_isa_string(const cbor_item_t *item) {
   35|  30.5M|  return item->type == CBOR_TYPE_STRING;
   36|  30.5M|}
cbor_isa_array:
   38|   336M|bool cbor_isa_array(const cbor_item_t *item) {
   39|   336M|  return item->type == CBOR_TYPE_ARRAY;
   40|   336M|}
cbor_isa_map:
   42|  20.9M|bool cbor_isa_map(const cbor_item_t *item) {
   43|  20.9M|  return item->type == CBOR_TYPE_MAP;
   44|  20.9M|}
cbor_isa_tag:
   46|  1.63M|bool cbor_isa_tag(const cbor_item_t *item) {
   47|  1.63M|  return item->type == CBOR_TYPE_TAG;
   48|  1.63M|}
cbor_isa_float_ctrl:
   50|  48.0M|bool cbor_isa_float_ctrl(const cbor_item_t *item) {
   51|  48.0M|  return item->type == CBOR_TYPE_FLOAT_CTRL;
   52|  48.0M|}
cbor_typeof:
   54|  90.0M|cbor_type cbor_typeof(const cbor_item_t *item) { return item->type; }
cbor_is_int:
   56|   292M|bool cbor_is_int(const cbor_item_t *item) {
   57|   292M|  return cbor_isa_uint(item) || cbor_isa_negint(item);
  ------------------
  |  Branch (57:10): [True: 282M, False: 10.2M]
  |  Branch (57:33): [True: 10.2M, False: 0]
  ------------------
   58|   292M|}
cbor_is_bool:
   60|  2.83M|bool cbor_is_bool(const cbor_item_t *item) {
   61|  2.83M|  return cbor_isa_float_ctrl(item) &&
  ------------------
  |  Branch (61:10): [True: 2.83M, False: 0]
  ------------------
   62|  2.83M|         (cbor_ctrl_value(item) == CBOR_CTRL_FALSE ||
  ------------------
  |  Branch (62:11): [True: 67.5k, False: 2.76M]
  ------------------
   63|  2.83M|          cbor_ctrl_value(item) == CBOR_CTRL_TRUE);
  ------------------
  |  Branch (63:11): [True: 2.68M, False: 79.1k]
  ------------------
   64|  2.83M|}
cbor_is_null:
   66|  17.6k|bool cbor_is_null(const cbor_item_t *item) {
   67|  17.6k|  return cbor_isa_float_ctrl(item) && cbor_ctrl_value(item) == CBOR_CTRL_NULL;
  ------------------
  |  Branch (67:10): [True: 17.6k, False: 0]
  |  Branch (67:39): [True: 17.6k, False: 0]
  ------------------
   68|  17.6k|}
cbor_is_undef:
   70|  79.1k|bool cbor_is_undef(const cbor_item_t *item) {
   71|  79.1k|  return cbor_isa_float_ctrl(item) && cbor_ctrl_value(item) == CBOR_CTRL_UNDEF;
  ------------------
  |  Branch (71:10): [True: 79.1k, False: 0]
  |  Branch (71:39): [True: 61.4k, False: 17.6k]
  ------------------
   72|  79.1k|}
cbor_is_float:
   74|   777k|bool cbor_is_float(const cbor_item_t *item) {
   75|   777k|  return cbor_isa_float_ctrl(item) && !cbor_float_ctrl_is_ctrl(item);
  ------------------
  |  Branch (75:10): [True: 777k, False: 0]
  |  Branch (75:39): [True: 777k, False: 0]
  ------------------
   76|   777k|}
cbor_incref:
   78|  79.4M|cbor_item_t *cbor_incref(cbor_item_t *item) {
   79|  79.4M|  item->refcount++;
   80|  79.4M|  return item;
   81|  79.4M|}
cbor_decref:
   83|   118M|void cbor_decref(cbor_item_t **item_ref) {
   84|   118M|  cbor_item_t *item = *item_ref;
   85|   118M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   63|   118M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   86|   118M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (86:7): [True: 59.2M, False: 59.2M]
  ------------------
   87|  59.2M|    switch (item->type) {
  ------------------
  |  Branch (87:13): [True: 0, False: 59.2M]
  ------------------
   88|  32.5M|      case CBOR_TYPE_UINT:
  ------------------
  |  Branch (88:7): [True: 32.5M, False: 26.7M]
  ------------------
   89|       |        /* Fallthrough */
   90|  34.0M|      case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (90:7): [True: 1.54M, False: 57.7M]
  ------------------
   91|       |        /* Combined allocation, freeing the item suffices */
   92|  34.0M|        { break; }
   93|  1.15M|      case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (93:7): [True: 1.15M, False: 58.1M]
  ------------------
   94|  1.15M|        if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (94:13): [True: 1.13M, False: 14.2k]
  ------------------
   95|  1.13M|          _cbor_free(item->data);
   96|  1.13M|        } else {
   97|       |          /* We need to decref all chunks */
   98|  14.2k|          cbor_item_t **handle = cbor_bytestring_chunks_handle(item);
   99|  1.10M|          for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (99:30): [True: 1.09M, False: 14.2k]
  ------------------
  100|  1.09M|            cbor_decref(&handle[i]);
  101|  14.2k|          _cbor_free(
  102|  14.2k|              ((struct cbor_indefinite_string_data *)item->data)->chunks);
  103|  14.2k|          _cbor_free(item->data);
  104|  14.2k|        }
  105|  1.15M|        break;
  106|  32.5M|      }
  107|  1.82M|      case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (107:7): [True: 1.82M, False: 57.4M]
  ------------------
  108|  1.82M|        if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (108:13): [True: 1.78M, False: 32.3k]
  ------------------
  109|  1.78M|          _cbor_free(item->data);
  110|  1.78M|        } else {
  111|       |          /* We need to decref all chunks */
  112|  32.3k|          cbor_item_t **handle = cbor_string_chunks_handle(item);
  113|  1.46M|          for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (113:30): [True: 1.43M, False: 32.3k]
  ------------------
  114|  1.43M|            cbor_decref(&handle[i]);
  115|  32.3k|          _cbor_free(
  116|  32.3k|              ((struct cbor_indefinite_string_data *)item->data)->chunks);
  117|  32.3k|          _cbor_free(item->data);
  118|  32.3k|        }
  119|  1.82M|        break;
  120|  32.5M|      }
  121|  15.2M|      case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (121:7): [True: 15.2M, False: 43.9M]
  ------------------
  122|       |        /* Get all items and decref them */
  123|  15.2M|        cbor_item_t **handle = cbor_array_handle(item);
  124|  15.2M|        size_t size = cbor_array_size(item);
  125|  66.6M|        for (size_t i = 0; i < size; i++)
  ------------------
  |  Branch (125:28): [True: 51.3M, False: 15.2M]
  ------------------
  126|  51.3M|          if (handle[i] != NULL) cbor_decref(&handle[i]);
  ------------------
  |  Branch (126:15): [True: 51.3M, False: 0]
  ------------------
  127|  15.2M|        _cbor_free(item->data);
  128|  15.2M|        break;
  129|  32.5M|      }
  130|  55.5k|      case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (130:7): [True: 55.5k, False: 59.2M]
  ------------------
  131|  55.5k|        struct cbor_pair *handle = cbor_map_handle(item);
  132|  2.45M|        for (size_t i = 0; i < item->metadata.map_metadata.end_ptr;
  ------------------
  |  Branch (132:28): [True: 2.39M, False: 55.5k]
  ------------------
  133|  2.39M|             i++, handle++) {
  134|  2.39M|          cbor_decref(&handle->key);
  135|  2.39M|          if (handle->value != NULL) cbor_decref(&handle->value);
  ------------------
  |  Branch (135:15): [True: 2.39M, False: 835]
  ------------------
  136|  2.39M|        }
  137|  55.5k|        _cbor_free(item->data);
  138|  55.5k|        break;
  139|  32.5M|      }
  140|   501k|      case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (140:7): [True: 501k, False: 58.7M]
  ------------------
  141|   501k|        if (item->metadata.tag_metadata.tagged_item != NULL)
  ------------------
  |  Branch (141:13): [True: 490k, False: 11.7k]
  ------------------
  142|   490k|          cbor_decref(&item->metadata.tag_metadata.tagged_item);
  143|   501k|        _cbor_free(item->data);
  144|   501k|        break;
  145|  32.5M|      }
  146|  6.39M|      case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (146:7): [True: 6.39M, False: 52.8M]
  ------------------
  147|       |        /* Floats have combined allocation */
  148|  6.39M|        break;
  149|  32.5M|      }
  150|  59.2M|    }
  151|  59.2M|    _cbor_free(item);
  152|  59.2M|    *item_ref = NULL;
  153|  59.2M|  }
  154|   118M|}
cbor_move:
  160|  20.2M|cbor_item_t *cbor_move(cbor_item_t *item) {
  161|  20.2M|  item->refcount--;
  162|  20.2M|  return item;
  163|  20.2M|}

cbor_encode_uint8:
   12|  12.6M|                         size_t buffer_size) {
   13|  12.6M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x00);
   14|  12.6M|}
cbor_encode_uint16:
   17|  3.66k|                          size_t buffer_size) {
   18|  3.66k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x00);
   19|  3.66k|}
cbor_encode_uint32:
   22|   322k|                          size_t buffer_size) {
   23|   322k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x00);
   24|   322k|}
cbor_encode_uint64:
   27|  5.22k|                          size_t buffer_size) {
   28|  5.22k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x00);
   29|  5.22k|}
cbor_encode_negint8:
   37|   583k|                           size_t buffer_size) {
   38|   583k|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x20);
   39|   583k|}
cbor_encode_negint16:
   42|  3.80k|                            size_t buffer_size) {
   43|  3.80k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x20);
   44|  3.80k|}
cbor_encode_negint32:
   47|  2.64k|                            size_t buffer_size) {
   48|  2.64k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x20);
   49|  2.64k|}
cbor_encode_negint64:
   52|  4.01k|                            size_t buffer_size) {
   53|  4.01k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x20);
   54|  4.01k|}
cbor_encode_bytestring_start:
   62|   547k|                                    size_t buffer_size) {
   63|   547k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x40);
   64|   547k|}
_cbor_encode_byte:
   67|   503k|                         size_t buffer_size) {
   68|   503k|  if (buffer_size >= 1) {
  ------------------
  |  Branch (68:7): [True: 503k, False: 0]
  ------------------
   69|   503k|    buffer[0] = value;
   70|   503k|    return 1;
   71|   503k|  } else
   72|      0|    return 0;
   73|   503k|}
cbor_encode_indef_bytestring_start:
   76|    531|                                          size_t buffer_size) {
   77|    531|  return _cbor_encode_byte(0x5F, buffer, buffer_size);
   78|    531|}
cbor_encode_string_start:
   81|   724k|                                size_t buffer_size) {
   82|   724k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x60);
   83|   724k|}
cbor_encode_indef_string_start:
   86|  14.7k|                                      size_t buffer_size) {
   87|  14.7k|  return _cbor_encode_byte(0x7F, buffer, buffer_size);
   88|  14.7k|}
cbor_encode_array_start:
   91|  5.91M|                               size_t buffer_size) {
   92|  5.91M|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x80);
   93|  5.91M|}
cbor_encode_indef_array_start:
   96|   235k|                                     size_t buffer_size) {
   97|   235k|  return _cbor_encode_byte(0x9F, buffer, buffer_size);
   98|   235k|}
cbor_encode_map_start:
  101|  20.2k|                             size_t buffer_size) {
  102|  20.2k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0xA0);
  103|  20.2k|}
cbor_encode_indef_map_start:
  105|  1.15k|size_t cbor_encode_indef_map_start(unsigned char *buffer, size_t buffer_size) {
  106|  1.15k|  return _cbor_encode_byte(0xBF, buffer, buffer_size);
  107|  1.15k|}
cbor_encode_tag:
  110|   127k|                       size_t buffer_size) {
  111|   127k|  return _cbor_encode_uint(value, buffer, buffer_size, 0xC0);
  112|   127k|}
cbor_encode_half:
  128|  82.8k|                        size_t buffer_size) {
  129|       |  /* Assuming value is normalized */
  130|  82.8k|  uint32_t val = ((union _cbor_float_helper){.as_float = value}).as_uint;
  131|  82.8k|  uint16_t res;
  132|  82.8k|  uint8_t exp = (uint8_t)((val & 0x7F800000u) >>
  133|  82.8k|                          23u); /* 0b0111_1111_1000_0000_0000_0000_0000_0000 */
  134|  82.8k|  uint32_t mant =
  135|  82.8k|      val & 0x7FFFFFu; /* 0b0000_0000_0111_1111_1111_1111_1111_1111 */
  136|  82.8k|  if (exp == 0xFF) {   /* Infinity or NaNs */
  ------------------
  |  Branch (136:7): [True: 4.59k, False: 78.2k]
  ------------------
  137|  4.59k|    if (value != value) {
  ------------------
  |  Branch (137:9): [True: 3.80k, False: 790]
  ------------------
  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|  3.80k|      res = (uint16_t)0x007e00;
  143|  3.80k|    } 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|    790|      CBOR_ASSERT(mant == 0u);
  ------------------
  |  |   63|    790|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  148|      0|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u);
  149|    790|    }
  150|  78.2k|  } else if (exp == 0x00) { /* Zeroes or subnorms */
  ------------------
  |  Branch (150:14): [True: 344, False: 77.9k]
  ------------------
  151|    344|    res = (uint16_t)((val & 0x80000000u) >> 16u | mant >> 13u);
  152|  77.9k|  } else { /* Normal numbers */
  153|  77.9k|    int8_t logical_exp = (int8_t)(exp - 127);
  154|  77.9k|    CBOR_ASSERT(logical_exp == exp - 127);
  ------------------
  |  |   63|  77.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  155|       |
  156|       |    // Now we know that 2^exp <= 0 logically
  157|  77.9k|    if (logical_exp < -24) {
  ------------------
  |  Branch (157:9): [True: 0, False: 77.9k]
  ------------------
  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|  77.9k|    } else if (logical_exp < -14) {
  ------------------
  |  Branch (162:16): [True: 17.9k, False: 59.9k]
  ------------------
  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|  17.9k|      res = (uint16_t)((val & 0x80000000u) >> 16u) |  // Extract sign bit
  167|  17.9k|            ((uint16_t)(1u << (24u + logical_exp)) +
  168|  17.9k|             (uint16_t)(((mant >> (-logical_exp - 2)) + 1) >>
  169|  17.9k|                        1));  // Round half away from zero for simplicity
  170|  59.9k|    } else {
  171|  59.9k|      res = (uint16_t)((val & 0x80000000u) >> 16u |
  172|  59.9k|                       ((((uint8_t)logical_exp) + 15u) << 10u) |
  173|  59.9k|                       (uint16_t)(mant >> 13u));
  174|  59.9k|    }
  175|  77.9k|  }
  176|      0|  return _cbor_encode_uint16(res, buffer, buffer_size, 0xE0);
  177|  82.8k|}
cbor_encode_single:
  180|  5.85k|                          size_t buffer_size) {
  181|  5.85k|  return _cbor_encode_uint32(
  182|  5.85k|      ((union _cbor_float_helper){.as_float = value}).as_uint, buffer,
  183|  5.85k|      buffer_size, 0xE0);
  184|  5.85k|}
cbor_encode_double:
  187|  34.7k|                          size_t buffer_size) {
  188|  34.7k|  return _cbor_encode_uint64(
  189|  34.7k|      ((union _cbor_double_helper){.as_double = value}).as_uint, buffer,
  190|  34.7k|      buffer_size, 0xE0);
  191|  34.7k|}
cbor_encode_break:
  193|   251k|size_t cbor_encode_break(unsigned char *buffer, size_t buffer_size) {
  194|   251k|  return _cbor_encode_byte(0xFF, buffer, buffer_size);
  195|   251k|}
cbor_encode_ctrl:
  198|  1.45M|                        size_t buffer_size) {
  199|  1.45M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0xE0);
  200|  1.45M|}

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

_cbor_builder_append:
   25|  34.9M|                          struct _cbor_decoder_context *ctx) {
   26|  34.9M|  if (ctx->stack->size == 0) {
  ------------------
  |  Branch (26:7): [True: 1.32k, False: 34.9M]
  ------------------
   27|       |    /* Top level item */
   28|  1.32k|    ctx->root = item;
   29|  1.32k|    return;
   30|  1.32k|  }
   31|       |  /* Part of a bigger structure */
   32|  34.9M|  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|  31.6M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (36:5): [True: 31.6M, False: 3.29M]
  ------------------
   37|  31.6M|      if (cbor_array_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (37:11): [True: 9.29M, False: 22.3M]
  ------------------
   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.29M|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   63|  9.29M|#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.29M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (44:13): [True: 0, False: 9.29M]
  ------------------
   45|      0|          ctx->creation_failed = true;
   46|      0|          cbor_decref(&item);
   47|      0|          break;
   48|      0|        }
   49|  9.29M|        cbor_decref(&item);
   50|  9.29M|        ctx->stack->top->subitems--;
   51|  9.29M|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (51:13): [True: 8.81M, False: 477k]
  ------------------
   52|  8.81M|          cbor_item_t *stack_item = ctx->stack->top->item;
   53|  8.81M|          _cbor_stack_pop(ctx->stack);
   54|  8.81M|          _cbor_builder_append(stack_item, ctx);
   55|  8.81M|        }
   56|  22.3M|      } else {
   57|       |        /* Indefinite array, don't bother with subitems */
   58|  22.3M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (58:13): [True: 7, False: 22.3M]
  ------------------
   59|      7|          ctx->creation_failed = true;
   60|      7|        }
   61|  22.3M|        cbor_decref(&item);
   62|  22.3M|      }
   63|  31.6M|      break;
   64|  31.6M|    }
   65|  31.6M|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (65:5): [True: 2.93M, False: 32.0M]
  ------------------
   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|  2.93M|      if (ctx->stack->top->subitems % 2) {
  ------------------
  |  Branch (69:11): [True: 1.46M, False: 1.46M]
  ------------------
   70|       |        // Odd record, this is a value.
   71|  1.46M|        ctx->creation_failed =
   72|  1.46M|            !_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.46M|        CBOR_ASSERT(!ctx->creation_failed);
  ------------------
  |  |   63|  1.46M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   76|  1.46M|      } else {
   77|       |        // Even record, this is a key.
   78|  1.46M|        if (!_cbor_map_add_key(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (78:13): [True: 1, False: 1.46M]
  ------------------
   79|      1|          ctx->creation_failed = true;
   80|      1|          cbor_decref(&item);
   81|      1|          break;
   82|      1|        }
   83|  1.46M|      }
   84|  2.93M|      cbor_decref(&item);
   85|  2.93M|      if (cbor_map_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (85:11): [True: 332k, False: 2.60M]
  ------------------
   86|   332k|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   63|   332k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   87|      0|        ctx->stack->top->subitems--;
   88|   332k|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (88:13): [True: 23.8k, False: 308k]
  ------------------
   89|  23.8k|          cbor_item_t *map_entry = ctx->stack->top->item;
   90|  23.8k|          _cbor_stack_pop(ctx->stack);
   91|  23.8k|          _cbor_builder_append(map_entry, ctx);
   92|  23.8k|        }
   93|  2.60M|      } else {
   94|  2.60M|        ctx->stack->top->subitems ^=
   95|  2.60M|            1; /* Flip the indicator for indefinite items */
   96|  2.60M|      }
   97|      0|      break;
   98|  2.93M|    }
   99|   362k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (99:5): [True: 362k, False: 34.6M]
  ------------------
  100|   362k|      CBOR_ASSERT(ctx->stack->top->subitems == 1);
  ------------------
  |  |   63|   362k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  101|      0|      cbor_tag_set_item(ctx->stack->top->item, item);
  102|   362k|      cbor_decref(&item); /* Give up on our reference */
  103|   362k|      cbor_item_t *tagged_item = ctx->stack->top->item;
  104|   362k|      _cbor_stack_pop(ctx->stack);
  105|   362k|      _cbor_builder_append(tagged_item, ctx);
  106|   362k|      break;
  107|  2.93M|    }
  108|       |    // We have an item to append but nothing to append it to.
  109|     96|    default: {
  ------------------
  |  Branch (109:5): [True: 96, False: 34.9M]
  ------------------
  110|     96|      cbor_decref(&item);
  111|     96|      ctx->syntax_error = true;
  112|     96|    }
  113|  34.9M|  }
  114|  34.9M|}
cbor_builder_uint8_callback:
  142|  19.1M|void cbor_builder_uint8_callback(void *context, uint8_t value) {
  143|  19.1M|  struct _cbor_decoder_context *ctx = context;
  144|  19.1M|  cbor_item_t *res = cbor_new_int8();
  145|  19.1M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  19.1M|  do {                             \
  |  |  118|  19.1M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 5, False: 19.1M]
  |  |  ------------------
  |  |  119|      5|      ctx->creation_failed = true; \
  |  |  120|      5|      return;                      \
  |  |  121|      5|    }                              \
  |  |  122|  19.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  146|  19.1M|  cbor_mark_uint(res);
  147|  19.1M|  cbor_set_uint8(res, value);
  148|  19.1M|  _cbor_builder_append(res, ctx);
  149|  19.1M|}
cbor_builder_uint16_callback:
  151|  4.07k|void cbor_builder_uint16_callback(void *context, uint16_t value) {
  152|  4.07k|  struct _cbor_decoder_context *ctx = context;
  153|  4.07k|  cbor_item_t *res = cbor_new_int16();
  154|  4.07k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  4.07k|  do {                             \
  |  |  118|  4.07k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 4.07k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  4.07k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  155|  4.07k|  cbor_mark_uint(res);
  156|  4.07k|  cbor_set_uint16(res, value);
  157|  4.07k|  _cbor_builder_append(res, ctx);
  158|  4.07k|}
cbor_builder_uint32_callback:
  160|   339k|void cbor_builder_uint32_callback(void *context, uint32_t value) {
  161|   339k|  struct _cbor_decoder_context *ctx = context;
  162|   339k|  cbor_item_t *res = cbor_new_int32();
  163|   339k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   339k|  do {                             \
  |  |  118|   339k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 339k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   339k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  164|   339k|  cbor_mark_uint(res);
  165|   339k|  cbor_set_uint32(res, value);
  166|   339k|  _cbor_builder_append(res, ctx);
  167|   339k|}
cbor_builder_uint64_callback:
  169|  24.2k|void cbor_builder_uint64_callback(void *context, uint64_t value) {
  170|  24.2k|  struct _cbor_decoder_context *ctx = context;
  171|  24.2k|  cbor_item_t *res = cbor_new_int64();
  172|  24.2k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  24.2k|  do {                             \
  |  |  118|  24.2k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 24.2k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  24.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  173|  24.2k|  cbor_mark_uint(res);
  174|  24.2k|  cbor_set_uint64(res, value);
  175|  24.2k|  _cbor_builder_append(res, ctx);
  176|  24.2k|}
cbor_builder_negint8_callback:
  178|   868k|void cbor_builder_negint8_callback(void *context, uint8_t value) {
  179|   868k|  struct _cbor_decoder_context *ctx = context;
  180|   868k|  cbor_item_t *res = cbor_new_int8();
  181|   868k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   868k|  do {                             \
  |  |  118|   868k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 868k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   868k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  182|   868k|  cbor_mark_negint(res);
  183|   868k|  cbor_set_uint8(res, value);
  184|   868k|  _cbor_builder_append(res, ctx);
  185|   868k|}
cbor_builder_negint16_callback:
  187|  6.33k|void cbor_builder_negint16_callback(void *context, uint16_t value) {
  188|  6.33k|  struct _cbor_decoder_context *ctx = context;
  189|  6.33k|  cbor_item_t *res = cbor_new_int16();
  190|  6.33k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  6.33k|  do {                             \
  |  |  118|  6.33k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 6.33k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  6.33k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  191|  6.33k|  cbor_mark_negint(res);
  192|  6.33k|  cbor_set_uint16(res, value);
  193|  6.33k|  _cbor_builder_append(res, ctx);
  194|  6.33k|}
cbor_builder_negint32_callback:
  196|  2.96k|void cbor_builder_negint32_callback(void *context, uint32_t value) {
  197|  2.96k|  struct _cbor_decoder_context *ctx = context;
  198|  2.96k|  cbor_item_t *res = cbor_new_int32();
  199|  2.96k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.96k|  do {                             \
  |  |  118|  2.96k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 2.96k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  2.96k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  200|  2.96k|  cbor_mark_negint(res);
  201|  2.96k|  cbor_set_uint32(res, value);
  202|  2.96k|  _cbor_builder_append(res, ctx);
  203|  2.96k|}
cbor_builder_negint64_callback:
  205|  76.4k|void cbor_builder_negint64_callback(void *context, uint64_t value) {
  206|  76.4k|  struct _cbor_decoder_context *ctx = context;
  207|  76.4k|  cbor_item_t *res = cbor_new_int64();
  208|  76.4k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  76.4k|  do {                             \
  |  |  118|  76.4k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 76.4k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  76.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  209|  76.4k|  cbor_mark_negint(res);
  210|  76.4k|  cbor_set_uint64(res, value);
  211|  76.4k|  _cbor_builder_append(res, ctx);
  212|  76.4k|}
cbor_builder_byte_string_callback:
  215|   592k|                                       uint64_t length) {
  216|   592k|  struct _cbor_decoder_context *ctx = context;
  217|   592k|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  127|   592k|  do {                             \
  |  |  128|   592k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 592k]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|   592k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  218|   592k|  unsigned char *new_handle = _cbor_malloc(length);
  219|   592k|  if (new_handle == NULL) {
  ------------------
  |  Branch (219:7): [True: 40, False: 592k]
  ------------------
  220|     40|    ctx->creation_failed = true;
  221|     40|    return;
  222|     40|  }
  223|       |
  224|   592k|  memcpy(new_handle, data, length);
  225|   592k|  cbor_item_t *new_chunk = cbor_new_definite_bytestring();
  226|       |
  227|   592k|  if (new_chunk == NULL) {
  ------------------
  |  Branch (227:7): [True: 0, False: 592k]
  ------------------
  228|      0|    _cbor_free(new_handle);
  229|      0|    ctx->creation_failed = true;
  230|      0|    return;
  231|      0|  }
  232|       |
  233|   592k|  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|   592k|  if (ctx->stack->size > 0 && cbor_isa_bytestring(ctx->stack->top->item) &&
  ------------------
  |  Branch (237:7): [True: 592k, False: 18]
  |  Branch (237:31): [True: 561k, False: 30.6k]
  ------------------
  238|   592k|      cbor_bytestring_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (238:7): [True: 561k, False: 0]
  ------------------
  239|   561k|    if (!cbor_bytestring_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (239:9): [True: 0, False: 561k]
  ------------------
  240|      0|      ctx->creation_failed = true;
  241|      0|    }
  242|   561k|    cbor_decref(&new_chunk);
  243|   561k|  } else {
  244|  30.6k|    _cbor_builder_append(new_chunk, ctx);
  245|  30.6k|  }
  246|   592k|}
cbor_builder_byte_string_start_callback:
  248|  13.7k|void cbor_builder_byte_string_start_callback(void *context) {
  249|  13.7k|  struct _cbor_decoder_context *ctx = context;
  250|  13.7k|  cbor_item_t *res = cbor_new_indefinite_bytestring();
  251|  13.7k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  13.7k|  do {                             \
  |  |  118|  13.7k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 13.7k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  13.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  252|  13.7k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  13.7k|  do {                                                         \
  |  |  136|  13.7k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 13.7k]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|  13.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  253|  13.7k|}
cbor_builder_string_callback:
  256|  1.06M|                                  uint64_t length) {
  257|  1.06M|  struct _cbor_decoder_context *ctx = context;
  258|  1.06M|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  127|  1.06M|  do {                             \
  |  |  128|  1.06M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 1.06M]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|  1.06M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  259|       |
  260|  1.06M|  unsigned char *new_handle = _cbor_malloc(length);
  261|  1.06M|  if (new_handle == NULL) {
  ------------------
  |  Branch (261:7): [True: 39, False: 1.06M]
  ------------------
  262|     39|    ctx->creation_failed = true;
  263|     39|    return;
  264|     39|  }
  265|       |
  266|  1.06M|  memcpy(new_handle, data, length);
  267|  1.06M|  cbor_item_t *new_chunk = cbor_new_definite_string();
  268|  1.06M|  if (new_chunk == NULL) {
  ------------------
  |  Branch (268:7): [True: 0, False: 1.06M]
  ------------------
  269|      0|    _cbor_free(new_handle);
  270|      0|    ctx->creation_failed = true;
  271|      0|    return;
  272|      0|  }
  273|  1.06M|  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|  1.06M|  if (ctx->stack->size > 0 && cbor_isa_string(ctx->stack->top->item) &&
  ------------------
  |  Branch (277:7): [True: 1.06M, False: 38]
  |  Branch (277:31): [True: 881k, False: 181k]
  ------------------
  278|  1.06M|      cbor_string_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (278:7): [True: 881k, False: 0]
  ------------------
  279|   881k|    if (!cbor_string_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (279:9): [True: 0, False: 881k]
  ------------------
  280|      0|      ctx->creation_failed = true;
  281|      0|    }
  282|   881k|    cbor_decref(&new_chunk);
  283|   881k|  } else {
  284|   181k|    _cbor_builder_append(new_chunk, ctx);
  285|   181k|  }
  286|  1.06M|}
cbor_builder_string_start_callback:
  288|  17.5k|void cbor_builder_string_start_callback(void *context) {
  289|  17.5k|  struct _cbor_decoder_context *ctx = context;
  290|  17.5k|  cbor_item_t *res = cbor_new_indefinite_string();
  291|  17.5k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  17.5k|  do {                             \
  |  |  118|  17.5k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 17.5k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  17.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  292|  17.5k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  17.5k|  do {                                                         \
  |  |  136|  17.5k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 17.5k]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|  17.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  293|  17.5k|}
cbor_builder_array_start_callback:
  295|  8.83M|void cbor_builder_array_start_callback(void *context, uint64_t size) {
  296|  8.83M|  struct _cbor_decoder_context *ctx = context;
  297|  8.83M|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  127|  8.83M|  do {                             \
  |  |  128|  8.83M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 8.83M]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|  8.83M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  298|  8.83M|  cbor_item_t *res = cbor_new_definite_array(size);
  299|  8.83M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  8.83M|  do {                             \
  |  |  118|  8.83M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 72, False: 8.83M]
  |  |  ------------------
  |  |  119|     72|      ctx->creation_failed = true; \
  |  |  120|     72|      return;                      \
  |  |  121|     72|    }                              \
  |  |  122|  8.83M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  300|  8.83M|  if (size > 0) {
  ------------------
  |  Branch (300:7): [True: 8.83M, False: 0]
  ------------------
  301|  8.83M|    PUSH_CTX_STACK(ctx, res, size);
  ------------------
  |  |  135|  8.83M|  do {                                                         \
  |  |  136|  8.83M|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 8.83M]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|  8.83M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  302|  8.83M|  } else {
  303|      0|    _cbor_builder_append(res, ctx);
  304|      0|  }
  305|  8.83M|}
cbor_builder_indef_array_start_callback:
  307|   302k|void cbor_builder_indef_array_start_callback(void *context) {
  308|   302k|  struct _cbor_decoder_context *ctx = context;
  309|   302k|  cbor_item_t *res = cbor_new_indefinite_array();
  310|   302k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   302k|  do {                             \
  |  |  118|   302k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 302k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   302k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  311|   302k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|   302k|  do {                                                         \
  |  |  136|   302k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 2, False: 302k]
  |  |  ------------------
  |  |  137|      2|      cbor_decref(&res);                                       \
  |  |  138|      2|      ctx->creation_failed = true;                             \
  |  |  139|      2|    }                                                          \
  |  |  140|   302k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  312|   302k|}
cbor_builder_indef_map_start_callback:
  314|  2.51k|void cbor_builder_indef_map_start_callback(void *context) {
  315|  2.51k|  struct _cbor_decoder_context *ctx = context;
  316|  2.51k|  cbor_item_t *res = cbor_new_indefinite_map();
  317|  2.51k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.51k|  do {                             \
  |  |  118|  2.51k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 2.51k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  2.51k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  318|  2.51k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  135|  2.51k|  do {                                                         \
  |  |  136|  2.51k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 2, False: 2.51k]
  |  |  ------------------
  |  |  137|      2|      cbor_decref(&res);                                       \
  |  |  138|      2|      ctx->creation_failed = true;                             \
  |  |  139|      2|    }                                                          \
  |  |  140|  2.51k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  319|  2.51k|}
cbor_builder_map_start_callback:
  321|  31.6k|void cbor_builder_map_start_callback(void *context, uint64_t size) {
  322|  31.6k|  struct _cbor_decoder_context *ctx = context;
  323|  31.6k|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  127|  31.6k|  do {                             \
  |  |  128|  31.6k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (128:9): [True: 0, False: 31.6k]
  |  |  ------------------
  |  |  129|      0|      ctx->creation_failed = true; \
  |  |  130|      0|      return;                      \
  |  |  131|      0|    }                              \
  |  |  132|  31.6k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (132:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  324|  31.6k|  cbor_item_t *res = cbor_new_definite_map(size);
  325|  31.6k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  31.6k|  do {                             \
  |  |  118|  31.6k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 71, False: 31.6k]
  |  |  ------------------
  |  |  119|     71|      ctx->creation_failed = true; \
  |  |  120|     71|      return;                      \
  |  |  121|     71|    }                              \
  |  |  122|  31.6k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  326|  31.6k|  if (size > 0) {
  ------------------
  |  Branch (326:7): [True: 31.6k, False: 0]
  ------------------
  327|  31.6k|    PUSH_CTX_STACK(ctx, res, size * 2);
  ------------------
  |  |  135|  31.6k|  do {                                                         \
  |  |  136|  31.6k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 31.6k]
  |  |  ------------------
  |  |  137|      0|      cbor_decref(&res);                                       \
  |  |  138|      0|      ctx->creation_failed = true;                             \
  |  |  139|      0|    }                                                          \
  |  |  140|  31.6k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  328|  31.6k|  } else {
  329|      0|    _cbor_builder_append(res, ctx);
  330|      0|  }
  331|  31.6k|}
_cbor_is_indefinite:
  336|   300k|bool _cbor_is_indefinite(cbor_item_t *item) {
  337|   300k|  switch (item->type) {
  338|    735|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (338:5): [True: 735, False: 300k]
  ------------------
  339|    735|      return cbor_bytestring_is_indefinite(item);
  340|  15.1k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (340:5): [True: 15.1k, False: 285k]
  ------------------
  341|  15.1k|      return cbor_string_is_indefinite(item);
  342|   283k|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (342:5): [True: 283k, False: 17.4k]
  ------------------
  343|   283k|      return cbor_array_is_indefinite(item);
  344|  1.52k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (344:5): [True: 1.52k, False: 299k]
  ------------------
  345|  1.52k|      return cbor_map_is_indefinite(item);
  346|      2|    default:
  ------------------
  |  Branch (346:5): [True: 2, False: 300k]
  ------------------
  347|       |      // Should never happen since a non-nested item cannot be on top of the
  348|       |      // stack.
  349|      2|      return false;
  350|   300k|  }
  351|   300k|}
cbor_builder_indef_break_callback:
  353|   300k|void cbor_builder_indef_break_callback(void *context) {
  354|   300k|  struct _cbor_decoder_context *ctx = context;
  355|       |  /* There must be an item to break out of*/
  356|   300k|  if (ctx->stack->size > 0) {
  ------------------
  |  Branch (356:7): [True: 300k, False: 2]
  ------------------
  357|   300k|    cbor_item_t *item = ctx->stack->top->item;
  358|   300k|    if (_cbor_is_indefinite(
  ------------------
  |  Branch (358:9): [True: 300k, False: 11]
  ------------------
  359|   300k|            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|   300k|        (item->type != CBOR_TYPE_MAP || ctx->stack->top->subitems % 2 == 0)) {
  ------------------
  |  Branch (362:10): [True: 299k, False: 1.51k]
  |  Branch (362:41): [True: 1.50k, False: 8]
  ------------------
  363|   300k|      _cbor_stack_pop(ctx->stack);
  364|   300k|      _cbor_builder_append(item, ctx);
  365|   300k|      return;
  366|   300k|    }
  367|   300k|  }
  368|       |
  369|     21|  ctx->syntax_error = true;
  370|     21|}
cbor_builder_float2_callback:
  372|  93.4k|void cbor_builder_float2_callback(void *context, float value) {
  373|  93.4k|  struct _cbor_decoder_context *ctx = context;
  374|  93.4k|  cbor_item_t *res = cbor_new_float2();
  375|  93.4k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  93.4k|  do {                             \
  |  |  118|  93.4k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 93.4k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  93.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  376|  93.4k|  cbor_set_float2(res, value);
  377|  93.4k|  _cbor_builder_append(res, ctx);
  378|  93.4k|}
cbor_builder_float4_callback:
  380|  6.41k|void cbor_builder_float4_callback(void *context, float value) {
  381|  6.41k|  struct _cbor_decoder_context *ctx = context;
  382|  6.41k|  cbor_item_t *res = cbor_new_float4();
  383|  6.41k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  6.41k|  do {                             \
  |  |  118|  6.41k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 6.41k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  6.41k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  384|  6.41k|  cbor_set_float4(res, value);
  385|  6.41k|  _cbor_builder_append(res, ctx);
  386|  6.41k|}
cbor_builder_float8_callback:
  388|  60.4k|void cbor_builder_float8_callback(void *context, double value) {
  389|  60.4k|  struct _cbor_decoder_context *ctx = context;
  390|  60.4k|  cbor_item_t *res = cbor_new_float8();
  391|  60.4k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  60.4k|  do {                             \
  |  |  118|  60.4k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 60.4k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  60.4k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  392|  60.4k|  cbor_set_float8(res, value);
  393|  60.4k|  _cbor_builder_append(res, ctx);
  394|  60.4k|}
cbor_builder_null_callback:
  396|  2.86M|void cbor_builder_null_callback(void *context) {
  397|  2.86M|  struct _cbor_decoder_context *ctx = context;
  398|  2.86M|  cbor_item_t *res = cbor_new_null();
  399|  2.86M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.86M|  do {                             \
  |  |  118|  2.86M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 6, False: 2.86M]
  |  |  ------------------
  |  |  119|      6|      ctx->creation_failed = true; \
  |  |  120|      6|      return;                      \
  |  |  121|      6|    }                              \
  |  |  122|  2.86M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  400|  2.86M|  _cbor_builder_append(res, ctx);
  401|  2.86M|}
cbor_builder_undefined_callback:
  403|  62.8k|void cbor_builder_undefined_callback(void *context) {
  404|  62.8k|  struct _cbor_decoder_context *ctx = context;
  405|  62.8k|  cbor_item_t *res = cbor_new_undef();
  406|  62.8k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  62.8k|  do {                             \
  |  |  118|  62.8k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 62.8k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  62.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  407|  62.8k|  _cbor_builder_append(res, ctx);
  408|  62.8k|}
cbor_builder_boolean_callback:
  410|  1.71M|void cbor_builder_boolean_callback(void *context, bool value) {
  411|  1.71M|  struct _cbor_decoder_context *ctx = context;
  412|  1.71M|  cbor_item_t *res = cbor_build_bool(value);
  413|  1.71M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.71M|  do {                             \
  |  |  118|  1.71M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 1.71M]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  1.71M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  414|  1.71M|  _cbor_builder_append(res, ctx);
  415|  1.71M|}
cbor_builder_tag_callback:
  417|   374k|void cbor_builder_tag_callback(void *context, uint64_t value) {
  418|   374k|  struct _cbor_decoder_context *ctx = context;
  419|   374k|  cbor_item_t *res = cbor_new_tag(value);
  420|   374k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   374k|  do {                             \
  |  |  118|   374k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 1, False: 374k]
  |  |  ------------------
  |  |  119|      1|      ctx->creation_failed = true; \
  |  |  120|      1|      return;                      \
  |  |  121|      1|    }                              \
  |  |  122|   374k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  421|   374k|  PUSH_CTX_STACK(ctx, res, 1);
  ------------------
  |  |  135|   374k|  do {                                                         \
  |  |  136|   374k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 1, False: 374k]
  |  |  ------------------
  |  |  137|      1|      cbor_decref(&res);                                       \
  |  |  138|      1|      ctx->creation_failed = true;                             \
  |  |  139|      1|    }                                                          \
  |  |  140|   374k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  422|   374k|}

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

_cbor_load_uint8:
   12|  30.8M|uint8_t _cbor_load_uint8(cbor_data source) { return (uint8_t)*source; }
_cbor_load_uint16:
   14|  15.7k|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|  15.7k|  return ((uint16_t) * (source + 0) << 8) + (uint8_t) * (source + 1);
   21|  15.7k|#endif
   22|  15.7k|}
_cbor_load_uint32:
   24|   355k|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|   355k|  return ((uint32_t) * (source + 0) << 0x18) +
   31|   355k|         ((uint32_t) * (source + 1) << 0x10) +
   32|   355k|         ((uint16_t) * (source + 2) << 0x08) + (uint8_t) * (source + 3);
   33|   355k|#endif
   34|   355k|}
_cbor_load_uint64:
   36|   164k|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|   164k|  return ((uint64_t) * (source + 0) << 0x38) +
   43|   164k|         ((uint64_t) * (source + 1) << 0x30) +
   44|   164k|         ((uint64_t) * (source + 2) << 0x28) +
   45|   164k|         ((uint64_t) * (source + 3) << 0x20) +
   46|   164k|         ((uint32_t) * (source + 4) << 0x18) +
   47|   164k|         ((uint32_t) * (source + 5) << 0x10) +
   48|   164k|         ((uint16_t) * (source + 6) << 0x08) + (uint8_t) * (source + 7);
   49|   164k|#endif
   50|   164k|}
_cbor_decode_half:
   53|  93.4k|float _cbor_decode_half(unsigned char *halfp) {
   54|  93.4k|  int half = (halfp[0] << 8) + halfp[1];
   55|  93.4k|  int exp = (half >> 10) & 0x1f;
   56|  93.4k|  int mant = half & 0x3ff;
   57|  93.4k|  double val;
   58|  93.4k|  if (exp == 0)
  ------------------
  |  Branch (58:7): [True: 20.1k, False: 73.3k]
  ------------------
   59|  20.1k|    val = ldexp(mant, -24);
   60|  73.3k|  else if (exp != 31)
  ------------------
  |  Branch (60:12): [True: 68.3k, False: 4.98k]
  ------------------
   61|  68.3k|    val = ldexp(mant + 1024, exp - 25);
   62|  4.98k|  else
   63|  4.98k|    val = mant == 0 ? INFINITY : NAN;
  ------------------
  |  Branch (63:11): [True: 801, False: 4.17k]
  ------------------
   64|  93.4k|  return (float)(half & 0x8000 ? -val : val);
  ------------------
  |  Branch (64:18): [True: 59.0k, False: 34.3k]
  ------------------
   65|  93.4k|}
_cbor_load_half:
   67|  93.4k|float _cbor_load_half(cbor_data source) {
   68|       |  /* Discard const */
   69|  93.4k|  return _cbor_decode_half((unsigned char *)source);
   70|  93.4k|}
_cbor_load_float:
   72|  6.41k|float _cbor_load_float(cbor_data source) {
   73|  6.41k|  union _cbor_float_helper helper = {.as_uint = _cbor_load_uint32(source)};
   74|  6.41k|  return helper.as_float;
   75|  6.41k|}
_cbor_load_double:
   77|  60.4k|double _cbor_load_double(cbor_data source) {
   78|  60.4k|  union _cbor_double_helper helper = {.as_uint = _cbor_load_uint64(source)};
   79|  60.4k|  return helper.as_double;
   80|  60.4k|}

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

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

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

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

cbor_map_size:
   11|  2.93M|size_t cbor_map_size(const cbor_item_t *item) {
   12|  2.93M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.93M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   13|      0|  return item->metadata.map_metadata.end_ptr;
   14|  2.93M|}
cbor_new_definite_map:
   21|  51.9k|cbor_item_t *cbor_new_definite_map(size_t size) {
   22|  51.9k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   23|  51.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  51.9k|  do {                           \
  |  |  107|  51.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 1, False: 51.9k]
  |  |  ------------------
  |  |  108|      1|      return NULL;               \
  |  |  109|      1|    }                            \
  |  |  110|  51.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   24|       |
   25|  51.9k|  *item = (cbor_item_t){
   26|  51.9k|      .refcount = 1,
   27|  51.9k|      .type = CBOR_TYPE_MAP,
   28|  51.9k|      .metadata = {.map_metadata = {.allocated = size,
   29|  51.9k|                                    .type = _CBOR_METADATA_DEFINITE,
   30|  51.9k|                                    .end_ptr = 0}},
   31|  51.9k|      .data = _cbor_alloc_multiple(sizeof(struct cbor_pair), size)};
   32|  51.9k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  114|  51.9k|  do {                                              \
  |  |  115|  51.9k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (115:9): [True: 70, False: 51.8k]
  |  |  ------------------
  |  |  116|     70|      _cbor_free(cbor_item);                        \
  |  |  117|     70|      return NULL;                                  \
  |  |  118|     70|    }                                               \
  |  |  119|  51.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (119:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   33|       |
   34|  51.8k|  return item;
   35|  51.9k|}
cbor_new_indefinite_map:
   37|  3.66k|cbor_item_t *cbor_new_indefinite_map(void) {
   38|  3.66k|  cbor_item_t *item = _cbor_malloc(sizeof(cbor_item_t));
   39|  3.66k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  106|  3.66k|  do {                           \
  |  |  107|  3.66k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (107:9): [True: 0, False: 3.66k]
  |  |  ------------------
  |  |  108|      0|      return NULL;               \
  |  |  109|      0|    }                            \
  |  |  110|  3.66k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (110:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
   40|       |
   41|  3.66k|  *item = (cbor_item_t){
   42|  3.66k|      .refcount = 1,
   43|  3.66k|      .type = CBOR_TYPE_MAP,
   44|  3.66k|      .metadata = {.map_metadata = {.allocated = 0,
   45|  3.66k|                                    .type = _CBOR_METADATA_INDEFINITE,
   46|  3.66k|                                    .end_ptr = 0}},
   47|  3.66k|      .data = NULL};
   48|       |
   49|  3.66k|  return item;
   50|  3.66k|}
_cbor_map_add_key:
   52|  2.39M|bool _cbor_map_add_key(cbor_item_t *item, cbor_item_t *key) {
   53|  2.39M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.39M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   54|      0|  struct _cbor_map_metadata *metadata =
   55|  2.39M|      (struct _cbor_map_metadata *)&item->metadata;
   56|  2.39M|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (56:7): [True: 277k, False: 2.12M]
  ------------------
   57|   277k|    struct cbor_pair *data = cbor_map_handle(item);
   58|   277k|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (58:9): [True: 0, False: 277k]
  ------------------
   59|       |      /* Don't realloc definite preallocated map */
   60|      0|      return false;
   61|      0|    }
   62|       |
   63|   277k|    data[metadata->end_ptr].key = key;
   64|   277k|    data[metadata->end_ptr++].value = NULL;
   65|  2.12M|  } else {
   66|  2.12M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (66:9): [True: 5.78k, False: 2.11M]
  ------------------
   67|       |      /* Exponential realloc */
   68|       |      // Check for overflows first
   69|  5.78k|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  5.78k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (69:11): [True: 0, False: 5.78k]
  ------------------
   70|      0|        return false;
   71|      0|      }
   72|       |
   73|  5.78k|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (73:31): [True: 2.07k, False: 3.70k]
  ------------------
   74|  5.78k|                                  ? 1
   75|  5.78k|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  3.70k|#define CBOR_BUFFER_GROWTH 2
  ------------------
   76|       |
   77|  5.78k|      unsigned char *new_data = _cbor_realloc_multiple(
   78|  5.78k|          item->data, sizeof(struct cbor_pair), new_allocation);
   79|       |
   80|  5.78k|      if (new_data == NULL) {
  ------------------
  |  Branch (80:11): [True: 1, False: 5.78k]
  ------------------
   81|      1|        return false;
   82|      1|      }
   83|       |
   84|  5.78k|      item->data = new_data;
   85|  5.78k|      metadata->allocated = new_allocation;
   86|  5.78k|    }
   87|  2.12M|    struct cbor_pair *data = cbor_map_handle(item);
   88|  2.12M|    data[metadata->end_ptr].key = key;
   89|  2.12M|    data[metadata->end_ptr++].value = NULL;
   90|  2.12M|  }
   91|  2.39M|  cbor_incref(key);
   92|  2.39M|  return true;
   93|  2.39M|}
_cbor_map_add_value:
   95|  2.39M|bool _cbor_map_add_value(cbor_item_t *item, cbor_item_t *value) {
   96|  2.39M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  2.39M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
   97|      0|  cbor_incref(value);
   98|  2.39M|  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.39M|      item->metadata.map_metadata.end_ptr - 1]
  102|  2.39M|      .value = value;
  103|  2.39M|  return true;
  104|  2.39M|}
cbor_map_add:
  107|   929k|bool cbor_map_add(cbor_item_t *item, struct cbor_pair pair) {
  108|   929k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|   929k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  109|   929k|  if (!_cbor_map_add_key(item, pair.key)) return false;
  ------------------
  |  Branch (109:7): [True: 0, False: 929k]
  ------------------
  110|   929k|  return _cbor_map_add_value(item, pair.value);
  111|   929k|}
cbor_map_is_definite:
  113|  5.44M|bool cbor_map_is_definite(const cbor_item_t *item) {
  114|  5.44M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  5.44M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  115|      0|  return item->metadata.map_metadata.type == _CBOR_METADATA_DEFINITE;
  116|  5.44M|}
cbor_map_is_indefinite:
  118|  3.82k|bool cbor_map_is_indefinite(const cbor_item_t *item) {
  119|  3.82k|  return !cbor_map_is_definite(item);
  120|  3.82k|}
cbor_map_handle:
  122|  6.77M|struct cbor_pair *cbor_map_handle(const cbor_item_t *item) {
  123|  6.77M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  6.77M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  124|      0|  return (struct cbor_pair *)item->data;
  125|  6.77M|}

cbor_serialize:
   21|  21.7M|                      size_t buffer_size) {
   22|       |  // cppcheck-suppress missingReturn
   23|  21.7M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (23:11): [True: 0, False: 21.7M]
  ------------------
   24|  13.0M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (24:5): [True: 13.0M, False: 8.68M]
  ------------------
   25|  13.0M|      return cbor_serialize_uint(item, buffer, buffer_size);
   26|   594k|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (26:5): [True: 594k, False: 21.1M]
  ------------------
   27|   594k|      return cbor_serialize_negint(item, buffer, buffer_size);
   28|  18.3k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (28:5): [True: 18.3k, False: 21.6M]
  ------------------
   29|  18.3k|      return cbor_serialize_bytestring(item, buffer, buffer_size);
   30|   189k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (30:5): [True: 189k, False: 21.5M]
  ------------------
   31|   189k|      return cbor_serialize_string(item, buffer, buffer_size);
   32|  6.15M|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (32:5): [True: 6.15M, False: 15.5M]
  ------------------
   33|  6.15M|      return cbor_serialize_array(item, buffer, buffer_size);
   34|  21.4k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (34:5): [True: 21.4k, False: 21.6M]
  ------------------
   35|  21.4k|      return cbor_serialize_map(item, buffer, buffer_size);
   36|   127k|    case CBOR_TYPE_TAG:
  ------------------
  |  Branch (36:5): [True: 127k, False: 21.5M]
  ------------------
   37|   127k|      return cbor_serialize_tag(item, buffer, buffer_size);
   38|  1.58M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (38:5): [True: 1.58M, False: 20.1M]
  ------------------
   39|  1.58M|      return cbor_serialize_float_ctrl(item, buffer, buffer_size);
   40|  21.7M|  }
   41|  21.7M|}
_cbor_encoded_header_size:
   48|  8.79M|size_t _cbor_encoded_header_size(uint64_t size) {
   49|  8.79M|  if (size <= kMaxEmbeddedInt)
  ------------------
  |  Branch (49:7): [True: 8.77M, False: 13.8k]
  ------------------
   50|  8.77M|    return 1;
   51|  13.8k|  else if (size <= UINT8_MAX)
  ------------------
  |  Branch (51:12): [True: 8.16k, False: 5.64k]
  ------------------
   52|  8.16k|    return 2;
   53|  5.64k|  else if (size <= UINT16_MAX)
  ------------------
  |  Branch (53:12): [True: 1.23k, False: 4.40k]
  ------------------
   54|  1.23k|    return 3;
   55|  4.40k|  else if (size <= UINT32_MAX)
  ------------------
  |  Branch (55:12): [True: 2.78k, False: 1.62k]
  ------------------
   56|  2.78k|    return 5;
   57|  1.62k|  else
   58|  1.62k|    return 9;
   59|  8.79M|}
cbor_serialized_size:
   61|  22.7M|size_t cbor_serialized_size(const cbor_item_t *item) {
   62|       |  // cppcheck-suppress missingReturn
   63|  22.7M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (63:11): [True: 0, False: 22.7M]
  ------------------
   64|  13.0M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (64:5): [True: 13.0M, False: 9.76M]
  ------------------
   65|  13.6M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (65:5): [True: 594k, False: 22.1M]
  ------------------
   66|  13.6M|      switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (66:15): [True: 0, False: 13.6M]
  ------------------
   67|  13.2M|        case CBOR_INT_8:
  ------------------
  |  Branch (67:9): [True: 13.2M, False: 342k]
  ------------------
   68|  13.2M|          if (cbor_get_uint8(item) <= kMaxEmbeddedInt) return 1;
  ------------------
  |  Branch (68:15): [True: 13.2M, False: 18.2k]
  ------------------
   69|  18.2k|          return 2;
   70|  7.47k|        case CBOR_INT_16:
  ------------------
  |  Branch (70:9): [True: 7.47k, False: 13.6M]
  ------------------
   71|  7.47k|          return 3;
   72|   325k|        case CBOR_INT_32:
  ------------------
  |  Branch (72:9): [True: 325k, False: 13.2M]
  ------------------
   73|   325k|          return 5;
   74|  9.23k|        case CBOR_INT_64:
  ------------------
  |  Branch (74:9): [True: 9.23k, False: 13.6M]
  ------------------
   75|  9.23k|          return 9;
   76|  13.6M|      }
   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|   547k|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (80:5): [True: 547k, False: 22.2M]
  ------------------
   81|   547k|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (81:11): [True: 547k, False: 531]
  ------------------
   82|   547k|        size_t header_size =
   83|   547k|            _cbor_encoded_header_size(cbor_bytestring_length(item));
   84|   547k|        if (cbor_bytestring_length(item) == 0) return header_size;
  ------------------
  |  Branch (84:13): [True: 0, False: 547k]
  ------------------
   85|   547k|        return _cbor_safe_signaling_add(header_size,
   86|   547k|                                        cbor_bytestring_length(item));
   87|   547k|      }
   88|    531|      size_t indef_bytestring_size = 2;  // Leading byte + break
   89|    531|      cbor_item_t **chunks = cbor_bytestring_chunks_handle(item);
   90|   529k|      for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (90:26): [True: 529k, False: 531]
  ------------------
   91|   529k|        indef_bytestring_size = _cbor_safe_signaling_add(
   92|   529k|            indef_bytestring_size, cbor_serialized_size(chunks[i]));
   93|   529k|      }
   94|    531|      return indef_bytestring_size;
   95|   547k|    }
   96|   738k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (96:5): [True: 738k, False: 22.0M]
  ------------------
   97|   738k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (97:11): [True: 724k, False: 14.7k]
  ------------------
   98|   724k|        size_t header_size =
   99|   724k|            _cbor_encoded_header_size(cbor_string_length(item));
  100|   724k|        if (cbor_string_length(item) == 0) return header_size;
  ------------------
  |  Branch (100:13): [True: 0, False: 724k]
  ------------------
  101|   724k|        return _cbor_safe_signaling_add(header_size, cbor_string_length(item));
  102|   724k|      }
  103|  14.7k|      size_t indef_string_size = 2;  // Leading byte + break
  104|  14.7k|      cbor_item_t **chunks = cbor_string_chunks_handle(item);
  105|   564k|      for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (105:26): [True: 549k, False: 14.7k]
  ------------------
  106|   549k|        indef_string_size = _cbor_safe_signaling_add(
  107|   549k|            indef_string_size, cbor_serialized_size(chunks[i]));
  108|   549k|      }
  109|  14.7k|      return indef_string_size;
  110|   738k|    }
  111|  6.15M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (111:5): [True: 6.15M, False: 16.6M]
  ------------------
  112|  6.15M|      size_t array_size = cbor_array_is_definite(item)
  ------------------
  |  Branch (112:27): [True: 5.91M, False: 235k]
  ------------------
  113|  6.15M|                              ? _cbor_encoded_header_size(cbor_array_size(item))
  114|  6.15M|                              : 2;  // Leading byte + break
  115|  6.15M|      cbor_item_t **items = cbor_array_handle(item);
  116|  25.8M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (116:26): [True: 19.7M, False: 6.15M]
  ------------------
  117|  19.7M|        array_size = _cbor_safe_signaling_add(array_size,
  118|  19.7M|                                              cbor_serialized_size(items[i]));
  119|  19.7M|      }
  120|  6.15M|      return array_size;
  121|   738k|    }
  122|  21.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (122:5): [True: 21.4k, False: 22.7M]
  ------------------
  123|  21.4k|      size_t map_size = cbor_map_is_definite(item)
  ------------------
  |  Branch (123:25): [True: 20.2k, False: 1.15k]
  ------------------
  124|  21.4k|                            ? _cbor_encoded_header_size(cbor_map_size(item))
  125|  21.4k|                            : 2;  // Leading byte + break
  126|  21.4k|      struct cbor_pair *items = cbor_map_handle(item);
  127|   950k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (127:26): [True: 929k, False: 21.4k]
  ------------------
  128|   929k|        map_size = _cbor_safe_signaling_add(
  129|   929k|            map_size,
  130|   929k|            _cbor_safe_signaling_add(cbor_serialized_size(items[i].key),
  131|   929k|                                     cbor_serialized_size(items[i].value)));
  132|   929k|      }
  133|  21.4k|      return map_size;
  134|   738k|    }
  135|   127k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (135:5): [True: 127k, False: 22.6M]
  ------------------
  136|   127k|      return _cbor_safe_signaling_add(
  137|   127k|          _cbor_encoded_header_size(cbor_tag_value(item)),
  138|   127k|          cbor_serialized_size(cbor_move(cbor_tag_item(item))));
  139|   738k|    }
  140|  1.58M|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (140:5): [True: 1.58M, False: 21.2M]
  ------------------
  141|  1.58M|      switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (141:15): [True: 0, False: 1.58M]
  ------------------
  142|  1.45M|        case CBOR_FLOAT_0:
  ------------------
  |  Branch (142:9): [True: 1.45M, False: 123k]
  ------------------
  143|  1.45M|          return _cbor_encoded_header_size(cbor_ctrl_value(item));
  144|  82.8k|        case CBOR_FLOAT_16:
  ------------------
  |  Branch (144:9): [True: 82.8k, False: 1.49M]
  ------------------
  145|  82.8k|          return 3;
  146|  5.85k|        case CBOR_FLOAT_32:
  ------------------
  |  Branch (146:9): [True: 5.85k, False: 1.57M]
  ------------------
  147|  5.85k|          return 5;
  148|  34.7k|        case CBOR_FLOAT_64:
  ------------------
  |  Branch (148:9): [True: 34.7k, False: 1.54M]
  ------------------
  149|  34.7k|          return 9;
  150|  1.58M|      }
  151|  22.7M|  }
  152|  22.7M|}
cbor_serialize_alloc:
  155|  1.32k|                            size_t *buffer_size) {
  156|  1.32k|  *buffer = NULL;
  157|  1.32k|  size_t serialized_size = cbor_serialized_size(item);
  158|  1.32k|  if (serialized_size == 0) {
  ------------------
  |  Branch (158:7): [True: 0, False: 1.32k]
  ------------------
  159|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (159:9): [True: 0, False: 0]
  ------------------
  160|      0|    return 0;
  161|      0|  }
  162|  1.32k|  *buffer = _cbor_malloc(serialized_size);
  163|  1.32k|  if (*buffer == NULL) {
  ------------------
  |  Branch (163:7): [True: 0, False: 1.32k]
  ------------------
  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.32k|  size_t written = cbor_serialize(item, *buffer, serialized_size);
  169|  1.32k|  CBOR_ASSERT(written == serialized_size);
  ------------------
  |  |   63|  1.32k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  170|  1.32k|  if (buffer_size != NULL) *buffer_size = serialized_size;
  ------------------
  |  Branch (170:7): [True: 1.32k, False: 0]
  ------------------
  171|  1.32k|  return written;
  172|  1.32k|}
cbor_serialize_uint:
  175|  13.0M|                           size_t buffer_size) {
  176|  13.0M|  CBOR_ASSERT(cbor_isa_uint(item));
  ------------------
  |  |   63|  13.0M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  177|       |  // cppcheck-suppress missingReturn
  178|      0|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (178:11): [True: 0, False: 13.0M]
  ------------------
  179|  12.6M|    case CBOR_INT_8:
  ------------------
  |  Branch (179:5): [True: 12.6M, False: 331k]
  ------------------
  180|  12.6M|      return cbor_encode_uint8(cbor_get_uint8(item), buffer, buffer_size);
  181|  3.66k|    case CBOR_INT_16:
  ------------------
  |  Branch (181:5): [True: 3.66k, False: 13.0M]
  ------------------
  182|  3.66k|      return cbor_encode_uint16(cbor_get_uint16(item), buffer, buffer_size);
  183|   322k|    case CBOR_INT_32:
  ------------------
  |  Branch (183:5): [True: 322k, False: 12.7M]
  ------------------
  184|   322k|      return cbor_encode_uint32(cbor_get_uint32(item), buffer, buffer_size);
  185|  5.22k|    case CBOR_INT_64:
  ------------------
  |  Branch (185:5): [True: 5.22k, False: 13.0M]
  ------------------
  186|  5.22k|      return cbor_encode_uint64(cbor_get_uint64(item), buffer, buffer_size);
  187|  13.0M|  }
  188|  13.0M|}
cbor_serialize_negint:
  191|   594k|                             size_t buffer_size) {
  192|   594k|  CBOR_ASSERT(cbor_isa_negint(item));
  ------------------
  |  |   63|   594k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  193|       |  // cppcheck-suppress missingReturn
  194|      0|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (194:11): [True: 0, False: 594k]
  ------------------
  195|   583k|    case CBOR_INT_8:
  ------------------
  |  Branch (195:5): [True: 583k, False: 10.4k]
  ------------------
  196|   583k|      return cbor_encode_negint8(cbor_get_uint8(item), buffer, buffer_size);
  197|  3.80k|    case CBOR_INT_16:
  ------------------
  |  Branch (197:5): [True: 3.80k, False: 590k]
  ------------------
  198|  3.80k|      return cbor_encode_negint16(cbor_get_uint16(item), buffer, buffer_size);
  199|  2.64k|    case CBOR_INT_32:
  ------------------
  |  Branch (199:5): [True: 2.64k, False: 591k]
  ------------------
  200|  2.64k|      return cbor_encode_negint32(cbor_get_uint32(item), buffer, buffer_size);
  201|  4.01k|    case CBOR_INT_64:
  ------------------
  |  Branch (201:5): [True: 4.01k, False: 590k]
  ------------------
  202|  4.01k|      return cbor_encode_negint64(cbor_get_uint64(item), buffer, buffer_size);
  203|   594k|  }
  204|   594k|}
cbor_serialize_bytestring:
  207|   547k|                                 size_t buffer_size) {
  208|   547k|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   63|   547k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  209|   547k|  if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (209:7): [True: 547k, False: 531]
  ------------------
  210|   547k|    size_t length = cbor_bytestring_length(item);
  211|   547k|    size_t written = cbor_encode_bytestring_start(length, buffer, buffer_size);
  212|   547k|    if (written > 0 && (buffer_size - written >= length)) {
  ------------------
  |  Branch (212:9): [True: 547k, False: 0]
  |  Branch (212:24): [True: 547k, False: 0]
  ------------------
  213|   547k|      memcpy(buffer + written, cbor_bytestring_handle(item), length);
  214|   547k|      return written + length;
  215|   547k|    }
  216|      0|    return 0;
  217|   547k|  } else {
  218|    531|    CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   63|    531|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  219|      0|    size_t chunk_count = cbor_bytestring_chunk_count(item);
  220|    531|    size_t written = cbor_encode_indef_bytestring_start(buffer, buffer_size);
  221|    531|    if (written == 0) return 0;
  ------------------
  |  Branch (221:9): [True: 0, False: 531]
  ------------------
  222|       |
  223|    531|    cbor_item_t **chunks = cbor_bytestring_chunks_handle(item);
  224|   529k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (224:24): [True: 529k, False: 531]
  ------------------
  225|   529k|      size_t chunk_written = cbor_serialize_bytestring(
  226|   529k|          chunks[i], buffer + written, buffer_size - written);
  227|   529k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (227:11): [True: 0, False: 529k]
  ------------------
  228|   529k|      written += chunk_written;
  229|   529k|    }
  230|       |
  231|    531|    size_t break_written =
  232|    531|        cbor_encode_break(buffer + written, buffer_size - written);
  233|    531|    if (break_written == 0) return 0;
  ------------------
  |  Branch (233:9): [True: 0, False: 531]
  ------------------
  234|    531|    return written + break_written;
  235|    531|  }
  236|   547k|}
cbor_serialize_string:
  239|   738k|                             size_t buffer_size) {
  240|   738k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   63|   738k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  241|   738k|  if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (241:7): [True: 724k, False: 14.7k]
  ------------------
  242|   724k|    size_t length = cbor_string_length(item);
  243|   724k|    size_t written = cbor_encode_string_start(length, buffer, buffer_size);
  244|   724k|    if (written && (buffer_size - written >= length)) {
  ------------------
  |  Branch (244:9): [True: 724k, False: 0]
  |  Branch (244:20): [True: 724k, False: 0]
  ------------------
  245|   724k|      memcpy(buffer + written, cbor_string_handle(item), length);
  246|   724k|      return written + length;
  247|   724k|    }
  248|      0|    return 0;
  249|   724k|  } else {
  250|  14.7k|    CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   63|  14.7k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  251|      0|    size_t chunk_count = cbor_string_chunk_count(item);
  252|  14.7k|    size_t written = cbor_encode_indef_string_start(buffer, buffer_size);
  253|  14.7k|    if (written == 0) return 0;
  ------------------
  |  Branch (253:9): [True: 0, False: 14.7k]
  ------------------
  254|       |
  255|  14.7k|    cbor_item_t **chunks = cbor_string_chunks_handle(item);
  256|   564k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (256:24): [True: 549k, False: 14.7k]
  ------------------
  257|   549k|      size_t chunk_written = cbor_serialize_string(chunks[i], buffer + written,
  258|   549k|                                                   buffer_size - written);
  259|   549k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (259:11): [True: 0, False: 549k]
  ------------------
  260|   549k|      written += chunk_written;
  261|   549k|    }
  262|       |
  263|  14.7k|    size_t break_written =
  264|  14.7k|        cbor_encode_break(buffer + written, buffer_size - written);
  265|  14.7k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (265:9): [True: 0, False: 14.7k]
  ------------------
  266|  14.7k|    return written + break_written;
  267|  14.7k|  }
  268|   738k|}
cbor_serialize_array:
  271|  6.15M|                            size_t buffer_size) {
  272|  6.15M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   63|  6.15M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  273|      0|  size_t size = cbor_array_size(item), written = 0;
  274|  6.15M|  cbor_item_t **handle = cbor_array_handle(item);
  275|  6.15M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (275:7): [True: 5.91M, False: 235k]
  ------------------
  276|  5.91M|    written = cbor_encode_array_start(size, buffer, buffer_size);
  277|  5.91M|  } else {
  278|   235k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   63|   235k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  279|      0|    written = cbor_encode_indef_array_start(buffer, buffer_size);
  280|   235k|  }
  281|  6.15M|  if (written == 0) return 0;
  ------------------
  |  Branch (281:7): [True: 0, False: 6.15M]
  ------------------
  282|       |
  283|  25.8M|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (283:22): [True: 19.7M, False: 6.15M]
  ------------------
  284|  19.7M|    size_t item_written =
  285|  19.7M|        cbor_serialize(*(handle++), buffer + written, buffer_size - written);
  286|  19.7M|    if (item_written == 0) return 0;
  ------------------
  |  Branch (286:9): [True: 0, False: 19.7M]
  ------------------
  287|  19.7M|    written += item_written;
  288|  19.7M|  }
  289|       |
  290|  6.15M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (290:7): [True: 5.91M, False: 235k]
  ------------------
  291|  5.91M|    return written;
  292|  5.91M|  } else {
  293|   235k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   63|   235k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  294|      0|    size_t break_written =
  295|   235k|        cbor_encode_break(buffer + written, buffer_size - written);
  296|   235k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (296:9): [True: 0, False: 235k]
  ------------------
  297|   235k|    return written + break_written;
  298|   235k|  }
  299|  6.15M|}
cbor_serialize_map:
  302|  21.4k|                          size_t buffer_size) {
  303|  21.4k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   63|  21.4k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  304|      0|  size_t size = cbor_map_size(item), written = 0;
  305|  21.4k|  struct cbor_pair *handle = cbor_map_handle(item);
  306|       |
  307|  21.4k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (307:7): [True: 20.2k, False: 1.15k]
  ------------------
  308|  20.2k|    written = cbor_encode_map_start(size, buffer, buffer_size);
  309|  20.2k|  } else {
  310|  1.15k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   63|  1.15k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  311|      0|    written = cbor_encode_indef_map_start(buffer, buffer_size);
  312|  1.15k|  }
  313|  21.4k|  if (written == 0) return 0;
  ------------------
  |  Branch (313:7): [True: 0, False: 21.4k]
  ------------------
  314|       |
  315|   950k|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (315:22): [True: 929k, False: 21.4k]
  ------------------
  316|   929k|    size_t item_written =
  317|   929k|        cbor_serialize(handle->key, buffer + written, buffer_size - written);
  318|   929k|    if (item_written == 0) {
  ------------------
  |  Branch (318:9): [True: 0, False: 929k]
  ------------------
  319|      0|      return 0;
  320|      0|    }
  321|   929k|    written += item_written;
  322|   929k|    item_written = cbor_serialize((handle++)->value, buffer + written,
  323|   929k|                                  buffer_size - written);
  324|   929k|    if (item_written == 0) return 0;
  ------------------
  |  Branch (324:9): [True: 0, False: 929k]
  ------------------
  325|   929k|    written += item_written;
  326|   929k|  }
  327|       |
  328|  21.4k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (328:7): [True: 20.2k, False: 1.15k]
  ------------------
  329|  20.2k|    return written;
  330|  20.2k|  } else {
  331|  1.15k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   63|  1.15k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  332|      0|    size_t break_written =
  333|  1.15k|        cbor_encode_break(buffer + written, buffer_size - written);
  334|  1.15k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (334:9): [True: 0, False: 1.15k]
  ------------------
  335|  1.15k|    return written + break_written;
  336|  1.15k|  }
  337|  21.4k|}
cbor_serialize_tag:
  340|   127k|                          size_t buffer_size) {
  341|   127k|  CBOR_ASSERT(cbor_isa_tag(item));
  ------------------
  |  |   63|   127k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  342|      0|  size_t written = cbor_encode_tag(cbor_tag_value(item), buffer, buffer_size);
  343|   127k|  if (written == 0) return 0;
  ------------------
  |  Branch (343:7): [True: 0, False: 127k]
  ------------------
  344|       |
  345|   127k|  size_t item_written = cbor_serialize(cbor_move(cbor_tag_item(item)),
  346|   127k|                                       buffer + written, buffer_size - written);
  347|   127k|  if (item_written == 0) return 0;
  ------------------
  |  Branch (347:7): [True: 0, False: 127k]
  ------------------
  348|   127k|  return written + item_written;
  349|   127k|}
cbor_serialize_float_ctrl:
  352|  1.58M|                                 size_t buffer_size) {
  353|  1.58M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   63|  1.58M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  354|       |  // cppcheck-suppress missingReturn
  355|      0|  switch (cbor_float_get_width(item)) {
  ------------------
  |  Branch (355:11): [True: 0, False: 1.58M]
  ------------------
  356|  1.45M|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (356:5): [True: 1.45M, False: 123k]
  ------------------
  357|       |      /* CTRL - special treatment */
  358|  1.45M|      return cbor_encode_ctrl(cbor_ctrl_value(item), buffer, buffer_size);
  359|  82.8k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (359:5): [True: 82.8k, False: 1.49M]
  ------------------
  360|  82.8k|      return cbor_encode_half(cbor_float_get_float2(item), buffer, buffer_size);
  361|  5.85k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (361:5): [True: 5.85k, False: 1.57M]
  ------------------
  362|  5.85k|      return cbor_encode_single(cbor_float_get_float4(item), buffer,
  363|  5.85k|                                buffer_size);
  364|  34.7k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (364:5): [True: 34.7k, False: 1.54M]
  ------------------
  365|  34.7k|      return cbor_encode_double(cbor_float_get_float8(item), buffer,
  366|  34.7k|                                buffer_size);
  367|  1.58M|  }
  368|  1.58M|}

cbor_stream_decode:
   45|  36.7M|    const struct cbor_callbacks *callbacks, void *context) {
   46|       |  // Attempt to claim the initial MTB byte
   47|  36.7M|  struct cbor_decoder_result result = {.status = CBOR_DECODER_FINISHED};
   48|  36.7M|  if (!claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (48:7): [True: 0, False: 36.7M]
  ------------------
   49|      0|    return result;
   50|      0|  }
   51|       |
   52|  36.7M|  switch (*source) {
   53|  18.4M|    case 0x00: /* Fallthrough */
  ------------------
  |  Branch (53:5): [True: 18.4M, False: 18.3M]
  ------------------
   54|  18.5M|    case 0x01: /* Fallthrough */
  ------------------
  |  Branch (54:5): [True: 19.2k, False: 36.7M]
  ------------------
   55|  18.5M|    case 0x02: /* Fallthrough */
  ------------------
  |  Branch (55:5): [True: 25.5k, False: 36.7M]
  ------------------
   56|  18.5M|    case 0x03: /* Fallthrough */
  ------------------
  |  Branch (56:5): [True: 6.92k, False: 36.7M]
  ------------------
   57|  18.5M|    case 0x04: /* Fallthrough */
  ------------------
  |  Branch (57:5): [True: 11.8k, False: 36.7M]
  ------------------
   58|  18.5M|    case 0x05: /* Fallthrough */
  ------------------
  |  Branch (58:5): [True: 3.52k, False: 36.7M]
  ------------------
   59|  18.5M|    case 0x06: /* Fallthrough */
  ------------------
  |  Branch (59:5): [True: 9.15k, False: 36.7M]
  ------------------
   60|  18.5M|    case 0x07: /* Fallthrough */
  ------------------
  |  Branch (60:5): [True: 1.71k, False: 36.7M]
  ------------------
   61|  18.5M|    case 0x08: /* Fallthrough */
  ------------------
  |  Branch (61:5): [True: 10.1k, False: 36.7M]
  ------------------
   62|  18.6M|    case 0x09: /* Fallthrough */
  ------------------
  |  Branch (62:5): [True: 52.2k, False: 36.7M]
  ------------------
   63|  18.6M|    case 0x0A: /* Fallthrough */
  ------------------
  |  Branch (63:5): [True: 29.8k, False: 36.7M]
  ------------------
   64|  18.6M|    case 0x0B: /* Fallthrough */
  ------------------
  |  Branch (64:5): [True: 1.05k, False: 36.7M]
  ------------------
   65|  18.6M|    case 0x0C: /* Fallthrough */
  ------------------
  |  Branch (65:5): [True: 13.6k, False: 36.7M]
  ------------------
   66|  18.7M|    case 0x0D: /* Fallthrough */
  ------------------
  |  Branch (66:5): [True: 55.0k, False: 36.7M]
  ------------------
   67|  18.7M|    case 0x0E: /* Fallthrough */
  ------------------
  |  Branch (67:5): [True: 6.58k, False: 36.7M]
  ------------------
   68|  18.7M|    case 0x0F: /* Fallthrough */
  ------------------
  |  Branch (68:5): [True: 7.75k, False: 36.7M]
  ------------------
   69|  18.8M|    case 0x10: /* Fallthrough */
  ------------------
  |  Branch (69:5): [True: 104k, False: 36.6M]
  ------------------
   70|  18.8M|    case 0x11: /* Fallthrough */
  ------------------
  |  Branch (70:5): [True: 32.5k, False: 36.7M]
  ------------------
   71|  18.9M|    case 0x12: /* Fallthrough */
  ------------------
  |  Branch (71:5): [True: 21.6k, False: 36.7M]
  ------------------
   72|  18.9M|    case 0x13: /* Fallthrough */
  ------------------
  |  Branch (72:5): [True: 30.3k, False: 36.7M]
  ------------------
   73|  18.9M|    case 0x14: /* Fallthrough */
  ------------------
  |  Branch (73:5): [True: 37.2k, False: 36.7M]
  ------------------
   74|  19.0M|    case 0x15: /* Fallthrough */
  ------------------
  |  Branch (74:5): [True: 113k, False: 36.6M]
  ------------------
   75|  19.1M|    case 0x16: /* Fallthrough */
  ------------------
  |  Branch (75:5): [True: 19.1k, False: 36.7M]
  ------------------
   76|  19.1M|    case 0x17:
  ------------------
  |  Branch (76:5): [True: 9.24k, False: 36.7M]
  ------------------
   77|       |      /* Embedded one byte unsigned integer */
   78|  19.1M|      {
   79|  19.1M|        callbacks->uint8(context, _cbor_load_uint8(source));
   80|  19.1M|        return result;
   81|  19.1M|      }
   82|  13.0k|    case 0x18:
  ------------------
  |  Branch (82:5): [True: 13.0k, False: 36.7M]
  ------------------
   83|       |      /* One byte unsigned integer */
   84|  13.0k|      {
   85|  13.0k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (85:13): [True: 13.0k, False: 2]
  ------------------
   86|  13.0k|          callbacks->uint8(context, _cbor_load_uint8(source + 1));
   87|  13.0k|        }
   88|  13.0k|        return result;
   89|  19.1M|      }
   90|  4.07k|    case 0x19:
  ------------------
  |  Branch (90:5): [True: 4.07k, False: 36.7M]
  ------------------
   91|       |      /* Two bytes unsigned integer */
   92|  4.07k|      {
   93|  4.07k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (93:13): [True: 4.07k, False: 1]
  ------------------
   94|  4.07k|          callbacks->uint16(context, _cbor_load_uint16(source + 1));
   95|  4.07k|        }
   96|  4.07k|        return result;
   97|  19.1M|      }
   98|   339k|    case 0x1A:
  ------------------
  |  Branch (98:5): [True: 339k, False: 36.4M]
  ------------------
   99|       |      /* Four bytes unsigned integer */
  100|   339k|      {
  101|   339k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (101:13): [True: 339k, False: 2]
  ------------------
  102|   339k|          callbacks->uint32(context, _cbor_load_uint32(source + 1));
  103|   339k|        }
  104|   339k|        return result;
  105|  19.1M|      }
  106|  24.2k|    case 0x1B:
  ------------------
  |  Branch (106:5): [True: 24.2k, False: 36.7M]
  ------------------
  107|       |      /* Eight bytes unsigned integer */
  108|  24.2k|      {
  109|  24.2k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (109:13): [True: 24.2k, False: 1]
  ------------------
  110|  24.2k|          callbacks->uint64(context, _cbor_load_uint64(source + 1));
  111|  24.2k|        }
  112|  24.2k|        return result;
  113|  19.1M|      }
  114|      1|    case 0x1C: /* Fallthrough */
  ------------------
  |  Branch (114:5): [True: 1, False: 36.7M]
  ------------------
  115|      2|    case 0x1D: /* Fallthrough */
  ------------------
  |  Branch (115:5): [True: 1, False: 36.7M]
  ------------------
  116|      4|    case 0x1E: /* Fallthrough */
  ------------------
  |  Branch (116:5): [True: 2, False: 36.7M]
  ------------------
  117|      5|    case 0x1F:
  ------------------
  |  Branch (117:5): [True: 1, False: 36.7M]
  ------------------
  118|       |      /* Reserved */
  119|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  120|  3.44k|    case 0x20: /* Fallthrough */
  ------------------
  |  Branch (120:5): [True: 3.44k, False: 36.7M]
  ------------------
  121|  4.01k|    case 0x21: /* Fallthrough */
  ------------------
  |  Branch (121:5): [True: 575, False: 36.7M]
  ------------------
  122|  7.97k|    case 0x22: /* Fallthrough */
  ------------------
  |  Branch (122:5): [True: 3.95k, False: 36.7M]
  ------------------
  123|  10.8k|    case 0x23: /* Fallthrough */
  ------------------
  |  Branch (123:5): [True: 2.83k, False: 36.7M]
  ------------------
  124|  21.1k|    case 0x24: /* Fallthrough */
  ------------------
  |  Branch (124:5): [True: 10.3k, False: 36.7M]
  ------------------
  125|  52.1k|    case 0x25: /* Fallthrough */
  ------------------
  |  Branch (125:5): [True: 31.0k, False: 36.7M]
  ------------------
  126|   218k|    case 0x26: /* Fallthrough */
  ------------------
  |  Branch (126:5): [True: 165k, False: 36.6M]
  ------------------
  127|   219k|    case 0x27: /* Fallthrough */
  ------------------
  |  Branch (127:5): [True: 1.52k, False: 36.7M]
  ------------------
  128|   223k|    case 0x28: /* Fallthrough */
  ------------------
  |  Branch (128:5): [True: 3.56k, False: 36.7M]
  ------------------
  129|   224k|    case 0x29: /* Fallthrough */
  ------------------
  |  Branch (129:5): [True: 1.15k, False: 36.7M]
  ------------------
  130|   225k|    case 0x2A: /* Fallthrough */
  ------------------
  |  Branch (130:5): [True: 761, False: 36.7M]
  ------------------
  131|   302k|    case 0x2B: /* Fallthrough */
  ------------------
  |  Branch (131:5): [True: 76.9k, False: 36.7M]
  ------------------
  132|   349k|    case 0x2C: /* Fallthrough */
  ------------------
  |  Branch (132:5): [True: 47.2k, False: 36.7M]
  ------------------
  133|   355k|    case 0x2D: /* Fallthrough */
  ------------------
  |  Branch (133:5): [True: 6.63k, False: 36.7M]
  ------------------
  134|   390k|    case 0x2E: /* Fallthrough */
  ------------------
  |  Branch (134:5): [True: 34.8k, False: 36.7M]
  ------------------
  135|   394k|    case 0x2F: /* Fallthrough */
  ------------------
  |  Branch (135:5): [True: 3.51k, False: 36.7M]
  ------------------
  136|   530k|    case 0x30: /* Fallthrough */
  ------------------
  |  Branch (136:5): [True: 135k, False: 36.6M]
  ------------------
  137|   548k|    case 0x31: /* Fallthrough */
  ------------------
  |  Branch (137:5): [True: 17.9k, False: 36.7M]
  ------------------
  138|   590k|    case 0x32: /* Fallthrough */
  ------------------
  |  Branch (138:5): [True: 41.6k, False: 36.7M]
  ------------------
  139|   697k|    case 0x33: /* Fallthrough */
  ------------------
  |  Branch (139:5): [True: 107k, False: 36.6M]
  ------------------
  140|   704k|    case 0x34: /* Fallthrough */
  ------------------
  |  Branch (140:5): [True: 6.24k, False: 36.7M]
  ------------------
  141|   764k|    case 0x35: /* Fallthrough */
  ------------------
  |  Branch (141:5): [True: 60.4k, False: 36.7M]
  ------------------
  142|   818k|    case 0x36: /* Fallthrough */
  ------------------
  |  Branch (142:5): [True: 53.8k, False: 36.7M]
  ------------------
  143|   857k|    case 0x37:
  ------------------
  |  Branch (143:5): [True: 39.0k, False: 36.7M]
  ------------------
  144|       |      /* Embedded one byte negative integer */
  145|   857k|      {
  146|   857k|        callbacks->negint8(context,
  147|   857k|                           _cbor_load_uint8(source) - 0x20); /* 0x20 offset */
  148|   857k|        return result;
  149|   818k|      }
  150|  11.2k|    case 0x38:
  ------------------
  |  Branch (150:5): [True: 11.2k, False: 36.7M]
  ------------------
  151|       |      /* One byte negative integer */
  152|  11.2k|      {
  153|  11.2k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (153:13): [True: 11.2k, False: 1]
  ------------------
  154|  11.2k|          callbacks->negint8(context, _cbor_load_uint8(source + 1));
  155|  11.2k|        }
  156|  11.2k|        return result;
  157|   818k|      }
  158|  6.33k|    case 0x39:
  ------------------
  |  Branch (158:5): [True: 6.33k, False: 36.7M]
  ------------------
  159|       |      /* Two bytes negative integer */
  160|  6.33k|      {
  161|  6.33k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (161:13): [True: 6.33k, False: 1]
  ------------------
  162|  6.33k|          callbacks->negint16(context, _cbor_load_uint16(source + 1));
  163|  6.33k|        }
  164|  6.33k|        return result;
  165|   818k|      }
  166|  2.96k|    case 0x3A:
  ------------------
  |  Branch (166:5): [True: 2.96k, False: 36.7M]
  ------------------
  167|       |      /* Four bytes negative integer */
  168|  2.96k|      {
  169|  2.96k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (169:13): [True: 2.96k, False: 1]
  ------------------
  170|  2.96k|          callbacks->negint32(context, _cbor_load_uint32(source + 1));
  171|  2.96k|        }
  172|  2.96k|        return result;
  173|   818k|      }
  174|  76.5k|    case 0x3B:
  ------------------
  |  Branch (174:5): [True: 76.5k, False: 36.7M]
  ------------------
  175|       |      /* Eight bytes negative integer */
  176|  76.5k|      {
  177|  76.5k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (177:13): [True: 76.4k, False: 2]
  ------------------
  178|  76.4k|          callbacks->negint64(context, _cbor_load_uint64(source + 1));
  179|  76.4k|        }
  180|  76.5k|        return result;
  181|   818k|      }
  182|      1|    case 0x3C: /* Fallthrough */
  ------------------
  |  Branch (182:5): [True: 1, False: 36.7M]
  ------------------
  183|      2|    case 0x3D: /* Fallthrough */
  ------------------
  |  Branch (183:5): [True: 1, False: 36.7M]
  ------------------
  184|      3|    case 0x3E: /* Fallthrough */
  ------------------
  |  Branch (184:5): [True: 1, False: 36.7M]
  ------------------
  185|      4|    case 0x3F:
  ------------------
  |  Branch (185:5): [True: 1, False: 36.7M]
  ------------------
  186|       |      /* Reserved */
  187|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  188|     10|    case 0x40: /* Fallthrough */
  ------------------
  |  Branch (188:5): [True: 10, False: 36.7M]
  ------------------
  189|   567k|    case 0x41: /* Fallthrough */
  ------------------
  |  Branch (189:5): [True: 567k, False: 36.2M]
  ------------------
  190|   567k|    case 0x42: /* Fallthrough */
  ------------------
  |  Branch (190:5): [True: 490, False: 36.7M]
  ------------------
  191|   568k|    case 0x43: /* Fallthrough */
  ------------------
  |  Branch (191:5): [True: 791, False: 36.7M]
  ------------------
  192|   569k|    case 0x44: /* Fallthrough */
  ------------------
  |  Branch (192:5): [True: 1.07k, False: 36.7M]
  ------------------
  193|   569k|    case 0x45: /* Fallthrough */
  ------------------
  |  Branch (193:5): [True: 581, False: 36.7M]
  ------------------
  194|   575k|    case 0x46: /* Fallthrough */
  ------------------
  |  Branch (194:5): [True: 5.97k, False: 36.7M]
  ------------------
  195|   576k|    case 0x47: /* Fallthrough */
  ------------------
  |  Branch (195:5): [True: 404, False: 36.7M]
  ------------------
  196|   576k|    case 0x48: /* Fallthrough */
  ------------------
  |  Branch (196:5): [True: 298, False: 36.7M]
  ------------------
  197|   576k|    case 0x49: /* Fallthrough */
  ------------------
  |  Branch (197:5): [True: 356, False: 36.7M]
  ------------------
  198|   577k|    case 0x4A: /* Fallthrough */
  ------------------
  |  Branch (198:5): [True: 254, False: 36.7M]
  ------------------
  199|   577k|    case 0x4B: /* Fallthrough */
  ------------------
  |  Branch (199:5): [True: 755, False: 36.7M]
  ------------------
  200|   578k|    case 0x4C: /* Fallthrough */
  ------------------
  |  Branch (200:5): [True: 492, False: 36.7M]
  ------------------
  201|   581k|    case 0x4D: /* Fallthrough */
  ------------------
  |  Branch (201:5): [True: 3.05k, False: 36.7M]
  ------------------
  202|   582k|    case 0x4E: /* Fallthrough */
  ------------------
  |  Branch (202:5): [True: 694, False: 36.7M]
  ------------------
  203|   583k|    case 0x4F: /* Fallthrough */
  ------------------
  |  Branch (203:5): [True: 791, False: 36.7M]
  ------------------
  204|   583k|    case 0x50: /* Fallthrough */
  ------------------
  |  Branch (204:5): [True: 550, False: 36.7M]
  ------------------
  205|   585k|    case 0x51: /* Fallthrough */
  ------------------
  |  Branch (205:5): [True: 1.69k, False: 36.7M]
  ------------------
  206|   585k|    case 0x52: /* Fallthrough */
  ------------------
  |  Branch (206:5): [True: 241, False: 36.7M]
  ------------------
  207|   585k|    case 0x53: /* Fallthrough */
  ------------------
  |  Branch (207:5): [True: 382, False: 36.7M]
  ------------------
  208|   589k|    case 0x54: /* Fallthrough */
  ------------------
  |  Branch (208:5): [True: 3.63k, False: 36.7M]
  ------------------
  209|   589k|    case 0x55: /* Fallthrough */
  ------------------
  |  Branch (209:5): [True: 390, False: 36.7M]
  ------------------
  210|   590k|    case 0x56: /* Fallthrough */
  ------------------
  |  Branch (210:5): [True: 443, False: 36.7M]
  ------------------
  211|   590k|    case 0x57:
  ------------------
  |  Branch (211:5): [True: 284, False: 36.7M]
  ------------------
  212|       |      /* Embedded length byte string */
  213|   590k|      {
  214|   590k|        uint64_t length = _cbor_load_uint8(source) - 0x40; /* 0x40 offset */
  215|   590k|        CLAIM_BYTES_AND_INVOKE(byte_string, length, 0);
  ------------------
  |  |   27|   590k|  do {                                                                     \
  |  |   28|   590k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 590k, False: 194]
  |  |  ------------------
  |  |   29|   590k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   30|   590k|                               length);                                    \
  |  |   31|   590k|    }                                                                      \
  |  |   32|   590k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  216|   590k|        return result;
  217|   590k|      }
  218|  1.28k|    case 0x58:
  ------------------
  |  Branch (218:5): [True: 1.28k, False: 36.7M]
  ------------------
  219|       |      /* One byte length byte string */
  220|  1.28k|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint8, 1);
  ------------------
  |  |   35|  1.28k|  do {                                                                \
  |  |   36|  1.28k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 1.28k, False: 1]
  |  |  ------------------
  |  |   37|  1.28k|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|  1.28k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|  1.28k|  do {                                                                     \
  |  |  |  |   28|  1.28k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 1.27k, False: 5]
  |  |  |  |  ------------------
  |  |  |  |   29|  1.27k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|  1.27k|                               length);                                    \
  |  |  |  |   31|  1.27k|    }                                                                      \
  |  |  |  |   32|  1.28k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|  1.28k|    }                                                                 \
  |  |   40|  1.28k|    return result;                                                    \
  |  |   41|  1.28k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  221|    260|    case 0x59:
  ------------------
  |  Branch (221:5): [True: 260, False: 36.7M]
  ------------------
  222|       |      /* Two bytes length byte string */
  223|    260|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint16, 2);
  ------------------
  |  |   35|    260|  do {                                                                \
  |  |   36|    260|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 258, False: 2]
  |  |  ------------------
  |  |   37|    258|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    258|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    258|  do {                                                                     \
  |  |  |  |   28|    258|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 246, False: 12]
  |  |  |  |  ------------------
  |  |  |  |   29|    246|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    246|                               length);                                    \
  |  |  |  |   31|    246|    }                                                                      \
  |  |  |  |   32|    258|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    258|    }                                                                 \
  |  |   40|    260|    return result;                                                    \
  |  |   41|    260|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  224|    224|    case 0x5A:
  ------------------
  |  Branch (224:5): [True: 224, False: 36.7M]
  ------------------
  225|       |      /* Four bytes length byte string */
  226|    224|      READ_CLAIM_INVOKE(byte_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: 212, False: 11]
  |  |  |  |  ------------------
  |  |  |  |   29|    212|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    212|                               length);                                    \
  |  |  |  |   31|    212|    }                                                                      \
  |  |  |  |   32|    223|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    223|    }                                                                 \
  |  |   40|    224|    return result;                                                    \
  |  |   41|    224|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  227|    253|    case 0x5B:
  ------------------
  |  Branch (227:5): [True: 253, False: 36.7M]
  ------------------
  228|       |      /* Eight bytes length byte string */
  229|    253|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint64, 8);
  ------------------
  |  |   35|    253|  do {                                                                \
  |  |   36|    253|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 251, False: 2]
  |  |  ------------------
  |  |   37|    251|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    251|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    251|  do {                                                                     \
  |  |  |  |   28|    251|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 200, False: 51]
  |  |  |  |  ------------------
  |  |  |  |   29|    200|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    200|                               length);                                    \
  |  |  |  |   31|    200|    }                                                                      \
  |  |  |  |   32|    251|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    251|    }                                                                 \
  |  |   40|    253|    return result;                                                    \
  |  |   41|    253|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  230|      1|    case 0x5C: /* Fallthrough */
  ------------------
  |  Branch (230:5): [True: 1, False: 36.7M]
  ------------------
  231|      5|    case 0x5D: /* Fallthrough */
  ------------------
  |  Branch (231:5): [True: 4, False: 36.7M]
  ------------------
  232|      6|    case 0x5E:
  ------------------
  |  Branch (232:5): [True: 1, False: 36.7M]
  ------------------
  233|       |      /* Reserved */
  234|      6|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  235|  13.7k|    case 0x5F:
  ------------------
  |  Branch (235:5): [True: 13.7k, False: 36.7M]
  ------------------
  236|       |      /* Indefinite byte string */
  237|  13.7k|      {
  238|  13.7k|        callbacks->byte_string_start(context);
  239|  13.7k|        return result;
  240|      5|      }
  241|      9|    case 0x60: /* Fallthrough */
  ------------------
  |  Branch (241:5): [True: 9, False: 36.7M]
  ------------------
  242|  1.04M|    case 0x61: /* Fallthrough */
  ------------------
  |  Branch (242:5): [True: 1.04M, False: 35.7M]
  ------------------
  243|  1.04M|    case 0x62: /* Fallthrough */
  ------------------
  |  Branch (243:5): [True: 745, False: 36.7M]
  ------------------
  244|  1.04M|    case 0x63: /* Fallthrough */
  ------------------
  |  Branch (244:5): [True: 3.41k, False: 36.7M]
  ------------------
  245|  1.04M|    case 0x64: /* Fallthrough */
  ------------------
  |  Branch (245:5): [True: 644, False: 36.7M]
  ------------------
  246|  1.04M|    case 0x65: /* Fallthrough */
  ------------------
  |  Branch (246:5): [True: 268, False: 36.7M]
  ------------------
  247|  1.04M|    case 0x66: /* Fallthrough */
  ------------------
  |  Branch (247:5): [True: 242, False: 36.7M]
  ------------------
  248|  1.04M|    case 0x67: /* Fallthrough */
  ------------------
  |  Branch (248:5): [True: 540, False: 36.7M]
  ------------------
  249|  1.04M|    case 0x68: /* Fallthrough */
  ------------------
  |  Branch (249:5): [True: 344, False: 36.7M]
  ------------------
  250|  1.05M|    case 0x69: /* Fallthrough */
  ------------------
  |  Branch (250:5): [True: 342, False: 36.7M]
  ------------------
  251|  1.05M|    case 0x6A: /* Fallthrough */
  ------------------
  |  Branch (251:5): [True: 213, False: 36.7M]
  ------------------
  252|  1.05M|    case 0x6B: /* Fallthrough */
  ------------------
  |  Branch (252:5): [True: 231, False: 36.7M]
  ------------------
  253|  1.05M|    case 0x6C: /* Fallthrough */
  ------------------
  |  Branch (253:5): [True: 382, False: 36.7M]
  ------------------
  254|  1.05M|    case 0x6D: /* Fallthrough */
  ------------------
  |  Branch (254:5): [True: 204, False: 36.7M]
  ------------------
  255|  1.05M|    case 0x6E: /* Fallthrough */
  ------------------
  |  Branch (255:5): [True: 335, False: 36.7M]
  ------------------
  256|  1.05M|    case 0x6F: /* Fallthrough */
  ------------------
  |  Branch (256:5): [True: 200, False: 36.7M]
  ------------------
  257|  1.05M|    case 0x70: /* Fallthrough */
  ------------------
  |  Branch (257:5): [True: 345, False: 36.7M]
  ------------------
  258|  1.05M|    case 0x71: /* Fallthrough */
  ------------------
  |  Branch (258:5): [True: 678, False: 36.7M]
  ------------------
  259|  1.05M|    case 0x72: /* Fallthrough */
  ------------------
  |  Branch (259:5): [True: 485, False: 36.7M]
  ------------------
  260|  1.05M|    case 0x73: /* Fallthrough */
  ------------------
  |  Branch (260:5): [True: 195, False: 36.7M]
  ------------------
  261|  1.05M|    case 0x74: /* Fallthrough */
  ------------------
  |  Branch (261:5): [True: 208, False: 36.7M]
  ------------------
  262|  1.05M|    case 0x75: /* Fallthrough */
  ------------------
  |  Branch (262:5): [True: 1.68k, False: 36.7M]
  ------------------
  263|  1.05M|    case 0x76: /* Fallthrough */
  ------------------
  |  Branch (263:5): [True: 241, False: 36.7M]
  ------------------
  264|  1.05M|    case 0x77:
  ------------------
  |  Branch (264:5): [True: 210, False: 36.7M]
  ------------------
  265|       |      /* Embedded one byte length string */
  266|  1.05M|      {
  267|  1.05M|        uint64_t length = _cbor_load_uint8(source) - 0x60; /* 0x60 offset */
  268|  1.05M|        CLAIM_BYTES_AND_INVOKE(string, length, 0);
  ------------------
  |  |   27|  1.05M|  do {                                                                     \
  |  |   28|  1.05M|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (28:9): [True: 1.05M, False: 193]
  |  |  ------------------
  |  |   29|  1.05M|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   30|  1.05M|                               length);                                    \
  |  |   31|  1.05M|    }                                                                      \
  |  |   32|  1.05M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  269|  1.05M|        return result;
  270|  1.05M|      }
  271|  7.26k|    case 0x78:
  ------------------
  |  Branch (271:5): [True: 7.26k, False: 36.7M]
  ------------------
  272|       |      /* One byte length string */
  273|  7.26k|      READ_CLAIM_INVOKE(string, _cbor_load_uint8, 1);
  ------------------
  |  |   35|  7.26k|  do {                                                                \
  |  |   36|  7.26k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 7.26k, False: 1]
  |  |  ------------------
  |  |   37|  7.26k|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|  7.26k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|  7.26k|  do {                                                                     \
  |  |  |  |   28|  7.26k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 7.25k, False: 5]
  |  |  |  |  ------------------
  |  |  |  |   29|  7.25k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|  7.25k|                               length);                                    \
  |  |  |  |   31|  7.25k|    }                                                                      \
  |  |  |  |   32|  7.26k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|  7.26k|    }                                                                 \
  |  |   40|  7.26k|    return result;                                                    \
  |  |   41|  7.26k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  274|    286|    case 0x79:
  ------------------
  |  Branch (274:5): [True: 286, False: 36.7M]
  ------------------
  275|       |      /* Two bytes length string */
  276|    286|      READ_CLAIM_INVOKE(string, _cbor_load_uint16, 2);
  ------------------
  |  |   35|    286|  do {                                                                \
  |  |   36|    286|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 283, False: 3]
  |  |  ------------------
  |  |   37|    283|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    283|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    283|  do {                                                                     \
  |  |  |  |   28|    283|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 275, False: 8]
  |  |  |  |  ------------------
  |  |  |  |   29|    275|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    275|                               length);                                    \
  |  |  |  |   31|    275|    }                                                                      \
  |  |  |  |   32|    283|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    283|    }                                                                 \
  |  |   40|    286|    return result;                                                    \
  |  |   41|    286|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  277|    219|    case 0x7A:
  ------------------
  |  Branch (277:5): [True: 219, False: 36.7M]
  ------------------
  278|       |      /* Four bytes length string */
  279|    219|      READ_CLAIM_INVOKE(string, _cbor_load_uint32, 4);
  ------------------
  |  |   35|    219|  do {                                                                \
  |  |   36|    219|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 217, False: 2]
  |  |  ------------------
  |  |   37|    217|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    217|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    217|  do {                                                                     \
  |  |  |  |   28|    217|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 205, False: 12]
  |  |  |  |  ------------------
  |  |  |  |   29|    205|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    205|                               length);                                    \
  |  |  |  |   31|    205|    }                                                                      \
  |  |  |  |   32|    217|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    217|    }                                                                 \
  |  |   40|    219|    return result;                                                    \
  |  |   41|    219|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  280|    238|    case 0x7B:
  ------------------
  |  Branch (280:5): [True: 238, False: 36.7M]
  ------------------
  281|       |      /* Eight bytes length string */
  282|    238|      READ_CLAIM_INVOKE(string, _cbor_load_uint64, 8);
  ------------------
  |  |   35|    238|  do {                                                                \
  |  |   36|    238|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (36:9): [True: 237, False: 1]
  |  |  ------------------
  |  |   37|    237|      uint64_t length = length_reader(source + 1);                    \
  |  |   38|    237|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   27|    237|  do {                                                                     \
  |  |  |  |   28|    237|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (28:9): [True: 219, False: 18]
  |  |  |  |  ------------------
  |  |  |  |   29|    219|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   30|    219|                               length);                                    \
  |  |  |  |   31|    219|    }                                                                      \
  |  |  |  |   32|    237|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (32:12): [Folded - Ignored]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   39|    237|    }                                                                 \
  |  |   40|    238|    return result;                                                    \
  |  |   41|    238|  } while (0)
  |  |  ------------------
  |  |  |  Branch (41:12): [Folded - Ignored]
  |  |  ------------------
  ------------------
  283|      1|    case 0x7C: /* Fallthrough */
  ------------------
  |  Branch (283:5): [True: 1, False: 36.7M]
  ------------------
  284|      2|    case 0x7D: /* Fallthrough */
  ------------------
  |  Branch (284:5): [True: 1, False: 36.7M]
  ------------------
  285|      5|    case 0x7E:
  ------------------
  |  Branch (285:5): [True: 3, False: 36.7M]
  ------------------
  286|       |      /* Reserved */
  287|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  288|  17.5k|    case 0x7F:
  ------------------
  |  Branch (288:5): [True: 17.5k, False: 36.7M]
  ------------------
  289|       |      /* Indefinite length string */
  290|  17.5k|      {
  291|  17.5k|        callbacks->string_start(context);
  292|  17.5k|        return result;
  293|      2|      }
  294|      4|    case 0x80: /* Fallthrough */
  ------------------
  |  Branch (294:5): [True: 4, False: 36.7M]
  ------------------
  295|  8.76M|    case 0x81: /* Fallthrough */
  ------------------
  |  Branch (295:5): [True: 8.76M, False: 28.0M]
  ------------------
  296|  8.78M|    case 0x82: /* Fallthrough */
  ------------------
  |  Branch (296:5): [True: 14.9k, False: 36.7M]
  ------------------
  297|  8.79M|    case 0x83: /* Fallthrough */
  ------------------
  |  Branch (297:5): [True: 8.82k, False: 36.7M]
  ------------------
  298|  8.79M|    case 0x84: /* Fallthrough */
  ------------------
  |  Branch (298:5): [True: 3.62k, False: 36.7M]
  ------------------
  299|  8.79M|    case 0x85: /* Fallthrough */
  ------------------
  |  Branch (299:5): [True: 2.36k, False: 36.7M]
  ------------------
  300|  8.79M|    case 0x86: /* Fallthrough */
  ------------------
  |  Branch (300:5): [True: 442, False: 36.7M]
  ------------------
  301|  8.80M|    case 0x87: /* Fallthrough */
  ------------------
  |  Branch (301:5): [True: 2.59k, False: 36.7M]
  ------------------
  302|  8.80M|    case 0x88: /* Fallthrough */
  ------------------
  |  Branch (302:5): [True: 399, False: 36.7M]
  ------------------
  303|  8.80M|    case 0x89: /* Fallthrough */
  ------------------
  |  Branch (303:5): [True: 916, False: 36.7M]
  ------------------
  304|  8.80M|    case 0x8A: /* Fallthrough */
  ------------------
  |  Branch (304:5): [True: 381, False: 36.7M]
  ------------------
  305|  8.80M|    case 0x8B: /* Fallthrough */
  ------------------
  |  Branch (305:5): [True: 1.11k, False: 36.7M]
  ------------------
  306|  8.80M|    case 0x8C: /* Fallthrough */
  ------------------
  |  Branch (306:5): [True: 2.17k, False: 36.7M]
  ------------------
  307|  8.80M|    case 0x8D: /* Fallthrough */
  ------------------
  |  Branch (307:5): [True: 1.35k, False: 36.7M]
  ------------------
  308|  8.80M|    case 0x8E: /* Fallthrough */
  ------------------
  |  Branch (308:5): [True: 506, False: 36.7M]
  ------------------
  309|  8.80M|    case 0x8F: /* Fallthrough */
  ------------------
  |  Branch (309:5): [True: 444, False: 36.7M]
  ------------------
  310|  8.80M|    case 0x90: /* Fallthrough */
  ------------------
  |  Branch (310:5): [True: 247, False: 36.7M]
  ------------------
  311|  8.80M|    case 0x91: /* Fallthrough */
  ------------------
  |  Branch (311:5): [True: 1.44k, False: 36.7M]
  ------------------
  312|  8.81M|    case 0x92: /* Fallthrough */
  ------------------
  |  Branch (312:5): [True: 312, False: 36.7M]
  ------------------
  313|  8.81M|    case 0x93: /* Fallthrough */
  ------------------
  |  Branch (313:5): [True: 240, False: 36.7M]
  ------------------
  314|  8.81M|    case 0x94: /* Fallthrough */
  ------------------
  |  Branch (314:5): [True: 909, False: 36.7M]
  ------------------
  315|  8.83M|    case 0x95: /* Fallthrough */
  ------------------
  |  Branch (315:5): [True: 20.6k, False: 36.7M]
  ------------------
  316|  8.83M|    case 0x96: /* Fallthrough */
  ------------------
  |  Branch (316:5): [True: 4.16k, False: 36.7M]
  ------------------
  317|  8.83M|    case 0x97:
  ------------------
  |  Branch (317:5): [True: 748, False: 36.7M]
  ------------------
  318|       |      /* Embedded one byte length array */
  319|  8.83M|      {
  320|  8.83M|        callbacks->array_start(
  321|  8.83M|            context, _cbor_load_uint8(source) - 0x80); /* 0x40 offset */
  322|  8.83M|        return result;
  323|  8.83M|      }
  324|    375|    case 0x98:
  ------------------
  |  Branch (324:5): [True: 375, False: 36.7M]
  ------------------
  325|       |      /* One byte length array */
  326|    375|      {
  327|    375|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (327:13): [True: 373, False: 2]
  ------------------
  328|    373|          callbacks->array_start(context, _cbor_load_uint8(source + 1));
  329|    373|        }
  330|    375|        return result;
  331|  8.83M|      }
  332|    222|    case 0x99:
  ------------------
  |  Branch (332:5): [True: 222, False: 36.7M]
  ------------------
  333|       |      /* Two bytes length array */
  334|    222|      {
  335|    222|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (335:13): [True: 221, False: 1]
  ------------------
  336|    221|          callbacks->array_start(context, _cbor_load_uint16(source + 1));
  337|    221|        }
  338|    222|        return result;
  339|  8.83M|      }
  340|    252|    case 0x9A:
  ------------------
  |  Branch (340:5): [True: 252, False: 36.7M]
  ------------------
  341|       |      /* Four bytes length array */
  342|    252|      {
  343|    252|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (343:13): [True: 251, False: 1]
  ------------------
  344|    251|          callbacks->array_start(context, _cbor_load_uint32(source + 1));
  345|    251|        }
  346|    252|        return result;
  347|  8.83M|      }
  348|    239|    case 0x9B:
  ------------------
  |  Branch (348:5): [True: 239, False: 36.7M]
  ------------------
  349|       |      /* Eight bytes length array */
  350|    239|      {
  351|    239|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (351:13): [True: 238, False: 1]
  ------------------
  352|    238|          callbacks->array_start(context, _cbor_load_uint64(source + 1));
  353|    238|        }
  354|    239|        return result;
  355|  8.83M|      }
  356|      1|    case 0x9C: /* Fallthrough */
  ------------------
  |  Branch (356:5): [True: 1, False: 36.7M]
  ------------------
  357|      2|    case 0x9D: /* Fallthrough */
  ------------------
  |  Branch (357:5): [True: 1, False: 36.7M]
  ------------------
  358|      3|    case 0x9E:
  ------------------
  |  Branch (358:5): [True: 1, False: 36.7M]
  ------------------
  359|       |      /* Reserved */
  360|      3|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  361|   302k|    case 0x9F:
  ------------------
  |  Branch (361:5): [True: 302k, False: 36.4M]
  ------------------
  362|       |      /* Indefinite length array */
  363|   302k|      {
  364|   302k|        callbacks->indef_array_start(context);
  365|   302k|        return result;
  366|      2|      }
  367|      2|    case 0xA0: /* Fallthrough */
  ------------------
  |  Branch (367:5): [True: 2, False: 36.7M]
  ------------------
  368|  12.3k|    case 0xA1: /* Fallthrough */
  ------------------
  |  Branch (368:5): [True: 12.3k, False: 36.7M]
  ------------------
  369|  12.9k|    case 0xA2: /* Fallthrough */
  ------------------
  |  Branch (369:5): [True: 603, False: 36.7M]
  ------------------
  370|  13.4k|    case 0xA3: /* Fallthrough */
  ------------------
  |  Branch (370:5): [True: 439, False: 36.7M]
  ------------------
  371|  14.0k|    case 0xA4: /* Fallthrough */
  ------------------
  |  Branch (371:5): [True: 651, False: 36.7M]
  ------------------
  372|  16.9k|    case 0xA5: /* Fallthrough */
  ------------------
  |  Branch (372:5): [True: 2.94k, False: 36.7M]
  ------------------
  373|  17.5k|    case 0xA6: /* Fallthrough */
  ------------------
  |  Branch (373:5): [True: 534, False: 36.7M]
  ------------------
  374|  18.3k|    case 0xA7: /* Fallthrough */
  ------------------
  |  Branch (374:5): [True: 776, False: 36.7M]
  ------------------
  375|  18.8k|    case 0xA8: /* Fallthrough */
  ------------------
  |  Branch (375:5): [True: 521, False: 36.7M]
  ------------------
  376|  19.0k|    case 0xA9: /* Fallthrough */
  ------------------
  |  Branch (376:5): [True: 208, False: 36.7M]
  ------------------
  377|  19.4k|    case 0xAA: /* Fallthrough */
  ------------------
  |  Branch (377:5): [True: 432, False: 36.7M]
  ------------------
  378|  19.6k|    case 0xAB: /* Fallthrough */
  ------------------
  |  Branch (378:5): [True: 229, False: 36.7M]
  ------------------
  379|  20.0k|    case 0xAC: /* Fallthrough */
  ------------------
  |  Branch (379:5): [True: 332, False: 36.7M]
  ------------------
  380|  20.2k|    case 0xAD: /* Fallthrough */
  ------------------
  |  Branch (380:5): [True: 218, False: 36.7M]
  ------------------
  381|  20.9k|    case 0xAE: /* Fallthrough */
  ------------------
  |  Branch (381:5): [True: 718, False: 36.7M]
  ------------------
  382|  22.3k|    case 0xAF: /* Fallthrough */
  ------------------
  |  Branch (382:5): [True: 1.35k, False: 36.7M]
  ------------------
  383|  24.2k|    case 0xB0: /* Fallthrough */
  ------------------
  |  Branch (383:5): [True: 1.98k, False: 36.7M]
  ------------------
  384|  25.0k|    case 0xB1: /* Fallthrough */
  ------------------
  |  Branch (384:5): [True: 791, False: 36.7M]
  ------------------
  385|  27.4k|    case 0xB2: /* Fallthrough */
  ------------------
  |  Branch (385:5): [True: 2.32k, False: 36.7M]
  ------------------
  386|  28.0k|    case 0xB3: /* Fallthrough */
  ------------------
  |  Branch (386:5): [True: 618, False: 36.7M]
  ------------------
  387|  28.5k|    case 0xB4: /* Fallthrough */
  ------------------
  |  Branch (387:5): [True: 502, False: 36.7M]
  ------------------
  388|  29.1k|    case 0xB5: /* Fallthrough */
  ------------------
  |  Branch (388:5): [True: 571, False: 36.7M]
  ------------------
  389|  29.3k|    case 0xB6: /* Fallthrough */
  ------------------
  |  Branch (389:5): [True: 280, False: 36.7M]
  ------------------
  390|  30.1k|    case 0xB7:
  ------------------
  |  Branch (390:5): [True: 793, False: 36.7M]
  ------------------
  391|       |      /* Embedded one byte length map */
  392|  30.1k|      {
  393|  30.1k|        callbacks->map_start(context,
  394|  30.1k|                             _cbor_load_uint8(source) - 0xA0); /* 0xA0 offset */
  395|  30.1k|        return result;
  396|  29.3k|      }
  397|    470|    case 0xB8:
  ------------------
  |  Branch (397:5): [True: 470, False: 36.7M]
  ------------------
  398|       |      /* One byte length map */
  399|    470|      {
  400|    470|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (400:13): [True: 468, False: 2]
  ------------------
  401|    468|          callbacks->map_start(context, _cbor_load_uint8(source + 1));
  402|    468|        }
  403|    470|        return result;
  404|  29.3k|      }
  405|    361|    case 0xB9:
  ------------------
  |  Branch (405:5): [True: 361, False: 36.7M]
  ------------------
  406|       |      /* Two bytes length map */
  407|    361|      {
  408|    361|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (408:13): [True: 360, False: 1]
  ------------------
  409|    360|          callbacks->map_start(context, _cbor_load_uint16(source + 1));
  410|    360|        }
  411|    361|        return result;
  412|  29.3k|      }
  413|    379|    case 0xBA:
  ------------------
  |  Branch (413:5): [True: 379, False: 36.7M]
  ------------------
  414|       |      /* Four bytes length map */
  415|    379|      {
  416|    379|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (416:13): [True: 378, False: 1]
  ------------------
  417|    378|          callbacks->map_start(context, _cbor_load_uint32(source + 1));
  418|    378|        }
  419|    379|        return result;
  420|  29.3k|      }
  421|    315|    case 0xBB:
  ------------------
  |  Branch (421:5): [True: 315, False: 36.7M]
  ------------------
  422|       |      /* Eight bytes length map */
  423|    315|      {
  424|    315|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (424:13): [True: 314, False: 1]
  ------------------
  425|    314|          callbacks->map_start(context, _cbor_load_uint64(source + 1));
  426|    314|        }
  427|    315|        return result;
  428|  29.3k|      }
  429|      1|    case 0xBC: /* Fallthrough */
  ------------------
  |  Branch (429:5): [True: 1, False: 36.7M]
  ------------------
  430|      2|    case 0xBD: /* Fallthrough */
  ------------------
  |  Branch (430:5): [True: 1, False: 36.7M]
  ------------------
  431|      4|    case 0xBE:
  ------------------
  |  Branch (431:5): [True: 2, False: 36.7M]
  ------------------
  432|       |      /* Reserved */
  433|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  434|  2.51k|    case 0xBF:
  ------------------
  |  Branch (434:5): [True: 2.51k, False: 36.7M]
  ------------------
  435|       |      /* Indefinite length map */
  436|  2.51k|      {
  437|  2.51k|        callbacks->indef_map_start(context);
  438|  2.51k|        return result;
  439|      2|      }
  440|   143k|    case 0xC0:
  ------------------
  |  Branch (440:5): [True: 143k, False: 36.6M]
  ------------------
  441|       |      /* Text date/time - RFC 3339 tag, fallthrough */
  442|   158k|    case 0xC1:
  ------------------
  |  Branch (442:5): [True: 15.1k, False: 36.7M]
  ------------------
  443|       |      /* Epoch date tag, fallthrough */
  444|   165k|    case 0xC2:
  ------------------
  |  Branch (444:5): [True: 7.57k, False: 36.7M]
  ------------------
  445|       |      /* Positive bignum tag, fallthrough */
  446|   168k|    case 0xC3:
  ------------------
  |  Branch (446:5): [True: 2.65k, False: 36.7M]
  ------------------
  447|       |      /* Negative bignum tag, fallthrough */
  448|   171k|    case 0xC4:
  ------------------
  |  Branch (448:5): [True: 2.97k, False: 36.7M]
  ------------------
  449|       |      /* Fraction, fallthrough */
  450|   241k|    case 0xC5:
  ------------------
  |  Branch (450:5): [True: 70.0k, False: 36.7M]
  ------------------
  451|       |      /* Big float */
  452|   241k|      {
  453|   241k|        callbacks->tag(context, (uint64_t)(_cbor_load_uint8(source) -
  454|   241k|                                           0xC0)); /* 0xC0 offset */
  455|   241k|        return result;
  456|   171k|      }
  457|      1|    case 0xC6: /* Fallthrough */
  ------------------
  |  Branch (457:5): [True: 1, False: 36.7M]
  ------------------
  458|      2|    case 0xC7: /* Fallthrough */
  ------------------
  |  Branch (458:5): [True: 1, False: 36.7M]
  ------------------
  459|      3|    case 0xC8: /* Fallthrough */
  ------------------
  |  Branch (459:5): [True: 1, False: 36.7M]
  ------------------
  460|      4|    case 0xC9: /* Fallthrough */
  ------------------
  |  Branch (460:5): [True: 1, False: 36.7M]
  ------------------
  461|      6|    case 0xCA: /* Fallthrough */
  ------------------
  |  Branch (461:5): [True: 2, False: 36.7M]
  ------------------
  462|      7|    case 0xCB: /* Fallthrough */
  ------------------
  |  Branch (462:5): [True: 1, False: 36.7M]
  ------------------
  463|      8|    case 0xCC: /* Fallthrough */
  ------------------
  |  Branch (463:5): [True: 1, False: 36.7M]
  ------------------
  464|      9|    case 0xCD: /* Fallthrough */
  ------------------
  |  Branch (464:5): [True: 1, False: 36.7M]
  ------------------
  465|     11|    case 0xCE: /* Fallthrough */
  ------------------
  |  Branch (465:5): [True: 2, False: 36.7M]
  ------------------
  466|     12|    case 0xCF: /* Fallthrough */
  ------------------
  |  Branch (466:5): [True: 1, False: 36.7M]
  ------------------
  467|     13|    case 0xD0: /* Fallthrough */
  ------------------
  |  Branch (467:5): [True: 1, False: 36.7M]
  ------------------
  468|     14|    case 0xD1: /* Fallthrough */
  ------------------
  |  Branch (468:5): [True: 1, False: 36.7M]
  ------------------
  469|     15|    case 0xD2: /* Fallthrough */
  ------------------
  |  Branch (469:5): [True: 1, False: 36.7M]
  ------------------
  470|     16|    case 0xD3: /* Fallthrough */
  ------------------
  |  Branch (470:5): [True: 1, False: 36.7M]
  ------------------
  471|     17|    case 0xD4: /* Unassigned tag value */
  ------------------
  |  Branch (471:5): [True: 1, False: 36.7M]
  ------------------
  472|     17|    {
  473|     17|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  474|     16|    }
  475|  4.22k|    case 0xD5: /* Expected b64url conversion tag - fallthrough */
  ------------------
  |  Branch (475:5): [True: 4.22k, False: 36.7M]
  ------------------
  476|  7.50k|    case 0xD6: /* Expected b64 conversion tag - fallthrough */
  ------------------
  |  Branch (476:5): [True: 3.28k, False: 36.7M]
  ------------------
  477|   117k|    case 0xD7: /* Expected b16 conversion tag */
  ------------------
  |  Branch (477:5): [True: 110k, False: 36.6M]
  ------------------
  478|   117k|    {
  479|   117k|      callbacks->tag(context, (uint64_t)(_cbor_load_uint8(source) -
  480|   117k|                                         0xC0)); /* 0xC0 offset */
  481|   117k|      return result;
  482|  7.50k|    }
  483|  4.50k|    case 0xD8: /* 1B tag */
  ------------------
  |  Branch (483:5): [True: 4.50k, False: 36.7M]
  ------------------
  484|  4.50k|    {
  485|  4.50k|      if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (485:11): [True: 4.50k, False: 1]
  ------------------
  486|  4.50k|        callbacks->tag(context, _cbor_load_uint8(source + 1));
  487|  4.50k|      }
  488|  4.50k|      return result;
  489|  7.50k|    }
  490|  4.20k|    case 0xD9: /* 2B tag */
  ------------------
  |  Branch (490:5): [True: 4.20k, False: 36.7M]
  ------------------
  491|  4.20k|    {
  492|  4.20k|      if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (492:11): [True: 4.19k, False: 1]
  ------------------
  493|  4.19k|        callbacks->tag(context, _cbor_load_uint16(source + 1));
  494|  4.19k|      }
  495|  4.20k|      return result;
  496|  7.50k|    }
  497|  4.63k|    case 0xDA: /* 4B tag */
  ------------------
  |  Branch (497:5): [True: 4.63k, False: 36.7M]
  ------------------
  498|  4.63k|    {
  499|  4.63k|      if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (499:11): [True: 4.63k, False: 1]
  ------------------
  500|  4.63k|        callbacks->tag(context, _cbor_load_uint32(source + 1));
  501|  4.63k|      }
  502|  4.63k|      return result;
  503|  7.50k|    }
  504|  1.87k|    case 0xDB: /* 8B tag */
  ------------------
  |  Branch (504:5): [True: 1.87k, False: 36.7M]
  ------------------
  505|  1.87k|    {
  506|  1.87k|      if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (506:11): [True: 1.87k, False: 3]
  ------------------
  507|  1.87k|        callbacks->tag(context, _cbor_load_uint64(source + 1));
  508|  1.87k|      }
  509|  1.87k|      return result;
  510|  7.50k|    }
  511|      1|    case 0xDC: /* Fallthrough */
  ------------------
  |  Branch (511:5): [True: 1, False: 36.7M]
  ------------------
  512|      2|    case 0xDD: /* Fallthrough */
  ------------------
  |  Branch (512:5): [True: 1, False: 36.7M]
  ------------------
  513|      3|    case 0xDE: /* Fallthrough */
  ------------------
  |  Branch (513:5): [True: 1, False: 36.7M]
  ------------------
  514|      4|    case 0xDF: /* Reserved */
  ------------------
  |  Branch (514:5): [True: 1, False: 36.7M]
  ------------------
  515|      4|    {
  516|      4|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  517|      3|    }
  518|      2|    case 0xE0: /* Fallthrough */
  ------------------
  |  Branch (518:5): [True: 2, False: 36.7M]
  ------------------
  519|      4|    case 0xE1: /* Fallthrough */
  ------------------
  |  Branch (519:5): [True: 2, False: 36.7M]
  ------------------
  520|      5|    case 0xE2: /* Fallthrough */
  ------------------
  |  Branch (520:5): [True: 1, False: 36.7M]
  ------------------
  521|      6|    case 0xE3: /* Fallthrough */
  ------------------
  |  Branch (521:5): [True: 1, False: 36.7M]
  ------------------
  522|      7|    case 0xE4: /* Fallthrough */
  ------------------
  |  Branch (522:5): [True: 1, False: 36.7M]
  ------------------
  523|      8|    case 0xE5: /* Fallthrough */
  ------------------
  |  Branch (523:5): [True: 1, False: 36.7M]
  ------------------
  524|      9|    case 0xE6: /* Fallthrough */
  ------------------
  |  Branch (524:5): [True: 1, False: 36.7M]
  ------------------
  525|     10|    case 0xE7: /* Fallthrough */
  ------------------
  |  Branch (525:5): [True: 1, False: 36.7M]
  ------------------
  526|     11|    case 0xE8: /* Fallthrough */
  ------------------
  |  Branch (526:5): [True: 1, False: 36.7M]
  ------------------
  527|     12|    case 0xE9: /* Fallthrough */
  ------------------
  |  Branch (527:5): [True: 1, False: 36.7M]
  ------------------
  528|     13|    case 0xEA: /* Fallthrough */
  ------------------
  |  Branch (528:5): [True: 1, False: 36.7M]
  ------------------
  529|     15|    case 0xEB: /* Fallthrough */
  ------------------
  |  Branch (529:5): [True: 2, False: 36.7M]
  ------------------
  530|     16|    case 0xEC: /* Fallthrough */
  ------------------
  |  Branch (530:5): [True: 1, False: 36.7M]
  ------------------
  531|     17|    case 0xED: /* Fallthrough */
  ------------------
  |  Branch (531:5): [True: 1, False: 36.7M]
  ------------------
  532|     18|    case 0xEE: /* Fallthrough */
  ------------------
  |  Branch (532:5): [True: 1, False: 36.7M]
  ------------------
  533|     19|    case 0xEF: /* Fallthrough */
  ------------------
  |  Branch (533:5): [True: 1, False: 36.7M]
  ------------------
  534|     20|    case 0xF0: /* Fallthrough */
  ------------------
  |  Branch (534:5): [True: 1, False: 36.7M]
  ------------------
  535|     21|    case 0xF1: /* Fallthrough */
  ------------------
  |  Branch (535:5): [True: 1, False: 36.7M]
  ------------------
  536|     22|    case 0xF2: /* Fallthrough */
  ------------------
  |  Branch (536:5): [True: 1, False: 36.7M]
  ------------------
  537|     27|    case 0xF3: /* Simple value - unassigned */
  ------------------
  |  Branch (537:5): [True: 5, False: 36.7M]
  ------------------
  538|     27|    {
  539|     27|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  540|     22|    }
  541|  42.8k|    case 0xF4:
  ------------------
  |  Branch (541:5): [True: 42.8k, False: 36.7M]
  ------------------
  542|       |      /* False */
  543|  42.8k|      {
  544|  42.8k|        callbacks->boolean(context, false);
  545|  42.8k|        return result;
  546|     22|      }
  547|  1.67M|    case 0xF5:
  ------------------
  |  Branch (547:5): [True: 1.67M, False: 35.1M]
  ------------------
  548|       |      /* True */
  549|  1.67M|      {
  550|  1.67M|        callbacks->boolean(context, true);
  551|  1.67M|        return result;
  552|     22|      }
  553|  2.86M|    case 0xF6:
  ------------------
  |  Branch (553:5): [True: 2.86M, False: 33.9M]
  ------------------
  554|       |      /* Null */
  555|  2.86M|      {
  556|  2.86M|        callbacks->null(context);
  557|  2.86M|        return result;
  558|     22|      }
  559|  62.8k|    case 0xF7:
  ------------------
  |  Branch (559:5): [True: 62.8k, False: 36.7M]
  ------------------
  560|       |      /* Undefined */
  561|  62.8k|      {
  562|  62.8k|        callbacks->undefined(context);
  563|  62.8k|        return result;
  564|     22|      }
  565|      2|    case 0xF8:
  ------------------
  |  Branch (565:5): [True: 2, False: 36.7M]
  ------------------
  566|       |      /* 1B simple value, unassigned */
  567|      2|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  568|  93.4k|    case 0xF9:
  ------------------
  |  Branch (568:5): [True: 93.4k, False: 36.7M]
  ------------------
  569|       |      /* 2B float */
  570|  93.4k|      {
  571|  93.4k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (571:13): [True: 93.4k, False: 2]
  ------------------
  572|  93.4k|          callbacks->float2(context, _cbor_load_half(source + 1));
  573|  93.4k|        }
  574|  93.4k|        return result;
  575|     22|      }
  576|  6.41k|    case 0xFA:
  ------------------
  |  Branch (576:5): [True: 6.41k, False: 36.7M]
  ------------------
  577|       |      /* 4B float */
  578|  6.41k|      {
  579|  6.41k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (579:13): [True: 6.41k, False: 1]
  ------------------
  580|  6.41k|          callbacks->float4(context, _cbor_load_float(source + 1));
  581|  6.41k|        }
  582|  6.41k|        return result;
  583|     22|      }
  584|  60.4k|    case 0xFB:
  ------------------
  |  Branch (584:5): [True: 60.4k, False: 36.7M]
  ------------------
  585|       |      /* 8B float */
  586|  60.4k|      {
  587|  60.4k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (587:13): [True: 60.4k, False: 2]
  ------------------
  588|  60.4k|          callbacks->float8(context, _cbor_load_double(source + 1));
  589|  60.4k|        }
  590|  60.4k|        return result;
  591|     22|      }
  592|      1|    case 0xFC: /* Fallthrough */
  ------------------
  |  Branch (592:5): [True: 1, False: 36.7M]
  ------------------
  593|      2|    case 0xFD: /* Fallthrough */
  ------------------
  |  Branch (593:5): [True: 1, False: 36.7M]
  ------------------
  594|      3|    case 0xFE:
  ------------------
  |  Branch (594:5): [True: 1, False: 36.7M]
  ------------------
  595|       |      /* Reserved */
  596|      3|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  597|   300k|    case 0xFF:
  ------------------
  |  Branch (597:5): [True: 300k, False: 36.4M]
  ------------------
  598|       |      /* Break */
  599|   300k|      callbacks->indef_break(context);
  600|       |      // Never happens, the switch statement is exhaustive on the 1B range; make
  601|       |      // compiler happy
  602|   300k|    default:
  ------------------
  |  Branch (602:5): [True: 0, False: 36.7M]
  ------------------
  603|   300k|      return result;
  604|  36.7M|  }
  605|  36.7M|}
streaming.c:claim_bytes:
   12|  39.1M|                        struct cbor_decoder_result *result) {
   13|  39.1M|  if (required > (provided - result->read)) {
  ------------------
  |  Branch (13:7): [True: 554, False: 39.1M]
  ------------------
   14|    554|    result->required = required + result->read;
   15|    554|    result->read = 0;
   16|    554|    result->status = CBOR_DECODER_NEDATA;
   17|    554|    return false;
   18|  39.1M|  } else {
   19|  39.1M|    result->read += required;
   20|  39.1M|    result->required = 0;
   21|  39.1M|    return true;
   22|  39.1M|  }
   23|  39.1M|}

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

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

