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

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

cbor_bytestring_length:
   12|  7.52M|size_t cbor_bytestring_length(const cbor_item_t* item) {
   13|  7.52M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  7.52M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (13:3): [True: 0, False: 7.52M]
  |  Branch (13:3): [True: 7.52M, False: 0]
  ------------------
   14|  7.52M|  return item->metadata.bytestring_metadata.length;
   15|  7.52M|}
cbor_bytestring_handle:
   17|  2.39M|unsigned char* cbor_bytestring_handle(const cbor_item_t* item) {
   18|  2.39M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  2.39M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (18:3): [True: 0, False: 2.39M]
  |  Branch (18:3): [True: 2.39M, False: 0]
  ------------------
   19|  2.39M|  return item->data;
   20|  2.39M|}
cbor_bytestring_is_definite:
   22|  18.6M|bool cbor_bytestring_is_definite(const cbor_item_t* item) {
   23|  18.6M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  18.6M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (23:3): [True: 0, False: 18.6M]
  |  Branch (23:3): [True: 18.6M, False: 0]
  ------------------
   24|  18.6M|  return item->metadata.bytestring_metadata.type == _CBOR_METADATA_DEFINITE;
   25|  18.6M|}
cbor_bytestring_is_indefinite:
   27|  9.93M|bool cbor_bytestring_is_indefinite(const cbor_item_t* item) {
   28|  9.93M|  return !cbor_bytestring_is_definite(item);
   29|  9.93M|}
cbor_new_definite_bytestring:
   31|  2.14M|cbor_item_t* cbor_new_definite_bytestring(void) {
   32|  2.14M|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   33|  2.14M|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  2.14M|  do {                           \
  |  |  127|  2.14M|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 2.14M]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  2.14M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 2.14M]
  |  |  ------------------
  ------------------
   34|  2.14M|  *item = (cbor_item_t){
   35|  2.14M|      .refcount = 1,
   36|  2.14M|      .type = CBOR_TYPE_BYTESTRING,
   37|  2.14M|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_DEFINITE,
   38|  2.14M|                                           .length = 0}}};
   39|  2.14M|  return item;
   40|  2.14M|}
cbor_new_indefinite_bytestring:
   42|  4.75k|cbor_item_t* cbor_new_indefinite_bytestring(void) {
   43|  4.75k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   44|  4.75k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  4.75k|  do {                           \
  |  |  127|  4.75k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 4.75k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  4.75k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 4.75k]
  |  |  ------------------
  ------------------
   45|  4.75k|  *item = (cbor_item_t){
   46|  4.75k|      .refcount = 1,
   47|  4.75k|      .type = CBOR_TYPE_BYTESTRING,
   48|  4.75k|      .metadata = {.bytestring_metadata = {.type = _CBOR_METADATA_INDEFINITE,
   49|  4.75k|                                           .length = 0}},
   50|  4.75k|      .data = _cbor_malloc(sizeof(struct cbor_indefinite_string_data))};
   51|  4.75k|  _CBOR_DEPENDENT_NOTNULL(item, item->data);
  ------------------
  |  |  135|  4.75k|  do {                                              \
  |  |  136|  4.75k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 4.75k]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|  4.75k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 4.75k]
  |  |  ------------------
  ------------------
   52|  4.75k|  *((struct cbor_indefinite_string_data*)item->data) =
   53|  4.75k|      (struct cbor_indefinite_string_data){
   54|  4.75k|          .chunk_count = 0,
   55|  4.75k|          .chunk_capacity = 0,
   56|       |          .chunks = NULL,
   57|  4.75k|      };
   58|  4.75k|  return item;
   59|  4.75k|}
cbor_build_bytestring:
   61|   799k|cbor_item_t* cbor_build_bytestring(cbor_data handle, size_t length) {
   62|   799k|  cbor_item_t* item = cbor_new_definite_bytestring();
   63|   799k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   799k|  do {                           \
  |  |  127|   799k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 799k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   799k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 799k]
  |  |  ------------------
  ------------------
   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|   799k|  void* content = NULL;
   67|   799k|  if (length > 0) {
  ------------------
  |  Branch (67:7): [True: 799k, False: 5]
  ------------------
   68|   799k|    content = _cbor_malloc(length);
   69|   799k|    _CBOR_DEPENDENT_NOTNULL(item, content);
  ------------------
  |  |  135|   799k|  do {                                              \
  |  |  136|   799k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 0, False: 799k]
  |  |  ------------------
  |  |  137|      0|      _cbor_free(cbor_item);                        \
  |  |  138|      0|      return NULL;                                  \
  |  |  139|      0|    }                                               \
  |  |  140|   799k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 799k]
  |  |  ------------------
  ------------------
   70|   799k|    memcpy(content, handle, length);
   71|   799k|  }
   72|   799k|  cbor_bytestring_set_handle(item, content, length);
   73|   799k|  return item;
   74|   799k|}
cbor_bytestring_set_handle:
   78|  2.14M|                                size_t length) {
   79|  2.14M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  2.14M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (79:3): [True: 0, False: 2.14M]
  |  Branch (79:3): [True: 2.14M, False: 0]
  ------------------
   80|  2.14M|  CBOR_ASSERT(cbor_bytestring_is_definite(item));
  ------------------
  |  |   64|  2.14M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (80:3): [True: 0, False: 2.14M]
  |  Branch (80:3): [True: 2.14M, False: 0]
  ------------------
   81|  2.14M|  item->data = data;
   82|  2.14M|  item->metadata.bytestring_metadata.length = length;
   83|  2.14M|}
cbor_bytestring_chunks_handle:
   85|  1.51M|cbor_item_t** cbor_bytestring_chunks_handle(const cbor_item_t* item) {
   86|  1.51M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  1.51M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (86:3): [True: 0, False: 1.51M]
  |  Branch (86:3): [True: 1.51M, False: 0]
  ------------------
   87|  1.51M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  1.51M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (87:3): [True: 0, False: 1.51M]
  |  Branch (87:3): [True: 1.51M, False: 0]
  ------------------
   88|  1.51M|  return ((struct cbor_indefinite_string_data*)item->data)->chunks;
   89|  1.51M|}
cbor_bytestring_chunk_count:
   91|  4.30M|size_t cbor_bytestring_chunk_count(const cbor_item_t* item) {
   92|  4.30M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  4.30M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (92:3): [True: 0, False: 4.30M]
  |  Branch (92:3): [True: 4.30M, False: 0]
  ------------------
   93|  4.30M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  4.30M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (93:3): [True: 0, False: 4.30M]
  |  Branch (93:3): [True: 4.30M, False: 0]
  ------------------
   94|  4.30M|  return ((struct cbor_indefinite_string_data*)item->data)->chunk_count;
   95|  4.30M|}
cbor_bytestring_add_chunk:
   97|  2.03M|bool cbor_bytestring_add_chunk(cbor_item_t* item, cbor_item_t* chunk) {
   98|  2.03M|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|  2.03M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (98:3): [True: 0, False: 2.03M]
  |  Branch (98:3): [True: 2.03M, False: 0]
  ------------------
   99|  2.03M|  CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|  2.03M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (99:3): [True: 0, False: 2.03M]
  |  Branch (99:3): [True: 2.03M, False: 0]
  ------------------
  100|  2.03M|  CBOR_ASSERT(cbor_isa_bytestring(chunk));
  ------------------
  |  |   64|  2.03M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (100:3): [True: 0, False: 2.03M]
  |  Branch (100:3): [True: 2.03M, False: 0]
  ------------------
  101|  2.03M|  CBOR_ASSERT(cbor_bytestring_is_definite(chunk));
  ------------------
  |  |   64|  2.03M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (101:3): [True: 0, False: 2.03M]
  |  Branch (101:3): [True: 2.03M, False: 0]
  ------------------
  102|  2.03M|  struct cbor_indefinite_string_data* data =
  103|  2.03M|      (struct cbor_indefinite_string_data*)item->data;
  104|  2.03M|  if (data->chunk_count == data->chunk_capacity) {
  ------------------
  |  Branch (104:7): [True: 2.82k, False: 2.02M]
  ------------------
  105|  2.82k|    if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, data->chunk_capacity)) {
  ------------------
  |  |    8|  2.82k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (105:9): [True: 0, False: 2.82k]
  ------------------
  106|      0|      return false;
  107|      0|    }
  108|       |
  109|  2.82k|    size_t new_chunk_capacity =
  110|  2.82k|        data->chunk_capacity == 0 ? 1
  ------------------
  |  Branch (110:9): [True: 904, False: 1.91k]
  ------------------
  111|  2.82k|                                  : CBOR_BUFFER_GROWTH * (data->chunk_capacity);
  ------------------
  |  |    8|  1.91k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  112|       |
  113|  2.82k|    cbor_item_t** new_chunks_data = _cbor_realloc_multiple(
  114|  2.82k|        data->chunks, sizeof(cbor_item_t*), new_chunk_capacity);
  115|       |
  116|  2.82k|    if (new_chunks_data == NULL) {
  ------------------
  |  Branch (116:9): [True: 0, False: 2.82k]
  ------------------
  117|      0|      return false;
  118|      0|    }
  119|  2.82k|    data->chunk_capacity = new_chunk_capacity;
  120|  2.82k|    data->chunks = new_chunks_data;
  121|  2.82k|  }
  122|  2.03M|  data->chunks[data->chunk_count++] = cbor_incref(chunk);
  123|  2.03M|  return true;
  124|  2.03M|}

cbor_typeof:
   22|  1.14G|cbor_type cbor_typeof(const cbor_item_t* item) {
   23|  1.14G|  CBOR_ASSERT(item != NULL);
  ------------------
  |  |   64|  1.14G|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (23:3): [True: 0, False: 1.14G]
  |  Branch (23:3): [True: 1.14G, False: 0]
  ------------------
   24|  1.14G|  CBOR_ASSERT_VALID_TYPE(item->type);
  ------------------
  |  |   82|  1.14G|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  1.14G|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (24:3): [True: 1.14G, False: 0]
  |  Branch (24:3): [True: 1.14G, False: 0]
  |  Branch (24:3): [True: 0, False: 1.14G]
  ------------------
   25|  1.14G|  return item->type;
   26|  1.14G|}
cbor_isa_uint:
   28|   371M|bool cbor_isa_uint(const cbor_item_t* item) {
   29|   371M|  return cbor_typeof(item) == CBOR_TYPE_UINT;
   30|   371M|}
cbor_isa_negint:
   32|  49.5M|bool cbor_isa_negint(const cbor_item_t* item) {
   33|  49.5M|  return cbor_typeof(item) == CBOR_TYPE_NEGINT;
   34|  49.5M|}
cbor_isa_bytestring:
   36|  42.7M|bool cbor_isa_bytestring(const cbor_item_t* item) {
   37|  42.7M|  return cbor_typeof(item) == CBOR_TYPE_BYTESTRING;
   38|  42.7M|}
cbor_isa_string:
   40|  38.6M|bool cbor_isa_string(const cbor_item_t* item) {
   41|  38.6M|  return cbor_typeof(item) == CBOR_TYPE_STRING;
   42|  38.6M|}
cbor_isa_array:
   44|   358M|bool cbor_isa_array(const cbor_item_t* item) {
   45|   358M|  return cbor_typeof(item) == CBOR_TYPE_ARRAY;
   46|   358M|}
cbor_isa_map:
   48|  21.3M|bool cbor_isa_map(const cbor_item_t* item) {
   49|  21.3M|  return cbor_typeof(item) == CBOR_TYPE_MAP;
   50|  21.3M|}
cbor_isa_tag:
   52|  2.83M|bool cbor_isa_tag(const cbor_item_t* item) {
   53|  2.83M|  return cbor_typeof(item) == CBOR_TYPE_TAG;
   54|  2.83M|}
cbor_isa_float_ctrl:
   56|  18.3M|bool cbor_isa_float_ctrl(const cbor_item_t* item) {
   57|  18.3M|  return cbor_typeof(item) == CBOR_TYPE_FLOAT_CTRL;
   58|  18.3M|}
cbor_is_int:
   60|   349M|bool cbor_is_int(const cbor_item_t* item) {
   61|   349M|  return cbor_isa_uint(item) || cbor_isa_negint(item);
  ------------------
  |  Branch (61:10): [True: 304M, False: 45.8M]
  |  Branch (61:33): [True: 45.8M, False: 0]
  ------------------
   62|   349M|}
cbor_is_bool:
   64|   353k|bool cbor_is_bool(const cbor_item_t* item) {
   65|   353k|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (65:10): [True: 353k, False: 0]
  |  Branch (65:39): [True: 353k, False: 0]
  ------------------
   66|   353k|         (cbor_ctrl_value(item) == CBOR_CTRL_FALSE ||
  ------------------
  |  Branch (66:11): [True: 104k, False: 249k]
  ------------------
   67|   249k|          cbor_ctrl_value(item) == CBOR_CTRL_TRUE);
  ------------------
  |  Branch (67:11): [True: 156k, False: 92.4k]
  ------------------
   68|   353k|}
cbor_is_null:
   70|  70.9k|bool cbor_is_null(const cbor_item_t* item) {
   71|  70.9k|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (71:10): [True: 70.9k, False: 0]
  |  Branch (71:39): [True: 70.9k, False: 0]
  ------------------
   72|  70.9k|         cbor_ctrl_value(item) == CBOR_CTRL_NULL;
  ------------------
  |  Branch (72:10): [True: 70.9k, False: 21]
  ------------------
   73|  70.9k|}
cbor_is_undef:
   75|  92.4k|bool cbor_is_undef(const cbor_item_t* item) {
   76|  92.4k|  return cbor_isa_float_ctrl(item) && cbor_float_ctrl_is_ctrl(item) &&
  ------------------
  |  Branch (76:10): [True: 92.4k, False: 0]
  |  Branch (76:39): [True: 92.4k, False: 0]
  ------------------
   77|  92.4k|         cbor_ctrl_value(item) == CBOR_CTRL_UNDEF;
  ------------------
  |  Branch (77:10): [True: 21.5k, False: 70.9k]
  ------------------
   78|  92.4k|}
cbor_is_float:
   80|   566k|bool cbor_is_float(const cbor_item_t* item) {
   81|   566k|  return cbor_isa_float_ctrl(item) && !cbor_float_ctrl_is_ctrl(item);
  ------------------
  |  Branch (81:10): [True: 566k, False: 0]
  |  Branch (81:39): [True: 566k, False: 0]
  ------------------
   82|   566k|}
_cbor_decref_free:
   84|  61.0M|void _cbor_decref_free(cbor_item_t* item) {
   85|  61.0M|  switch (item->type) {
  ------------------
  |  Branch (85:11): [True: 61.0M, False: 0]
  ------------------
   86|  27.2M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (86:5): [True: 27.2M, False: 33.8M]
  ------------------
   87|       |      /* Fallthrough */
   88|  31.4M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (88:5): [True: 4.26M, False: 56.8M]
  ------------------
   89|       |      /* Combined allocation, freeing the item suffices */
   90|  31.4M|      { break; }
   91|  2.15M|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (91:5): [True: 2.15M, False: 58.9M]
  ------------------
   92|  2.15M|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (92:11): [True: 2.14M, False: 4.75k]
  ------------------
   93|  2.14M|        _cbor_free(item->data);
   94|  2.14M|      } else {
   95|       |        /* We need to decref all chunks */
   96|  4.75k|        cbor_item_t** handle = cbor_bytestring_chunks_handle(item);
   97|  2.03M|        for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++)
  ------------------
  |  Branch (97:28): [True: 2.03M, False: 4.75k]
  ------------------
   98|  2.03M|          cbor_decref(&handle[i]);
   99|  4.75k|        _cbor_free(((struct cbor_indefinite_string_data*)item->data)->chunks);
  100|  4.75k|        _cbor_free(item->data);
  101|  4.75k|      }
  102|  2.15M|      break;
  103|  27.2M|    }
  104|  2.91M|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (104:5): [True: 2.91M, False: 58.1M]
  ------------------
  105|  2.91M|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (105:11): [True: 2.88M, False: 21.5k]
  ------------------
  106|  2.88M|        _cbor_free(item->data);
  107|  2.88M|      } else {
  108|       |        /* We need to decref all chunks */
  109|  21.5k|        cbor_item_t** handle = cbor_string_chunks_handle(item);
  110|  2.54M|        for (size_t i = 0; i < cbor_string_chunk_count(item); i++)
  ------------------
  |  Branch (110:28): [True: 2.52M, False: 21.5k]
  ------------------
  111|  2.52M|          cbor_decref(&handle[i]);
  112|  21.5k|        _cbor_free(((struct cbor_indefinite_string_data*)item->data)->chunks);
  113|  21.5k|        _cbor_free(item->data);
  114|  21.5k|      }
  115|  2.91M|      break;
  116|  27.2M|    }
  117|  20.1M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (117:5): [True: 20.1M, False: 40.9M]
  ------------------
  118|       |      /* Get all items and decref them */
  119|  20.1M|      cbor_item_t** handle = cbor_array_handle(item);
  120|  20.1M|      size_t size = cbor_array_size(item);
  121|  70.9M|      for (size_t i = 0; i < size; i++)
  ------------------
  |  Branch (121:26): [True: 50.7M, False: 20.1M]
  ------------------
  122|  50.7M|        if (handle[i] != NULL) cbor_decref(&handle[i]);
  ------------------
  |  Branch (122:13): [True: 50.7M, False: 0]
  ------------------
  123|  20.1M|      _cbor_free(item->data);
  124|  20.1M|      break;
  125|  27.2M|    }
  126|   139k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (126:5): [True: 139k, False: 60.9M]
  ------------------
  127|   139k|      struct cbor_pair* handle = cbor_map_handle(item);
  128|  2.65M|      for (size_t i = 0; i < item->metadata.map_metadata.end_ptr;
  ------------------
  |  Branch (128:26): [True: 2.51M, False: 139k]
  ------------------
  129|  2.51M|           i++, handle++) {
  130|  2.51M|        cbor_decref(&handle->key);
  131|  2.51M|        if (handle->value != NULL) cbor_decref(&handle->value);
  ------------------
  |  Branch (131:13): [True: 2.51M, False: 2.06k]
  ------------------
  132|  2.51M|      }
  133|   139k|      _cbor_free(item->data);
  134|   139k|      break;
  135|  27.2M|    }
  136|   604k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (136:5): [True: 604k, False: 60.4M]
  ------------------
  137|   604k|      if (item->metadata.tag_metadata.tagged_item != NULL)
  ------------------
  |  Branch (137:11): [True: 585k, False: 18.7k]
  ------------------
  138|   585k|        cbor_decref(&item->metadata.tag_metadata.tagged_item);
  139|   604k|      _cbor_free(item->data);
  140|   604k|      break;
  141|  27.2M|    }
  142|  3.67M|    case CBOR_TYPE_FLOAT_CTRL: {
  ------------------
  |  Branch (142:5): [True: 3.67M, False: 57.4M]
  ------------------
  143|       |      /* Floats have combined allocation */
  144|  3.67M|      break;
  145|  27.2M|    }
  146|  61.0M|  }
  147|  61.0M|  _cbor_free(item);
  148|  61.0M|}
cbor_move:
  154|  18.1M|cbor_item_t* cbor_move(cbor_item_t* item) {
  155|  18.1M|  if (item == NULL) return NULL;
  ------------------
  |  Branch (155:7): [True: 0, False: 18.1M]
  ------------------
  156|  18.1M|  item->refcount--;
  157|  18.1M|  return item;
  158|  18.1M|}

cbor.c:cbor_decref:
  352|  20.2M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  20.2M|  cbor_item_t* item = *item_ref;
  354|  20.2M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  20.2M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 20.2M]
  |  Branch (354:3): [True: 20.2M, False: 0]
  ------------------
  355|  20.2M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 127k, False: 20.0M]
  ------------------
  356|   127k|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|   127k|  }
  359|  20.2M|}
builder_callbacks.c:cbor_decref:
  352|  40.8M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  40.8M|  cbor_item_t* item = *item_ref;
  354|  40.8M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  40.8M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 40.8M]
  |  Branch (354:3): [True: 40.8M, False: 0]
  ------------------
  355|  40.8M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 103, False: 40.8M]
  ------------------
  356|    103|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|    103|  }
  359|  40.8M|}
arrays.c:cbor_incref:
  326|  67.8M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  67.8M|  item->refcount++;
  328|  67.8M|  return item;
  329|  67.8M|}
common.c:cbor_decref:
  352|  60.9M|static inline void cbor_decref(cbor_item_t** item_ref) {
  353|  60.9M|  cbor_item_t* item = *item_ref;
  354|  60.9M|  CBOR_ASSERT(item->refcount > 0);
  ------------------
  |  |   64|  60.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (354:3): [True: 0, False: 60.9M]
  |  Branch (354:3): [True: 60.9M, False: 0]
  ------------------
  355|  60.9M|  if (--item->refcount == 0) {
  ------------------
  |  Branch (355:7): [True: 60.9M, False: 0]
  ------------------
  356|  60.9M|    _cbor_decref_free(item);
  357|       |    *item_ref = NULL;
  358|  60.9M|  }
  359|  60.9M|}
bytestrings.c:cbor_incref:
  326|  2.03M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  2.03M|  item->refcount++;
  328|  2.03M|  return item;
  329|  2.03M|}
strings.c:cbor_incref:
  326|  2.52M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  2.52M|  item->refcount++;
  328|  2.52M|  return item;
  329|  2.52M|}
maps.c:cbor_incref:
  326|  5.03M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  5.03M|  item->refcount++;
  328|  5.03M|  return item;
  329|  5.03M|}
tags.c:cbor_incref:
  326|  1.58M|static inline cbor_item_t* cbor_incref(cbor_item_t* item) {
  327|  1.58M|  item->refcount++;
  328|  1.58M|  return item;
  329|  1.58M|}

cbor_encode_uint8:
   15|  9.11M|                         size_t buffer_size) {
   16|  9.11M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x00);
   17|  9.11M|}
cbor_encode_uint16:
   20|  8.44k|                          size_t buffer_size) {
   21|  8.44k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x00);
   22|  8.44k|}
cbor_encode_uint32:
   25|   585k|                          size_t buffer_size) {
   26|   585k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x00);
   27|   585k|}
cbor_encode_uint64:
   30|  7.48k|                          size_t buffer_size) {
   31|  7.48k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x00);
   32|  7.48k|}
cbor_encode_negint8:
   40|  1.83M|                           size_t buffer_size) {
   41|  1.83M|  return _cbor_encode_uint8(value, buffer, buffer_size, 0x20);
   42|  1.83M|}
cbor_encode_negint16:
   45|  22.5k|                            size_t buffer_size) {
   46|  22.5k|  return _cbor_encode_uint16(value, buffer, buffer_size, 0x20);
   47|  22.5k|}
cbor_encode_negint32:
   50|  13.5k|                            size_t buffer_size) {
   51|  13.5k|  return _cbor_encode_uint32(value, buffer, buffer_size, 0x20);
   52|  13.5k|}
cbor_encode_negint64:
   55|  1.30k|                            size_t buffer_size) {
   56|  1.30k|  return _cbor_encode_uint64(value, buffer, buffer_size, 0x20);
   57|  1.30k|}
cbor_encode_bytestring_start:
   65|   799k|                                    size_t buffer_size) {
   66|   799k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x40);
   67|   799k|}
_cbor_encode_byte:
   70|   732k|                         size_t buffer_size) {
   71|   732k|  if (buffer_size >= 1) {
  ------------------
  |  Branch (71:7): [True: 732k, False: 0]
  ------------------
   72|   732k|    buffer[0] = value;
   73|   732k|    return 1;
   74|   732k|  } else
   75|      0|    return 0;
   76|   732k|}
cbor_encode_indef_bytestring_start:
   79|    889|                                          size_t buffer_size) {
   80|    889|  return _cbor_encode_byte(0x5F, buffer, buffer_size);
   81|    889|}
cbor_encode_string_start:
   84|   587k|                                size_t buffer_size) {
   85|   587k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x60);
   86|   587k|}
cbor_encode_indef_string_start:
   89|  8.67k|                                      size_t buffer_size) {
   90|  8.67k|  return _cbor_encode_byte(0x7F, buffer, buffer_size);
   91|  8.67k|}
cbor_encode_array_start:
   94|  6.11M|                               size_t buffer_size) {
   95|  6.11M|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0x80);
   96|  6.11M|}
cbor_encode_indef_array_start:
   99|   354k|                                     size_t buffer_size) {
  100|   354k|  return _cbor_encode_byte(0x9F, buffer, buffer_size);
  101|   354k|}
cbor_encode_map_start:
  104|  44.3k|                             size_t buffer_size) {
  105|  44.3k|  return _cbor_encode_uint((size_t)length, buffer, buffer_size, 0xA0);
  106|  44.3k|}
cbor_encode_indef_map_start:
  108|  2.26k|size_t cbor_encode_indef_map_start(unsigned char* buffer, size_t buffer_size) {
  109|  2.26k|  return _cbor_encode_byte(0xBF, buffer, buffer_size);
  110|  2.26k|}
cbor_encode_tag:
  113|   249k|                       size_t buffer_size) {
  114|   249k|  return _cbor_encode_uint(value, buffer, buffer_size, 0xC0);
  115|   249k|}
cbor_encode_half:
  131|  85.8k|                        size_t buffer_size) {
  132|       |  // TODO: Broken on systems that do not use IEEE 754
  133|       |  /* Assuming value is normalized */
  134|  85.8k|  uint32_t val = ((union _cbor_float_helper){.as_float = value}).as_uint;
  135|  85.8k|  uint16_t res;
  136|  85.8k|  uint8_t exp = (uint8_t)((val & 0x7F800000u) >>
  137|  85.8k|                          23u); /* 0b0111_1111_1000_0000_0000_0000_0000_0000 */
  138|  85.8k|  uint32_t mant =
  139|  85.8k|      val & 0x7FFFFFu; /* 0b0000_0000_0111_1111_1111_1111_1111_1111 */
  140|  85.8k|  if (exp == 0xFF) {   /* Infinity or NaNs */
  ------------------
  |  Branch (140:7): [True: 7.89k, False: 77.9k]
  ------------------
  141|  7.89k|    if (isnan(value)) {
  ------------------
  |  Branch (141:9): [True: 6.88k, False: 1.00k]
  ------------------
  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|  6.88k|      uint16_t half_mant = (uint16_t)(mant >> 13u);
  151|  6.88k|      if (half_mant == 0) half_mant = 0x0200u; /* quiet NaN fallback */
  ------------------
  |  Branch (151:11): [True: 0, False: 6.88k]
  ------------------
  152|  6.88k|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u | half_mant);
  153|  6.88k|    } 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.00k|      CBOR_ASSERT(mant == 0u);
  ------------------
  |  |   64|  1.00k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (157:7): [True: 0, False: 1.00k]
  |  Branch (157:7): [True: 1.00k, False: 0]
  ------------------
  158|  1.00k|      res = (uint16_t)((val & 0x80000000u) >> 16u | 0x7C00u);
  159|  1.00k|    }
  160|  77.9k|  } else if (exp == 0x00) { /* Zeroes or subnorms */
  ------------------
  |  Branch (160:14): [True: 891, False: 77.0k]
  ------------------
  161|    891|    res = (uint16_t)((val & 0x80000000u) >> 16u | mant >> 13u);
  162|  77.0k|  } else { /* Normal numbers */
  163|  77.0k|    int8_t logical_exp = (int8_t)(exp - 127);
  164|  77.0k|    CBOR_ASSERT(logical_exp == exp - 127);
  ------------------
  |  |   64|  77.0k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (164:5): [True: 0, False: 77.0k]
  |  Branch (164:5): [True: 77.0k, False: 0]
  ------------------
  165|       |
  166|       |    // Now we know that 2^exp <= 0 logically
  167|  77.0k|    if (logical_exp < -24) {
  ------------------
  |  Branch (167:9): [True: 0, False: 77.0k]
  ------------------
  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|  77.0k|    } else if (logical_exp < -14) {
  ------------------
  |  Branch (172:16): [True: 30.7k, False: 46.2k]
  ------------------
  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|  30.7k|      res = (uint16_t)((val & 0x80000000u) >> 16u) |  // Extract sign bit
  177|  30.7k|            ((uint16_t)(1u << (24u + logical_exp)) +
  178|  30.7k|             (uint16_t)(((mant >> (-logical_exp - 2)) + 1) >>
  179|  30.7k|                        1));  // Round half away from zero for simplicity
  180|  46.2k|    } else if (logical_exp > 15) {
  ------------------
  |  Branch (180:16): [True: 0, False: 46.2k]
  ------------------
  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|  46.2k|    } else {
  190|  46.2k|      res = (uint16_t)((val & 0x80000000u) >> 16u |
  191|  46.2k|                       ((((uint8_t)logical_exp) + 15u) << 10u) |
  192|  46.2k|                       (uint16_t)(mant >> 13u));
  193|  46.2k|    }
  194|  77.0k|  }
  195|  85.8k|  return _cbor_encode_uint16(res, buffer, buffer_size, 0xE0);
  196|  85.8k|}
cbor_encode_single:
  199|  12.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|  12.1k|  return _cbor_encode_uint32(
  206|  12.1k|      ((union _cbor_float_helper){.as_float = value}).as_uint, buffer,
  207|  12.1k|      buffer_size, 0xE0);
  208|  12.1k|}
cbor_encode_double:
  211|  8.36k|                          size_t buffer_size) {
  212|       |  // See `cbor_encode_single` regarding NaNs
  213|       |  // TODO: Broken on systems that do not use IEEE 754
  214|  8.36k|  return _cbor_encode_uint64(
  215|  8.36k|      ((union _cbor_double_helper){.as_double = value}).as_uint, buffer,
  216|  8.36k|      buffer_size, 0xE0);
  217|  8.36k|}
cbor_encode_break:
  219|   366k|size_t cbor_encode_break(unsigned char* buffer, size_t buffer_size) {
  220|   366k|  return _cbor_encode_byte(0xFF, buffer, buffer_size);
  221|   366k|}
cbor_encode_ctrl:
  224|   222k|                        size_t buffer_size) {
  225|   222k|  return _cbor_encode_uint8(value, buffer, buffer_size, 0xE0);
  226|   222k|}

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

_cbor_builder_append:
   25|  37.6M|                          struct _cbor_decoder_context* ctx) {
   26|  37.6M|  if (ctx->stack->size == 0) {
  ------------------
  |  Branch (26:7): [True: 1.28k, False: 37.6M]
  ------------------
   27|       |    /* Top level item */
   28|  1.28k|    ctx->root = item;
   29|  1.28k|    return;
   30|  1.28k|  }
   31|       |  /* Part of a bigger structure */
   32|  37.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|  33.6M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (36:5): [True: 33.6M, False: 3.92M]
  ------------------
   37|  33.6M|      if (cbor_array_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (37:11): [True: 13.9M, False: 19.6M]
  ------------------
   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|  13.9M|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   64|  13.9M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (41:9): [True: 0, False: 13.9M]
  |  Branch (41:9): [True: 13.9M, False: 0]
  ------------------
   42|       |        // This should never happen since the definite array should be
   43|       |        // preallocated for the expected number of items.
   44|  13.9M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (44:13): [True: 0, False: 13.9M]
  ------------------
   45|      0|          ctx->creation_failed = true;
   46|      0|          cbor_decref(&item);
   47|      0|          break;
   48|      0|        }
   49|  13.9M|        cbor_decref(&item);
   50|  13.9M|        ctx->stack->top->subitems--;
   51|  13.9M|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (51:13): [True: 13.0M, False: 920k]
  ------------------
   52|  13.0M|          cbor_item_t* stack_item = ctx->stack->top->item;
   53|  13.0M|          _cbor_stack_pop(ctx->stack);
   54|  13.0M|          _cbor_builder_append(stack_item, ctx);
   55|  13.0M|        }
   56|  19.6M|      } else {
   57|       |        /* Indefinite array, don't bother with subitems */
   58|  19.6M|        if (!cbor_array_push(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (58:13): [True: 1, False: 19.6M]
  ------------------
   59|      1|          ctx->creation_failed = true;
   60|      1|        }
   61|  19.6M|        cbor_decref(&item);
   62|  19.6M|      }
   63|  33.6M|      break;
   64|  33.6M|    }
   65|  33.6M|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (65:5): [True: 3.59M, False: 34.0M]
  ------------------
   66|       |      // Handle both definite and indefinite maps the same initially.
   67|       |      // Note: We use 0 and 1 subitems to distinguish between keys and values in
   68|       |      // indefinite items
   69|  3.59M|      if (ctx->stack->top->subitems % 2) {
  ------------------
  |  Branch (69:11): [True: 1.79M, False: 1.79M]
  ------------------
   70|       |        // Odd record, this is a value.
   71|  1.79M|        ctx->creation_failed =
   72|  1.79M|            !_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.79M|        CBOR_ASSERT(!ctx->creation_failed);
  ------------------
  |  |   64|  1.79M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (75:9): [True: 0, False: 1.79M]
  |  Branch (75:9): [True: 1.79M, False: 0]
  ------------------
   76|  1.79M|      } else {
   77|       |        // Even record, this is a key.
   78|  1.79M|        if (!_cbor_map_add_key(ctx->stack->top->item, item)) {
  ------------------
  |  Branch (78:13): [True: 0, False: 1.79M]
  ------------------
   79|      0|          ctx->creation_failed = true;
   80|      0|          cbor_decref(&item);
   81|      0|          break;
   82|      0|        }
   83|  1.79M|      }
   84|  3.59M|      cbor_decref(&item);
   85|  3.59M|      if (cbor_map_is_definite(ctx->stack->top->item)) {
  ------------------
  |  Branch (85:11): [True: 1.25M, False: 2.33M]
  ------------------
   86|  1.25M|        CBOR_ASSERT(ctx->stack->top->subitems > 0);
  ------------------
  |  |   64|  1.25M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (86:9): [True: 0, False: 1.25M]
  |  Branch (86:9): [True: 1.25M, False: 0]
  ------------------
   87|  1.25M|        ctx->stack->top->subitems--;
   88|  1.25M|        if (ctx->stack->top->subitems == 0) {
  ------------------
  |  Branch (88:13): [True: 50.8k, False: 1.20M]
  ------------------
   89|  50.8k|          cbor_item_t* map_entry = ctx->stack->top->item;
   90|  50.8k|          _cbor_stack_pop(ctx->stack);
   91|  50.8k|          _cbor_builder_append(map_entry, ctx);
   92|  50.8k|        }
   93|  2.33M|      } else {
   94|  2.33M|        ctx->stack->top->subitems ^=
   95|  2.33M|            1; /* Flip the indicator for indefinite items */
   96|  2.33M|      }
   97|  3.59M|      break;
   98|  3.59M|    }
   99|  3.59M|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (99:5): [True: 335k, False: 37.2M]
  ------------------
  100|   335k|      CBOR_ASSERT(ctx->stack->top->subitems == 1);
  ------------------
  |  |   64|   335k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (100:7): [True: 0, False: 335k]
  |  Branch (100:7): [True: 335k, False: 0]
  ------------------
  101|   335k|      cbor_tag_set_item(ctx->stack->top->item, item);
  102|   335k|      cbor_decref(&item); /* Give up on our reference */
  103|   335k|      cbor_item_t* tagged_item = ctx->stack->top->item;
  104|   335k|      _cbor_stack_pop(ctx->stack);
  105|   335k|      _cbor_builder_append(tagged_item, ctx);
  106|   335k|      break;
  107|   335k|    }
  108|       |    // We have an item to append but nothing to append it to.
  109|     85|    default: {
  ------------------
  |  Branch (109:5): [True: 85, False: 37.6M]
  ------------------
  110|     85|      cbor_decref(&item);
  111|     85|      ctx->syntax_error = true;
  112|     85|    }
  113|  37.6M|  }
  114|  37.6M|}
cbor_builder_uint8_callback:
  144|  16.8M|void cbor_builder_uint8_callback(void* context, uint8_t value) {
  145|  16.8M|  struct _cbor_decoder_context* ctx = context;
  146|  16.8M|  cbor_item_t* res = cbor_new_int8();
  147|  16.8M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  16.8M|  do {                             \
  |  |  118|  16.8M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 17, False: 16.8M]
  |  |  ------------------
  |  |  119|     17|      ctx->creation_failed = true; \
  |  |  120|     17|      return;                      \
  |  |  121|     17|    }                              \
  |  |  122|  16.8M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 16.8M]
  |  |  ------------------
  ------------------
  148|  16.8M|  cbor_mark_uint(res);
  149|  16.8M|  cbor_set_uint8(res, value);
  150|  16.8M|  _cbor_builder_append(res, ctx);
  151|  16.8M|}
cbor_builder_uint16_callback:
  153|  9.05k|void cbor_builder_uint16_callback(void* context, uint16_t value) {
  154|  9.05k|  struct _cbor_decoder_context* ctx = context;
  155|  9.05k|  cbor_item_t* res = cbor_new_int16();
  156|  9.05k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  9.05k|  do {                             \
  |  |  118|  9.05k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 9.05k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  9.05k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 9.05k]
  |  |  ------------------
  ------------------
  157|  9.05k|  cbor_mark_uint(res);
  158|  9.05k|  cbor_set_uint16(res, value);
  159|  9.05k|  _cbor_builder_append(res, ctx);
  160|  9.05k|}
cbor_builder_uint32_callback:
  162|   621k|void cbor_builder_uint32_callback(void* context, uint32_t value) {
  163|   621k|  struct _cbor_decoder_context* ctx = context;
  164|   621k|  cbor_item_t* res = cbor_new_int32();
  165|   621k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   621k|  do {                             \
  |  |  118|   621k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 621k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   621k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 621k]
  |  |  ------------------
  ------------------
  166|   621k|  cbor_mark_uint(res);
  167|   621k|  cbor_set_uint32(res, value);
  168|   621k|  _cbor_builder_append(res, ctx);
  169|   621k|}
cbor_builder_uint64_callback:
  171|  10.2k|void cbor_builder_uint64_callback(void* context, uint64_t value) {
  172|  10.2k|  struct _cbor_decoder_context* ctx = context;
  173|  10.2k|  cbor_item_t* res = cbor_new_int64();
  174|  10.2k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  10.2k|  do {                             \
  |  |  118|  10.2k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 10.2k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  10.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 10.2k]
  |  |  ------------------
  ------------------
  175|  10.2k|  cbor_mark_uint(res);
  176|  10.2k|  cbor_set_uint64(res, value);
  177|  10.2k|  _cbor_builder_append(res, ctx);
  178|  10.2k|}
cbor_builder_negint8_callback:
  180|  2.34M|void cbor_builder_negint8_callback(void* context, uint8_t value) {
  181|  2.34M|  struct _cbor_decoder_context* ctx = context;
  182|  2.34M|  cbor_item_t* res = cbor_new_int8();
  183|  2.34M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  2.34M|  do {                             \
  |  |  118|  2.34M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 1, False: 2.34M]
  |  |  ------------------
  |  |  119|      1|      ctx->creation_failed = true; \
  |  |  120|      1|      return;                      \
  |  |  121|      1|    }                              \
  |  |  122|  2.34M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 2.34M]
  |  |  ------------------
  ------------------
  184|  2.34M|  cbor_mark_negint(res);
  185|  2.34M|  cbor_set_uint8(res, value);
  186|  2.34M|  _cbor_builder_append(res, ctx);
  187|  2.34M|}
cbor_builder_negint16_callback:
  189|  34.5k|void cbor_builder_negint16_callback(void* context, uint16_t value) {
  190|  34.5k|  struct _cbor_decoder_context* ctx = context;
  191|  34.5k|  cbor_item_t* res = cbor_new_int16();
  192|  34.5k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  34.5k|  do {                             \
  |  |  118|  34.5k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 34.5k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  34.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 34.5k]
  |  |  ------------------
  ------------------
  193|  34.5k|  cbor_mark_negint(res);
  194|  34.5k|  cbor_set_uint16(res, value);
  195|  34.5k|  _cbor_builder_append(res, ctx);
  196|  34.5k|}
cbor_builder_negint32_callback:
  198|  14.9k|void cbor_builder_negint32_callback(void* context, uint32_t value) {
  199|  14.9k|  struct _cbor_decoder_context* ctx = context;
  200|  14.9k|  cbor_item_t* res = cbor_new_int32();
  201|  14.9k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  14.9k|  do {                             \
  |  |  118|  14.9k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 14.9k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  14.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 14.9k]
  |  |  ------------------
  ------------------
  202|  14.9k|  cbor_mark_negint(res);
  203|  14.9k|  cbor_set_uint32(res, value);
  204|  14.9k|  _cbor_builder_append(res, ctx);
  205|  14.9k|}
cbor_builder_negint64_callback:
  207|  3.68k|void cbor_builder_negint64_callback(void* context, uint64_t value) {
  208|  3.68k|  struct _cbor_decoder_context* ctx = context;
  209|  3.68k|  cbor_item_t* res = cbor_new_int64();
  210|  3.68k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  3.68k|  do {                             \
  |  |  118|  3.68k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 3.68k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  3.68k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 3.68k]
  |  |  ------------------
  ------------------
  211|  3.68k|  cbor_mark_negint(res);
  212|  3.68k|  cbor_set_uint64(res, value);
  213|  3.68k|  _cbor_builder_append(res, ctx);
  214|  3.68k|}
cbor_builder_byte_string_callback:
  217|  1.34M|                                       uint64_t length) {
  218|  1.34M|  struct _cbor_decoder_context* ctx = context;
  219|  1.34M|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  129|  1.34M|  do {                             \
  |  |  130|  1.34M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 1.34M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  1.34M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 1.34M]
  |  |  ------------------
  ------------------
  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.34M|  unsigned char* new_handle = NULL;
  223|  1.34M|  if (length > 0) {
  ------------------
  |  Branch (223:7): [True: 1.34M, False: 26]
  ------------------
  224|  1.34M|    new_handle = _cbor_malloc(length);
  225|  1.34M|    if (new_handle == NULL) {
  ------------------
  |  Branch (225:9): [True: 0, False: 1.34M]
  ------------------
  226|      0|      ctx->creation_failed = true;
  227|      0|      return;
  228|      0|    }
  229|  1.34M|    memcpy(new_handle, data, length);
  230|  1.34M|  }
  231|  1.34M|  cbor_item_t* new_chunk = cbor_new_definite_bytestring();
  232|       |
  233|  1.34M|  if (new_chunk == NULL) {
  ------------------
  |  Branch (233:7): [True: 0, False: 1.34M]
  ------------------
  234|      0|    _cbor_free(new_handle);
  235|      0|    ctx->creation_failed = true;
  236|      0|    return;
  237|      0|  }
  238|       |
  239|  1.34M|  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.34M|  if (ctx->stack->size > 0 && cbor_isa_bytestring(ctx->stack->top->item) &&
  ------------------
  |  Branch (243:7): [True: 1.34M, False: 22]
  |  Branch (243:31): [True: 1.27M, False: 70.5k]
  ------------------
  244|  1.27M|      cbor_bytestring_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (244:7): [True: 1.27M, False: 0]
  ------------------
  245|  1.27M|    if (!cbor_bytestring_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (245:9): [True: 0, False: 1.27M]
  ------------------
  246|      0|      ctx->creation_failed = true;
  247|      0|    }
  248|  1.27M|    cbor_decref(&new_chunk);
  249|  1.27M|  } else {
  250|  70.5k|    _cbor_builder_append(new_chunk, ctx);
  251|  70.5k|  }
  252|  1.34M|}
cbor_builder_byte_string_start_callback:
  254|  3.86k|void cbor_builder_byte_string_start_callback(void* context) {
  255|  3.86k|  struct _cbor_decoder_context* ctx = context;
  256|  3.86k|  cbor_item_t* res = cbor_new_indefinite_bytestring();
  257|  3.86k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  3.86k|  do {                             \
  |  |  118|  3.86k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 3.86k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  3.86k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 3.86k]
  |  |  ------------------
  ------------------
  258|  3.86k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  3.86k|  do {                                                         \
  |  |  138|  3.86k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 2, False: 3.86k]
  |  |  ------------------
  |  |  139|      2|      cbor_decref(&res);                                       \
  |  |  140|      2|      ctx->creation_failed = true;                             \
  |  |  141|      2|    }                                                          \
  |  |  142|  3.86k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 3.86k]
  |  |  ------------------
  ------------------
  259|  3.86k|}
cbor_builder_string_callback:
  262|  2.30M|                                  uint64_t length) {
  263|  2.30M|  struct _cbor_decoder_context* ctx = context;
  264|  2.30M|  CHECK_LENGTH(ctx, length);
  ------------------
  |  |  129|  2.30M|  do {                             \
  |  |  130|  2.30M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 2.30M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  2.30M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 2.30M]
  |  |  ------------------
  ------------------
  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.30M|  unsigned char* new_handle = NULL;
  268|  2.30M|  if (length > 0) {
  ------------------
  |  Branch (268:7): [True: 2.30M, False: 37]
  ------------------
  269|  2.30M|    new_handle = _cbor_malloc(length);
  270|  2.30M|    if (new_handle == NULL) {
  ------------------
  |  Branch (270:9): [True: 0, False: 2.30M]
  ------------------
  271|      0|      ctx->creation_failed = true;
  272|      0|      return;
  273|      0|    }
  274|  2.30M|    memcpy(new_handle, data, length);
  275|  2.30M|  }
  276|  2.30M|  cbor_item_t* new_chunk = cbor_new_definite_string();
  277|  2.30M|  if (new_chunk == NULL) {
  ------------------
  |  Branch (277:7): [True: 0, False: 2.30M]
  ------------------
  278|      0|    _cbor_free(new_handle);
  279|      0|    ctx->creation_failed = true;
  280|      0|    return;
  281|      0|  }
  282|  2.30M|  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.30M|  if (ctx->stack->size > 0 && cbor_isa_string(ctx->stack->top->item) &&
  ------------------
  |  Branch (286:7): [True: 2.30M, False: 24]
  |  Branch (286:31): [True: 1.99M, False: 303k]
  ------------------
  287|  1.99M|      cbor_string_is_indefinite(ctx->stack->top->item)) {
  ------------------
  |  Branch (287:7): [True: 1.99M, False: 0]
  ------------------
  288|  1.99M|    if (!cbor_string_add_chunk(ctx->stack->top->item, new_chunk)) {
  ------------------
  |  Branch (288:9): [True: 0, False: 1.99M]
  ------------------
  289|      0|      ctx->creation_failed = true;
  290|      0|    }
  291|  1.99M|    cbor_decref(&new_chunk);
  292|  1.99M|  } else {
  293|   303k|    _cbor_builder_append(new_chunk, ctx);
  294|   303k|  }
  295|  2.30M|}
cbor_builder_string_start_callback:
  297|  12.8k|void cbor_builder_string_start_callback(void* context) {
  298|  12.8k|  struct _cbor_decoder_context* ctx = context;
  299|  12.8k|  cbor_item_t* res = cbor_new_indefinite_string();
  300|  12.8k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  12.8k|  do {                             \
  |  |  118|  12.8k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 12.8k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  12.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 12.8k]
  |  |  ------------------
  ------------------
  301|  12.8k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  12.8k|  do {                                                         \
  |  |  138|  12.8k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 12.8k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  12.8k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 12.8k]
  |  |  ------------------
  ------------------
  302|  12.8k|}
cbor_builder_array_start_callback:
  304|  13.1M|void cbor_builder_array_start_callback(void* context, uint64_t size) {
  305|  13.1M|  struct _cbor_decoder_context* ctx = context;
  306|  13.1M|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  129|  13.1M|  do {                             \
  |  |  130|  13.1M|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 13.1M]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  13.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 13.1M]
  |  |  ------------------
  ------------------
  307|  13.1M|  cbor_item_t* res = cbor_new_definite_array(size);
  308|  13.1M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  13.1M|  do {                             \
  |  |  118|  13.1M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 105, False: 13.1M]
  |  |  ------------------
  |  |  119|    105|      ctx->creation_failed = true; \
  |  |  120|    105|      return;                      \
  |  |  121|    105|    }                              \
  |  |  122|  13.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 13.1M]
  |  |  ------------------
  ------------------
  309|  13.1M|  if (size > 0) {
  ------------------
  |  Branch (309:7): [True: 13.1M, False: 6]
  ------------------
  310|  13.1M|    PUSH_CTX_STACK(ctx, res, size);
  ------------------
  |  |  137|  13.1M|  do {                                                         \
  |  |  138|  13.1M|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 9, False: 13.1M]
  |  |  ------------------
  |  |  139|      9|      cbor_decref(&res);                                       \
  |  |  140|      9|      ctx->creation_failed = true;                             \
  |  |  141|      9|    }                                                          \
  |  |  142|  13.1M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 13.1M]
  |  |  ------------------
  ------------------
  311|  13.1M|  } else {
  312|      6|    _cbor_builder_append(res, ctx);
  313|      6|  }
  314|  13.1M|}
cbor_builder_indef_array_start_callback:
  316|   536k|void cbor_builder_indef_array_start_callback(void* context) {
  317|   536k|  struct _cbor_decoder_context* ctx = context;
  318|   536k|  cbor_item_t* res = cbor_new_indefinite_array();
  319|   536k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   536k|  do {                             \
  |  |  118|   536k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 536k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   536k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 536k]
  |  |  ------------------
  ------------------
  320|   536k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|   536k|  do {                                                         \
  |  |  138|   536k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 536k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|   536k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 536k]
  |  |  ------------------
  ------------------
  321|   536k|}
cbor_builder_indef_map_start_callback:
  323|  6.33k|void cbor_builder_indef_map_start_callback(void* context) {
  324|  6.33k|  struct _cbor_decoder_context* ctx = context;
  325|  6.33k|  cbor_item_t* res = cbor_new_indefinite_map();
  326|  6.33k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  6.33k|  do {                             \
  |  |  118|  6.33k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 6.33k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  6.33k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 6.33k]
  |  |  ------------------
  ------------------
  327|  6.33k|  PUSH_CTX_STACK(ctx, res, 0);
  ------------------
  |  |  137|  6.33k|  do {                                                         \
  |  |  138|  6.33k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 6.32k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  6.33k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 6.33k]
  |  |  ------------------
  ------------------
  328|  6.33k|}
cbor_builder_map_start_callback:
  330|  86.9k|void cbor_builder_map_start_callback(void* context, uint64_t size) {
  331|  86.9k|  struct _cbor_decoder_context* ctx = context;
  332|  86.9k|  CHECK_LENGTH(ctx, size);
  ------------------
  |  |  129|  86.9k|  do {                             \
  |  |  130|  86.9k|    if (length > SIZE_MAX) {       \
  |  |  ------------------
  |  |  |  Branch (130:9): [True: 0, False: 86.9k]
  |  |  ------------------
  |  |  131|      0|      ctx->creation_failed = true; \
  |  |  132|      0|      return;                      \
  |  |  133|      0|    }                              \
  |  |  134|  86.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (134:12): [Folded, False: 86.9k]
  |  |  ------------------
  ------------------
  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|  86.9k|  if (size > SIZE_MAX / 2) {
  ------------------
  |  Branch (335:7): [True: 72, False: 86.9k]
  ------------------
  336|     72|    ctx->creation_failed = true;
  337|     72|    return;
  338|     72|  }
  339|  86.9k|  cbor_item_t* res = cbor_new_definite_map(size);
  340|  86.9k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  86.9k|  do {                             \
  |  |  118|  86.9k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 101, False: 86.8k]
  |  |  ------------------
  |  |  119|    101|      ctx->creation_failed = true; \
  |  |  120|    101|      return;                      \
  |  |  121|    101|    }                              \
  |  |  122|  86.9k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 86.8k]
  |  |  ------------------
  ------------------
  341|  86.8k|  if (size > 0) {
  ------------------
  |  Branch (341:7): [True: 86.7k, False: 15]
  ------------------
  342|  86.7k|    PUSH_CTX_STACK(ctx, res, size * 2);
  ------------------
  |  |  137|  86.7k|  do {                                                         \
  |  |  138|  86.7k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 1, False: 86.7k]
  |  |  ------------------
  |  |  139|      1|      cbor_decref(&res);                                       \
  |  |  140|      1|      ctx->creation_failed = true;                             \
  |  |  141|      1|    }                                                          \
  |  |  142|  86.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 86.7k]
  |  |  ------------------
  ------------------
  343|  86.7k|  } else {
  344|     15|    _cbor_builder_append(res, ctx);
  345|     15|  }
  346|  86.8k|}
_cbor_is_indefinite:
  351|   528k|bool _cbor_is_indefinite(cbor_item_t* item) {
  352|   528k|  switch (item->type) {
  353|    953|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (353:5): [True: 953, False: 527k]
  ------------------
  354|    953|      return cbor_bytestring_is_indefinite(item);
  355|  12.4k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (355:5): [True: 12.4k, False: 516k]
  ------------------
  356|  12.4k|      return cbor_string_is_indefinite(item);
  357|   511k|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (357:5): [True: 511k, False: 16.7k]
  ------------------
  358|   511k|      return cbor_array_is_indefinite(item);
  359|  3.37k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (359:5): [True: 3.37k, False: 525k]
  ------------------
  360|  3.37k|      return cbor_map_is_indefinite(item);
  361|      3|    default:
  ------------------
  |  Branch (361:5): [True: 3, False: 528k]
  ------------------
  362|       |      // Should never happen since a non-nested item cannot be on top of the
  363|       |      // stack.
  364|      3|      return false;
  365|   528k|  }
  366|   528k|}
cbor_builder_indef_break_callback:
  368|   528k|void cbor_builder_indef_break_callback(void* context) {
  369|   528k|  struct _cbor_decoder_context* ctx = context;
  370|       |  /* There must be an item to break out of*/
  371|   528k|  if (ctx->stack->size > 0) {
  ------------------
  |  Branch (371:7): [True: 528k, False: 1]
  ------------------
  372|   528k|    cbor_item_t* item = ctx->stack->top->item;
  373|   528k|    if (_cbor_is_indefinite(
  ------------------
  |  Branch (373:9): [True: 528k, False: 34]
  ------------------
  374|   528k|            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|   528k|        (item->type != CBOR_TYPE_MAP || ctx->stack->top->subitems % 2 == 0)) {
  ------------------
  |  Branch (377:10): [True: 525k, False: 3.35k]
  |  Branch (377:41): [True: 3.34k, False: 6]
  ------------------
  378|   528k|      _cbor_stack_pop(ctx->stack);
  379|   528k|      _cbor_builder_append(item, ctx);
  380|   528k|      return;
  381|   528k|    }
  382|   528k|  }
  383|       |
  384|     41|  ctx->syntax_error = true;
  385|     41|}
cbor_builder_float2_callback:
  387|  96.3k|void cbor_builder_float2_callback(void* context, float value) {
  388|  96.3k|  struct _cbor_decoder_context* ctx = context;
  389|  96.3k|  cbor_item_t* res = cbor_new_float2();
  390|  96.3k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  96.3k|  do {                             \
  |  |  118|  96.3k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 96.3k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  96.3k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 96.3k]
  |  |  ------------------
  ------------------
  391|  96.3k|  cbor_set_float2(res, value);
  392|  96.3k|  _cbor_builder_append(res, ctx);
  393|  96.3k|}
cbor_builder_float4_callback:
  395|  13.2k|void cbor_builder_float4_callback(void* context, float value) {
  396|  13.2k|  struct _cbor_decoder_context* ctx = context;
  397|  13.2k|  cbor_item_t* res = cbor_new_float4();
  398|  13.2k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  13.2k|  do {                             \
  |  |  118|  13.2k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 13.2k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  13.2k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 13.2k]
  |  |  ------------------
  ------------------
  399|  13.2k|  cbor_set_float4(res, value);
  400|  13.2k|  _cbor_builder_append(res, ctx);
  401|  13.2k|}
cbor_builder_float8_callback:
  403|  31.5k|void cbor_builder_float8_callback(void* context, double value) {
  404|  31.5k|  struct _cbor_decoder_context* ctx = context;
  405|  31.5k|  cbor_item_t* res = cbor_new_float8();
  406|  31.5k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  31.5k|  do {                             \
  |  |  118|  31.5k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 31.5k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  31.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 31.5k]
  |  |  ------------------
  ------------------
  407|  31.5k|  cbor_set_float8(res, value);
  408|  31.5k|  _cbor_builder_append(res, ctx);
  409|  31.5k|}
cbor_builder_null_callback:
  411|  1.35M|void cbor_builder_null_callback(void* context) {
  412|  1.35M|  struct _cbor_decoder_context* ctx = context;
  413|  1.35M|  cbor_item_t* res = cbor_new_null();
  414|  1.35M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.35M|  do {                             \
  |  |  118|  1.35M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 1, False: 1.35M]
  |  |  ------------------
  |  |  119|      1|      ctx->creation_failed = true; \
  |  |  120|      1|      return;                      \
  |  |  121|      1|    }                              \
  |  |  122|  1.35M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 1.35M]
  |  |  ------------------
  ------------------
  415|  1.35M|  _cbor_builder_append(res, ctx);
  416|  1.35M|}
cbor_builder_undefined_callback:
  418|  29.5k|void cbor_builder_undefined_callback(void* context) {
  419|  29.5k|  struct _cbor_decoder_context* ctx = context;
  420|  29.5k|  cbor_item_t* res = cbor_new_undef();
  421|  29.5k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  29.5k|  do {                             \
  |  |  118|  29.5k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 29.5k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  29.5k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 29.5k]
  |  |  ------------------
  ------------------
  422|  29.5k|  _cbor_builder_append(res, ctx);
  423|  29.5k|}
cbor_builder_simple_value_callback:
  425|     46|void cbor_builder_simple_value_callback(void* context, uint8_t value) {
  426|     46|  struct _cbor_decoder_context* ctx = context;
  427|     46|  cbor_item_t* res = cbor_build_ctrl(value);
  428|     46|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|     46|  do {                             \
  |  |  118|     46|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 46]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|     46|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 46]
  |  |  ------------------
  ------------------
  429|     46|  _cbor_builder_append(res, ctx);
  430|     46|}
cbor_builder_boolean_callback:
  432|  1.81M|void cbor_builder_boolean_callback(void* context, bool value) {
  433|  1.81M|  struct _cbor_decoder_context* ctx = context;
  434|  1.81M|  cbor_item_t* res = cbor_build_bool(value);
  435|  1.81M|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|  1.81M|  do {                             \
  |  |  118|  1.81M|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 1.81M]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|  1.81M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 1.81M]
  |  |  ------------------
  ------------------
  436|  1.81M|  _cbor_builder_append(res, ctx);
  437|  1.81M|}
cbor_builder_tag_callback:
  439|   354k|void cbor_builder_tag_callback(void* context, uint64_t value) {
  440|   354k|  struct _cbor_decoder_context* ctx = context;
  441|   354k|  cbor_item_t* res = cbor_new_tag(value);
  442|   354k|  CHECK_RES(ctx, res);
  ------------------
  |  |  117|   354k|  do {                             \
  |  |  118|   354k|    if (res == NULL) {             \
  |  |  ------------------
  |  |  |  Branch (118:9): [True: 0, False: 354k]
  |  |  ------------------
  |  |  119|      0|      ctx->creation_failed = true; \
  |  |  120|      0|      return;                      \
  |  |  121|      0|    }                              \
  |  |  122|   354k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (122:12): [Folded, False: 354k]
  |  |  ------------------
  ------------------
  443|   354k|  PUSH_CTX_STACK(ctx, res, 1);
  ------------------
  |  |  137|   354k|  do {                                                         \
  |  |  138|   354k|    if (_cbor_stack_push(ctx->stack, res, subitems) == NULL) { \
  |  |  ------------------
  |  |  |  Branch (138:9): [True: 2, False: 354k]
  |  |  ------------------
  |  |  139|      2|      cbor_decref(&res);                                       \
  |  |  140|      2|      ctx->creation_failed = true;                             \
  |  |  141|      2|    }                                                          \
  |  |  142|   354k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (142:12): [Folded, False: 354k]
  |  |  ------------------
  ------------------
  444|   354k|}

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

_cbor_load_uint8:
   12|  36.3M|uint8_t _cbor_load_uint8(cbor_data source) { return (uint8_t)*source; }
_cbor_load_uint16:
   14|  63.1k|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|  63.1k|  return ((uint16_t) * (source + 0) << 8) + (uint8_t) * (source + 1);
   21|  63.1k|#endif
   22|  63.1k|}
_cbor_load_uint32:
   24|   659k|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|   659k|  return ((uint32_t) * (source + 0) << 0x18) +
   31|   659k|         ((uint32_t) * (source + 1) << 0x10) +
   32|   659k|         ((uint16_t) * (source + 2) << 0x08) + (uint8_t) * (source + 3);
   33|   659k|#endif
   34|   659k|}
_cbor_load_uint64:
   36|  50.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|  50.1k|  return ((uint64_t) * (source + 0) << 0x38) +
   43|  50.1k|         ((uint64_t) * (source + 1) << 0x30) +
   44|  50.1k|         ((uint64_t) * (source + 2) << 0x28) +
   45|  50.1k|         ((uint64_t) * (source + 3) << 0x20) +
   46|  50.1k|         ((uint32_t) * (source + 4) << 0x18) +
   47|  50.1k|         ((uint32_t) * (source + 5) << 0x10) +
   48|  50.1k|         ((uint16_t) * (source + 6) << 0x08) + (uint8_t) * (source + 7);
   49|  50.1k|#endif
   50|  50.1k|}
_cbor_decode_half:
   53|  96.3k|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|  96.3k|  int half = (halfp[0] << 8) + halfp[1];
   57|  96.3k|  int exp = (half >> 10) & 0x1f;
   58|  96.3k|  int mant = half & 0x3ff;
   59|  96.3k|  if (exp == 31 && mant != 0) {
  ------------------
  |  Branch (59:7): [True: 8.59k, False: 87.7k]
  |  Branch (59:20): [True: 7.47k, False: 1.12k]
  ------------------
   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|  7.47k|    union _cbor_float_helper helper = {
   65|  7.47k|        .as_uint = ((uint32_t)(half & 0x8000) << 16) | /* sign */
   66|  7.47k|                   0x7F800000u |                       /* exponent (all 1s) */
   67|  7.47k|                   ((uint32_t)mant << 13)};            /* payload */
   68|  7.47k|    return helper.as_float;
   69|  7.47k|  }
   70|  88.9k|  double val;
   71|  88.9k|  if (exp == 0)
  ------------------
  |  Branch (71:7): [True: 34.6k, False: 54.2k]
  ------------------
   72|  34.6k|    val = ldexp(mant, -24);
   73|  54.2k|  else if (exp != 31)
  ------------------
  |  Branch (73:12): [True: 53.1k, False: 1.12k]
  ------------------
   74|  53.1k|    val = ldexp(mant + 1024, exp - 25);
   75|  1.12k|  else
   76|  1.12k|    val = INFINITY; /* exp == 31, mant == 0: the NaN case is handled above */
   77|  88.9k|  return (float)(half & 0x8000 ? -val : val);
  ------------------
  |  Branch (77:18): [True: 39.9k, False: 48.9k]
  ------------------
   78|  96.3k|}
_cbor_load_half:
   80|  96.3k|float _cbor_load_half(cbor_data source) {
   81|       |  /* Discard const */
   82|  96.3k|  return _cbor_decode_half((unsigned char*)source);
   83|  96.3k|}
_cbor_load_float:
   85|  13.2k|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|  13.2k|  union _cbor_float_helper helper = {.as_uint = _cbor_load_uint32(source)};
   89|  13.2k|  return helper.as_float;
   90|  13.2k|}
_cbor_load_double:
   92|  31.5k|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|  31.5k|  union _cbor_double_helper helper = {.as_uint = _cbor_load_uint64(source)};
   96|  31.5k|  return helper.as_double;
   97|  31.5k|}

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

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

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

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

cbor_map_size:
   11|  2.48M|size_t cbor_map_size(const cbor_item_t* item) {
   12|  2.48M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  2.48M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (12:3): [True: 0, False: 2.48M]
  |  Branch (12:3): [True: 2.48M, False: 0]
  ------------------
   13|  2.48M|  return item->metadata.map_metadata.end_ptr;
   14|  2.48M|}
cbor_new_definite_map:
   21|   131k|cbor_item_t* cbor_new_definite_map(size_t size) {
   22|   131k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   23|   131k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|   131k|  do {                           \
  |  |  127|   131k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 131k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|   131k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 131k]
  |  |  ------------------
  ------------------
   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|   131k|  unsigned char* data = NULL;
   28|   131k|  if (size > 0) {
  ------------------
  |  Branch (28:7): [True: 131k, False: 17]
  ------------------
   29|   131k|    data = _cbor_alloc_multiple(sizeof(struct cbor_pair), size);
   30|   131k|    _CBOR_DEPENDENT_NOTNULL(item, data);
  ------------------
  |  |  135|   131k|  do {                                              \
  |  |  136|   131k|    if (pointer == NULL) {                          \
  |  |  ------------------
  |  |  |  Branch (136:9): [True: 101, False: 131k]
  |  |  ------------------
  |  |  137|    101|      _cbor_free(cbor_item);                        \
  |  |  138|    101|      return NULL;                                  \
  |  |  139|    101|    }                                               \
  |  |  140|   131k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (140:12): [Folded, False: 131k]
  |  |  ------------------
  ------------------
   31|   131k|  }
   32|       |
   33|   131k|  *item = (cbor_item_t){
   34|   131k|      .refcount = 1,
   35|   131k|      .type = CBOR_TYPE_MAP,
   36|   131k|      .metadata = {.map_metadata = {.allocated = size,
   37|   131k|                                    .type = _CBOR_METADATA_DEFINITE,
   38|   131k|                                    .end_ptr = 0}},
   39|   131k|      .data = data};
   40|       |
   41|   131k|  return item;
   42|   131k|}
cbor_new_indefinite_map:
   44|  8.59k|cbor_item_t* cbor_new_indefinite_map(void) {
   45|  8.59k|  cbor_item_t* item = _cbor_malloc(sizeof(cbor_item_t));
   46|  8.59k|  _CBOR_NOTNULL(item);
  ------------------
  |  |  126|  8.59k|  do {                           \
  |  |  127|  8.59k|    if (cbor_item == NULL) {     \
  |  |  ------------------
  |  |  |  Branch (127:9): [True: 0, False: 8.59k]
  |  |  ------------------
  |  |  128|      0|      return NULL;               \
  |  |  129|      0|    }                            \
  |  |  130|  8.59k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (130:12): [Folded, False: 8.59k]
  |  |  ------------------
  ------------------
   47|       |
   48|  8.59k|  *item = (cbor_item_t){
   49|  8.59k|      .refcount = 1,
   50|  8.59k|      .type = CBOR_TYPE_MAP,
   51|  8.59k|      .metadata = {.map_metadata = {.allocated = 0,
   52|  8.59k|                                    .type = _CBOR_METADATA_INDEFINITE,
   53|  8.59k|                                    .end_ptr = 0}},
   54|  8.59k|      .data = NULL};
   55|       |
   56|  8.59k|  return item;
   57|  8.59k|}
_cbor_map_add_key:
   59|  2.51M|bool _cbor_map_add_key(cbor_item_t* item, cbor_item_t* key) {
   60|  2.51M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  2.51M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (60:3): [True: 0, False: 2.51M]
  |  Branch (60:3): [True: 2.51M, False: 0]
  ------------------
   61|  2.51M|  struct _cbor_map_metadata* metadata =
   62|  2.51M|      (struct _cbor_map_metadata*)&item->metadata;
   63|  2.51M|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (63:7): [True: 1.08M, False: 1.42M]
  ------------------
   64|  1.08M|    struct cbor_pair* data = cbor_map_handle(item);
   65|  1.08M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (65:9): [True: 0, False: 1.08M]
  ------------------
   66|       |      /* Don't realloc definite preallocated map */
   67|      0|      return false;
   68|      0|    }
   69|       |
   70|  1.08M|    data[metadata->end_ptr].key = key;
   71|  1.08M|    data[metadata->end_ptr++].value = NULL;
   72|  1.42M|  } else {
   73|  1.42M|    if (metadata->end_ptr >= metadata->allocated) {
  ------------------
  |  Branch (73:9): [True: 4.83k, False: 1.42M]
  ------------------
   74|       |      /* Exponential realloc */
   75|       |      // Check for overflows first
   76|  4.83k|      if (!_cbor_safe_to_multiply(CBOR_BUFFER_GROWTH, metadata->allocated)) {
  ------------------
  |  |    8|  4.83k|#define CBOR_BUFFER_GROWTH 2
  ------------------
  |  Branch (76:11): [True: 0, False: 4.83k]
  ------------------
   77|      0|        return false;
   78|      0|      }
   79|       |
   80|  4.83k|      size_t new_allocation = metadata->allocated == 0
  ------------------
  |  Branch (80:31): [True: 1.75k, False: 3.07k]
  ------------------
   81|  4.83k|                                  ? 1
   82|  4.83k|                                  : CBOR_BUFFER_GROWTH * metadata->allocated;
  ------------------
  |  |    8|  3.07k|#define CBOR_BUFFER_GROWTH 2
  ------------------
   83|       |
   84|  4.83k|      unsigned char* new_data = _cbor_realloc_multiple(
   85|  4.83k|          item->data, sizeof(struct cbor_pair), new_allocation);
   86|       |
   87|  4.83k|      if (new_data == NULL) {
  ------------------
  |  Branch (87:11): [True: 0, False: 4.83k]
  ------------------
   88|      0|        return false;
   89|      0|      }
   90|       |
   91|  4.83k|      item->data = new_data;
   92|  4.83k|      metadata->allocated = new_allocation;
   93|  4.83k|    }
   94|  1.42M|    struct cbor_pair* data = cbor_map_handle(item);
   95|  1.42M|    data[metadata->end_ptr].key = key;
   96|  1.42M|    data[metadata->end_ptr++].value = NULL;
   97|  1.42M|  }
   98|  2.51M|  cbor_incref(key);
   99|  2.51M|  return true;
  100|  2.51M|}
_cbor_map_add_value:
  102|  2.51M|bool _cbor_map_add_value(cbor_item_t* item, cbor_item_t* value) {
  103|  2.51M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  2.51M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (103:3): [True: 0, False: 2.51M]
  |  Branch (103:3): [True: 2.51M, False: 0]
  ------------------
  104|  2.51M|  cbor_incref(value);
  105|  2.51M|  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.51M|      item->metadata.map_metadata.end_ptr - 1]
  109|  2.51M|      .value = value;
  110|  2.51M|  return true;
  111|  2.51M|}
cbor_map_add:
  114|   719k|bool cbor_map_add(cbor_item_t* item, struct cbor_pair pair) {
  115|   719k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|   719k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (115:3): [True: 0, False: 719k]
  |  Branch (115:3): [True: 719k, False: 0]
  ------------------
  116|   719k|  if (!_cbor_map_add_key(item, pair.key)) return false;
  ------------------
  |  Branch (116:7): [True: 0, False: 719k]
  ------------------
  117|   719k|  return _cbor_map_add_value(item, pair.value);
  118|   719k|}
cbor_map_is_definite:
  120|  6.35M|bool cbor_map_is_definite(const cbor_item_t* item) {
  121|  6.35M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  6.35M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (121:3): [True: 0, False: 6.35M]
  |  Branch (121:3): [True: 6.35M, False: 0]
  ------------------
  122|  6.35M|  return item->metadata.map_metadata.type == _CBOR_METADATA_DEFINITE;
  123|  6.35M|}
cbor_map_is_indefinite:
  125|  7.89k|bool cbor_map_is_indefinite(const cbor_item_t* item) {
  126|  7.89k|  return !cbor_map_is_definite(item);
  127|  7.89k|}
cbor_map_handle:
  129|  6.75M|struct cbor_pair* cbor_map_handle(const cbor_item_t* item) {
  130|  6.75M|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  6.75M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (130:3): [True: 0, False: 6.75M]
  |  Branch (130:3): [True: 6.75M, False: 0]
  ------------------
  131|  6.75M|  return (struct cbor_pair*)item->data;
  132|  6.75M|}

cbor_serialize:
   21|  18.7M|                      size_t buffer_size) {
   22|  18.7M|  CBOR_ASSERT_VALID_TYPE(cbor_typeof(item));
  ------------------
  |  |   82|  18.7M|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  18.7M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (22:3): [True: 18.7M, False: 0]
  |  Branch (22:3): [True: 18.7M, False: 0]
  |  Branch (22:3): [True: 0, False: 18.7M]
  ------------------
   23|  18.7M|  switch (cbor_typeof(item)) {
   24|  9.71M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (24:5): [True: 9.71M, False: 9.07M]
  ------------------
   25|  9.71M|      return cbor_serialize_uint(item, buffer, buffer_size);
   26|  1.86M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (26:5): [True: 1.86M, False: 16.9M]
  ------------------
   27|  1.86M|      return cbor_serialize_negint(item, buffer, buffer_size);
   28|  44.7k|    case CBOR_TYPE_BYTESTRING:
  ------------------
  |  Branch (28:5): [True: 44.7k, False: 18.7M]
  ------------------
   29|  44.7k|      return cbor_serialize_bytestring(item, buffer, buffer_size);
   30|  67.4k|    case CBOR_TYPE_STRING:
  ------------------
  |  Branch (30:5): [True: 67.4k, False: 18.7M]
  ------------------
   31|  67.4k|      return cbor_serialize_string(item, buffer, buffer_size);
   32|  6.47M|    case CBOR_TYPE_ARRAY:
  ------------------
  |  Branch (32:5): [True: 6.47M, False: 12.3M]
  ------------------
   33|  6.47M|      return cbor_serialize_array(item, buffer, buffer_size);
   34|  46.6k|    case CBOR_TYPE_MAP:
  ------------------
  |  Branch (34:5): [True: 46.6k, False: 18.7M]
  ------------------
   35|  46.6k|      return cbor_serialize_map(item, buffer, buffer_size);
   36|   249k|    case CBOR_TYPE_TAG:
  ------------------
  |  Branch (36:5): [True: 249k, False: 18.5M]
  ------------------
   37|   249k|      return cbor_serialize_tag(item, buffer, buffer_size);
   38|   329k|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (38:5): [True: 329k, False: 18.4M]
  ------------------
   39|   329k|      return cbor_serialize_float_ctrl(item, buffer, buffer_size);
   40|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (40:5): [True: 0, False: 18.7M]
  ------------------
   41|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   42|      0|      return 0;  // LCOV_EXCL_STOP
   43|  18.7M|  }
   44|  18.7M|}
_cbor_encoded_header_size:
   51|  8.02M|size_t _cbor_encoded_header_size(uint64_t size) {
   52|  8.02M|  if (size <= kMaxEmbeddedInt)
  ------------------
  |  Branch (52:7): [True: 7.99M, False: 26.0k]
  ------------------
   53|  7.99M|    return 1;
   54|  26.0k|  else if (size <= UINT8_MAX)
  ------------------
  |  Branch (54:12): [True: 16.3k, False: 9.67k]
  ------------------
   55|  16.3k|    return 2;
   56|  9.67k|  else if (size <= UINT16_MAX)
  ------------------
  |  Branch (56:12): [True: 1.50k, False: 8.17k]
  ------------------
   57|  1.50k|    return 3;
   58|  8.17k|  else if (size <= UINT32_MAX)
  ------------------
  |  Branch (58:12): [True: 6.38k, False: 1.79k]
  ------------------
   59|  6.38k|    return 5;
   60|  1.79k|  else
   61|  1.79k|    return 9;
   62|  8.02M|}
cbor_serialized_size:
   64|  20.0M|size_t cbor_serialized_size(const cbor_item_t* item) {
   65|  20.0M|  CBOR_ASSERT_VALID_TYPE(cbor_typeof(item));
  ------------------
  |  |   82|  20.0M|  CBOR_ASSERT(item_type >= CBOR_TYPE_UINT && item_type <= CBOR_TYPE_FLOAT_CTRL);
  |  |  ------------------
  |  |  |  |   64|  20.0M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  |  |  ------------------
  ------------------
  |  Branch (65:3): [True: 20.0M, False: 0]
  |  Branch (65:3): [True: 20.0M, False: 0]
  |  Branch (65:3): [True: 0, False: 20.0M]
  ------------------
   66|  20.0M|  switch (cbor_typeof(item)) {
   67|  9.71M|    case CBOR_TYPE_UINT:
  ------------------
  |  Branch (67:5): [True: 9.71M, False: 10.3M]
  ------------------
   68|  11.5M|    case CBOR_TYPE_NEGINT:
  ------------------
  |  Branch (68:5): [True: 1.86M, False: 18.2M]
  ------------------
   69|  11.5M|      CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  11.5M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (69:7): [True: 11.5M, False: 0]
  |  Branch (69:7): [True: 11.5M, False: 0]
  |  Branch (69:7): [True: 0, False: 11.5M]
  ------------------
   70|  11.5M|                  cbor_int_get_width(item) <= CBOR_INT_64);
   71|  11.5M|      switch (cbor_int_get_width(item)) {
   72|  10.9M|        case CBOR_INT_8:
  ------------------
  |  Branch (72:9): [True: 10.9M, False: 638k]
  ------------------
   73|  10.9M|          if (cbor_get_uint8(item) <= kMaxEmbeddedInt) return 1;
  ------------------
  |  Branch (73:15): [True: 10.9M, False: 38.7k]
  ------------------
   74|  38.7k|          return 2;
   75|  31.0k|        case CBOR_INT_16:
  ------------------
  |  Branch (75:9): [True: 31.0k, False: 11.5M]
  ------------------
   76|  31.0k|          return 3;
   77|   598k|        case CBOR_INT_32:
  ------------------
  |  Branch (77:9): [True: 598k, False: 10.9M]
  ------------------
   78|   598k|          return 5;
   79|  8.79k|        case CBOR_INT_64:
  ------------------
  |  Branch (79:9): [True: 8.79k, False: 11.5M]
  ------------------
   80|  8.79k|          return 9;
   81|      0|        default:  // LCOV_EXCL_START
  ------------------
  |  Branch (81:9): [True: 0, False: 11.5M]
  ------------------
   82|      0|          _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
   83|      0|          return 0;  // LCOV_EXCL_STOP
   84|  11.5M|      }
   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|   800k|    case CBOR_TYPE_BYTESTRING: {
  ------------------
  |  Branch (88:5): [True: 800k, False: 19.2M]
  ------------------
   89|   800k|      if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (89:11): [True: 799k, False: 889]
  ------------------
   90|   799k|        size_t header_size =
   91|   799k|            _cbor_encoded_header_size(cbor_bytestring_length(item));
   92|   799k|        if (cbor_bytestring_length(item) == 0) return header_size;
  ------------------
  |  Branch (92:13): [True: 5, False: 799k]
  ------------------
   93|   799k|        return _cbor_safe_signaling_add(header_size,
   94|   799k|                                        cbor_bytestring_length(item));
   95|   799k|      }
   96|    889|      size_t indef_bytestring_size = 2;  // Leading byte + break
   97|    889|      cbor_item_t** chunks = cbor_bytestring_chunks_handle(item);
   98|   756k|      for (size_t i = 0; i < cbor_bytestring_chunk_count(item); i++) {
  ------------------
  |  Branch (98:26): [True: 755k, False: 889]
  ------------------
   99|   755k|        indef_bytestring_size = _cbor_safe_signaling_add(
  100|   755k|            indef_bytestring_size, cbor_serialized_size(chunks[i]));
  101|   755k|      }
  102|    889|      return indef_bytestring_size;
  103|   800k|    }
  104|   596k|    case CBOR_TYPE_STRING: {
  ------------------
  |  Branch (104:5): [True: 596k, False: 19.4M]
  ------------------
  105|   596k|      if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (105:11): [True: 587k, False: 8.67k]
  ------------------
  106|   587k|        size_t header_size =
  107|   587k|            _cbor_encoded_header_size(cbor_string_length(item));
  108|   587k|        if (cbor_string_length(item) == 0) return header_size;
  ------------------
  |  Branch (108:13): [True: 5, False: 587k]
  ------------------
  109|   587k|        return _cbor_safe_signaling_add(header_size, cbor_string_length(item));
  110|   587k|      }
  111|  8.67k|      size_t indef_string_size = 2;  // Leading byte + break
  112|  8.67k|      cbor_item_t** chunks = cbor_string_chunks_handle(item);
  113|   537k|      for (size_t i = 0; i < cbor_string_chunk_count(item); i++) {
  ------------------
  |  Branch (113:26): [True: 529k, False: 8.67k]
  ------------------
  114|   529k|        indef_string_size = _cbor_safe_signaling_add(
  115|   529k|            indef_string_size, cbor_serialized_size(chunks[i]));
  116|   529k|      }
  117|  8.67k|      return indef_string_size;
  118|   596k|    }
  119|  6.47M|    case CBOR_TYPE_ARRAY: {
  ------------------
  |  Branch (119:5): [True: 6.47M, False: 13.6M]
  ------------------
  120|  6.47M|      size_t array_size = cbor_array_is_definite(item)
  ------------------
  |  Branch (120:27): [True: 6.11M, False: 354k]
  ------------------
  121|  6.47M|                              ? _cbor_encoded_header_size(cbor_array_size(item))
  122|  6.47M|                              : 2;  // Leading byte + break
  123|  6.47M|      cbor_item_t** items = cbor_array_handle(item);
  124|  23.5M|      for (size_t i = 0; i < cbor_array_size(item); i++) {
  ------------------
  |  Branch (124:26): [True: 17.1M, False: 6.47M]
  ------------------
  125|  17.1M|        array_size = _cbor_safe_signaling_add(array_size,
  126|  17.1M|                                              cbor_serialized_size(items[i]));
  127|  17.1M|      }
  128|  6.47M|      return array_size;
  129|   596k|    }
  130|  46.6k|    case CBOR_TYPE_MAP: {
  ------------------
  |  Branch (130:5): [True: 46.6k, False: 20.0M]
  ------------------
  131|  46.6k|      size_t map_size = cbor_map_is_definite(item)
  ------------------
  |  Branch (131:25): [True: 44.3k, False: 2.26k]
  ------------------
  132|  46.6k|                            ? _cbor_encoded_header_size(cbor_map_size(item))
  133|  46.6k|                            : 2;  // Leading byte + break
  134|  46.6k|      struct cbor_pair* items = cbor_map_handle(item);
  135|   766k|      for (size_t i = 0; i < cbor_map_size(item); i++) {
  ------------------
  |  Branch (135:26): [True: 719k, False: 46.6k]
  ------------------
  136|   719k|        map_size = _cbor_safe_signaling_add(
  137|   719k|            map_size,
  138|   719k|            _cbor_safe_signaling_add(cbor_serialized_size(items[i].key),
  139|   719k|                                     cbor_serialized_size(items[i].value)));
  140|   719k|      }
  141|  46.6k|      return map_size;
  142|   596k|    }
  143|   249k|    case CBOR_TYPE_TAG: {
  ------------------
  |  Branch (143:5): [True: 249k, False: 19.8M]
  ------------------
  144|   249k|      cbor_item_t* tagged = cbor_tag_item(item);
  145|   249k|      if (tagged == NULL) return 0;
  ------------------
  |  Branch (145:11): [True: 0, False: 249k]
  ------------------
  146|   249k|      return _cbor_safe_signaling_add(
  147|   249k|          _cbor_encoded_header_size(cbor_tag_value(item)),
  148|   249k|          cbor_serialized_size(cbor_move(tagged)));
  149|   249k|    }
  150|   329k|    case CBOR_TYPE_FLOAT_CTRL:
  ------------------
  |  Branch (150:5): [True: 329k, False: 19.7M]
  ------------------
  151|   329k|      CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   329k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (151:7): [True: 329k, False: 0]
  |  Branch (151:7): [True: 329k, False: 0]
  |  Branch (151:7): [True: 0, False: 329k]
  ------------------
  152|   329k|                  cbor_float_get_width(item) <= CBOR_FLOAT_64);
  153|   329k|      switch (cbor_float_get_width(item)) {
  154|   222k|        case CBOR_FLOAT_0:
  ------------------
  |  Branch (154:9): [True: 222k, False: 106k]
  ------------------
  155|   222k|          return _cbor_encoded_header_size(cbor_ctrl_value(item));
  156|  85.8k|        case CBOR_FLOAT_16:
  ------------------
  |  Branch (156:9): [True: 85.8k, False: 243k]
  ------------------
  157|  85.8k|          return 3;
  158|  12.1k|        case CBOR_FLOAT_32:
  ------------------
  |  Branch (158:9): [True: 12.1k, False: 317k]
  ------------------
  159|  12.1k|          return 5;
  160|  8.36k|        case CBOR_FLOAT_64:
  ------------------
  |  Branch (160:9): [True: 8.36k, False: 321k]
  ------------------
  161|  8.36k|          return 9;
  162|      0|        default:  // LCOV_EXCL_START
  ------------------
  |  Branch (162:9): [True: 0, False: 329k]
  ------------------
  163|      0|          _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  164|      0|          return 0;  // LCOV_EXCL_STOP
  165|   329k|      }
  166|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (166:5): [True: 0, False: 20.0M]
  ------------------
  167|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  168|      0|      return 0;  // LCOV_EXCL_STOP
  169|  20.0M|  }
  170|  20.0M|}
cbor_serialize_alloc:
  173|  1.28k|                            size_t* buffer_size) {
  174|  1.28k|  *buffer = NULL;
  175|  1.28k|  size_t serialized_size = cbor_serialized_size(item);
  176|  1.28k|  if (serialized_size == 0) {
  ------------------
  |  Branch (176:7): [True: 0, False: 1.28k]
  ------------------
  177|      0|    if (buffer_size != NULL) *buffer_size = 0;
  ------------------
  |  Branch (177:9): [True: 0, False: 0]
  ------------------
  178|      0|    return 0;
  179|      0|  }
  180|  1.28k|  *buffer = _cbor_malloc(serialized_size);
  181|  1.28k|  if (*buffer == NULL) {
  ------------------
  |  Branch (181:7): [True: 0, False: 1.28k]
  ------------------
  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.28k|  size_t written = cbor_serialize(item, *buffer, serialized_size);
  187|  1.28k|  CBOR_ASSERT(written == serialized_size);
  ------------------
  |  |   64|  1.28k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (187:3): [True: 0, False: 1.28k]
  |  Branch (187:3): [True: 1.28k, False: 0]
  ------------------
  188|  1.28k|  if (buffer_size != NULL) *buffer_size = serialized_size;
  ------------------
  |  Branch (188:7): [True: 1.28k, False: 0]
  ------------------
  189|  1.28k|  return written;
  190|  1.28k|}
cbor_serialize_uint:
  193|  9.71M|                           size_t buffer_size) {
  194|  9.71M|  CBOR_ASSERT(cbor_isa_uint(item));
  ------------------
  |  |   64|  9.71M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (194:3): [True: 0, False: 9.71M]
  |  Branch (194:3): [True: 9.71M, False: 0]
  ------------------
  195|  9.71M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  9.71M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (195:3): [True: 9.71M, False: 0]
  |  Branch (195:3): [True: 9.71M, False: 0]
  |  Branch (195:3): [True: 0, False: 9.71M]
  ------------------
  196|  9.71M|              cbor_int_get_width(item) <= CBOR_INT_64);
  197|       |  // cppcheck-suppress missingReturn
  198|  9.71M|  switch (cbor_int_get_width(item)) {
  199|  9.11M|    case CBOR_INT_8:
  ------------------
  |  Branch (199:5): [True: 9.11M, False: 601k]
  ------------------
  200|  9.11M|      return cbor_encode_uint8(cbor_get_uint8(item), buffer, buffer_size);
  201|  8.44k|    case CBOR_INT_16:
  ------------------
  |  Branch (201:5): [True: 8.44k, False: 9.70M]
  ------------------
  202|  8.44k|      return cbor_encode_uint16(cbor_get_uint16(item), buffer, buffer_size);
  203|   585k|    case CBOR_INT_32:
  ------------------
  |  Branch (203:5): [True: 585k, False: 9.13M]
  ------------------
  204|   585k|      return cbor_encode_uint32(cbor_get_uint32(item), buffer, buffer_size);
  205|  7.48k|    case CBOR_INT_64:
  ------------------
  |  Branch (205:5): [True: 7.48k, False: 9.70M]
  ------------------
  206|  7.48k|      return cbor_encode_uint64(cbor_get_uint64(item), buffer, buffer_size);
  207|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (207:5): [True: 0, False: 9.71M]
  ------------------
  208|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  209|      0|      return 0;  // LCOV_EXCL_STOP
  210|  9.71M|  }
  211|  9.71M|}
cbor_serialize_negint:
  214|  1.86M|                             size_t buffer_size) {
  215|  1.86M|  CBOR_ASSERT(cbor_isa_negint(item));
  ------------------
  |  |   64|  1.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (215:3): [True: 0, False: 1.86M]
  |  Branch (215:3): [True: 1.86M, False: 0]
  ------------------
  216|  1.86M|  CBOR_ASSERT(cbor_int_get_width(item) >= CBOR_INT_8 &&
  ------------------
  |  |   64|  1.86M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (216:3): [True: 1.86M, False: 0]
  |  Branch (216:3): [True: 1.86M, False: 0]
  |  Branch (216:3): [True: 0, False: 1.86M]
  ------------------
  217|  1.86M|              cbor_int_get_width(item) <= CBOR_INT_64);
  218|       |  // cppcheck-suppress missingReturn
  219|  1.86M|  switch (cbor_int_get_width(item)) {
  220|  1.83M|    case CBOR_INT_8:
  ------------------
  |  Branch (220:5): [True: 1.83M, False: 37.4k]
  ------------------
  221|  1.83M|      return cbor_encode_negint8(cbor_get_uint8(item), buffer, buffer_size);
  222|  22.5k|    case CBOR_INT_16:
  ------------------
  |  Branch (222:5): [True: 22.5k, False: 1.84M]
  ------------------
  223|  22.5k|      return cbor_encode_negint16(cbor_get_uint16(item), buffer, buffer_size);
  224|  13.5k|    case CBOR_INT_32:
  ------------------
  |  Branch (224:5): [True: 13.5k, False: 1.85M]
  ------------------
  225|  13.5k|      return cbor_encode_negint32(cbor_get_uint32(item), buffer, buffer_size);
  226|  1.30k|    case CBOR_INT_64:
  ------------------
  |  Branch (226:5): [True: 1.30k, False: 1.86M]
  ------------------
  227|  1.30k|      return cbor_encode_negint64(cbor_get_uint64(item), buffer, buffer_size);
  228|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (228:5): [True: 0, False: 1.86M]
  ------------------
  229|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  230|      0|      return 0;  // LCOV_EXCL_STOP
  231|  1.86M|  }
  232|  1.86M|}
cbor_serialize_bytestring:
  235|   800k|                                 size_t buffer_size) {
  236|   800k|  CBOR_ASSERT(cbor_isa_bytestring(item));
  ------------------
  |  |   64|   800k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (236:3): [True: 0, False: 800k]
  |  Branch (236:3): [True: 800k, False: 0]
  ------------------
  237|   800k|  if (cbor_bytestring_is_definite(item)) {
  ------------------
  |  Branch (237:7): [True: 799k, False: 889]
  ------------------
  238|   799k|    size_t length = cbor_bytestring_length(item);
  239|   799k|    size_t written = cbor_encode_bytestring_start(length, buffer, buffer_size);
  240|   799k|    if (written > 0 && (buffer_size - written >= length)) {
  ------------------
  |  Branch (240:9): [True: 799k, False: 0]
  |  Branch (240:24): [True: 799k, False: 0]
  ------------------
  241|       |      // Empty bytestrings may have a NULL handle
  242|   799k|      if (length > 0) {
  ------------------
  |  Branch (242:11): [True: 799k, False: 5]
  ------------------
  243|   799k|        memcpy(buffer + written, cbor_bytestring_handle(item), length);
  244|   799k|      }
  245|   799k|      return written + length;
  246|   799k|    }
  247|      0|    return 0;
  248|   799k|  } else {
  249|    889|    CBOR_ASSERT(cbor_bytestring_is_indefinite(item));
  ------------------
  |  |   64|    889|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (249:5): [True: 0, False: 889]
  |  Branch (249:5): [True: 889, False: 0]
  ------------------
  250|    889|    size_t chunk_count = cbor_bytestring_chunk_count(item);
  251|    889|    size_t written = cbor_encode_indef_bytestring_start(buffer, buffer_size);
  252|    889|    if (written == 0) return 0;
  ------------------
  |  Branch (252:9): [True: 0, False: 889]
  ------------------
  253|       |
  254|    889|    cbor_item_t** chunks = cbor_bytestring_chunks_handle(item);
  255|   756k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (255:24): [True: 755k, False: 889]
  ------------------
  256|   755k|      size_t chunk_written = cbor_serialize_bytestring(
  257|   755k|          chunks[i], buffer + written, buffer_size - written);
  258|   755k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (258:11): [True: 0, False: 755k]
  ------------------
  259|   755k|      written += chunk_written;
  260|   755k|    }
  261|       |
  262|    889|    size_t break_written =
  263|    889|        cbor_encode_break(buffer + written, buffer_size - written);
  264|    889|    if (break_written == 0) return 0;
  ------------------
  |  Branch (264:9): [True: 0, False: 889]
  ------------------
  265|    889|    return written + break_written;
  266|    889|  }
  267|   800k|}
cbor_serialize_string:
  270|   596k|                             size_t buffer_size) {
  271|   596k|  CBOR_ASSERT(cbor_isa_string(item));
  ------------------
  |  |   64|   596k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (271:3): [True: 0, False: 596k]
  |  Branch (271:3): [True: 596k, False: 0]
  ------------------
  272|   596k|  if (cbor_string_is_definite(item)) {
  ------------------
  |  Branch (272:7): [True: 587k, False: 8.67k]
  ------------------
  273|   587k|    size_t length = cbor_string_length(item);
  274|   587k|    size_t written = cbor_encode_string_start(length, buffer, buffer_size);
  275|   587k|    if (written && (buffer_size - written >= length)) {
  ------------------
  |  Branch (275:9): [True: 587k, False: 0]
  |  Branch (275:20): [True: 587k, False: 0]
  ------------------
  276|       |      // Empty strings may have a NULL handle
  277|   587k|      if (length > 0) {
  ------------------
  |  Branch (277:11): [True: 587k, False: 5]
  ------------------
  278|   587k|        memcpy(buffer + written, cbor_string_handle(item), length);
  279|   587k|      }
  280|   587k|      return written + length;
  281|   587k|    }
  282|      0|    return 0;
  283|   587k|  } else {
  284|  8.67k|    CBOR_ASSERT(cbor_string_is_indefinite(item));
  ------------------
  |  |   64|  8.67k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (284:5): [True: 0, False: 8.67k]
  |  Branch (284:5): [True: 8.67k, False: 0]
  ------------------
  285|  8.67k|    size_t chunk_count = cbor_string_chunk_count(item);
  286|  8.67k|    size_t written = cbor_encode_indef_string_start(buffer, buffer_size);
  287|  8.67k|    if (written == 0) return 0;
  ------------------
  |  Branch (287:9): [True: 0, False: 8.67k]
  ------------------
  288|       |
  289|  8.67k|    cbor_item_t** chunks = cbor_string_chunks_handle(item);
  290|   537k|    for (size_t i = 0; i < chunk_count; i++) {
  ------------------
  |  Branch (290:24): [True: 529k, False: 8.67k]
  ------------------
  291|   529k|      size_t chunk_written = cbor_serialize_string(chunks[i], buffer + written,
  292|   529k|                                                   buffer_size - written);
  293|   529k|      if (chunk_written == 0) return 0;
  ------------------
  |  Branch (293:11): [True: 0, False: 529k]
  ------------------
  294|   529k|      written += chunk_written;
  295|   529k|    }
  296|       |
  297|  8.67k|    size_t break_written =
  298|  8.67k|        cbor_encode_break(buffer + written, buffer_size - written);
  299|  8.67k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (299:9): [True: 0, False: 8.67k]
  ------------------
  300|  8.67k|    return written + break_written;
  301|  8.67k|  }
  302|   596k|}
cbor_serialize_array:
  305|  6.47M|                            size_t buffer_size) {
  306|  6.47M|  CBOR_ASSERT(cbor_isa_array(item));
  ------------------
  |  |   64|  6.47M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (306:3): [True: 0, False: 6.47M]
  |  Branch (306:3): [True: 6.47M, False: 0]
  ------------------
  307|  6.47M|  size_t size = cbor_array_size(item), written = 0;
  308|  6.47M|  cbor_item_t** handle = cbor_array_handle(item);
  309|  6.47M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (309:7): [True: 6.11M, False: 354k]
  ------------------
  310|  6.11M|    written = cbor_encode_array_start(size, buffer, buffer_size);
  311|  6.11M|  } else {
  312|   354k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   64|   354k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (312:5): [True: 0, False: 354k]
  |  Branch (312:5): [True: 354k, False: 0]
  ------------------
  313|   354k|    written = cbor_encode_indef_array_start(buffer, buffer_size);
  314|   354k|  }
  315|  6.47M|  if (written == 0) return 0;
  ------------------
  |  Branch (315:7): [True: 0, False: 6.47M]
  ------------------
  316|       |
  317|  23.5M|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (317:22): [True: 17.1M, False: 6.47M]
  ------------------
  318|  17.1M|    size_t item_written =
  319|  17.1M|        cbor_serialize(*(handle++), buffer + written, buffer_size - written);
  320|  17.1M|    if (item_written == 0) return 0;
  ------------------
  |  Branch (320:9): [True: 0, False: 17.1M]
  ------------------
  321|  17.1M|    written += item_written;
  322|  17.1M|  }
  323|       |
  324|  6.47M|  if (cbor_array_is_definite(item)) {
  ------------------
  |  Branch (324:7): [True: 6.11M, False: 354k]
  ------------------
  325|  6.11M|    return written;
  326|  6.11M|  } else {
  327|   354k|    CBOR_ASSERT(cbor_array_is_indefinite(item));
  ------------------
  |  |   64|   354k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (327:5): [True: 0, False: 354k]
  |  Branch (327:5): [True: 354k, False: 0]
  ------------------
  328|   354k|    size_t break_written =
  329|   354k|        cbor_encode_break(buffer + written, buffer_size - written);
  330|   354k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (330:9): [True: 0, False: 354k]
  ------------------
  331|   354k|    return written + break_written;
  332|   354k|  }
  333|  6.47M|}
cbor_serialize_map:
  336|  46.6k|                          size_t buffer_size) {
  337|  46.6k|  CBOR_ASSERT(cbor_isa_map(item));
  ------------------
  |  |   64|  46.6k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (337:3): [True: 0, False: 46.6k]
  |  Branch (337:3): [True: 46.6k, False: 0]
  ------------------
  338|  46.6k|  size_t size = cbor_map_size(item), written = 0;
  339|  46.6k|  struct cbor_pair* handle = cbor_map_handle(item);
  340|       |
  341|  46.6k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (341:7): [True: 44.3k, False: 2.26k]
  ------------------
  342|  44.3k|    written = cbor_encode_map_start(size, buffer, buffer_size);
  343|  44.3k|  } else {
  344|  2.26k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   64|  2.26k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (344:5): [True: 0, False: 2.26k]
  |  Branch (344:5): [True: 2.26k, False: 0]
  ------------------
  345|  2.26k|    written = cbor_encode_indef_map_start(buffer, buffer_size);
  346|  2.26k|  }
  347|  46.6k|  if (written == 0) return 0;
  ------------------
  |  Branch (347:7): [True: 0, False: 46.6k]
  ------------------
  348|       |
  349|   766k|  for (size_t i = 0; i < size; i++) {
  ------------------
  |  Branch (349:22): [True: 719k, False: 46.6k]
  ------------------
  350|   719k|    size_t item_written =
  351|   719k|        cbor_serialize(handle->key, buffer + written, buffer_size - written);
  352|   719k|    if (item_written == 0) {
  ------------------
  |  Branch (352:9): [True: 0, False: 719k]
  ------------------
  353|      0|      return 0;
  354|      0|    }
  355|   719k|    written += item_written;
  356|   719k|    item_written = cbor_serialize((handle++)->value, buffer + written,
  357|   719k|                                  buffer_size - written);
  358|   719k|    if (item_written == 0) return 0;
  ------------------
  |  Branch (358:9): [True: 0, False: 719k]
  ------------------
  359|   719k|    written += item_written;
  360|   719k|  }
  361|       |
  362|  46.6k|  if (cbor_map_is_definite(item)) {
  ------------------
  |  Branch (362:7): [True: 44.3k, False: 2.26k]
  ------------------
  363|  44.3k|    return written;
  364|  44.3k|  } else {
  365|  2.26k|    CBOR_ASSERT(cbor_map_is_indefinite(item));
  ------------------
  |  |   64|  2.26k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (365:5): [True: 0, False: 2.26k]
  |  Branch (365:5): [True: 2.26k, False: 0]
  ------------------
  366|  2.26k|    size_t break_written =
  367|  2.26k|        cbor_encode_break(buffer + written, buffer_size - written);
  368|  2.26k|    if (break_written == 0) return 0;
  ------------------
  |  Branch (368:9): [True: 0, False: 2.26k]
  ------------------
  369|  2.26k|    return written + break_written;
  370|  2.26k|  }
  371|  46.6k|}
cbor_serialize_tag:
  374|   249k|                          size_t buffer_size) {
  375|   249k|  CBOR_ASSERT(cbor_isa_tag(item));
  ------------------
  |  |   64|   249k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (375:3): [True: 0, False: 249k]
  |  Branch (375:3): [True: 249k, False: 0]
  ------------------
  376|   249k|  size_t written = cbor_encode_tag(cbor_tag_value(item), buffer, buffer_size);
  377|   249k|  if (written == 0) return 0;
  ------------------
  |  Branch (377:7): [True: 0, False: 249k]
  ------------------
  378|       |
  379|   249k|  cbor_item_t* tagged = cbor_tag_item(item);
  380|   249k|  if (tagged == NULL) return 0;
  ------------------
  |  Branch (380:7): [True: 0, False: 249k]
  ------------------
  381|   249k|  size_t item_written = cbor_serialize(cbor_move(tagged), buffer + written,
  382|   249k|                                       buffer_size - written);
  383|   249k|  if (item_written == 0) return 0;
  ------------------
  |  Branch (383:7): [True: 0, False: 249k]
  ------------------
  384|   249k|  return written + item_written;
  385|   249k|}
cbor_serialize_float_ctrl:
  388|   329k|                                 size_t buffer_size) {
  389|   329k|  CBOR_ASSERT(cbor_isa_float_ctrl(item));
  ------------------
  |  |   64|   329k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (389:3): [True: 0, False: 329k]
  |  Branch (389:3): [True: 329k, False: 0]
  ------------------
  390|   329k|  CBOR_ASSERT(cbor_float_get_width(item) >= CBOR_FLOAT_0 &&
  ------------------
  |  |   64|   329k|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (390:3): [True: 329k, False: 0]
  |  Branch (390:3): [True: 329k, False: 0]
  |  Branch (390:3): [True: 0, False: 329k]
  ------------------
  391|   329k|              cbor_float_get_width(item) <= CBOR_FLOAT_64);
  392|       |  // cppcheck-suppress missingReturn
  393|   329k|  switch (cbor_float_get_width(item)) {
  394|   222k|    case CBOR_FLOAT_0:
  ------------------
  |  Branch (394:5): [True: 222k, False: 106k]
  ------------------
  395|       |      /* CTRL - special treatment */
  396|   222k|      return cbor_encode_ctrl(cbor_ctrl_value(item), buffer, buffer_size);
  397|  85.8k|    case CBOR_FLOAT_16:
  ------------------
  |  Branch (397:5): [True: 85.8k, False: 243k]
  ------------------
  398|  85.8k|      return cbor_encode_half(cbor_float_get_float2(item), buffer, buffer_size);
  399|  12.1k|    case CBOR_FLOAT_32:
  ------------------
  |  Branch (399:5): [True: 12.1k, False: 317k]
  ------------------
  400|  12.1k|      return cbor_encode_single(cbor_float_get_float4(item), buffer,
  401|  12.1k|                                buffer_size);
  402|  8.36k|    case CBOR_FLOAT_64:
  ------------------
  |  Branch (402:5): [True: 8.36k, False: 321k]
  ------------------
  403|  8.36k|      return cbor_encode_double(cbor_float_get_float8(item), buffer,
  404|  8.36k|                                buffer_size);
  405|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (405:5): [True: 0, False: 329k]
  ------------------
  406|      0|      _CBOR_UNREACHABLE;
  ------------------
  |  |  111|      0|#define _CBOR_UNREACHABLE __builtin_unreachable()
  ------------------
  407|      0|      return 0;  // LCOV_EXCL_STOP
  408|   329k|  }
  409|   329k|}

cbor_stream_decode:
   51|  41.5M|    const struct cbor_callbacks* callbacks, void* context) {
   52|       |  // Attempt to claim the initial MTB byte
   53|  41.5M|  struct cbor_decoder_result result = {.status = CBOR_DECODER_FINISHED};
   54|  41.5M|  if (!claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (54:7): [True: 0, False: 41.5M]
  ------------------
   55|      0|    return result;
   56|      0|  }
   57|       |
   58|  41.5M|  switch (*source) {
   59|  15.7M|    case 0x00: /* Fallthrough */
  ------------------
  |  Branch (59:5): [True: 15.7M, False: 25.8M]
  ------------------
   60|  15.7M|    case 0x01: /* Fallthrough */
  ------------------
  |  Branch (60:5): [True: 32.1k, False: 41.5M]
  ------------------
   61|  15.7M|    case 0x02: /* Fallthrough */
  ------------------
  |  Branch (61:5): [True: 29.2k, False: 41.5M]
  ------------------
   62|  15.7M|    case 0x03: /* Fallthrough */
  ------------------
  |  Branch (62:5): [True: 10.3k, False: 41.5M]
  ------------------
   63|  15.7M|    case 0x04: /* Fallthrough */
  ------------------
  |  Branch (63:5): [True: 10.9k, False: 41.5M]
  ------------------
   64|  15.8M|    case 0x05: /* Fallthrough */
  ------------------
  |  Branch (64:5): [True: 66.6k, False: 41.4M]
  ------------------
   65|  15.8M|    case 0x06: /* Fallthrough */
  ------------------
  |  Branch (65:5): [True: 19.4k, False: 41.5M]
  ------------------
   66|  15.9M|    case 0x07: /* Fallthrough */
  ------------------
  |  Branch (66:5): [True: 37.8k, False: 41.4M]
  ------------------
   67|  15.9M|    case 0x08: /* Fallthrough */
  ------------------
  |  Branch (67:5): [True: 22.9k, False: 41.5M]
  ------------------
   68|  15.9M|    case 0x09: /* Fallthrough */
  ------------------
  |  Branch (68:5): [True: 28.4k, False: 41.5M]
  ------------------
   69|  16.0M|    case 0x0A: /* Fallthrough */
  ------------------
  |  Branch (69:5): [True: 35.9k, False: 41.4M]
  ------------------
   70|  16.0M|    case 0x0B: /* Fallthrough */
  ------------------
  |  Branch (70:5): [True: 1.08k, False: 41.5M]
  ------------------
   71|  16.0M|    case 0x0C: /* Fallthrough */
  ------------------
  |  Branch (71:5): [True: 23.3k, False: 41.5M]
  ------------------
   72|  16.2M|    case 0x0D: /* Fallthrough */
  ------------------
  |  Branch (72:5): [True: 185k, False: 41.3M]
  ------------------
   73|  16.2M|    case 0x0E: /* Fallthrough */
  ------------------
  |  Branch (73:5): [True: 8.85k, False: 41.5M]
  ------------------
   74|  16.2M|    case 0x0F: /* Fallthrough */
  ------------------
  |  Branch (74:5): [True: 8.24k, False: 41.5M]
  ------------------
   75|  16.4M|    case 0x10: /* Fallthrough */
  ------------------
  |  Branch (75:5): [True: 205k, False: 41.3M]
  ------------------
   76|  16.4M|    case 0x11: /* Fallthrough */
  ------------------
  |  Branch (76:5): [True: 58.6k, False: 41.4M]
  ------------------
   77|  16.5M|    case 0x12: /* Fallthrough */
  ------------------
  |  Branch (77:5): [True: 31.4k, False: 41.5M]
  ------------------
   78|  16.5M|    case 0x13: /* Fallthrough */
  ------------------
  |  Branch (78:5): [True: 18.2k, False: 41.5M]
  ------------------
   79|  16.5M|    case 0x14: /* Fallthrough */
  ------------------
  |  Branch (79:5): [True: 38.3k, False: 41.4M]
  ------------------
   80|  16.7M|    case 0x15: /* Fallthrough */
  ------------------
  |  Branch (80:5): [True: 194k, False: 41.3M]
  ------------------
   81|  16.8M|    case 0x16: /* Fallthrough */
  ------------------
  |  Branch (81:5): [True: 34.1k, False: 41.4M]
  ------------------
   82|  16.8M|    case 0x17:
  ------------------
  |  Branch (82:5): [True: 15.3k, False: 41.5M]
  ------------------
   83|       |      /* Embedded one byte unsigned integer */
   84|  16.8M|      {
   85|  16.8M|        callbacks->uint8(context, _cbor_load_uint8(source));
   86|  16.8M|        return result;
   87|  16.8M|      }
   88|  22.9k|    case 0x18:
  ------------------
  |  Branch (88:5): [True: 22.9k, False: 41.5M]
  ------------------
   89|       |      /* One byte unsigned integer */
   90|  22.9k|      {
   91|  22.9k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (91:13): [True: 22.9k, False: 1]
  ------------------
   92|  22.9k|          callbacks->uint8(context, _cbor_load_uint8(source + 1));
   93|  22.9k|        }
   94|  22.9k|        return result;
   95|  16.8M|      }
   96|  9.05k|    case 0x19:
  ------------------
  |  Branch (96:5): [True: 9.05k, False: 41.5M]
  ------------------
   97|       |      /* Two bytes unsigned integer */
   98|  9.05k|      {
   99|  9.05k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (99:13): [True: 9.05k, False: 2]
  ------------------
  100|  9.05k|          callbacks->uint16(context, _cbor_load_uint16(source + 1));
  101|  9.05k|        }
  102|  9.05k|        return result;
  103|  16.8M|      }
  104|   621k|    case 0x1A:
  ------------------
  |  Branch (104:5): [True: 621k, False: 40.9M]
  ------------------
  105|       |      /* Four bytes unsigned integer */
  106|   621k|      {
  107|   621k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (107:13): [True: 621k, False: 4]
  ------------------
  108|   621k|          callbacks->uint32(context, _cbor_load_uint32(source + 1));
  109|   621k|        }
  110|   621k|        return result;
  111|  16.8M|      }
  112|  10.2k|    case 0x1B:
  ------------------
  |  Branch (112:5): [True: 10.2k, False: 41.5M]
  ------------------
  113|       |      /* Eight bytes unsigned integer */
  114|  10.2k|      {
  115|  10.2k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (115:13): [True: 10.2k, False: 3]
  ------------------
  116|  10.2k|          callbacks->uint64(context, _cbor_load_uint64(source + 1));
  117|  10.2k|        }
  118|  10.2k|        return result;
  119|  16.8M|      }
  120|      3|    case 0x1C: /* Fallthrough */
  ------------------
  |  Branch (120:5): [True: 3, False: 41.5M]
  ------------------
  121|      4|    case 0x1D: /* Fallthrough */
  ------------------
  |  Branch (121:5): [True: 1, False: 41.5M]
  ------------------
  122|      5|    case 0x1E: /* Fallthrough */
  ------------------
  |  Branch (122:5): [True: 1, False: 41.5M]
  ------------------
  123|      8|    case 0x1F:
  ------------------
  |  Branch (123:5): [True: 3, False: 41.5M]
  ------------------
  124|       |      /* Reserved */
  125|      8|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  126|  7.68k|    case 0x20: /* Fallthrough */
  ------------------
  |  Branch (126:5): [True: 7.68k, False: 41.5M]
  ------------------
  127|  10.4k|    case 0x21: /* Fallthrough */
  ------------------
  |  Branch (127:5): [True: 2.74k, False: 41.5M]
  ------------------
  128|  12.0k|    case 0x22: /* Fallthrough */
  ------------------
  |  Branch (128:5): [True: 1.57k, False: 41.5M]
  ------------------
  129|  17.8k|    case 0x23: /* Fallthrough */
  ------------------
  |  Branch (129:5): [True: 5.84k, False: 41.5M]
  ------------------
  130|  31.9k|    case 0x24: /* Fallthrough */
  ------------------
  |  Branch (130:5): [True: 14.1k, False: 41.5M]
  ------------------
  131|   220k|    case 0x25: /* Fallthrough */
  ------------------
  |  Branch (131:5): [True: 188k, False: 41.3M]
  ------------------
  132|   511k|    case 0x26: /* Fallthrough */
  ------------------
  |  Branch (132:5): [True: 290k, False: 41.2M]
  ------------------
  133|   513k|    case 0x27: /* Fallthrough */
  ------------------
  |  Branch (133:5): [True: 1.93k, False: 41.5M]
  ------------------
  134|  1.40M|    case 0x28: /* Fallthrough */
  ------------------
  |  Branch (134:5): [True: 891k, False: 40.6M]
  ------------------
  135|  1.41M|    case 0x29: /* Fallthrough */
  ------------------
  |  Branch (135:5): [True: 7.60k, False: 41.5M]
  ------------------
  136|  1.41M|    case 0x2A: /* Fallthrough */
  ------------------
  |  Branch (136:5): [True: 1.33k, False: 41.5M]
  ------------------
  137|  1.54M|    case 0x2B: /* Fallthrough */
  ------------------
  |  Branch (137:5): [True: 134k, False: 41.3M]
  ------------------
  138|  1.63M|    case 0x2C: /* Fallthrough */
  ------------------
  |  Branch (138:5): [True: 89.5k, False: 41.4M]
  ------------------
  139|  1.64M|    case 0x2D: /* Fallthrough */
  ------------------
  |  Branch (139:5): [True: 11.8k, False: 41.5M]
  ------------------
  140|  1.70M|    case 0x2E: /* Fallthrough */
  ------------------
  |  Branch (140:5): [True: 59.4k, False: 41.4M]
  ------------------
  141|  1.71M|    case 0x2F: /* Fallthrough */
  ------------------
  |  Branch (141:5): [True: 4.61k, False: 41.5M]
  ------------------
  142|  1.89M|    case 0x30: /* Fallthrough */
  ------------------
  |  Branch (142:5): [True: 178k, False: 41.3M]
  ------------------
  143|  1.93M|    case 0x31: /* Fallthrough */
  ------------------
  |  Branch (143:5): [True: 38.4k, False: 41.4M]
  ------------------
  144|  2.00M|    case 0x32: /* Fallthrough */
  ------------------
  |  Branch (144:5): [True: 70.5k, False: 41.4M]
  ------------------
  145|  2.03M|    case 0x33: /* Fallthrough */
  ------------------
  |  Branch (145:5): [True: 34.0k, False: 41.4M]
  ------------------
  146|  2.04M|    case 0x34: /* Fallthrough */
  ------------------
  |  Branch (146:5): [True: 12.6k, False: 41.5M]
  ------------------
  147|  2.15M|    case 0x35: /* Fallthrough */
  ------------------
  |  Branch (147:5): [True: 107k, False: 41.4M]
  ------------------
  148|  2.25M|    case 0x36: /* Fallthrough */
  ------------------
  |  Branch (148:5): [True: 97.2k, False: 41.4M]
  ------------------
  149|  2.31M|    case 0x37:
  ------------------
  |  Branch (149:5): [True: 67.2k, False: 41.4M]
  ------------------
  150|       |      /* Embedded one byte negative integer */
  151|  2.31M|      {
  152|  2.31M|        callbacks->negint8(context,
  153|  2.31M|                           _cbor_load_uint8(source) - 0x20); /* 0x20 offset */
  154|  2.31M|        return result;
  155|  2.25M|      }
  156|  26.5k|    case 0x38:
  ------------------
  |  Branch (156:5): [True: 26.5k, False: 41.5M]
  ------------------
  157|       |      /* One byte negative integer */
  158|  26.5k|      {
  159|  26.5k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (159:13): [True: 26.5k, False: 4]
  ------------------
  160|  26.5k|          callbacks->negint8(context, _cbor_load_uint8(source + 1));
  161|  26.5k|        }
  162|  26.5k|        return result;
  163|  2.25M|      }
  164|  34.5k|    case 0x39:
  ------------------
  |  Branch (164:5): [True: 34.5k, False: 41.4M]
  ------------------
  165|       |      /* Two bytes negative integer */
  166|  34.5k|      {
  167|  34.5k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (167:13): [True: 34.5k, False: 7]
  ------------------
  168|  34.5k|          callbacks->negint16(context, _cbor_load_uint16(source + 1));
  169|  34.5k|        }
  170|  34.5k|        return result;
  171|  2.25M|      }
  172|  14.9k|    case 0x3A:
  ------------------
  |  Branch (172:5): [True: 14.9k, False: 41.5M]
  ------------------
  173|       |      /* Four bytes negative integer */
  174|  14.9k|      {
  175|  14.9k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (175:13): [True: 14.9k, False: 3]
  ------------------
  176|  14.9k|          callbacks->negint32(context, _cbor_load_uint32(source + 1));
  177|  14.9k|        }
  178|  14.9k|        return result;
  179|  2.25M|      }
  180|  3.68k|    case 0x3B:
  ------------------
  |  Branch (180:5): [True: 3.68k, False: 41.5M]
  ------------------
  181|       |      /* Eight bytes negative integer */
  182|  3.68k|      {
  183|  3.68k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (183:13): [True: 3.68k, False: 3]
  ------------------
  184|  3.68k|          callbacks->negint64(context, _cbor_load_uint64(source + 1));
  185|  3.68k|        }
  186|  3.68k|        return result;
  187|  2.25M|      }
  188|      3|    case 0x3C: /* Fallthrough */
  ------------------
  |  Branch (188:5): [True: 3, False: 41.5M]
  ------------------
  189|      7|    case 0x3D: /* Fallthrough */
  ------------------
  |  Branch (189:5): [True: 4, False: 41.5M]
  ------------------
  190|      8|    case 0x3E: /* Fallthrough */
  ------------------
  |  Branch (190:5): [True: 1, False: 41.5M]
  ------------------
  191|      9|    case 0x3F:
  ------------------
  |  Branch (191:5): [True: 1, False: 41.5M]
  ------------------
  192|       |      /* Reserved */
  193|      9|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  194|      4|    case 0x40: /* Fallthrough */
  ------------------
  |  Branch (194:5): [True: 4, False: 41.5M]
  ------------------
  195|  1.29M|    case 0x41: /* Fallthrough */
  ------------------
  |  Branch (195:5): [True: 1.29M, False: 40.2M]
  ------------------
  196|  1.29M|    case 0x42: /* Fallthrough */
  ------------------
  |  Branch (196:5): [True: 1.30k, False: 41.5M]
  ------------------
  197|  1.29M|    case 0x43: /* Fallthrough */
  ------------------
  |  Branch (197:5): [True: 637, False: 41.5M]
  ------------------
  198|  1.31M|    case 0x44: /* Fallthrough */
  ------------------
  |  Branch (198:5): [True: 18.9k, False: 41.5M]
  ------------------
  199|  1.31M|    case 0x45: /* Fallthrough */
  ------------------
  |  Branch (199:5): [True: 761, False: 41.5M]
  ------------------
  200|  1.31M|    case 0x46: /* Fallthrough */
  ------------------
  |  Branch (200:5): [True: 4.70k, False: 41.5M]
  ------------------
  201|  1.32M|    case 0x47: /* Fallthrough */
  ------------------
  |  Branch (201:5): [True: 1.14k, False: 41.5M]
  ------------------
  202|  1.32M|    case 0x48: /* Fallthrough */
  ------------------
  |  Branch (202:5): [True: 1.15k, False: 41.5M]
  ------------------
  203|  1.32M|    case 0x49: /* Fallthrough */
  ------------------
  |  Branch (203:5): [True: 2.39k, False: 41.5M]
  ------------------
  204|  1.32M|    case 0x4A: /* Fallthrough */
  ------------------
  |  Branch (204:5): [True: 696, False: 41.5M]
  ------------------
  205|  1.32M|    case 0x4B: /* Fallthrough */
  ------------------
  |  Branch (205:5): [True: 791, False: 41.5M]
  ------------------
  206|  1.32M|    case 0x4C: /* Fallthrough */
  ------------------
  |  Branch (206:5): [True: 383, False: 41.5M]
  ------------------
  207|  1.33M|    case 0x4D: /* Fallthrough */
  ------------------
  |  Branch (207:5): [True: 4.77k, False: 41.5M]
  ------------------
  208|  1.33M|    case 0x4E: /* Fallthrough */
  ------------------
  |  Branch (208:5): [True: 849, False: 41.5M]
  ------------------
  209|  1.33M|    case 0x4F: /* Fallthrough */
  ------------------
  |  Branch (209:5): [True: 967, False: 41.5M]
  ------------------
  210|  1.33M|    case 0x50: /* Fallthrough */
  ------------------
  |  Branch (210:5): [True: 799, False: 41.5M]
  ------------------
  211|  1.33M|    case 0x51: /* Fallthrough */
  ------------------
  |  Branch (211:5): [True: 2.98k, False: 41.5M]
  ------------------
  212|  1.33M|    case 0x52: /* Fallthrough */
  ------------------
  |  Branch (212:5): [True: 381, False: 41.5M]
  ------------------
  213|  1.33M|    case 0x53: /* Fallthrough */
  ------------------
  |  Branch (213:5): [True: 287, False: 41.5M]
  ------------------
  214|  1.34M|    case 0x54: /* Fallthrough */
  ------------------
  |  Branch (214:5): [True: 5.19k, False: 41.5M]
  ------------------
  215|  1.34M|    case 0x55: /* Fallthrough */
  ------------------
  |  Branch (215:5): [True: 1.05k, False: 41.5M]
  ------------------
  216|  1.34M|    case 0x56: /* Fallthrough */
  ------------------
  |  Branch (216:5): [True: 320, False: 41.5M]
  ------------------
  217|  1.34M|    case 0x57:
  ------------------
  |  Branch (217:5): [True: 221, False: 41.5M]
  ------------------
  218|       |      /* Embedded length byte string */
  219|  1.34M|      {
  220|  1.34M|        uint64_t length = _cbor_load_uint8(source) - 0x40; /* 0x40 offset */
  221|  1.34M|        CLAIM_BYTES_AND_INVOKE(byte_string, length, 0);
  ------------------
  |  |   33|  1.34M|  do {                                                                     \
  |  |   34|  1.34M|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (34:9): [True: 1.34M, False: 198]
  |  |  ------------------
  |  |   35|  1.34M|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   36|  1.34M|                               length);                                    \
  |  |   37|  1.34M|    }                                                                      \
  |  |   38|  1.34M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (38:12): [Folded, False: 1.34M]
  |  |  ------------------
  ------------------
  222|  1.34M|        return result;
  223|  1.34M|      }
  224|  1.43k|    case 0x58:
  ------------------
  |  Branch (224:5): [True: 1.43k, False: 41.5M]
  ------------------
  225|       |      /* One byte length byte string */
  226|  1.43k|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint8, 1);
  ------------------
  |  |   41|  1.43k|  do {                                                                \
  |  |   42|  1.43k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 1.43k, False: 3]
  |  |  ------------------
  |  |   43|  1.43k|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|  1.43k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|  1.43k|  do {                                                                     \
  |  |  |  |   34|  1.43k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 1.43k, False: 5]
  |  |  |  |  ------------------
  |  |  |  |   35|  1.43k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|  1.43k|                               length);                                    \
  |  |  |  |   37|  1.43k|    }                                                                      \
  |  |  |  |   38|  1.43k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 1.43k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|  1.43k|    }                                                                 \
  |  |   46|  1.43k|    return result;                                                    \
  |  |   47|  1.43k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  227|    259|    case 0x59:
  ------------------
  |  Branch (227:5): [True: 259, False: 41.5M]
  ------------------
  228|       |      /* Two bytes length byte string */
  229|    259|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint16, 2);
  ------------------
  |  |   41|    259|  do {                                                                \
  |  |   42|    259|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 256, False: 3]
  |  |  ------------------
  |  |   43|    256|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    256|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    256|  do {                                                                     \
  |  |  |  |   34|    256|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 243, False: 13]
  |  |  |  |  ------------------
  |  |  |  |   35|    243|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    243|                               length);                                    \
  |  |  |  |   37|    243|    }                                                                      \
  |  |  |  |   38|    256|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 256]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    256|    }                                                                 \
  |  |   46|    259|    return result;                                                    \
  |  |   47|    259|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  230|    209|    case 0x5A:
  ------------------
  |  Branch (230:5): [True: 209, False: 41.5M]
  ------------------
  231|       |      /* Four bytes length byte string */
  232|    209|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint32, 4);
  ------------------
  |  |   41|    209|  do {                                                                \
  |  |   42|    209|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 208, False: 1]
  |  |  ------------------
  |  |   43|    208|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    208|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    208|  do {                                                                     \
  |  |  |  |   34|    208|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 198, False: 10]
  |  |  |  |  ------------------
  |  |  |  |   35|    198|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    198|                               length);                                    \
  |  |  |  |   37|    198|    }                                                                      \
  |  |  |  |   38|    208|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 208]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    208|    }                                                                 \
  |  |   46|    209|    return result;                                                    \
  |  |   47|    209|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  233|    254|    case 0x5B:
  ------------------
  |  Branch (233:5): [True: 254, False: 41.5M]
  ------------------
  234|       |      /* Eight bytes length byte string */
  235|    254|      READ_CLAIM_INVOKE(byte_string, _cbor_load_uint64, 8);
  ------------------
  |  |   41|    254|  do {                                                                \
  |  |   42|    254|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 249, False: 5]
  |  |  ------------------
  |  |   43|    249|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    249|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    249|  do {                                                                     \
  |  |  |  |   34|    249|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 214, False: 35]
  |  |  |  |  ------------------
  |  |  |  |   35|    214|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    214|                               length);                                    \
  |  |  |  |   37|    214|    }                                                                      \
  |  |  |  |   38|    249|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 249]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    249|    }                                                                 \
  |  |   46|    254|    return result;                                                    \
  |  |   47|    254|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  236|      2|    case 0x5C: /* Fallthrough */
  ------------------
  |  Branch (236:5): [True: 2, False: 41.5M]
  ------------------
  237|      3|    case 0x5D: /* Fallthrough */
  ------------------
  |  Branch (237:5): [True: 1, False: 41.5M]
  ------------------
  238|      4|    case 0x5E:
  ------------------
  |  Branch (238:5): [True: 1, False: 41.5M]
  ------------------
  239|       |      /* Reserved */
  240|      4|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  241|  3.86k|    case 0x5F:
  ------------------
  |  Branch (241:5): [True: 3.86k, False: 41.5M]
  ------------------
  242|       |      /* Indefinite byte string */
  243|  3.86k|      {
  244|  3.86k|        callbacks->byte_string_start(context);
  245|  3.86k|        return result;
  246|      3|      }
  247|     17|    case 0x60: /* Fallthrough */
  ------------------
  |  Branch (247:5): [True: 17, False: 41.5M]
  ------------------
  248|  2.22M|    case 0x61: /* Fallthrough */
  ------------------
  |  Branch (248:5): [True: 2.22M, False: 39.3M]
  ------------------
  249|  2.22M|    case 0x62: /* Fallthrough */
  ------------------
  |  Branch (249:5): [True: 368, False: 41.5M]
  ------------------
  250|  2.23M|    case 0x63: /* Fallthrough */
  ------------------
  |  Branch (250:5): [True: 9.64k, False: 41.5M]
  ------------------
  251|  2.23M|    case 0x64: /* Fallthrough */
  ------------------
  |  Branch (251:5): [True: 922, False: 41.5M]
  ------------------
  252|  2.23M|    case 0x65: /* Fallthrough */
  ------------------
  |  Branch (252:5): [True: 239, False: 41.5M]
  ------------------
  253|  2.23M|    case 0x66: /* Fallthrough */
  ------------------
  |  Branch (253:5): [True: 507, False: 41.5M]
  ------------------
  254|  2.23M|    case 0x67: /* Fallthrough */
  ------------------
  |  Branch (254:5): [True: 682, False: 41.5M]
  ------------------
  255|  2.23M|    case 0x68: /* Fallthrough */
  ------------------
  |  Branch (255:5): [True: 503, False: 41.5M]
  ------------------
  256|  2.24M|    case 0x69: /* Fallthrough */
  ------------------
  |  Branch (256:5): [True: 1.38k, False: 41.5M]
  ------------------
  257|  2.24M|    case 0x6A: /* Fallthrough */
  ------------------
  |  Branch (257:5): [True: 2.32k, False: 41.5M]
  ------------------
  258|  2.24M|    case 0x6B: /* Fallthrough */
  ------------------
  |  Branch (258:5): [True: 1.07k, False: 41.5M]
  ------------------
  259|  2.24M|    case 0x6C: /* Fallthrough */
  ------------------
  |  Branch (259:5): [True: 1.17k, False: 41.5M]
  ------------------
  260|  2.24M|    case 0x6D: /* Fallthrough */
  ------------------
  |  Branch (260:5): [True: 331, False: 41.5M]
  ------------------
  261|  2.24M|    case 0x6E: /* Fallthrough */
  ------------------
  |  Branch (261:5): [True: 434, False: 41.5M]
  ------------------
  262|  2.24M|    case 0x6F: /* Fallthrough */
  ------------------
  |  Branch (262:5): [True: 252, False: 41.5M]
  ------------------
  263|  2.24M|    case 0x70: /* Fallthrough */
  ------------------
  |  Branch (263:5): [True: 2.50k, False: 41.5M]
  ------------------
  264|  2.25M|    case 0x71: /* Fallthrough */
  ------------------
  |  Branch (264:5): [True: 1.63k, False: 41.5M]
  ------------------
  265|  2.25M|    case 0x72: /* Fallthrough */
  ------------------
  |  Branch (265:5): [True: 421, False: 41.5M]
  ------------------
  266|  2.25M|    case 0x73: /* Fallthrough */
  ------------------
  |  Branch (266:5): [True: 611, False: 41.5M]
  ------------------
  267|  2.28M|    case 0x74: /* Fallthrough */
  ------------------
  |  Branch (267:5): [True: 31.4k, False: 41.5M]
  ------------------
  268|  2.28M|    case 0x75: /* Fallthrough */
  ------------------
  |  Branch (268:5): [True: 2.51k, False: 41.5M]
  ------------------
  269|  2.28M|    case 0x76: /* Fallthrough */
  ------------------
  |  Branch (269:5): [True: 895, False: 41.5M]
  ------------------
  270|  2.28M|    case 0x77:
  ------------------
  |  Branch (270:5): [True: 360, False: 41.5M]
  ------------------
  271|       |      /* Embedded one byte length string */
  272|  2.28M|      {
  273|  2.28M|        uint64_t length = _cbor_load_uint8(source) - 0x60; /* 0x60 offset */
  274|  2.28M|        CLAIM_BYTES_AND_INVOKE(string, length, 0);
  ------------------
  |  |   33|  2.28M|  do {                                                                     \
  |  |   34|  2.28M|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  ------------------
  |  |  |  Branch (34:9): [True: 2.28M, False: 211]
  |  |  ------------------
  |  |   35|  2.28M|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |   36|  2.28M|                               length);                                    \
  |  |   37|  2.28M|    }                                                                      \
  |  |   38|  2.28M|  } while (0)
  |  |  ------------------
  |  |  |  Branch (38:12): [Folded, False: 2.28M]
  |  |  ------------------
  ------------------
  275|  2.28M|        return result;
  276|  2.28M|      }
  277|  13.7k|    case 0x78:
  ------------------
  |  Branch (277:5): [True: 13.7k, False: 41.5M]
  ------------------
  278|       |      /* One byte length string */
  279|  13.7k|      READ_CLAIM_INVOKE(string, _cbor_load_uint8, 1);
  ------------------
  |  |   41|  13.7k|  do {                                                                \
  |  |   42|  13.7k|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 13.7k, False: 1]
  |  |  ------------------
  |  |   43|  13.7k|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|  13.7k|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|  13.7k|  do {                                                                     \
  |  |  |  |   34|  13.7k|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 13.7k, False: 2]
  |  |  |  |  ------------------
  |  |  |  |   35|  13.7k|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|  13.7k|                               length);                                    \
  |  |  |  |   37|  13.7k|    }                                                                      \
  |  |  |  |   38|  13.7k|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 13.7k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|  13.7k|    }                                                                 \
  |  |   46|  13.7k|    return result;                                                    \
  |  |   47|  13.7k|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  280|    512|    case 0x79:
  ------------------
  |  Branch (280:5): [True: 512, False: 41.5M]
  ------------------
  281|       |      /* Two bytes length string */
  282|    512|      READ_CLAIM_INVOKE(string, _cbor_load_uint16, 2);
  ------------------
  |  |   41|    512|  do {                                                                \
  |  |   42|    512|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 509, False: 3]
  |  |  ------------------
  |  |   43|    509|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    509|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    509|  do {                                                                     \
  |  |  |  |   34|    509|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 494, False: 15]
  |  |  |  |  ------------------
  |  |  |  |   35|    494|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    494|                               length);                                    \
  |  |  |  |   37|    494|    }                                                                      \
  |  |  |  |   38|    509|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 509]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    509|    }                                                                 \
  |  |   46|    512|    return result;                                                    \
  |  |   47|    512|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  283|    328|    case 0x7A:
  ------------------
  |  Branch (283:5): [True: 328, False: 41.5M]
  ------------------
  284|       |      /* Four bytes length string */
  285|    328|      READ_CLAIM_INVOKE(string, _cbor_load_uint32, 4);
  ------------------
  |  |   41|    328|  do {                                                                \
  |  |   42|    328|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 326, False: 2]
  |  |  ------------------
  |  |   43|    326|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    326|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    326|  do {                                                                     \
  |  |  |  |   34|    326|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 300, False: 26]
  |  |  |  |  ------------------
  |  |  |  |   35|    300|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    300|                               length);                                    \
  |  |  |  |   37|    300|    }                                                                      \
  |  |  |  |   38|    326|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 326]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    326|    }                                                                 \
  |  |   46|    328|    return result;                                                    \
  |  |   47|    328|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  286|    500|    case 0x7B:
  ------------------
  |  Branch (286:5): [True: 500, False: 41.5M]
  ------------------
  287|       |      /* Eight bytes length string */
  288|    500|      READ_CLAIM_INVOKE(string, _cbor_load_uint64, 8);
  ------------------
  |  |   41|    500|  do {                                                                \
  |  |   42|    500|    if (claim_bytes(length_bytes, source_size, &result)) {            \
  |  |  ------------------
  |  |  |  Branch (42:9): [True: 497, False: 3]
  |  |  ------------------
  |  |   43|    497|      uint64_t length = length_reader(source + 1);                    \
  |  |   44|    497|      CLAIM_BYTES_AND_INVOKE(callback_name, length, length_bytes);    \
  |  |  ------------------
  |  |  |  |   33|    497|  do {                                                                     \
  |  |  |  |   34|    497|    if (claim_bytes(length, source_size, &result)) {                       \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (34:9): [True: 462, False: 35]
  |  |  |  |  ------------------
  |  |  |  |   35|    462|      callbacks->callback_name(context, source + 1 + source_extra_offset,  \
  |  |  |  |   36|    462|                               length);                                    \
  |  |  |  |   37|    462|    }                                                                      \
  |  |  |  |   38|    497|  } while (0)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (38:12): [Folded, False: 497]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |   45|    497|    }                                                                 \
  |  |   46|    500|    return result;                                                    \
  |  |   47|    500|  } while (0)
  |  |  ------------------
  |  |  |  Branch (47:12): [Folded, False: 0]
  |  |  ------------------
  ------------------
  289|      6|    case 0x7C: /* Fallthrough */
  ------------------
  |  Branch (289:5): [True: 6, False: 41.5M]
  ------------------
  290|      8|    case 0x7D: /* Fallthrough */
  ------------------
  |  Branch (290:5): [True: 2, False: 41.5M]
  ------------------
  291|     15|    case 0x7E:
  ------------------
  |  Branch (291:5): [True: 7, False: 41.5M]
  ------------------
  292|       |      /* Reserved */
  293|     15|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  294|  12.8k|    case 0x7F:
  ------------------
  |  Branch (294:5): [True: 12.8k, False: 41.5M]
  ------------------
  295|       |      /* Indefinite length string */
  296|  12.8k|      {
  297|  12.8k|        callbacks->string_start(context);
  298|  12.8k|        return result;
  299|      8|      }
  300|      6|    case 0x80: /* Fallthrough */
  ------------------
  |  Branch (300:5): [True: 6, False: 41.5M]
  ------------------
  301|  12.9M|    case 0x81: /* Fallthrough */
  ------------------
  |  Branch (301:5): [True: 12.9M, False: 28.5M]
  ------------------
  302|  13.0M|    case 0x82: /* Fallthrough */
  ------------------
  |  Branch (302:5): [True: 20.9k, False: 41.5M]
  ------------------
  303|  13.0M|    case 0x83: /* Fallthrough */
  ------------------
  |  Branch (303:5): [True: 10.6k, False: 41.5M]
  ------------------
  304|  13.0M|    case 0x84: /* Fallthrough */
  ------------------
  |  Branch (304:5): [True: 19.8k, False: 41.5M]
  ------------------
  305|  13.0M|    case 0x85: /* Fallthrough */
  ------------------
  |  Branch (305:5): [True: 4.65k, False: 41.5M]
  ------------------
  306|  13.0M|    case 0x86: /* Fallthrough */
  ------------------
  |  Branch (306:5): [True: 643, False: 41.5M]
  ------------------
  307|  13.0M|    case 0x87: /* Fallthrough */
  ------------------
  |  Branch (307:5): [True: 1.22k, False: 41.5M]
  ------------------
  308|  13.0M|    case 0x88: /* Fallthrough */
  ------------------
  |  Branch (308:5): [True: 5.57k, False: 41.5M]
  ------------------
  309|  13.0M|    case 0x89: /* Fallthrough */
  ------------------
  |  Branch (309:5): [True: 1.28k, False: 41.5M]
  ------------------
  310|  13.0M|    case 0x8A: /* Fallthrough */
  ------------------
  |  Branch (310:5): [True: 462, False: 41.5M]
  ------------------
  311|  13.0M|    case 0x8B: /* Fallthrough */
  ------------------
  |  Branch (311:5): [True: 329, False: 41.5M]
  ------------------
  312|  13.0M|    case 0x8C: /* Fallthrough */
  ------------------
  |  Branch (312:5): [True: 5.83k, False: 41.5M]
  ------------------
  313|  13.0M|    case 0x8D: /* Fallthrough */
  ------------------
  |  Branch (313:5): [True: 757, False: 41.5M]
  ------------------
  314|  13.0M|    case 0x8E: /* Fallthrough */
  ------------------
  |  Branch (314:5): [True: 2.55k, False: 41.5M]
  ------------------
  315|  13.0M|    case 0x8F: /* Fallthrough */
  ------------------
  |  Branch (315:5): [True: 562, False: 41.5M]
  ------------------
  316|  13.0M|    case 0x90: /* Fallthrough */
  ------------------
  |  Branch (316:5): [True: 528, False: 41.5M]
  ------------------
  317|  13.0M|    case 0x91: /* Fallthrough */
  ------------------
  |  Branch (317:5): [True: 1.62k, False: 41.5M]
  ------------------
  318|  13.0M|    case 0x92: /* Fallthrough */
  ------------------
  |  Branch (318:5): [True: 882, False: 41.5M]
  ------------------
  319|  13.0M|    case 0x93: /* Fallthrough */
  ------------------
  |  Branch (319:5): [True: 807, False: 41.5M]
  ------------------
  320|  13.0M|    case 0x94: /* Fallthrough */
  ------------------
  |  Branch (320:5): [True: 372, False: 41.5M]
  ------------------
  321|  13.1M|    case 0x95: /* Fallthrough */
  ------------------
  |  Branch (321:5): [True: 29.4k, False: 41.5M]
  ------------------
  322|  13.1M|    case 0x96: /* Fallthrough */
  ------------------
  |  Branch (322:5): [True: 7.69k, False: 41.5M]
  ------------------
  323|  13.1M|    case 0x97:
  ------------------
  |  Branch (323:5): [True: 1.69k, False: 41.5M]
  ------------------
  324|       |      /* Embedded one byte length array */
  325|  13.1M|      {
  326|  13.1M|        callbacks->array_start(
  327|  13.1M|            context, _cbor_load_uint8(source) - 0x80); /* 0x40 offset */
  328|  13.1M|        return result;
  329|  13.1M|      }
  330|    972|    case 0x98:
  ------------------
  |  Branch (330:5): [True: 972, False: 41.5M]
  ------------------
  331|       |      /* One byte length array */
  332|    972|      {
  333|    972|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (333:13): [True: 967, False: 5]
  ------------------
  334|    967|          callbacks->array_start(context, _cbor_load_uint8(source + 1));
  335|    967|        }
  336|    972|        return result;
  337|  13.1M|      }
  338|    334|    case 0x99:
  ------------------
  |  Branch (338:5): [True: 334, False: 41.5M]
  ------------------
  339|       |      /* Two bytes length array */
  340|    334|      {
  341|    334|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (341:13): [True: 331, False: 3]
  ------------------
  342|    331|          callbacks->array_start(context, _cbor_load_uint16(source + 1));
  343|    331|        }
  344|    334|        return result;
  345|  13.1M|      }
  346|    604|    case 0x9A:
  ------------------
  |  Branch (346:5): [True: 604, False: 41.5M]
  ------------------
  347|       |      /* Four bytes length array */
  348|    604|      {
  349|    604|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (349:13): [True: 602, False: 2]
  ------------------
  350|    602|          callbacks->array_start(context, _cbor_load_uint32(source + 1));
  351|    602|        }
  352|    604|        return result;
  353|  13.1M|      }
  354|    296|    case 0x9B:
  ------------------
  |  Branch (354:5): [True: 296, False: 41.5M]
  ------------------
  355|       |      /* Eight bytes length array */
  356|    296|      {
  357|    296|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (357:13): [True: 294, False: 2]
  ------------------
  358|    294|          callbacks->array_start(context, _cbor_load_uint64(source + 1));
  359|    294|        }
  360|    296|        return result;
  361|  13.1M|      }
  362|      2|    case 0x9C: /* Fallthrough */
  ------------------
  |  Branch (362:5): [True: 2, False: 41.5M]
  ------------------
  363|      3|    case 0x9D: /* Fallthrough */
  ------------------
  |  Branch (363:5): [True: 1, False: 41.5M]
  ------------------
  364|      5|    case 0x9E:
  ------------------
  |  Branch (364:5): [True: 2, False: 41.5M]
  ------------------
  365|       |      /* Reserved */
  366|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  367|   536k|    case 0x9F:
  ------------------
  |  Branch (367:5): [True: 536k, False: 40.9M]
  ------------------
  368|       |      /* Indefinite length array */
  369|   536k|      {
  370|   536k|        callbacks->indef_array_start(context);
  371|   536k|        return result;
  372|      3|      }
  373|     14|    case 0xA0: /* Fallthrough */
  ------------------
  |  Branch (373:5): [True: 14, False: 41.5M]
  ------------------
  374|  14.0k|    case 0xA1: /* Fallthrough */
  ------------------
  |  Branch (374:5): [True: 14.0k, False: 41.5M]
  ------------------
  375|  16.8k|    case 0xA2: /* Fallthrough */
  ------------------
  |  Branch (375:5): [True: 2.81k, False: 41.5M]
  ------------------
  376|  17.4k|    case 0xA3: /* Fallthrough */
  ------------------
  |  Branch (376:5): [True: 597, False: 41.5M]
  ------------------
  377|  22.9k|    case 0xA4: /* Fallthrough */
  ------------------
  |  Branch (377:5): [True: 5.50k, False: 41.5M]
  ------------------
  378|  28.3k|    case 0xA5: /* Fallthrough */
  ------------------
  |  Branch (378:5): [True: 5.36k, False: 41.5M]
  ------------------
  379|  29.8k|    case 0xA6: /* Fallthrough */
  ------------------
  |  Branch (379:5): [True: 1.47k, False: 41.5M]
  ------------------
  380|  32.3k|    case 0xA7: /* Fallthrough */
  ------------------
  |  Branch (380:5): [True: 2.53k, False: 41.5M]
  ------------------
  381|  33.1k|    case 0xA8: /* Fallthrough */
  ------------------
  |  Branch (381:5): [True: 837, False: 41.5M]
  ------------------
  382|  33.7k|    case 0xA9: /* Fallthrough */
  ------------------
  |  Branch (382:5): [True: 604, False: 41.5M]
  ------------------
  383|  35.7k|    case 0xAA: /* Fallthrough */
  ------------------
  |  Branch (383:5): [True: 1.94k, False: 41.5M]
  ------------------
  384|  36.1k|    case 0xAB: /* Fallthrough */
  ------------------
  |  Branch (384:5): [True: 427, False: 41.5M]
  ------------------
  385|  36.5k|    case 0xAC: /* Fallthrough */
  ------------------
  |  Branch (385:5): [True: 378, False: 41.5M]
  ------------------
  386|  37.1k|    case 0xAD: /* Fallthrough */
  ------------------
  |  Branch (386:5): [True: 672, False: 41.5M]
  ------------------
  387|  37.8k|    case 0xAE: /* Fallthrough */
  ------------------
  |  Branch (387:5): [True: 620, False: 41.5M]
  ------------------
  388|  38.4k|    case 0xAF: /* Fallthrough */
  ------------------
  |  Branch (388:5): [True: 675, False: 41.5M]
  ------------------
  389|  57.3k|    case 0xB0: /* Fallthrough */
  ------------------
  |  Branch (389:5): [True: 18.8k, False: 41.5M]
  ------------------
  390|  59.0k|    case 0xB1: /* Fallthrough */
  ------------------
  |  Branch (390:5): [True: 1.68k, False: 41.5M]
  ------------------
  391|  61.5k|    case 0xB2: /* Fallthrough */
  ------------------
  |  Branch (391:5): [True: 2.52k, False: 41.5M]
  ------------------
  392|  64.3k|    case 0xB3: /* Fallthrough */
  ------------------
  |  Branch (392:5): [True: 2.84k, False: 41.5M]
  ------------------
  393|  64.7k|    case 0xB4: /* Fallthrough */
  ------------------
  |  Branch (393:5): [True: 317, False: 41.5M]
  ------------------
  394|  66.0k|    case 0xB5: /* Fallthrough */
  ------------------
  |  Branch (394:5): [True: 1.38k, False: 41.5M]
  ------------------
  395|  66.4k|    case 0xB6: /* Fallthrough */
  ------------------
  |  Branch (395:5): [True: 364, False: 41.5M]
  ------------------
  396|  68.1k|    case 0xB7:
  ------------------
  |  Branch (396:5): [True: 1.67k, False: 41.5M]
  ------------------
  397|       |      /* Embedded one byte length map */
  398|  68.1k|      {
  399|  68.1k|        callbacks->map_start(context,
  400|  68.1k|                             _cbor_load_uint8(source) - 0xA0); /* 0xA0 offset */
  401|  68.1k|        return result;
  402|  66.4k|      }
  403|  2.33k|    case 0xB8:
  ------------------
  |  Branch (403:5): [True: 2.33k, False: 41.5M]
  ------------------
  404|       |      /* One byte length map */
  405|  2.33k|      {
  406|  2.33k|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (406:13): [True: 2.32k, False: 4]
  ------------------
  407|  2.32k|          callbacks->map_start(context, _cbor_load_uint8(source + 1));
  408|  2.32k|        }
  409|  2.33k|        return result;
  410|  66.4k|      }
  411|  15.7k|    case 0xB9:
  ------------------
  |  Branch (411:5): [True: 15.7k, False: 41.5M]
  ------------------
  412|       |      /* Two bytes length map */
  413|  15.7k|      {
  414|  15.7k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (414:13): [True: 15.7k, False: 4]
  ------------------
  415|  15.7k|          callbacks->map_start(context, _cbor_load_uint16(source + 1));
  416|  15.7k|        }
  417|  15.7k|        return result;
  418|  66.4k|      }
  419|    452|    case 0xBA:
  ------------------
  |  Branch (419:5): [True: 452, False: 41.5M]
  ------------------
  420|       |      /* Four bytes length map */
  421|    452|      {
  422|    452|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (422:13): [True: 449, False: 3]
  ------------------
  423|    449|          callbacks->map_start(context, _cbor_load_uint32(source + 1));
  424|    449|        }
  425|    452|        return result;
  426|  66.4k|      }
  427|    352|    case 0xBB:
  ------------------
  |  Branch (427:5): [True: 352, False: 41.5M]
  ------------------
  428|       |      /* Eight bytes length map */
  429|    352|      {
  430|    352|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (430:13): [True: 350, False: 2]
  ------------------
  431|    350|          callbacks->map_start(context, _cbor_load_uint64(source + 1));
  432|    350|        }
  433|    352|        return result;
  434|  66.4k|      }
  435|      1|    case 0xBC: /* Fallthrough */
  ------------------
  |  Branch (435:5): [True: 1, False: 41.5M]
  ------------------
  436|      4|    case 0xBD: /* Fallthrough */
  ------------------
  |  Branch (436:5): [True: 3, False: 41.5M]
  ------------------
  437|      6|    case 0xBE:
  ------------------
  |  Branch (437:5): [True: 2, False: 41.5M]
  ------------------
  438|       |      /* Reserved */
  439|      6|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  440|  6.33k|    case 0xBF:
  ------------------
  |  Branch (440:5): [True: 6.33k, False: 41.5M]
  ------------------
  441|       |      /* Indefinite length map */
  442|  6.33k|      {
  443|  6.33k|        callbacks->indef_map_start(context);
  444|  6.33k|        return result;
  445|      4|      }
  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|  37.7k|    case 0xC0: /* Fallthrough */
  ------------------
  |  Branch (455:5): [True: 37.7k, False: 41.4M]
  ------------------
  456|  47.4k|    case 0xC1: /* Fallthrough */
  ------------------
  |  Branch (456:5): [True: 9.74k, False: 41.5M]
  ------------------
  457|  71.6k|    case 0xC2: /* Fallthrough */
  ------------------
  |  Branch (457:5): [True: 24.1k, False: 41.5M]
  ------------------
  458|  83.2k|    case 0xC3: /* Fallthrough */
  ------------------
  |  Branch (458:5): [True: 11.5k, False: 41.5M]
  ------------------
  459|  86.3k|    case 0xC4: /* Fallthrough */
  ------------------
  |  Branch (459:5): [True: 3.09k, False: 41.5M]
  ------------------
  460|   113k|    case 0xC5: /* Fallthrough */
  ------------------
  |  Branch (460:5): [True: 27.4k, False: 41.5M]
  ------------------
  461|   116k|    case 0xC6: /* Fallthrough */
  ------------------
  |  Branch (461:5): [True: 2.98k, False: 41.5M]
  ------------------
  462|   127k|    case 0xC7: /* Fallthrough */
  ------------------
  |  Branch (462:5): [True: 10.4k, False: 41.5M]
  ------------------
  463|   127k|    case 0xC8: /* Fallthrough */
  ------------------
  |  Branch (463:5): [True: 572, False: 41.5M]
  ------------------
  464|   128k|    case 0xC9: /* Fallthrough */
  ------------------
  |  Branch (464:5): [True: 955, False: 41.5M]
  ------------------
  465|   129k|    case 0xCA: /* Fallthrough */
  ------------------
  |  Branch (465:5): [True: 1.14k, False: 41.5M]
  ------------------
  466|   130k|    case 0xCB: /* Fallthrough */
  ------------------
  |  Branch (466:5): [True: 575, False: 41.5M]
  ------------------
  467|   133k|    case 0xCC: /* Fallthrough */
  ------------------
  |  Branch (467:5): [True: 2.99k, False: 41.5M]
  ------------------
  468|   134k|    case 0xCD: /* Fallthrough */
  ------------------
  |  Branch (468:5): [True: 1.36k, False: 41.5M]
  ------------------
  469|   154k|    case 0xCE: /* Fallthrough */
  ------------------
  |  Branch (469:5): [True: 19.8k, False: 41.5M]
  ------------------
  470|   158k|    case 0xCF: /* Fallthrough */
  ------------------
  |  Branch (470:5): [True: 3.79k, False: 41.5M]
  ------------------
  471|   161k|    case 0xD0: /* Fallthrough */
  ------------------
  |  Branch (471:5): [True: 3.06k, False: 41.5M]
  ------------------
  472|   163k|    case 0xD1: /* Fallthrough */
  ------------------
  |  Branch (472:5): [True: 2.22k, False: 41.5M]
  ------------------
  473|   164k|    case 0xD2: /* Fallthrough */
  ------------------
  |  Branch (473:5): [True: 761, False: 41.5M]
  ------------------
  474|   165k|    case 0xD3: /* Fallthrough */
  ------------------
  |  Branch (474:5): [True: 484, False: 41.5M]
  ------------------
  475|   166k|    case 0xD4: /* Fallthrough */
  ------------------
  |  Branch (475:5): [True: 1.25k, False: 41.5M]
  ------------------
  476|   167k|    case 0xD5: /* Fallthrough */
  ------------------
  |  Branch (476:5): [True: 1.25k, False: 41.5M]
  ------------------
  477|   172k|    case 0xD6: /* Fallthrough */
  ------------------
  |  Branch (477:5): [True: 4.79k, False: 41.5M]
  ------------------
  478|   337k|    case 0xD7: /* Fallthrough */
  ------------------
  |  Branch (478:5): [True: 165k, False: 41.3M]
  ------------------
  479|   337k|    {
  480|   337k|      callbacks->tag(context, (uint64_t)(_cbor_load_uint8(source) -
  481|   337k|                                         0xC0)); /* 0xC0 offset */
  482|   337k|      return result;
  483|   172k|    }
  484|  2.86k|    case 0xD8: /* 1B tag */
  ------------------
  |  Branch (484:5): [True: 2.86k, False: 41.5M]
  ------------------
  485|  2.86k|    {
  486|  2.86k|      if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (486:11): [True: 2.86k, False: 2]
  ------------------
  487|  2.86k|        callbacks->tag(context, _cbor_load_uint8(source + 1));
  488|  2.86k|      }
  489|  2.86k|      return result;
  490|   172k|    }
  491|  2.66k|    case 0xD9: /* 2B tag */
  ------------------
  |  Branch (491:5): [True: 2.66k, False: 41.5M]
  ------------------
  492|  2.66k|    {
  493|  2.66k|      if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (493:11): [True: 2.66k, False: 2]
  ------------------
  494|  2.66k|        callbacks->tag(context, _cbor_load_uint16(source + 1));
  495|  2.66k|      }
  496|  2.66k|      return result;
  497|   172k|    }
  498|  8.14k|    case 0xDA: /* 4B tag */
  ------------------
  |  Branch (498:5): [True: 8.14k, False: 41.5M]
  ------------------
  499|  8.14k|    {
  500|  8.14k|      if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (500:11): [True: 8.13k, False: 2]
  ------------------
  501|  8.13k|        callbacks->tag(context, _cbor_load_uint32(source + 1));
  502|  8.13k|      }
  503|  8.14k|      return result;
  504|   172k|    }
  505|  3.26k|    case 0xDB: /* 8B tag */
  ------------------
  |  Branch (505:5): [True: 3.26k, False: 41.5M]
  ------------------
  506|  3.26k|    {
  507|  3.26k|      if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (507:11): [True: 3.25k, False: 2]
  ------------------
  508|  3.25k|        callbacks->tag(context, _cbor_load_uint64(source + 1));
  509|  3.25k|      }
  510|  3.26k|      return result;
  511|   172k|    }
  512|      2|    case 0xDC: /* Fallthrough */
  ------------------
  |  Branch (512:5): [True: 2, False: 41.5M]
  ------------------
  513|      5|    case 0xDD: /* Fallthrough */
  ------------------
  |  Branch (513:5): [True: 3, False: 41.5M]
  ------------------
  514|     11|    case 0xDE: /* Fallthrough */
  ------------------
  |  Branch (514:5): [True: 6, False: 41.5M]
  ------------------
  515|     15|    case 0xDF: /* Reserved */
  ------------------
  |  Branch (515:5): [True: 4, False: 41.5M]
  ------------------
  516|     15|    {
  517|     15|      return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  518|     11|    }
  519|      1|    case 0xE0: /* Fallthrough */
  ------------------
  |  Branch (519:5): [True: 1, False: 41.5M]
  ------------------
  520|      4|    case 0xE1: /* Fallthrough */
  ------------------
  |  Branch (520:5): [True: 3, False: 41.5M]
  ------------------
  521|      8|    case 0xE2: /* Fallthrough */
  ------------------
  |  Branch (521:5): [True: 4, False: 41.5M]
  ------------------
  522|     10|    case 0xE3: /* Fallthrough */
  ------------------
  |  Branch (522:5): [True: 2, False: 41.5M]
  ------------------
  523|     12|    case 0xE4: /* Fallthrough */
  ------------------
  |  Branch (523:5): [True: 2, False: 41.5M]
  ------------------
  524|     14|    case 0xE5: /* Fallthrough */
  ------------------
  |  Branch (524:5): [True: 2, False: 41.5M]
  ------------------
  525|     16|    case 0xE6: /* Fallthrough */
  ------------------
  |  Branch (525:5): [True: 2, False: 41.5M]
  ------------------
  526|     17|    case 0xE7: /* Fallthrough */
  ------------------
  |  Branch (526:5): [True: 1, False: 41.5M]
  ------------------
  527|     19|    case 0xE8: /* Fallthrough */
  ------------------
  |  Branch (527:5): [True: 2, False: 41.5M]
  ------------------
  528|     20|    case 0xE9: /* Fallthrough */
  ------------------
  |  Branch (528:5): [True: 1, False: 41.5M]
  ------------------
  529|     21|    case 0xEA: /* Fallthrough */
  ------------------
  |  Branch (529:5): [True: 1, False: 41.5M]
  ------------------
  530|     23|    case 0xEB: /* Fallthrough */
  ------------------
  |  Branch (530:5): [True: 2, False: 41.5M]
  ------------------
  531|     24|    case 0xEC: /* Fallthrough */
  ------------------
  |  Branch (531:5): [True: 1, False: 41.5M]
  ------------------
  532|     26|    case 0xED: /* Fallthrough */
  ------------------
  |  Branch (532:5): [True: 2, False: 41.5M]
  ------------------
  533|     30|    case 0xEE: /* Fallthrough */
  ------------------
  |  Branch (533:5): [True: 4, False: 41.5M]
  ------------------
  534|     32|    case 0xEF: /* Fallthrough */
  ------------------
  |  Branch (534:5): [True: 2, False: 41.5M]
  ------------------
  535|     33|    case 0xF0: /* Fallthrough */
  ------------------
  |  Branch (535:5): [True: 1, False: 41.5M]
  ------------------
  536|     36|    case 0xF1: /* Fallthrough */
  ------------------
  |  Branch (536:5): [True: 3, False: 41.5M]
  ------------------
  537|     38|    case 0xF2: /* Fallthrough */
  ------------------
  |  Branch (537:5): [True: 2, False: 41.5M]
  ------------------
  538|     45|    case 0xF3:
  ------------------
  |  Branch (538:5): [True: 7, False: 41.5M]
  ------------------
  539|       |      /* Simple value 0..19, unassigned but well-formed */
  540|     45|      {
  541|     45|        callbacks->simple_value(context, (uint8_t)(*source - 0xE0));
  542|     45|        return result;
  543|     38|      }
  544|  78.0k|    case 0xF4:
  ------------------
  |  Branch (544:5): [True: 78.0k, False: 41.4M]
  ------------------
  545|       |      /* False */
  546|  78.0k|      {
  547|  78.0k|        callbacks->boolean(context, false);
  548|  78.0k|        return result;
  549|     38|      }
  550|  1.73M|    case 0xF5:
  ------------------
  |  Branch (550:5): [True: 1.73M, False: 39.7M]
  ------------------
  551|       |      /* True */
  552|  1.73M|      {
  553|  1.73M|        callbacks->boolean(context, true);
  554|  1.73M|        return result;
  555|     38|      }
  556|  1.35M|    case 0xF6:
  ------------------
  |  Branch (556:5): [True: 1.35M, False: 40.1M]
  ------------------
  557|       |      /* Null */
  558|  1.35M|      {
  559|  1.35M|        callbacks->null(context);
  560|  1.35M|        return result;
  561|     38|      }
  562|  29.5k|    case 0xF7:
  ------------------
  |  Branch (562:5): [True: 29.5k, False: 41.5M]
  ------------------
  563|       |      /* Undefined */
  564|  29.5k|      {
  565|  29.5k|        callbacks->undefined(context);
  566|  29.5k|        return result;
  567|     38|      }
  568|      4|    case 0xF8:
  ------------------
  |  Branch (568:5): [True: 4, False: 41.5M]
  ------------------
  569|       |      /* 1B simple value */
  570|      4|      {
  571|      4|        if (claim_bytes(1, source_size, &result)) {
  ------------------
  |  Branch (571:13): [True: 1, False: 3]
  ------------------
  572|      1|          uint8_t value = source[1];
  573|      1|          if (value < 32) {
  ------------------
  |  Branch (573:15): [True: 0, False: 1]
  ------------------
  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|      0|            return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR};
  578|      0|          }
  579|      1|          callbacks->simple_value(context, value);
  580|      1|        }
  581|      4|        return result;
  582|      4|      }
  583|  96.3k|    case 0xF9:
  ------------------
  |  Branch (583:5): [True: 96.3k, False: 41.4M]
  ------------------
  584|       |      /* 2B float */
  585|  96.3k|      {
  586|  96.3k|        if (claim_bytes(2, source_size, &result)) {
  ------------------
  |  Branch (586:13): [True: 96.3k, False: 6]
  ------------------
  587|  96.3k|          callbacks->float2(context, _cbor_load_half(source + 1));
  588|  96.3k|        }
  589|  96.3k|        return result;
  590|      4|      }
  591|  13.2k|    case 0xFA:
  ------------------
  |  Branch (591:5): [True: 13.2k, False: 41.5M]
  ------------------
  592|       |      /* 4B float */
  593|  13.2k|      {
  594|  13.2k|        if (claim_bytes(4, source_size, &result)) {
  ------------------
  |  Branch (594:13): [True: 13.2k, False: 1]
  ------------------
  595|  13.2k|          callbacks->float4(context, _cbor_load_float(source + 1));
  596|  13.2k|        }
  597|  13.2k|        return result;
  598|      4|      }
  599|  31.5k|    case 0xFB:
  ------------------
  |  Branch (599:5): [True: 31.5k, False: 41.5M]
  ------------------
  600|       |      /* 8B float */
  601|  31.5k|      {
  602|  31.5k|        if (claim_bytes(8, source_size, &result)) {
  ------------------
  |  Branch (602:13): [True: 31.5k, False: 5]
  ------------------
  603|  31.5k|          callbacks->float8(context, _cbor_load_double(source + 1));
  604|  31.5k|        }
  605|  31.5k|        return result;
  606|      4|      }
  607|      1|    case 0xFC: /* Fallthrough */
  ------------------
  |  Branch (607:5): [True: 1, False: 41.5M]
  ------------------
  608|      2|    case 0xFD: /* Fallthrough */
  ------------------
  |  Branch (608:5): [True: 1, False: 41.5M]
  ------------------
  609|      5|    case 0xFE:
  ------------------
  |  Branch (609:5): [True: 3, False: 41.5M]
  ------------------
  610|       |      /* Reserved */
  611|      5|      { return (struct cbor_decoder_result){.status = CBOR_DECODER_ERROR}; }
  612|   528k|    case 0xFF:
  ------------------
  |  Branch (612:5): [True: 528k, False: 41.0M]
  ------------------
  613|       |      /* Break */
  614|   528k|      callbacks->indef_break(context);
  615|   528k|      return result;
  616|      0|    default:  // LCOV_EXCL_START
  ------------------
  |  Branch (616:5): [True: 0, False: 41.5M]
  ------------------
  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|  41.5M|  }
  621|  41.5M|}
streaming.c:claim_bytes:
   16|  46.1M|                        struct cbor_decoder_result* result) {
   17|       |  // Safe from underflow: read is only incremented on successful claims
   18|  46.1M|  CBOR_ASSERT(result->read <= provided);
  ------------------
  |  |   64|  46.1M|#define CBOR_ASSERT(e) assert(!_cbor_enable_assert || (e))
  ------------------
  |  Branch (18:3): [True: 0, False: 46.1M]
  |  Branch (18:3): [True: 46.1M, False: 0]
  ------------------
   19|  46.1M|  if (required > (provided - result->read)) {
  ------------------
  |  Branch (19:7): [True: 646, False: 46.1M]
  ------------------
   20|    646|    result->required = required + result->read;
   21|    646|    result->read = 0;
   22|    646|    result->status = CBOR_DECODER_NEDATA;
   23|    646|    return false;
   24|  46.1M|  } else {
   25|  46.1M|    result->read += required;
   26|  46.1M|    result->required = 0;
   27|  46.1M|    return true;
   28|  46.1M|  }
   29|  46.1M|}

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

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

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

