_Z14limited_mallocm:
   12|   101M|void *limited_malloc(size_t size) {
   13|   101M|    if (size + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (13:9): [True: 86, False: 101M]
  ------------------
   14|     86|        return nullptr;
   15|     86|    }
   16|   101M|    if (size == 0) {
  ------------------
  |  Branch (16:9): [True: 0, False: 101M]
  ------------------
   17|      0|        return nullptr;
   18|      0|    }
   19|   101M|    void* m = malloc(size);
   20|   101M|    if (m != nullptr) {
  ------------------
  |  Branch (20:9): [True: 101M, False: 0]
  ------------------
   21|   101M|        allocated_mem += size;
   22|   101M|        allocated_len_map[m] = size;
   23|   101M|    }
   24|   101M|    return m;
   25|   101M|}
_Z12limited_freePv:
   27|   102M|void limited_free(void *ptr) {
   28|   102M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (28:9): [True: 101M, False: 627k]
  |  Branch (28:9): [True: 0, False: 102M]
  |  Branch (28:24): [True: 0, False: 101M]
  ------------------
   29|      0|        abort();
   30|      0|    }
   31|   102M|    free(ptr);
   32|   102M|    if (ptr != NULL) {
  ------------------
  |  Branch (32:9): [True: 101M, False: 627k]
  ------------------
   33|   101M|        allocated_mem -= allocated_len_map[ptr];
   34|   101M|        allocated_len_map.erase(ptr);
   35|   101M|    }
   36|   102M|}
_Z15limited_reallocPvm:
   38|  3.41M|void *limited_realloc(void *ptr, size_t size) {
   39|  3.41M|    if (ptr != NULL && allocated_len_map.find(ptr) == allocated_len_map.end()) {
  ------------------
  |  Branch (39:9): [True: 2.21M, False: 1.20M]
  |  Branch (39:9): [True: 0, False: 3.41M]
  |  Branch (39:24): [True: 0, False: 2.21M]
  ------------------
   40|      0|        abort();
   41|      0|    }
   42|  3.41M|    if (ptr == NULL) {
  ------------------
  |  Branch (42:9): [True: 1.20M, False: 2.21M]
  ------------------
   43|  1.20M|        return limited_malloc(size);
   44|  1.20M|    }
   45|  2.21M|    long delta = (long) size - allocated_len_map[ptr];
   46|  2.21M|    if (delta + allocated_mem > kMemoryLimit) {
  ------------------
  |  Branch (46:9): [True: 1, False: 2.21M]
  ------------------
   47|      1|        return nullptr;
   48|      1|    }
   49|  2.21M|    void* new_ptr = realloc(ptr, size);
   50|  2.21M|    if (size > 0 && new_ptr == nullptr) {
  ------------------
  |  Branch (50:9): [True: 2.21M, False: 0]
  |  Branch (50:21): [True: 0, False: 2.21M]
  ------------------
   51|      0|        return nullptr;
   52|      0|    }
   53|  2.21M|    allocated_mem += delta;
   54|  2.21M|    allocated_len_map.erase(ptr);
   55|  2.21M|    if (size > 0) {
  ------------------
  |  Branch (55:9): [True: 2.21M, False: 0]
  ------------------
   56|  2.21M|        allocated_len_map[new_ptr] = size;
   57|  2.21M|    }
   58|  2.21M|    return new_ptr;
   59|  2.21M|}
LLVMFuzzerTestOneInput:
   71|  3.89k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *Data, size_t Size) {
   72|  3.89k|    cbor_load_result result;
   73|  3.89k|    cbor_item_t *item = cbor_load(Data, Size, &result);
   74|  3.89k|    if (result.error.code == CBOR_ERR_NONE) {
  ------------------
  |  Branch (74:9): [True: 1.25k, False: 2.64k]
  ------------------
   75|  1.25k|        cbor_describe(item, kState.fout);
   76|  1.25k|        unsigned char *buffer;
   77|  1.25k|        size_t buffer_size;
   78|  1.25k|        cbor_serialize_alloc(item, &buffer, &buffer_size);
   79|  1.25k|        free(buffer);
   80|  1.25k|        cbor_item_t *copied = cbor_copy(item);
   81|  1.25k|        cbor_decref(&copied);
   82|  1.25k|        cbor_decref(&item);
   83|  1.25k|    }
   84|  3.89k|    return 0;
   85|  3.89k|}
_ZN5StateC2Ev:
   64|      2|    State() : fout(fopen("/dev/null", "w")) {
   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:
   17|  3.89k|                       struct cbor_load_result* result) {
   18|       |  /* Context stack */
   19|  3.89k|  static struct cbor_callbacks callbacks = {
   20|  3.89k|      .uint8 = &cbor_builder_uint8_callback,
   21|  3.89k|      .uint16 = &cbor_builder_uint16_callback,
   22|  3.89k|      .uint32 = &cbor_builder_uint32_callback,
   23|  3.89k|      .uint64 = &cbor_builder_uint64_callback,
   24|       |
   25|  3.89k|      .negint8 = &cbor_builder_negint8_callback,
   26|  3.89k|      .negint16 = &cbor_builder_negint16_callback,
   27|  3.89k|      .negint32 = &cbor_builder_negint32_callback,
   28|  3.89k|      .negint64 = &cbor_builder_negint64_callback,
   29|       |
   30|  3.89k|      .byte_string = &cbor_builder_byte_string_callback,
   31|  3.89k|      .byte_string_start = &cbor_builder_byte_string_start_callback,
   32|       |
   33|  3.89k|      .string = &cbor_builder_string_callback,
   34|  3.89k|      .string_start = &cbor_builder_string_start_callback,
   35|       |
   36|  3.89k|      .array_start = &cbor_builder_array_start_callback,
   37|  3.89k|      .indef_array_start = &cbor_builder_indef_array_start_callback,
   38|       |
   39|  3.89k|      .map_start = &cbor_builder_map_start_callback,
   40|  3.89k|      .indef_map_start = &cbor_builder_indef_map_start_callback,
   41|       |
   42|  3.89k|      .tag = &cbor_builder_tag_callback,
   43|       |
   44|  3.89k|      .null = &cbor_builder_null_callback,
   45|  3.89k|      .undefined = &cbor_builder_undefined_callback,
   46|  3.89k|      .boolean = &cbor_builder_boolean_callback,
   47|  3.89k|      .float2 = &cbor_builder_float2_callback,
   48|  3.89k|      .float4 = &cbor_builder_float4_callback,
   49|  3.89k|      .float8 = &cbor_builder_float8_callback,
   50|  3.89k|      .indef_break = &cbor_builder_indef_break_callback,
   51|  3.89k|      .simple_value = &cbor_builder_simple_value_callback};
   52|       |
   53|  3.89k|  if (source_size == 0) {
  ------------------
  |  Branch (53:7): [True: 0, False: 3.89k]
  ------------------
   54|      0|    result->error.code = CBOR_ERR_NODATA;
   55|      0|    return NULL;
   56|      0|  }
   57|  3.89k|  struct _cbor_stack stack = _cbor_stack_init();
   58|       |
   59|       |  /* Target for callbacks */
   60|  3.89k|  struct _cbor_decoder_context context = (struct _cbor_decoder_context){
   61|  3.89k|      .stack = &stack, .creation_failed = false, .syntax_error = false};
   62|  3.89k|  struct cbor_decoder_result decode_result;
   63|  3.89k|  *result =
   64|  3.89k|      (struct cbor_load_result){.read = 0, .error = {.code = CBOR_ERR_NONE}};
   65|       |
   66|  42.7M|  do {
   67|  42.7M|    if (source_size > result->read) { /* Check for overflows */
  ------------------
  |  Branch (67:9): [True: 42.7M, False: 1.57k]
  ------------------
   68|  42.7M|      decode_result =
   69|  42.7M|          cbor_stream_decode(source + result->read, source_size - result->read,
   70|  42.7M|                             &callbacks, &context);
   71|  42.7M|    } else {
   72|  1.57k|      result->error = (struct cbor_error){.code = CBOR_ERR_NOTENOUGHDATA,
   73|  1.57k|                                          .position = result->read};
   74|  1.57k|      goto error;
   75|  1.57k|    }
   76|       |
   77|  42.7M|    switch (decode_result.status) {
  ------------------
  |  Branch (77:13): [True: 42.7M, False: 0]
  ------------------
   78|  42.7M|      case CBOR_DECODER_FINISHED:
  ------------------
  |  Branch (78:7): [True: 42.7M, False: 639]
  ------------------
   79|       |        /* Everything OK */
   80|  42.7M|        {
   81|  42.7M|          result->read += decode_result.read;
   82|  42.7M|          break;
   83|      0|        }
   84|    582|      case CBOR_DECODER_NEDATA:
  ------------------
  |  Branch (84:7): [True: 582, False: 42.7M]
  ------------------
   85|       |        /* Not enough data to complete the current item */
   86|    582|        {
   87|    582|          result->error.code = CBOR_ERR_NOTENOUGHDATA;
   88|    582|          goto error;
   89|      0|        }
   90|     57|      case CBOR_DECODER_ERROR:
  ------------------
  |  Branch (90:7): [True: 57, False: 42.7M]
  ------------------
   91|       |        /* Reserved/malformed item */
   92|     57|        {
   93|     57|          result->error.code = CBOR_ERR_MALFORMATED;
   94|     57|          goto error;
   95|      0|        }
   96|  42.7M|    }
   97|       |
   98|  42.7M|    if (context.creation_failed) {
  ------------------
  |  Branch (98:9): [True: 306, False: 42.7M]
  ------------------
   99|       |      /* Most likely unsuccessful allocation - our callback has failed */
  100|    306|      result->error.code = CBOR_ERR_MEMERROR;
  101|    306|      goto error;
  102|  42.7M|    } else if (context.syntax_error) {
  ------------------
  |  Branch (102:16): [True: 120, False: 42.7M]
  ------------------
  103|    120|      result->error.code = CBOR_ERR_SYNTAXERROR;
  104|    120|      goto error;
  105|    120|    }
  106|  42.7M|  } while (stack.size > 0);
  ------------------
  |  Branch (106:12): [True: 42.7M, False: 1.25k]
  ------------------
  107|       |
  108|  1.25k|  return context.root;
  109|       |
  110|  2.64k|error:
  111|  2.64k|  result->error.position = result->read;
  112|       |  // debug_print("Failed with decoder error %d at %d\n", result->error.code,
  113|       |  // result->error.position); cbor_describe(stack.top->item, stdout);
  114|       |  /* Free the stack */
  115|   117k|  while (stack.size > 0) {
  ------------------
  |  Branch (115:10): [True: 115k, False: 2.64k]
  ------------------
  116|   115k|    cbor_decref(&stack.top->item);
  117|   115k|    _cbor_stack_pop(&stack);
  118|   115k|  }
  119|       |  return NULL;
  120|  3.89k|}
cbor_copy:
  167|  21.4M|cbor_item_t* cbor_copy(cbor_item_t* item) {
  168|  21.4M|  CBOR_ASSERT_VALID_TYPE(cbor_typeof(item));
  ------------------
  |  |   82|  21.4M|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  21.4M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (168:3): [True: 21.4M, False: 0]
  |  Branch (168:3): [True: 21.4M, False: 0]
  |  Branch (168:3): [True: 0, False: 21.4M]
  ------------------
  169|  21.4M|  switch (cbor_typeof(item)) {
  170|  10.6M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (170:5): [True: 10.6M, False: 10.7M]
  ------------------
  171|  10.6M|      return _cbor_copy_int(item, false);
  172|  2.04M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (172:5): [True: 2.04M, False: 19.3M]
  ------------------
  173|  2.04M|      return _cbor_copy_int(item, true);
  174|  1.03M|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (174:5): [True: 1.03M, False: 20.4M]
  ------------------
  175|  1.03M|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (175:11): [True: 1.02M, False: 2.83k]
  ------------------
  176|  1.02M|        return cbor_build_bytestring(cbor_bytestring_handle(item),
  177|  1.02M|                                     cbor_bytestring_length(item));
  178|  1.02M|      } else {
  179|  2.83k|        cbor_item_t* res = cbor_new_indefinite_bytestring();
  180|  2.83k|        if (res == NULL) {
  ------------------
  |  Branch (180:13): [True: 0, False: 2.83k]
  ------------------
  181|      0|          return NULL;
  182|      0|        }
  183|       |
  184|   570k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (184:28): [True: 567k, False: 2.83k]
  ------------------
  185|   567k|          cbor_item_t* chunk_copy =
  186|   567k|              cbor_copy(cbor_bytestring_chunks_handle(item)[i]);
  187|   567k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (187:15): [True: 0, False: 567k]
  ------------------
  188|      0|            cbor_decref(&res);
  189|      0|            return NULL;
  190|      0|          }
  191|   567k|          if (!cbor_bytestring_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (191:15): [True: 0, False: 567k]
  ------------------
  192|      0|            cbor_decref(&chunk_copy);
  193|      0|            cbor_decref(&res);
  194|      0|            return NULL;
  195|      0|          }
  196|   567k|          cbor_decref(&chunk_copy);
  197|   567k|        }
  198|  2.83k|        return res;
  199|  2.83k|      }
  200|   879k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (200:5): [True: 879k, False: 20.5M]
  ------------------
  201|   879k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (201:11): [True: 870k, False: 8.97k]
  ------------------
  202|   870k|        return cbor_build_stringn((const char*)cbor_string_handle(item),
  203|   870k|                                  cbor_string_length(item));
  204|   870k|      } else {
  205|  8.97k|        cbor_item_t* res = cbor_new_indefinite_string();
  206|  8.97k|        if (res == NULL) {
  ------------------
  |  Branch (206:13): [True: 0, False: 8.97k]
  ------------------
  207|      0|          return NULL;
  208|      0|        }
  209|       |
  210|   540k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (210:28): [True: 531k, False: 8.97k]
  ------------------
  211|   531k|          cbor_item_t* chunk_copy =
  212|   531k|              cbor_copy(cbor_string_chunks_handle(item)[i]);
  213|   531k|          if (chunk_copy == NULL) {
  ------------------
  |  Branch (213:15): [True: 0, False: 531k]
  ------------------
  214|      0|            cbor_decref(&res);
  215|      0|            return NULL;
  216|      0|          }
  217|   531k|          if (!cbor_string_add_chunk(res, chunk_copy)) {
  ------------------
  |  Branch (217:15): [True: 0, False: 531k]
  ------------------
  218|      0|            cbor_decref(&chunk_copy);
  219|      0|            cbor_decref(&res);
  220|      0|            return NULL;
  221|      0|          }
  222|   531k|          cbor_decref(&chunk_copy);
  223|   531k|        }
  224|  8.97k|        return res;
  225|  8.97k|      }
  226|  5.86M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (226:5): [True: 5.86M, False: 15.5M]
  ------------------
  227|  5.86M|      cbor_item_t* res;
  228|  5.86M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (228:11): [True: 5.46M, False: 395k]
  ------------------
  229|  5.46M|        res = cbor_new_definite_array(cbor_array_size(item));
  230|  5.46M|      } else {
  231|   395k|        res = cbor_new_indefinite_array();
  232|   395k|      }
  233|  5.86M|      if (res == NULL) {
  ------------------
  |  Branch (233:11): [True: 0, False: 5.86M]
  ------------------
  234|      0|        return NULL;
  235|      0|      }
  236|       |
  237|  23.9M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (237:26): [True: 18.0M, False: 5.86M]
  ------------------
  238|  18.0M|        cbor_item_t* entry_copy = cbor_copy(cbor_move(cbor_array_get(item, i)));
  239|  18.0M|        if (entry_copy == NULL) {
  ------------------
  |  Branch (239:13): [True: 0, False: 18.0M]
  ------------------
  240|      0|          cbor_decref(&res);
  241|      0|          return NULL;
  242|      0|        }
  243|  18.0M|        if (!cbor_array_push(res, entry_copy)) {
  ------------------
  |  Branch (243:13): [True: 0, False: 18.0M]
  ------------------
  244|      0|          cbor_decref(&entry_copy);
  245|      0|          cbor_decref(&res);
  246|      0|          return NULL;
  247|      0|        }
  248|  18.0M|        cbor_decref(&entry_copy);
  249|  18.0M|      }
  250|  5.86M|      return res;
  251|  5.86M|    }
  252|  41.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (252:5): [True: 41.4k, False: 21.4M]
  ------------------
  253|  41.4k|      cbor_item_t* res;
  254|  41.4k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (254:11): [True: 39.1k, False: 2.24k]
  ------------------
  255|  39.1k|        res = cbor_new_definite_map(cbor_map_size(item));
  256|  39.1k|      } else {
  257|  2.24k|        res = cbor_new_indefinite_map();
  258|  2.24k|      }
  259|  41.4k|      if (res == NULL) {
  ------------------
  |  Branch (259:11): [True: 0, False: 41.4k]
  ------------------
  260|      0|        return NULL;
  261|      0|      }
  262|       |
  263|  41.4k|      struct cbor_pair* it = cbor_map_handle(item);
  264|  1.06M|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (264:26): [True: 1.02M, False: 41.4k]
  ------------------
  265|  1.02M|        cbor_item_t* key_copy = cbor_copy(it[i].key);
  266|  1.02M|        if (key_copy == NULL) {
  ------------------
  |  Branch (266:13): [True: 0, False: 1.02M]
  ------------------
  267|      0|          cbor_decref(&res);
  268|      0|          return NULL;
  269|      0|        }
  270|  1.02M|        cbor_item_t* value_copy = cbor_copy(it[i].value);
  271|  1.02M|        if (value_copy == NULL) {
  ------------------
  |  Branch (271:13): [True: 0, False: 1.02M]
  ------------------
  272|      0|          cbor_decref(&res);
  273|      0|          cbor_decref(&key_copy);
  274|      0|          return NULL;
  275|      0|        }
  276|  1.02M|        if (!cbor_map_add(res, (struct cbor_pair){.key = key_copy,
  ------------------
  |  Branch (276:13): [True: 0, False: 1.02M]
  ------------------
  277|  1.02M|                                                  .value = value_copy})) {
  278|      0|          cbor_decref(&res);
  279|      0|          cbor_decref(&key_copy);
  280|      0|          cbor_decref(&value_copy);
  281|      0|          return NULL;
  282|      0|        }
  283|  1.02M|        cbor_decref(&key_copy);
  284|  1.02M|        cbor_decref(&value_copy);
  285|  1.02M|      }
  286|  41.4k|      return res;
  287|  41.4k|    }
  288|   220k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (288:5): [True: 220k, False: 21.2M]
  ------------------
  289|   220k|      cbor_item_t* item_copy = cbor_copy(cbor_move(cbor_tag_item(item)));
  290|   220k|      if (item_copy == NULL) {
  ------------------
  |  Branch (290:11): [True: 0, False: 220k]
  ------------------
  291|      0|        return NULL;
  292|      0|      }
  293|   220k|      cbor_item_t* tag = cbor_build_tag(cbor_tag_value(item), item_copy);
  294|   220k|      cbor_decref(&item_copy);
  295|   220k|      return tag;
  296|   220k|    }
  297|   685k|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (297:5): [True: 685k, False: 20.7M]
  ------------------
  298|   685k|      return _cbor_copy_float_ctrl(item);
  299|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (299:5): [True: 0, False: 21.4M]
  ------------------
  300|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  301|      0|      return NULL;  // LCOV_EXCL_STOP
  302|  21.4M|  }
  303|  21.4M|}
cbor_describe:
  605|  1.25k|void cbor_describe(cbor_item_t* item, FILE* out) {
  606|  1.25k|  _cbor_nested_describe(item, out, 0);
  607|  1.25k|}
cbor.c:_cbor_copy_int:
  122|  12.7M|static cbor_item_t* _cbor_copy_int(cbor_item_t* item, bool negative) {
  123|  12.7M|  CBOR_ASSERT(cbor_isa_uint(item) || cbor_isa_negint(item));
  ------------------
  |  |   64|  12.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (123:3): [True: 10.6M, False: 2.04M]
  |  Branch (123:3): [True: 2.04M, False: 0]
  |  Branch (123:3): [True: 0, False: 12.7M]
  ------------------
  124|  12.7M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  12.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (124:3): [True: 12.7M, False: 0]
  |  Branch (124:3): [True: 12.7M, False: 0]
  |  Branch (124:3): [True: 0, False: 12.7M]
  ------------------
  125|  12.7M|              cbor_int_get_width(item) <= CBOR_INT_64);
  126|  12.7M|  cbor_item_t* res = NULL;
  127|  12.7M|  switch (cbor_int_get_width(item)) {
  ------------------
  |  Branch (127:11): [True: 12.7M, False: 0]
  ------------------
  128|  12.2M|    case CBOR_INT_8:
  ------------------
  |  Branch (128:5): [True: 12.2M, False: 510k]
  ------------------
  129|  12.2M|      res = cbor_build_uint8(cbor_get_uint8(item));
  130|  12.2M|      break;
  131|  29.0k|    case CBOR_INT_16:
  ------------------
  |  Branch (131:5): [True: 29.0k, False: 12.6M]
  ------------------
  132|  29.0k|      res = cbor_build_uint16(cbor_get_uint16(item));
  133|  29.0k|      break;
  134|   473k|    case CBOR_INT_32:
  ------------------
  |  Branch (134:5): [True: 473k, False: 12.2M]
  ------------------
  135|   473k|      res = cbor_build_uint32(cbor_get_uint32(item));
  136|   473k|      break;
  137|  8.08k|    case CBOR_INT_64:
  ------------------
  |  Branch (137:5): [True: 8.08k, False: 12.7M]
  ------------------
  138|  8.08k|      res = cbor_build_uint64(cbor_get_uint64(item));
  139|  8.08k|      break;
  140|  12.7M|  }
  141|       |
  142|  12.7M|  if (res == NULL) return NULL;
  ------------------
  |  Branch (142:7): [True: 0, False: 12.7M]
  ------------------
  143|  12.7M|  if (negative) cbor_mark_negint(res);
  ------------------
  |  Branch (143:7): [True: 2.04M, False: 10.6M]
  ------------------
  144|       |
  145|  12.7M|  return res;
  146|  12.7M|}
cbor.c:_cbor_copy_float_ctrl:
  148|   685k|static cbor_item_t* _cbor_copy_float_ctrl(cbor_item_t* item) {
  149|   685k|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|   685k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (149:3): [True: 0, False: 685k]
  |  Branch (149:3): [True: 685k, False: 0]
  ------------------
  150|   685k|  CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   685k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (150:3): [True: 685k, False: 0]
  |  Branch (150:3): [True: 685k, False: 0]
  |  Branch (150:3): [True: 0, False: 685k]
  ------------------
  151|   685k|              cbor_float_get_width(item) <= CBOR_FLOAT_64);
  152|   685k|  switch (cbor_float_get_width(item)) {
  153|   573k|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (153:5): [True: 573k, False: 112k]
  ------------------
  154|   573k|      return cbor_build_ctrl(cbor_ctrl_value(item));
  155|  95.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (155:5): [True: 95.9k, False: 590k]
  ------------------
  156|  95.9k|      return cbor_build_float2(cbor_float_get_float2(item));
  157|  10.1k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (157:5): [True: 10.1k, False: 675k]
  ------------------
  158|  10.1k|      return cbor_build_float4(cbor_float_get_float4(item));
  159|  6.69k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (159:5): [True: 6.69k, False: 679k]
  ------------------
  160|  6.69k|      return cbor_build_float8(cbor_float_get_float8(item));
  161|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (161:5): [True: 0, False: 685k]
  ------------------
  162|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  163|      0|      return NULL;  // LCOV_EXCL_START
  164|   685k|  }
  165|   685k|}
cbor.c:_cbor_nested_describe:
  487|  21.4M|static void _cbor_nested_describe(cbor_item_t* item, FILE* out, int indent) {
  488|  21.4M|  CBOR_ASSERT(cbor_typeof(item) >= CBOR_TYPE_UINT &&
  ------------------
  |  |   64|  21.4M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (488:3): [True: 21.4M, False: 0]
  |  Branch (488:3): [True: 21.4M, False: 0]
  |  Branch (488:3): [True: 0, False: 21.4M]
  ------------------
  489|  21.4M|              cbor_typeof(item) <= CBOR_TYPE_FLOAT_CTRL);
  490|  21.4M|  const int indent_offset = 4;
  491|  21.4M|  switch (cbor_typeof(item)) {
  ------------------
  |  Branch (491:11): [True: 21.4M, False: 0]
  ------------------
  492|  10.6M|    case CBOR_TYPE_UINT: {
  ------------------
  |  Branch (492:5): [True: 10.6M, False: 10.7M]
  ------------------
  493|  10.6M|      _cbor_type_marquee(out, "CBOR_TYPE_UINT", indent);
  494|  10.6M|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  495|  10.6M|      fprintf(out, "Value: %" PRIu64 "\n", cbor_get_int(item));
  496|  10.6M|      break;
  497|      0|    }
  498|  2.04M|    case CBOR_TYPE_NEGINT: {
  ------------------
  |  Branch (498:5): [True: 2.04M, False: 19.3M]
  ------------------
  499|  2.04M|      _cbor_type_marquee(out, "CBOR_TYPE_NEGINT", indent);
  500|  2.04M|      fprintf(out, "Width: %dB, ", _pow(2, cbor_int_get_width(item)));
  501|  2.04M|      fprintf(out, "Value: -%" PRIu64 " - 1\n", cbor_get_int(item));
  502|  2.04M|      break;
  503|      0|    }
  504|  1.03M|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (504:5): [True: 1.03M, False: 20.4M]
  ------------------
  505|  1.03M|      _cbor_type_marquee(out, "CBOR_TYPE_BYTESTRING", indent);
  506|  1.03M|      if (cbor_bytestring_is_indefinite(item)) {
  ------------------
  |  Branch (506:11): [True: 2.83k, False: 1.02M]
  ------------------
  507|  2.83k|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  508|  2.83k|                cbor_bytestring_chunk_count(item));
  509|   570k|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (509:28): [True: 567k, False: 2.83k]
  ------------------
  510|   567k|          _cbor_nested_describe(cbor_bytestring_chunks_handle(item)[i], out,
  511|   567k|                                indent + indent_offset);
  512|  1.02M|      } else {
  513|  1.02M|        const unsigned char* data = cbor_bytestring_handle(item);
  514|  1.02M|        fprintf(out, "Definite, Length: %zuB, Data:\n",
  515|  1.02M|                cbor_bytestring_length(item));
  516|  1.02M|        fprintf(out, "%*s", indent + indent_offset, " ");
  517|  4.10M|        for (size_t i = 0; i < cbor_bytestring_length(item); i++)
  ------------------
  |  Branch (517:28): [True: 3.08M, False: 1.02M]
  ------------------
  518|  3.08M|          fprintf(out, "%02x", (int)(data[i] & 0xff));
  519|  1.02M|        fprintf(out, "\n");
  520|  1.02M|      }
  521|  1.03M|      break;
  522|      0|    }
  523|   879k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (523:5): [True: 879k, False: 20.5M]
  ------------------
  524|   879k|      _cbor_type_marquee(out, "CBOR_TYPE_STRING", indent);
  525|   879k|      if (cbor_string_is_indefinite(item)) {
  ------------------
  |  Branch (525:11): [True: 8.97k, False: 870k]
  ------------------
  526|  8.97k|        fprintf(out, "Indefinite, Chunks: %zu, Chunk data:\n",
  527|  8.97k|                cbor_string_chunk_count(item));
  528|   540k|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (528:28): [True: 531k, False: 8.97k]
  ------------------
  529|   531k|          _cbor_nested_describe(cbor_string_chunks_handle(item)[i], out,
  530|   531k|                                indent + indent_offset);
  531|   870k|      } else {
  532|   870k|        fprintf(out, "Definite, Length: %zuB, Codepoints: %zu, Data:\n",
  533|   870k|                cbor_string_length(item), cbor_string_codepoint_count(item));
  534|   870k|        fprintf(out, "%*s", indent + indent_offset, " ");
  535|       |        // Note: The string is not escaped, whitespace and control character
  536|       |        // will be printed in verbatim and take effect.
  537|       |        // Empty strings may have a NULL handle
  538|   870k|        if (cbor_string_length(item) > 0) {
  ------------------
  |  Branch (538:13): [True: 867k, False: 2.98k]
  ------------------
  539|   867k|          fwrite(cbor_string_handle(item), sizeof(unsigned char),
  540|   867k|                 cbor_string_length(item), out);
  541|   867k|        }
  542|   870k|        fprintf(out, "\n");
  543|   870k|      }
  544|   879k|      break;
  545|      0|    }
  546|  5.86M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (546:5): [True: 5.86M, False: 15.5M]
  ------------------
  547|  5.86M|      _cbor_type_marquee(out, "CBOR_TYPE_ARRAY", indent);
  548|  5.86M|      if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (548:11): [True: 5.46M, False: 395k]
  ------------------
  549|  5.46M|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_array_size(item));
  550|  5.46M|      } else {
  551|   395k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n",
  552|   395k|                cbor_array_size(item));
  553|   395k|      }
  554|       |
  555|  23.9M|      for (size_t i = 0; i < cbor_array_size(item); i++)
  ------------------
  |  Branch (555:26): [True: 18.0M, False: 5.86M]
  ------------------
  556|  18.0M|        _cbor_nested_describe(cbor_array_handle(item)[i], out,
  557|  18.0M|                              indent + indent_offset);
  558|  5.86M|      break;
  559|      0|    }
  560|  41.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (560:5): [True: 41.4k, False: 21.4M]
  ------------------
  561|  41.4k|      _cbor_type_marquee(out, "CBOR_TYPE_MAP", indent);
  562|  41.4k|      if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (562:11): [True: 39.1k, False: 2.24k]
  ------------------
  563|  39.1k|        fprintf(out, "Definite, Size: %zu, Contents:\n", cbor_map_size(item));
  564|  39.1k|      } else {
  565|  2.24k|        fprintf(out, "Indefinite, Size: %zu, Contents:\n", cbor_map_size(item));
  566|  2.24k|      }
  567|       |
  568|       |      // TODO: Label and group keys and values
  569|  1.06M|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (569:26): [True: 1.02M, False: 41.4k]
  ------------------
  570|  1.02M|        fprintf(out, "%*sMap entry %zu\n", indent + indent_offset, " ", i);
  571|  1.02M|        _cbor_nested_describe(cbor_map_handle(item)[i].key, out,
  572|  1.02M|                              indent + 2 * indent_offset);
  573|  1.02M|        _cbor_nested_describe(cbor_map_handle(item)[i].value, out,
  574|  1.02M|                              indent + 2 * indent_offset);
  575|  1.02M|      }
  576|  41.4k|      break;
  577|      0|    }
  578|   220k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (578:5): [True: 220k, False: 21.2M]
  ------------------
  579|   220k|      _cbor_type_marquee(out, "CBOR_TYPE_TAG", indent);
  580|   220k|      fprintf(out, "Value: %" PRIu64 "\n", cbor_tag_value(item));
  581|   220k|      _cbor_nested_describe(cbor_move(cbor_tag_item(item)), out,
  582|   220k|                            indent + indent_offset);
  583|   220k|      break;
  584|      0|    }
  585|   685k|    case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (585:5): [True: 685k, False: 20.7M]
  ------------------
  586|   685k|      _cbor_type_marquee(out, "CBOR_TYPE_FLOAT_CTRL", indent);
  587|   685k|      if (cbor_float_ctrl_is_ctrl(item)) {
  ------------------
  |  Branch (587:11): [True: 573k, False: 112k]
  ------------------
  588|   573k|        if (cbor_is_bool(item))
  ------------------
  |  Branch (588:13): [True: 429k, False: 143k]
  ------------------
  589|   429k|          fprintf(out, "Bool: %s\n", cbor_get_bool(item) ? "true" : "false");
  ------------------
  |  Branch (589:38): [True: 370k, False: 59.3k]
  ------------------
  590|   143k|        else if (cbor_is_undef(item))
  ------------------
  |  Branch (590:18): [True: 23.9k, False: 119k]
  ------------------
  591|  23.9k|          fprintf(out, "Undefined\n");
  592|   119k|        else if (cbor_is_null(item))
  ------------------
  |  Branch (592:18): [True: 116k, False: 2.76k]
  ------------------
  593|   116k|          fprintf(out, "Null\n");
  594|  2.76k|        else
  595|  2.76k|          fprintf(out, "Simple value: %d\n", cbor_ctrl_value(item));
  596|   573k|      } else {
  597|   112k|        fprintf(out, "Width: %dB, ", _pow(2, cbor_float_get_width(item)));
  598|   112k|        fprintf(out, "Value: %lf\n", cbor_float_get_float(item));
  599|   112k|      }
  600|   685k|      break;
  601|      0|    }
  602|  21.4M|  }
  603|  21.4M|}
cbor.c:_cbor_type_marquee:
  483|  21.4M|static void _cbor_type_marquee(FILE* out, char* label, int indent) {
  484|  21.4M|  fprintf(out, "%*.*s[%s] ", indent, indent, " ", label);
  485|  21.4M|}
cbor.c:_pow:
  476|  12.8M|static int _pow(int b, int ex) {
  477|  12.8M|  if (ex == 0) return 1;
  ------------------
  |  Branch (477:7): [True: 12.2M, False: 623k]
  ------------------
  478|   623k|  int res = b;
  479|  1.13M|  while (--ex > 0) res *= b;
  ------------------
  |  Branch (479:10): [True: 513k, False: 623k]
  ------------------
  480|   623k|  return res;
  481|  12.8M|}

cbor_array_size:
   13|   113M|size_t cbor_array_size(const cbor_item_t* item) {
   14|   113M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|   113M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (14:3): [True: 0, False: 113M]
  |  Branch (14:3): [True: 113M, False: 0]
  ------------------
   15|   113M|  return item->metadata.array_metadata.end_ptr;
   16|   113M|}
cbor_array_get:
   23|  18.0M|cbor_item_t* cbor_array_get(const cbor_item_t* item, size_t index) {
   24|  18.0M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|  18.0M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (24:3): [True: 0, False: 18.0M]
  |  Branch (24:3): [True: 18.0M, False: 0]
  ------------------
   25|  18.0M|  if (index >= item->metadata.array_metadata.end_ptr) {
  ------------------
  |  Branch (25:7): [True: 0, False: 18.0M]
  ------------------
   26|      0|    return NULL;
   27|      0|  }
   28|  18.0M|  return cbor_incref(((cbor_item_t**)item->data)[index]);
   29|  18.0M|}
cbor_array_push:
   49|  52.9M|bool cbor_array_push(cbor_item_t* array, cbor_item_t* pushee) {
   50|  52.9M|  CBOR_ASSERT(cbor_isa_array(array));
  ------------------
  |  |   64|  52.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (50:3): [True: 0, False: 52.9M]
  |  Branch (50:3): [True: 52.9M, False: 0]
  ------------------
   51|  52.9M|  struct _cbor_array_metadata* metadata =
   52|  52.9M|      (struct _cbor_array_metadata*)&array->metadata;
   53|  52.9M|  cbor_item_t** data = (cbor_item_t**)array->data;
   54|  52.9M|  if (cbor_array_is_definite(array)) {
  ------------------
  |  Branch (54:7): [True: 19.0M, False: 33.8M]
  ------------------
   55|       |    /* Do not reallocate definite arrays */
   56|  19.0M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (56:9): [True: 0, False: 19.0M]
  ------------------
   57|      0|      return false;
   58|      0|    }
   59|  19.0M|    data[metadata->end_ptr++] = pushee;
   60|  33.8M|  } else {
   61|       |    /* Exponential realloc */
   62|  33.8M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (62:9): [True: 3.39M, False: 30.4M]
  ------------------
   63|       |      // Check for overflows first
   64|  3.39M|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  3.39M|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (64:11): [True: 0, False: 3.39M]
  ------------------
   65|      0|        return false;
   66|      0|      }
   67|       |
   68|  3.39M|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (68:31): [True: 1.19M, False: 2.19M]
  ------------------
   69|  3.39M|                                  ? 1
   70|  3.39M|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  2.19M|#define CBOR_BUFFER_GROWTH 2
  ------------------
   71|       |
   72|  3.39M|      unsigned char* new_data = _cbor_realloc_multiple(
   73|  3.39M|          array->data, sizeof(cbor_item_t*), new_allocation);
   74|  3.39M|      if (new_data == NULL) {
  ------------------
  |  Branch (74:11): [True: 1, False: 3.39M]
  ------------------
   75|      1|        return false;
   76|      1|      }
   77|       |
   78|  3.39M|      array->data = new_data;
   79|  3.39M|      metadata->allocated = new_allocation;
   80|  3.39M|    }
   81|  33.8M|    ((cbor_item_t**)array->data)[metadata->end_ptr++] = pushee;
   82|  33.8M|  }
   83|  52.9M|  cbor_incref(pushee);
   84|  52.9M|  return true;
   85|  52.9M|}
cbor_array_is_definite:
   87|   117M|bool cbor_array_is_definite(const cbor_item_t* item) {
   88|   117M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|   117M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (88:3): [True: 0, False: 117M]
  |  Branch (88:3): [True: 117M, False: 0]
  ------------------
   89|   117M|  return item->metadata.array_metadata.type == _CBOR_METADATA_DEFINITE;
   90|   117M|}
cbor_array_is_indefinite:
   92|  1.56M|bool cbor_array_is_indefinite(const cbor_item_t* item) {
   93|  1.56M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|  1.56M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (93:3): [True: 0, False: 1.56M]
  |  Branch (93:3): [True: 1.56M, False: 0]
  ------------------
   94|  1.56M|  return item->metadata.array_metadata.type == _CBOR_METADATA_INDEFINITE;
   95|  1.56M|}
cbor_array_handle:
   97|  48.6M|cbor_item_t** cbor_array_handle(const cbor_item_t* item) {
   98|  48.6M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|  48.6M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (98:3): [True: 0, False: 48.6M]
  |  Branch (98:3): [True: 48.6M, False: 0]
  ------------------
   99|  48.6M|  return (cbor_item_t**)item->data;
  100|  48.6M|}
cbor_new_definite_array:
  102|  17.6M|cbor_item_t* cbor_new_definite_array(size_t size) {
  103|  17.6M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
  104|  17.6M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  17.6M|  do {                           \
  |  |  127|  17.6M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 1, False: 17.6M]
  |  |  ------------------
  |  |  128|      1|      return NULL;               \
  |  |  129|      1|    }                            \
  |  |  130|  17.6M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 17.6M]
  |  |  ------------------
  ------------------
  105|       |
  106|       |  // malloc(0) may legitimately return NULL, so do not allocate (or check) for
  107|       |  // an empty array. The data pointer is never dereferenced while size == 0.
  108|  17.6M|  cbor_item_t** data = NULL;
  109|  17.6M|  if (size > 0) {
  ------------------
  |  Branch (109:7): [True: 17.6M, False: 674]
  ------------------
  110|  17.6M|    data = _cbor_alloc_multiple(sizeof(cbor_item_t*), size);
  111|  17.6M|    _CBOR_DEPENDENT_NOTNULL(item, data);
  ------------------
  |  |  135|  17.6M|  do {                                              \
  |  |  136|  17.6M|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 108, False: 17.6M]
  |  |  ------------------
  |  |  137|    108|      _cbor_free(cbor_item);                        \
  |  |  138|    108|      return NULL;                                  \
  |  |  139|    108|    }                                               \
  |  |  140|  17.6M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 17.6M]
  |  |  ------------------
  ------------------
  112|  17.6M|  }
  113|       |
  114|  3.97G|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (114:22): [True: 3.95G, False: 17.6M]
  ------------------
  115|  3.95G|    data[i] = NULL;
  116|  3.95G|  }
  117|       |
  118|  17.6M|  *item = (cbor_item_t){
  119|  17.6M|      .refcount = 1,
  120|  17.6M|      .type = CBOR_TYPE_ARRAY,
  121|  17.6M|      .metadata = {.array_metadata = {.type = _CBOR_METADATA_DEFINITE,
  122|  17.6M|                                      .allocated = size,
  123|  17.6M|                                      .end_ptr = 0}},
  124|  17.6M|      .data = (unsigned char*)data};
  125|       |
  126|  17.6M|  return item;
  127|  17.6M|}
cbor_new_indefinite_array:
  129|  1.20M|cbor_item_t* cbor_new_indefinite_array(void) {
  130|  1.20M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
  131|  1.20M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  1.20M|  do {                           \
  |  |  127|  1.20M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 1.20M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  1.20M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 1.20M]
  |  |  ------------------
  ------------------
  132|       |
  133|  1.20M|  *item = (cbor_item_t){
  134|  1.20M|      .refcount = 1,
  135|  1.20M|      .type = CBOR_TYPE_ARRAY,
  136|  1.20M|      .metadata = {.array_metadata = {.type = _CBOR_METADATA_INDEFINITE,
  137|  1.20M|                                      .allocated = 0,
  138|  1.20M|                                      .end_ptr = 0}},
  139|       |      .data = NULL /* Can be safely realloc-ed */
  140|  1.20M|  };
  141|  1.20M|  return item;
  142|  1.20M|}

cbor_bytestring_length:
   12|  10.2M|size_t cbor_bytestring_length(const cbor_item_t* item) {
   13|  10.2M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  10.2M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (13:3): [True: 0, False: 10.2M]
  |  Branch (13:3): [True: 10.2M, False: 0]
  ------------------
   14|  10.2M|  return item->metadata.bytestring_metadata.length;
   15|  10.2M|}
cbor_bytestring_handle:
   17|  3.08M|unsigned char* cbor_bytestring_handle(const cbor_item_t* item) {
   18|  3.08M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  3.08M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (18:3): [True: 0, False: 3.08M]
  |  Branch (18:3): [True: 3.08M, False: 0]
  ------------------
   19|  3.08M|  return item->data;
   20|  3.08M|}
cbor_bytestring_is_definite:
   22|  18.3M|bool cbor_bytestring_is_definite(const cbor_item_t* item) {
   23|  18.3M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  18.3M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (23:3): [True: 0, False: 18.3M]
  |  Branch (23:3): [True: 18.3M, False: 0]
  ------------------
   24|  18.3M|  return item->metadata.bytestring_metadata.type == _CBOR_METADATA_DEFINITE;
   25|  18.3M|}
cbor_bytestring_is_indefinite:
   27|  8.33M|bool cbor_bytestring_is_indefinite(const cbor_item_t* item) {
   28|  8.33M|  return !cbor_bytestring_is_definite(item);
   29|  8.33M|}
cbor_new_definite_bytestring:
   31|  2.61M|cbor_item_t* cbor_new_definite_bytestring(void) {
   32|  2.61M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   33|  2.61M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  2.61M|  do {                           \
  |  |  127|  2.61M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 2.61M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  2.61M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 2.61M]
  |  |  ------------------
  ------------------
   34|  2.61M|  *item = (cbor_item_t){
   35|  2.61M|      .refcount = 1,
   36|  2.61M|      .type = CBOR_TYPE_BYTESTRING,
   37|  2.61M|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_DEFINITE,
   38|  2.61M|                                           .length = 0}}};
   39|  2.61M|  return item;
   40|  2.61M|}
cbor_new_indefinite_bytestring:
   42|  6.83k|cbor_item_t* cbor_new_indefinite_bytestring(void) {
   43|  6.83k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   44|  6.83k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  6.83k|  do {                           \
  |  |  127|  6.83k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 6.83k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  6.83k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 6.83k]
  |  |  ------------------
  ------------------
   45|  6.83k|  *item = (cbor_item_t){
   46|  6.83k|      .refcount = 1,
   47|  6.83k|      .type = CBOR_TYPE_BYTESTRING,
   48|  6.83k|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_INDEFINITE,
   49|  6.83k|                                           .length = 0}},
   50|  6.83k|      .data = _cbor_malloc(sizeof(struct cbor_indefinite_string_data))};
   51|  6.83k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  135|  6.83k|  do {                                              \
  |  |  136|  6.83k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 6.83k]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|  6.83k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 6.83k]
  |  |  ------------------
  ------------------
   52|  6.83k|  *((struct cbor_indefinite_string_data*)item->data) =
   53|  6.83k|      (struct cbor_indefinite_string_data){
   54|  6.83k|          .chunk_count = 0,
   55|  6.83k|          .chunk_capacity = 0,
   56|       |          .chunks = NULL,
   57|  6.83k|      };
   58|  6.83k|  return item;
   59|  6.83k|}
cbor_build_bytestring:
   61|  1.02M|cbor_item_t* cbor_build_bytestring(cbor_data handle, size_t length) {
   62|  1.02M|  cbor_item_t* item = cbor_new_definite_bytestring();
   63|  1.02M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  1.02M|  do {                           \
  |  |  127|  1.02M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 1.02M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  1.02M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 1.02M]
  |  |  ------------------
  ------------------
   64|       |  // malloc(0) may legitimately return NULL, so do not allocate for an empty
   65|       |  // bytestring; the handle will be NULL and never dereferenced.
   66|  1.02M|  void* content = NULL;
   67|  1.02M|  if (length > 0) {
  ------------------
  |  Branch (67:7): [True: 1.02M, False: 1.33k]
  ------------------
   68|  1.02M|    content = _cbor_malloc(length);
   69|  1.02M|    _CBOR_DEPENDENT_NOTNULL(item, content);
  ------------------
  |  |  135|  1.02M|  do {                                              \
  |  |  136|  1.02M|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 1.02M]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|  1.02M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 1.02M]
  |  |  ------------------
  ------------------
   70|  1.02M|    memcpy(content, handle, length);
   71|  1.02M|  }
   72|  1.02M|  cbor_bytestring_set_handle(item, content, length);
   73|  1.02M|  return item;
   74|  1.02M|}
cbor_bytestring_set_handle:
   78|  2.61M|                                size_t length) {
   79|  2.61M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  2.61M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (79:3): [True: 0, False: 2.61M]
  |  Branch (79:3): [True: 2.61M, False: 0]
  ------------------
   80|  2.61M|  CBOR_ASSERT(cbor_bytestring_is_definite(item));
  ------------------
  |  |   64|  2.61M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (80:3): [True: 0, False: 2.61M]
  |  Branch (80:3): [True: 2.61M, False: 0]
  ------------------
   81|  2.61M|  item->data = data;
   82|  2.61M|  item->metadata.bytestring_metadata.length = length;
   83|  2.61M|}
cbor_bytestring_chunks_handle:
   85|  1.14M|cbor_item_t** cbor_bytestring_chunks_handle(const cbor_item_t* item) {
   86|  1.14M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  1.14M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (86:3): [True: 0, False: 1.14M]
  |  Branch (86:3): [True: 1.14M, False: 0]
  ------------------
   87|  1.14M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  1.14M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (87:3): [True: 0, False: 1.14M]
  |  Branch (87:3): [True: 1.14M, False: 0]
  ------------------
   88|  1.14M|  return ((struct cbor_indefinite_string_data*)item->data)->chunks;
   89|  1.14M|}
cbor_bytestring_chunk_count:
   91|  3.38M|size_t cbor_bytestring_chunk_count(const cbor_item_t* item) {
   92|  3.38M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  3.38M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (92:3): [True: 0, False: 3.38M]
  |  Branch (92:3): [True: 3.38M, False: 0]
  ------------------
   93|  3.38M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  3.38M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (93:3): [True: 0, False: 3.38M]
  |  Branch (93:3): [True: 3.38M, False: 0]
  ------------------
   94|  3.38M|  return ((struct cbor_indefinite_string_data*)item->data)->chunk_count;
   95|  3.38M|}
cbor_bytestring_add_chunk:
   97|  1.66M|bool cbor_bytestring_add_chunk(cbor_item_t* item, cbor_item_t* chunk) {
   98|  1.66M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  1.66M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (98:3): [True: 0, False: 1.66M]
  |  Branch (98:3): [True: 1.66M, False: 0]
  ------------------
   99|  1.66M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  1.66M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (99:3): [True: 0, False: 1.66M]
  |  Branch (99:3): [True: 1.66M, False: 0]
  ------------------
  100|  1.66M|  CBOR_ASSERT(cbor_isa_bytestring(chunk));
  ------------------
  |  |   64|  1.66M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (100:3): [True: 0, False: 1.66M]
  |  Branch (100:3): [True: 1.66M, False: 0]
  ------------------
  101|  1.66M|  CBOR_ASSERT(cbor_bytestring_is_definite(chunk));
  ------------------
  |  |   64|  1.66M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (101:3): [True: 0, False: 1.66M]
  |  Branch (101:3): [True: 1.66M, False: 0]
  ------------------
  102|  1.66M|  struct cbor_indefinite_string_data* data =
  103|  1.66M|      (struct cbor_indefinite_string_data*)item->data;
  104|  1.66M|  if (data->chunk_count == data->chunk_capacity) {
  ------------------
  |  Branch (104:7): [True: 15.0k, False: 1.64M]
  ------------------
  105|  15.0k|    if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, data->chunk_capacity)) {
  ------------------
  |  |    8|  15.0k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (105:9): [True: 0, False: 15.0k]
  ------------------
  106|      0|      return false;
  107|      0|    }
  108|       |
  109|  15.0k|    size_t new_chunk_capacity =
  110|  15.0k|        data->chunk_capacity == 0 ? 1
  ------------------
  |  Branch (110:9): [True: 5.23k, False: 9.84k]
  ------------------
  111|  15.0k|                                  : CBOR_BUFFER_GROWTH * (data->chunk_capacity);
  ------------------
  |  |    8|  9.84k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  112|       |
  113|  15.0k|    cbor_item_t** new_chunks_data = _cbor_realloc_multiple(
  114|  15.0k|        data->chunks, sizeof(cbor_item_t*), new_chunk_capacity);
  115|       |
  116|  15.0k|    if (new_chunks_data == NULL) {
  ------------------
  |  Branch (116:9): [True: 0, False: 15.0k]
  ------------------
  117|      0|      return false;
  118|      0|    }
  119|  15.0k|    data->chunk_capacity = new_chunk_capacity;
  120|  15.0k|    data->chunks = new_chunks_data;
  121|  15.0k|  }
  122|  1.66M|  data->chunks[data->chunk_count++] = cbor_incref(chunk);
  123|  1.66M|  return true;
  124|  1.66M|}

cbor_typeof:
   22|  1.22G|cbor_type cbor_typeof(const cbor_item_t* item) {
   23|  1.22G|  CBOR_ASSERT(item != NULL);
  ------------------
  |  |   64|  1.22G|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (23:3): [True: 0, False: 1.22G]
  |  Branch (23:3): [True: 1.22G, False: 0]
  ------------------
   24|  1.22G|  CBOR_ASSERT_VALID_TYPE(item->type);
  ------------------
  |  |   82|  1.22G|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  1.22G|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (24:3): [True: 1.22G, False: 0]
  |  Branch (24:3): [True: 1.22G, False: 0]
  |  Branch (24:3): [True: 0, False: 1.22G]
  ------------------
   25|  1.22G|  return item->type;
   26|  1.22G|}
cbor_isa_uint:
   28|   408M|bool cbor_isa_uint(const cbor_item_t* item) {
   29|   408M|  return cbor_typeof(item) == CBOR_TYPE_UINT;
   30|   408M|}
cbor_isa_negint:
   32|  56.7M|bool cbor_isa_negint(const cbor_item_t* item) {
   33|  56.7M|  return cbor_typeof(item) == CBOR_TYPE_NEGINT;
   34|  56.7M|}
cbor_isa_bytestring:
   36|  44.7M|bool cbor_isa_bytestring(const cbor_item_t* item) {
   37|  44.7M|  return cbor_typeof(item) == CBOR_TYPE_BYTESTRING;
   38|  44.7M|}
cbor_isa_string:
   40|  46.0M|bool cbor_isa_string(const cbor_item_t* item) {
   41|  46.0M|  return cbor_typeof(item) == CBOR_TYPE_STRING;
   42|  46.0M|}
cbor_isa_array:
   44|   357M|bool cbor_isa_array(const cbor_item_t* item) {
   45|   357M|  return cbor_typeof(item) == CBOR_TYPE_ARRAY;
   46|   357M|}
cbor_isa_map:
   48|  24.4M|bool cbor_isa_map(const cbor_item_t* item) {
   49|  24.4M|  return cbor_typeof(item) == CBOR_TYPE_MAP;
   50|  24.4M|}
cbor_isa_tag:
   52|  2.49M|bool cbor_isa_tag(const cbor_item_t* item) {
   53|  2.49M|  return cbor_typeof(item) == CBOR_TYPE_TAG;
   54|  2.49M|}
cbor_isa_float_ctrl:
   56|  28.9M|bool cbor_isa_float_ctrl(const cbor_item_t* item) {
   57|  28.9M|  return cbor_typeof(item) == CBOR_TYPE_FLOAT_CTRL;
   58|  28.9M|}
cbor_is_int:
   60|   384M|bool cbor_is_int(const cbor_item_t* item) {
   61|   384M|  return cbor_isa_uint(item) || cbor_isa_negint(item);
  ------------------
  |  Branch (61:10): [True: 332M, False: 52.6M]
  |  Branch (61:33): [True: 52.6M, False: 0]
  ------------------
   62|   384M|}
cbor_is_bool:
   64|  1.00M|bool cbor_is_bool(const cbor_item_t* item) {
   65|  1.00M|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (65:10): [True: 1.00M, False: 0]
  |  Branch (65:39): [True: 1.00M, False: 0]
  ------------------
   66|  1.00M|         (cbor_ctrl_value(item) == CBOR_CTRL_FALSE ||
  ------------------
  |  Branch (66:11): [True: 118k, False: 884k]
  ------------------
   67|   884k|          cbor_ctrl_value(item) == CBOR_CTRL_TRUE);
  ------------------
  |  Branch (67:11): [True: 740k, False: 143k]
  ------------------
   68|  1.00M|}
cbor_is_null:
   70|   119k|bool cbor_is_null(const cbor_item_t* item) {
   71|   119k|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (71:10): [True: 119k, False: 0]
  |  Branch (71:39): [True: 119k, False: 0]
  ------------------
   72|   119k|         cbor_ctrl_value(item) == CBOR_CTRL_NULL;
  ------------------
  |  Branch (72:10): [True: 116k, False: 2.76k]
  ------------------
   73|   119k|}
cbor_is_undef:
   75|   143k|bool cbor_is_undef(const cbor_item_t* item) {
   76|   143k|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (76:10): [True: 143k, False: 0]
  |  Branch (76:39): [True: 143k, False: 0]
  ------------------
   77|   143k|         cbor_ctrl_value(item) == CBOR_CTRL_UNDEF;
  ------------------
  |  Branch (77:10): [True: 23.9k, False: 119k]
  ------------------
   78|   143k|}
cbor_is_float:
   80|   599k|bool cbor_is_float(const cbor_item_t* item) {
   81|   599k|  return cbor_isa_float_ctrl(item) && !cbor_float_ctrl_is_ctrl(item);
  ------------------
  |  Branch (81:10): [True: 599k, False: 0]
  |  Branch (81:39): [True: 599k, False: 0]
  ------------------
   82|   599k|}
_cbor_decref_free:
   84|  63.3M|void _cbor_decref_free(cbor_item_t* item) {
   85|  63.3M|  switch (item->type) {
  ------------------
  |  Branch (85:11): [True: 63.3M, False: 0]
  ------------------
   86|  28.7M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (86:5): [True: 28.7M, False: 34.6M]
  ------------------
   87|       |      /* Fallthrough */
   88|  34.6M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (88:5): [True: 5.89M, False: 57.4M]
  ------------------
   89|       |      /* Combined allocation, freeing the item suffices */
   90|  34.6M|      { break; }
   91|  2.61M|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (91:5): [True: 2.61M, False: 60.7M]
  ------------------
   92|  2.61M|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (92:11): [True: 2.61M, False: 6.83k]
  ------------------
   93|  2.61M|        _cbor_free(item->data);
   94|  2.61M|      } else {
   95|       |        /* We need to decref all chunks */
   96|  6.83k|        cbor_item_t** handle = cbor_bytestring_chunks_handle(item);
   97|  1.67M|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (97:28): [True: 1.66M, False: 6.83k]
  ------------------
   98|  1.66M|          cbor_decref(&handle[i]);
   99|  6.83k|        _cbor_free(((struct cbor_indefinite_string_data*)item->data)->chunks);
  100|  6.83k|        _cbor_free(item->data);
  101|  6.83k|      }
  102|  2.61M|      break;
  103|  28.7M|    }
  104|  3.60M|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (104:5): [True: 3.60M, False: 59.7M]
  ------------------
  105|  3.60M|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (105:11): [True: 3.57M, False: 22.7k]
  ------------------
  106|  3.57M|        _cbor_free(item->data);
  107|  3.57M|      } else {
  108|       |        /* We need to decref all chunks */
  109|  22.7k|        cbor_item_t** handle = cbor_string_chunks_handle(item);
  110|  2.56M|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (110:28): [True: 2.54M, False: 22.7k]
  ------------------
  111|  2.54M|          cbor_decref(&handle[i]);
  112|  22.7k|        _cbor_free(((struct cbor_indefinite_string_data*)item->data)->chunks);
  113|  22.7k|        _cbor_free(item->data);
  114|  22.7k|      }
  115|  3.60M|      break;
  116|  28.7M|    }
  117|  18.8M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (117:5): [True: 18.8M, False: 44.5M]
  ------------------
  118|       |      /* Get all items and decref them */
  119|  18.8M|      cbor_item_t** handle = cbor_array_handle(item);
  120|  18.8M|      size_t size = cbor_array_size(item);
  121|  71.7M|      for (size_t i = 0; i < size; i++)
  ------------------
  |  Branch (121:26): [True: 52.9M, False: 18.8M]
  ------------------
  122|  52.9M|        if (handle[i] != NULL) cbor_decref(&handle[i]);
  ------------------
  |  Branch (122:13): [True: 52.9M, False: 0]
  ------------------
  123|  18.8M|      _cbor_free(item->data);
  124|  18.8M|      break;
  125|  28.7M|    }
  126|   120k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (126:5): [True: 120k, False: 63.2M]
  ------------------
  127|   120k|      struct cbor_pair* handle = cbor_map_handle(item);
  128|  2.91M|      for (size_t i = 0; i < item->metadata.map_metadata.end_ptr;
  ------------------
  |  Branch (128:26): [True: 2.79M, False: 120k]
  ------------------
  129|  2.79M|           i++, handle++) {
  130|  2.79M|        cbor_decref(&handle->key);
  131|  2.79M|        if (handle->value != NULL) cbor_decref(&handle->value);
  ------------------
  |  Branch (131:13): [True: 2.79M, False: 1.40k]
  ------------------
  132|  2.79M|      }
  133|   120k|      _cbor_free(item->data);
  134|   120k|      break;
  135|  28.7M|    }
  136|   536k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (136:5): [True: 536k, False: 62.8M]
  ------------------
  137|   536k|      if (item->metadata.tag_metadata.tagged_item != NULL)
  ------------------
  |  Branch (137:11): [True: 512k, False: 24.6k]
  ------------------
  138|   512k|        cbor_decref(&item->metadata.tag_metadata.tagged_item);
  139|   536k|      _cbor_free(item->data);
  140|   536k|      break;
  141|  28.7M|    }
  142|  3.03M|    case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (142:5): [True: 3.03M, False: 60.3M]
  ------------------
  143|       |      /* Floats have combined allocation */
  144|  3.03M|      break;
  145|  28.7M|    }
  146|  63.3M|  }
  147|  63.3M|  _cbor_free(item);
  148|  63.3M|}
cbor_move:
  154|  18.9M|cbor_item_t* cbor_move(cbor_item_t* item) {
  155|  18.9M|  if (item == NULL) return NULL;
  ------------------
  |  Branch (155:7): [True: 0, False: 18.9M]
  ------------------
  156|  18.9M|  item->refcount--;
  157|  18.9M|  return item;
  158|  18.9M|}

cbor.c:cbor_decref:
  352|  21.5M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  21.5M|  cbor_item_t* item = *item_ref;
  354|  21.5M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  21.5M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 21.5M]
  |  Branch (354:3): [True: 21.5M, False: 0]
  ------------------
  355|  21.5M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 115k, False: 21.4M]
  ------------------
  356|   115k|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|   115k|  }
  359|  21.5M|}
builder_callbacks.c:cbor_decref:
  352|  41.8M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  41.8M|  cbor_item_t* item = *item_ref;
  354|  41.8M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  41.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 41.8M]
  |  Branch (354:3): [True: 41.8M, False: 0]
  ------------------
  355|  41.8M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 100, False: 41.8M]
  ------------------
  356|    100|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|    100|  }
  359|  41.8M|}
arrays.c:cbor_incref:
  326|  71.0M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  71.0M|  item->refcount++;
  328|  71.0M|  return item;
  329|  71.0M|}
common.c:cbor_decref:
  352|  63.2M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  63.2M|  cbor_item_t* item = *item_ref;
  354|  63.2M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  63.2M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 63.2M]
  |  Branch (354:3): [True: 63.2M, False: 0]
  ------------------
  355|  63.2M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 63.2M, False: 0]
  ------------------
  356|  63.2M|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|  63.2M|  }
  359|  63.2M|}
bytestrings.c:cbor_incref:
  326|  1.66M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  1.66M|  item->refcount++;
  328|  1.66M|  return item;
  329|  1.66M|}
strings.c:cbor_incref:
  326|  2.54M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  2.54M|  item->refcount++;
  328|  2.54M|  return item;
  329|  2.54M|}
maps.c:cbor_incref:
  326|  5.59M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  5.59M|  item->refcount++;
  328|  5.59M|  return item;
  329|  5.59M|}
tags.c:cbor_incref:
  326|  1.39M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  1.39M|  item->refcount++;
  328|  1.39M|  return item;
  329|  1.39M|}

cbor_encode_uint8:
   15|  10.1M|                         size_t buffer_size) {
   16|  10.1M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x00);
   17|  10.1M|}
cbor_encode_uint16:
   20|  6.91k|                          size_t buffer_size) {
   21|  6.91k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x00);
   22|  6.91k|}
cbor_encode_uint32:
   25|   462k|                          size_t buffer_size) {
   26|   462k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x00);
   27|   462k|}
cbor_encode_uint64:
   30|  6.32k|                          size_t buffer_size) {
   31|  6.32k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x00);
   32|  6.32k|}
cbor_encode_negint8:
   40|  2.01M|                           size_t buffer_size) {
   41|  2.01M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x20);
   42|  2.01M|}
cbor_encode_negint16:
   45|  22.1k|                            size_t buffer_size) {
   46|  22.1k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x20);
   47|  22.1k|}
cbor_encode_negint32:
   50|  11.0k|                            size_t buffer_size) {
   51|  11.0k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x20);
   52|  11.0k|}
cbor_encode_negint64:
   55|  1.76k|                            size_t buffer_size) {
   56|  1.76k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x20);
   57|  1.76k|}
cbor_encode_bytestring_start:
   65|  1.02M|                                    size_t buffer_size) {
   66|  1.02M|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x40);
   67|  1.02M|}
_cbor_encode_byte:
   70|   819k|                         size_t buffer_size) {
   71|   819k|  if (buffer_size >= 1) {
  ------------------
  |  Branch (71:7): [True: 819k, False: 0]
  ------------------
   72|   819k|    buffer[0] = value;
   73|   819k|    return 1;
   74|   819k|  } else
   75|      0|    return 0;
   76|   819k|}
cbor_encode_indef_bytestring_start:
   79|  2.83k|                                          size_t buffer_size) {
   80|  2.83k|  return _cbor_encode_byte(0x5F, buffer, buffer_size);
   81|  2.83k|}
cbor_encode_string_start:
   84|   870k|                                size_t buffer_size) {
   85|   870k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x60);
   86|   870k|}
cbor_encode_indef_string_start:
   89|  8.97k|                                      size_t buffer_size) {
   90|  8.97k|  return _cbor_encode_byte(0x7F, buffer, buffer_size);
   91|  8.97k|}
cbor_encode_array_start:
   94|  5.46M|                               size_t buffer_size) {
   95|  5.46M|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x80);
   96|  5.46M|}
cbor_encode_indef_array_start:
   99|   395k|                                     size_t buffer_size) {
  100|   395k|  return _cbor_encode_byte(0x9F, buffer, buffer_size);
  101|   395k|}
cbor_encode_map_start:
  104|  39.1k|                             size_t buffer_size) {
  105|  39.1k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0xA0);
  106|  39.1k|}
cbor_encode_indef_map_start:
  108|  2.24k|size_t cbor_encode_indef_map_start(unsigned char* buffer, size_t buffer_size) {
  109|  2.24k|  return _cbor_encode_byte(0xBF, buffer, buffer_size);
  110|  2.24k|}
cbor_encode_tag:
  113|   220k|                       size_t buffer_size) {
  114|   220k|  return _cbor_encode_uint(value, buffer, buffer_size, 0xC0);
  115|   220k|}
cbor_encode_half:
  131|  95.9k|                        size_t buffer_size) {
  132|       |  // TODO: Broken on systems that do not use IEEE 754
  133|       |  /* Assuming value is normalized */
  134|  95.9k|  uint32_t val = ((union _cbor_float_helper){.as_float = value}).as_uint;
  135|  95.9k|  uint16_t res;
  136|  95.9k|  uint8_t exp = (uint8_t)((val & 0x7F800000u) >>
  137|  95.9k|                          23u); /* 0b0111_1111_1000_0000_0000_0000_0000_0000 */
  138|  95.9k|  uint32_t mant =
  139|  95.9k|      val & 0x7FFFFFu; /* 0b0000_0000_0111_1111_1111_1111_1111_1111 */
  140|  95.9k|  if (exp == 0xFF) {   /* Infinity or NaNs */
  ------------------
  |  Branch (140:7): [True: 6.52k, False: 89.4k]
  ------------------
  141|  6.52k|    if (isnan(value)) {
  ------------------
  |  Branch (141:9): [True: 5.38k, False: 1.13k]
  ------------------
  142|       |      /* Preserve the sign bit and NaN payload. The top 10 bits of the 23-bit
  143|       |       * single-precision mantissa map directly onto the 10-bit half-precision
  144|       |       * mantissa. If the payload fits entirely in the bottom 13 bits (which
  145|       |       * cannot be represented in half precision), fall back to a quiet NaN
  146|       |       * to avoid accidentally producing an infinity encoding (mantissa == 0).
  147|       |       * Note: signaling NaN payloads are preserved on a best-effort basis;
  148|       |       * some CPUs canonicalize them to quiet NaNs when loaded into registers.
  149|       |       * See https://github.com/PJK/libcbor/issues/215 */
  150|  5.38k|      uint16_t half_mant = (uint16_t)(mant >> 13u);
  151|  5.38k|      if (half_mant == 0) half_mant = 0x0200u; /* quiet NaN fallback */
  ------------------
  |  Branch (151:11): [True: 0, False: 5.38k]
  ------------------
  152|  5.38k|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u | half_mant);
  153|  5.38k|    } else {
  154|       |      // If the mantissa is non-zero, we have a NaN, but those are handled
  155|       |      // above. See
  156|       |      // https://en.wikipedia.org/wiki/Half-precision_floating-point_format
  157|  1.13k|      CBOR_ASSERT(mant == 0u);
  ------------------
  |  |   64|  1.13k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (157:7): [True: 0, False: 1.13k]
  |  Branch (157:7): [True: 1.13k, False: 0]
  ------------------
  158|  1.13k|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u);
  159|  1.13k|    }
  160|  89.4k|  } else if (exp == 0x00) { /* Zeroes or subnorms */
  ------------------
  |  Branch (160:14): [True: 1.41k, False: 87.9k]
  ------------------
  161|  1.41k|    res = (uint16_t)((val & 0x80000000u) >> 16u | mant >> 13u);
  162|  87.9k|  } else { /* Normal numbers */
  163|  87.9k|    int8_t logical_exp = (int8_t)(exp - 127);
  164|  87.9k|    CBOR_ASSERT(logical_exp == exp - 127);
  ------------------
  |  |   64|  87.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (164:5): [True: 0, False: 87.9k]
  |  Branch (164:5): [True: 87.9k, False: 0]
  ------------------
  165|       |
  166|       |    // Now we know that 2^exp <= 0 logically
  167|  87.9k|    if (logical_exp < -24) {
  ------------------
  |  Branch (167:9): [True: 0, False: 87.9k]
  ------------------
  168|       |      /* Too small to represent even as a half-precision subnormal; round to
  169|       |       * zero. The sign bit is preserved so that small negative values round
  170|       |       * to negative zero rather than positive zero. */
  171|      0|      res = (uint16_t)((val & 0x80000000u) >> 16u);
  172|  87.9k|    } else if (logical_exp < -14) {
  ------------------
  |  Branch (172:16): [True: 24.6k, False: 63.3k]
  ------------------
  173|       |      /* Offset the remaining decimal places by shifting the significand, the
  174|       |         value is lost. This is an implementation decision that works around the
  175|       |         absence of standard half-float in the language. */
  176|  24.6k|      res = (uint16_t)((val & 0x80000000u) >> 16u) |  // Extract sign bit
  177|  24.6k|            ((uint16_t)(1u << (24u + logical_exp)) +
  178|  24.6k|             (uint16_t)(((mant >> (-logical_exp - 2)) + 1) >>
  179|  24.6k|                        1));  // Round half away from zero for simplicity
  180|  63.3k|    } else if (logical_exp > 15) {
  ------------------
  |  Branch (180:16): [True: 0, False: 63.3k]
  ------------------
  181|       |      /* Too large to represent as a half-precision number (the largest
  182|       |       * finite half is 65504). Without this check, the exponent bits below
  183|       |       * would overflow past the 5-bit exponent field and corrupt the sign
  184|       |       * and mantissa bits, silently producing an unrelated finite value or
  185|       |       * a NaN instead of a correctly rounded result. Saturate to signed
  186|       |       * infinity instead, which is what other half-precision converters do
  187|       |       * for out-of-range finite inputs. */
  188|      0|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u);
  189|  63.3k|    } else {
  190|  63.3k|      res = (uint16_t)((val & 0x80000000u) >> 16u |
  191|  63.3k|                       ((((uint8_t)logical_exp) + 15u) << 10u) |
  192|  63.3k|                       (uint16_t)(mant >> 13u));
  193|  63.3k|    }
  194|  87.9k|  }
  195|  95.9k|  return _cbor_encode_uint16(res, buffer, buffer_size, 0xE0);
  196|  95.9k|}
cbor_encode_single:
  199|  10.1k|                          size_t buffer_size) {
  200|       |  // The bit pattern is copied verbatim, so NaN sign and payload bits are
  201|       |  // preserved. Signaling NaN payloads are preserved on a best-effort basis;
  202|       |  // some CPUs canonicalize them to quiet NaNs when loaded into registers.
  203|       |  // See https://github.com/PJK/libcbor/issues/215
  204|       |  // TODO: Broken on systems that do not use IEEE 754
  205|  10.1k|  return _cbor_encode_uint32(
  206|  10.1k|      ((union _cbor_float_helper){.as_float = value}).as_uint, buffer,
  207|  10.1k|      buffer_size, 0xE0);
  208|  10.1k|}
cbor_encode_double:
  211|  6.69k|                          size_t buffer_size) {
  212|       |  // See `cbor_encode_single` regarding NaNs
  213|       |  // TODO: Broken on systems that do not use IEEE 754
  214|  6.69k|  return _cbor_encode_uint64(
  215|  6.69k|      ((union _cbor_double_helper){.as_double = value}).as_uint, buffer,
  216|  6.69k|      buffer_size, 0xE0);
  217|  6.69k|}
cbor_encode_break:
  219|   409k|size_t cbor_encode_break(unsigned char* buffer, size_t buffer_size) {
  220|   409k|  return _cbor_encode_byte(0xFF, buffer, buffer_size);
  221|   409k|}
cbor_encode_ctrl:
  224|   573k|                        size_t buffer_size) {
  225|   573k|  return _cbor_encode_uint8(value, buffer, buffer_size, 0xE0);
  226|   573k|}

cbor_float_get_width:
   12|  16.4M|cbor_float_width cbor_float_get_width(const cbor_item_t* item) {
   13|  16.4M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|  16.4M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (13:3): [True: 0, False: 16.4M]
  |  Branch (13:3): [True: 16.4M, False: 0]
  ------------------
   14|  16.4M|  return item->metadata.float_ctrl_metadata.width;
   15|  16.4M|}
cbor_ctrl_value:
   17|  3.87M|uint8_t cbor_ctrl_value(const cbor_item_t* item) {
   18|  3.87M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|  3.87M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (18:3): [True: 0, False: 3.87M]
  |  Branch (18:3): [True: 3.87M, False: 0]
  ------------------
   19|  3.87M|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_0);
  ------------------
  |  |   64|  3.87M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (19:3): [True: 0, False: 3.87M]
  |  Branch (19:3): [True: 3.87M, False: 0]
  ------------------
   20|  3.87M|  return item->metadata.float_ctrl_metadata.ctrl;
   21|  3.87M|}
cbor_float_ctrl_is_ctrl:
   23|  2.55M|bool cbor_float_ctrl_is_ctrl(const cbor_item_t* item) {
   24|  2.55M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|  2.55M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (24:3): [True: 0, False: 2.55M]
  |  Branch (24:3): [True: 2.55M, False: 0]
  ------------------
   25|  2.55M|  return cbor_float_get_width(item) == CBOR_FLOAT_0;
   26|  2.55M|}
cbor_float_get_float2:
   28|   287k|float cbor_float_get_float2(const cbor_item_t* item) {
   29|   287k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|   287k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (29:3): [True: 0, False: 287k]
  |  Branch (29:3): [True: 287k, False: 0]
  ------------------
   30|   287k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_16);
  ------------------
  |  |   64|   287k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (30:3): [True: 0, False: 287k]
  |  Branch (30:3): [True: 287k, False: 0]
  ------------------
   31|   287k|  return *(float*)item->data;
   32|   287k|}
cbor_float_get_float4:
   34|  30.5k|float cbor_float_get_float4(const cbor_item_t* item) {
   35|  30.5k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|  30.5k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (35:3): [True: 0, False: 30.5k]
  |  Branch (35:3): [True: 30.5k, False: 0]
  ------------------
   36|  30.5k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_32);
  ------------------
  |  |   64|  30.5k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (36:3): [True: 0, False: 30.5k]
  |  Branch (36:3): [True: 30.5k, False: 0]
  ------------------
   37|  30.5k|  return *(float*)item->data;
   38|  30.5k|}
cbor_float_get_float8:
   40|  20.0k|double cbor_float_get_float8(const cbor_item_t* item) {
   41|  20.0k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|  20.0k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (41:3): [True: 0, False: 20.0k]
  |  Branch (41:3): [True: 20.0k, False: 0]
  ------------------
   42|  20.0k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_64);
  ------------------
  |  |   64|  20.0k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (42:3): [True: 0, False: 20.0k]
  |  Branch (42:3): [True: 20.0k, False: 0]
  ------------------
   43|  20.0k|  return *(double*)item->data;
   44|  20.0k|}
cbor_float_get_float:
   46|   112k|double cbor_float_get_float(const cbor_item_t* item) {
   47|   112k|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|   112k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (47:3): [True: 0, False: 112k]
  |  Branch (47:3): [True: 112k, False: 0]
  ------------------
   48|   112k|  CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   112k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (48:3): [True: 112k, False: 0]
  |  Branch (48:3): [True: 112k, False: 0]
  |  Branch (48:3): [True: 0, False: 112k]
  ------------------
   49|   112k|              cbor_float_get_width(item) <= CBOR_FLOAT_64);
   50|   112k|  switch (cbor_float_get_width(item)) {
   51|      0|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (51:5): [True: 0, False: 112k]
  ------------------
   52|      0|      return NAN;
   53|  95.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (53:5): [True: 95.9k, False: 16.8k]
  ------------------
   54|  95.9k|      return cbor_float_get_float2(item);
   55|  10.1k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (55:5): [True: 10.1k, False: 102k]
  ------------------
   56|  10.1k|      return cbor_float_get_float4(item);
   57|  6.69k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (57:5): [True: 6.69k, False: 106k]
  ------------------
   58|  6.69k|      return cbor_float_get_float8(item);
   59|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (59:5): [True: 0, False: 112k]
  ------------------
   60|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   61|      0|      return 0;  // LCOV_EXCL_STOP
   62|   112k|  }
   63|   112k|}
cbor_get_bool:
   65|   429k|bool cbor_get_bool(const cbor_item_t* item) {
   66|   429k|  CBOR_ASSERT(cbor_is_bool(item));
  ------------------
  |  |   64|   429k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (66:3): [True: 0, False: 429k]
  |  Branch (66:3): [True: 429k, False: 0]
  ------------------
   67|   429k|  return item->metadata.float_ctrl_metadata.ctrl == CBOR_CTRL_TRUE;
   68|   429k|}
cbor_set_float2:
   70|   207k|void cbor_set_float2(cbor_item_t* item, float value) {
   71|   207k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|   207k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (71:3): [True: 0, False: 207k]
  |  Branch (71:3): [True: 207k, False: 0]
  ------------------
   72|   207k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_16);
  ------------------
  |  |   64|   207k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (72:3): [True: 0, False: 207k]
  |  Branch (72:3): [True: 207k, False: 0]
  ------------------
   73|   207k|  *((float*)item->data) = value;
   74|   207k|}
cbor_set_float4:
   76|  20.9k|void cbor_set_float4(cbor_item_t* item, float value) {
   77|  20.9k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|  20.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (77:3): [True: 0, False: 20.9k]
  |  Branch (77:3): [True: 20.9k, False: 0]
  ------------------
   78|  20.9k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_32);
  ------------------
  |  |   64|  20.9k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (78:3): [True: 0, False: 20.9k]
  |  Branch (78:3): [True: 20.9k, False: 0]
  ------------------
   79|  20.9k|  *((float*)item->data) = value;
   80|  20.9k|}
cbor_set_float8:
   82|  32.6k|void cbor_set_float8(cbor_item_t* item, double value) {
   83|  32.6k|  CBOR_ASSERT(cbor_is_float(item));
  ------------------
  |  |   64|  32.6k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (83:3): [True: 0, False: 32.6k]
  |  Branch (83:3): [True: 32.6k, False: 0]
  ------------------
   84|  32.6k|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_64);
  ------------------
  |  |   64|  32.6k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (84:3): [True: 0, False: 32.6k]
  |  Branch (84:3): [True: 32.6k, False: 0]
  ------------------
   85|  32.6k|  *((double*)item->data) = value;
   86|  32.6k|}
cbor_set_ctrl:
   88|  2.77M|void cbor_set_ctrl(cbor_item_t* item, uint8_t value) {
   89|  2.77M|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|  2.77M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (89:3): [True: 0, False: 2.77M]
  |  Branch (89:3): [True: 2.77M, False: 0]
  ------------------
   90|  2.77M|  CBOR_ASSERT(cbor_float_get_width(item) == CBOR_FLOAT_0);
  ------------------
  |  |   64|  2.77M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (90:3): [True: 0, False: 2.77M]
  |  Branch (90:3): [True: 2.77M, False: 0]
  ------------------
   91|  2.77M|  item->metadata.float_ctrl_metadata.ctrl = value;
   92|  2.77M|}
cbor_new_ctrl:
  100|  2.77M|cbor_item_t* cbor_new_ctrl(void) {
  101|  2.77M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
  102|  2.77M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  2.77M|  do {                           \
  |  |  127|  2.77M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 10, False: 2.77M]
  |  |  ------------------
  |  |  128|     10|      return NULL;               \
  |  |  129|     10|    }                            \
  |  |  130|  2.77M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 2.77M]
  |  |  ------------------
  ------------------
  103|       |
  104|  2.77M|  *item = (cbor_item_t){
  105|  2.77M|      .type = CBOR_TYPE_FLOAT_CTRL,
  106|       |      .data = NULL,
  107|  2.77M|      .refcount = 1,
  108|  2.77M|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_0,
  109|  2.77M|                                           .ctrl = CBOR_CTRL_NONE}}};
  110|  2.77M|  return item;
  111|  2.77M|}
cbor_new_float2:
  113|   207k|cbor_item_t* cbor_new_float2(void) {
  114|   207k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  115|   207k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   207k|  do {                           \
  |  |  127|   207k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 207k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   207k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 207k]
  |  |  ------------------
  ------------------
  116|       |
  117|   207k|  *item = (cbor_item_t){
  118|   207k|      .type = CBOR_TYPE_FLOAT_CTRL,
  119|   207k|      .data = (unsigned char*)item + sizeof(cbor_item_t),
  120|   207k|      .refcount = 1,
  121|   207k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_16}}};
  122|   207k|  return item;
  123|   207k|}
cbor_new_float4:
  125|  20.9k|cbor_item_t* cbor_new_float4(void) {
  126|  20.9k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  127|  20.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  20.9k|  do {                           \
  |  |  127|  20.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 20.9k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  20.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 20.9k]
  |  |  ------------------
  ------------------
  128|       |
  129|  20.9k|  *item = (cbor_item_t){
  130|  20.9k|      .type = CBOR_TYPE_FLOAT_CTRL,
  131|  20.9k|      .data = (unsigned char*)item + sizeof(cbor_item_t),
  132|  20.9k|      .refcount = 1,
  133|  20.9k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_32}}};
  134|  20.9k|  return item;
  135|  20.9k|}
cbor_new_float8:
  137|  32.6k|cbor_item_t* cbor_new_float8(void) {
  138|  32.6k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 8);
  139|  32.6k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  32.6k|  do {                           \
  |  |  127|  32.6k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 32.6k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  32.6k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 32.6k]
  |  |  ------------------
  ------------------
  140|       |
  141|  32.6k|  *item = (cbor_item_t){
  142|  32.6k|      .type = CBOR_TYPE_FLOAT_CTRL,
  143|  32.6k|      .data = (unsigned char*)item + sizeof(cbor_item_t),
  144|  32.6k|      .refcount = 1,
  145|  32.6k|      .metadata = {.float_ctrl_metadata = {.width = CBOR_FLOAT_64}}};
  146|  32.6k|  return item;
  147|  32.6k|}
cbor_new_null:
  149|  1.27M|cbor_item_t* cbor_new_null(void) {
  150|  1.27M|  cbor_item_t* item = cbor_new_ctrl();
  151|  1.27M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  1.27M|  do {                           \
  |  |  127|  1.27M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 10, False: 1.27M]
  |  |  ------------------
  |  |  128|     10|      return NULL;               \
  |  |  129|     10|    }                            \
  |  |  130|  1.27M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 1.27M]
  |  |  ------------------
  ------------------
  152|  1.27M|  cbor_set_ctrl(item, CBOR_CTRL_NULL);
  153|  1.27M|  return item;
  154|  1.27M|}
cbor_new_undef:
  156|  28.7k|cbor_item_t* cbor_new_undef(void) {
  157|  28.7k|  cbor_item_t* item = cbor_new_ctrl();
  158|  28.7k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  28.7k|  do {                           \
  |  |  127|  28.7k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 28.7k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  28.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 28.7k]
  |  |  ------------------
  ------------------
  159|  28.7k|  cbor_set_ctrl(item, CBOR_CTRL_UNDEF);
  160|  28.7k|  return item;
  161|  28.7k|}
cbor_build_bool:
  163|   885k|cbor_item_t* cbor_build_bool(bool value) {
  164|   885k|  return cbor_build_ctrl(value ? CBOR_CTRL_TRUE : CBOR_CTRL_FALSE);
  ------------------
  |  Branch (164:26): [True: 766k, False: 118k]
  ------------------
  165|   885k|}
cbor_build_float2:
  167|  95.9k|cbor_item_t* cbor_build_float2(float value) {
  168|  95.9k|  cbor_item_t* item = cbor_new_float2();
  169|  95.9k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  95.9k|  do {                           \
  |  |  127|  95.9k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 95.9k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  95.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 95.9k]
  |  |  ------------------
  ------------------
  170|  95.9k|  cbor_set_float2(item, value);
  171|  95.9k|  return item;
  172|  95.9k|}
cbor_build_float4:
  174|  10.1k|cbor_item_t* cbor_build_float4(float value) {
  175|  10.1k|  cbor_item_t* item = cbor_new_float4();
  176|  10.1k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  10.1k|  do {                           \
  |  |  127|  10.1k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 10.1k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  10.1k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 10.1k]
  |  |  ------------------
  ------------------
  177|  10.1k|  cbor_set_float4(item, value);
  178|  10.1k|  return item;
  179|  10.1k|}
cbor_build_float8:
  181|  6.69k|cbor_item_t* cbor_build_float8(double value) {
  182|  6.69k|  cbor_item_t* item = cbor_new_float8();
  183|  6.69k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  6.69k|  do {                           \
  |  |  127|  6.69k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 6.69k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  6.69k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 6.69k]
  |  |  ------------------
  ------------------
  184|  6.69k|  cbor_set_float8(item, value);
  185|  6.69k|  return item;
  186|  6.69k|}
cbor_build_ctrl:
  188|  1.47M|cbor_item_t* cbor_build_ctrl(uint8_t value) {
  189|  1.47M|  cbor_item_t* item = cbor_new_ctrl();
  190|  1.47M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  1.47M|  do {                           \
  |  |  127|  1.47M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 1.47M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  1.47M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 1.47M]
  |  |  ------------------
  ------------------
  191|  1.47M|  cbor_set_ctrl(item, value);
  192|  1.47M|  return item;
  193|  1.47M|}

_cbor_builder_append:
   25|  38.6M|                          struct _cbor_decoder_context* ctx) {
   26|  38.6M|  if (ctx->stack->size == 0) {
  ------------------
  |  Branch (26:7): [True: 1.25k, False: 38.6M]
  ------------------
   27|       |    /* Top level item */
   28|  1.25k|    ctx->root = item;
   29|  1.25k|    return;
   30|  1.25k|  }
   31|       |  /* Part of a bigger structure */
   32|  38.6M|  switch (ctx->stack->top->item->type) {
   33|       |    // Handle Arrays and Maps since they can contain subitems of any type.
   34|       |    // Byte/string construction from chunks is handled in the respective chunk
   35|       |    // handlers.
   36|  34.8M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (36:5): [True: 34.8M, False: 3.84M]
  ------------------
   37|  34.8M|      if (cbor_array_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (37:11): [True: 12.9M, False: 21.8M]
  ------------------
   38|       |        // We don't need an explicit check for whether the item still belongs
   39|       |        // into this array because if there are extra items, they will cause a
   40|       |        // syntax error when decoded.
   41|  12.9M|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   64|  12.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (41:9): [True: 0, False: 12.9M]
  |  Branch (41:9): [True: 12.9M, False: 0]
  ------------------
   42|       |        // This should never happen since the definite array should be
   43|       |        // preallocated for the expected number of items.
   44|  12.9M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (44:13): [True: 0, False: 12.9M]
  ------------------
   45|      0|          ctx->creation_failed = true;
   46|      0|          cbor_decref(&item);
   47|      0|          break;
   48|      0|        }
   49|  12.9M|        cbor_decref(&item);
   50|  12.9M|        ctx->stack->top->subitems--;
   51|  12.9M|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (51:13): [True: 12.1M, False: 818k]
  ------------------
   52|  12.1M|          cbor_item_t* stack_item = ctx->stack->top->item;
   53|  12.1M|          _cbor_stack_pop(ctx->stack);
   54|  12.1M|          _cbor_builder_append(stack_item, ctx);
   55|  12.1M|        }
   56|  21.8M|      } else {
   57|       |        /* Indefinite array, don't bother with subitems */
   58|  21.8M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (58:13): [True: 1, False: 21.8M]
  ------------------
   59|      1|          ctx->creation_failed = true;
   60|      1|        }
   61|  21.8M|        cbor_decref(&item);
   62|  21.8M|      }
   63|  34.8M|      break;
   64|  34.8M|    }
   65|  34.8M|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (65:5): [True: 3.55M, False: 35.1M]
  ------------------
   66|       |      // Handle both definite and indefinite maps the same initially.
   67|       |      // Note: We use 0 and 1 subitems to distinguish between keys and values in
   68|       |      // indefinite items
   69|  3.55M|      if (ctx->stack->top->subitems % 2) {
  ------------------
  |  Branch (69:11): [True: 1.77M, False: 1.77M]
  ------------------
   70|       |        // Odd record, this is a value.
   71|  1.77M|        ctx->creation_failed =
   72|  1.77M|            !_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.77M|        CBOR_ASSERT(!ctx->creation_failed);
  ------------------
  |  |   64|  1.77M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (75:9): [True: 0, False: 1.77M]
  |  Branch (75:9): [True: 1.77M, False: 0]
  ------------------
   76|  1.77M|      } else {
   77|       |        // Even record, this is a key.
   78|  1.77M|        if (!_cbor_map_add_key(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (78:13): [True: 0, False: 1.77M]
  ------------------
   79|      0|          ctx->creation_failed = true;
   80|      0|          cbor_decref(&item);
   81|      0|          break;
   82|      0|        }
   83|  1.77M|      }
   84|  3.55M|      cbor_decref(&item);
   85|  3.55M|      if (cbor_map_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (85:11): [True: 944k, False: 2.61M]
  ------------------
   86|   944k|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   64|   944k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (86:9): [True: 0, False: 944k]
  |  Branch (86:9): [True: 944k, False: 0]
  ------------------
   87|   944k|        ctx->stack->top->subitems--;
   88|   944k|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (88:13): [True: 45.7k, False: 899k]
  ------------------
   89|  45.7k|          cbor_item_t* map_entry = ctx->stack->top->item;
   90|  45.7k|          _cbor_stack_pop(ctx->stack);
   91|  45.7k|          _cbor_builder_append(map_entry, ctx);
   92|  45.7k|        }
   93|  2.61M|      } else {
   94|  2.61M|        ctx->stack->top->subitems ^=
   95|  2.61M|            1; /* Flip the indicator for indefinite items */
   96|  2.61M|      }
   97|  3.55M|      break;
   98|  3.55M|    }
   99|  3.55M|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (99:5): [True: 292k, False: 38.4M]
  ------------------
  100|   292k|      CBOR_ASSERT(ctx->stack->top->subitems == 1);
  ------------------
  |  |   64|   292k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (100:7): [True: 0, False: 292k]
  |  Branch (100:7): [True: 292k, False: 0]
  ------------------
  101|   292k|      cbor_tag_set_item(ctx->stack->top->item, item);
  102|   292k|      cbor_decref(&item); /* Give up on our reference */
  103|   292k|      cbor_item_t* tagged_item = ctx->stack->top->item;
  104|   292k|      _cbor_stack_pop(ctx->stack);
  105|   292k|      _cbor_builder_append(tagged_item, ctx);
  106|   292k|      break;
  107|   292k|    }
  108|       |    // We have an item to append but nothing to append it to.
  109|     84|    default: {
  ------------------
  |  Branch (109:5): [True: 84, False: 38.6M]
  ------------------
  110|     84|      cbor_decref(&item);
  111|     84|      ctx->syntax_error = true;
  112|     84|    }
  113|  38.6M|  }
  114|  38.6M|}
cbor_builder_uint8_callback:
  144|  17.5M|void cbor_builder_uint8_callback(void* context, uint8_t value) {
  145|  17.5M|  struct _cbor_decoder_context* ctx = context;
  146|  17.5M|  cbor_item_t* res = cbor_new_int8();
  147|  17.5M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  17.5M|  do {                             \
  |  |  118|  17.5M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 6, False: 17.5M]
  |  |  ------------------
  |  |  119|      6|      ctx->creation_failed = true; \
  |  |  120|      6|      return;                      \
  |  |  121|      6|    }                              \
  |  |  122|  17.5M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 17.5M]
  |  |  ------------------
  ------------------
  148|  17.5M|  cbor_mark_uint(res);
  149|  17.5M|  cbor_set_uint8(res, value);
  150|  17.5M|  _cbor_builder_append(res, ctx);
  151|  17.5M|}
cbor_builder_uint16_callback:
  153|  7.62k|void cbor_builder_uint16_callback(void* context, uint16_t value) {
  154|  7.62k|  struct _cbor_decoder_context* ctx = context;
  155|  7.62k|  cbor_item_t* res = cbor_new_int16();
  156|  7.62k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  7.62k|  do {                             \
  |  |  118|  7.62k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 7.62k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  7.62k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 7.62k]
  |  |  ------------------
  ------------------
  157|  7.62k|  cbor_mark_uint(res);
  158|  7.62k|  cbor_set_uint16(res, value);
  159|  7.62k|  _cbor_builder_append(res, ctx);
  160|  7.62k|}
cbor_builder_uint32_callback:
  162|   477k|void cbor_builder_uint32_callback(void* context, uint32_t value) {
  163|   477k|  struct _cbor_decoder_context* ctx = context;
  164|   477k|  cbor_item_t* res = cbor_new_int32();
  165|   477k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   477k|  do {                             \
  |  |  118|   477k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 477k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   477k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 477k]
  |  |  ------------------
  ------------------
  166|   477k|  cbor_mark_uint(res);
  167|   477k|  cbor_set_uint32(res, value);
  168|   477k|  _cbor_builder_append(res, ctx);
  169|   477k|}
cbor_builder_uint64_callback:
  171|  9.42k|void cbor_builder_uint64_callback(void* context, uint64_t value) {
  172|  9.42k|  struct _cbor_decoder_context* ctx = context;
  173|  9.42k|  cbor_item_t* res = cbor_new_int64();
  174|  9.42k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  9.42k|  do {                             \
  |  |  118|  9.42k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 9.42k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  9.42k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 9.42k]
  |  |  ------------------
  ------------------
  175|  9.42k|  cbor_mark_uint(res);
  176|  9.42k|  cbor_set_uint64(res, value);
  177|  9.42k|  _cbor_builder_append(res, ctx);
  178|  9.42k|}
cbor_builder_negint8_callback:
  180|  3.78M|void cbor_builder_negint8_callback(void* context, uint8_t value) {
  181|  3.78M|  struct _cbor_decoder_context* ctx = context;
  182|  3.78M|  cbor_item_t* res = cbor_new_int8();
  183|  3.78M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  3.78M|  do {                             \
  |  |  118|  3.78M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 1, False: 3.78M]
  |  |  ------------------
  |  |  119|      1|      ctx->creation_failed = true; \
  |  |  120|      1|      return;                      \
  |  |  121|      1|    }                              \
  |  |  122|  3.78M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 3.78M]
  |  |  ------------------
  ------------------
  184|  3.78M|  cbor_mark_negint(res);
  185|  3.78M|  cbor_set_uint8(res, value);
  186|  3.78M|  _cbor_builder_append(res, ctx);
  187|  3.78M|}
cbor_builder_negint16_callback:
  189|  46.1k|void cbor_builder_negint16_callback(void* context, uint16_t value) {
  190|  46.1k|  struct _cbor_decoder_context* ctx = context;
  191|  46.1k|  cbor_item_t* res = cbor_new_int16();
  192|  46.1k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  46.1k|  do {                             \
  |  |  118|  46.1k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 46.1k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  46.1k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 46.1k]
  |  |  ------------------
  ------------------
  193|  46.1k|  cbor_mark_negint(res);
  194|  46.1k|  cbor_set_uint16(res, value);
  195|  46.1k|  _cbor_builder_append(res, ctx);
  196|  46.1k|}
cbor_builder_negint32_callback:
  198|  11.9k|void cbor_builder_negint32_callback(void* context, uint32_t value) {
  199|  11.9k|  struct _cbor_decoder_context* ctx = context;
  200|  11.9k|  cbor_item_t* res = cbor_new_int32();
  201|  11.9k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  11.9k|  do {                             \
  |  |  118|  11.9k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 11.9k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  11.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 11.9k]
  |  |  ------------------
  ------------------
  202|  11.9k|  cbor_mark_negint(res);
  203|  11.9k|  cbor_set_uint32(res, value);
  204|  11.9k|  _cbor_builder_append(res, ctx);
  205|  11.9k|}
cbor_builder_negint64_callback:
  207|  3.84k|void cbor_builder_negint64_callback(void* context, uint64_t value) {
  208|  3.84k|  struct _cbor_decoder_context* ctx = context;
  209|  3.84k|  cbor_item_t* res = cbor_new_int64();
  210|  3.84k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  3.84k|  do {                             \
  |  |  118|  3.84k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 3.84k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  3.84k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 3.84k]
  |  |  ------------------
  ------------------
  211|  3.84k|  cbor_mark_negint(res);
  212|  3.84k|  cbor_set_uint64(res, value);
  213|  3.84k|  _cbor_builder_append(res, ctx);
  214|  3.84k|}
cbor_builder_byte_string_callback:
  217|  1.58M|                                       uint64_t length) {
  218|  1.58M|  struct _cbor_decoder_context* ctx = context;
  219|  1.58M|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  129|  1.58M|  do {                             \
  |  |  130|  1.58M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 1.58M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  1.58M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 1.58M]
  |  |  ------------------
  ------------------
  220|       |  // malloc(0) may legitimately return NULL, so do not allocate for an empty
  221|       |  // chunk; the handle will be NULL and never dereferenced.
  222|  1.58M|  unsigned char* new_handle = NULL;
  223|  1.58M|  if (length > 0) {
  ------------------
  |  Branch (223:7): [True: 1.56M, False: 18.3k]
  ------------------
  224|  1.56M|    new_handle = _cbor_malloc(length);
  225|  1.56M|    if (new_handle == NULL) {
  ------------------
  |  Branch (225:9): [True: 0, False: 1.56M]
  ------------------
  226|      0|      ctx->creation_failed = true;
  227|      0|      return;
  228|      0|    }
  229|  1.56M|    memcpy(new_handle, data, length);
  230|  1.56M|  }
  231|  1.58M|  cbor_item_t* new_chunk = cbor_new_definite_bytestring();
  232|       |
  233|  1.58M|  if (new_chunk == NULL) {
  ------------------
  |  Branch (233:7): [True: 0, False: 1.58M]
  ------------------
  234|      0|    _cbor_free(new_handle);
  235|      0|    ctx->creation_failed = true;
  236|      0|    return;
  237|      0|  }
  238|       |
  239|  1.58M|  cbor_bytestring_set_handle(new_chunk, new_handle, length);
  240|       |
  241|       |  // If an indef bytestring is on the stack, extend it (if it were closed, it
  242|       |  // would have been popped). Handle any syntax errors upstream.
  243|  1.58M|  if (ctx->stack->size > 0 && cbor_isa_bytestring(ctx->stack->top->item) &&
  ------------------
  |  Branch (243:7): [True: 1.58M, False: 24]
  |  Branch (243:31): [True: 1.09M, False: 486k]
  ------------------
  244|  1.09M|      cbor_bytestring_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (244:7): [True: 1.09M, False: 0]
  ------------------
  245|  1.09M|    if (!cbor_bytestring_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (245:9): [True: 0, False: 1.09M]
  ------------------
  246|      0|      ctx->creation_failed = true;
  247|      0|    }
  248|  1.09M|    cbor_decref(&new_chunk);
  249|  1.09M|  } else {
  250|   486k|    _cbor_builder_append(new_chunk, ctx);
  251|   486k|  }
  252|  1.58M|}
cbor_builder_byte_string_start_callback:
  254|  4.00k|void cbor_builder_byte_string_start_callback(void* context) {
  255|  4.00k|  struct _cbor_decoder_context* ctx = context;
  256|  4.00k|  cbor_item_t* res = cbor_new_indefinite_bytestring();
  257|  4.00k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  4.00k|  do {                             \
  |  |  118|  4.00k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 4.00k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  4.00k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 4.00k]
  |  |  ------------------
  ------------------
  258|  4.00k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  4.00k|  do {                                                         \
  |  |  138|  4.00k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 4.00k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  4.00k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 4.00k]
  |  |  ------------------
  ------------------
  259|  4.00k|}
cbor_builder_string_callback:
  262|  2.70M|                                  uint64_t length) {
  263|  2.70M|  struct _cbor_decoder_context* ctx = context;
  264|  2.70M|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  129|  2.70M|  do {                             \
  |  |  130|  2.70M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 2.70M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  2.70M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 2.70M]
  |  |  ------------------
  ------------------
  265|       |  // malloc(0) may legitimately return NULL, so do not allocate for an empty
  266|       |  // chunk; the handle will be NULL and never dereferenced.
  267|  2.70M|  unsigned char* new_handle = NULL;
  268|  2.70M|  if (length > 0) {
  ------------------
  |  Branch (268:7): [True: 2.67M, False: 30.5k]
  ------------------
  269|  2.67M|    new_handle = _cbor_malloc(length);
  270|  2.67M|    if (new_handle == NULL) {
  ------------------
  |  Branch (270:9): [True: 0, False: 2.67M]
  ------------------
  271|      0|      ctx->creation_failed = true;
  272|      0|      return;
  273|      0|    }
  274|  2.67M|    memcpy(new_handle, data, length);
  275|  2.67M|  }
  276|  2.70M|  cbor_item_t* new_chunk = cbor_new_definite_string();
  277|  2.70M|  if (new_chunk == NULL) {
  ------------------
  |  Branch (277:7): [True: 0, False: 2.70M]
  ------------------
  278|      0|    _cbor_free(new_handle);
  279|      0|    ctx->creation_failed = true;
  280|      0|    return;
  281|      0|  }
  282|  2.70M|  cbor_string_set_handle(new_chunk, new_handle, length);
  283|       |
  284|       |  // If an indef string is on the stack, extend it (if it were closed, it would
  285|       |  // have been popped). Handle any syntax errors upstream.
  286|  2.70M|  if (ctx->stack->size > 0 && cbor_isa_string(ctx->stack->top->item) &&
  ------------------
  |  Branch (286:7): [True: 2.70M, False: 26]
  |  Branch (286:31): [True: 2.01M, False: 691k]
  ------------------
  287|  2.01M|      cbor_string_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (287:7): [True: 2.01M, False: 0]
  ------------------
  288|  2.01M|    if (!cbor_string_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (288:9): [True: 0, False: 2.01M]
  ------------------
  289|      0|      ctx->creation_failed = true;
  290|      0|    }
  291|  2.01M|    cbor_decref(&new_chunk);
  292|  2.01M|  } else {
  293|   691k|    _cbor_builder_append(new_chunk, ctx);
  294|   691k|  }
  295|  2.70M|}
cbor_builder_string_start_callback:
  297|  13.7k|void cbor_builder_string_start_callback(void* context) {
  298|  13.7k|  struct _cbor_decoder_context* ctx = context;
  299|  13.7k|  cbor_item_t* res = cbor_new_indefinite_string();
  300|  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, False: 13.7k]
  |  |  ------------------
  ------------------
  301|  13.7k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  13.7k|  do {                                                         \
  |  |  138|  13.7k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 13.7k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  13.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 13.7k]
  |  |  ------------------
  ------------------
  302|  13.7k|}
cbor_builder_array_start_callback:
  304|  12.1M|void cbor_builder_array_start_callback(void* context, uint64_t size) {
  305|  12.1M|  struct _cbor_decoder_context* ctx = context;
  306|  12.1M|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  129|  12.1M|  do {                             \
  |  |  130|  12.1M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 12.1M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  12.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 12.1M]
  |  |  ------------------
  ------------------
  307|  12.1M|  cbor_item_t* res = cbor_new_definite_array(size);
  308|  12.1M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  12.1M|  do {                             \
  |  |  118|  12.1M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 109, False: 12.1M]
  |  |  ------------------
  |  |  119|    109|      ctx->creation_failed = true; \
  |  |  120|    109|      return;                      \
  |  |  121|    109|    }                              \
  |  |  122|  12.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 12.1M]
  |  |  ------------------
  ------------------
  309|  12.1M|  if (size > 0) {
  ------------------
  |  Branch (309:7): [True: 12.1M, False: 471]
  ------------------
  310|  12.1M|    PUSH_CTX_STACK(ctx, res, size);
  ------------------
  |  |  137|  12.1M|  do {                                                         \
  |  |  138|  12.1M|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 5, False: 12.1M]
  |  |  ------------------
  |  |  139|      5|      cbor_decref(&res);                                       \
  |  |  140|      5|      ctx->creation_failed = true;                             \
  |  |  141|      5|    }                                                          \
  |  |  142|  12.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 12.1M]
  |  |  ------------------
  ------------------
  311|  12.1M|  } else {
  312|    471|    _cbor_builder_append(res, ctx);
  313|    471|  }
  314|  12.1M|}
cbor_builder_indef_array_start_callback:
  316|   807k|void cbor_builder_indef_array_start_callback(void* context) {
  317|   807k|  struct _cbor_decoder_context* ctx = context;
  318|   807k|  cbor_item_t* res = cbor_new_indefinite_array();
  319|   807k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   807k|  do {                             \
  |  |  118|   807k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 807k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   807k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 807k]
  |  |  ------------------
  ------------------
  320|   807k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|   807k|  do {                                                         \
  |  |  138|   807k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 3, False: 807k]
  |  |  ------------------
  |  |  139|      3|      cbor_decref(&res);                                       \
  |  |  140|      3|      ctx->creation_failed = true;                             \
  |  |  141|      3|    }                                                          \
  |  |  142|   807k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 807k]
  |  |  ------------------
  ------------------
  321|   807k|}
cbor_builder_indef_map_start_callback:
  323|  6.99k|void cbor_builder_indef_map_start_callback(void* context) {
  324|  6.99k|  struct _cbor_decoder_context* ctx = context;
  325|  6.99k|  cbor_item_t* res = cbor_new_indefinite_map();
  326|  6.99k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  6.99k|  do {                             \
  |  |  118|  6.99k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 6.99k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  6.99k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 6.99k]
  |  |  ------------------
  ------------------
  327|  6.99k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  6.99k|  do {                                                         \
  |  |  138|  6.99k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 6.99k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  6.99k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 6.99k]
  |  |  ------------------
  ------------------
  328|  6.99k|}
cbor_builder_map_start_callback:
  330|  71.7k|void cbor_builder_map_start_callback(void* context, uint64_t size) {
  331|  71.7k|  struct _cbor_decoder_context* ctx = context;
  332|  71.7k|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  129|  71.7k|  do {                             \
  |  |  130|  71.7k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 71.7k]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  71.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 71.7k]
  |  |  ------------------
  ------------------
  333|       |  // Each map entry requires two subitems (key + value). Guard against
  334|       |  // overflow in size * 2 before it is used as the subitems count.
  335|  71.7k|  if (size > SIZE_MAX / 2) {
  ------------------
  |  Branch (335:7): [True: 65, False: 71.6k]
  ------------------
  336|     65|    ctx->creation_failed = true;
  337|     65|    return;
  338|     65|  }
  339|  71.6k|  cbor_item_t* res = cbor_new_definite_map(size);
  340|  71.6k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  71.6k|  do {                             \
  |  |  118|  71.6k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 99, False: 71.5k]
  |  |  ------------------
  |  |  119|     99|      ctx->creation_failed = true; \
  |  |  120|     99|      return;                      \
  |  |  121|     99|    }                              \
  |  |  122|  71.6k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 71.5k]
  |  |  ------------------
  ------------------
  341|  71.5k|  if (size > 0) {
  ------------------
  |  Branch (341:7): [True: 70.9k, False: 620]
  ------------------
  342|  70.9k|    PUSH_CTX_STACK(ctx, res, size * 2);
  ------------------
  |  |  137|  70.9k|  do {                                                         \
  |  |  138|  70.9k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 70.9k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  70.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 70.9k]
  |  |  ------------------
  ------------------
  343|  70.9k|  } else {
  344|    620|    _cbor_builder_append(res, ctx);
  345|    620|  }
  346|  71.5k|}
_cbor_is_indefinite:
  351|   798k|bool _cbor_is_indefinite(cbor_item_t* item) {
  352|   798k|  switch (item->type) {
  353|  2.88k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (353:5): [True: 2.88k, False: 796k]
  ------------------
  354|  2.88k|      return cbor_bytestring_is_indefinite(item);
  355|  13.3k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (355:5): [True: 13.3k, False: 785k]
  ------------------
  356|  13.3k|      return cbor_string_is_indefinite(item);
  357|   778k|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (357:5): [True: 778k, False: 20.7k]
  ------------------
  358|   778k|      return cbor_array_is_indefinite(item);
  359|  4.52k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (359:5): [True: 4.52k, False: 794k]
  ------------------
  360|  4.52k|      return cbor_map_is_indefinite(item);
  361|      3|    default:
  ------------------
  |  Branch (361:5): [True: 3, False: 798k]
  ------------------
  362|       |      // Should never happen since a non-nested item cannot be on top of the
  363|       |      // stack.
  364|      3|      return false;
  365|   798k|  }
  366|   798k|}
cbor_builder_indef_break_callback:
  368|   798k|void cbor_builder_indef_break_callback(void* context) {
  369|   798k|  struct _cbor_decoder_context* ctx = context;
  370|       |  /* There must be an item to break out of*/
  371|   798k|  if (ctx->stack->size > 0) {
  ------------------
  |  Branch (371:7): [True: 798k, False: 1]
  ------------------
  372|   798k|    cbor_item_t* item = ctx->stack->top->item;
  373|   798k|    if (_cbor_is_indefinite(
  ------------------
  |  Branch (373:9): [True: 798k, False: 22]
  ------------------
  374|   798k|            item) && /* Only indefinite items can be terminated by 0xFF */
  375|       |        /* Special case: we cannot append up if an indefinite map is incomplete
  376|       |           (we are expecting a value). */
  377|   798k|        (item->type != CBOR_TYPE_MAP || ctx->stack->top->subitems % 2 == 0)) {
  ------------------
  |  Branch (377:10): [True: 794k, False: 4.51k]
  |  Branch (377:41): [True: 4.50k, False: 13]
  ------------------
  378|   798k|      _cbor_stack_pop(ctx->stack);
  379|   798k|      _cbor_builder_append(item, ctx);
  380|   798k|      return;
  381|   798k|    }
  382|   798k|  }
  383|       |
  384|     36|  ctx->syntax_error = true;
  385|     36|}
cbor_builder_float2_callback:
  387|   111k|void cbor_builder_float2_callback(void* context, float value) {
  388|   111k|  struct _cbor_decoder_context* ctx = context;
  389|   111k|  cbor_item_t* res = cbor_new_float2();
  390|   111k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   111k|  do {                             \
  |  |  118|   111k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 111k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   111k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 111k]
  |  |  ------------------
  ------------------
  391|   111k|  cbor_set_float2(res, value);
  392|   111k|  _cbor_builder_append(res, ctx);
  393|   111k|}
cbor_builder_float4_callback:
  395|  10.8k|void cbor_builder_float4_callback(void* context, float value) {
  396|  10.8k|  struct _cbor_decoder_context* ctx = context;
  397|  10.8k|  cbor_item_t* res = cbor_new_float4();
  398|  10.8k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  10.8k|  do {                             \
  |  |  118|  10.8k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 10.8k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  10.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 10.8k]
  |  |  ------------------
  ------------------
  399|  10.8k|  cbor_set_float4(res, value);
  400|  10.8k|  _cbor_builder_append(res, ctx);
  401|  10.8k|}
cbor_builder_float8_callback:
  403|  25.9k|void cbor_builder_float8_callback(void* context, double value) {
  404|  25.9k|  struct _cbor_decoder_context* ctx = context;
  405|  25.9k|  cbor_item_t* res = cbor_new_float8();
  406|  25.9k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  25.9k|  do {                             \
  |  |  118|  25.9k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 25.9k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  25.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 25.9k]
  |  |  ------------------
  ------------------
  407|  25.9k|  cbor_set_float8(res, value);
  408|  25.9k|  _cbor_builder_append(res, ctx);
  409|  25.9k|}
cbor_builder_null_callback:
  411|  1.27M|void cbor_builder_null_callback(void* context) {
  412|  1.27M|  struct _cbor_decoder_context* ctx = context;
  413|  1.27M|  cbor_item_t* res = cbor_new_null();
  414|  1.27M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.27M|  do {                             \
  |  |  118|  1.27M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 10, False: 1.27M]
  |  |  ------------------
  |  |  119|     10|      ctx->creation_failed = true; \
  |  |  120|     10|      return;                      \
  |  |  121|     10|    }                              \
  |  |  122|  1.27M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 1.27M]
  |  |  ------------------
  ------------------
  415|  1.27M|  _cbor_builder_append(res, ctx);
  416|  1.27M|}
cbor_builder_undefined_callback:
  418|  28.7k|void cbor_builder_undefined_callback(void* context) {
  419|  28.7k|  struct _cbor_decoder_context* ctx = context;
  420|  28.7k|  cbor_item_t* res = cbor_new_undef();
  421|  28.7k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  28.7k|  do {                             \
  |  |  118|  28.7k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 28.7k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  28.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 28.7k]
  |  |  ------------------
  ------------------
  422|  28.7k|  _cbor_builder_append(res, ctx);
  423|  28.7k|}
cbor_builder_simple_value_callback:
  425|  12.2k|void cbor_builder_simple_value_callback(void* context, uint8_t value) {
  426|  12.2k|  struct _cbor_decoder_context* ctx = context;
  427|  12.2k|  cbor_item_t* res = cbor_build_ctrl(value);
  428|  12.2k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  12.2k|  do {                             \
  |  |  118|  12.2k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 12.2k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  12.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 12.2k]
  |  |  ------------------
  ------------------
  429|  12.2k|  _cbor_builder_append(res, ctx);
  430|  12.2k|}
cbor_builder_boolean_callback:
  432|   885k|void cbor_builder_boolean_callback(void* context, bool value) {
  433|   885k|  struct _cbor_decoder_context* ctx = context;
  434|   885k|  cbor_item_t* res = cbor_build_bool(value);
  435|   885k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   885k|  do {                             \
  |  |  118|   885k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 885k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   885k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 885k]
  |  |  ------------------
  ------------------
  436|   885k|  _cbor_builder_append(res, ctx);
  437|   885k|}
cbor_builder_tag_callback:
  439|   316k|void cbor_builder_tag_callback(void* context, uint64_t value) {
  440|   316k|  struct _cbor_decoder_context* ctx = context;
  441|   316k|  cbor_item_t* res = cbor_new_tag(value);
  442|   316k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   316k|  do {                             \
  |  |  118|   316k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 316k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   316k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 316k]
  |  |  ------------------
  ------------------
  443|   316k|  PUSH_CTX_STACK(ctx, res, 1);
  ------------------
  |  |  137|   316k|  do {                                                         \
  |  |  138|   316k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 3, False: 316k]
  |  |  ------------------
  |  |  139|      3|      cbor_decref(&res);                                       \
  |  |  140|      3|      ctx->creation_failed = true;                             \
  |  |  141|      3|    }                                                          \
  |  |  142|   316k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 316k]
  |  |  ------------------
  ------------------
  444|   316k|}

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

_cbor_load_uint8:
   12|  38.1M|uint8_t _cbor_load_uint8(cbor_data source) { return (uint8_t)*source; }
_cbor_load_uint16:
   14|  68.6k|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|  68.6k|  return ((uint16_t) * (source + 0) << 8) + (uint8_t) * (source + 1);
   21|  68.6k|#endif
   22|  68.6k|}
_cbor_load_uint32:
   24|   510k|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|   510k|  return ((uint32_t) * (source + 0) << 0x18) +
   31|   510k|         ((uint32_t) * (source + 1) << 0x10) +
   32|   510k|         ((uint16_t) * (source + 2) << 0x08) + (uint8_t) * (source + 3);
   33|   510k|#endif
   34|   510k|}
_cbor_load_uint64:
   36|  44.1k|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|  44.1k|  return ((uint64_t) * (source + 0) << 0x38) +
   43|  44.1k|         ((uint64_t) * (source + 1) << 0x30) +
   44|  44.1k|         ((uint64_t) * (source + 2) << 0x28) +
   45|  44.1k|         ((uint64_t) * (source + 3) << 0x20) +
   46|  44.1k|         ((uint32_t) * (source + 4) << 0x18) +
   47|  44.1k|         ((uint32_t) * (source + 5) << 0x10) +
   48|  44.1k|         ((uint16_t) * (source + 6) << 0x08) + (uint8_t) * (source + 7);
   49|  44.1k|#endif
   50|  44.1k|}
_cbor_decode_half:
   53|   111k|float _cbor_decode_half(unsigned char* halfp) {
   54|       |  // TODO: Broken if we are not on IEEE 754
   55|       |  // (https://github.com/PJK/libcbor/issues/336)
   56|   111k|  int half = (halfp[0] << 8) + halfp[1];
   57|   111k|  int exp = (half >> 10) & 0x1f;
   58|   111k|  int mant = half & 0x3ff;
   59|   111k|  if (exp == 31 && mant != 0) {
  ------------------
  |  Branch (59:7): [True: 6.96k, False: 104k]
  |  Branch (59:20): [True: 5.71k, False: 1.24k]
  ------------------
   60|       |    /* NaN: reconstruct as a single-precision NaN, preserving the sign bit and
   61|       |     * the 10-bit half-precision payload by placing it in the top 10 bits of
   62|       |     * the 23-bit single-precision mantissa. This ensures round-trip fidelity
   63|       |     * with cbor_encode_half's NaN encoding. */
   64|  5.71k|    union _cbor_float_helper helper = {
   65|  5.71k|        .as_uint = ((uint32_t)(half & 0x8000) << 16) | /* sign */
   66|  5.71k|                   0x7F800000u |                       /* exponent (all 1s) */
   67|  5.71k|                   ((uint32_t)mant << 13)};            /* payload */
   68|  5.71k|    return helper.as_float;
   69|  5.71k|  }
   70|   106k|  double val;
   71|   106k|  if (exp == 0)
  ------------------
  |  Branch (71:7): [True: 27.7k, False: 78.4k]
  ------------------
   72|  27.7k|    val = ldexp(mant, -24);
   73|  78.4k|  else if (exp != 31)
  ------------------
  |  Branch (73:12): [True: 77.1k, False: 1.24k]
  ------------------
   74|  77.1k|    val = ldexp(mant + 1024, exp - 25);
   75|  1.24k|  else
   76|  1.24k|    val = INFINITY; /* exp == 31, mant == 0: the NaN case is handled above */
   77|   106k|  return (float)(half & 0x8000 ? -val : val);
  ------------------
  |  Branch (77:18): [True: 64.6k, False: 41.5k]
  ------------------
   78|   111k|}
_cbor_load_half:
   80|   111k|float _cbor_load_half(cbor_data source) {
   81|       |  /* Discard const */
   82|   111k|  return _cbor_decode_half((unsigned char*)source);
   83|   111k|}
_cbor_load_float:
   85|  10.8k|float _cbor_load_float(cbor_data source) {
   86|       |  // TODO: Broken if we are not on IEEE 754
   87|       |  // (https://github.com/PJK/libcbor/issues/336)
   88|  10.8k|  union _cbor_float_helper helper = {.as_uint = _cbor_load_uint32(source)};
   89|  10.8k|  return helper.as_float;
   90|  10.8k|}
_cbor_load_double:
   92|  25.9k|double _cbor_load_double(cbor_data source) {
   93|       |  // TODO: Broken if we are not on IEEE 754
   94|       |  // (https://github.com/PJK/libcbor/issues/336)
   95|  25.9k|  union _cbor_double_helper helper = {.as_uint = _cbor_load_uint64(source)};
   96|  25.9k|  return helper.as_double;
   97|  25.9k|}

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

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

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

cbor_int_get_width:
   10|   250M|cbor_int_width cbor_int_get_width(const cbor_item_t* item) {
   11|   250M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|   250M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (11:3): [True: 0, False: 250M]
  |  Branch (11:3): [True: 250M, False: 0]
  ------------------
   12|   250M|  return item->metadata.int_metadata.width;
   13|   250M|}
cbor_get_uint8:
   15|  48.8M|uint8_t cbor_get_uint8(const cbor_item_t* item) {
   16|  48.8M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  48.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (16:3): [True: 0, False: 48.8M]
  |  Branch (16:3): [True: 48.8M, False: 0]
  ------------------
   17|  48.8M|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
  ------------------
  |  |   64|  48.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (17:3): [True: 0, False: 48.8M]
  |  Branch (17:3): [True: 48.8M, False: 0]
  ------------------
   18|  48.8M|  return *item->data;
   19|  48.8M|}
cbor_get_uint16:
   21|  87.1k|uint16_t cbor_get_uint16(const cbor_item_t* item) {
   22|  87.1k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  87.1k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (22:3): [True: 0, False: 87.1k]
  |  Branch (22:3): [True: 87.1k, False: 0]
  ------------------
   23|  87.1k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
  ------------------
  |  |   64|  87.1k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (23:3): [True: 0, False: 87.1k]
  |  Branch (23:3): [True: 87.1k, False: 0]
  ------------------
   24|  87.1k|  return *(uint16_t*)item->data;
   25|  87.1k|}
cbor_get_uint32:
   27|  1.42M|uint32_t cbor_get_uint32(const cbor_item_t* item) {
   28|  1.42M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  1.42M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (28:3): [True: 0, False: 1.42M]
  |  Branch (28:3): [True: 1.42M, False: 0]
  ------------------
   29|  1.42M|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
  ------------------
  |  |   64|  1.42M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (29:3): [True: 0, False: 1.42M]
  |  Branch (29:3): [True: 1.42M, False: 0]
  ------------------
   30|  1.42M|  return *(uint32_t*)item->data;
   31|  1.42M|}
cbor_get_uint64:
   33|  24.2k|uint64_t cbor_get_uint64(const cbor_item_t* item) {
   34|  24.2k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  24.2k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (34:3): [True: 0, False: 24.2k]
  |  Branch (34:3): [True: 24.2k, False: 0]
  ------------------
   35|  24.2k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
  ------------------
  |  |   64|  24.2k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (35:3): [True: 0, False: 24.2k]
  |  Branch (35:3): [True: 24.2k, False: 0]
  ------------------
   36|  24.2k|  return *(uint64_t*)item->data;
   37|  24.2k|}
cbor_get_int:
   39|  12.7M|uint64_t cbor_get_int(const cbor_item_t* item) {
   40|  12.7M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  12.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (40:3): [True: 0, False: 12.7M]
  |  Branch (40:3): [True: 12.7M, False: 0]
  ------------------
   41|  12.7M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  12.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (41:3): [True: 12.7M, False: 0]
  |  Branch (41:3): [True: 12.7M, False: 0]
  |  Branch (41:3): [True: 0, False: 12.7M]
  ------------------
   42|  12.7M|              cbor_int_get_width(item) <= CBOR_INT_64);
   43|  12.7M|  switch (cbor_int_get_width(item)) {
   44|  12.2M|    case CBOR_INT_8:
  ------------------
  |  Branch (44:5): [True: 12.2M, False: 510k]
  ------------------
   45|  12.2M|      return cbor_get_uint8(item);
   46|  29.0k|    case CBOR_INT_16:
  ------------------
  |  Branch (46:5): [True: 29.0k, False: 12.6M]
  ------------------
   47|  29.0k|      return cbor_get_uint16(item);
   48|   473k|    case CBOR_INT_32:
  ------------------
  |  Branch (48:5): [True: 473k, False: 12.2M]
  ------------------
   49|   473k|      return cbor_get_uint32(item);
   50|  8.08k|    case CBOR_INT_64:
  ------------------
  |  Branch (50:5): [True: 8.08k, False: 12.7M]
  ------------------
   51|  8.08k|      return cbor_get_uint64(item);
   52|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (52:5): [True: 0, False: 12.7M]
  ------------------
   53|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   54|      0|      return 0;  // LCOV_EXCL_STOP
   55|  12.7M|  }
   56|  12.7M|}
cbor_set_uint8:
   58|  33.5M|void cbor_set_uint8(cbor_item_t* item, uint8_t value) {
   59|  33.5M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  33.5M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (59:3): [True: 0, False: 33.5M]
  |  Branch (59:3): [True: 33.5M, False: 0]
  ------------------
   60|  33.5M|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_8);
  ------------------
  |  |   64|  33.5M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (60:3): [True: 0, False: 33.5M]
  |  Branch (60:3): [True: 33.5M, False: 0]
  ------------------
   61|  33.5M|  *item->data = value;
   62|  33.5M|}
cbor_set_uint16:
   64|  82.8k|void cbor_set_uint16(cbor_item_t* item, uint16_t value) {
   65|  82.8k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  82.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (65:3): [True: 0, False: 82.8k]
  |  Branch (65:3): [True: 82.8k, False: 0]
  ------------------
   66|  82.8k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_16);
  ------------------
  |  |   64|  82.8k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (66:3): [True: 0, False: 82.8k]
  |  Branch (66:3): [True: 82.8k, False: 0]
  ------------------
   67|  82.8k|  *(uint16_t*)item->data = value;
   68|  82.8k|}
cbor_set_uint32:
   70|   962k|void cbor_set_uint32(cbor_item_t* item, uint32_t value) {
   71|   962k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|   962k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (71:3): [True: 0, False: 962k]
  |  Branch (71:3): [True: 962k, False: 0]
  ------------------
   72|   962k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_32);
  ------------------
  |  |   64|   962k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (72:3): [True: 0, False: 962k]
  |  Branch (72:3): [True: 962k, False: 0]
  ------------------
   73|   962k|  *(uint32_t*)item->data = value;
   74|   962k|}
cbor_set_uint64:
   76|  21.3k|void cbor_set_uint64(cbor_item_t* item, uint64_t value) {
   77|  21.3k|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  21.3k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (77:3): [True: 0, False: 21.3k]
  |  Branch (77:3): [True: 21.3k, False: 0]
  ------------------
   78|  21.3k|  CBOR_ASSERT(cbor_int_get_width(item) == CBOR_INT_64);
  ------------------
  |  |   64|  21.3k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (78:3): [True: 0, False: 21.3k]
  |  Branch (78:3): [True: 21.3k, False: 0]
  ------------------
   79|  21.3k|  *(uint64_t*)item->data = value;
   80|  21.3k|}
cbor_mark_uint:
   82|  30.7M|void cbor_mark_uint(cbor_item_t* item) {
   83|  30.7M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  30.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (83:3): [True: 0, False: 30.7M]
  |  Branch (83:3): [True: 30.7M, False: 0]
  ------------------
   84|  30.7M|  item->type = CBOR_TYPE_UINT;
   85|  30.7M|}
cbor_mark_negint:
   87|  5.89M|void cbor_mark_negint(cbor_item_t* item) {
   88|  5.89M|  CBOR_ASSERT(cbor_is_int(item));
  ------------------
  |  |   64|  5.89M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (88:3): [True: 0, False: 5.89M]
  |  Branch (88:3): [True: 5.89M, False: 0]
  ------------------
   89|  5.89M|  item->type = CBOR_TYPE_NEGINT;
   90|  5.89M|}
cbor_new_int8:
   92|  33.5M|cbor_item_t* cbor_new_int8(void) {
   93|  33.5M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 1);
   94|  33.5M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  33.5M|  do {                           \
  |  |  127|  33.5M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 7, False: 33.5M]
  |  |  ------------------
  |  |  128|      7|      return NULL;               \
  |  |  129|      7|    }                            \
  |  |  130|  33.5M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 33.5M]
  |  |  ------------------
  ------------------
   95|  33.5M|  *item = (cbor_item_t){.data = (unsigned char*)item + sizeof(cbor_item_t),
   96|  33.5M|                        .refcount = 1,
   97|  33.5M|                        .metadata = {.int_metadata = {.width = CBOR_INT_8}},
   98|  33.5M|                        .type = CBOR_TYPE_UINT};
   99|  33.5M|  return item;
  100|  33.5M|}
cbor_new_int16:
  102|  82.8k|cbor_item_t* cbor_new_int16(void) {
  103|  82.8k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 2);
  104|  82.8k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  82.8k|  do {                           \
  |  |  127|  82.8k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 82.8k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  82.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 82.8k]
  |  |  ------------------
  ------------------
  105|  82.8k|  *item = (cbor_item_t){.data = (unsigned char*)item + sizeof(cbor_item_t),
  106|  82.8k|                        .refcount = 1,
  107|  82.8k|                        .metadata = {.int_metadata = {.width = CBOR_INT_16}},
  108|  82.8k|                        .type = CBOR_TYPE_UINT};
  109|  82.8k|  return item;
  110|  82.8k|}
cbor_new_int32:
  112|   962k|cbor_item_t* cbor_new_int32(void) {
  113|   962k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 4);
  114|   962k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   962k|  do {                           \
  |  |  127|   962k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 962k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   962k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 962k]
  |  |  ------------------
  ------------------
  115|   962k|  *item = (cbor_item_t){.data = (unsigned char*)item + sizeof(cbor_item_t),
  116|   962k|                        .refcount = 1,
  117|   962k|                        .metadata = {.int_metadata = {.width = CBOR_INT_32}},
  118|   962k|                        .type = CBOR_TYPE_UINT};
  119|   962k|  return item;
  120|   962k|}
cbor_new_int64:
  122|  21.3k|cbor_item_t* cbor_new_int64(void) {
  123|  21.3k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t) + 8);
  124|  21.3k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  21.3k|  do {                           \
  |  |  127|  21.3k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 21.3k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  21.3k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 21.3k]
  |  |  ------------------
  ------------------
  125|  21.3k|  *item = (cbor_item_t){.data = (unsigned char*)item + sizeof(cbor_item_t),
  126|  21.3k|                        .refcount = 1,
  127|  21.3k|                        .metadata = {.int_metadata = {.width = CBOR_INT_64}},
  128|  21.3k|                        .type = CBOR_TYPE_UINT};
  129|  21.3k|  return item;
  130|  21.3k|}
cbor_build_uint8:
  132|  12.2M|cbor_item_t* cbor_build_uint8(uint8_t value) {
  133|  12.2M|  cbor_item_t* item = cbor_new_int8();
  134|  12.2M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  12.2M|  do {                           \
  |  |  127|  12.2M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 12.2M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  12.2M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 12.2M]
  |  |  ------------------
  ------------------
  135|  12.2M|  cbor_set_uint8(item, value);
  136|  12.2M|  cbor_mark_uint(item);
  137|  12.2M|  return item;
  138|  12.2M|}
cbor_build_uint16:
  140|  29.0k|cbor_item_t* cbor_build_uint16(uint16_t value) {
  141|  29.0k|  cbor_item_t* item = cbor_new_int16();
  142|  29.0k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  29.0k|  do {                           \
  |  |  127|  29.0k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 29.0k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  29.0k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 29.0k]
  |  |  ------------------
  ------------------
  143|  29.0k|  cbor_set_uint16(item, value);
  144|  29.0k|  cbor_mark_uint(item);
  145|  29.0k|  return item;
  146|  29.0k|}
cbor_build_uint32:
  148|   473k|cbor_item_t* cbor_build_uint32(uint32_t value) {
  149|   473k|  cbor_item_t* item = cbor_new_int32();
  150|   473k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   473k|  do {                           \
  |  |  127|   473k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 473k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   473k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 473k]
  |  |  ------------------
  ------------------
  151|   473k|  cbor_set_uint32(item, value);
  152|   473k|  cbor_mark_uint(item);
  153|   473k|  return item;
  154|   473k|}
cbor_build_uint64:
  156|  8.08k|cbor_item_t* cbor_build_uint64(uint64_t value) {
  157|  8.08k|  cbor_item_t* item = cbor_new_int64();
  158|  8.08k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  8.08k|  do {                           \
  |  |  127|  8.08k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 8.08k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  8.08k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 8.08k]
  |  |  ------------------
  ------------------
  159|  8.08k|  cbor_set_uint64(item, value);
  160|  8.08k|  cbor_mark_uint(item);
  161|  8.08k|  return item;
  162|  8.08k|}

cbor_map_size:
   11|  3.34M|size_t cbor_map_size(const cbor_item_t* item) {
   12|  3.34M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  3.34M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (12:3): [True: 0, False: 3.34M]
  |  Branch (12:3): [True: 3.34M, False: 0]
  ------------------
   13|  3.34M|  return item->metadata.map_metadata.end_ptr;
   14|  3.34M|}
cbor_new_definite_map:
   21|   110k|cbor_item_t* cbor_new_definite_map(size_t size) {
   22|   110k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   23|   110k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   110k|  do {                           \
  |  |  127|   110k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 110k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   110k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 110k]
  |  |  ------------------
  ------------------
   24|       |
   25|       |  // malloc(0) may legitimately return NULL, so do not allocate (or check) for
   26|       |  // an empty map. The data pointer is never dereferenced while size == 0.
   27|   110k|  unsigned char* data = NULL;
   28|   110k|  if (size > 0) {
  ------------------
  |  Branch (28:7): [True: 109k, False: 1.09k]
  ------------------
   29|   109k|    data = _cbor_alloc_multiple(sizeof(struct cbor_pair), size);
   30|   109k|    _CBOR_DEPENDENT_NOTNULL(item, data);
  ------------------
  |  |  135|   109k|  do {                                              \
  |  |  136|   109k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 99, False: 109k]
  |  |  ------------------
  |  |  137|     99|      _cbor_free(cbor_item);                        \
  |  |  138|     99|      return NULL;                                  \
  |  |  139|     99|    }                                               \
  |  |  140|   109k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 109k]
  |  |  ------------------
  ------------------
   31|   109k|  }
   32|       |
   33|   110k|  *item = (cbor_item_t){
   34|   110k|      .refcount = 1,
   35|   110k|      .type = CBOR_TYPE_MAP,
   36|   110k|      .metadata = {.map_metadata = {.allocated = size,
   37|   110k|                                    .type = _CBOR_METADATA_DEFINITE,
   38|   110k|                                    .end_ptr = 0}},
   39|   110k|      .data = data};
   40|       |
   41|   110k|  return item;
   42|   110k|}
cbor_new_indefinite_map:
   44|  9.24k|cbor_item_t* cbor_new_indefinite_map(void) {
   45|  9.24k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   46|  9.24k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  9.24k|  do {                           \
  |  |  127|  9.24k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 9.24k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  9.24k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 9.24k]
  |  |  ------------------
  ------------------
   47|       |
   48|  9.24k|  *item = (cbor_item_t){
   49|  9.24k|      .refcount = 1,
   50|  9.24k|      .type = CBOR_TYPE_MAP,
   51|  9.24k|      .metadata = {.map_metadata = {.allocated = 0,
   52|  9.24k|                                    .type = _CBOR_METADATA_INDEFINITE,
   53|  9.24k|                                    .end_ptr = 0}},
   54|  9.24k|      .data = NULL};
   55|       |
   56|  9.24k|  return item;
   57|  9.24k|}
_cbor_map_add_key:
   59|  2.79M|bool _cbor_map_add_key(cbor_item_t* item, cbor_item_t* key) {
   60|  2.79M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  2.79M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (60:3): [True: 0, False: 2.79M]
  |  Branch (60:3): [True: 2.79M, False: 0]
  ------------------
   61|  2.79M|  struct _cbor_map_metadata* metadata =
   62|  2.79M|      (struct _cbor_map_metadata*)&item->metadata;
   63|  2.79M|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (63:7): [True: 856k, False: 1.94M]
  ------------------
   64|   856k|    struct cbor_pair* data = cbor_map_handle(item);
   65|   856k|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (65:9): [True: 0, False: 856k]
  ------------------
   66|       |      /* Don't realloc definite preallocated map */
   67|      0|      return false;
   68|      0|    }
   69|       |
   70|   856k|    data[metadata->end_ptr].key = key;
   71|   856k|    data[metadata->end_ptr++].value = NULL;
   72|  1.94M|  } else {
   73|  1.94M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (73:9): [True: 4.29k, False: 1.93M]
  ------------------
   74|       |      /* Exponential realloc */
   75|       |      // Check for overflows first
   76|  4.29k|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  4.29k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (76:11): [True: 0, False: 4.29k]
  ------------------
   77|      0|        return false;
   78|      0|      }
   79|       |
   80|  4.29k|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (80:31): [True: 1.34k, False: 2.95k]
  ------------------
   81|  4.29k|                                  ? 1
   82|  4.29k|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  2.95k|#define CBOR_BUFFER_GROWTH 2
  ------------------
   83|       |
   84|  4.29k|      unsigned char* new_data = _cbor_realloc_multiple(
   85|  4.29k|          item->data, sizeof(struct cbor_pair), new_allocation);
   86|       |
   87|  4.29k|      if (new_data == NULL) {
  ------------------
  |  Branch (87:11): [True: 0, False: 4.29k]
  ------------------
   88|      0|        return false;
   89|      0|      }
   90|       |
   91|  4.29k|      item->data = new_data;
   92|  4.29k|      metadata->allocated = new_allocation;
   93|  4.29k|    }
   94|  1.94M|    struct cbor_pair* data = cbor_map_handle(item);
   95|  1.94M|    data[metadata->end_ptr].key = key;
   96|  1.94M|    data[metadata->end_ptr++].value = NULL;
   97|  1.94M|  }
   98|  2.79M|  cbor_incref(key);
   99|  2.79M|  return true;
  100|  2.79M|}
_cbor_map_add_value:
  102|  2.79M|bool _cbor_map_add_value(cbor_item_t* item, cbor_item_t* value) {
  103|  2.79M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  2.79M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (103:3): [True: 0, False: 2.79M]
  |  Branch (103:3): [True: 2.79M, False: 0]
  ------------------
  104|  2.79M|  cbor_incref(value);
  105|  2.79M|  cbor_map_handle(item)[
  106|       |      /* Move one back since we are assuming _add_key (which increased the ptr)
  107|       |       * was the previous operation on this object */
  108|  2.79M|      item->metadata.map_metadata.end_ptr - 1]
  109|  2.79M|      .value = value;
  110|  2.79M|  return true;
  111|  2.79M|}
cbor_map_add:
  114|  1.02M|bool cbor_map_add(cbor_item_t* item, struct cbor_pair pair) {
  115|  1.02M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  1.02M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (115:3): [True: 0, False: 1.02M]
  |  Branch (115:3): [True: 1.02M, False: 0]
  ------------------
  116|  1.02M|  if (!_cbor_map_add_key(item, pair.key)) return false;
  ------------------
  |  Branch (116:7): [True: 0, False: 1.02M]
  ------------------
  117|  1.02M|  return _cbor_map_add_value(item, pair.value);
  118|  1.02M|}
cbor_map_is_definite:
  120|  6.56M|bool cbor_map_is_definite(const cbor_item_t* item) {
  121|  6.56M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  6.56M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (121:3): [True: 0, False: 6.56M]
  |  Branch (121:3): [True: 6.56M, False: 0]
  ------------------
  122|  6.56M|  return item->metadata.map_metadata.type == _CBOR_METADATA_DEFINITE;
  123|  6.56M|}
cbor_map_is_indefinite:
  125|  9.02k|bool cbor_map_is_indefinite(const cbor_item_t* item) {
  126|  9.02k|  return !cbor_map_is_definite(item);
  127|  9.02k|}
cbor_map_handle:
  129|  7.87M|struct cbor_pair* cbor_map_handle(const cbor_item_t* item) {
  130|  7.87M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  7.87M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (130:3): [True: 0, False: 7.87M]
  |  Branch (130:3): [True: 7.87M, False: 0]
  ------------------
  131|  7.87M|  return (struct cbor_pair*)item->data;
  132|  7.87M|}

cbor_serialize:
   21|  20.3M|                      size_t buffer_size) {
   22|  20.3M|  CBOR_ASSERT_VALID_TYPE(cbor_typeof(item));
  ------------------
  |  |   82|  20.3M|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  20.3M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (22:3): [True: 20.3M, False: 0]
  |  Branch (22:3): [True: 20.3M, False: 0]
  |  Branch (22:3): [True: 0, False: 20.3M]
  ------------------
   23|  20.3M|  switch (cbor_typeof(item)) {
   24|  10.6M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (24:5): [True: 10.6M, False: 9.67M]
  ------------------
   25|  10.6M|      return cbor_serialize_uint(item, buffer, buffer_size);
   26|  2.04M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (26:5): [True: 2.04M, False: 18.2M]
  ------------------
   27|  2.04M|      return cbor_serialize_negint(item, buffer, buffer_size);
   28|   463k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (28:5): [True: 463k, False: 19.8M]
  ------------------
   29|   463k|      return cbor_serialize_bytestring(item, buffer, buffer_size);
   30|   348k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (30:5): [True: 348k, False: 19.9M]
  ------------------
   31|   348k|      return cbor_serialize_string(item, buffer, buffer_size);
   32|  5.86M|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (32:5): [True: 5.86M, False: 14.4M]
  ------------------
   33|  5.86M|      return cbor_serialize_array(item, buffer, buffer_size);
   34|  41.4k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (34:5): [True: 41.4k, False: 20.3M]
  ------------------
   35|  41.4k|      return cbor_serialize_map(item, buffer, buffer_size);
   36|   220k|    case CBOR_TYPE_TAG:
  ------------------
  |  Branch (36:5): [True: 220k, False: 20.1M]
  ------------------
   37|   220k|      return cbor_serialize_tag(item, buffer, buffer_size);
   38|   685k|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (38:5): [True: 685k, False: 19.6M]
  ------------------
   39|   685k|      return cbor_serialize_float_ctrl(item, buffer, buffer_size);
   40|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (40:5): [True: 0, False: 20.3M]
  ------------------
   41|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   42|      0|      return 0;  // LCOV_EXCL_STOP
   43|  20.3M|  }
   44|  20.3M|}
_cbor_encoded_header_size:
   51|  8.20M|size_t _cbor_encoded_header_size(uint64_t size) {
   52|  8.20M|  if (size <= kMaxEmbeddedInt)
  ------------------
  |  Branch (52:7): [True: 8.17M, False: 25.0k]
  ------------------
   53|  8.17M|    return 1;
   54|  25.0k|  else if (size <= UINT8_MAX)
  ------------------
  |  Branch (54:12): [True: 12.1k, False: 12.9k]
  ------------------
   55|  12.1k|    return 2;
   56|  12.9k|  else if (size <= UINT16_MAX)
  ------------------
  |  Branch (56:12): [True: 2.05k, False: 10.9k]
  ------------------
   57|  2.05k|    return 3;
   58|  10.9k|  else if (size <= UINT32_MAX)
  ------------------
  |  Branch (58:12): [True: 7.84k, False: 3.08k]
  ------------------
   59|  7.84k|    return 5;
   60|  3.08k|  else
   61|  3.08k|    return 9;
   62|  8.20M|}
cbor_serialized_size:
   64|  21.4M|size_t cbor_serialized_size(const cbor_item_t* item) {
   65|  21.4M|  CBOR_ASSERT_VALID_TYPE(cbor_typeof(item));
  ------------------
  |  |   82|  21.4M|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  21.4M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (65:3): [True: 21.4M, False: 0]
  |  Branch (65:3): [True: 21.4M, False: 0]
  |  Branch (65:3): [True: 0, False: 21.4M]
  ------------------
   66|  21.4M|  switch (cbor_typeof(item)) {
   67|  10.6M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (67:5): [True: 10.6M, False: 10.7M]
  ------------------
   68|  12.7M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (68:5): [True: 2.04M, False: 19.3M]
  ------------------
   69|  12.7M|      CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  12.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (69:7): [True: 12.7M, False: 0]
  |  Branch (69:7): [True: 12.7M, False: 0]
  |  Branch (69:7): [True: 0, False: 12.7M]
  ------------------
   70|  12.7M|                  cbor_int_get_width(item) <= CBOR_INT_64);
   71|  12.7M|      switch (cbor_int_get_width(item)) {
   72|  12.2M|        case CBOR_INT_8:
  ------------------
  |  Branch (72:9): [True: 12.2M, False: 510k]
  ------------------
   73|  12.2M|          if (cbor_get_uint8(item) <= kMaxEmbeddedInt) return 1;
  ------------------
  |  Branch (73:15): [True: 12.1M, False: 30.1k]
  ------------------
   74|  30.1k|          return 2;
   75|  29.0k|        case CBOR_INT_16:
  ------------------
  |  Branch (75:9): [True: 29.0k, False: 12.6M]
  ------------------
   76|  29.0k|          return 3;
   77|   473k|        case CBOR_INT_32:
  ------------------
  |  Branch (77:9): [True: 473k, False: 12.2M]
  ------------------
   78|   473k|          return 5;
   79|  8.08k|        case CBOR_INT_64:
  ------------------
  |  Branch (79:9): [True: 8.08k, False: 12.7M]
  ------------------
   80|  8.08k|          return 9;
   81|      0|        default:  // LCOV_EXCL_START
  ------------------
  |  Branch (81:9): [True: 0, False: 12.7M]
  ------------------
   82|      0|          _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   83|      0|          return 0;  // LCOV_EXCL_STOP
   84|  12.7M|      }
   85|       |    // Note: We do not _cbor_safe_signaling_add zero-length definite strings,
   86|       |    // they would cause zeroes to propagate. All other items are at least one
   87|       |    // byte.
   88|  1.03M|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (88:5): [True: 1.03M, False: 20.4M]
  ------------------
   89|  1.03M|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (89:11): [True: 1.02M, False: 2.83k]
  ------------------
   90|  1.02M|        size_t header_size =
   91|  1.02M|            _cbor_encoded_header_size(cbor_bytestring_length(item));
   92|  1.02M|        if (cbor_bytestring_length(item) == 0) return header_size;
  ------------------
  |  Branch (92:13): [True: 1.33k, False: 1.02M]
  ------------------
   93|  1.02M|        return _cbor_safe_signaling_add(header_size,
   94|  1.02M|                                        cbor_bytestring_length(item));
   95|  1.02M|      }
   96|  2.83k|      size_t indef_bytestring_size = 2;  // Leading byte + break
   97|  2.83k|      cbor_item_t** chunks = cbor_bytestring_chunks_handle(item);
   98|   570k|      for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (98:26): [True: 567k, False: 2.83k]
  ------------------
   99|   567k|        indef_bytestring_size = _cbor_safe_signaling_add(
  100|   567k|            indef_bytestring_size, cbor_serialized_size(chunks[i]));
  101|   567k|      }
  102|  2.83k|      return indef_bytestring_size;
  103|  1.03M|    }
  104|   879k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (104:5): [True: 879k, False: 20.5M]
  ------------------
  105|   879k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (105:11): [True: 870k, False: 8.97k]
  ------------------
  106|   870k|        size_t header_size =
  107|   870k|            _cbor_encoded_header_size(cbor_string_length(item));
  108|   870k|        if (cbor_string_length(item) == 0) return header_size;
  ------------------
  |  Branch (108:13): [True: 2.98k, False: 867k]
  ------------------
  109|   867k|        return _cbor_safe_signaling_add(header_size, cbor_string_length(item));
  110|   870k|      }
  111|  8.97k|      size_t indef_string_size = 2;  // Leading byte + break
  112|  8.97k|      cbor_item_t** chunks = cbor_string_chunks_handle(item);
  113|   540k|      for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (113:26): [True: 531k, False: 8.97k]
  ------------------
  114|   531k|        indef_string_size = _cbor_safe_signaling_add(
  115|   531k|            indef_string_size, cbor_serialized_size(chunks[i]));
  116|   531k|      }
  117|  8.97k|      return indef_string_size;
  118|   879k|    }
  119|  5.86M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (119:5): [True: 5.86M, False: 15.5M]
  ------------------
  120|  5.86M|      size_t array_size = cbor_array_is_definite(item)
  ------------------
  |  Branch (120:27): [True: 5.46M, False: 395k]
  ------------------
  121|  5.86M|                              ? _cbor_encoded_header_size(cbor_array_size(item))
  122|  5.86M|                              : 2;  // Leading byte + break
  123|  5.86M|      cbor_item_t** items = cbor_array_handle(item);
  124|  23.9M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (124:26): [True: 18.0M, False: 5.86M]
  ------------------
  125|  18.0M|        array_size = _cbor_safe_signaling_add(array_size,
  126|  18.0M|                                              cbor_serialized_size(items[i]));
  127|  18.0M|      }
  128|  5.86M|      return array_size;
  129|   879k|    }
  130|  41.4k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (130:5): [True: 41.4k, False: 21.4M]
  ------------------
  131|  41.4k|      size_t map_size = cbor_map_is_definite(item)
  ------------------
  |  Branch (131:25): [True: 39.1k, False: 2.24k]
  ------------------
  132|  41.4k|                            ? _cbor_encoded_header_size(cbor_map_size(item))
  133|  41.4k|                            : 2;  // Leading byte + break
  134|  41.4k|      struct cbor_pair* items = cbor_map_handle(item);
  135|  1.06M|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (135:26): [True: 1.02M, False: 41.4k]
  ------------------
  136|  1.02M|        map_size = _cbor_safe_signaling_add(
  137|  1.02M|            map_size,
  138|  1.02M|            _cbor_safe_signaling_add(cbor_serialized_size(items[i].key),
  139|  1.02M|                                     cbor_serialized_size(items[i].value)));
  140|  1.02M|      }
  141|  41.4k|      return map_size;
  142|   879k|    }
  143|   220k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (143:5): [True: 220k, False: 21.2M]
  ------------------
  144|   220k|      cbor_item_t* tagged = cbor_tag_item(item);
  145|   220k|      if (tagged == NULL) return 0;
  ------------------
  |  Branch (145:11): [True: 0, False: 220k]
  ------------------
  146|   220k|      return _cbor_safe_signaling_add(
  147|   220k|          _cbor_encoded_header_size(cbor_tag_value(item)),
  148|   220k|          cbor_serialized_size(cbor_move(tagged)));
  149|   220k|    }
  150|   685k|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (150:5): [True: 685k, False: 20.7M]
  ------------------
  151|   685k|      CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   685k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (151:7): [True: 685k, False: 0]
  |  Branch (151:7): [True: 685k, False: 0]
  |  Branch (151:7): [True: 0, False: 685k]
  ------------------
  152|   685k|                  cbor_float_get_width(item) <= CBOR_FLOAT_64);
  153|   685k|      switch (cbor_float_get_width(item)) {
  154|   573k|        case CBOR_FLOAT_0:
  ------------------
  |  Branch (154:9): [True: 573k, False: 112k]
  ------------------
  155|   573k|          return _cbor_encoded_header_size(cbor_ctrl_value(item));
  156|  95.9k|        case CBOR_FLOAT_16:
  ------------------
  |  Branch (156:9): [True: 95.9k, False: 590k]
  ------------------
  157|  95.9k|          return 3;
  158|  10.1k|        case CBOR_FLOAT_32:
  ------------------
  |  Branch (158:9): [True: 10.1k, False: 675k]
  ------------------
  159|  10.1k|          return 5;
  160|  6.69k|        case CBOR_FLOAT_64:
  ------------------
  |  Branch (160:9): [True: 6.69k, False: 679k]
  ------------------
  161|  6.69k|          return 9;
  162|      0|        default:  // LCOV_EXCL_START
  ------------------
  |  Branch (162:9): [True: 0, False: 685k]
  ------------------
  163|      0|          _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  164|      0|          return 0;  // LCOV_EXCL_STOP
  165|   685k|      }
  166|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (166:5): [True: 0, False: 21.4M]
  ------------------
  167|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  168|      0|      return 0;  // LCOV_EXCL_STOP
  169|  21.4M|  }
  170|  21.4M|}
cbor_serialize_alloc:
  173|  1.25k|                            size_t* buffer_size) {
  174|  1.25k|  *buffer = NULL;
  175|  1.25k|  size_t serialized_size = cbor_serialized_size(item);
  176|  1.25k|  if (serialized_size == 0) {
  ------------------
  |  Branch (176:7): [True: 0, False: 1.25k]
  ------------------
  177|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (177:9): [True: 0, False: 0]
  ------------------
  178|      0|    return 0;
  179|      0|  }
  180|  1.25k|  *buffer = _cbor_malloc(serialized_size);
  181|  1.25k|  if (*buffer == NULL) {
  ------------------
  |  Branch (181:7): [True: 0, False: 1.25k]
  ------------------
  182|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (182:9): [True: 0, False: 0]
  ------------------
  183|      0|    return 0;
  184|      0|  }
  185|       |
  186|  1.25k|  size_t written = cbor_serialize(item, *buffer, serialized_size);
  187|  1.25k|  CBOR_ASSERT(written == serialized_size);
  ------------------
  |  |   64|  1.25k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (187:3): [True: 0, False: 1.25k]
  |  Branch (187:3): [True: 1.25k, False: 0]
  ------------------
  188|  1.25k|  if (buffer_size != NULL) *buffer_size = serialized_size;
  ------------------
  |  Branch (188:7): [True: 1.25k, False: 0]
  ------------------
  189|  1.25k|  return written;
  190|  1.25k|}
cbor_serialize_uint:
  193|  10.6M|                           size_t buffer_size) {
  194|  10.6M|  CBOR_ASSERT(cbor_isa_uint(item));
  ------------------
  |  |   64|  10.6M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (194:3): [True: 0, False: 10.6M]
  |  Branch (194:3): [True: 10.6M, False: 0]
  ------------------
  195|  10.6M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  10.6M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (195:3): [True: 10.6M, False: 0]
  |  Branch (195:3): [True: 10.6M, False: 0]
  |  Branch (195:3): [True: 0, False: 10.6M]
  ------------------
  196|  10.6M|              cbor_int_get_width(item) <= CBOR_INT_64);
  197|       |  // cppcheck-suppress missingReturn
  198|  10.6M|  switch (cbor_int_get_width(item)) {
  199|  10.1M|    case CBOR_INT_8:
  ------------------
  |  Branch (199:5): [True: 10.1M, False: 475k]
  ------------------
  200|  10.1M|      return cbor_encode_uint8(cbor_get_uint8(item), buffer, buffer_size);
  201|  6.91k|    case CBOR_INT_16:
  ------------------
  |  Branch (201:5): [True: 6.91k, False: 10.6M]
  ------------------
  202|  6.91k|      return cbor_encode_uint16(cbor_get_uint16(item), buffer, buffer_size);
  203|   462k|    case CBOR_INT_32:
  ------------------
  |  Branch (203:5): [True: 462k, False: 10.2M]
  ------------------
  204|   462k|      return cbor_encode_uint32(cbor_get_uint32(item), buffer, buffer_size);
  205|  6.32k|    case CBOR_INT_64:
  ------------------
  |  Branch (205:5): [True: 6.32k, False: 10.6M]
  ------------------
  206|  6.32k|      return cbor_encode_uint64(cbor_get_uint64(item), buffer, buffer_size);
  207|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (207:5): [True: 0, False: 10.6M]
  ------------------
  208|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  209|      0|      return 0;  // LCOV_EXCL_STOP
  210|  10.6M|  }
  211|  10.6M|}
cbor_serialize_negint:
  214|  2.04M|                             size_t buffer_size) {
  215|  2.04M|  CBOR_ASSERT(cbor_isa_negint(item));
  ------------------
  |  |   64|  2.04M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (215:3): [True: 0, False: 2.04M]
  |  Branch (215:3): [True: 2.04M, False: 0]
  ------------------
  216|  2.04M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  2.04M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (216:3): [True: 2.04M, False: 0]
  |  Branch (216:3): [True: 2.04M, False: 0]
  |  Branch (216:3): [True: 0, False: 2.04M]
  ------------------
  217|  2.04M|              cbor_int_get_width(item) <= CBOR_INT_64);
  218|       |  // cppcheck-suppress missingReturn
  219|  2.04M|  switch (cbor_int_get_width(item)) {
  220|  2.01M|    case CBOR_INT_8:
  ------------------
  |  Branch (220:5): [True: 2.01M, False: 34.9k]
  ------------------
  221|  2.01M|      return cbor_encode_negint8(cbor_get_uint8(item), buffer, buffer_size);
  222|  22.1k|    case CBOR_INT_16:
  ------------------
  |  Branch (222:5): [True: 22.1k, False: 2.02M]
  ------------------
  223|  22.1k|      return cbor_encode_negint16(cbor_get_uint16(item), buffer, buffer_size);
  224|  11.0k|    case CBOR_INT_32:
  ------------------
  |  Branch (224:5): [True: 11.0k, False: 2.03M]
  ------------------
  225|  11.0k|      return cbor_encode_negint32(cbor_get_uint32(item), buffer, buffer_size);
  226|  1.76k|    case CBOR_INT_64:
  ------------------
  |  Branch (226:5): [True: 1.76k, False: 2.04M]
  ------------------
  227|  1.76k|      return cbor_encode_negint64(cbor_get_uint64(item), buffer, buffer_size);
  228|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (228:5): [True: 0, False: 2.04M]
  ------------------
  229|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  230|      0|      return 0;  // LCOV_EXCL_STOP
  231|  2.04M|  }
  232|  2.04M|}
cbor_serialize_bytestring:
  235|  1.03M|                                 size_t buffer_size) {
  236|  1.03M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  1.03M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (236:3): [True: 0, False: 1.03M]
  |  Branch (236:3): [True: 1.03M, False: 0]
  ------------------
  237|  1.03M|  if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (237:7): [True: 1.02M, False: 2.83k]
  ------------------
  238|  1.02M|    size_t length = cbor_bytestring_length(item);
  239|  1.02M|    size_t written = cbor_encode_bytestring_start(length, buffer, buffer_size);
  240|  1.02M|    if (written > 0 && (buffer_size - written >= length)) {
  ------------------
  |  Branch (240:9): [True: 1.02M, False: 0]
  |  Branch (240:24): [True: 1.02M, False: 0]
  ------------------
  241|       |      // Empty bytestrings may have a NULL handle
  242|  1.02M|      if (length > 0) {
  ------------------
  |  Branch (242:11): [True: 1.02M, False: 1.33k]
  ------------------
  243|  1.02M|        memcpy(buffer + written, cbor_bytestring_handle(item), length);
  244|  1.02M|      }
  245|  1.02M|      return written + length;
  246|  1.02M|    }
  247|      0|    return 0;
  248|  1.02M|  } else {
  249|  2.83k|    CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  2.83k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (249:5): [True: 0, False: 2.83k]
  |  Branch (249:5): [True: 2.83k, False: 0]
  ------------------
  250|  2.83k|    size_t chunk_count = cbor_bytestring_chunk_count(item);
  251|  2.83k|    size_t written = cbor_encode_indef_bytestring_start(buffer, buffer_size);
  252|  2.83k|    if (written == 0) return 0;
  ------------------
  |  Branch (252:9): [True: 0, False: 2.83k]
  ------------------
  253|       |
  254|  2.83k|    cbor_item_t** chunks = cbor_bytestring_chunks_handle(item);
  255|   570k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (255:24): [True: 567k, False: 2.83k]
  ------------------
  256|   567k|      size_t chunk_written = cbor_serialize_bytestring(
  257|   567k|          chunks[i], buffer + written, buffer_size - written);
  258|   567k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (258:11): [True: 0, False: 567k]
  ------------------
  259|   567k|      written += chunk_written;
  260|   567k|    }
  261|       |
  262|  2.83k|    size_t break_written =
  263|  2.83k|        cbor_encode_break(buffer + written, buffer_size - written);
  264|  2.83k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (264:9): [True: 0, False: 2.83k]
  ------------------
  265|  2.83k|    return written + break_written;
  266|  2.83k|  }
  267|  1.03M|}
cbor_serialize_string:
  270|   879k|                             size_t buffer_size) {
  271|   879k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|   879k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (271:3): [True: 0, False: 879k]
  |  Branch (271:3): [True: 879k, False: 0]
  ------------------
  272|   879k|  if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (272:7): [True: 870k, False: 8.97k]
  ------------------
  273|   870k|    size_t length = cbor_string_length(item);
  274|   870k|    size_t written = cbor_encode_string_start(length, buffer, buffer_size);
  275|   870k|    if (written && (buffer_size - written >= length)) {
  ------------------
  |  Branch (275:9): [True: 870k, False: 0]
  |  Branch (275:20): [True: 870k, False: 0]
  ------------------
  276|       |      // Empty strings may have a NULL handle
  277|   870k|      if (length > 0) {
  ------------------
  |  Branch (277:11): [True: 867k, False: 2.98k]
  ------------------
  278|   867k|        memcpy(buffer + written, cbor_string_handle(item), length);
  279|   867k|      }
  280|   870k|      return written + length;
  281|   870k|    }
  282|      0|    return 0;
  283|   870k|  } else {
  284|  8.97k|    CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   64|  8.97k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (284:5): [True: 0, False: 8.97k]
  |  Branch (284:5): [True: 8.97k, False: 0]
  ------------------
  285|  8.97k|    size_t chunk_count = cbor_string_chunk_count(item);
  286|  8.97k|    size_t written = cbor_encode_indef_string_start(buffer, buffer_size);
  287|  8.97k|    if (written == 0) return 0;
  ------------------
  |  Branch (287:9): [True: 0, False: 8.97k]
  ------------------
  288|       |
  289|  8.97k|    cbor_item_t** chunks = cbor_string_chunks_handle(item);
  290|   540k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (290:24): [True: 531k, False: 8.97k]
  ------------------
  291|   531k|      size_t chunk_written = cbor_serialize_string(chunks[i], buffer + written,
  292|   531k|                                                   buffer_size - written);
  293|   531k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (293:11): [True: 0, False: 531k]
  ------------------
  294|   531k|      written += chunk_written;
  295|   531k|    }
  296|       |
  297|  8.97k|    size_t break_written =
  298|  8.97k|        cbor_encode_break(buffer + written, buffer_size - written);
  299|  8.97k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (299:9): [True: 0, False: 8.97k]
  ------------------
  300|  8.97k|    return written + break_written;
  301|  8.97k|  }
  302|   879k|}
cbor_serialize_array:
  305|  5.86M|                            size_t buffer_size) {
  306|  5.86M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|  5.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (306:3): [True: 0, False: 5.86M]
  |  Branch (306:3): [True: 5.86M, False: 0]
  ------------------
  307|  5.86M|  size_t size = cbor_array_size(item), written = 0;
  308|  5.86M|  cbor_item_t** handle = cbor_array_handle(item);
  309|  5.86M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (309:7): [True: 5.46M, False: 395k]
  ------------------
  310|  5.46M|    written = cbor_encode_array_start(size, buffer, buffer_size);
  311|  5.46M|  } else {
  312|   395k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   64|   395k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (312:5): [True: 0, False: 395k]
  |  Branch (312:5): [True: 395k, False: 0]
  ------------------
  313|   395k|    written = cbor_encode_indef_array_start(buffer, buffer_size);
  314|   395k|  }
  315|  5.86M|  if (written == 0) return 0;
  ------------------
  |  Branch (315:7): [True: 0, False: 5.86M]
  ------------------
  316|       |
  317|  23.9M|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (317:22): [True: 18.0M, False: 5.86M]
  ------------------
  318|  18.0M|    size_t item_written =
  319|  18.0M|        cbor_serialize(*(handle++), buffer + written, buffer_size - written);
  320|  18.0M|    if (item_written == 0) return 0;
  ------------------
  |  Branch (320:9): [True: 0, False: 18.0M]
  ------------------
  321|  18.0M|    written += item_written;
  322|  18.0M|  }
  323|       |
  324|  5.86M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (324:7): [True: 5.46M, False: 395k]
  ------------------
  325|  5.46M|    return written;
  326|  5.46M|  } else {
  327|   395k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   64|   395k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (327:5): [True: 0, False: 395k]
  |  Branch (327:5): [True: 395k, False: 0]
  ------------------
  328|   395k|    size_t break_written =
  329|   395k|        cbor_encode_break(buffer + written, buffer_size - written);
  330|   395k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (330:9): [True: 0, False: 395k]
  ------------------
  331|   395k|    return written + break_written;
  332|   395k|  }
  333|  5.86M|}
cbor_serialize_map:
  336|  41.4k|                          size_t buffer_size) {
  337|  41.4k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  41.4k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (337:3): [True: 0, False: 41.4k]
  |  Branch (337:3): [True: 41.4k, False: 0]
  ------------------
  338|  41.4k|  size_t size = cbor_map_size(item), written = 0;
  339|  41.4k|  struct cbor_pair* handle = cbor_map_handle(item);
  340|       |
  341|  41.4k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (341:7): [True: 39.1k, False: 2.24k]
  ------------------
  342|  39.1k|    written = cbor_encode_map_start(size, buffer, buffer_size);
  343|  39.1k|  } else {
  344|  2.24k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   64|  2.24k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (344:5): [True: 0, False: 2.24k]
  |  Branch (344:5): [True: 2.24k, False: 0]
  ------------------
  345|  2.24k|    written = cbor_encode_indef_map_start(buffer, buffer_size);
  346|  2.24k|  }
  347|  41.4k|  if (written == 0) return 0;
  ------------------
  |  Branch (347:7): [True: 0, False: 41.4k]
  ------------------
  348|       |
  349|  1.06M|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (349:22): [True: 1.02M, False: 41.4k]
  ------------------
  350|  1.02M|    size_t item_written =
  351|  1.02M|        cbor_serialize(handle->key, buffer + written, buffer_size - written);
  352|  1.02M|    if (item_written == 0) {
  ------------------
  |  Branch (352:9): [True: 0, False: 1.02M]
  ------------------
  353|      0|      return 0;
  354|      0|    }
  355|  1.02M|    written += item_written;
  356|  1.02M|    item_written = cbor_serialize((handle++)->value, buffer + written,
  357|  1.02M|                                  buffer_size - written);
  358|  1.02M|    if (item_written == 0) return 0;
  ------------------
  |  Branch (358:9): [True: 0, False: 1.02M]
  ------------------
  359|  1.02M|    written += item_written;
  360|  1.02M|  }
  361|       |
  362|  41.4k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (362:7): [True: 39.1k, False: 2.24k]
  ------------------
  363|  39.1k|    return written;
  364|  39.1k|  } else {
  365|  2.24k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   64|  2.24k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (365:5): [True: 0, False: 2.24k]
  |  Branch (365:5): [True: 2.24k, False: 0]
  ------------------
  366|  2.24k|    size_t break_written =
  367|  2.24k|        cbor_encode_break(buffer + written, buffer_size - written);
  368|  2.24k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (368:9): [True: 0, False: 2.24k]
  ------------------
  369|  2.24k|    return written + break_written;
  370|  2.24k|  }
  371|  41.4k|}
cbor_serialize_tag:
  374|   220k|                          size_t buffer_size) {
  375|   220k|  CBOR_ASSERT(cbor_isa_tag(item));
  ------------------
  |  |   64|   220k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (375:3): [True: 0, False: 220k]
  |  Branch (375:3): [True: 220k, False: 0]
  ------------------
  376|   220k|  size_t written = cbor_encode_tag(cbor_tag_value(item), buffer, buffer_size);
  377|   220k|  if (written == 0) return 0;
  ------------------
  |  Branch (377:7): [True: 0, False: 220k]
  ------------------
  378|       |
  379|   220k|  cbor_item_t* tagged = cbor_tag_item(item);
  380|   220k|  if (tagged == NULL) return 0;
  ------------------
  |  Branch (380:7): [True: 0, False: 220k]
  ------------------
  381|   220k|  size_t item_written = cbor_serialize(cbor_move(tagged), buffer + written,
  382|   220k|                                       buffer_size - written);
  383|   220k|  if (item_written == 0) return 0;
  ------------------
  |  Branch (383:7): [True: 0, False: 220k]
  ------------------
  384|   220k|  return written + item_written;
  385|   220k|}
cbor_serialize_float_ctrl:
  388|   685k|                                 size_t buffer_size) {
  389|   685k|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|   685k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (389:3): [True: 0, False: 685k]
  |  Branch (389:3): [True: 685k, False: 0]
  ------------------
  390|   685k|  CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   685k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (390:3): [True: 685k, False: 0]
  |  Branch (390:3): [True: 685k, False: 0]
  |  Branch (390:3): [True: 0, False: 685k]
  ------------------
  391|   685k|              cbor_float_get_width(item) <= CBOR_FLOAT_64);
  392|       |  // cppcheck-suppress missingReturn
  393|   685k|  switch (cbor_float_get_width(item)) {
  394|   573k|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (394:5): [True: 573k, False: 112k]
  ------------------
  395|       |      /* CTRL - special treatment */
  396|   573k|      return cbor_encode_ctrl(cbor_ctrl_value(item), buffer, buffer_size);
  397|  95.9k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (397:5): [True: 95.9k, False: 590k]
  ------------------
  398|  95.9k|      return cbor_encode_half(cbor_float_get_float2(item), buffer, buffer_size);
  399|  10.1k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (399:5): [True: 10.1k, False: 675k]
  ------------------
  400|  10.1k|      return cbor_encode_single(cbor_float_get_float4(item), buffer,
  401|  10.1k|                                buffer_size);
  402|  6.69k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (402:5): [True: 6.69k, False: 679k]
  ------------------
  403|  6.69k|      return cbor_encode_double(cbor_float_get_float8(item), buffer,
  404|  6.69k|                                buffer_size);
  405|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (405:5): [True: 0, False: 685k]
  ------------------
  406|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  407|      0|      return 0;  // LCOV_EXCL_STOP
  408|   685k|  }
  409|   685k|}

cbor_stream_decode:
   51|  42.7M|    const struct cbor_callbacks* callbacks, void* context) {
   52|       |  // Attempt to claim the initial MTB byte
   53|  42.7M|  struct cbor_decoder_result result = {.status = CBOR_DECODER_FINISHED};
   54|  42.7M|  if (!claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (54:7): [True: 0, False: 42.7M]
  ------------------
   55|      0|    return result;
   56|      0|  }
   57|       |
   58|  42.7M|  switch (*source) {
   59|  16.5M|    case 0x00: /* Fallthrough */
  ------------------
  |  Branch (59:5): [True: 16.5M, False: 26.1M]
  ------------------
   60|  16.5M|    case 0x01: /* Fallthrough */
  ------------------
  |  Branch (60:5): [True: 32.8k, False: 42.6M]
  ------------------
   61|  16.6M|    case 0x02: /* Fallthrough */
  ------------------
  |  Branch (61:5): [True: 35.3k, False: 42.6M]
  ------------------
   62|  16.6M|    case 0x03: /* Fallthrough */
  ------------------
  |  Branch (62:5): [True: 12.4k, False: 42.7M]
  ------------------
   63|  16.6M|    case 0x04: /* Fallthrough */
  ------------------
  |  Branch (63:5): [True: 10.2k, False: 42.7M]
  ------------------
   64|  16.6M|    case 0x05: /* Fallthrough */
  ------------------
  |  Branch (64:5): [True: 4.64k, False: 42.7M]
  ------------------
   65|  16.6M|    case 0x06: /* Fallthrough */
  ------------------
  |  Branch (65:5): [True: 25.8k, False: 42.6M]
  ------------------
   66|  16.6M|    case 0x07: /* Fallthrough */
  ------------------
  |  Branch (66:5): [True: 29.7k, False: 42.6M]
  ------------------
   67|  16.7M|    case 0x08: /* Fallthrough */
  ------------------
  |  Branch (67:5): [True: 27.5k, False: 42.6M]
  ------------------
   68|  16.7M|    case 0x09: /* Fallthrough */
  ------------------
  |  Branch (68:5): [True: 19.6k, False: 42.7M]
  ------------------
   69|  16.7M|    case 0x0A: /* Fallthrough */
  ------------------
  |  Branch (69:5): [True: 20.3k, False: 42.7M]
  ------------------
   70|  16.7M|    case 0x0B: /* Fallthrough */
  ------------------
  |  Branch (70:5): [True: 1.73k, False: 42.7M]
  ------------------
   71|  16.7M|    case 0x0C: /* Fallthrough */
  ------------------
  |  Branch (71:5): [True: 18.0k, False: 42.7M]
  ------------------
   72|  16.9M|    case 0x0D: /* Fallthrough */
  ------------------
  |  Branch (72:5): [True: 192k, False: 42.5M]
  ------------------
   73|  16.9M|    case 0x0E: /* Fallthrough */
  ------------------
  |  Branch (73:5): [True: 4.83k, False: 42.7M]
  ------------------
   74|  16.9M|    case 0x0F: /* Fallthrough */
  ------------------
  |  Branch (74:5): [True: 6.61k, False: 42.7M]
  ------------------
   75|  17.1M|    case 0x10: /* Fallthrough */
  ------------------
  |  Branch (75:5): [True: 159k, False: 42.5M]
  ------------------
   76|  17.1M|    case 0x11: /* Fallthrough */
  ------------------
  |  Branch (76:5): [True: 44.4k, False: 42.6M]
  ------------------
   77|  17.2M|    case 0x12: /* Fallthrough */
  ------------------
  |  Branch (77:5): [True: 25.3k, False: 42.6M]
  ------------------
   78|  17.2M|    case 0x13: /* Fallthrough */
  ------------------
  |  Branch (78:5): [True: 11.0k, False: 42.7M]
  ------------------
   79|  17.2M|    case 0x14: /* Fallthrough */
  ------------------
  |  Branch (79:5): [True: 50.5k, False: 42.6M]
  ------------------
   80|  17.4M|    case 0x15: /* Fallthrough */
  ------------------
  |  Branch (80:5): [True: 195k, False: 42.5M]
  ------------------
   81|  17.5M|    case 0x16: /* Fallthrough */
  ------------------
  |  Branch (81:5): [True: 47.8k, False: 42.6M]
  ------------------
   82|  17.5M|    case 0x17:
  ------------------
  |  Branch (82:5): [True: 21.7k, False: 42.7M]
  ------------------
   83|       |      /* Embedded one byte unsigned integer */
   84|  17.5M|      {
   85|  17.5M|        callbacks->uint8(context, _cbor_load_uint8(source));
   86|  17.5M|        return result;
   87|  17.5M|      }
   88|  16.6k|    case 0x18:
  ------------------
  |  Branch (88:5): [True: 16.6k, False: 42.7M]
  ------------------
   89|       |      /* One byte unsigned integer */
   90|  16.6k|      {
   91|  16.6k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (91:13): [True: 16.6k, False: 1]
  ------------------
   92|  16.6k|          callbacks->uint8(context, _cbor_load_uint8(source + 1));
   93|  16.6k|        }
   94|  16.6k|        return result;
   95|  17.5M|      }
   96|  7.62k|    case 0x19:
  ------------------
  |  Branch (96:5): [True: 7.62k, False: 42.7M]
  ------------------
   97|       |      /* Two bytes unsigned integer */
   98|  7.62k|      {
   99|  7.62k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (99:13): [True: 7.62k, False: 1]
  ------------------
  100|  7.62k|          callbacks->uint16(context, _cbor_load_uint16(source + 1));
  101|  7.62k|        }
  102|  7.62k|        return result;
  103|  17.5M|      }
  104|   477k|    case 0x1A:
  ------------------
  |  Branch (104:5): [True: 477k, False: 42.2M]
  ------------------
  105|       |      /* Four bytes unsigned integer */
  106|   477k|      {
  107|   477k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (107:13): [True: 477k, False: 4]
  ------------------
  108|   477k|          callbacks->uint32(context, _cbor_load_uint32(source + 1));
  109|   477k|        }
  110|   477k|        return result;
  111|  17.5M|      }
  112|  9.42k|    case 0x1B:
  ------------------
  |  Branch (112:5): [True: 9.42k, False: 42.7M]
  ------------------
  113|       |      /* Eight bytes unsigned integer */
  114|  9.42k|      {
  115|  9.42k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (115:13): [True: 9.42k, False: 2]
  ------------------
  116|  9.42k|          callbacks->uint64(context, _cbor_load_uint64(source + 1));
  117|  9.42k|        }
  118|  9.42k|        return result;
  119|  17.5M|      }
  120|      1|    case 0x1C: /* Fallthrough */
  ------------------
  |  Branch (120:5): [True: 1, False: 42.7M]
  ------------------
  121|      6|    case 0x1D: /* Fallthrough */
  ------------------
  |  Branch (121:5): [True: 5, False: 42.7M]
  ------------------
  122|      7|    case 0x1E: /* Fallthrough */
  ------------------
  |  Branch (122:5): [True: 1, False: 42.7M]
  ------------------
  123|     10|    case 0x1F:
  ------------------
  |  Branch (123:5): [True: 3, False: 42.7M]
  ------------------
  124|       |      /* Reserved */
  125|     10|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  126|  6.35k|    case 0x20: /* Fallthrough */
  ------------------
  |  Branch (126:5): [True: 6.35k, False: 42.7M]
  ------------------
  127|  8.06k|    case 0x21: /* Fallthrough */
  ------------------
  |  Branch (127:5): [True: 1.70k, False: 42.7M]
  ------------------
  128|  9.30k|    case 0x22: /* Fallthrough */
  ------------------
  |  Branch (128:5): [True: 1.23k, False: 42.7M]
  ------------------
  129|  14.3k|    case 0x23: /* Fallthrough */
  ------------------
  |  Branch (129:5): [True: 5.07k, False: 42.7M]
  ------------------
  130|  25.0k|    case 0x24: /* Fallthrough */
  ------------------
  |  Branch (130:5): [True: 10.6k, False: 42.7M]
  ------------------
  131|   187k|    case 0x25: /* Fallthrough */
  ------------------
  |  Branch (131:5): [True: 162k, False: 42.5M]
  ------------------
  132|   449k|    case 0x26: /* Fallthrough */
  ------------------
  |  Branch (132:5): [True: 261k, False: 42.4M]
  ------------------
  133|   451k|    case 0x27: /* Fallthrough */
  ------------------
  |  Branch (133:5): [True: 2.37k, False: 42.7M]
  ------------------
  134|  2.59M|    case 0x28: /* Fallthrough */
  ------------------
  |  Branch (134:5): [True: 2.14M, False: 40.5M]
  ------------------
  135|  2.59M|    case 0x29: /* Fallthrough */
  ------------------
  |  Branch (135:5): [True: 1.38k, False: 42.7M]
  ------------------
  136|  2.59M|    case 0x2A: /* Fallthrough */
  ------------------
  |  Branch (136:5): [True: 1.44k, False: 42.7M]
  ------------------
  137|  2.70M|    case 0x2B: /* Fallthrough */
  ------------------
  |  Branch (137:5): [True: 108k, False: 42.6M]
  ------------------
  138|  2.82M|    case 0x2C: /* Fallthrough */
  ------------------
  |  Branch (138:5): [True: 125k, False: 42.5M]
  ------------------
  139|  2.84M|    case 0x2D: /* Fallthrough */
  ------------------
  |  Branch (139:5): [True: 16.1k, False: 42.7M]
  ------------------
  140|  2.93M|    case 0x2E: /* Fallthrough */
  ------------------
  |  Branch (140:5): [True: 88.0k, False: 42.6M]
  ------------------
  141|  2.93M|    case 0x2F: /* Fallthrough */
  ------------------
  |  Branch (141:5): [True: 5.55k, False: 42.7M]
  ------------------
  142|  3.18M|    case 0x30: /* Fallthrough */
  ------------------
  |  Branch (142:5): [True: 242k, False: 42.4M]
  ------------------
  143|  3.22M|    case 0x31: /* Fallthrough */
  ------------------
  |  Branch (143:5): [True: 43.9k, False: 42.6M]
  ------------------
  144|  3.32M|    case 0x32: /* Fallthrough */
  ------------------
  |  Branch (144:5): [True: 104k, False: 42.6M]
  ------------------
  145|  3.35M|    case 0x33: /* Fallthrough */
  ------------------
  |  Branch (145:5): [True: 29.1k, False: 42.6M]
  ------------------
  146|  3.37M|    case 0x34: /* Fallthrough */
  ------------------
  |  Branch (146:5): [True: 11.5k, False: 42.7M]
  ------------------
  147|  3.53M|    case 0x35: /* Fallthrough */
  ------------------
  |  Branch (147:5): [True: 159k, False: 42.5M]
  ------------------
  148|  3.67M|    case 0x36: /* Fallthrough */
  ------------------
  |  Branch (148:5): [True: 142k, False: 42.5M]
  ------------------
  149|  3.76M|    case 0x37:
  ------------------
  |  Branch (149:5): [True: 95.0k, False: 42.6M]
  ------------------
  150|       |      /* Embedded one byte negative integer */
  151|  3.76M|      {
  152|  3.76M|        callbacks->negint8(context,
  153|  3.76M|                           _cbor_load_uint8(source) - 0x20); /* 0x20 offset */
  154|  3.76M|        return result;
  155|  3.67M|      }
  156|  21.1k|    case 0x38:
  ------------------
  |  Branch (156:5): [True: 21.1k, False: 42.7M]
  ------------------
  157|       |      /* One byte negative integer */
  158|  21.1k|      {
  159|  21.1k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (159:13): [True: 21.1k, False: 2]
  ------------------
  160|  21.1k|          callbacks->negint8(context, _cbor_load_uint8(source + 1));
  161|  21.1k|        }
  162|  21.1k|        return result;
  163|  3.67M|      }
  164|  46.1k|    case 0x39:
  ------------------
  |  Branch (164:5): [True: 46.1k, False: 42.6M]
  ------------------
  165|       |      /* Two bytes negative integer */
  166|  46.1k|      {
  167|  46.1k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (167:13): [True: 46.1k, False: 2]
  ------------------
  168|  46.1k|          callbacks->negint16(context, _cbor_load_uint16(source + 1));
  169|  46.1k|        }
  170|  46.1k|        return result;
  171|  3.67M|      }
  172|  11.9k|    case 0x3A:
  ------------------
  |  Branch (172:5): [True: 11.9k, False: 42.7M]
  ------------------
  173|       |      /* Four bytes negative integer */
  174|  11.9k|      {
  175|  11.9k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (175:13): [True: 11.9k, False: 3]
  ------------------
  176|  11.9k|          callbacks->negint32(context, _cbor_load_uint32(source + 1));
  177|  11.9k|        }
  178|  11.9k|        return result;
  179|  3.67M|      }
  180|  3.85k|    case 0x3B:
  ------------------
  |  Branch (180:5): [True: 3.85k, False: 42.7M]
  ------------------
  181|       |      /* Eight bytes negative integer */
  182|  3.85k|      {
  183|  3.85k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (183:13): [True: 3.84k, False: 2]
  ------------------
  184|  3.84k|          callbacks->negint64(context, _cbor_load_uint64(source + 1));
  185|  3.84k|        }
  186|  3.85k|        return result;
  187|  3.67M|      }
  188|      3|    case 0x3C: /* Fallthrough */
  ------------------
  |  Branch (188:5): [True: 3, False: 42.7M]
  ------------------
  189|      5|    case 0x3D: /* Fallthrough */
  ------------------
  |  Branch (189:5): [True: 2, False: 42.7M]
  ------------------
  190|      6|    case 0x3E: /* Fallthrough */
  ------------------
  |  Branch (190:5): [True: 1, False: 42.7M]
  ------------------
  191|      7|    case 0x3F:
  ------------------
  |  Branch (191:5): [True: 1, False: 42.7M]
  ------------------
  192|       |      /* Reserved */
  193|      7|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  194|  18.2k|    case 0x40: /* Fallthrough */
  ------------------
  |  Branch (194:5): [True: 18.2k, False: 42.7M]
  ------------------
  195|  1.55M|    case 0x41: /* Fallthrough */
  ------------------
  |  Branch (195:5): [True: 1.53M, False: 41.1M]
  ------------------
  196|  1.55M|    case 0x42: /* Fallthrough */
  ------------------
  |  Branch (196:5): [True: 563, False: 42.7M]
  ------------------
  197|  1.55M|    case 0x43: /* Fallthrough */
  ------------------
  |  Branch (197:5): [True: 597, False: 42.7M]
  ------------------
  198|  1.55M|    case 0x44: /* Fallthrough */
  ------------------
  |  Branch (198:5): [True: 1.20k, False: 42.7M]
  ------------------
  199|  1.55M|    case 0x45: /* Fallthrough */
  ------------------
  |  Branch (199:5): [True: 1.06k, False: 42.7M]
  ------------------
  200|  1.55M|    case 0x46: /* Fallthrough */
  ------------------
  |  Branch (200:5): [True: 4.43k, False: 42.7M]
  ------------------
  201|  1.55M|    case 0x47: /* Fallthrough */
  ------------------
  |  Branch (201:5): [True: 423, False: 42.7M]
  ------------------
  202|  1.56M|    case 0x48: /* Fallthrough */
  ------------------
  |  Branch (202:5): [True: 1.58k, False: 42.7M]
  ------------------
  203|  1.56M|    case 0x49: /* Fallthrough */
  ------------------
  |  Branch (203:5): [True: 2.34k, False: 42.7M]
  ------------------
  204|  1.56M|    case 0x4A: /* Fallthrough */
  ------------------
  |  Branch (204:5): [True: 905, False: 42.7M]
  ------------------
  205|  1.56M|    case 0x4B: /* Fallthrough */
  ------------------
  |  Branch (205:5): [True: 691, False: 42.7M]
  ------------------
  206|  1.56M|    case 0x4C: /* Fallthrough */
  ------------------
  |  Branch (206:5): [True: 541, False: 42.7M]
  ------------------
  207|  1.56M|    case 0x4D: /* Fallthrough */
  ------------------
  |  Branch (207:5): [True: 3.80k, False: 42.7M]
  ------------------
  208|  1.56M|    case 0x4E: /* Fallthrough */
  ------------------
  |  Branch (208:5): [True: 883, False: 42.7M]
  ------------------
  209|  1.57M|    case 0x4F: /* Fallthrough */
  ------------------
  |  Branch (209:5): [True: 1.01k, False: 42.7M]
  ------------------
  210|  1.57M|    case 0x50: /* Fallthrough */
  ------------------
  |  Branch (210:5): [True: 1.11k, False: 42.7M]
  ------------------
  211|  1.57M|    case 0x51: /* Fallthrough */
  ------------------
  |  Branch (211:5): [True: 2.47k, False: 42.7M]
  ------------------
  212|  1.57M|    case 0x52: /* Fallthrough */
  ------------------
  |  Branch (212:5): [True: 267, False: 42.7M]
  ------------------
  213|  1.57M|    case 0x53: /* Fallthrough */
  ------------------
  |  Branch (213:5): [True: 222, False: 42.7M]
  ------------------
  214|  1.57M|    case 0x54: /* Fallthrough */
  ------------------
  |  Branch (214:5): [True: 4.07k, False: 42.7M]
  ------------------
  215|  1.57M|    case 0x55: /* Fallthrough */
  ------------------
  |  Branch (215:5): [True: 919, False: 42.7M]
  ------------------
  216|  1.58M|    case 0x56: /* Fallthrough */
  ------------------
  |  Branch (216:5): [True: 278, False: 42.7M]
  ------------------
  217|  1.58M|    case 0x57:
  ------------------
  |  Branch (217:5): [True: 210, False: 42.7M]
  ------------------
  218|       |      /* Embedded length byte string */
  219|  1.58M|      {
  220|  1.58M|        uint64_t length = _cbor_load_uint8(source) - 0x40; /* 0x40 offset */
  221|  1.58M|        CLAIM_BYTES_AND_INVOKE(byte_string, length, 0);
  ------------------
  |  |   33|  1.58M|  do {                                                                     \
  |  |   34|  1.58M|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (34:9): [True: 1.58M, False: 192]
  |  |  ------------------
  |  |   35|  1.58M|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   36|  1.58M|                               length);                                    \
  |  |   37|  1.58M|    }                                                                      \
  |  |   38|  1.58M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (38:12): [Folded, False: 1.58M]
  |  |  ------------------
  ------------------
  222|  1.58M|        return result;
  223|  1.58M|      }
  224|    991|    case 0x58:
  ------------------
  |  Branch (224:5): [True: 991, False: 42.7M]
  ------------------
  225|       |      /* One byte length byte string */
  226|    991|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint8, 1);
  ------------------
  |  |   41|    991|  do {                                                                \
  |  |   42|    991|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 988, False: 3]
  |  |  ------------------
  |  |   43|    988|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    988|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    988|  do {                                                                     \
  |  |  |  |   34|    988|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 986, False: 2]
  |  |  |  |  ------------------
  |  |  |  |   35|    986|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    986|                               length);                                    \
  |  |  |  |   37|    986|    }                                                                      \
  |  |  |  |   38|    988|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 988]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    988|    }                                                                 \
  |  |   46|    991|    return result;                                                    \
  |  |   47|    991|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  227|    260|    case 0x59:
  ------------------
  |  Branch (227:5): [True: 260, False: 42.7M]
  ------------------
  228|       |      /* Two bytes length byte string */
  229|    260|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint16, 2);
  ------------------
  |  |   41|    260|  do {                                                                \
  |  |   42|    260|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 258, False: 2]
  |  |  ------------------
  |  |   43|    258|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    258|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    258|  do {                                                                     \
  |  |  |  |   34|    258|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 246, False: 12]
  |  |  |  |  ------------------
  |  |  |  |   35|    246|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    246|                               length);                                    \
  |  |  |  |   37|    246|    }                                                                      \
  |  |  |  |   38|    258|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 258]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    258|    }                                                                 \
  |  |   46|    260|    return result;                                                    \
  |  |   47|    260|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  230|    237|    case 0x5A:
  ------------------
  |  Branch (230:5): [True: 237, False: 42.7M]
  ------------------
  231|       |      /* Four bytes length byte string */
  232|    237|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint32, 4);
  ------------------
  |  |   41|    237|  do {                                                                \
  |  |   42|    237|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 235, False: 2]
  |  |  ------------------
  |  |   43|    235|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    235|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    235|  do {                                                                     \
  |  |  |  |   34|    235|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 221, False: 14]
  |  |  |  |  ------------------
  |  |  |  |   35|    221|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    221|                               length);                                    \
  |  |  |  |   37|    221|    }                                                                      \
  |  |  |  |   38|    235|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 235]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    235|    }                                                                 \
  |  |   46|    237|    return result;                                                    \
  |  |   47|    237|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  233|    352|    case 0x5B:
  ------------------
  |  Branch (233:5): [True: 352, False: 42.7M]
  ------------------
  234|       |      /* Eight bytes length byte string */
  235|    352|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint64, 8);
  ------------------
  |  |   41|    352|  do {                                                                \
  |  |   42|    352|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 348, False: 4]
  |  |  ------------------
  |  |   43|    348|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    348|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    348|  do {                                                                     \
  |  |  |  |   34|    348|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 316, False: 32]
  |  |  |  |  ------------------
  |  |  |  |   35|    316|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    316|                               length);                                    \
  |  |  |  |   37|    316|    }                                                                      \
  |  |  |  |   38|    348|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 348]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    348|    }                                                                 \
  |  |   46|    352|    return result;                                                    \
  |  |   47|    352|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  236|      1|    case 0x5C: /* Fallthrough */
  ------------------
  |  Branch (236:5): [True: 1, False: 42.7M]
  ------------------
  237|      2|    case 0x5D: /* Fallthrough */
  ------------------
  |  Branch (237:5): [True: 1, False: 42.7M]
  ------------------
  238|      3|    case 0x5E:
  ------------------
  |  Branch (238:5): [True: 1, False: 42.7M]
  ------------------
  239|       |      /* Reserved */
  240|      3|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  241|  4.00k|    case 0x5F:
  ------------------
  |  Branch (241:5): [True: 4.00k, False: 42.7M]
  ------------------
  242|       |      /* Indefinite byte string */
  243|  4.00k|      {
  244|  4.00k|        callbacks->byte_string_start(context);
  245|  4.00k|        return result;
  246|      2|      }
  247|  30.4k|    case 0x60: /* Fallthrough */
  ------------------
  |  Branch (247:5): [True: 30.4k, False: 42.6M]
  ------------------
  248|  2.66M|    case 0x61: /* Fallthrough */
  ------------------
  |  Branch (248:5): [True: 2.63M, False: 40.0M]
  ------------------
  249|  2.66M|    case 0x62: /* Fallthrough */
  ------------------
  |  Branch (249:5): [True: 406, False: 42.7M]
  ------------------
  250|  2.67M|    case 0x63: /* Fallthrough */
  ------------------
  |  Branch (250:5): [True: 9.74k, False: 42.7M]
  ------------------
  251|  2.67M|    case 0x64: /* Fallthrough */
  ------------------
  |  Branch (251:5): [True: 761, False: 42.7M]
  ------------------
  252|  2.67M|    case 0x65: /* Fallthrough */
  ------------------
  |  Branch (252:5): [True: 441, False: 42.7M]
  ------------------
  253|  2.67M|    case 0x66: /* Fallthrough */
  ------------------
  |  Branch (253:5): [True: 1.15k, False: 42.7M]
  ------------------
  254|  2.67M|    case 0x67: /* Fallthrough */
  ------------------
  |  Branch (254:5): [True: 621, False: 42.7M]
  ------------------
  255|  2.67M|    case 0x68: /* Fallthrough */
  ------------------
  |  Branch (255:5): [True: 470, False: 42.7M]
  ------------------
  256|  2.67M|    case 0x69: /* Fallthrough */
  ------------------
  |  Branch (256:5): [True: 1.55k, False: 42.7M]
  ------------------
  257|  2.67M|    case 0x6A: /* Fallthrough */
  ------------------
  |  Branch (257:5): [True: 3.38k, False: 42.7M]
  ------------------
  258|  2.68M|    case 0x6B: /* Fallthrough */
  ------------------
  |  Branch (258:5): [True: 626, False: 42.7M]
  ------------------
  259|  2.68M|    case 0x6C: /* Fallthrough */
  ------------------
  |  Branch (259:5): [True: 681, False: 42.7M]
  ------------------
  260|  2.68M|    case 0x6D: /* Fallthrough */
  ------------------
  |  Branch (260:5): [True: 504, False: 42.7M]
  ------------------
  261|  2.68M|    case 0x6E: /* Fallthrough */
  ------------------
  |  Branch (261:5): [True: 423, False: 42.7M]
  ------------------
  262|  2.68M|    case 0x6F: /* Fallthrough */
  ------------------
  |  Branch (262:5): [True: 276, False: 42.7M]
  ------------------
  263|  2.68M|    case 0x70: /* Fallthrough */
  ------------------
  |  Branch (263:5): [True: 2.32k, False: 42.7M]
  ------------------
  264|  2.68M|    case 0x71: /* Fallthrough */
  ------------------
  |  Branch (264:5): [True: 2.35k, False: 42.7M]
  ------------------
  265|  2.68M|    case 0x72: /* Fallthrough */
  ------------------
  |  Branch (265:5): [True: 458, False: 42.7M]
  ------------------
  266|  2.68M|    case 0x73: /* Fallthrough */
  ------------------
  |  Branch (266:5): [True: 637, False: 42.7M]
  ------------------
  267|  2.69M|    case 0x74: /* Fallthrough */
  ------------------
  |  Branch (267:5): [True: 3.85k, False: 42.7M]
  ------------------
  268|  2.69M|    case 0x75: /* Fallthrough */
  ------------------
  |  Branch (268:5): [True: 2.03k, False: 42.7M]
  ------------------
  269|  2.69M|    case 0x76: /* Fallthrough */
  ------------------
  |  Branch (269:5): [True: 1.05k, False: 42.7M]
  ------------------
  270|  2.69M|    case 0x77:
  ------------------
  |  Branch (270:5): [True: 302, False: 42.7M]
  ------------------
  271|       |      /* Embedded one byte length string */
  272|  2.69M|      {
  273|  2.69M|        uint64_t length = _cbor_load_uint8(source) - 0x60; /* 0x60 offset */
  274|  2.69M|        CLAIM_BYTES_AND_INVOKE(string, length, 0);
  ------------------
  |  |   33|  2.69M|  do {                                                                     \
  |  |   34|  2.69M|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (34:9): [True: 2.69M, False: 198]
  |  |  ------------------
  |  |   35|  2.69M|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   36|  2.69M|                               length);                                    \
  |  |   37|  2.69M|    }                                                                      \
  |  |   38|  2.69M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (38:12): [Folded, False: 2.69M]
  |  |  ------------------
  ------------------
  275|  2.69M|        return result;
  276|  2.69M|      }
  277|  10.8k|    case 0x78:
  ------------------
  |  Branch (277:5): [True: 10.8k, False: 42.7M]
  ------------------
  278|       |      /* One byte length string */
  279|  10.8k|      READ_CLAIM_INVOKE(string, _cbor_load_uint8, 1);
  ------------------
  |  |   41|  10.8k|  do {                                                                \
  |  |   42|  10.8k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 10.8k, False: 1]
  |  |  ------------------
  |  |   43|  10.8k|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|  10.8k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|  10.8k|  do {                                                                     \
  |  |  |  |   34|  10.8k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 10.8k, False: 3]
  |  |  |  |  ------------------
  |  |  |  |   35|  10.8k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|  10.8k|                               length);                                    \
  |  |  |  |   37|  10.8k|    }                                                                      \
  |  |  |  |   38|  10.8k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 10.8k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|  10.8k|    }                                                                 \
  |  |   46|  10.8k|    return result;                                                    \
  |  |   47|  10.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  280|    369|    case 0x79:
  ------------------
  |  Branch (280:5): [True: 369, False: 42.7M]
  ------------------
  281|       |      /* Two bytes length string */
  282|    369|      READ_CLAIM_INVOKE(string, _cbor_load_uint16, 2);
  ------------------
  |  |   41|    369|  do {                                                                \
  |  |   42|    369|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 368, False: 1]
  |  |  ------------------
  |  |   43|    368|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    368|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    368|  do {                                                                     \
  |  |  |  |   34|    368|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 357, False: 11]
  |  |  |  |  ------------------
  |  |  |  |   35|    357|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    357|                               length);                                    \
  |  |  |  |   37|    357|    }                                                                      \
  |  |  |  |   38|    368|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 368]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    368|    }                                                                 \
  |  |   46|    369|    return result;                                                    \
  |  |   47|    369|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  283|    273|    case 0x7A:
  ------------------
  |  Branch (283:5): [True: 273, False: 42.7M]
  ------------------
  284|       |      /* Four bytes length string */
  285|    273|      READ_CLAIM_INVOKE(string, _cbor_load_uint32, 4);
  ------------------
  |  |   41|    273|  do {                                                                \
  |  |   42|    273|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 269, False: 4]
  |  |  ------------------
  |  |   43|    269|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    269|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    269|  do {                                                                     \
  |  |  |  |   34|    269|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 254, False: 15]
  |  |  |  |  ------------------
  |  |  |  |   35|    254|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    254|                               length);                                    \
  |  |  |  |   37|    254|    }                                                                      \
  |  |  |  |   38|    269|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 269]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    269|    }                                                                 \
  |  |   46|    273|    return result;                                                    \
  |  |   47|    273|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  286|    245|    case 0x7B:
  ------------------
  |  Branch (286:5): [True: 245, False: 42.7M]
  ------------------
  287|       |      /* Eight bytes length string */
  288|    245|      READ_CLAIM_INVOKE(string, _cbor_load_uint64, 8);
  ------------------
  |  |   41|    245|  do {                                                                \
  |  |   42|    245|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 242, False: 3]
  |  |  ------------------
  |  |   43|    242|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    242|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    242|  do {                                                                     \
  |  |  |  |   34|    242|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 213, False: 29]
  |  |  |  |  ------------------
  |  |  |  |   35|    213|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    213|                               length);                                    \
  |  |  |  |   37|    213|    }                                                                      \
  |  |  |  |   38|    242|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 242]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    242|    }                                                                 \
  |  |   46|    245|    return result;                                                    \
  |  |   47|    245|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      2|    case 0x7C: /* Fallthrough */
  ------------------
  |  Branch (289:5): [True: 2, False: 42.7M]
  ------------------
  290|      4|    case 0x7D: /* Fallthrough */
  ------------------
  |  Branch (290:5): [True: 2, False: 42.7M]
  ------------------
  291|      7|    case 0x7E:
  ------------------
  |  Branch (291:5): [True: 3, False: 42.7M]
  ------------------
  292|       |      /* Reserved */
  293|      7|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  294|  13.7k|    case 0x7F:
  ------------------
  |  Branch (294:5): [True: 13.7k, False: 42.7M]
  ------------------
  295|       |      /* Indefinite length string */
  296|  13.7k|      {
  297|  13.7k|        callbacks->string_start(context);
  298|  13.7k|        return result;
  299|      4|      }
  300|    467|    case 0x80: /* Fallthrough */
  ------------------
  |  Branch (300:5): [True: 467, False: 42.7M]
  ------------------
  301|  12.0M|    case 0x81: /* Fallthrough */
  ------------------
  |  Branch (301:5): [True: 12.0M, False: 30.6M]
  ------------------
  302|  12.0M|    case 0x82: /* Fallthrough */
  ------------------
  |  Branch (302:5): [True: 16.0k, False: 42.7M]
  ------------------
  303|  12.0M|    case 0x83: /* Fallthrough */
  ------------------
  |  Branch (303:5): [True: 8.35k, False: 42.7M]
  ------------------
  304|  12.1M|    case 0x84: /* Fallthrough */
  ------------------
  |  Branch (304:5): [True: 17.2k, False: 42.7M]
  ------------------
  305|  12.1M|    case 0x85: /* Fallthrough */
  ------------------
  |  Branch (305:5): [True: 4.85k, False: 42.7M]
  ------------------
  306|  12.1M|    case 0x86: /* Fallthrough */
  ------------------
  |  Branch (306:5): [True: 553, False: 42.7M]
  ------------------
  307|  12.1M|    case 0x87: /* Fallthrough */
  ------------------
  |  Branch (307:5): [True: 485, False: 42.7M]
  ------------------
  308|  12.1M|    case 0x88: /* Fallthrough */
  ------------------
  |  Branch (308:5): [True: 5.18k, False: 42.7M]
  ------------------
  309|  12.1M|    case 0x89: /* Fallthrough */
  ------------------
  |  Branch (309:5): [True: 1.23k, False: 42.7M]
  ------------------
  310|  12.1M|    case 0x8A: /* Fallthrough */
  ------------------
  |  Branch (310:5): [True: 499, False: 42.7M]
  ------------------
  311|  12.1M|    case 0x8B: /* Fallthrough */
  ------------------
  |  Branch (311:5): [True: 409, False: 42.7M]
  ------------------
  312|  12.1M|    case 0x8C: /* Fallthrough */
  ------------------
  |  Branch (312:5): [True: 3.30k, False: 42.7M]
  ------------------
  313|  12.1M|    case 0x8D: /* Fallthrough */
  ------------------
  |  Branch (313:5): [True: 1.34k, False: 42.7M]
  ------------------
  314|  12.1M|    case 0x8E: /* Fallthrough */
  ------------------
  |  Branch (314:5): [True: 2.49k, False: 42.7M]
  ------------------
  315|  12.1M|    case 0x8F: /* Fallthrough */
  ------------------
  |  Branch (315:5): [True: 289, False: 42.7M]
  ------------------
  316|  12.1M|    case 0x90: /* Fallthrough */
  ------------------
  |  Branch (316:5): [True: 322, False: 42.7M]
  ------------------
  317|  12.1M|    case 0x91: /* Fallthrough */
  ------------------
  |  Branch (317:5): [True: 1.12k, False: 42.7M]
  ------------------
  318|  12.1M|    case 0x92: /* Fallthrough */
  ------------------
  |  Branch (318:5): [True: 960, False: 42.7M]
  ------------------
  319|  12.1M|    case 0x93: /* Fallthrough */
  ------------------
  |  Branch (319:5): [True: 315, False: 42.7M]
  ------------------
  320|  12.1M|    case 0x94: /* Fallthrough */
  ------------------
  |  Branch (320:5): [True: 450, False: 42.7M]
  ------------------
  321|  12.1M|    case 0x95: /* Fallthrough */
  ------------------
  |  Branch (321:5): [True: 23.7k, False: 42.7M]
  ------------------
  322|  12.1M|    case 0x96: /* Fallthrough */
  ------------------
  |  Branch (322:5): [True: 6.11k, False: 42.7M]
  ------------------
  323|  12.1M|    case 0x97:
  ------------------
  |  Branch (323:5): [True: 1.52k, False: 42.7M]
  ------------------
  324|       |      /* Embedded one byte length array */
  325|  12.1M|      {
  326|  12.1M|        callbacks->array_start(
  327|  12.1M|            context, _cbor_load_uint8(source) - 0x80); /* 0x40 offset */
  328|  12.1M|        return result;
  329|  12.1M|      }
  330|    522|    case 0x98:
  ------------------
  |  Branch (330:5): [True: 522, False: 42.7M]
  ------------------
  331|       |      /* One byte length array */
  332|    522|      {
  333|    522|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (333:13): [True: 521, False: 1]
  ------------------
  334|    521|          callbacks->array_start(context, _cbor_load_uint8(source + 1));
  335|    521|        }
  336|    522|        return result;
  337|  12.1M|      }
  338|    318|    case 0x99:
  ------------------
  |  Branch (338:5): [True: 318, False: 42.7M]
  ------------------
  339|       |      /* Two bytes length array */
  340|    318|      {
  341|    318|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (341:13): [True: 314, False: 4]
  ------------------
  342|    314|          callbacks->array_start(context, _cbor_load_uint16(source + 1));
  343|    314|        }
  344|    318|        return result;
  345|  12.1M|      }
  346|    498|    case 0x9A:
  ------------------
  |  Branch (346:5): [True: 498, False: 42.7M]
  ------------------
  347|       |      /* Four bytes length array */
  348|    498|      {
  349|    498|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (349:13): [True: 496, False: 2]
  ------------------
  350|    496|          callbacks->array_start(context, _cbor_load_uint32(source + 1));
  351|    496|        }
  352|    498|        return result;
  353|  12.1M|      }
  354|    308|    case 0x9B:
  ------------------
  |  Branch (354:5): [True: 308, False: 42.7M]
  ------------------
  355|       |      /* Eight bytes length array */
  356|    308|      {
  357|    308|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (357:13): [True: 307, False: 1]
  ------------------
  358|    307|          callbacks->array_start(context, _cbor_load_uint64(source + 1));
  359|    307|        }
  360|    308|        return result;
  361|  12.1M|      }
  362|      1|    case 0x9C: /* Fallthrough */
  ------------------
  |  Branch (362:5): [True: 1, False: 42.7M]
  ------------------
  363|      3|    case 0x9D: /* Fallthrough */
  ------------------
  |  Branch (363:5): [True: 2, False: 42.7M]
  ------------------
  364|      4|    case 0x9E:
  ------------------
  |  Branch (364:5): [True: 1, False: 42.7M]
  ------------------
  365|       |      /* Reserved */
  366|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  367|   807k|    case 0x9F:
  ------------------
  |  Branch (367:5): [True: 807k, False: 41.9M]
  ------------------
  368|       |      /* Indefinite length array */
  369|   807k|      {
  370|   807k|        callbacks->indef_array_start(context);
  371|   807k|        return result;
  372|      3|      }
  373|    614|    case 0xA0: /* Fallthrough */
  ------------------
  |  Branch (373:5): [True: 614, False: 42.7M]
  ------------------
  374|  13.6k|    case 0xA1: /* Fallthrough */
  ------------------
  |  Branch (374:5): [True: 13.0k, False: 42.7M]
  ------------------
  375|  15.8k|    case 0xA2: /* Fallthrough */
  ------------------
  |  Branch (375:5): [True: 2.18k, False: 42.7M]
  ------------------
  376|  16.9k|    case 0xA3: /* Fallthrough */
  ------------------
  |  Branch (376:5): [True: 1.07k, False: 42.7M]
  ------------------
  377|  21.2k|    case 0xA4: /* Fallthrough */
  ------------------
  |  Branch (377:5): [True: 4.34k, False: 42.7M]
  ------------------
  378|  25.2k|    case 0xA5: /* Fallthrough */
  ------------------
  |  Branch (378:5): [True: 3.94k, False: 42.7M]
  ------------------
  379|  25.9k|    case 0xA6: /* Fallthrough */
  ------------------
  |  Branch (379:5): [True: 771, False: 42.7M]
  ------------------
  380|  29.0k|    case 0xA7: /* Fallthrough */
  ------------------
  |  Branch (380:5): [True: 3.08k, False: 42.7M]
  ------------------
  381|  29.5k|    case 0xA8: /* Fallthrough */
  ------------------
  |  Branch (381:5): [True: 440, False: 42.7M]
  ------------------
  382|  30.0k|    case 0xA9: /* Fallthrough */
  ------------------
  |  Branch (382:5): [True: 527, False: 42.7M]
  ------------------
  383|  30.8k|    case 0xAA: /* Fallthrough */
  ------------------
  |  Branch (383:5): [True: 785, False: 42.7M]
  ------------------
  384|  31.2k|    case 0xAB: /* Fallthrough */
  ------------------
  |  Branch (384:5): [True: 407, False: 42.7M]
  ------------------
  385|  31.5k|    case 0xAC: /* Fallthrough */
  ------------------
  |  Branch (385:5): [True: 294, False: 42.7M]
  ------------------
  386|  31.8k|    case 0xAD: /* Fallthrough */
  ------------------
  |  Branch (386:5): [True: 307, False: 42.7M]
  ------------------
  387|  32.2k|    case 0xAE: /* Fallthrough */
  ------------------
  |  Branch (387:5): [True: 434, False: 42.7M]
  ------------------
  388|  32.9k|    case 0xAF: /* Fallthrough */
  ------------------
  |  Branch (388:5): [True: 672, False: 42.7M]
  ------------------
  389|  50.4k|    case 0xB0: /* Fallthrough */
  ------------------
  |  Branch (389:5): [True: 17.4k, False: 42.7M]
  ------------------
  390|  50.9k|    case 0xB1: /* Fallthrough */
  ------------------
  |  Branch (390:5): [True: 513, False: 42.7M]
  ------------------
  391|  53.0k|    case 0xB2: /* Fallthrough */
  ------------------
  |  Branch (391:5): [True: 2.14k, False: 42.7M]
  ------------------
  392|  55.4k|    case 0xB3: /* Fallthrough */
  ------------------
  |  Branch (392:5): [True: 2.41k, False: 42.7M]
  ------------------
  393|  55.7k|    case 0xB4: /* Fallthrough */
  ------------------
  |  Branch (393:5): [True: 258, False: 42.7M]
  ------------------
  394|  56.9k|    case 0xB5: /* Fallthrough */
  ------------------
  |  Branch (394:5): [True: 1.22k, False: 42.7M]
  ------------------
  395|  57.3k|    case 0xB6: /* Fallthrough */
  ------------------
  |  Branch (395:5): [True: 417, False: 42.7M]
  ------------------
  396|  58.0k|    case 0xB7:
  ------------------
  |  Branch (396:5): [True: 685, False: 42.7M]
  ------------------
  397|       |      /* Embedded one byte length map */
  398|  58.0k|      {
  399|  58.0k|        callbacks->map_start(context,
  400|  58.0k|                             _cbor_load_uint8(source) - 0xA0); /* 0xA0 offset */
  401|  58.0k|        return result;
  402|  57.3k|      }
  403|  1.39k|    case 0xB8:
  ------------------
  |  Branch (403:5): [True: 1.39k, False: 42.7M]
  ------------------
  404|       |      /* One byte length map */
  405|  1.39k|      {
  406|  1.39k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (406:13): [True: 1.39k, False: 2]
  ------------------
  407|  1.39k|          callbacks->map_start(context, _cbor_load_uint8(source + 1));
  408|  1.39k|        }
  409|  1.39k|        return result;
  410|  57.3k|      }
  411|  11.5k|    case 0xB9:
  ------------------
  |  Branch (411:5): [True: 11.5k, False: 42.7M]
  ------------------
  412|       |      /* Two bytes length map */
  413|  11.5k|      {
  414|  11.5k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (414:13): [True: 11.5k, False: 1]
  ------------------
  415|  11.5k|          callbacks->map_start(context, _cbor_load_uint16(source + 1));
  416|  11.5k|        }
  417|  11.5k|        return result;
  418|  57.3k|      }
  419|    373|    case 0xBA:
  ------------------
  |  Branch (419:5): [True: 373, False: 42.7M]
  ------------------
  420|       |      /* Four bytes length map */
  421|    373|      {
  422|    373|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (422:13): [True: 368, False: 5]
  ------------------
  423|    368|          callbacks->map_start(context, _cbor_load_uint32(source + 1));
  424|    368|        }
  425|    373|        return result;
  426|  57.3k|      }
  427|    423|    case 0xBB:
  ------------------
  |  Branch (427:5): [True: 423, False: 42.7M]
  ------------------
  428|       |      /* Eight bytes length map */
  429|    423|      {
  430|    423|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (430:13): [True: 420, False: 3]
  ------------------
  431|    420|          callbacks->map_start(context, _cbor_load_uint64(source + 1));
  432|    420|        }
  433|    423|        return result;
  434|  57.3k|      }
  435|      2|    case 0xBC: /* Fallthrough */
  ------------------
  |  Branch (435:5): [True: 2, False: 42.7M]
  ------------------
  436|      7|    case 0xBD: /* Fallthrough */
  ------------------
  |  Branch (436:5): [True: 5, False: 42.7M]
  ------------------
  437|      9|    case 0xBE:
  ------------------
  |  Branch (437:5): [True: 2, False: 42.7M]
  ------------------
  438|       |      /* Reserved */
  439|      9|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  440|  6.99k|    case 0xBF:
  ------------------
  |  Branch (440:5): [True: 6.99k, False: 42.7M]
  ------------------
  441|       |      /* Indefinite length map */
  442|  6.99k|      {
  443|  6.99k|        callbacks->indef_map_start(context);
  444|  6.99k|        return result;
  445|      7|      }
  446|       |      /* See https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml for tag
  447|       |       * assignment. All well-formed tags are processed regardless of validity
  448|       |       * since maintaining the known mapping would be impractical.
  449|       |       *
  450|       |       * Moreover, even tags in the reserved "standard" range are not assigned
  451|       |       * but may get assigned in the future (see e.g.
  452|       |       * https://github.com/PJK/libcbor/issues/307), so processing all tags
  453|       |       * improves forward compatibility.
  454|       |       */
  455|  29.7k|    case 0xC0: /* Fallthrough */
  ------------------
  |  Branch (455:5): [True: 29.7k, False: 42.6M]
  ------------------
  456|  37.4k|    case 0xC1: /* Fallthrough */
  ------------------
  |  Branch (456:5): [True: 7.63k, False: 42.7M]
  ------------------
  457|  57.7k|    case 0xC2: /* Fallthrough */
  ------------------
  |  Branch (457:5): [True: 20.3k, False: 42.7M]
  ------------------
  458|  65.7k|    case 0xC3: /* Fallthrough */
  ------------------
  |  Branch (458:5): [True: 7.99k, False: 42.7M]
  ------------------
  459|  68.8k|    case 0xC4: /* Fallthrough */
  ------------------
  |  Branch (459:5): [True: 3.11k, False: 42.7M]
  ------------------
  460|   102k|    case 0xC5: /* Fallthrough */
  ------------------
  |  Branch (460:5): [True: 33.6k, False: 42.6M]
  ------------------
  461|   105k|    case 0xC6: /* Fallthrough */
  ------------------
  |  Branch (461:5): [True: 2.99k, False: 42.7M]
  ------------------
  462|   111k|    case 0xC7: /* Fallthrough */
  ------------------
  |  Branch (462:5): [True: 5.95k, False: 42.7M]
  ------------------
  463|   113k|    case 0xC8: /* Fallthrough */
  ------------------
  |  Branch (463:5): [True: 1.60k, False: 42.7M]
  ------------------
  464|   118k|    case 0xC9: /* Fallthrough */
  ------------------
  |  Branch (464:5): [True: 5.27k, False: 42.7M]
  ------------------
  465|   120k|    case 0xCA: /* Fallthrough */
  ------------------
  |  Branch (465:5): [True: 1.91k, False: 42.7M]
  ------------------
  466|   120k|    case 0xCB: /* Fallthrough */
  ------------------
  |  Branch (466:5): [True: 529, False: 42.7M]
  ------------------
  467|   124k|    case 0xCC: /* Fallthrough */
  ------------------
  |  Branch (467:5): [True: 3.22k, False: 42.7M]
  ------------------
  468|   126k|    case 0xCD: /* Fallthrough */
  ------------------
  |  Branch (468:5): [True: 2.47k, False: 42.7M]
  ------------------
  469|   155k|    case 0xCE: /* Fallthrough */
  ------------------
  |  Branch (469:5): [True: 29.3k, False: 42.6M]
  ------------------
  470|   158k|    case 0xCF: /* Fallthrough */
  ------------------
  |  Branch (470:5): [True: 2.41k, False: 42.7M]
  ------------------
  471|   161k|    case 0xD0: /* Fallthrough */
  ------------------
  |  Branch (471:5): [True: 2.72k, False: 42.7M]
  ------------------
  472|   161k|    case 0xD1: /* Fallthrough */
  ------------------
  |  Branch (472:5): [True: 838, False: 42.7M]
  ------------------
  473|   162k|    case 0xD2: /* Fallthrough */
  ------------------
  |  Branch (473:5): [True: 755, False: 42.7M]
  ------------------
  474|   165k|    case 0xD3: /* Fallthrough */
  ------------------
  |  Branch (474:5): [True: 2.56k, False: 42.7M]
  ------------------
  475|   166k|    case 0xD4: /* Fallthrough */
  ------------------
  |  Branch (475:5): [True: 917, False: 42.7M]
  ------------------
  476|   167k|    case 0xD5: /* Fallthrough */
  ------------------
  |  Branch (476:5): [True: 1.47k, False: 42.7M]
  ------------------
  477|   170k|    case 0xD6: /* Fallthrough */
  ------------------
  |  Branch (477:5): [True: 2.90k, False: 42.7M]
  ------------------
  478|   299k|    case 0xD7: /* Fallthrough */
  ------------------
  |  Branch (478:5): [True: 129k, False: 42.5M]
  ------------------
  479|   299k|    {
  480|   299k|      callbacks->tag(context, (uint64_t)(_cbor_load_uint8(source) -
  481|   299k|                                         0xC0)); /* 0xC0 offset */
  482|   299k|      return result;
  483|   170k|    }
  484|  1.48k|    case 0xD8: /* 1B tag */
  ------------------
  |  Branch (484:5): [True: 1.48k, False: 42.7M]
  ------------------
  485|  1.48k|    {
  486|  1.48k|      if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (486:11): [True: 1.48k, False: 1]
  ------------------
  487|  1.48k|        callbacks->tag(context, _cbor_load_uint8(source + 1));
  488|  1.48k|      }
  489|  1.48k|      return result;
  490|   170k|    }
  491|  2.36k|    case 0xD9: /* 2B tag */
  ------------------
  |  Branch (491:5): [True: 2.36k, False: 42.7M]
  ------------------
  492|  2.36k|    {
  493|  2.36k|      if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (493:11): [True: 2.36k, False: 1]
  ------------------
  494|  2.36k|        callbacks->tag(context, _cbor_load_uint16(source + 1));
  495|  2.36k|      }
  496|  2.36k|      return result;
  497|   170k|    }
  498|  9.47k|    case 0xDA: /* 4B tag */
  ------------------
  |  Branch (498:5): [True: 9.47k, False: 42.7M]
  ------------------
  499|  9.47k|    {
  500|  9.47k|      if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (500:11): [True: 9.47k, False: 2]
  ------------------
  501|  9.47k|        callbacks->tag(context, _cbor_load_uint32(source + 1));
  502|  9.47k|      }
  503|  9.47k|      return result;
  504|   170k|    }
  505|  3.60k|    case 0xDB: /* 8B tag */
  ------------------
  |  Branch (505:5): [True: 3.60k, False: 42.7M]
  ------------------
  506|  3.60k|    {
  507|  3.60k|      if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (507:11): [True: 3.59k, False: 1]
  ------------------
  508|  3.59k|        callbacks->tag(context, _cbor_load_uint64(source + 1));
  509|  3.59k|      }
  510|  3.60k|      return result;
  511|   170k|    }
  512|      1|    case 0xDC: /* Fallthrough */
  ------------------
  |  Branch (512:5): [True: 1, False: 42.7M]
  ------------------
  513|      2|    case 0xDD: /* Fallthrough */
  ------------------
  |  Branch (513:5): [True: 1, False: 42.7M]
  ------------------
  514|      5|    case 0xDE: /* Fallthrough */
  ------------------
  |  Branch (514:5): [True: 3, False: 42.7M]
  ------------------
  515|      8|    case 0xDF: /* Reserved */
  ------------------
  |  Branch (515:5): [True: 3, False: 42.7M]
  ------------------
  516|      8|    {
  517|      8|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  518|      5|    }
  519|    305|    case 0xE0: /* Fallthrough */
  ------------------
  |  Branch (519:5): [True: 305, False: 42.7M]
  ------------------
  520|  1.11k|    case 0xE1: /* Fallthrough */
  ------------------
  |  Branch (520:5): [True: 811, False: 42.7M]
  ------------------
  521|  1.34k|    case 0xE2: /* Fallthrough */
  ------------------
  |  Branch (521:5): [True: 229, False: 42.7M]
  ------------------
  522|  1.57k|    case 0xE3: /* Fallthrough */
  ------------------
  |  Branch (522:5): [True: 233, False: 42.7M]
  ------------------
  523|  3.04k|    case 0xE4: /* Fallthrough */
  ------------------
  |  Branch (523:5): [True: 1.46k, False: 42.7M]
  ------------------
  524|  3.54k|    case 0xE5: /* Fallthrough */
  ------------------
  |  Branch (524:5): [True: 508, False: 42.7M]
  ------------------
  525|  3.76k|    case 0xE6: /* Fallthrough */
  ------------------
  |  Branch (525:5): [True: 214, False: 42.7M]
  ------------------
  526|  4.10k|    case 0xE7: /* Fallthrough */
  ------------------
  |  Branch (526:5): [True: 338, False: 42.7M]
  ------------------
  527|  4.40k|    case 0xE8: /* Fallthrough */
  ------------------
  |  Branch (527:5): [True: 299, False: 42.7M]
  ------------------
  528|  4.78k|    case 0xE9: /* Fallthrough */
  ------------------
  |  Branch (528:5): [True: 387, False: 42.7M]
  ------------------
  529|  5.16k|    case 0xEA: /* Fallthrough */
  ------------------
  |  Branch (529:5): [True: 381, False: 42.7M]
  ------------------
  530|  5.47k|    case 0xEB: /* Fallthrough */
  ------------------
  |  Branch (530:5): [True: 304, False: 42.7M]
  ------------------
  531|  6.43k|    case 0xEC: /* Fallthrough */
  ------------------
  |  Branch (531:5): [True: 961, False: 42.7M]
  ------------------
  532|  7.18k|    case 0xED: /* Fallthrough */
  ------------------
  |  Branch (532:5): [True: 755, False: 42.7M]
  ------------------
  533|  8.24k|    case 0xEE: /* Fallthrough */
  ------------------
  |  Branch (533:5): [True: 1.06k, False: 42.7M]
  ------------------
  534|  8.48k|    case 0xEF: /* Fallthrough */
  ------------------
  |  Branch (534:5): [True: 233, False: 42.7M]
  ------------------
  535|  8.79k|    case 0xF0: /* Fallthrough */
  ------------------
  |  Branch (535:5): [True: 316, False: 42.7M]
  ------------------
  536|  10.2k|    case 0xF1: /* Fallthrough */
  ------------------
  |  Branch (536:5): [True: 1.48k, False: 42.7M]
  ------------------
  537|  11.1k|    case 0xF2: /* Fallthrough */
  ------------------
  |  Branch (537:5): [True: 832, False: 42.7M]
  ------------------
  538|  11.6k|    case 0xF3:
  ------------------
  |  Branch (538:5): [True: 532, False: 42.7M]
  ------------------
  539|       |      /* Simple value 0..19, unassigned but well-formed */
  540|  11.6k|      {
  541|  11.6k|        callbacks->simple_value(context, (uint8_t)(*source - 0xE0));
  542|  11.6k|        return result;
  543|  11.1k|      }
  544|   118k|    case 0xF4:
  ------------------
  |  Branch (544:5): [True: 118k, False: 42.6M]
  ------------------
  545|       |      /* False */
  546|   118k|      {
  547|   118k|        callbacks->boolean(context, false);
  548|   118k|        return result;
  549|  11.1k|      }
  550|   766k|    case 0xF5:
  ------------------
  |  Branch (550:5): [True: 766k, False: 41.9M]
  ------------------
  551|       |      /* True */
  552|   766k|      {
  553|   766k|        callbacks->boolean(context, true);
  554|   766k|        return result;
  555|  11.1k|      }
  556|  1.27M|    case 0xF6:
  ------------------
  |  Branch (556:5): [True: 1.27M, False: 41.4M]
  ------------------
  557|       |      /* Null */
  558|  1.27M|      {
  559|  1.27M|        callbacks->null(context);
  560|  1.27M|        return result;
  561|  11.1k|      }
  562|  28.7k|    case 0xF7:
  ------------------
  |  Branch (562:5): [True: 28.7k, False: 42.6M]
  ------------------
  563|       |      /* Undefined */
  564|  28.7k|      {
  565|  28.7k|        callbacks->undefined(context);
  566|  28.7k|        return result;
  567|  11.1k|      }
  568|    573|    case 0xF8:
  ------------------
  |  Branch (568:5): [True: 573, False: 42.7M]
  ------------------
  569|       |      /* 1B simple value */
  570|    573|      {
  571|    573|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (571:13): [True: 571, False: 2]
  ------------------
  572|    571|          uint8_t value = source[1];
  573|    571|          if (value < 32) {
  ------------------
  |  Branch (573:15): [True: 6, False: 565]
  ------------------
  574|       |            /* RFC 8949 Section 3.3: 0xF8 followed by a byte below 0x20 is not
  575|       |             * well-formed (values 0..23 have a one-byte encoding, 24..31 are
  576|       |             * reserved) */
  577|      6|            return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  578|      6|          }
  579|    565|          callbacks->simple_value(context, value);
  580|    565|        }
  581|    567|        return result;
  582|    573|      }
  583|   111k|    case 0xF9:
  ------------------
  |  Branch (583:5): [True: 111k, False: 42.6M]
  ------------------
  584|       |      /* 2B float */
  585|   111k|      {
  586|   111k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (586:13): [True: 111k, False: 3]
  ------------------
  587|   111k|          callbacks->float2(context, _cbor_load_half(source + 1));
  588|   111k|        }
  589|   111k|        return result;
  590|    573|      }
  591|  10.8k|    case 0xFA:
  ------------------
  |  Branch (591:5): [True: 10.8k, False: 42.7M]
  ------------------
  592|       |      /* 4B float */
  593|  10.8k|      {
  594|  10.8k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (594:13): [True: 10.8k, False: 4]
  ------------------
  595|  10.8k|          callbacks->float4(context, _cbor_load_float(source + 1));
  596|  10.8k|        }
  597|  10.8k|        return result;
  598|    573|      }
  599|  25.9k|    case 0xFB:
  ------------------
  |  Branch (599:5): [True: 25.9k, False: 42.6M]
  ------------------
  600|       |      /* 8B float */
  601|  25.9k|      {
  602|  25.9k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (602:13): [True: 25.9k, False: 4]
  ------------------
  603|  25.9k|          callbacks->float8(context, _cbor_load_double(source + 1));
  604|  25.9k|        }
  605|  25.9k|        return result;
  606|    573|      }
  607|      1|    case 0xFC: /* Fallthrough */
  ------------------
  |  Branch (607:5): [True: 1, False: 42.7M]
  ------------------
  608|      2|    case 0xFD: /* Fallthrough */
  ------------------
  |  Branch (608:5): [True: 1, False: 42.7M]
  ------------------
  609|      3|    case 0xFE:
  ------------------
  |  Branch (609:5): [True: 1, False: 42.7M]
  ------------------
  610|       |      /* Reserved */
  611|      3|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  612|   798k|    case 0xFF:
  ------------------
  |  Branch (612:5): [True: 798k, False: 41.9M]
  ------------------
  613|       |      /* Break */
  614|   798k|      callbacks->indef_break(context);
  615|   798k|      return result;
  616|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (616:5): [True: 0, False: 42.7M]
  ------------------
  617|       |      // Never happens, the switch statement is exhaustive on the 1B range
  618|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  619|      0|      return result;  // LCOV_EXCL_STOP
  620|  42.7M|  }
  621|  42.7M|}
streaming.c:claim_bytes:
   16|  47.8M|                        struct cbor_decoder_result* result) {
   17|       |  // Safe from underflow: read is only incremented on successful claims
   18|  47.8M|  CBOR_ASSERT(result->read <= provided);
  ------------------
  |  |   64|  47.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (18:3): [True: 0, False: 47.8M]
  |  Branch (18:3): [True: 47.8M, False: 0]
  ------------------
   19|  47.8M|  if (required > (provided - result->read)) {
  ------------------
  |  Branch (19:7): [True: 582, False: 47.8M]
  ------------------
   20|    582|    result->required = required + result->read;
   21|    582|    result->read = 0;
   22|    582|    result->status = CBOR_DECODER_NEDATA;
   23|    582|    return false;
   24|  47.8M|  } else {
   25|  47.8M|    result->read += required;
   26|  47.8M|    result->required = 0;
   27|  47.8M|    return true;
   28|  47.8M|  }
   29|  47.8M|}

cbor_new_definite_string:
   13|  3.57M|cbor_item_t* cbor_new_definite_string(void) {
   14|  3.57M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   15|  3.57M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  3.57M|  do {                           \
  |  |  127|  3.57M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 3.57M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  3.57M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 3.57M]
  |  |  ------------------
  ------------------
   16|  3.57M|  *item = (cbor_item_t){
   17|  3.57M|      .refcount = 1,
   18|  3.57M|      .type = CBOR_TYPE_STRING,
   19|  3.57M|      .metadata = {.string_metadata = {.type = _CBOR_METADATA_DEFINITE,
   20|  3.57M|                                       .codepoint_count = 0,
   21|  3.57M|                                       .length = 0}}};
   22|  3.57M|  return item;
   23|  3.57M|}
cbor_new_indefinite_string:
   25|  22.7k|cbor_item_t* cbor_new_indefinite_string(void) {
   26|  22.7k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   27|  22.7k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  22.7k|  do {                           \
  |  |  127|  22.7k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 22.7k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  22.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 22.7k]
  |  |  ------------------
  ------------------
   28|  22.7k|  *item = (cbor_item_t){
   29|  22.7k|      .refcount = 1,
   30|  22.7k|      .type = CBOR_TYPE_STRING,
   31|  22.7k|      .metadata = {.string_metadata = {.type = _CBOR_METADATA_INDEFINITE,
   32|  22.7k|                                       .length = 0}},
   33|  22.7k|      .data = _cbor_malloc(sizeof(struct cbor_indefinite_string_data))};
   34|  22.7k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  135|  22.7k|  do {                                              \
  |  |  136|  22.7k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 22.7k]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|  22.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 22.7k]
  |  |  ------------------
  ------------------
   35|  22.7k|  *((struct cbor_indefinite_string_data*)item->data) =
   36|  22.7k|      (struct cbor_indefinite_string_data){
   37|  22.7k|          .chunk_count = 0,
   38|  22.7k|          .chunk_capacity = 0,
   39|       |          .chunks = NULL,
   40|  22.7k|      };
   41|  22.7k|  return item;
   42|  22.7k|}
cbor_build_stringn:
   48|   870k|cbor_item_t* cbor_build_stringn(const char* val, size_t length) {
   49|   870k|  cbor_item_t* item = cbor_new_definite_string();
   50|   870k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   870k|  do {                           \
  |  |  127|   870k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 870k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   870k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 870k]
  |  |  ------------------
  ------------------
   51|       |  // malloc(0) may legitimately return NULL, so do not allocate for an empty
   52|       |  // string; the handle will be NULL and never dereferenced.
   53|   870k|  unsigned char* handle = NULL;
   54|   870k|  if (length > 0) {
  ------------------
  |  Branch (54:7): [True: 867k, False: 2.98k]
  ------------------
   55|   867k|    handle = _cbor_malloc(length);
   56|   867k|    _CBOR_DEPENDENT_NOTNULL(item, handle);
  ------------------
  |  |  135|   867k|  do {                                              \
  |  |  136|   867k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 867k]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|   867k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 867k]
  |  |  ------------------
  ------------------
   57|   867k|    memcpy(handle, val, length);
   58|   867k|  }
   59|   870k|  cbor_string_set_handle(item, handle, length);
   60|   870k|  return item;
   61|   870k|}
cbor_string_set_handle:
   65|  3.57M|                            size_t length) {
   66|  3.57M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  3.57M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (66:3): [True: 0, False: 3.57M]
  |  Branch (66:3): [True: 3.57M, False: 0]
  ------------------
   67|  3.57M|  CBOR_ASSERT(cbor_string_is_definite(item));
  ------------------
  |  |   64|  3.57M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (67:3): [True: 0, False: 3.57M]
  |  Branch (67:3): [True: 3.57M, False: 0]
  ------------------
   68|  3.57M|  item->data = data;
   69|  3.57M|  item->metadata.string_metadata.length = length;
   70|  3.57M|  struct _cbor_unicode_status unicode_status;
   71|  3.57M|  size_t codepoint_count =
   72|  3.57M|      _cbor_unicode_codepoint_count(data, length, &unicode_status);
   73|  3.57M|  CBOR_ASSERT(codepoint_count <= length);
  ------------------
  |  |   64|  3.57M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (73:3): [True: 0, False: 3.57M]
  |  Branch (73:3): [True: 3.57M, False: 0]
  ------------------
   74|  3.57M|  if (unicode_status.status == _CBOR_UNICODE_OK) {
  ------------------
  |  Branch (74:7): [True: 3.55M, False: 23.8k]
  ------------------
   75|  3.55M|    item->metadata.string_metadata.codepoint_count = codepoint_count;
   76|  3.55M|  } else {
   77|  23.8k|    item->metadata.string_metadata.codepoint_count = 0;
   78|  23.8k|  }
   79|  3.57M|}
cbor_string_chunks_handle:
   81|  1.10M|cbor_item_t** cbor_string_chunks_handle(const cbor_item_t* item) {
   82|  1.10M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  1.10M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (82:3): [True: 0, False: 1.10M]
  |  Branch (82:3): [True: 1.10M, False: 0]
  ------------------
   83|  1.10M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   64|  1.10M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (83:3): [True: 0, False: 1.10M]
  |  Branch (83:3): [True: 1.10M, False: 0]
  ------------------
   84|  1.10M|  return ((struct cbor_indefinite_string_data*)item->data)->chunks;
   85|  1.10M|}
cbor_string_chunk_count:
   87|  4.20M|size_t cbor_string_chunk_count(const cbor_item_t* item) {
   88|  4.20M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  4.20M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (88:3): [True: 0, False: 4.20M]
  |  Branch (88:3): [True: 4.20M, False: 0]
  ------------------
   89|  4.20M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   64|  4.20M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (89:3): [True: 0, False: 4.20M]
  |  Branch (89:3): [True: 4.20M, False: 0]
  ------------------
   90|  4.20M|  return ((struct cbor_indefinite_string_data*)item->data)->chunk_count;
   91|  4.20M|}
cbor_string_add_chunk:
   93|  2.54M|bool cbor_string_add_chunk(cbor_item_t* item, cbor_item_t* chunk) {
   94|  2.54M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  2.54M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (94:3): [True: 0, False: 2.54M]
  |  Branch (94:3): [True: 2.54M, False: 0]
  ------------------
   95|  2.54M|  CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   64|  2.54M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (95:3): [True: 0, False: 2.54M]
  |  Branch (95:3): [True: 2.54M, False: 0]
  ------------------
   96|  2.54M|  struct cbor_indefinite_string_data* data =
   97|  2.54M|      (struct cbor_indefinite_string_data*)item->data;
   98|  2.54M|  if (data->chunk_count == data->chunk_capacity) {
  ------------------
  |  Branch (98:7): [True: 2.70k, False: 2.54M]
  ------------------
   99|  2.70k|    if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, data->chunk_capacity)) {
  ------------------
  |  |    8|  2.70k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (99:9): [True: 0, False: 2.70k]
  ------------------
  100|      0|      return false;
  101|      0|    }
  102|       |
  103|  2.70k|    size_t new_chunk_capacity =
  104|  2.70k|        data->chunk_capacity == 0 ? 1
  ------------------
  |  Branch (104:9): [True: 839, False: 1.86k]
  ------------------
  105|  2.70k|                                  : CBOR_BUFFER_GROWTH * (data->chunk_capacity);
  ------------------
  |  |    8|  1.86k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  106|  2.70k|    cbor_item_t** new_chunks_data = _cbor_realloc_multiple(
  107|  2.70k|        data->chunks, sizeof(cbor_item_t*), new_chunk_capacity);
  108|       |
  109|  2.70k|    if (new_chunks_data == NULL) {
  ------------------
  |  Branch (109:9): [True: 0, False: 2.70k]
  ------------------
  110|      0|      return false;
  111|      0|    }
  112|       |
  113|  2.70k|    data->chunk_capacity = new_chunk_capacity;
  114|  2.70k|    data->chunks = new_chunks_data;
  115|  2.70k|  }
  116|  2.54M|  data->chunks[data->chunk_count++] = cbor_incref(chunk);
  117|  2.54M|  return true;
  118|  2.54M|}
cbor_string_length:
  120|  6.96M|size_t cbor_string_length(const cbor_item_t* item) {
  121|  6.96M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  6.96M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (121:3): [True: 0, False: 6.96M]
  |  Branch (121:3): [True: 6.96M, False: 0]
  ------------------
  122|  6.96M|  return item->metadata.string_metadata.length;
  123|  6.96M|}
cbor_string_handle:
  125|  2.60M|unsigned char* cbor_string_handle(const cbor_item_t* item) {
  126|  2.60M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  2.60M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (126:3): [True: 0, False: 2.60M]
  |  Branch (126:3): [True: 2.60M, False: 0]
  ------------------
  127|  2.60M|  return item->data;
  128|  2.60M|}
cbor_string_codepoint_count:
  130|   870k|size_t cbor_string_codepoint_count(const cbor_item_t* item) {
  131|   870k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|   870k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (131:3): [True: 0, False: 870k]
  |  Branch (131:3): [True: 870k, False: 0]
  ------------------
  132|   870k|  return item->metadata.string_metadata.codepoint_count;
  133|   870k|}
cbor_string_is_definite:
  135|  20.5M|bool cbor_string_is_definite(const cbor_item_t* item) {
  136|  20.5M|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|  20.5M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (136:3): [True: 0, False: 20.5M]
  |  Branch (136:3): [True: 20.5M, False: 0]
  ------------------
  137|  20.5M|  return item->metadata.string_metadata.type == _CBOR_METADATA_DEFINITE;
  138|  20.5M|}
cbor_string_is_indefinite:
  140|  10.7M|bool cbor_string_is_indefinite(const cbor_item_t* item) {
  141|  10.7M|  return !cbor_string_is_definite(item);
  142|  10.7M|}

cbor_new_tag:
   10|   536k|cbor_item_t* cbor_new_tag(uint64_t value) {
   11|   536k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   12|   536k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   536k|  do {                           \
  |  |  127|   536k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 536k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   536k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 536k]
  |  |  ------------------
  ------------------
   13|       |
   14|   536k|  *item = (cbor_item_t){
   15|   536k|      .refcount = 1,
   16|   536k|      .type = CBOR_TYPE_TAG,
   17|   536k|      .metadata = {.tag_metadata = {.value = value, .tagged_item = NULL}},
   18|       |      .data = NULL /* Never used */
   19|   536k|  };
   20|   536k|  return item;
   21|   536k|}
cbor_tag_item:
   23|   880k|cbor_item_t* cbor_tag_item(const cbor_item_t* tag) {
   24|   880k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   64|   880k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (24:3): [True: 0, False: 880k]
  |  Branch (24:3): [True: 880k, False: 0]
  ------------------
   25|   880k|  if (tag->metadata.tag_metadata.tagged_item == NULL) {
  ------------------
  |  Branch (25:7): [True: 0, False: 880k]
  ------------------
   26|      0|    return NULL;
   27|      0|  }
   28|   880k|  return cbor_incref(tag->metadata.tag_metadata.tagged_item);
   29|   880k|}
cbor_tag_value:
   31|   880k|uint64_t cbor_tag_value(const cbor_item_t* tag) {
   32|   880k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   64|   880k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (32:3): [True: 0, False: 880k]
  |  Branch (32:3): [True: 880k, False: 0]
  ------------------
   33|   880k|  return tag->metadata.tag_metadata.value;
   34|   880k|}
cbor_tag_set_item:
   36|   512k|void cbor_tag_set_item(cbor_item_t* tag, cbor_item_t* tagged_item) {
   37|   512k|  CBOR_ASSERT(cbor_isa_tag(tag));
  ------------------
  |  |   64|   512k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (37:3): [True: 0, False: 512k]
  |  Branch (37:3): [True: 512k, False: 0]
  ------------------
   38|   512k|  if (tag->metadata.tag_metadata.tagged_item != NULL) {
  ------------------
  |  Branch (38:7): [True: 0, False: 512k]
  ------------------
   39|      0|    cbor_intermediate_decref(tag->metadata.tag_metadata.tagged_item);
   40|      0|  }
   41|   512k|  cbor_incref(tagged_item);
   42|   512k|  tag->metadata.tag_metadata.tagged_item = tagged_item;
   43|   512k|}
cbor_build_tag:
   45|   220k|cbor_item_t* cbor_build_tag(uint64_t value, cbor_item_t* item) {
   46|   220k|  cbor_item_t* res = cbor_new_tag(value);
   47|   220k|  if (res == NULL) {
  ------------------
  |  Branch (47:7): [True: 0, False: 220k]
  ------------------
   48|      0|    return NULL;
   49|      0|  }
   50|   220k|  cbor_tag_set_item(res, item);
   51|   220k|  return res;
   52|   220k|}

cbor_load_fuzzer.cc:_ZL11cbor_decrefPP11cbor_item_t:
  352|  2.51k|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  2.51k|  cbor_item_t* item = *item_ref;
  354|  2.51k|  CBOR_ASSERT(item->refcount > 0);
  355|  2.51k|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 2.51k, False: 0]
  ------------------
  356|  2.51k|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|  2.51k|  }
  359|  2.51k|}

