cJSON_Delete:
  254|   297k|{
  255|   297k|    cJSON *next = NULL;
  256|  1.03M|    while (item != NULL)
  ------------------
  |  Branch (256:12): [True: 733k, False: 297k]
  ------------------
  257|   733k|    {
  258|   733k|        next = item->next;
  259|   733k|        if (!(item->type & cJSON_IsReference) && (item->child != NULL))
  ------------------
  |  |   99|   733k|#define cJSON_IsReference 256
  ------------------
  |  Branch (259:13): [True: 733k, False: 0]
  |  Branch (259:50): [True: 251k, False: 482k]
  ------------------
  260|   251k|        {
  261|   251k|            cJSON_Delete(item->child);
  262|   251k|        }
  263|   733k|        if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL))
  ------------------
  |  |   99|   733k|#define cJSON_IsReference 256
  ------------------
  |  Branch (263:13): [True: 733k, False: 0]
  |  Branch (263:50): [True: 3.91k, False: 730k]
  ------------------
  264|  3.91k|        {
  265|  3.91k|            global_hooks.deallocate(item->valuestring);
  266|  3.91k|            item->valuestring = NULL;
  267|  3.91k|        }
  268|   733k|        if (!(item->type & cJSON_StringIsConst) && (item->string != NULL))
  ------------------
  |  |  100|   733k|#define cJSON_StringIsConst 512
  ------------------
  |  Branch (268:13): [True: 733k, False: 0]
  |  Branch (268:52): [True: 22.1k, False: 711k]
  ------------------
  269|  22.1k|        {
  270|  22.1k|            global_hooks.deallocate(item->string);
  271|       |            item->string = NULL;
  272|  22.1k|        }
  273|   733k|        global_hooks.deallocate(item);
  274|   733k|        item = next;
  275|   733k|    }
  276|   297k|}
cJSON_ParseWithOpts:
 1132|  2.00k|{
 1133|  2.00k|    size_t buffer_length;
 1134|       |
 1135|  2.00k|    if (NULL == value)
  ------------------
  |  Branch (1135:9): [True: 0, False: 2.00k]
  ------------------
 1136|      0|    {
 1137|      0|        return NULL;
 1138|      0|    }
 1139|       |
 1140|       |    /* Adding null character size due to require_null_terminated. */
 1141|  2.00k|    buffer_length = strlen(value) + sizeof("");
 1142|       |
 1143|  2.00k|    return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated);
 1144|  2.00k|}
cJSON_ParseWithLengthOpts:
 1148|  2.00k|{
 1149|  2.00k|    parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } };
 1150|  2.00k|    cJSON *item = NULL;
 1151|       |
 1152|       |    /* reset error position */
 1153|  2.00k|    global_error.json = NULL;
 1154|  2.00k|    global_error.position = 0;
 1155|       |
 1156|  2.00k|    if (value == NULL || 0 == buffer_length)
  ------------------
  |  Branch (1156:9): [True: 0, False: 2.00k]
  |  Branch (1156:26): [True: 0, False: 2.00k]
  ------------------
 1157|      0|    {
 1158|      0|        goto fail;
 1159|      0|    }
 1160|       |
 1161|  2.00k|    buffer.content = (const unsigned char*)value;
 1162|  2.00k|    buffer.length = buffer_length;
 1163|  2.00k|    buffer.offset = 0;
 1164|  2.00k|    buffer.hooks = global_hooks;
 1165|       |
 1166|  2.00k|    item = cJSON_New_Item(&global_hooks);
 1167|  2.00k|    if (item == NULL) /* memory fail */
  ------------------
  |  Branch (1167:9): [True: 0, False: 2.00k]
  ------------------
 1168|      0|    {
 1169|      0|        goto fail;
 1170|      0|    }
 1171|       |
 1172|  2.00k|    if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer))))
  ------------------
  |  Branch (1172:9): [True: 866, False: 1.13k]
  ------------------
 1173|    866|    {
 1174|       |        /* parse failure. ep is set. */
 1175|    866|        goto fail;
 1176|    866|    }
 1177|       |
 1178|       |    /* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */
 1179|  1.13k|    if (require_null_terminated)
  ------------------
  |  Branch (1179:9): [True: 402, False: 737]
  ------------------
 1180|    402|    {
 1181|    402|        buffer_skip_whitespace(&buffer);
 1182|    402|        if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0')
  ------------------
  |  |  304|    402|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1182:13): [True: 0, False: 402]
  |  Branch (1182:49): [True: 51, False: 351]
  ------------------
 1183|     51|        {
 1184|     51|            goto fail;
 1185|     51|        }
 1186|    402|    }
 1187|  1.08k|    if (return_parse_end)
  ------------------
  |  Branch (1187:9): [True: 0, False: 1.08k]
  ------------------
 1188|      0|    {
 1189|      0|        *return_parse_end = (const char*)buffer_at_offset(&buffer);
  ------------------
  |  |  304|      0|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
 1190|      0|    }
 1191|       |
 1192|  1.08k|    return item;
 1193|       |
 1194|    917|fail:
 1195|    917|    if (item != NULL)
  ------------------
  |  Branch (1195:9): [True: 917, False: 0]
  ------------------
 1196|    917|    {
 1197|    917|        cJSON_Delete(item);
 1198|    917|    }
 1199|       |
 1200|    917|    if (value != NULL)
  ------------------
  |  Branch (1200:9): [True: 917, False: 0]
  ------------------
 1201|    917|    {
 1202|    917|        error local_error;
 1203|    917|        local_error.json = (const unsigned char*)value;
 1204|    917|        local_error.position = 0;
 1205|       |
 1206|    917|        if (buffer.offset < buffer.length)
  ------------------
  |  Branch (1206:13): [True: 805, False: 112]
  ------------------
 1207|    805|        {
 1208|    805|            local_error.position = buffer.offset;
 1209|    805|        }
 1210|    112|        else if (buffer.length > 0)
  ------------------
  |  Branch (1210:18): [True: 112, False: 0]
  ------------------
 1211|    112|        {
 1212|    112|            local_error.position = buffer.length - 1;
 1213|    112|        }
 1214|       |
 1215|    917|        if (return_parse_end != NULL)
  ------------------
  |  Branch (1215:13): [True: 0, False: 917]
  ------------------
 1216|      0|        {
 1217|      0|            *return_parse_end = (const char*)local_error.json + local_error.position;
 1218|      0|        }
 1219|       |
 1220|    917|        global_error = local_error;
 1221|    917|    }
 1222|       |
 1223|       |    return NULL;
 1224|  1.13k|}
cJSON_Print:
 1308|    232|{
 1309|    232|    return (char*)print(item, true, &global_hooks);
  ------------------
  |  |   65|    232|#define true ((cJSON_bool)1)
  ------------------
 1310|    232|}
cJSON_PrintUnformatted:
 1313|    282|{
 1314|    282|    return (char*)print(item, false, &global_hooks);
  ------------------
  |  |   70|    282|#define false ((cJSON_bool)0)
  ------------------
 1315|    282|}
cJSON_PrintBuffered:
 1318|    574|{
 1319|    574|    printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
 1320|       |
 1321|    574|    if (prebuffer < 0)
  ------------------
  |  Branch (1321:9): [True: 0, False: 574]
  ------------------
 1322|      0|    {
 1323|      0|        return NULL;
 1324|      0|    }
 1325|       |
 1326|    574|    p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer);
 1327|    574|    if (!p.buffer)
  ------------------
  |  Branch (1327:9): [True: 0, False: 574]
  ------------------
 1328|      0|    {
 1329|      0|        return NULL;
 1330|      0|    }
 1331|       |
 1332|    574|    p.length = (size_t)prebuffer;
 1333|    574|    p.offset = 0;
 1334|    574|    p.noalloc = false;
  ------------------
  |  |   70|    574|#define false ((cJSON_bool)0)
  ------------------
 1335|    574|    p.format = fmt;
 1336|    574|    p.hooks = global_hooks;
 1337|       |
 1338|    574|    if (!print_value(item, &p))
  ------------------
  |  Branch (1338:9): [True: 0, False: 574]
  ------------------
 1339|      0|    {
 1340|      0|        global_hooks.deallocate(p.buffer);
 1341|      0|        p.buffer = NULL;
 1342|      0|        return NULL;
 1343|      0|    }
 1344|       |
 1345|    574|    return (char*)p.buffer;
 1346|    574|}
cJSON_Minify:
 2925|    907|{
 2926|    907|    char *into = json;
 2927|       |
 2928|    907|    if (json == NULL)
  ------------------
  |  Branch (2928:9): [True: 0, False: 907]
  ------------------
 2929|      0|    {
 2930|      0|        return;
 2931|      0|    }
 2932|       |
 2933|  2.68M|    while (json[0] != '\0')
  ------------------
  |  Branch (2933:12): [True: 2.68M, False: 907]
  ------------------
 2934|  2.68M|    {
 2935|  2.68M|        switch (json[0])
 2936|  2.68M|        {
 2937|  1.92k|            case ' ':
  ------------------
  |  Branch (2937:13): [True: 1.92k, False: 2.68M]
  ------------------
 2938|  3.68k|            case '\t':
  ------------------
  |  Branch (2938:13): [True: 1.76k, False: 2.68M]
  ------------------
 2939|  4.23k|            case '\r':
  ------------------
  |  Branch (2939:13): [True: 557, False: 2.68M]
  ------------------
 2940|  5.84k|            case '\n':
  ------------------
  |  Branch (2940:13): [True: 1.61k, False: 2.68M]
  ------------------
 2941|  5.84k|                json++;
 2942|  5.84k|                break;
 2943|       |
 2944|  1.76k|            case '/':
  ------------------
  |  Branch (2944:13): [True: 1.76k, False: 2.68M]
  ------------------
 2945|  1.76k|                if (json[1] == '/')
  ------------------
  |  Branch (2945:21): [True: 553, False: 1.21k]
  ------------------
 2946|    553|                {
 2947|    553|                    skip_oneline_comment(&json);
 2948|    553|                }
 2949|  1.21k|                else if (json[1] == '*')
  ------------------
  |  Branch (2949:26): [True: 488, False: 727]
  ------------------
 2950|    488|                {
 2951|    488|                    skip_multiline_comment(&json);
 2952|    727|                } else {
 2953|    727|                    json++;
 2954|    727|                }
 2955|  1.76k|                break;
 2956|       |
 2957|  14.8k|            case '\"':
  ------------------
  |  Branch (2957:13): [True: 14.8k, False: 2.67M]
  ------------------
 2958|  14.8k|                minify_string(&json, (char**)&into);
 2959|  14.8k|                break;
 2960|       |
 2961|  2.66M|            default:
  ------------------
  |  Branch (2961:13): [True: 2.66M, False: 22.4k]
  ------------------
 2962|  2.66M|                into[0] = json[0];
 2963|  2.66M|                json++;
 2964|  2.66M|                into++;
 2965|  2.68M|        }
 2966|  2.68M|    }
 2967|       |
 2968|       |    /* and null-terminate. */
 2969|    907|    *into = '\0';
 2970|    907|}
cJSON.c:cJSON_New_Item:
  242|   733k|{
  243|   733k|    cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON));
  244|   733k|    if (node)
  ------------------
  |  Branch (244:9): [True: 733k, False: 0]
  ------------------
  245|   733k|    {
  246|   733k|        memset(node, '\0', sizeof(cJSON));
  247|   733k|    }
  248|       |
  249|   733k|    return node;
  250|   733k|}
cJSON.c:buffer_skip_whitespace:
 1091|  2.16M|{
 1092|  2.16M|    if ((buffer == NULL) || (buffer->content == NULL))
  ------------------
  |  Branch (1092:9): [True: 0, False: 2.16M]
  |  Branch (1092:29): [True: 0, False: 2.16M]
  ------------------
 1093|      0|    {
 1094|      0|        return NULL;
 1095|      0|    }
 1096|       |
 1097|  2.16M|    if (cannot_access_at_index(buffer, 0))
  ------------------
  |  |  302|  2.16M|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  2.16M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 2.16M, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 2.16M, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1098|      0|    {
 1099|      0|        return buffer;
 1100|      0|    }
 1101|       |
 1102|  3.23M|    while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
  ------------------
  |  |  301|  6.47M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 3.23M, False: 0]
  |  |  |  Branch (301:65): [True: 3.23M, False: 940]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
  ------------------
  |  |  304|  3.23M|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1102:46): [True: 1.06M, False: 2.16M]
  ------------------
 1103|  1.06M|    {
 1104|  1.06M|       buffer->offset++;
 1105|  1.06M|    }
 1106|       |
 1107|  2.16M|    if (buffer->offset == buffer->length)
  ------------------
  |  Branch (1107:9): [True: 940, False: 2.16M]
  ------------------
 1108|    940|    {
 1109|    940|        buffer->offset--;
 1110|    940|    }
 1111|       |
 1112|  2.16M|    return buffer;
 1113|  2.16M|}
cJSON.c:skip_utf8_bom:
 1117|  2.00k|{
 1118|  2.00k|    if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0))
  ------------------
  |  Branch (1118:9): [True: 0, False: 2.00k]
  |  Branch (1118:29): [True: 0, False: 2.00k]
  |  Branch (1118:58): [True: 0, False: 2.00k]
  ------------------
 1119|      0|    {
 1120|      0|        return NULL;
 1121|      0|    }
 1122|       |
 1123|  2.00k|    if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0))
  ------------------
  |  |  301|  4.01k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 2.00k, False: 0]
  |  |  |  Branch (301:65): [True: 1.71k, False: 291]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0))
  ------------------
  |  |  304|  1.71k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1123:43): [True: 91, False: 1.62k]
  ------------------
 1124|     91|    {
 1125|     91|        buffer->offset += 3;
 1126|     91|    }
 1127|       |
 1128|  2.00k|    return buffer;
 1129|  2.00k|}
cJSON.c:print:
 1240|    514|{
 1241|    514|    static const size_t default_buffer_size = 256;
 1242|    514|    printbuffer buffer[1];
 1243|    514|    unsigned char *printed = NULL;
 1244|       |
 1245|    514|    memset(buffer, 0, sizeof(buffer));
 1246|       |
 1247|       |    /* create buffer */
 1248|    514|    buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size);
 1249|    514|    buffer->length = default_buffer_size;
 1250|    514|    buffer->format = format;
 1251|    514|    buffer->hooks = *hooks;
 1252|    514|    if (buffer->buffer == NULL)
  ------------------
  |  Branch (1252:9): [True: 0, False: 514]
  ------------------
 1253|      0|    {
 1254|      0|        goto fail;
 1255|      0|    }
 1256|       |
 1257|       |    /* print the value */
 1258|    514|    if (!print_value(item, buffer))
  ------------------
  |  Branch (1258:9): [True: 0, False: 514]
  ------------------
 1259|      0|    {
 1260|      0|        goto fail;
 1261|      0|    }
 1262|    514|    update_offset(buffer);
 1263|       |
 1264|       |    /* check if reallocate is available */
 1265|    514|    if (hooks->reallocate != NULL)
  ------------------
  |  Branch (1265:9): [True: 514, False: 0]
  ------------------
 1266|    514|    {
 1267|    514|        printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
 1268|    514|        if (printed == NULL) {
  ------------------
  |  Branch (1268:13): [True: 0, False: 514]
  ------------------
 1269|      0|            goto fail;
 1270|      0|        }
 1271|    514|        buffer->buffer = NULL;
 1272|    514|    }
 1273|      0|    else /* otherwise copy the JSON over to a new buffer */
 1274|      0|    {
 1275|      0|        printed = (unsigned char*) hooks->allocate(buffer->offset + 1);
 1276|      0|        if (printed == NULL)
  ------------------
  |  Branch (1276:13): [True: 0, False: 0]
  ------------------
 1277|      0|        {
 1278|      0|            goto fail;
 1279|      0|        }
 1280|      0|        memcpy(printed, buffer->buffer, cjson_min(buffer->length, buffer->offset + 1));
  ------------------
  |  | 1237|      0|#define cjson_min(a, b) (((a) < (b)) ? (a) : (b))
  |  |  ------------------
  |  |  |  Branch (1237:26): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 1281|      0|        printed[buffer->offset] = '\0'; /* just to be sure */
 1282|       |
 1283|       |        /* free the buffer */
 1284|      0|        hooks->deallocate(buffer->buffer);
 1285|      0|        buffer->buffer = NULL;
 1286|      0|    }
 1287|       |
 1288|    514|    return printed;
 1289|       |
 1290|      0|fail:
 1291|      0|    if (buffer->buffer != NULL)
  ------------------
  |  Branch (1291:9): [True: 0, False: 0]
  ------------------
 1292|      0|    {
 1293|      0|        hooks->deallocate(buffer->buffer);
 1294|      0|        buffer->buffer = NULL;
 1295|      0|    }
 1296|       |
 1297|      0|    if (printed != NULL)
  ------------------
  |  Branch (1297:9): [True: 0, False: 0]
  ------------------
 1298|      0|    {
 1299|      0|        hooks->deallocate(printed);
 1300|      0|        printed = NULL;
 1301|      0|    }
 1302|       |
 1303|       |    return NULL;
 1304|    514|}
cJSON.c:update_offset:
  577|   677k|{
  578|   677k|    const unsigned char *buffer_pointer = NULL;
  579|   677k|    if ((buffer == NULL) || (buffer->buffer == NULL))
  ------------------
  |  Branch (579:9): [True: 0, False: 677k]
  |  Branch (579:29): [True: 0, False: 677k]
  ------------------
  580|      0|    {
  581|      0|        return;
  582|      0|    }
  583|   677k|    buffer_pointer = buffer->buffer + buffer->offset;
  584|       |
  585|   677k|    buffer->offset += strlen((const char*)buffer_pointer);
  586|   677k|}
cJSON.c:parse_value:
 1369|   733k|{
 1370|   733k|    if ((input_buffer == NULL) || (input_buffer->content == NULL))
  ------------------
  |  Branch (1370:9): [True: 0, False: 733k]
  |  Branch (1370:35): [True: 0, False: 733k]
  ------------------
 1371|      0|    {
 1372|      0|        return false; /* no input */
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1373|      0|    }
 1374|       |
 1375|       |    /* parse the different types of values */
 1376|       |    /* null */
 1377|   733k|    if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0))
  ------------------
  |  |  299|  1.46M|#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (299:33): [True: 733k, False: 0]
  |  |  |  Branch (299:53): [True: 732k, False: 860]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0))
  ------------------
  |  |  304|   732k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1377:38): [True: 579, False: 732k]
  ------------------
 1378|    579|    {
 1379|    579|        item->type = cJSON_NULL;
  ------------------
  |  |   92|    579|#define cJSON_NULL   (1 << 2)
  ------------------
 1380|    579|        input_buffer->offset += 4;
 1381|    579|        return true;
  ------------------
  |  |   65|    579|#define true ((cJSON_bool)1)
  ------------------
 1382|    579|    }
 1383|       |    /* false */
 1384|   733k|    if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0))
  ------------------
  |  |  299|  1.46M|#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (299:33): [True: 733k, False: 0]
  |  |  |  Branch (299:53): [True: 732k, False: 1.23k]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0))
  ------------------
  |  |  304|   732k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1384:38): [True: 470, False: 731k]
  ------------------
 1385|    470|    {
 1386|    470|        item->type = cJSON_False;
  ------------------
  |  |   90|    470|#define cJSON_False  (1 << 0)
  ------------------
 1387|    470|        input_buffer->offset += 5;
 1388|    470|        return true;
  ------------------
  |  |   65|    470|#define true ((cJSON_bool)1)
  ------------------
 1389|    470|    }
 1390|       |    /* true */
 1391|   732k|    if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0))
  ------------------
  |  |  299|  1.46M|#define can_read(buffer, size) ((buffer != NULL) && (((buffer)->offset + size) <= (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (299:33): [True: 732k, False: 0]
  |  |  |  Branch (299:53): [True: 731k, False: 860]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0))
  ------------------
  |  |  304|   731k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1391:38): [True: 528, False: 731k]
  ------------------
 1392|    528|    {
 1393|    528|        item->type = cJSON_True;
  ------------------
  |  |   91|    528|#define cJSON_True   (1 << 1)
  ------------------
 1394|    528|        item->valueint = 1;
 1395|    528|        input_buffer->offset += 4;
 1396|    528|        return true;
  ------------------
  |  |   65|    528|#define true ((cJSON_bool)1)
  ------------------
 1397|    528|    }
 1398|       |    /* string */
 1399|   732k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"'))
  ------------------
  |  |  301|  1.46M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 732k, False: 0]
  |  |  |  Branch (301:65): [True: 732k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"'))
  ------------------
  |  |  304|   732k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1399:49): [True: 4.11k, False: 728k]
  ------------------
 1400|  4.11k|    {
 1401|  4.11k|        return parse_string(item, input_buffer);
 1402|  4.11k|    }
 1403|       |    /* number */
 1404|   728k|    if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9'))))
  ------------------
  |  |  301|  1.45M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 728k, False: 0]
  |  |  |  Branch (301:65): [True: 728k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9'))))
  ------------------
  |  |  304|   728k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
                  if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9'))))
  ------------------
  |  |  304|   727k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
                  if (can_access_at_index(input_buffer, 0) && ((buffer_at_offset(input_buffer)[0] == '-') || ((buffer_at_offset(input_buffer)[0] >= '0') && (buffer_at_offset(input_buffer)[0] <= '9'))))
  ------------------
  |  |  304|   726k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1404:50): [True: 974, False: 727k]
  |  Branch (1404:97): [True: 726k, False: 152]
  |  Branch (1404:143): [True: 24.2k, False: 702k]
  ------------------
 1405|  25.2k|    {
 1406|  25.2k|        return parse_number(item, input_buffer);
 1407|  25.2k|    }
 1408|       |    /* array */
 1409|   702k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '['))
  ------------------
  |  |  301|  1.40M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 702k, False: 0]
  |  |  |  Branch (301:65): [True: 702k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '['))
  ------------------
  |  |  304|   702k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1409:49): [True: 286k, False: 416k]
  ------------------
 1410|   286k|    {
 1411|   286k|        return parse_array(item, input_buffer);
 1412|   286k|    }
 1413|       |    /* object */
 1414|   416k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{'))
  ------------------
  |  |  301|   833k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 416k, False: 0]
  |  |  |  Branch (301:65): [True: 416k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{'))
  ------------------
  |  |  304|   416k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1414:49): [True: 416k, False: 306]
  ------------------
 1415|   416k|    {
 1416|   416k|        return parse_object(item, input_buffer);
 1417|   416k|    }
 1418|       |
 1419|    306|    return false;
  ------------------
  |  |   70|    306|#define false ((cJSON_bool)0)
  ------------------
 1420|   416k|}
cJSON.c:parse_string:
  825|  26.4k|{
  826|  26.4k|    const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1;
  ------------------
  |  |  304|  26.4k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  827|  26.4k|    const unsigned char *input_end = buffer_at_offset(input_buffer) + 1;
  ------------------
  |  |  304|  26.4k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  828|  26.4k|    unsigned char *output_pointer = NULL;
  829|  26.4k|    unsigned char *output = NULL;
  830|       |
  831|       |    /* not a string */
  832|  26.4k|    if (buffer_at_offset(input_buffer)[0] != '\"')
  ------------------
  |  |  304|  26.4k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (832:9): [True: 135, False: 26.3k]
  ------------------
  833|    135|    {
  834|    135|        goto fail;
  835|    135|    }
  836|       |
  837|  26.3k|    {
  838|       |        /* calculate approximate size of the output (overestimate) */
  839|  26.3k|        size_t allocation_length = 0;
  840|  26.3k|        size_t skipped_bytes = 0;
  841|  27.0M|        while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"'))
  ------------------
  |  Branch (841:16): [True: 27.0M, False: 67]
  |  Branch (841:88): [True: 26.9M, False: 26.2k]
  ------------------
  842|  26.9M|        {
  843|       |            /* is escape sequence */
  844|  26.9M|            if (input_end[0] == '\\')
  ------------------
  |  Branch (844:17): [True: 176k, False: 26.7M]
  ------------------
  845|   176k|            {
  846|   176k|                if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length)
  ------------------
  |  Branch (846:21): [True: 0, False: 176k]
  ------------------
  847|      0|                {
  848|       |                    /* prevent buffer overflow when last input character is a backslash */
  849|      0|                    goto fail;
  850|      0|                }
  851|   176k|                skipped_bytes++;
  852|   176k|                input_end++;
  853|   176k|            }
  854|  26.9M|            input_end++;
  855|  26.9M|        }
  856|  26.3k|        if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"'))
  ------------------
  |  Branch (856:13): [True: 67, False: 26.2k]
  |  Branch (856:86): [True: 0, False: 26.2k]
  ------------------
  857|     67|        {
  858|     67|            goto fail; /* string ended unexpectedly */
  859|     67|        }
  860|       |
  861|       |        /* This is at most how much we need for the output */
  862|  26.2k|        allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes;
  ------------------
  |  |  304|  26.2k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  863|  26.2k|        output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof(""));
  864|  26.2k|        if (output == NULL)
  ------------------
  |  Branch (864:13): [True: 0, False: 26.2k]
  ------------------
  865|      0|        {
  866|      0|            goto fail; /* allocation failure */
  867|      0|        }
  868|  26.2k|    }
  869|       |
  870|  26.2k|    output_pointer = output;
  871|       |    /* loop through the string literal */
  872|  24.7M|    while (input_pointer < input_end)
  ------------------
  |  Branch (872:12): [True: 24.6M, False: 26.1k]
  ------------------
  873|  24.6M|    {
  874|  24.6M|        if (*input_pointer != '\\')
  ------------------
  |  Branch (874:13): [True: 24.5M, False: 153k]
  ------------------
  875|  24.5M|        {
  876|  24.5M|            *output_pointer++ = *input_pointer++;
  877|  24.5M|        }
  878|       |        /* escape sequence */
  879|   153k|        else
  880|   153k|        {
  881|   153k|            unsigned char sequence_length = 2;
  882|   153k|            if ((input_end - input_pointer) < 1)
  ------------------
  |  Branch (882:17): [True: 0, False: 153k]
  ------------------
  883|      0|            {
  884|      0|                goto fail;
  885|      0|            }
  886|       |
  887|   153k|            switch (input_pointer[1])
  888|   153k|            {
  889|  10.4k|                case 'b':
  ------------------
  |  Branch (889:17): [True: 10.4k, False: 142k]
  ------------------
  890|  10.4k|                    *output_pointer++ = '\b';
  891|  10.4k|                    break;
  892|  5.63k|                case 'f':
  ------------------
  |  Branch (892:17): [True: 5.63k, False: 147k]
  ------------------
  893|  5.63k|                    *output_pointer++ = '\f';
  894|  5.63k|                    break;
  895|  10.6k|                case 'n':
  ------------------
  |  Branch (895:17): [True: 10.6k, False: 142k]
  ------------------
  896|  10.6k|                    *output_pointer++ = '\n';
  897|  10.6k|                    break;
  898|  9.00k|                case 'r':
  ------------------
  |  Branch (898:17): [True: 9.00k, False: 144k]
  ------------------
  899|  9.00k|                    *output_pointer++ = '\r';
  900|  9.00k|                    break;
  901|  12.3k|                case 't':
  ------------------
  |  Branch (901:17): [True: 12.3k, False: 140k]
  ------------------
  902|  12.3k|                    *output_pointer++ = '\t';
  903|  12.3k|                    break;
  904|  14.3k|                case '\"':
  ------------------
  |  Branch (904:17): [True: 14.3k, False: 138k]
  ------------------
  905|  27.2k|                case '\\':
  ------------------
  |  Branch (905:17): [True: 12.9k, False: 140k]
  ------------------
  906|  40.6k|                case '/':
  ------------------
  |  Branch (906:17): [True: 13.3k, False: 139k]
  ------------------
  907|  40.6k|                    *output_pointer++ = input_pointer[1];
  908|  40.6k|                    break;
  909|       |
  910|       |                /* UTF-16 literal */
  911|  64.3k|                case 'u':
  ------------------
  |  Branch (911:17): [True: 64.3k, False: 88.6k]
  ------------------
  912|  64.3k|                    sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer);
  913|  64.3k|                    if (sequence_length == 0)
  ------------------
  |  Branch (913:25): [True: 134, False: 64.2k]
  ------------------
  914|    134|                    {
  915|       |                        /* failed to convert UTF16-literal to UTF-8 */
  916|    134|                        goto fail;
  917|    134|                    }
  918|  64.2k|                    break;
  919|       |
  920|  64.2k|                default:
  ------------------
  |  Branch (920:17): [True: 12, False: 153k]
  ------------------
  921|     12|                    goto fail;
  922|   153k|            }
  923|   152k|            input_pointer += sequence_length;
  924|   152k|        }
  925|  24.6M|    }
  926|       |
  927|       |    /* zero terminate the output */
  928|  26.1k|    *output_pointer = '\0';
  929|       |
  930|  26.1k|    item->type = cJSON_String;
  ------------------
  |  |   94|  26.1k|#define cJSON_String (1 << 4)
  ------------------
  931|  26.1k|    item->valuestring = (char*)output;
  932|       |
  933|  26.1k|    input_buffer->offset = (size_t) (input_end - input_buffer->content);
  934|  26.1k|    input_buffer->offset++;
  935|       |
  936|  26.1k|    return true;
  ------------------
  |  |   65|  26.1k|#define true ((cJSON_bool)1)
  ------------------
  937|       |
  938|    348|fail:
  939|    348|    if (output != NULL)
  ------------------
  |  Branch (939:9): [True: 146, False: 202]
  ------------------
  940|    146|    {
  941|    146|        input_buffer->hooks.deallocate(output);
  942|    146|        output = NULL;
  943|    146|    }
  944|       |
  945|    348|    if (input_pointer != NULL)
  ------------------
  |  Branch (945:9): [True: 348, False: 0]
  ------------------
  946|    348|    {
  947|    348|        input_buffer->offset = (size_t)(input_pointer - input_buffer->content);
  948|    348|    }
  949|       |
  950|    348|    return false;
  ------------------
  |  |   70|    348|#define false ((cJSON_bool)0)
  ------------------
  951|  26.2k|}
cJSON.c:utf16_literal_to_utf8:
  704|  64.3k|{
  705|  64.3k|    long unsigned int codepoint = 0;
  706|  64.3k|    unsigned int first_code = 0;
  707|  64.3k|    const unsigned char *first_sequence = input_pointer;
  708|  64.3k|    unsigned char utf8_length = 0;
  709|  64.3k|    unsigned char utf8_position = 0;
  710|  64.3k|    unsigned char sequence_length = 0;
  711|  64.3k|    unsigned char first_byte_mark = 0;
  712|       |
  713|  64.3k|    if ((input_end - first_sequence) < 6)
  ------------------
  |  Branch (713:9): [True: 5, False: 64.3k]
  ------------------
  714|      5|    {
  715|       |        /* input ends unexpectedly */
  716|      5|        goto fail;
  717|      5|    }
  718|       |
  719|       |    /* get the first utf16 sequence */
  720|  64.3k|    first_code = parse_hex4(first_sequence + 2);
  721|       |
  722|       |    /* check that the code is valid */
  723|  64.3k|    if (((first_code >= 0xDC00) && (first_code <= 0xDFFF)))
  ------------------
  |  Branch (723:10): [True: 5.49k, False: 58.8k]
  |  Branch (723:36): [True: 16, False: 5.47k]
  ------------------
  724|     16|    {
  725|     16|        goto fail;
  726|     16|    }
  727|       |
  728|       |    /* UTF16 surrogate pair */
  729|  64.3k|    if ((first_code >= 0xD800) && (first_code <= 0xDBFF))
  ------------------
  |  Branch (729:9): [True: 10.2k, False: 54.0k]
  |  Branch (729:35): [True: 4.79k, False: 5.47k]
  ------------------
  730|  4.79k|    {
  731|  4.79k|        const unsigned char *second_sequence = first_sequence + 6;
  732|  4.79k|        unsigned int second_code = 0;
  733|  4.79k|        sequence_length = 12; /* \uXXXX\uXXXX */
  734|       |
  735|  4.79k|        if ((input_end - second_sequence) < 6)
  ------------------
  |  Branch (735:13): [True: 18, False: 4.78k]
  ------------------
  736|     18|        {
  737|       |            /* input ends unexpectedly */
  738|     18|            goto fail;
  739|     18|        }
  740|       |
  741|  4.78k|        if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u'))
  ------------------
  |  Branch (741:13): [True: 18, False: 4.76k]
  |  Branch (741:45): [True: 16, False: 4.74k]
  ------------------
  742|     34|        {
  743|       |            /* missing second half of the surrogate pair */
  744|     34|            goto fail;
  745|     34|        }
  746|       |
  747|       |        /* get the second utf16 sequence */
  748|  4.74k|        second_code = parse_hex4(second_sequence + 2);
  749|       |        /* check that the code is valid */
  750|  4.74k|        if ((second_code < 0xDC00) || (second_code > 0xDFFF))
  ------------------
  |  Branch (750:13): [True: 52, False: 4.69k]
  |  Branch (750:39): [True: 9, False: 4.68k]
  ------------------
  751|     61|        {
  752|       |            /* invalid second half of the surrogate pair */
  753|     61|            goto fail;
  754|     61|        }
  755|       |
  756|       |
  757|       |        /* calculate the unicode codepoint from the surrogate pair */
  758|  4.68k|        codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF));
  759|  4.68k|    }
  760|  59.5k|    else
  761|  59.5k|    {
  762|  59.5k|        sequence_length = 6; /* \uXXXX */
  763|  59.5k|        codepoint = first_code;
  764|  59.5k|    }
  765|       |
  766|       |    /* encode as UTF-8
  767|       |     * takes at maximum 4 bytes to encode:
  768|       |     * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
  769|  64.2k|    if (codepoint < 0x80)
  ------------------
  |  Branch (769:9): [True: 33.9k, False: 30.3k]
  ------------------
  770|  33.9k|    {
  771|       |        /* normal ascii, encoding 0xxxxxxx */
  772|  33.9k|        utf8_length = 1;
  773|  33.9k|    }
  774|  30.3k|    else if (codepoint < 0x800)
  ------------------
  |  Branch (774:14): [True: 7.00k, False: 23.2k]
  ------------------
  775|  7.00k|    {
  776|       |        /* two bytes, encoding 110xxxxx 10xxxxxx */
  777|  7.00k|        utf8_length = 2;
  778|  7.00k|        first_byte_mark = 0xC0; /* 11000000 */
  779|  7.00k|    }
  780|  23.2k|    else if (codepoint < 0x10000)
  ------------------
  |  Branch (780:14): [True: 18.6k, False: 4.68k]
  ------------------
  781|  18.6k|    {
  782|       |        /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */
  783|  18.6k|        utf8_length = 3;
  784|  18.6k|        first_byte_mark = 0xE0; /* 11100000 */
  785|  18.6k|    }
  786|  4.68k|    else if (codepoint <= 0x10FFFF)
  ------------------
  |  Branch (786:14): [True: 4.68k, False: 0]
  ------------------
  787|  4.68k|    {
  788|       |        /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */
  789|  4.68k|        utf8_length = 4;
  790|  4.68k|        first_byte_mark = 0xF0; /* 11110000 */
  791|  4.68k|    }
  792|      0|    else
  793|      0|    {
  794|       |        /* invalid unicode codepoint */
  795|      0|        goto fail;
  796|      0|    }
  797|       |
  798|       |    /* encode as utf8 */
  799|   122k|    for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--)
  ------------------
  |  Branch (799:60): [True: 58.2k, False: 64.2k]
  ------------------
  800|  58.2k|    {
  801|       |        /* 10xxxxxx */
  802|  58.2k|        (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF);
  803|  58.2k|        codepoint >>= 6;
  804|  58.2k|    }
  805|       |    /* encode first byte */
  806|  64.2k|    if (utf8_length > 1)
  ------------------
  |  Branch (806:9): [True: 30.3k, False: 33.9k]
  ------------------
  807|  30.3k|    {
  808|  30.3k|        (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF);
  809|  30.3k|    }
  810|  33.9k|    else
  811|  33.9k|    {
  812|  33.9k|        (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F);
  813|  33.9k|    }
  814|       |
  815|  64.2k|    *output_pointer += utf8_length;
  816|       |
  817|  64.2k|    return sequence_length;
  818|       |
  819|    134|fail:
  820|    134|    return 0;
  821|  64.2k|}
cJSON.c:parse_hex4:
  667|  69.1k|{
  668|  69.1k|    unsigned int h = 0;
  669|  69.1k|    size_t i = 0;
  670|       |
  671|   247k|    for (i = 0; i < 4; i++)
  ------------------
  |  Branch (671:17): [True: 210k, False: 37.3k]
  ------------------
  672|   210k|    {
  673|       |        /* parse digit */
  674|   210k|        if ((input[i] >= '0') && (input[i] <= '9'))
  ------------------
  |  Branch (674:13): [True: 203k, False: 6.58k]
  |  Branch (674:34): [True: 74.6k, False: 129k]
  ------------------
  675|  74.6k|        {
  676|  74.6k|            h += (unsigned int) input[i] - '0';
  677|  74.6k|        }
  678|   135k|        else if ((input[i] >= 'A') && (input[i] <= 'F'))
  ------------------
  |  Branch (678:18): [True: 120k, False: 15.0k]
  |  Branch (678:39): [True: 25.0k, False: 95.7k]
  ------------------
  679|  25.0k|        {
  680|  25.0k|            h += (unsigned int) 10 + input[i] - 'A';
  681|  25.0k|        }
  682|   110k|        else if ((input[i] >= 'a') && (input[i] <= 'f'))
  ------------------
  |  Branch (682:18): [True: 94.0k, False: 16.8k]
  |  Branch (682:39): [True: 79.0k, False: 14.9k]
  ------------------
  683|  79.0k|        {
  684|  79.0k|            h += (unsigned int) 10 + input[i] - 'a';
  685|  79.0k|        }
  686|  31.8k|        else /* invalid */
  687|  31.8k|        {
  688|  31.8k|            return 0;
  689|  31.8k|        }
  690|       |
  691|   178k|        if (i < 3)
  ------------------
  |  Branch (691:13): [True: 141k, False: 37.3k]
  ------------------
  692|   141k|        {
  693|       |            /* shift left to make place for the next nibble */
  694|   141k|            h = h << 4;
  695|   141k|        }
  696|   178k|    }
  697|       |
  698|  37.3k|    return h;
  699|  69.1k|}
cJSON.c:parse_number:
  308|  25.2k|{
  309|  25.2k|    double number = 0;
  310|  25.2k|    unsigned char *after_end = NULL;
  311|  25.2k|    unsigned char *number_c_string;
  312|  25.2k|    unsigned char decimal_point = get_decimal_point();
  313|  25.2k|    size_t i = 0;
  314|  25.2k|    size_t number_string_length = 0;
  315|  25.2k|    cJSON_bool has_decimal_point = false;
  ------------------
  |  |   70|  25.2k|#define false ((cJSON_bool)0)
  ------------------
  316|       |
  317|  25.2k|    if ((input_buffer == NULL) || (input_buffer->content == NULL))
  ------------------
  |  Branch (317:9): [True: 0, False: 25.2k]
  |  Branch (317:35): [True: 0, False: 25.2k]
  ------------------
  318|      0|    {
  319|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  320|      0|    }
  321|       |
  322|       |    /* copy the number into a temporary buffer and replace '.' with the decimal point
  323|       |     * of the current locale (for strtod)
  324|       |     * This also takes care of '\0' not necessarily being available for marking the end of the input */
  325|   638k|    for (i = 0; can_access_at_index(input_buffer, i); i++)
  ------------------
  |  |  301|   638k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 638k, False: 0]
  |  |  |  Branch (301:65): [True: 638k, False: 0]
  |  |  ------------------
  ------------------
  326|   638k|    {
  327|   638k|        switch (buffer_at_offset(input_buffer)[i])
  ------------------
  |  |  304|   638k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  328|   638k|        {
  329|   408k|            case '0':
  ------------------
  |  Branch (329:13): [True: 408k, False: 229k]
  ------------------
  330|   436k|            case '1':
  ------------------
  |  Branch (330:13): [True: 28.1k, False: 610k]
  ------------------
  331|   453k|            case '2':
  ------------------
  |  Branch (331:13): [True: 16.6k, False: 621k]
  ------------------
  332|   462k|            case '3':
  ------------------
  |  Branch (332:13): [True: 9.33k, False: 629k]
  ------------------
  333|   468k|            case '4':
  ------------------
  |  Branch (333:13): [True: 5.46k, False: 633k]
  ------------------
  334|   488k|            case '5':
  ------------------
  |  Branch (334:13): [True: 20.5k, False: 617k]
  ------------------
  335|   497k|            case '6':
  ------------------
  |  Branch (335:13): [True: 8.60k, False: 629k]
  ------------------
  336|   508k|            case '7':
  ------------------
  |  Branch (336:13): [True: 11.6k, False: 626k]
  ------------------
  337|   528k|            case '8':
  ------------------
  |  Branch (337:13): [True: 19.7k, False: 618k]
  ------------------
  338|   550k|            case '9':
  ------------------
  |  Branch (338:13): [True: 21.7k, False: 616k]
  ------------------
  339|   551k|            case '+':
  ------------------
  |  Branch (339:13): [True: 1.23k, False: 637k]
  ------------------
  340|   600k|            case '-':
  ------------------
  |  Branch (340:13): [True: 49.3k, False: 589k]
  ------------------
  341|   602k|            case 'e':
  ------------------
  |  Branch (341:13): [True: 1.56k, False: 636k]
  ------------------
  342|   605k|            case 'E':
  ------------------
  |  Branch (342:13): [True: 2.57k, False: 635k]
  ------------------
  343|   605k|                number_string_length++;
  344|   605k|                break;
  345|       |
  346|  8.15k|            case '.':
  ------------------
  |  Branch (346:13): [True: 8.15k, False: 630k]
  ------------------
  347|  8.15k|                number_string_length++;
  348|  8.15k|                has_decimal_point = true;
  ------------------
  |  |   65|  8.15k|#define true ((cJSON_bool)1)
  ------------------
  349|  8.15k|                break;
  350|       |
  351|  25.2k|            default:
  ------------------
  |  Branch (351:13): [True: 25.2k, False: 613k]
  ------------------
  352|  25.2k|                goto loop_end;
  353|   638k|        }
  354|   638k|    }
  355|  25.2k|loop_end:
  356|       |    /* malloc for temporary buffer, add 1 for '\0' */
  357|  25.2k|    number_c_string = (unsigned char *) input_buffer->hooks.allocate(number_string_length + 1);
  358|  25.2k|    if (number_c_string == NULL)
  ------------------
  |  Branch (358:9): [True: 0, False: 25.2k]
  ------------------
  359|      0|    {
  360|      0|        return false; /* allocation failure */
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  361|      0|    }
  362|       |
  363|  25.2k|    memcpy(number_c_string, buffer_at_offset(input_buffer), number_string_length);
  ------------------
  |  |  304|  25.2k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  364|  25.2k|    number_c_string[number_string_length] = '\0';
  365|       |
  366|  25.2k|    if (has_decimal_point)
  ------------------
  |  Branch (366:9): [True: 1.01k, False: 24.2k]
  ------------------
  367|  1.01k|    {
  368|   532k|        for (i = 0; i < number_string_length; i++)
  ------------------
  |  Branch (368:21): [True: 531k, False: 1.01k]
  ------------------
  369|   531k|        {
  370|   531k|            if (number_c_string[i] == '.')
  ------------------
  |  Branch (370:17): [True: 8.15k, False: 523k]
  ------------------
  371|  8.15k|            {
  372|       |                /* replace '.' with the decimal point of the current locale (for strtod) */
  373|  8.15k|                number_c_string[i] = decimal_point;
  374|  8.15k|            }
  375|   531k|        }
  376|  1.01k|    }
  377|       |
  378|  25.2k|    number = strtod((const char*)number_c_string, (char**)&after_end);
  379|  25.2k|    if (number_c_string == after_end)
  ------------------
  |  Branch (379:9): [True: 19, False: 25.1k]
  ------------------
  380|     19|    {
  381|       |        /* free the temporary buffer */
  382|     19|        input_buffer->hooks.deallocate(number_c_string);
  383|     19|        return false; /* parse_error */
  ------------------
  |  |   70|     19|#define false ((cJSON_bool)0)
  ------------------
  384|     19|    }
  385|       |
  386|  25.1k|    item->valuedouble = number;
  387|       |
  388|       |    /* use saturation in case of overflow */
  389|  25.1k|    if (number >= INT_MAX)
  ------------------
  |  Branch (389:9): [True: 3.76k, False: 21.4k]
  ------------------
  390|  3.76k|    {
  391|  3.76k|        item->valueint = INT_MAX;
  392|  3.76k|    }
  393|  21.4k|    else if (number <= (double)INT_MIN)
  ------------------
  |  Branch (393:14): [True: 327, False: 21.1k]
  ------------------
  394|    327|    {
  395|    327|        item->valueint = INT_MIN;
  396|    327|    }
  397|  21.1k|    else
  398|  21.1k|    {
  399|  21.1k|        item->valueint = (int)number;
  400|  21.1k|    }
  401|       |
  402|  25.1k|    item->type = cJSON_Number;
  ------------------
  |  |   93|  25.1k|#define cJSON_Number (1 << 3)
  ------------------
  403|       |
  404|  25.1k|    input_buffer->offset += (size_t)(after_end - number_c_string);
  405|       |    /* free the temporary buffer */
  406|  25.1k|    input_buffer->hooks.deallocate(number_c_string);
  407|  25.1k|    return true;
  ------------------
  |  |   65|  25.1k|#define true ((cJSON_bool)1)
  ------------------
  408|  25.2k|}
cJSON.c:get_decimal_point:
  280|  37.5k|{
  281|  37.5k|#ifdef ENABLE_LOCALES
  282|  37.5k|    struct lconv *lconv = localeconv();
  283|  37.5k|    return (unsigned char) lconv->decimal_point[0];
  284|       |#else
  285|       |    return '.';
  286|       |#endif
  287|  37.5k|}
cJSON.c:parse_array:
 1498|   286k|{
 1499|   286k|    cJSON *head = NULL; /* head of the linked list */
 1500|   286k|    cJSON *current_item = NULL;
 1501|       |
 1502|   286k|    if (input_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   286k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1502:9): [True: 2, False: 286k]
  ------------------
 1503|      2|    {
 1504|      2|        return false; /* to deeply nested */
  ------------------
  |  |   70|      2|#define false ((cJSON_bool)0)
  ------------------
 1505|      2|    }
 1506|   286k|    input_buffer->depth++;
 1507|       |
 1508|   286k|    if (buffer_at_offset(input_buffer)[0] != '[')
  ------------------
  |  |  304|   286k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1508:9): [True: 0, False: 286k]
  ------------------
 1509|      0|    {
 1510|       |        /* not an array */
 1511|      0|        goto fail;
 1512|      0|    }
 1513|       |
 1514|   286k|    input_buffer->offset++;
 1515|   286k|    buffer_skip_whitespace(input_buffer);
 1516|   286k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']'))
  ------------------
  |  |  301|   572k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 286k, False: 0]
  |  |  |  Branch (301:65): [True: 286k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']'))
  ------------------
  |  |  304|   286k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1516:49): [True: 3.06k, False: 283k]
  ------------------
 1517|  3.06k|    {
 1518|       |        /* empty array */
 1519|  3.06k|        goto success;
 1520|  3.06k|    }
 1521|       |
 1522|       |    /* check if we skipped to the end of the buffer */
 1523|   283k|    if (cannot_access_at_index(input_buffer, 0))
  ------------------
  |  |  302|   283k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   283k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 283k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 283k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1524|      0|    {
 1525|      0|        input_buffer->offset--;
 1526|      0|        goto fail;
 1527|      0|    }
 1528|       |
 1529|       |    /* step back to character in front of the first element */
 1530|   283k|    input_buffer->offset--;
 1531|       |    /* loop through the comma separated array elements */
 1532|   283k|    do
 1533|   709k|    {
 1534|       |        /* allocate next item */
 1535|   709k|        cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
 1536|   709k|        if (new_item == NULL)
  ------------------
  |  Branch (1536:13): [True: 0, False: 709k]
  ------------------
 1537|      0|        {
 1538|      0|            goto fail; /* allocation failure */
 1539|      0|        }
 1540|       |
 1541|       |        /* attach next item to list */
 1542|   709k|        if (head == NULL)
  ------------------
  |  Branch (1542:13): [True: 283k, False: 426k]
  ------------------
 1543|   283k|        {
 1544|       |            /* start the linked list */
 1545|   283k|            current_item = head = new_item;
 1546|   283k|        }
 1547|   426k|        else
 1548|   426k|        {
 1549|       |            /* add to the end and advance */
 1550|   426k|            current_item->next = new_item;
 1551|   426k|            new_item->prev = current_item;
 1552|   426k|            current_item = new_item;
 1553|   426k|        }
 1554|       |
 1555|       |        /* parse next value */
 1556|   709k|        input_buffer->offset++;
 1557|   709k|        buffer_skip_whitespace(input_buffer);
 1558|   709k|        if (!parse_value(current_item, input_buffer))
  ------------------
  |  Branch (1558:13): [True: 41.6k, False: 668k]
  ------------------
 1559|  41.6k|        {
 1560|  41.6k|            goto fail; /* failed to parse value */
 1561|  41.6k|        }
 1562|   668k|        buffer_skip_whitespace(input_buffer);
 1563|   668k|    }
 1564|   668k|    while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  301|  1.33M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 668k, False: 0]
  |  |  |  Branch (301:65): [True: 668k, False: 0]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  304|   668k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1564:52): [True: 426k, False: 241k]
  ------------------
 1565|       |
 1566|   241k|    if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']')
  ------------------
  |  |  302|   482k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   241k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 241k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 241k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']')
  ------------------
  |  |  304|   241k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1566:52): [True: 112, False: 241k]
  ------------------
 1567|    112|    {
 1568|    112|        goto fail; /* expected end of array */
 1569|    112|    }
 1570|       |
 1571|   244k|success:
 1572|   244k|    input_buffer->depth--;
 1573|       |
 1574|   244k|    if (head != NULL) {
  ------------------
  |  Branch (1574:9): [True: 241k, False: 3.06k]
  ------------------
 1575|   241k|        head->prev = current_item;
 1576|   241k|    }
 1577|       |
 1578|   244k|    item->type = cJSON_Array;
  ------------------
  |  |   95|   244k|#define cJSON_Array  (1 << 5)
  ------------------
 1579|   244k|    item->child = head;
 1580|       |
 1581|   244k|    input_buffer->offset++;
 1582|       |
 1583|   244k|    return true;
  ------------------
  |  |   65|   244k|#define true ((cJSON_bool)1)
  ------------------
 1584|       |
 1585|  41.7k|fail:
 1586|  41.7k|    if (head != NULL)
  ------------------
  |  Branch (1586:9): [True: 41.7k, False: 0]
  ------------------
 1587|  41.7k|    {
 1588|  41.7k|        cJSON_Delete(head);
 1589|  41.7k|    }
 1590|       |
 1591|  41.7k|    return false;
  ------------------
  |  |   70|  41.7k|#define false ((cJSON_bool)0)
  ------------------
 1592|   241k|}
cJSON.c:parse_object:
 1663|   416k|{
 1664|   416k|    cJSON *head = NULL; /* linked list head */
 1665|   416k|    cJSON *current_item = NULL;
 1666|       |
 1667|   416k|    if (input_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   416k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1667:9): [True: 1, False: 416k]
  ------------------
 1668|      1|    {
 1669|      1|        return false; /* to deeply nested */
  ------------------
  |  |   70|      1|#define false ((cJSON_bool)0)
  ------------------
 1670|      1|    }
 1671|   416k|    input_buffer->depth++;
 1672|       |
 1673|   416k|    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{'))
  ------------------
  |  |  302|   832k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   416k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 416k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 416k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{'))
  ------------------
  |  |  304|   416k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1673:52): [True: 0, False: 416k]
  ------------------
 1674|      0|    {
 1675|      0|        goto fail; /* not an object */
 1676|      0|    }
 1677|       |
 1678|   416k|    input_buffer->offset++;
 1679|   416k|    buffer_skip_whitespace(input_buffer);
 1680|   416k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}'))
  ------------------
  |  |  301|   832k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 416k, False: 0]
  |  |  |  Branch (301:65): [True: 416k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}'))
  ------------------
  |  |  304|   416k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1680:49): [True: 403k, False: 12.7k]
  ------------------
 1681|   403k|    {
 1682|   403k|        goto success; /* empty object */
 1683|   403k|    }
 1684|       |
 1685|       |    /* check if we skipped to the end of the buffer */
 1686|  12.7k|    if (cannot_access_at_index(input_buffer, 0))
  ------------------
  |  |  302|  12.7k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  12.7k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 12.7k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 12.7k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1687|      0|    {
 1688|      0|        input_buffer->offset--;
 1689|      0|        goto fail;
 1690|      0|    }
 1691|       |
 1692|       |    /* step back to character in front of the first element */
 1693|  12.7k|    input_buffer->offset--;
 1694|       |    /* loop through the comma separated array elements */
 1695|  12.7k|    do
 1696|  22.3k|    {
 1697|       |        /* allocate next item */
 1698|  22.3k|        cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
 1699|  22.3k|        if (new_item == NULL)
  ------------------
  |  Branch (1699:13): [True: 0, False: 22.3k]
  ------------------
 1700|      0|        {
 1701|      0|            goto fail; /* allocation failure */
 1702|      0|        }
 1703|       |
 1704|       |        /* attach next item to list */
 1705|  22.3k|        if (head == NULL)
  ------------------
  |  Branch (1705:13): [True: 12.7k, False: 9.59k]
  ------------------
 1706|  12.7k|        {
 1707|       |            /* start the linked list */
 1708|  12.7k|            current_item = head = new_item;
 1709|  12.7k|        }
 1710|  9.59k|        else
 1711|  9.59k|        {
 1712|       |            /* add to the end and advance */
 1713|  9.59k|            current_item->next = new_item;
 1714|  9.59k|            new_item->prev = current_item;
 1715|  9.59k|            current_item = new_item;
 1716|  9.59k|        }
 1717|       |
 1718|  22.3k|        if (cannot_access_at_index(input_buffer, 1))
  ------------------
  |  |  302|  22.3k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  22.3k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 22.3k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 22.3k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1719|      0|        {
 1720|      0|            goto fail; /* nothing comes after the comma */
 1721|      0|        }
 1722|       |
 1723|       |        /* parse the name of the child */
 1724|  22.3k|        input_buffer->offset++;
 1725|  22.3k|        buffer_skip_whitespace(input_buffer);
 1726|  22.3k|        if (!parse_string(current_item, input_buffer))
  ------------------
  |  Branch (1726:13): [True: 148, False: 22.1k]
  ------------------
 1727|    148|        {
 1728|    148|            goto fail; /* failed to parse name */
 1729|    148|        }
 1730|  22.1k|        buffer_skip_whitespace(input_buffer);
 1731|       |
 1732|       |        /* swap valuestring and string, because we parsed the name */
 1733|  22.1k|        current_item->string = current_item->valuestring;
 1734|  22.1k|        current_item->valuestring = NULL;
 1735|       |
 1736|  22.1k|        if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':'))
  ------------------
  |  |  302|  44.3k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  22.1k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 22.1k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 22.1k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':'))
  ------------------
  |  |  304|  22.1k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1736:56): [True: 32, False: 22.1k]
  ------------------
 1737|     32|        {
 1738|     32|            goto fail; /* invalid object */
 1739|     32|        }
 1740|       |
 1741|       |        /* parse the value */
 1742|  22.1k|        input_buffer->offset++;
 1743|  22.1k|        buffer_skip_whitespace(input_buffer);
 1744|  22.1k|        if (!parse_value(current_item, input_buffer))
  ------------------
  |  Branch (1744:13): [True: 2.45k, False: 19.7k]
  ------------------
 1745|  2.45k|        {
 1746|  2.45k|            goto fail; /* failed to parse value */
 1747|  2.45k|        }
 1748|  19.7k|        buffer_skip_whitespace(input_buffer);
 1749|  19.7k|    }
 1750|  19.7k|    while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  301|  39.4k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 19.7k, False: 0]
  |  |  |  Branch (301:65): [True: 19.7k, False: 0]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  304|  19.7k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1750:52): [True: 9.59k, False: 10.1k]
  ------------------
 1751|       |
 1752|  10.1k|    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}'))
  ------------------
  |  |  302|  20.2k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  10.1k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 10.1k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 10.1k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}'))
  ------------------
  |  |  304|  10.1k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1752:52): [True: 46, False: 10.0k]
  ------------------
 1753|     46|    {
 1754|     46|        goto fail; /* expected end of object */
 1755|     46|    }
 1756|       |
 1757|   413k|success:
 1758|   413k|    input_buffer->depth--;
 1759|       |
 1760|   413k|    if (head != NULL) {
  ------------------
  |  Branch (1760:9): [True: 10.0k, False: 403k]
  ------------------
 1761|  10.0k|        head->prev = current_item;
 1762|  10.0k|    }
 1763|       |
 1764|   413k|    item->type = cJSON_Object;
  ------------------
  |  |   96|   413k|#define cJSON_Object (1 << 6)
  ------------------
 1765|   413k|    item->child = head;
 1766|       |
 1767|   413k|    input_buffer->offset++;
 1768|   413k|    return true;
  ------------------
  |  |   65|   413k|#define true ((cJSON_bool)1)
  ------------------
 1769|       |
 1770|  2.68k|fail:
 1771|  2.68k|    if (head != NULL)
  ------------------
  |  Branch (1771:9): [True: 2.68k, False: 0]
  ------------------
 1772|  2.68k|    {
 1773|  2.68k|        cJSON_Delete(head);
 1774|  2.68k|    }
 1775|       |
 1776|  2.68k|    return false;
  ------------------
  |  |   70|  2.68k|#define false ((cJSON_bool)0)
  ------------------
 1777|  10.1k|}
cJSON.c:print_value:
 1424|   663k|{
 1425|   663k|    unsigned char *output = NULL;
 1426|       |
 1427|   663k|    if ((item == NULL) || (output_buffer == NULL))
  ------------------
  |  Branch (1427:9): [True: 0, False: 663k]
  |  Branch (1427:27): [True: 0, False: 663k]
  ------------------
 1428|      0|    {
 1429|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1430|      0|    }
 1431|       |
 1432|   663k|    switch ((item->type) & 0xFF)
 1433|   663k|    {
 1434|    322|        case cJSON_NULL:
  ------------------
  |  |   92|    322|#define cJSON_NULL   (1 << 2)
  ------------------
  |  Branch (1434:9): [True: 322, False: 663k]
  ------------------
 1435|    322|            output = ensure(output_buffer, 5);
 1436|    322|            if (output == NULL)
  ------------------
  |  Branch (1436:17): [True: 0, False: 322]
  ------------------
 1437|      0|            {
 1438|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1439|      0|            }
 1440|    322|            strcpy((char*)output, "null");
 1441|    322|            return true;
  ------------------
  |  |   65|    322|#define true ((cJSON_bool)1)
  ------------------
 1442|       |
 1443|    262|        case cJSON_False:
  ------------------
  |  |   90|    262|#define cJSON_False  (1 << 0)
  ------------------
  |  Branch (1443:9): [True: 262, False: 663k]
  ------------------
 1444|    262|            output = ensure(output_buffer, 6);
 1445|    262|            if (output == NULL)
  ------------------
  |  Branch (1445:17): [True: 0, False: 262]
  ------------------
 1446|      0|            {
 1447|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1448|      0|            }
 1449|    262|            strcpy((char*)output, "false");
 1450|    262|            return true;
  ------------------
  |  |   65|    262|#define true ((cJSON_bool)1)
  ------------------
 1451|       |
 1452|    231|        case cJSON_True:
  ------------------
  |  |   91|    231|#define cJSON_True   (1 << 1)
  ------------------
  |  Branch (1452:9): [True: 231, False: 663k]
  ------------------
 1453|    231|            output = ensure(output_buffer, 5);
 1454|    231|            if (output == NULL)
  ------------------
  |  Branch (1454:17): [True: 0, False: 231]
  ------------------
 1455|      0|            {
 1456|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1457|      0|            }
 1458|    231|            strcpy((char*)output, "true");
 1459|    231|            return true;
  ------------------
  |  |   65|    231|#define true ((cJSON_bool)1)
  ------------------
 1460|       |
 1461|  12.3k|        case cJSON_Number:
  ------------------
  |  |   93|  12.3k|#define cJSON_Number (1 << 3)
  ------------------
  |  Branch (1461:9): [True: 12.3k, False: 651k]
  ------------------
 1462|  12.3k|            return print_number(item, output_buffer);
 1463|       |
 1464|      0|        case cJSON_Raw:
  ------------------
  |  |   97|      0|#define cJSON_Raw    (1 << 7) /* raw json */
  ------------------
  |  Branch (1464:9): [True: 0, False: 663k]
  ------------------
 1465|      0|        {
 1466|      0|            size_t raw_length = 0;
 1467|      0|            if (item->valuestring == NULL)
  ------------------
  |  Branch (1467:17): [True: 0, False: 0]
  ------------------
 1468|      0|            {
 1469|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1470|      0|            }
 1471|       |
 1472|      0|            raw_length = strlen(item->valuestring) + sizeof("");
 1473|      0|            output = ensure(output_buffer, raw_length);
 1474|      0|            if (output == NULL)
  ------------------
  |  Branch (1474:17): [True: 0, False: 0]
  ------------------
 1475|      0|            {
 1476|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1477|      0|            }
 1478|      0|            memcpy(output, item->valuestring, raw_length);
 1479|      0|            return true;
  ------------------
  |  |   65|      0|#define true ((cJSON_bool)1)
  ------------------
 1480|      0|        }
 1481|       |
 1482|  1.33k|        case cJSON_String:
  ------------------
  |  |   94|  1.33k|#define cJSON_String (1 << 4)
  ------------------
  |  Branch (1482:9): [True: 1.33k, False: 662k]
  ------------------
 1483|  1.33k|            return print_string(item, output_buffer);
 1484|       |
 1485|   238k|        case cJSON_Array:
  ------------------
  |  |   95|   238k|#define cJSON_Array  (1 << 5)
  ------------------
  |  Branch (1485:9): [True: 238k, False: 425k]
  ------------------
 1486|   238k|            return print_array(item, output_buffer);
 1487|       |
 1488|   410k|        case cJSON_Object:
  ------------------
  |  |   96|   410k|#define cJSON_Object (1 << 6)
  ------------------
  |  Branch (1488:9): [True: 410k, False: 253k]
  ------------------
 1489|   410k|            return print_object(item, output_buffer);
 1490|       |
 1491|      0|        default:
  ------------------
  |  Branch (1491:9): [True: 0, False: 663k]
  ------------------
 1492|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1493|   663k|    }
 1494|   663k|}
cJSON.c:ensure:
  491|  1.77M|{
  492|  1.77M|    unsigned char *newbuffer = NULL;
  493|  1.77M|    size_t newsize = 0;
  494|       |
  495|  1.77M|    if ((p == NULL) || (p->buffer == NULL))
  ------------------
  |  Branch (495:9): [True: 0, False: 1.77M]
  |  Branch (495:24): [True: 0, False: 1.77M]
  ------------------
  496|      0|    {
  497|      0|        return NULL;
  498|      0|    }
  499|       |
  500|  1.77M|    if ((p->length > 0) && (p->offset >= p->length))
  ------------------
  |  Branch (500:9): [True: 1.77M, False: 0]
  |  Branch (500:28): [True: 0, False: 1.77M]
  ------------------
  501|      0|    {
  502|       |        /* make sure that offset is valid */
  503|      0|        return NULL;
  504|      0|    }
  505|       |
  506|  1.77M|    if (needed > INT_MAX)
  ------------------
  |  Branch (506:9): [True: 0, False: 1.77M]
  ------------------
  507|      0|    {
  508|       |        /* sizes bigger than INT_MAX are currently not supported */
  509|      0|        return NULL;
  510|      0|    }
  511|       |
  512|  1.77M|    needed += p->offset + 1;
  513|  1.77M|    if (needed <= p->length)
  ------------------
  |  Branch (513:9): [True: 1.77M, False: 1.90k]
  ------------------
  514|  1.77M|    {
  515|  1.77M|        return p->buffer + p->offset;
  516|  1.77M|    }
  517|       |
  518|  1.90k|    if (p->noalloc) {
  ------------------
  |  Branch (518:9): [True: 0, False: 1.90k]
  ------------------
  519|      0|        return NULL;
  520|      0|    }
  521|       |
  522|       |    /* calculate new buffer size */
  523|  1.90k|    if (needed > (INT_MAX / 2))
  ------------------
  |  Branch (523:9): [True: 0, False: 1.90k]
  ------------------
  524|      0|    {
  525|       |        /* overflow of int, use INT_MAX if possible */
  526|      0|        if (needed <= INT_MAX)
  ------------------
  |  Branch (526:13): [True: 0, False: 0]
  ------------------
  527|      0|        {
  528|      0|            newsize = INT_MAX;
  529|      0|        }
  530|      0|        else
  531|      0|        {
  532|      0|            return NULL;
  533|      0|        }
  534|      0|    }
  535|  1.90k|    else
  536|  1.90k|    {
  537|  1.90k|        newsize = needed * 2;
  538|  1.90k|    }
  539|       |
  540|  1.90k|    if (p->hooks.reallocate != NULL)
  ------------------
  |  Branch (540:9): [True: 1.90k, False: 0]
  ------------------
  541|  1.90k|    {
  542|       |        /* reallocate with realloc if available */
  543|  1.90k|        newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize);
  544|  1.90k|        if (newbuffer == NULL)
  ------------------
  |  Branch (544:13): [True: 0, False: 1.90k]
  ------------------
  545|      0|        {
  546|      0|            p->hooks.deallocate(p->buffer);
  547|      0|            p->length = 0;
  548|      0|            p->buffer = NULL;
  549|       |
  550|      0|            return NULL;
  551|      0|        }
  552|  1.90k|    }
  553|      0|    else
  554|      0|    {
  555|       |        /* otherwise reallocate manually */
  556|      0|        newbuffer = (unsigned char*)p->hooks.allocate(newsize);
  557|      0|        if (!newbuffer)
  ------------------
  |  Branch (557:13): [True: 0, False: 0]
  ------------------
  558|      0|        {
  559|      0|            p->hooks.deallocate(p->buffer);
  560|      0|            p->length = 0;
  561|      0|            p->buffer = NULL;
  562|       |
  563|      0|            return NULL;
  564|      0|        }
  565|       |
  566|      0|        memcpy(newbuffer, p->buffer, p->offset + 1);
  567|      0|        p->hooks.deallocate(p->buffer);
  568|      0|    }
  569|  1.90k|    p->length = newsize;
  570|  1.90k|    p->buffer = newbuffer;
  571|       |
  572|  1.90k|    return newbuffer + p->offset;
  573|  1.90k|}
cJSON.c:print_number:
  597|  12.3k|{
  598|  12.3k|    unsigned char *output_pointer = NULL;
  599|  12.3k|    double d = item->valuedouble;
  600|  12.3k|    int length = 0;
  601|  12.3k|    size_t i = 0;
  602|  12.3k|    unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */
  603|  12.3k|    unsigned char decimal_point = get_decimal_point();
  604|  12.3k|    double test = 0.0;
  605|       |
  606|  12.3k|    if (output_buffer == NULL)
  ------------------
  |  Branch (606:9): [True: 0, False: 12.3k]
  ------------------
  607|      0|    {
  608|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  609|      0|    }
  610|       |
  611|       |    /* This checks for NaN and Infinity */
  612|  12.3k|    if (isnan(d) || isinf(d))
  ------------------
  |  |   77|  24.7k|#define isnan(d) (d != d)
  |  |  ------------------
  |  |  |  Branch (77:18): [True: 0, False: 12.3k]
  |  |  ------------------
  ------------------
                  if (isnan(d) || isinf(d))
  ------------------
  |  |   74|  12.3k|#define isinf(d) (isnan((d - d)) && !isnan(d))
  |  |  ------------------
  |  |  |  |   77|  24.7k|#define isnan(d) (d != d)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:18): [True: 268, False: 12.0k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define isinf(d) (isnan((d - d)) && !isnan(d))
  |  |  ------------------
  |  |  |  |   77|    268|#define isnan(d) (d != d)
  |  |  ------------------
  |  |  |  Branch (74:37): [True: 268, False: 0]
  |  |  ------------------
  ------------------
  613|    268|    {
  614|    268|        length = sprintf((char*)number_buffer, "null");
  615|    268|    }
  616|  12.0k|    else if(d == (double)item->valueint)
  ------------------
  |  Branch (616:13): [True: 10.2k, False: 1.88k]
  ------------------
  617|  10.2k|    {
  618|  10.2k|        length = sprintf((char*)number_buffer, "%d", item->valueint);
  619|  10.2k|    }
  620|  1.88k|    else
  621|  1.88k|    {
  622|       |        /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
  623|  1.88k|        length = sprintf((char*)number_buffer, "%1.15g", d);
  624|       |
  625|       |        /* Check whether the original double can be recovered */
  626|  1.88k|        if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d))
  ------------------
  |  Branch (626:13): [True: 0, False: 1.88k]
  |  Branch (626:66): [True: 788, False: 1.09k]
  ------------------
  627|    788|        {
  628|       |            /* If not, print with 17 decimal places of precision */
  629|    788|            length = sprintf((char*)number_buffer, "%1.17g", d);
  630|    788|        }
  631|  1.88k|    }
  632|       |
  633|       |    /* sprintf failed or buffer overrun occurred */
  634|  12.3k|    if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1)))
  ------------------
  |  Branch (634:9): [True: 0, False: 12.3k]
  |  Branch (634:25): [True: 0, False: 12.3k]
  ------------------
  635|      0|    {
  636|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  637|      0|    }
  638|       |
  639|       |    /* reserve appropriate space in the output */
  640|  12.3k|    output_pointer = ensure(output_buffer, (size_t)length + sizeof(""));
  641|  12.3k|    if (output_pointer == NULL)
  ------------------
  |  Branch (641:9): [True: 0, False: 12.3k]
  ------------------
  642|      0|    {
  643|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  644|      0|    }
  645|       |
  646|       |    /* copy the printed number to the output and replace locale
  647|       |     * dependent decimal point with '.' */
  648|  51.0k|    for (i = 0; i < ((size_t)length); i++)
  ------------------
  |  Branch (648:17): [True: 38.7k, False: 12.3k]
  ------------------
  649|  38.7k|    {
  650|  38.7k|        if (number_buffer[i] == decimal_point)
  ------------------
  |  Branch (650:13): [True: 826, False: 37.8k]
  ------------------
  651|    826|        {
  652|    826|            output_pointer[i] = '.';
  653|    826|            continue;
  654|    826|        }
  655|       |
  656|  37.8k|        output_pointer[i] = number_buffer[i];
  657|  37.8k|    }
  658|  12.3k|    output_pointer[i] = '\0';
  659|       |
  660|  12.3k|    output_buffer->offset += (size_t)length;
  661|       |
  662|  12.3k|    return true;
  ------------------
  |  |   65|  12.3k|#define true ((cJSON_bool)1)
  ------------------
  663|  12.3k|}
cJSON.c:print_string:
 1077|  1.33k|{
 1078|  1.33k|    return print_string_ptr((unsigned char*)item->valuestring, p);
 1079|  1.33k|}
cJSON.c:print_string_ptr:
  955|  15.2k|{
  956|  15.2k|    const unsigned char *input_pointer = NULL;
  957|  15.2k|    unsigned char *output = NULL;
  958|  15.2k|    unsigned char *output_pointer = NULL;
  959|  15.2k|    size_t output_length = 0;
  960|       |    /* numbers of additional characters needed for escaping */
  961|  15.2k|    size_t escape_characters = 0;
  962|       |
  963|  15.2k|    if (output_buffer == NULL)
  ------------------
  |  Branch (963:9): [True: 0, False: 15.2k]
  ------------------
  964|      0|    {
  965|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  966|      0|    }
  967|       |
  968|       |    /* empty string */
  969|  15.2k|    if (input == NULL)
  ------------------
  |  Branch (969:9): [True: 0, False: 15.2k]
  ------------------
  970|      0|    {
  971|      0|        output = ensure(output_buffer, sizeof("\"\""));
  972|      0|        if (output == NULL)
  ------------------
  |  Branch (972:13): [True: 0, False: 0]
  ------------------
  973|      0|        {
  974|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  975|      0|        }
  976|      0|        strcpy((char*)output, "\"\"");
  977|       |
  978|      0|        return true;
  ------------------
  |  |   65|      0|#define true ((cJSON_bool)1)
  ------------------
  979|      0|    }
  980|       |
  981|       |    /* set "flag" to 1 if something needs to be escaped */
  982|  11.7M|    for (input_pointer = input; *input_pointer; input_pointer++)
  ------------------
  |  Branch (982:33): [True: 11.7M, False: 15.2k]
  ------------------
  983|  11.7M|    {
  984|  11.7M|        switch (*input_pointer)
  985|  11.7M|        {
  986|  1.54k|            case '\"':
  ------------------
  |  Branch (986:13): [True: 1.54k, False: 11.7M]
  ------------------
  987|  3.29k|            case '\\':
  ------------------
  |  Branch (987:13): [True: 1.74k, False: 11.7M]
  ------------------
  988|  10.0k|            case '\b':
  ------------------
  |  Branch (988:13): [True: 6.77k, False: 11.7M]
  ------------------
  989|  30.6k|            case '\f':
  ------------------
  |  Branch (989:13): [True: 20.6k, False: 11.7M]
  ------------------
  990|   154k|            case '\n':
  ------------------
  |  Branch (990:13): [True: 124k, False: 11.6M]
  ------------------
  991|   159k|            case '\r':
  ------------------
  |  Branch (991:13): [True: 5.13k, False: 11.7M]
  ------------------
  992|   170k|            case '\t':
  ------------------
  |  Branch (992:13): [True: 10.8k, False: 11.7M]
  ------------------
  993|       |                /* one character escape sequence */
  994|   170k|                escape_characters++;
  995|   170k|                break;
  996|  11.5M|            default:
  ------------------
  |  Branch (996:13): [True: 11.5M, False: 170k]
  ------------------
  997|  11.5M|                if (*input_pointer < 32)
  ------------------
  |  Branch (997:21): [True: 8.96M, False: 2.59M]
  ------------------
  998|  8.96M|                {
  999|       |                    /* UTF-16 escape sequence uXXXX */
 1000|  8.96M|                    escape_characters += 5;
 1001|  8.96M|                }
 1002|  11.5M|                break;
 1003|  11.7M|        }
 1004|  11.7M|    }
 1005|  15.2k|    output_length = (size_t)(input_pointer - input) + escape_characters;
 1006|       |
 1007|  15.2k|    output = ensure(output_buffer, output_length + sizeof("\"\""));
 1008|  15.2k|    if (output == NULL)
  ------------------
  |  Branch (1008:9): [True: 0, False: 15.2k]
  ------------------
 1009|      0|    {
 1010|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1011|      0|    }
 1012|       |
 1013|       |    /* no characters have to be escaped */
 1014|  15.2k|    if (escape_characters == 0)
  ------------------
  |  Branch (1014:9): [True: 13.5k, False: 1.69k]
  ------------------
 1015|  13.5k|    {
 1016|  13.5k|        output[0] = '\"';
 1017|  13.5k|        memcpy(output + 1, input, output_length);
 1018|  13.5k|        output[output_length + 1] = '\"';
 1019|  13.5k|        output[output_length + 2] = '\0';
 1020|       |
 1021|  13.5k|        return true;
  ------------------
  |  |   65|  13.5k|#define true ((cJSON_bool)1)
  ------------------
 1022|  13.5k|    }
 1023|       |
 1024|  1.69k|    output[0] = '\"';
 1025|  1.69k|    output_pointer = output + 1;
 1026|       |    /* copy the string */
 1027|  11.7M|    for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++)
  ------------------
  |  Branch (1027:33): [True: 11.7M, False: 1.69k]
  ------------------
 1028|  11.7M|    {
 1029|  11.7M|        if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\'))
  ------------------
  |  Branch (1029:13): [True: 2.58M, False: 9.13M]
  |  Branch (1029:38): [True: 2.57M, False: 1.54k]
  |  Branch (1029:66): [True: 2.57M, False: 1.74k]
  ------------------
 1030|  2.57M|        {
 1031|       |            /* normal character, copy */
 1032|  2.57M|            *output_pointer = *input_pointer;
 1033|  2.57M|        }
 1034|  9.13M|        else
 1035|  9.13M|        {
 1036|       |            /* character needs to be escaped */
 1037|  9.13M|            *output_pointer++ = '\\';
 1038|  9.13M|            switch (*input_pointer)
 1039|  9.13M|            {
 1040|  1.74k|                case '\\':
  ------------------
  |  Branch (1040:17): [True: 1.74k, False: 9.13M]
  ------------------
 1041|  1.74k|                    *output_pointer = '\\';
 1042|  1.74k|                    break;
 1043|  1.54k|                case '\"':
  ------------------
  |  Branch (1043:17): [True: 1.54k, False: 9.13M]
  ------------------
 1044|  1.54k|                    *output_pointer = '\"';
 1045|  1.54k|                    break;
 1046|  6.77k|                case '\b':
  ------------------
  |  Branch (1046:17): [True: 6.77k, False: 9.12M]
  ------------------
 1047|  6.77k|                    *output_pointer = 'b';
 1048|  6.77k|                    break;
 1049|  20.6k|                case '\f':
  ------------------
  |  Branch (1049:17): [True: 20.6k, False: 9.11M]
  ------------------
 1050|  20.6k|                    *output_pointer = 'f';
 1051|  20.6k|                    break;
 1052|   124k|                case '\n':
  ------------------
  |  Branch (1052:17): [True: 124k, False: 9.01M]
  ------------------
 1053|   124k|                    *output_pointer = 'n';
 1054|   124k|                    break;
 1055|  5.13k|                case '\r':
  ------------------
  |  Branch (1055:17): [True: 5.13k, False: 9.13M]
  ------------------
 1056|  5.13k|                    *output_pointer = 'r';
 1057|  5.13k|                    break;
 1058|  10.8k|                case '\t':
  ------------------
  |  Branch (1058:17): [True: 10.8k, False: 9.12M]
  ------------------
 1059|  10.8k|                    *output_pointer = 't';
 1060|  10.8k|                    break;
 1061|  8.96M|                default:
  ------------------
  |  Branch (1061:17): [True: 8.96M, False: 170k]
  ------------------
 1062|       |                    /* escape and print as unicode codepoint */
 1063|  8.96M|                    sprintf((char*)output_pointer, "u%04x", *input_pointer);
 1064|  8.96M|                    output_pointer += 4;
 1065|  8.96M|                    break;
 1066|  9.13M|            }
 1067|  9.13M|        }
 1068|  11.7M|    }
 1069|  1.69k|    output[output_length + 1] = '\"';
 1070|  1.69k|    output[output_length + 2] = '\0';
 1071|       |
 1072|  1.69k|    return true;
  ------------------
  |  |   65|  1.69k|#define true ((cJSON_bool)1)
  ------------------
 1073|  1.69k|}
cJSON.c:print_array:
 1596|   238k|{
 1597|   238k|    unsigned char *output_pointer = NULL;
 1598|   238k|    size_t length = 0;
 1599|   238k|    cJSON *current_element = item->child;
 1600|       |
 1601|   238k|    if (output_buffer == NULL)
  ------------------
  |  Branch (1601:9): [True: 0, False: 238k]
  ------------------
 1602|      0|    {
 1603|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1604|      0|    }
 1605|       |
 1606|   238k|    if (output_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   238k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1606:9): [True: 0, False: 238k]
  ------------------
 1607|      0|    {
 1608|      0|        return false; /* nesting is too deep */
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1609|      0|    }
 1610|       |
 1611|       |    /* Compose the output array. */
 1612|       |    /* opening square bracket */
 1613|   238k|    output_pointer = ensure(output_buffer, 1);
 1614|   238k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1614:9): [True: 0, False: 238k]
  ------------------
 1615|      0|    {
 1616|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1617|      0|    }
 1618|       |
 1619|   238k|    *output_pointer = '[';
 1620|   238k|    output_buffer->offset++;
 1621|   238k|    output_buffer->depth++;
 1622|       |
 1623|   887k|    while (current_element != NULL)
  ------------------
  |  Branch (1623:12): [True: 648k, False: 238k]
  ------------------
 1624|   648k|    {
 1625|   648k|        if (!print_value(current_element, output_buffer))
  ------------------
  |  Branch (1625:13): [True: 0, False: 648k]
  ------------------
 1626|      0|        {
 1627|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1628|      0|        }
 1629|   648k|        update_offset(output_buffer);
 1630|   648k|        if (current_element->next)
  ------------------
  |  Branch (1630:13): [True: 412k, False: 236k]
  ------------------
 1631|   412k|        {
 1632|   412k|            length = (size_t) (output_buffer->format ? 2 : 1);
  ------------------
  |  Branch (1632:32): [True: 408k, False: 4.20k]
  ------------------
 1633|   412k|            output_pointer = ensure(output_buffer, length + 1);
 1634|   412k|            if (output_pointer == NULL)
  ------------------
  |  Branch (1634:17): [True: 0, False: 412k]
  ------------------
 1635|      0|            {
 1636|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1637|      0|            }
 1638|   412k|            *output_pointer++ = ',';
 1639|   412k|            if(output_buffer->format)
  ------------------
  |  Branch (1639:16): [True: 408k, False: 4.20k]
  ------------------
 1640|   408k|            {
 1641|   408k|                *output_pointer++ = ' ';
 1642|   408k|            }
 1643|   412k|            *output_pointer = '\0';
 1644|   412k|            output_buffer->offset += length;
 1645|   412k|        }
 1646|   648k|        current_element = current_element->next;
 1647|   648k|    }
 1648|       |
 1649|   238k|    output_pointer = ensure(output_buffer, 2);
 1650|   238k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1650:9): [True: 0, False: 238k]
  ------------------
 1651|      0|    {
 1652|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1653|      0|    }
 1654|   238k|    *output_pointer++ = ']';
 1655|   238k|    *output_pointer = '\0';
 1656|   238k|    output_buffer->depth--;
 1657|       |
 1658|   238k|    return true;
  ------------------
  |  |   65|   238k|#define true ((cJSON_bool)1)
  ------------------
 1659|   238k|}
cJSON.c:print_object:
 1781|   410k|{
 1782|   410k|    unsigned char *output_pointer = NULL;
 1783|   410k|    size_t length = 0;
 1784|   410k|    cJSON *current_item = item->child;
 1785|       |
 1786|   410k|    if (output_buffer == NULL)
  ------------------
  |  Branch (1786:9): [True: 0, False: 410k]
  ------------------
 1787|      0|    {
 1788|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1789|      0|    }
 1790|       |
 1791|   410k|    if (output_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   410k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1791:9): [True: 0, False: 410k]
  ------------------
 1792|      0|    {
 1793|      0|        return false; /* nesting is too deep */
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1794|      0|    }
 1795|       |
 1796|       |    /* Compose the output: */
 1797|   410k|    length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */
  ------------------
  |  Branch (1797:24): [True: 409k, False: 1.03k]
  ------------------
 1798|   410k|    output_pointer = ensure(output_buffer, length + 1);
 1799|   410k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1799:9): [True: 0, False: 410k]
  ------------------
 1800|      0|    {
 1801|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1802|      0|    }
 1803|       |
 1804|   410k|    *output_pointer++ = '{';
 1805|   410k|    output_buffer->depth++;
 1806|   410k|    if (output_buffer->format)
  ------------------
  |  Branch (1806:9): [True: 409k, False: 1.03k]
  ------------------
 1807|   409k|    {
 1808|   409k|        *output_pointer++ = '\n';
 1809|   409k|    }
 1810|   410k|    output_buffer->offset += length;
 1811|       |
 1812|   424k|    while (current_item)
  ------------------
  |  Branch (1812:12): [True: 13.9k, False: 410k]
  ------------------
 1813|  13.9k|    {
 1814|  13.9k|        if (output_buffer->format)
  ------------------
  |  Branch (1814:13): [True: 11.0k, False: 2.90k]
  ------------------
 1815|  11.0k|        {
 1816|  11.0k|            size_t i;
 1817|  11.0k|            output_pointer = ensure(output_buffer, output_buffer->depth);
 1818|  11.0k|            if (output_pointer == NULL)
  ------------------
  |  Branch (1818:17): [True: 0, False: 11.0k]
  ------------------
 1819|      0|            {
 1820|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1821|      0|            }
 1822|  4.25M|            for (i = 0; i < output_buffer->depth; i++)
  ------------------
  |  Branch (1822:25): [True: 4.24M, False: 11.0k]
  ------------------
 1823|  4.24M|            {
 1824|  4.24M|                *output_pointer++ = '\t';
 1825|  4.24M|            }
 1826|  11.0k|            output_buffer->offset += output_buffer->depth;
 1827|  11.0k|        }
 1828|       |
 1829|       |        /* print key */
 1830|  13.9k|        if (!print_string_ptr((unsigned char*)current_item->string, output_buffer))
  ------------------
  |  Branch (1830:13): [True: 0, False: 13.9k]
  ------------------
 1831|      0|        {
 1832|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1833|      0|        }
 1834|  13.9k|        update_offset(output_buffer);
 1835|       |
 1836|  13.9k|        length = (size_t) (output_buffer->format ? 2 : 1);
  ------------------
  |  Branch (1836:28): [True: 11.0k, False: 2.90k]
  ------------------
 1837|  13.9k|        output_pointer = ensure(output_buffer, length);
 1838|  13.9k|        if (output_pointer == NULL)
  ------------------
  |  Branch (1838:13): [True: 0, False: 13.9k]
  ------------------
 1839|      0|        {
 1840|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1841|      0|        }
 1842|  13.9k|        *output_pointer++ = ':';
 1843|  13.9k|        if (output_buffer->format)
  ------------------
  |  Branch (1843:13): [True: 11.0k, False: 2.90k]
  ------------------
 1844|  11.0k|        {
 1845|  11.0k|            *output_pointer++ = '\t';
 1846|  11.0k|        }
 1847|  13.9k|        output_buffer->offset += length;
 1848|       |
 1849|       |        /* print value */
 1850|  13.9k|        if (!print_value(current_item, output_buffer))
  ------------------
  |  Branch (1850:13): [True: 0, False: 13.9k]
  ------------------
 1851|      0|        {
 1852|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1853|      0|        }
 1854|  13.9k|        update_offset(output_buffer);
 1855|       |
 1856|       |        /* print comma if not last */
 1857|  13.9k|        length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0));
  ------------------
  |  Branch (1857:28): [True: 11.0k, False: 2.90k]
  |  Branch (1857:70): [True: 4.82k, False: 9.07k]
  ------------------
 1858|  13.9k|        output_pointer = ensure(output_buffer, length + 1);
 1859|  13.9k|        if (output_pointer == NULL)
  ------------------
  |  Branch (1859:13): [True: 0, False: 13.9k]
  ------------------
 1860|      0|        {
 1861|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1862|      0|        }
 1863|  13.9k|        if (current_item->next)
  ------------------
  |  Branch (1863:13): [True: 4.82k, False: 9.07k]
  ------------------
 1864|  4.82k|        {
 1865|  4.82k|            *output_pointer++ = ',';
 1866|  4.82k|        }
 1867|       |
 1868|  13.9k|        if (output_buffer->format)
  ------------------
  |  Branch (1868:13): [True: 11.0k, False: 2.90k]
  ------------------
 1869|  11.0k|        {
 1870|  11.0k|            *output_pointer++ = '\n';
 1871|  11.0k|        }
 1872|  13.9k|        *output_pointer = '\0';
 1873|  13.9k|        output_buffer->offset += length;
 1874|       |
 1875|  13.9k|        current_item = current_item->next;
 1876|  13.9k|    }
 1877|       |
 1878|   410k|    output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2);
  ------------------
  |  Branch (1878:44): [True: 409k, False: 1.03k]
  ------------------
 1879|   410k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1879:9): [True: 0, False: 410k]
  ------------------
 1880|      0|    {
 1881|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1882|      0|    }
 1883|   410k|    if (output_buffer->format)
  ------------------
  |  Branch (1883:9): [True: 409k, False: 1.03k]
  ------------------
 1884|   409k|    {
 1885|   409k|        size_t i;
 1886|   223M|        for (i = 0; i < (output_buffer->depth - 1); i++)
  ------------------
  |  Branch (1886:21): [True: 222M, False: 409k]
  ------------------
 1887|   222M|        {
 1888|   222M|            *output_pointer++ = '\t';
 1889|   222M|        }
 1890|   409k|    }
 1891|   410k|    *output_pointer++ = '}';
 1892|   410k|    *output_pointer = '\0';
 1893|   410k|    output_buffer->depth--;
 1894|       |
 1895|   410k|    return true;
  ------------------
  |  |   65|   410k|#define true ((cJSON_bool)1)
  ------------------
 1896|   410k|}
cJSON.c:skip_oneline_comment:
 2876|    553|{
 2877|    553|    *input += static_strlen("//");
  ------------------
  |  |  184|    553|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2878|       |
 2879|  6.11k|    for (; (*input)[0] != '\0'; ++(*input))
  ------------------
  |  Branch (2879:12): [True: 6.09k, False: 20]
  ------------------
 2880|  6.09k|    {
 2881|  6.09k|        if ((*input)[0] == '\n') {
  ------------------
  |  Branch (2881:13): [True: 533, False: 5.55k]
  ------------------
 2882|    533|            *input += static_strlen("\n");
  ------------------
  |  |  184|    533|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2883|    533|            return;
 2884|    533|        }
 2885|  6.09k|    }
 2886|    553|}
cJSON.c:skip_multiline_comment:
 2889|    488|{
 2890|    488|    *input += static_strlen("/*");
  ------------------
  |  |  184|    488|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2891|       |
 2892|  4.92k|    for (; (*input)[0] != '\0'; ++(*input))
  ------------------
  |  Branch (2892:12): [True: 4.87k, False: 47]
  ------------------
 2893|  4.87k|    {
 2894|  4.87k|        if (((*input)[0] == '*') && ((*input)[1] == '/'))
  ------------------
  |  Branch (2894:13): [True: 821, False: 4.05k]
  |  Branch (2894:37): [True: 441, False: 380]
  ------------------
 2895|    441|        {
 2896|    441|            *input += static_strlen("*/");
  ------------------
  |  |  184|    441|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2897|    441|            return;
 2898|    441|        }
 2899|  4.87k|    }
 2900|    488|}
cJSON.c:minify_string:
 2902|  14.8k|static void minify_string(char **input, char **output) {
 2903|  14.8k|    (*output)[0] = (*input)[0];
 2904|  14.8k|    *input += static_strlen("\"");
  ------------------
  |  |  184|  14.8k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2905|  14.8k|    *output += static_strlen("\"");
  ------------------
  |  |  184|  14.8k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2906|       |
 2907|       |
 2908|  12.4M|    for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) {
  ------------------
  |  Branch (2908:12): [True: 12.4M, False: 39]
  ------------------
 2909|  12.4M|        (*output)[0] = (*input)[0];
 2910|       |
 2911|  12.4M|        if ((*input)[0] == '\"') {
  ------------------
  |  Branch (2911:13): [True: 14.8k, False: 12.4M]
  ------------------
 2912|  14.8k|            (*output)[0] = '\"';
 2913|  14.8k|            *input += static_strlen("\"");
  ------------------
  |  |  184|  14.8k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2914|  14.8k|            *output += static_strlen("\"");
  ------------------
  |  |  184|  14.8k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2915|  14.8k|            return;
 2916|  12.4M|        } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) {
  ------------------
  |  Branch (2916:20): [True: 25.0k, False: 12.4M]
  |  Branch (2916:45): [True: 1.47k, False: 23.5k]
  ------------------
 2917|  1.47k|            (*output)[1] = (*input)[1];
 2918|  1.47k|            *input += static_strlen("\"");
  ------------------
  |  |  184|  1.47k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2919|  1.47k|            *output += static_strlen("\"");
  ------------------
  |  |  184|  1.47k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2920|  1.47k|        }
 2921|  12.4M|    }
 2922|  14.8k|}
cJSON.c:compare_double:
  590|  1.88k|{
  591|  1.88k|    double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
  ------------------
  |  Branch (591:21): [True: 681, False: 1.20k]
  ------------------
  592|       |    return (fabs(a - b) <= maxVal * DBL_EPSILON);
  593|  1.88k|}

LLVMFuzzerTestOneInput:
   14|  2.07k|{
   15|  2.07k|    cJSON *json;
   16|  2.07k|    size_t offset = 4;
   17|  2.07k|    unsigned char *copied;
   18|  2.07k|    char *printed_json = NULL;
   19|  2.07k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.07k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.07k]
  ------------------
   23|  2.07k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 9, False: 2.06k]
  ------------------
   24|  2.06k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 397, False: 1.66k]
  |  Branch (24:26): [True: 13, False: 384]
  ------------------
   25|  2.05k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.32k, False: 729]
  |  Branch (25:26): [True: 14, False: 1.30k]
  ------------------
   26|  2.03k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.08k, False: 950]
  |  Branch (26:26): [True: 16, False: 1.07k]
  ------------------
   27|  2.02k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 974, False: 1.04k]
  |  Branch (27:26): [True: 16, False: 958]
  ------------------
   28|       |
   29|  2.00k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.63k, False: 368]
  ------------------
   30|  2.00k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 718, False: 1.28k]
  ------------------
   31|  2.00k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 940, False: 1.06k]
  ------------------
   32|  2.00k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 1.04k, False: 958]
  ------------------
   33|       |
   34|  2.00k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.00k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 917, False: 1.08k]
  ------------------
   37|       |
   38|  1.08k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 574, False: 514]
  ------------------
   39|    574|    {
   40|    574|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    574|    }
   42|    514|    else
   43|    514|    {
   44|       |        /* unbuffered printing */
   45|    514|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 232, False: 282]
  ------------------
   46|    232|        {
   47|    232|            printed_json = cJSON_Print(json);
   48|    232|        }
   49|    282|        else
   50|    282|        {
   51|    282|            printed_json = cJSON_PrintUnformatted(json);
   52|    282|        }
   53|    514|    }
   54|       |
   55|  1.08k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.08k, False: 0]
  ------------------
   56|       |
   57|  1.08k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 907, False: 181]
  ------------------
   58|    907|    {
   59|    907|        copied = (unsigned char*)malloc(size);
   60|    907|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 907]
  ------------------
   61|       |
   62|    907|        memcpy(copied, data, size);
   63|       |
   64|    907|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    907|        free(copied);
   67|    907|    }
   68|       |
   69|  1.08k|    cJSON_Delete(json);
   70|       |
   71|  1.08k|    return 0;
   72|  1.08k|}

