cJSON_Delete:
  254|   302k|{
  255|   302k|    cJSON *next = NULL;
  256|  1.03M|    while (item != NULL)
  ------------------
  |  Branch (256:12): [True: 732k, False: 302k]
  ------------------
  257|   732k|    {
  258|   732k|        next = item->next;
  259|   732k|        if (!(item->type & cJSON_IsReference) && (item->child != NULL))
  ------------------
  |  |   99|   732k|#define cJSON_IsReference 256
  ------------------
  |  Branch (259:13): [True: 732k, False: 0]
  |  Branch (259:50): [True: 248k, False: 483k]
  ------------------
  260|   248k|        {
  261|   248k|            cJSON_Delete(item->child);
  262|   248k|        }
  263|   732k|        if (!(item->type & cJSON_IsReference) && (item->valuestring != NULL))
  ------------------
  |  |   99|   732k|#define cJSON_IsReference 256
  ------------------
  |  Branch (263:13): [True: 732k, False: 0]
  |  Branch (263:50): [True: 6.78k, False: 725k]
  ------------------
  264|  6.78k|        {
  265|  6.78k|            global_hooks.deallocate(item->valuestring);
  266|  6.78k|            item->valuestring = NULL;
  267|  6.78k|        }
  268|   732k|        if (!(item->type & cJSON_StringIsConst) && (item->string != NULL))
  ------------------
  |  |  100|   732k|#define cJSON_StringIsConst 512
  ------------------
  |  Branch (268:13): [True: 732k, False: 0]
  |  Branch (268:52): [True: 27.7k, False: 704k]
  ------------------
  269|  27.7k|        {
  270|  27.7k|            global_hooks.deallocate(item->string);
  271|       |            item->string = NULL;
  272|  27.7k|        }
  273|   732k|        global_hooks.deallocate(item);
  274|   732k|        item = next;
  275|   732k|    }
  276|   302k|}
cJSON_ParseWithOpts:
 1132|  2.03k|{
 1133|  2.03k|    size_t buffer_length;
 1134|       |
 1135|  2.03k|    if (NULL == value)
  ------------------
  |  Branch (1135:9): [True: 0, False: 2.03k]
  ------------------
 1136|      0|    {
 1137|      0|        return NULL;
 1138|      0|    }
 1139|       |
 1140|       |    /* Adding null character size due to require_null_terminated. */
 1141|  2.03k|    buffer_length = strlen(value) + sizeof("");
 1142|       |
 1143|  2.03k|    return cJSON_ParseWithLengthOpts(value, buffer_length, return_parse_end, require_null_terminated);
 1144|  2.03k|}
cJSON_ParseWithLengthOpts:
 1148|  2.03k|{
 1149|  2.03k|    parse_buffer buffer = { 0, 0, 0, 0, { 0, 0, 0 } };
 1150|  2.03k|    cJSON *item = NULL;
 1151|       |
 1152|       |    /* reset error position */
 1153|  2.03k|    global_error.json = NULL;
 1154|  2.03k|    global_error.position = 0;
 1155|       |
 1156|  2.03k|    if (value == NULL || 0 == buffer_length)
  ------------------
  |  Branch (1156:9): [True: 0, False: 2.03k]
  |  Branch (1156:26): [True: 0, False: 2.03k]
  ------------------
 1157|      0|    {
 1158|      0|        goto fail;
 1159|      0|    }
 1160|       |
 1161|  2.03k|    buffer.content = (const unsigned char*)value;
 1162|  2.03k|    buffer.length = buffer_length;
 1163|  2.03k|    buffer.offset = 0;
 1164|  2.03k|    buffer.hooks = global_hooks;
 1165|       |
 1166|  2.03k|    item = cJSON_New_Item(&global_hooks);
 1167|  2.03k|    if (item == NULL) /* memory fail */
  ------------------
  |  Branch (1167:9): [True: 0, False: 2.03k]
  ------------------
 1168|      0|    {
 1169|      0|        goto fail;
 1170|      0|    }
 1171|       |
 1172|  2.03k|    if (!parse_value(item, buffer_skip_whitespace(skip_utf8_bom(&buffer))))
  ------------------
  |  Branch (1172:9): [True: 899, False: 1.13k]
  ------------------
 1173|    899|    {
 1174|       |        /* parse failure. ep is set. */
 1175|    899|        goto fail;
 1176|    899|    }
 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: 382, False: 756]
  ------------------
 1180|    382|    {
 1181|    382|        buffer_skip_whitespace(&buffer);
 1182|    382|        if ((buffer.offset >= buffer.length) || buffer_at_offset(&buffer)[0] != '\0')
  ------------------
  |  |  304|    382|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1182:13): [True: 0, False: 382]
  |  Branch (1182:49): [True: 45, False: 337]
  ------------------
 1183|     45|        {
 1184|     45|            goto fail;
 1185|     45|        }
 1186|    382|    }
 1187|  1.09k|    if (return_parse_end)
  ------------------
  |  Branch (1187:9): [True: 0, False: 1.09k]
  ------------------
 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.09k|    return item;
 1193|       |
 1194|    944|fail:
 1195|    944|    if (item != NULL)
  ------------------
  |  Branch (1195:9): [True: 944, False: 0]
  ------------------
 1196|    944|    {
 1197|    944|        cJSON_Delete(item);
 1198|    944|    }
 1199|       |
 1200|    944|    if (value != NULL)
  ------------------
  |  Branch (1200:9): [True: 944, False: 0]
  ------------------
 1201|    944|    {
 1202|    944|        error local_error;
 1203|    944|        local_error.json = (const unsigned char*)value;
 1204|    944|        local_error.position = 0;
 1205|       |
 1206|    944|        if (buffer.offset < buffer.length)
  ------------------
  |  Branch (1206:13): [True: 817, False: 127]
  ------------------
 1207|    817|        {
 1208|    817|            local_error.position = buffer.offset;
 1209|    817|        }
 1210|    127|        else if (buffer.length > 0)
  ------------------
  |  Branch (1210:18): [True: 127, False: 0]
  ------------------
 1211|    127|        {
 1212|    127|            local_error.position = buffer.length - 1;
 1213|    127|        }
 1214|       |
 1215|    944|        if (return_parse_end != NULL)
  ------------------
  |  Branch (1215:13): [True: 0, False: 944]
  ------------------
 1216|      0|        {
 1217|      0|            *return_parse_end = (const char*)local_error.json + local_error.position;
 1218|      0|        }
 1219|       |
 1220|    944|        global_error = local_error;
 1221|    944|    }
 1222|       |
 1223|       |    return NULL;
 1224|  1.13k|}
cJSON_Print:
 1308|    245|{
 1309|    245|    return (char*)print(item, true, &global_hooks);
  ------------------
  |  |   65|    245|#define true ((cJSON_bool)1)
  ------------------
 1310|    245|}
cJSON_PrintUnformatted:
 1313|    266|{
 1314|    266|    return (char*)print(item, false, &global_hooks);
  ------------------
  |  |   70|    266|#define false ((cJSON_bool)0)
  ------------------
 1315|    266|}
cJSON_PrintBuffered:
 1318|    582|{
 1319|    582|    printbuffer p = { 0, 0, 0, 0, 0, 0, { 0, 0, 0 } };
 1320|       |
 1321|    582|    if (prebuffer < 0)
  ------------------
  |  Branch (1321:9): [True: 0, False: 582]
  ------------------
 1322|      0|    {
 1323|      0|        return NULL;
 1324|      0|    }
 1325|       |
 1326|    582|    p.buffer = (unsigned char*)global_hooks.allocate((size_t)prebuffer);
 1327|    582|    if (!p.buffer)
  ------------------
  |  Branch (1327:9): [True: 0, False: 582]
  ------------------
 1328|      0|    {
 1329|      0|        return NULL;
 1330|      0|    }
 1331|       |
 1332|    582|    p.length = (size_t)prebuffer;
 1333|    582|    p.offset = 0;
 1334|    582|    p.noalloc = false;
  ------------------
  |  |   70|    582|#define false ((cJSON_bool)0)
  ------------------
 1335|    582|    p.format = fmt;
 1336|    582|    p.hooks = global_hooks;
 1337|       |
 1338|    582|    if (!print_value(item, &p))
  ------------------
  |  Branch (1338:9): [True: 0, False: 582]
  ------------------
 1339|      0|    {
 1340|      0|        global_hooks.deallocate(p.buffer);
 1341|      0|        p.buffer = NULL;
 1342|      0|        return NULL;
 1343|      0|    }
 1344|       |
 1345|    582|    return (char*)p.buffer;
 1346|    582|}
cJSON_Minify:
 2925|    902|{
 2926|    902|    char *into = json;
 2927|       |
 2928|    902|    if (json == NULL)
  ------------------
  |  Branch (2928:9): [True: 0, False: 902]
  ------------------
 2929|      0|    {
 2930|      0|        return;
 2931|      0|    }
 2932|       |
 2933|  2.34M|    while (json[0] != '\0')
  ------------------
  |  Branch (2933:12): [True: 2.34M, False: 902]
  ------------------
 2934|  2.34M|    {
 2935|  2.34M|        switch (json[0])
 2936|  2.34M|        {
 2937|    252|            case ' ':
  ------------------
  |  Branch (2937:13): [True: 252, False: 2.34M]
  ------------------
 2938|    448|            case '\t':
  ------------------
  |  Branch (2938:13): [True: 196, False: 2.34M]
  ------------------
 2939|    961|            case '\r':
  ------------------
  |  Branch (2939:13): [True: 513, False: 2.34M]
  ------------------
 2940|  2.36k|            case '\n':
  ------------------
  |  Branch (2940:13): [True: 1.40k, False: 2.34M]
  ------------------
 2941|  2.36k|                json++;
 2942|  2.36k|                break;
 2943|       |
 2944|  1.21k|            case '/':
  ------------------
  |  Branch (2944:13): [True: 1.21k, False: 2.34M]
  ------------------
 2945|  1.21k|                if (json[1] == '/')
  ------------------
  |  Branch (2945:21): [True: 443, False: 776]
  ------------------
 2946|    443|                {
 2947|    443|                    skip_oneline_comment(&json);
 2948|    443|                }
 2949|    776|                else if (json[1] == '*')
  ------------------
  |  Branch (2949:26): [True: 338, False: 438]
  ------------------
 2950|    338|                {
 2951|    338|                    skip_multiline_comment(&json);
 2952|    438|                } else {
 2953|    438|                    json++;
 2954|    438|                }
 2955|  1.21k|                break;
 2956|       |
 2957|  16.1k|            case '\"':
  ------------------
  |  Branch (2957:13): [True: 16.1k, False: 2.33M]
  ------------------
 2958|  16.1k|                minify_string(&json, (char**)&into);
 2959|  16.1k|                break;
 2960|       |
 2961|  2.32M|            default:
  ------------------
  |  Branch (2961:13): [True: 2.32M, False: 19.6k]
  ------------------
 2962|  2.32M|                into[0] = json[0];
 2963|  2.32M|                json++;
 2964|  2.32M|                into++;
 2965|  2.34M|        }
 2966|  2.34M|    }
 2967|       |
 2968|       |    /* and null-terminate. */
 2969|    902|    *into = '\0';
 2970|    902|}
cJSON.c:cJSON_New_Item:
  242|   732k|{
  243|   732k|    cJSON* node = (cJSON*)hooks->allocate(sizeof(cJSON));
  244|   732k|    if (node)
  ------------------
  |  Branch (244:9): [True: 732k, False: 0]
  ------------------
  245|   732k|    {
  246|   732k|        memset(node, '\0', sizeof(cJSON));
  247|   732k|    }
  248|       |
  249|   732k|    return node;
  250|   732k|}
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.82M|    while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
  ------------------
  |  |  301|  7.64M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 3.82M, False: 0]
  |  |  |  Branch (301:65): [True: 3.82M, False: 958]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(buffer, 0) && (buffer_at_offset(buffer)[0] <= 32))
  ------------------
  |  |  304|  3.82M|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1102:46): [True: 1.65M, False: 2.16M]
  ------------------
 1103|  1.65M|    {
 1104|  1.65M|       buffer->offset++;
 1105|  1.65M|    }
 1106|       |
 1107|  2.16M|    if (buffer->offset == buffer->length)
  ------------------
  |  Branch (1107:9): [True: 958, False: 2.16M]
  ------------------
 1108|    958|    {
 1109|    958|        buffer->offset--;
 1110|    958|    }
 1111|       |
 1112|  2.16M|    return buffer;
 1113|  2.16M|}
cJSON.c:skip_utf8_bom:
 1117|  2.03k|{
 1118|  2.03k|    if ((buffer == NULL) || (buffer->content == NULL) || (buffer->offset != 0))
  ------------------
  |  Branch (1118:9): [True: 0, False: 2.03k]
  |  Branch (1118:29): [True: 0, False: 2.03k]
  |  Branch (1118:58): [True: 0, False: 2.03k]
  ------------------
 1119|      0|    {
 1120|      0|        return NULL;
 1121|      0|    }
 1122|       |
 1123|  2.03k|    if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0))
  ------------------
  |  |  301|  4.07k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 2.03k, False: 0]
  |  |  |  Branch (301:65): [True: 1.75k, False: 287]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(buffer, 4) && (strncmp((const char*)buffer_at_offset(buffer), "\xEF\xBB\xBF", 3) == 0))
  ------------------
  |  |  304|  1.75k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1123:43): [True: 104, False: 1.64k]
  ------------------
 1124|    104|    {
 1125|    104|        buffer->offset += 3;
 1126|    104|    }
 1127|       |
 1128|  2.03k|    return buffer;
 1129|  2.03k|}
cJSON.c:print:
 1240|    511|{
 1241|    511|    static const size_t default_buffer_size = 256;
 1242|    511|    printbuffer buffer[1];
 1243|    511|    unsigned char *printed = NULL;
 1244|       |
 1245|    511|    memset(buffer, 0, sizeof(buffer));
 1246|       |
 1247|       |    /* create buffer */
 1248|    511|    buffer->buffer = (unsigned char*) hooks->allocate(default_buffer_size);
 1249|    511|    buffer->length = default_buffer_size;
 1250|    511|    buffer->format = format;
 1251|    511|    buffer->hooks = *hooks;
 1252|    511|    if (buffer->buffer == NULL)
  ------------------
  |  Branch (1252:9): [True: 0, False: 511]
  ------------------
 1253|      0|    {
 1254|      0|        goto fail;
 1255|      0|    }
 1256|       |
 1257|       |    /* print the value */
 1258|    511|    if (!print_value(item, buffer))
  ------------------
  |  Branch (1258:9): [True: 0, False: 511]
  ------------------
 1259|      0|    {
 1260|      0|        goto fail;
 1261|      0|    }
 1262|    511|    update_offset(buffer);
 1263|       |
 1264|       |    /* check if reallocate is available */
 1265|    511|    if (hooks->reallocate != NULL)
  ------------------
  |  Branch (1265:9): [True: 511, False: 0]
  ------------------
 1266|    511|    {
 1267|    511|        printed = (unsigned char*) hooks->reallocate(buffer->buffer, buffer->offset + 1);
 1268|    511|        if (printed == NULL) {
  ------------------
  |  Branch (1268:13): [True: 0, False: 511]
  ------------------
 1269|      0|            goto fail;
 1270|      0|        }
 1271|    511|        buffer->buffer = NULL;
 1272|    511|    }
 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|    511|    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|    511|}
cJSON.c:update_offset:
  577|   675k|{
  578|   675k|    const unsigned char *buffer_pointer = NULL;
  579|   675k|    if ((buffer == NULL) || (buffer->buffer == NULL))
  ------------------
  |  Branch (579:9): [True: 0, False: 675k]
  |  Branch (579:29): [True: 0, False: 675k]
  ------------------
  580|      0|    {
  581|      0|        return;
  582|      0|    }
  583|   675k|    buffer_pointer = buffer->buffer + buffer->offset;
  584|       |
  585|   675k|    buffer->offset += strlen((const char*)buffer_pointer);
  586|   675k|}
cJSON.c:parse_value:
 1369|   732k|{
 1370|   732k|    if ((input_buffer == NULL) || (input_buffer->content == NULL))
  ------------------
  |  Branch (1370:9): [True: 0, False: 732k]
  |  Branch (1370:35): [True: 0, False: 732k]
  ------------------
 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|   732k|    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: 732k, False: 0]
  |  |  |  Branch (299:53): [True: 731k, False: 887]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "null", 4) == 0))
  ------------------
  |  |  304|   731k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1377:38): [True: 514, False: 731k]
  ------------------
 1378|    514|    {
 1379|    514|        item->type = cJSON_NULL;
  ------------------
  |  |   92|    514|#define cJSON_NULL   (1 << 2)
  ------------------
 1380|    514|        input_buffer->offset += 4;
 1381|    514|        return true;
  ------------------
  |  |   65|    514|#define true ((cJSON_bool)1)
  ------------------
 1382|    514|    }
 1383|       |    /* false */
 1384|   731k|    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: 731k, False: 0]
  |  |  |  Branch (299:53): [True: 730k, False: 1.25k]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 5) && (strncmp((const char*)buffer_at_offset(input_buffer), "false", 5) == 0))
  ------------------
  |  |  304|   730k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1384:38): [True: 768, False: 729k]
  ------------------
 1385|    768|    {
 1386|    768|        item->type = cJSON_False;
  ------------------
  |  |   90|    768|#define cJSON_False  (1 << 0)
  ------------------
 1387|    768|        input_buffer->offset += 5;
 1388|    768|        return true;
  ------------------
  |  |   65|    768|#define true ((cJSON_bool)1)
  ------------------
 1389|    768|    }
 1390|       |    /* true */
 1391|   731k|    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: 731k, False: 0]
  |  |  |  Branch (299:53): [True: 730k, False: 887]
  |  |  ------------------
  ------------------
                  if (can_read(input_buffer, 4) && (strncmp((const char*)buffer_at_offset(input_buffer), "true", 4) == 0))
  ------------------
  |  |  304|   730k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1391:38): [True: 1.14k, False: 729k]
  ------------------
 1392|  1.14k|    {
 1393|  1.14k|        item->type = cJSON_True;
  ------------------
  |  |   91|  1.14k|#define cJSON_True   (1 << 1)
  ------------------
 1394|  1.14k|        item->valueint = 1;
 1395|  1.14k|        input_buffer->offset += 4;
 1396|  1.14k|        return true;
  ------------------
  |  |   65|  1.14k|#define true ((cJSON_bool)1)
  ------------------
 1397|  1.14k|    }
 1398|       |    /* string */
 1399|   730k|    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: 730k, False: 0]
  |  |  |  Branch (301:65): [True: 730k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '\"'))
  ------------------
  |  |  304|   730k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1399:49): [True: 6.98k, False: 723k]
  ------------------
 1400|  6.98k|    {
 1401|  6.98k|        return parse_string(item, input_buffer);
 1402|  6.98k|    }
 1403|       |    /* number */
 1404|   723k|    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.44M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 723k, False: 0]
  |  |  |  Branch (301:65): [True: 723k, 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|   723k|#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|   722k|#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|   721k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1404:50): [True: 902, False: 722k]
  |  Branch (1404:97): [True: 721k, False: 163]
  |  Branch (1404:143): [True: 24.0k, False: 697k]
  ------------------
 1405|  24.9k|    {
 1406|  24.9k|        return parse_number(item, input_buffer);
 1407|  24.9k|    }
 1408|       |    /* array */
 1409|   698k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '['))
  ------------------
  |  |  301|  1.39M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 698k, False: 0]
  |  |  |  Branch (301:65): [True: 698k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '['))
  ------------------
  |  |  304|   698k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1409:49): [True: 290k, False: 407k]
  ------------------
 1410|   290k|    {
 1411|   290k|        return parse_array(item, input_buffer);
 1412|   290k|    }
 1413|       |    /* object */
 1414|   407k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{'))
  ------------------
  |  |  301|   814k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 407k, False: 0]
  |  |  |  Branch (301:65): [True: 407k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '{'))
  ------------------
  |  |  304|   407k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1414:49): [True: 406k, False: 328]
  ------------------
 1415|   406k|    {
 1416|   406k|        return parse_object(item, input_buffer);
 1417|   406k|    }
 1418|       |
 1419|    328|    return false;
  ------------------
  |  |   70|    328|#define false ((cJSON_bool)0)
  ------------------
 1420|   407k|}
cJSON.c:parse_string:
  825|  34.8k|{
  826|  34.8k|    const unsigned char *input_pointer = buffer_at_offset(input_buffer) + 1;
  ------------------
  |  |  304|  34.8k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  827|  34.8k|    const unsigned char *input_end = buffer_at_offset(input_buffer) + 1;
  ------------------
  |  |  304|  34.8k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  828|  34.8k|    unsigned char *output_pointer = NULL;
  829|  34.8k|    unsigned char *output = NULL;
  830|       |
  831|       |    /* not a string */
  832|  34.8k|    if (buffer_at_offset(input_buffer)[0] != '\"')
  ------------------
  |  |  304|  34.8k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (832:9): [True: 145, False: 34.7k]
  ------------------
  833|    145|    {
  834|    145|        goto fail;
  835|    145|    }
  836|       |
  837|  34.7k|    {
  838|       |        /* calculate approximate size of the output (overestimate) */
  839|  34.7k|        size_t allocation_length = 0;
  840|  34.7k|        size_t skipped_bytes = 0;
  841|  26.0M|        while (((size_t)(input_end - input_buffer->content) < input_buffer->length) && (*input_end != '\"'))
  ------------------
  |  Branch (841:16): [True: 26.0M, False: 76]
  |  Branch (841:88): [True: 25.9M, False: 34.6k]
  ------------------
  842|  25.9M|        {
  843|       |            /* is escape sequence */
  844|  25.9M|            if (input_end[0] == '\\')
  ------------------
  |  Branch (844:17): [True: 196k, False: 25.7M]
  ------------------
  845|   196k|            {
  846|   196k|                if ((size_t)(input_end + 1 - input_buffer->content) >= input_buffer->length)
  ------------------
  |  Branch (846:21): [True: 0, False: 196k]
  ------------------
  847|      0|                {
  848|       |                    /* prevent buffer overflow when last input character is a backslash */
  849|      0|                    goto fail;
  850|      0|                }
  851|   196k|                skipped_bytes++;
  852|   196k|                input_end++;
  853|   196k|            }
  854|  25.9M|            input_end++;
  855|  25.9M|        }
  856|  34.7k|        if (((size_t)(input_end - input_buffer->content) >= input_buffer->length) || (*input_end != '\"'))
  ------------------
  |  Branch (856:13): [True: 76, False: 34.6k]
  |  Branch (856:86): [True: 0, False: 34.6k]
  ------------------
  857|     76|        {
  858|     76|            goto fail; /* string ended unexpectedly */
  859|     76|        }
  860|       |
  861|       |        /* This is at most how much we need for the output */
  862|  34.6k|        allocation_length = (size_t) (input_end - buffer_at_offset(input_buffer)) - skipped_bytes;
  ------------------
  |  |  304|  34.6k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  863|  34.6k|        output = (unsigned char*)input_buffer->hooks.allocate(allocation_length + sizeof(""));
  864|  34.6k|        if (output == NULL)
  ------------------
  |  Branch (864:13): [True: 0, False: 34.6k]
  ------------------
  865|      0|        {
  866|      0|            goto fail; /* allocation failure */
  867|      0|        }
  868|  34.6k|    }
  869|       |
  870|  34.6k|    output_pointer = output;
  871|       |    /* loop through the string literal */
  872|  23.0M|    while (input_pointer < input_end)
  ------------------
  |  Branch (872:12): [True: 23.0M, False: 34.5k]
  ------------------
  873|  23.0M|    {
  874|  23.0M|        if (*input_pointer != '\\')
  ------------------
  |  Branch (874:13): [True: 22.8M, False: 164k]
  ------------------
  875|  22.8M|        {
  876|  22.8M|            *output_pointer++ = *input_pointer++;
  877|  22.8M|        }
  878|       |        /* escape sequence */
  879|   164k|        else
  880|   164k|        {
  881|   164k|            unsigned char sequence_length = 2;
  882|   164k|            if ((input_end - input_pointer) < 1)
  ------------------
  |  Branch (882:17): [True: 0, False: 164k]
  ------------------
  883|      0|            {
  884|      0|                goto fail;
  885|      0|            }
  886|       |
  887|   164k|            switch (input_pointer[1])
  888|   164k|            {
  889|  9.40k|                case 'b':
  ------------------
  |  Branch (889:17): [True: 9.40k, False: 155k]
  ------------------
  890|  9.40k|                    *output_pointer++ = '\b';
  891|  9.40k|                    break;
  892|  10.6k|                case 'f':
  ------------------
  |  Branch (892:17): [True: 10.6k, False: 154k]
  ------------------
  893|  10.6k|                    *output_pointer++ = '\f';
  894|  10.6k|                    break;
  895|  9.42k|                case 'n':
  ------------------
  |  Branch (895:17): [True: 9.42k, False: 155k]
  ------------------
  896|  9.42k|                    *output_pointer++ = '\n';
  897|  9.42k|                    break;
  898|  5.77k|                case 'r':
  ------------------
  |  Branch (898:17): [True: 5.77k, False: 158k]
  ------------------
  899|  5.77k|                    *output_pointer++ = '\r';
  900|  5.77k|                    break;
  901|  12.3k|                case 't':
  ------------------
  |  Branch (901:17): [True: 12.3k, False: 152k]
  ------------------
  902|  12.3k|                    *output_pointer++ = '\t';
  903|  12.3k|                    break;
  904|  18.4k|                case '\"':
  ------------------
  |  Branch (904:17): [True: 18.4k, False: 146k]
  ------------------
  905|  32.8k|                case '\\':
  ------------------
  |  Branch (905:17): [True: 14.4k, False: 150k]
  ------------------
  906|  52.4k|                case '/':
  ------------------
  |  Branch (906:17): [True: 19.5k, False: 145k]
  ------------------
  907|  52.4k|                    *output_pointer++ = input_pointer[1];
  908|  52.4k|                    break;
  909|       |
  910|       |                /* UTF-16 literal */
  911|  64.6k|                case 'u':
  ------------------
  |  Branch (911:17): [True: 64.6k, False: 100k]
  ------------------
  912|  64.6k|                    sequence_length = utf16_literal_to_utf8(input_pointer, input_end, &output_pointer);
  913|  64.6k|                    if (sequence_length == 0)
  ------------------
  |  Branch (913:25): [True: 123, False: 64.5k]
  ------------------
  914|    123|                    {
  915|       |                        /* failed to convert UTF16-literal to UTF-8 */
  916|    123|                        goto fail;
  917|    123|                    }
  918|  64.5k|                    break;
  919|       |
  920|  64.5k|                default:
  ------------------
  |  Branch (920:17): [True: 15, False: 164k]
  ------------------
  921|     15|                    goto fail;
  922|   164k|            }
  923|   164k|            input_pointer += sequence_length;
  924|   164k|        }
  925|  23.0M|    }
  926|       |
  927|       |    /* zero terminate the output */
  928|  34.5k|    *output_pointer = '\0';
  929|       |
  930|  34.5k|    item->type = cJSON_String;
  ------------------
  |  |   94|  34.5k|#define cJSON_String (1 << 4)
  ------------------
  931|  34.5k|    item->valuestring = (char*)output;
  932|       |
  933|  34.5k|    input_buffer->offset = (size_t) (input_end - input_buffer->content);
  934|  34.5k|    input_buffer->offset++;
  935|       |
  936|  34.5k|    return true;
  ------------------
  |  |   65|  34.5k|#define true ((cJSON_bool)1)
  ------------------
  937|       |
  938|    359|fail:
  939|    359|    if (output != NULL)
  ------------------
  |  Branch (939:9): [True: 138, False: 221]
  ------------------
  940|    138|    {
  941|    138|        input_buffer->hooks.deallocate(output);
  942|    138|        output = NULL;
  943|    138|    }
  944|       |
  945|    359|    if (input_pointer != NULL)
  ------------------
  |  Branch (945:9): [True: 359, False: 0]
  ------------------
  946|    359|    {
  947|    359|        input_buffer->offset = (size_t)(input_pointer - input_buffer->content);
  948|    359|    }
  949|       |
  950|    359|    return false;
  ------------------
  |  |   70|    359|#define false ((cJSON_bool)0)
  ------------------
  951|  34.6k|}
cJSON.c:utf16_literal_to_utf8:
  704|  64.6k|{
  705|  64.6k|    long unsigned int codepoint = 0;
  706|  64.6k|    unsigned int first_code = 0;
  707|  64.6k|    const unsigned char *first_sequence = input_pointer;
  708|  64.6k|    unsigned char utf8_length = 0;
  709|  64.6k|    unsigned char utf8_position = 0;
  710|  64.6k|    unsigned char sequence_length = 0;
  711|  64.6k|    unsigned char first_byte_mark = 0;
  712|       |
  713|  64.6k|    if ((input_end - first_sequence) < 6)
  ------------------
  |  Branch (713:9): [True: 4, False: 64.6k]
  ------------------
  714|      4|    {
  715|       |        /* input ends unexpectedly */
  716|      4|        goto fail;
  717|      4|    }
  718|       |
  719|       |    /* get the first utf16 sequence */
  720|  64.6k|    first_code = parse_hex4(first_sequence + 2);
  721|       |
  722|       |    /* check that the code is valid */
  723|  64.6k|    if (((first_code >= 0xDC00) && (first_code <= 0xDFFF)))
  ------------------
  |  Branch (723:10): [True: 5.80k, False: 58.8k]
  |  Branch (723:36): [True: 16, False: 5.78k]
  ------------------
  724|     16|    {
  725|     16|        goto fail;
  726|     16|    }
  727|       |
  728|       |    /* UTF16 surrogate pair */
  729|  64.6k|    if ((first_code >= 0xD800) && (first_code <= 0xDBFF))
  ------------------
  |  Branch (729:9): [True: 9.29k, False: 55.3k]
  |  Branch (729:35): [True: 3.50k, False: 5.78k]
  ------------------
  730|  3.50k|    {
  731|  3.50k|        const unsigned char *second_sequence = first_sequence + 6;
  732|  3.50k|        unsigned int second_code = 0;
  733|  3.50k|        sequence_length = 12; /* \uXXXX\uXXXX */
  734|       |
  735|  3.50k|        if ((input_end - second_sequence) < 6)
  ------------------
  |  Branch (735:13): [True: 19, False: 3.48k]
  ------------------
  736|     19|        {
  737|       |            /* input ends unexpectedly */
  738|     19|            goto fail;
  739|     19|        }
  740|       |
  741|  3.48k|        if ((second_sequence[0] != '\\') || (second_sequence[1] != 'u'))
  ------------------
  |  Branch (741:13): [True: 14, False: 3.47k]
  |  Branch (741:45): [True: 12, False: 3.45k]
  ------------------
  742|     26|        {
  743|       |            /* missing second half of the surrogate pair */
  744|     26|            goto fail;
  745|     26|        }
  746|       |
  747|       |        /* get the second utf16 sequence */
  748|  3.45k|        second_code = parse_hex4(second_sequence + 2);
  749|       |        /* check that the code is valid */
  750|  3.45k|        if ((second_code < 0xDC00) || (second_code > 0xDFFF))
  ------------------
  |  Branch (750:13): [True: 53, False: 3.40k]
  |  Branch (750:39): [True: 5, False: 3.40k]
  ------------------
  751|     58|        {
  752|       |            /* invalid second half of the surrogate pair */
  753|     58|            goto fail;
  754|     58|        }
  755|       |
  756|       |
  757|       |        /* calculate the unicode codepoint from the surrogate pair */
  758|  3.40k|        codepoint = 0x10000 + (((first_code & 0x3FF) << 10) | (second_code & 0x3FF));
  759|  3.40k|    }
  760|  61.1k|    else
  761|  61.1k|    {
  762|  61.1k|        sequence_length = 6; /* \uXXXX */
  763|  61.1k|        codepoint = first_code;
  764|  61.1k|    }
  765|       |
  766|       |    /* encode as UTF-8
  767|       |     * takes at maximum 4 bytes to encode:
  768|       |     * 11110xxx 10xxxxxx 10xxxxxx 10xxxxxx */
  769|  64.5k|    if (codepoint < 0x80)
  ------------------
  |  Branch (769:9): [True: 34.9k, False: 29.5k]
  ------------------
  770|  34.9k|    {
  771|       |        /* normal ascii, encoding 0xxxxxxx */
  772|  34.9k|        utf8_length = 1;
  773|  34.9k|    }
  774|  29.5k|    else if (codepoint < 0x800)
  ------------------
  |  Branch (774:14): [True: 5.30k, False: 24.2k]
  ------------------
  775|  5.30k|    {
  776|       |        /* two bytes, encoding 110xxxxx 10xxxxxx */
  777|  5.30k|        utf8_length = 2;
  778|  5.30k|        first_byte_mark = 0xC0; /* 11000000 */
  779|  5.30k|    }
  780|  24.2k|    else if (codepoint < 0x10000)
  ------------------
  |  Branch (780:14): [True: 20.8k, False: 3.40k]
  ------------------
  781|  20.8k|    {
  782|       |        /* three bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx */
  783|  20.8k|        utf8_length = 3;
  784|  20.8k|        first_byte_mark = 0xE0; /* 11100000 */
  785|  20.8k|    }
  786|  3.40k|    else if (codepoint <= 0x10FFFF)
  ------------------
  |  Branch (786:14): [True: 3.40k, False: 0]
  ------------------
  787|  3.40k|    {
  788|       |        /* four bytes, encoding 1110xxxx 10xxxxxx 10xxxxxx 10xxxxxx */
  789|  3.40k|        utf8_length = 4;
  790|  3.40k|        first_byte_mark = 0xF0; /* 11110000 */
  791|  3.40k|    }
  792|      0|    else
  793|      0|    {
  794|       |        /* invalid unicode codepoint */
  795|      0|        goto fail;
  796|      0|    }
  797|       |
  798|       |    /* encode as utf8 */
  799|   121k|    for (utf8_position = (unsigned char)(utf8_length - 1); utf8_position > 0; utf8_position--)
  ------------------
  |  Branch (799:60): [True: 57.1k, False: 64.5k]
  ------------------
  800|  57.1k|    {
  801|       |        /* 10xxxxxx */
  802|  57.1k|        (*output_pointer)[utf8_position] = (unsigned char)((codepoint | 0x80) & 0xBF);
  803|  57.1k|        codepoint >>= 6;
  804|  57.1k|    }
  805|       |    /* encode first byte */
  806|  64.5k|    if (utf8_length > 1)
  ------------------
  |  Branch (806:9): [True: 29.5k, False: 34.9k]
  ------------------
  807|  29.5k|    {
  808|  29.5k|        (*output_pointer)[0] = (unsigned char)((codepoint | first_byte_mark) & 0xFF);
  809|  29.5k|    }
  810|  34.9k|    else
  811|  34.9k|    {
  812|  34.9k|        (*output_pointer)[0] = (unsigned char)(codepoint & 0x7F);
  813|  34.9k|    }
  814|       |
  815|  64.5k|    *output_pointer += utf8_length;
  816|       |
  817|  64.5k|    return sequence_length;
  818|       |
  819|    123|fail:
  820|    123|    return 0;
  821|  64.5k|}
cJSON.c:parse_hex4:
  667|  68.0k|{
  668|  68.0k|    unsigned int h = 0;
  669|  68.0k|    size_t i = 0;
  670|       |
  671|   257k|    for (i = 0; i < 4; i++)
  ------------------
  |  Branch (671:17): [True: 220k, False: 37.3k]
  ------------------
  672|   220k|    {
  673|       |        /* parse digit */
  674|   220k|        if ((input[i] >= '0') && (input[i] <= '9'))
  ------------------
  |  Branch (674:13): [True: 213k, False: 6.07k]
  |  Branch (674:34): [True: 83.0k, False: 130k]
  ------------------
  675|  83.0k|        {
  676|  83.0k|            h += (unsigned int) input[i] - '0';
  677|  83.0k|        }
  678|   136k|        else if ((input[i] >= 'A') && (input[i] <= 'F'))
  ------------------
  |  Branch (678:18): [True: 126k, False: 10.6k]
  |  Branch (678:39): [True: 23.8k, False: 102k]
  ------------------
  679|  23.8k|        {
  680|  23.8k|            h += (unsigned int) 10 + input[i] - 'A';
  681|  23.8k|        }
  682|   113k|        else if ((input[i] >= 'a') && (input[i] <= 'f'))
  ------------------
  |  Branch (682:18): [True: 100k, False: 12.1k]
  |  Branch (682:39): [True: 82.3k, False: 18.6k]
  ------------------
  683|  82.3k|        {
  684|  82.3k|            h += (unsigned int) 10 + input[i] - 'a';
  685|  82.3k|        }
  686|  30.7k|        else /* invalid */
  687|  30.7k|        {
  688|  30.7k|            return 0;
  689|  30.7k|        }
  690|       |
  691|   189k|        if (i < 3)
  ------------------
  |  Branch (691:13): [True: 151k, False: 37.3k]
  ------------------
  692|   151k|        {
  693|       |            /* shift left to make place for the next nibble */
  694|   151k|            h = h << 4;
  695|   151k|        }
  696|   189k|    }
  697|       |
  698|  37.3k|    return h;
  699|  68.0k|}
cJSON.c:parse_number:
  308|  24.9k|{
  309|  24.9k|    double number = 0;
  310|  24.9k|    unsigned char *after_end = NULL;
  311|  24.9k|    unsigned char *number_c_string;
  312|  24.9k|    unsigned char decimal_point = get_decimal_point();
  313|  24.9k|    size_t i = 0;
  314|  24.9k|    size_t number_string_length = 0;
  315|  24.9k|    cJSON_bool has_decimal_point = false;
  ------------------
  |  |   70|  24.9k|#define false ((cJSON_bool)0)
  ------------------
  316|       |
  317|  24.9k|    if ((input_buffer == NULL) || (input_buffer->content == NULL))
  ------------------
  |  Branch (317:9): [True: 0, False: 24.9k]
  |  Branch (317:35): [True: 0, False: 24.9k]
  ------------------
  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|   594k|    for (i = 0; can_access_at_index(input_buffer, i); i++)
  ------------------
  |  |  301|   594k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 594k, False: 0]
  |  |  |  Branch (301:65): [True: 594k, False: 0]
  |  |  ------------------
  ------------------
  326|   594k|    {
  327|   594k|        switch (buffer_at_offset(input_buffer)[i])
  ------------------
  |  |  304|   594k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  328|   594k|        {
  329|   398k|            case '0':
  ------------------
  |  Branch (329:13): [True: 398k, False: 196k]
  ------------------
  330|   426k|            case '1':
  ------------------
  |  Branch (330:13): [True: 28.0k, False: 566k]
  ------------------
  331|   440k|            case '2':
  ------------------
  |  Branch (331:13): [True: 14.0k, False: 580k]
  ------------------
  332|   444k|            case '3':
  ------------------
  |  Branch (332:13): [True: 3.44k, False: 591k]
  ------------------
  333|   448k|            case '4':
  ------------------
  |  Branch (333:13): [True: 4.65k, False: 590k]
  ------------------
  334|   455k|            case '5':
  ------------------
  |  Branch (334:13): [True: 6.93k, False: 587k]
  ------------------
  335|   465k|            case '6':
  ------------------
  |  Branch (335:13): [True: 9.20k, False: 585k]
  ------------------
  336|   474k|            case '7':
  ------------------
  |  Branch (336:13): [True: 9.34k, False: 585k]
  ------------------
  337|   481k|            case '8':
  ------------------
  |  Branch (337:13): [True: 7.07k, False: 587k]
  ------------------
  338|   501k|            case '9':
  ------------------
  |  Branch (338:13): [True: 20.3k, False: 574k]
  ------------------
  339|   506k|            case '+':
  ------------------
  |  Branch (339:13): [True: 4.99k, False: 589k]
  ------------------
  340|   556k|            case '-':
  ------------------
  |  Branch (340:13): [True: 49.8k, False: 544k]
  ------------------
  341|   558k|            case 'e':
  ------------------
  |  Branch (341:13): [True: 2.11k, False: 592k]
  ------------------
  342|   562k|            case 'E':
  ------------------
  |  Branch (342:13): [True: 3.86k, False: 590k]
  ------------------
  343|   562k|                number_string_length++;
  344|   562k|                break;
  345|       |
  346|  7.33k|            case '.':
  ------------------
  |  Branch (346:13): [True: 7.33k, False: 587k]
  ------------------
  347|  7.33k|                number_string_length++;
  348|  7.33k|                has_decimal_point = true;
  ------------------
  |  |   65|  7.33k|#define true ((cJSON_bool)1)
  ------------------
  349|  7.33k|                break;
  350|       |
  351|  24.9k|            default:
  ------------------
  |  Branch (351:13): [True: 24.9k, False: 569k]
  ------------------
  352|  24.9k|                goto loop_end;
  353|   594k|        }
  354|   594k|    }
  355|  24.9k|loop_end:
  356|       |    /* malloc for temporary buffer, add 1 for '\0' */
  357|  24.9k|    number_c_string = (unsigned char *) input_buffer->hooks.allocate(number_string_length + 1);
  358|  24.9k|    if (number_c_string == NULL)
  ------------------
  |  Branch (358:9): [True: 0, False: 24.9k]
  ------------------
  359|      0|    {
  360|      0|        return false; /* allocation failure */
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  361|      0|    }
  362|       |
  363|  24.9k|    memcpy(number_c_string, buffer_at_offset(input_buffer), number_string_length);
  ------------------
  |  |  304|  24.9k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  364|  24.9k|    number_c_string[number_string_length] = '\0';
  365|       |
  366|  24.9k|    if (has_decimal_point)
  ------------------
  |  Branch (366:9): [True: 516, False: 24.4k]
  ------------------
  367|    516|    {
  368|   527k|        for (i = 0; i < number_string_length; i++)
  ------------------
  |  Branch (368:21): [True: 526k, False: 516]
  ------------------
  369|   526k|        {
  370|   526k|            if (number_c_string[i] == '.')
  ------------------
  |  Branch (370:17): [True: 7.33k, False: 519k]
  ------------------
  371|  7.33k|            {
  372|       |                /* replace '.' with the decimal point of the current locale (for strtod) */
  373|  7.33k|                number_c_string[i] = decimal_point;
  374|  7.33k|            }
  375|   526k|        }
  376|    516|    }
  377|       |
  378|  24.9k|    number = strtod((const char*)number_c_string, (char**)&after_end);
  379|  24.9k|    if (number_c_string == after_end)
  ------------------
  |  Branch (379:9): [True: 20, False: 24.8k]
  ------------------
  380|     20|    {
  381|       |        /* free the temporary buffer */
  382|     20|        input_buffer->hooks.deallocate(number_c_string);
  383|     20|        return false; /* parse_error */
  ------------------
  |  |   70|     20|#define false ((cJSON_bool)0)
  ------------------
  384|     20|    }
  385|       |
  386|  24.8k|    item->valuedouble = number;
  387|       |
  388|       |    /* use saturation in case of overflow */
  389|  24.8k|    if (number >= INT_MAX)
  ------------------
  |  Branch (389:9): [True: 1.37k, False: 23.5k]
  ------------------
  390|  1.37k|    {
  391|  1.37k|        item->valueint = INT_MAX;
  392|  1.37k|    }
  393|  23.5k|    else if (number <= (double)INT_MIN)
  ------------------
  |  Branch (393:14): [True: 311, False: 23.2k]
  ------------------
  394|    311|    {
  395|    311|        item->valueint = INT_MIN;
  396|    311|    }
  397|  23.2k|    else
  398|  23.2k|    {
  399|  23.2k|        item->valueint = (int)number;
  400|  23.2k|    }
  401|       |
  402|  24.8k|    item->type = cJSON_Number;
  ------------------
  |  |   93|  24.8k|#define cJSON_Number (1 << 3)
  ------------------
  403|       |
  404|  24.8k|    input_buffer->offset += (size_t)(after_end - number_c_string);
  405|       |    /* free the temporary buffer */
  406|  24.8k|    input_buffer->hooks.deallocate(number_c_string);
  407|  24.8k|    return true;
  ------------------
  |  |   65|  24.8k|#define true ((cJSON_bool)1)
  ------------------
  408|  24.9k|}
cJSON.c:get_decimal_point:
  280|  43.2k|{
  281|  43.2k|#ifdef ENABLE_LOCALES
  282|  43.2k|    struct lconv *lconv = localeconv();
  283|  43.2k|    return (unsigned char) lconv->decimal_point[0];
  284|       |#else
  285|       |    return '.';
  286|       |#endif
  287|  43.2k|}
cJSON.c:parse_array:
 1498|   290k|{
 1499|   290k|    cJSON *head = NULL; /* head of the linked list */
 1500|   290k|    cJSON *current_item = NULL;
 1501|       |
 1502|   290k|    if (input_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   290k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1502:9): [True: 2, False: 290k]
  ------------------
 1503|      2|    {
 1504|      2|        return false; /* to deeply nested */
  ------------------
  |  |   70|      2|#define false ((cJSON_bool)0)
  ------------------
 1505|      2|    }
 1506|   290k|    input_buffer->depth++;
 1507|       |
 1508|   290k|    if (buffer_at_offset(input_buffer)[0] != '[')
  ------------------
  |  |  304|   290k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1508:9): [True: 0, False: 290k]
  ------------------
 1509|      0|    {
 1510|       |        /* not an array */
 1511|      0|        goto fail;
 1512|      0|    }
 1513|       |
 1514|   290k|    input_buffer->offset++;
 1515|   290k|    buffer_skip_whitespace(input_buffer);
 1516|   290k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']'))
  ------------------
  |  |  301|   581k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 290k, False: 0]
  |  |  |  Branch (301:65): [True: 290k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ']'))
  ------------------
  |  |  304|   290k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1516:49): [True: 3.13k, False: 287k]
  ------------------
 1517|  3.13k|    {
 1518|       |        /* empty array */
 1519|  3.13k|        goto success;
 1520|  3.13k|    }
 1521|       |
 1522|       |    /* check if we skipped to the end of the buffer */
 1523|   287k|    if (cannot_access_at_index(input_buffer, 0))
  ------------------
  |  |  302|   287k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   287k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 287k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 287k, 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|   287k|    input_buffer->offset--;
 1531|       |    /* loop through the comma separated array elements */
 1532|   287k|    do
 1533|   702k|    {
 1534|       |        /* allocate next item */
 1535|   702k|        cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
 1536|   702k|        if (new_item == NULL)
  ------------------
  |  Branch (1536:13): [True: 0, False: 702k]
  ------------------
 1537|      0|        {
 1538|      0|            goto fail; /* allocation failure */
 1539|      0|        }
 1540|       |
 1541|       |        /* attach next item to list */
 1542|   702k|        if (head == NULL)
  ------------------
  |  Branch (1542:13): [True: 287k, False: 415k]
  ------------------
 1543|   287k|        {
 1544|       |            /* start the linked list */
 1545|   287k|            current_item = head = new_item;
 1546|   287k|        }
 1547|   415k|        else
 1548|   415k|        {
 1549|       |            /* add to the end and advance */
 1550|   415k|            current_item->next = new_item;
 1551|   415k|            new_item->prev = current_item;
 1552|   415k|            current_item = new_item;
 1553|   415k|        }
 1554|       |
 1555|       |        /* parse next value */
 1556|   702k|        input_buffer->offset++;
 1557|   702k|        buffer_skip_whitespace(input_buffer);
 1558|   702k|        if (!parse_value(current_item, input_buffer))
  ------------------
  |  Branch (1558:13): [True: 48.5k, False: 654k]
  ------------------
 1559|  48.5k|        {
 1560|  48.5k|            goto fail; /* failed to parse value */
 1561|  48.5k|        }
 1562|   654k|        buffer_skip_whitespace(input_buffer);
 1563|   654k|    }
 1564|   654k|    while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  301|  1.30M|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 654k, False: 0]
  |  |  |  Branch (301:65): [True: 654k, False: 0]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  304|   654k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1564:52): [True: 415k, False: 239k]
  ------------------
 1565|       |
 1566|   239k|    if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']')
  ------------------
  |  |  302|   478k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   239k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 239k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 239k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || buffer_at_offset(input_buffer)[0] != ']')
  ------------------
  |  |  304|   239k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1566:52): [True: 109, False: 239k]
  ------------------
 1567|    109|    {
 1568|    109|        goto fail; /* expected end of array */
 1569|    109|    }
 1570|       |
 1571|   242k|success:
 1572|   242k|    input_buffer->depth--;
 1573|       |
 1574|   242k|    if (head != NULL) {
  ------------------
  |  Branch (1574:9): [True: 239k, False: 3.13k]
  ------------------
 1575|   239k|        head->prev = current_item;
 1576|   239k|    }
 1577|       |
 1578|   242k|    item->type = cJSON_Array;
  ------------------
  |  |   95|   242k|#define cJSON_Array  (1 << 5)
  ------------------
 1579|   242k|    item->child = head;
 1580|       |
 1581|   242k|    input_buffer->offset++;
 1582|       |
 1583|   242k|    return true;
  ------------------
  |  |   65|   242k|#define true ((cJSON_bool)1)
  ------------------
 1584|       |
 1585|  48.6k|fail:
 1586|  48.6k|    if (head != NULL)
  ------------------
  |  Branch (1586:9): [True: 48.6k, False: 0]
  ------------------
 1587|  48.6k|    {
 1588|  48.6k|        cJSON_Delete(head);
 1589|  48.6k|    }
 1590|       |
 1591|  48.6k|    return false;
  ------------------
  |  |   70|  48.6k|#define false ((cJSON_bool)0)
  ------------------
 1592|   239k|}
cJSON.c:parse_object:
 1663|   406k|{
 1664|   406k|    cJSON *head = NULL; /* linked list head */
 1665|   406k|    cJSON *current_item = NULL;
 1666|       |
 1667|   406k|    if (input_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   406k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1667:9): [True: 1, False: 406k]
  ------------------
 1668|      1|    {
 1669|      1|        return false; /* to deeply nested */
  ------------------
  |  |   70|      1|#define false ((cJSON_bool)0)
  ------------------
 1670|      1|    }
 1671|   406k|    input_buffer->depth++;
 1672|       |
 1673|   406k|    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{'))
  ------------------
  |  |  302|   813k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|   406k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 406k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 406k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '{'))
  ------------------
  |  |  304|   406k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1673:52): [True: 0, False: 406k]
  ------------------
 1674|      0|    {
 1675|      0|        goto fail; /* not an object */
 1676|      0|    }
 1677|       |
 1678|   406k|    input_buffer->offset++;
 1679|   406k|    buffer_skip_whitespace(input_buffer);
 1680|   406k|    if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}'))
  ------------------
  |  |  301|   813k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 406k, False: 0]
  |  |  |  Branch (301:65): [True: 406k, False: 0]
  |  |  ------------------
  ------------------
                  if (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == '}'))
  ------------------
  |  |  304|   406k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1680:49): [True: 393k, False: 13.2k]
  ------------------
 1681|   393k|    {
 1682|   393k|        goto success; /* empty object */
 1683|   393k|    }
 1684|       |
 1685|       |    /* check if we skipped to the end of the buffer */
 1686|  13.2k|    if (cannot_access_at_index(input_buffer, 0))
  ------------------
  |  |  302|  13.2k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  13.2k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 13.2k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 13.2k, 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|  13.2k|    input_buffer->offset--;
 1694|       |    /* loop through the comma separated array elements */
 1695|  13.2k|    do
 1696|  27.8k|    {
 1697|       |        /* allocate next item */
 1698|  27.8k|        cJSON *new_item = cJSON_New_Item(&(input_buffer->hooks));
 1699|  27.8k|        if (new_item == NULL)
  ------------------
  |  Branch (1699:13): [True: 0, False: 27.8k]
  ------------------
 1700|      0|        {
 1701|      0|            goto fail; /* allocation failure */
 1702|      0|        }
 1703|       |
 1704|       |        /* attach next item to list */
 1705|  27.8k|        if (head == NULL)
  ------------------
  |  Branch (1705:13): [True: 13.2k, False: 14.6k]
  ------------------
 1706|  13.2k|        {
 1707|       |            /* start the linked list */
 1708|  13.2k|            current_item = head = new_item;
 1709|  13.2k|        }
 1710|  14.6k|        else
 1711|  14.6k|        {
 1712|       |            /* add to the end and advance */
 1713|  14.6k|            current_item->next = new_item;
 1714|  14.6k|            new_item->prev = current_item;
 1715|  14.6k|            current_item = new_item;
 1716|  14.6k|        }
 1717|       |
 1718|  27.8k|        if (cannot_access_at_index(input_buffer, 1))
  ------------------
  |  |  302|  27.8k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  27.8k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 27.8k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 27.8k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1719|      0|        {
 1720|      0|            goto fail; /* nothing comes after the comma */
 1721|      0|        }
 1722|       |
 1723|       |        /* parse the name of the child */
 1724|  27.8k|        input_buffer->offset++;
 1725|  27.8k|        buffer_skip_whitespace(input_buffer);
 1726|  27.8k|        if (!parse_string(current_item, input_buffer))
  ------------------
  |  Branch (1726:13): [True: 161, False: 27.7k]
  ------------------
 1727|    161|        {
 1728|    161|            goto fail; /* failed to parse name */
 1729|    161|        }
 1730|  27.7k|        buffer_skip_whitespace(input_buffer);
 1731|       |
 1732|       |        /* swap valuestring and string, because we parsed the name */
 1733|  27.7k|        current_item->string = current_item->valuestring;
 1734|  27.7k|        current_item->valuestring = NULL;
 1735|       |
 1736|  27.7k|        if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':'))
  ------------------
  |  |  302|  55.4k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  27.7k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 27.7k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 27.7k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                      if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != ':'))
  ------------------
  |  |  304|  27.7k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1736:56): [True: 35, False: 27.6k]
  ------------------
 1737|     35|        {
 1738|     35|            goto fail; /* invalid object */
 1739|     35|        }
 1740|       |
 1741|       |        /* parse the value */
 1742|  27.6k|        input_buffer->offset++;
 1743|  27.6k|        buffer_skip_whitespace(input_buffer);
 1744|  27.6k|        if (!parse_value(current_item, input_buffer))
  ------------------
  |  Branch (1744:13): [True: 3.08k, False: 24.6k]
  ------------------
 1745|  3.08k|        {
 1746|  3.08k|            goto fail; /* failed to parse value */
 1747|  3.08k|        }
 1748|  24.6k|        buffer_skip_whitespace(input_buffer);
 1749|  24.6k|    }
 1750|  24.6k|    while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  301|  49.2k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  ------------------
  |  |  |  Branch (301:45): [True: 24.6k, False: 0]
  |  |  |  Branch (301:65): [True: 24.6k, False: 0]
  |  |  ------------------
  ------------------
                  while (can_access_at_index(input_buffer, 0) && (buffer_at_offset(input_buffer)[0] == ','));
  ------------------
  |  |  304|  24.6k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1750:52): [True: 14.6k, False: 9.98k]
  ------------------
 1751|       |
 1752|  9.98k|    if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}'))
  ------------------
  |  |  302|  19.9k|#define cannot_access_at_index(buffer, index) (!can_access_at_index(buffer, index))
  |  |  ------------------
  |  |  |  |  301|  9.98k|#define can_access_at_index(buffer, index) ((buffer != NULL) && (((buffer)->offset + index) < (buffer)->length))
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (301:45): [True: 9.98k, False: 0]
  |  |  |  |  |  Branch (301:65): [True: 9.98k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                  if (cannot_access_at_index(input_buffer, 0) || (buffer_at_offset(input_buffer)[0] != '}'))
  ------------------
  |  |  304|  9.98k|#define buffer_at_offset(buffer) ((buffer)->content + (buffer)->offset)
  ------------------
  |  Branch (1752:52): [True: 45, False: 9.93k]
  ------------------
 1753|     45|    {
 1754|     45|        goto fail; /* expected end of object */
 1755|     45|    }
 1756|       |
 1757|   403k|success:
 1758|   403k|    input_buffer->depth--;
 1759|       |
 1760|   403k|    if (head != NULL) {
  ------------------
  |  Branch (1760:9): [True: 9.93k, False: 393k]
  ------------------
 1761|  9.93k|        head->prev = current_item;
 1762|  9.93k|    }
 1763|       |
 1764|   403k|    item->type = cJSON_Object;
  ------------------
  |  |   96|   403k|#define cJSON_Object (1 << 6)
  ------------------
 1765|   403k|    item->child = head;
 1766|       |
 1767|   403k|    input_buffer->offset++;
 1768|   403k|    return true;
  ------------------
  |  |   65|   403k|#define true ((cJSON_bool)1)
  ------------------
 1769|       |
 1770|  3.32k|fail:
 1771|  3.32k|    if (head != NULL)
  ------------------
  |  Branch (1771:9): [True: 3.32k, False: 0]
  ------------------
 1772|  3.32k|    {
 1773|  3.32k|        cJSON_Delete(head);
 1774|  3.32k|    }
 1775|       |
 1776|  3.32k|    return false;
  ------------------
  |  |   70|  3.32k|#define false ((cJSON_bool)0)
  ------------------
 1777|  9.98k|}
cJSON.c:print_value:
 1424|   657k|{
 1425|   657k|    unsigned char *output = NULL;
 1426|       |
 1427|   657k|    if ((item == NULL) || (output_buffer == NULL))
  ------------------
  |  Branch (1427:9): [True: 0, False: 657k]
  |  Branch (1427:27): [True: 0, False: 657k]
  ------------------
 1428|      0|    {
 1429|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1430|      0|    }
 1431|       |
 1432|   657k|    switch ((item->type) & 0xFF)
 1433|   657k|    {
 1434|    353|        case cJSON_NULL:
  ------------------
  |  |   92|    353|#define cJSON_NULL   (1 << 2)
  ------------------
  |  Branch (1434:9): [True: 353, False: 656k]
  ------------------
 1435|    353|            output = ensure(output_buffer, 5);
 1436|    353|            if (output == NULL)
  ------------------
  |  Branch (1436:17): [True: 0, False: 353]
  ------------------
 1437|      0|            {
 1438|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1439|      0|            }
 1440|    353|            strcpy((char*)output, "null");
 1441|    353|            return true;
  ------------------
  |  |   65|    353|#define true ((cJSON_bool)1)
  ------------------
 1442|       |
 1443|    534|        case cJSON_False:
  ------------------
  |  |   90|    534|#define cJSON_False  (1 << 0)
  ------------------
  |  Branch (1443:9): [True: 534, False: 656k]
  ------------------
 1444|    534|            output = ensure(output_buffer, 6);
 1445|    534|            if (output == NULL)
  ------------------
  |  Branch (1445:17): [True: 0, False: 534]
  ------------------
 1446|      0|            {
 1447|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1448|      0|            }
 1449|    534|            strcpy((char*)output, "false");
 1450|    534|            return true;
  ------------------
  |  |   65|    534|#define true ((cJSON_bool)1)
  ------------------
 1451|       |
 1452|    426|        case cJSON_True:
  ------------------
  |  |   91|    426|#define cJSON_True   (1 << 1)
  ------------------
  |  Branch (1452:9): [True: 426, False: 656k]
  ------------------
 1453|    426|            output = ensure(output_buffer, 5);
 1454|    426|            if (output == NULL)
  ------------------
  |  Branch (1454:17): [True: 0, False: 426]
  ------------------
 1455|      0|            {
 1456|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1457|      0|            }
 1458|    426|            strcpy((char*)output, "true");
 1459|    426|            return true;
  ------------------
  |  |   65|    426|#define true ((cJSON_bool)1)
  ------------------
 1460|       |
 1461|  18.3k|        case cJSON_Number:
  ------------------
  |  |   93|  18.3k|#define cJSON_Number (1 << 3)
  ------------------
  |  Branch (1461:9): [True: 18.3k, False: 638k]
  ------------------
 1462|  18.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: 657k]
  ------------------
 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.43k|        case cJSON_String:
  ------------------
  |  |   94|  1.43k|#define cJSON_String (1 << 4)
  ------------------
  |  Branch (1482:9): [True: 1.43k, False: 655k]
  ------------------
 1483|  1.43k|            return print_string(item, output_buffer);
 1484|       |
 1485|   237k|        case cJSON_Array:
  ------------------
  |  |   95|   237k|#define cJSON_Array  (1 << 5)
  ------------------
  |  Branch (1485:9): [True: 237k, False: 419k]
  ------------------
 1486|   237k|            return print_array(item, output_buffer);
 1487|       |
 1488|   398k|        case cJSON_Object:
  ------------------
  |  |   96|   398k|#define cJSON_Object (1 << 6)
  ------------------
  |  Branch (1488:9): [True: 398k, False: 258k]
  ------------------
 1489|   398k|            return print_object(item, output_buffer);
 1490|       |
 1491|      0|        default:
  ------------------
  |  Branch (1491:9): [True: 0, False: 657k]
  ------------------
 1492|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1493|   657k|    }
 1494|   657k|}
cJSON.c:ensure:
  491|  1.76M|{
  492|  1.76M|    unsigned char *newbuffer = NULL;
  493|  1.76M|    size_t newsize = 0;
  494|       |
  495|  1.76M|    if ((p == NULL) || (p->buffer == NULL))
  ------------------
  |  Branch (495:9): [True: 0, False: 1.76M]
  |  Branch (495:24): [True: 0, False: 1.76M]
  ------------------
  496|      0|    {
  497|      0|        return NULL;
  498|      0|    }
  499|       |
  500|  1.76M|    if ((p->length > 0) && (p->offset >= p->length))
  ------------------
  |  Branch (500:9): [True: 1.76M, False: 0]
  |  Branch (500:28): [True: 0, False: 1.76M]
  ------------------
  501|      0|    {
  502|       |        /* make sure that offset is valid */
  503|      0|        return NULL;
  504|      0|    }
  505|       |
  506|  1.76M|    if (needed > INT_MAX)
  ------------------
  |  Branch (506:9): [True: 0, False: 1.76M]
  ------------------
  507|      0|    {
  508|       |        /* sizes bigger than INT_MAX are currently not supported */
  509|      0|        return NULL;
  510|      0|    }
  511|       |
  512|  1.76M|    needed += p->offset + 1;
  513|  1.76M|    if (needed <= p->length)
  ------------------
  |  Branch (513:9): [True: 1.76M, False: 1.85k]
  ------------------
  514|  1.76M|    {
  515|  1.76M|        return p->buffer + p->offset;
  516|  1.76M|    }
  517|       |
  518|  1.85k|    if (p->noalloc) {
  ------------------
  |  Branch (518:9): [True: 0, False: 1.85k]
  ------------------
  519|      0|        return NULL;
  520|      0|    }
  521|       |
  522|       |    /* calculate new buffer size */
  523|  1.85k|    if (needed > (INT_MAX / 2))
  ------------------
  |  Branch (523:9): [True: 0, False: 1.85k]
  ------------------
  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.85k|    else
  536|  1.85k|    {
  537|  1.85k|        newsize = needed * 2;
  538|  1.85k|    }
  539|       |
  540|  1.85k|    if (p->hooks.reallocate != NULL)
  ------------------
  |  Branch (540:9): [True: 1.85k, False: 0]
  ------------------
  541|  1.85k|    {
  542|       |        /* reallocate with realloc if available */
  543|  1.85k|        newbuffer = (unsigned char*)p->hooks.reallocate(p->buffer, newsize);
  544|  1.85k|        if (newbuffer == NULL)
  ------------------
  |  Branch (544:13): [True: 0, False: 1.85k]
  ------------------
  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.85k|    }
  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.85k|    p->length = newsize;
  570|  1.85k|    p->buffer = newbuffer;
  571|       |
  572|  1.85k|    return newbuffer + p->offset;
  573|  1.85k|}
cJSON.c:print_number:
  597|  18.3k|{
  598|  18.3k|    unsigned char *output_pointer = NULL;
  599|  18.3k|    double d = item->valuedouble;
  600|  18.3k|    int length = 0;
  601|  18.3k|    size_t i = 0;
  602|  18.3k|    unsigned char number_buffer[26] = {0}; /* temporary buffer to print the number into */
  603|  18.3k|    unsigned char decimal_point = get_decimal_point();
  604|  18.3k|    double test = 0.0;
  605|       |
  606|  18.3k|    if (output_buffer == NULL)
  ------------------
  |  Branch (606:9): [True: 0, False: 18.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|  18.3k|    if (isnan(d) || isinf(d))
  ------------------
  |  |   77|  36.6k|#define isnan(d) (d != d)
  |  |  ------------------
  |  |  |  Branch (77:18): [True: 0, False: 18.3k]
  |  |  ------------------
  ------------------
                  if (isnan(d) || isinf(d))
  ------------------
  |  |   74|  18.3k|#define isinf(d) (isnan((d - d)) && !isnan(d))
  |  |  ------------------
  |  |  |  |   77|  36.6k|#define isnan(d) (d != d)
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (77:18): [True: 203, False: 18.1k]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |               #define isinf(d) (isnan((d - d)) && !isnan(d))
  |  |  ------------------
  |  |  |  |   77|    203|#define isnan(d) (d != d)
  |  |  ------------------
  |  |  |  Branch (74:37): [True: 203, False: 0]
  |  |  ------------------
  ------------------
  613|    203|    {
  614|    203|        length = sprintf((char*)number_buffer, "null");
  615|    203|    }
  616|  18.1k|    else if(d == (double)item->valueint)
  ------------------
  |  Branch (616:13): [True: 17.1k, False: 949]
  ------------------
  617|  17.1k|    {
  618|  17.1k|        length = sprintf((char*)number_buffer, "%d", item->valueint);
  619|  17.1k|    }
  620|    949|    else
  621|    949|    {
  622|       |        /* Try 15 decimal places of precision to avoid nonsignificant nonzero digits */
  623|    949|        length = sprintf((char*)number_buffer, "%1.15g", d);
  624|       |
  625|       |        /* Check whether the original double can be recovered */
  626|    949|        if ((sscanf((char*)number_buffer, "%lg", &test) != 1) || !compare_double((double)test, d))
  ------------------
  |  Branch (626:13): [True: 0, False: 949]
  |  Branch (626:66): [True: 401, False: 548]
  ------------------
  627|    401|        {
  628|       |            /* If not, print with 17 decimal places of precision */
  629|    401|            length = sprintf((char*)number_buffer, "%1.17g", d);
  630|    401|        }
  631|    949|    }
  632|       |
  633|       |    /* sprintf failed or buffer overrun occurred */
  634|  18.3k|    if ((length < 0) || (length > (int)(sizeof(number_buffer) - 1)))
  ------------------
  |  Branch (634:9): [True: 0, False: 18.3k]
  |  Branch (634:25): [True: 0, False: 18.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|  18.3k|    output_pointer = ensure(output_buffer, (size_t)length + sizeof(""));
  641|  18.3k|    if (output_pointer == NULL)
  ------------------
  |  Branch (641:9): [True: 0, False: 18.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|  46.8k|    for (i = 0; i < ((size_t)length); i++)
  ------------------
  |  Branch (648:17): [True: 28.5k, False: 18.3k]
  ------------------
  649|  28.5k|    {
  650|  28.5k|        if (number_buffer[i] == decimal_point)
  ------------------
  |  Branch (650:13): [True: 235, False: 28.3k]
  ------------------
  651|    235|        {
  652|    235|            output_pointer[i] = '.';
  653|    235|            continue;
  654|    235|        }
  655|       |
  656|  28.3k|        output_pointer[i] = number_buffer[i];
  657|  28.3k|    }
  658|  18.3k|    output_pointer[i] = '\0';
  659|       |
  660|  18.3k|    output_buffer->offset += (size_t)length;
  661|       |
  662|  18.3k|    return true;
  ------------------
  |  |   65|  18.3k|#define true ((cJSON_bool)1)
  ------------------
  663|  18.3k|}
cJSON.c:print_string:
 1077|  1.43k|{
 1078|  1.43k|    return print_string_ptr((unsigned char*)item->valuestring, p);
 1079|  1.43k|}
cJSON.c:print_string_ptr:
  955|  19.9k|{
  956|  19.9k|    const unsigned char *input_pointer = NULL;
  957|  19.9k|    unsigned char *output = NULL;
  958|  19.9k|    unsigned char *output_pointer = NULL;
  959|  19.9k|    size_t output_length = 0;
  960|       |    /* numbers of additional characters needed for escaping */
  961|  19.9k|    size_t escape_characters = 0;
  962|       |
  963|  19.9k|    if (output_buffer == NULL)
  ------------------
  |  Branch (963:9): [True: 0, False: 19.9k]
  ------------------
  964|      0|    {
  965|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
  966|      0|    }
  967|       |
  968|       |    /* empty string */
  969|  19.9k|    if (input == NULL)
  ------------------
  |  Branch (969:9): [True: 0, False: 19.9k]
  ------------------
  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|  10.1M|    for (input_pointer = input; *input_pointer; input_pointer++)
  ------------------
  |  Branch (982:33): [True: 10.1M, False: 19.9k]
  ------------------
  983|  10.1M|    {
  984|  10.1M|        switch (*input_pointer)
  985|  10.1M|        {
  986|  2.51k|            case '\"':
  ------------------
  |  Branch (986:13): [True: 2.51k, False: 10.1M]
  ------------------
  987|  4.63k|            case '\\':
  ------------------
  |  Branch (987:13): [True: 2.12k, False: 10.1M]
  ------------------
  988|  18.2k|            case '\b':
  ------------------
  |  Branch (988:13): [True: 13.5k, False: 10.1M]
  ------------------
  989|  35.5k|            case '\f':
  ------------------
  |  Branch (989:13): [True: 17.3k, False: 10.1M]
  ------------------
  990|  88.4k|            case '\n':
  ------------------
  |  Branch (990:13): [True: 52.8k, False: 10.0M]
  ------------------
  991|  98.1k|            case '\r':
  ------------------
  |  Branch (991:13): [True: 9.70k, False: 10.1M]
  ------------------
  992|   110k|            case '\t':
  ------------------
  |  Branch (992:13): [True: 12.1k, False: 10.1M]
  ------------------
  993|       |                /* one character escape sequence */
  994|   110k|                escape_characters++;
  995|   110k|                break;
  996|  10.0M|            default:
  ------------------
  |  Branch (996:13): [True: 10.0M, False: 110k]
  ------------------
  997|  10.0M|                if (*input_pointer < 32)
  ------------------
  |  Branch (997:21): [True: 7.45M, False: 2.57M]
  ------------------
  998|  7.45M|                {
  999|       |                    /* UTF-16 escape sequence uXXXX */
 1000|  7.45M|                    escape_characters += 5;
 1001|  7.45M|                }
 1002|  10.0M|                break;
 1003|  10.1M|        }
 1004|  10.1M|    }
 1005|  19.9k|    output_length = (size_t)(input_pointer - input) + escape_characters;
 1006|       |
 1007|  19.9k|    output = ensure(output_buffer, output_length + sizeof("\"\""));
 1008|  19.9k|    if (output == NULL)
  ------------------
  |  Branch (1008:9): [True: 0, False: 19.9k]
  ------------------
 1009|      0|    {
 1010|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1011|      0|    }
 1012|       |
 1013|       |    /* no characters have to be escaped */
 1014|  19.9k|    if (escape_characters == 0)
  ------------------
  |  Branch (1014:9): [True: 17.2k, False: 2.73k]
  ------------------
 1015|  17.2k|    {
 1016|  17.2k|        output[0] = '\"';
 1017|  17.2k|        memcpy(output + 1, input, output_length);
 1018|  17.2k|        output[output_length + 1] = '\"';
 1019|  17.2k|        output[output_length + 2] = '\0';
 1020|       |
 1021|  17.2k|        return true;
  ------------------
  |  |   65|  17.2k|#define true ((cJSON_bool)1)
  ------------------
 1022|  17.2k|    }
 1023|       |
 1024|  2.73k|    output[0] = '\"';
 1025|  2.73k|    output_pointer = output + 1;
 1026|       |    /* copy the string */
 1027|  10.1M|    for (input_pointer = input; *input_pointer != '\0'; (void)input_pointer++, output_pointer++)
  ------------------
  |  Branch (1027:33): [True: 10.1M, False: 2.73k]
  ------------------
 1028|  10.1M|    {
 1029|  10.1M|        if ((*input_pointer > 31) && (*input_pointer != '\"') && (*input_pointer != '\\'))
  ------------------
  |  Branch (1029:13): [True: 2.55M, False: 7.55M]
  |  Branch (1029:38): [True: 2.55M, False: 2.51k]
  |  Branch (1029:66): [True: 2.55M, False: 2.12k]
  ------------------
 1030|  2.55M|        {
 1031|       |            /* normal character, copy */
 1032|  2.55M|            *output_pointer = *input_pointer;
 1033|  2.55M|        }
 1034|  7.56M|        else
 1035|  7.56M|        {
 1036|       |            /* character needs to be escaped */
 1037|  7.56M|            *output_pointer++ = '\\';
 1038|  7.56M|            switch (*input_pointer)
 1039|  7.56M|            {
 1040|  2.12k|                case '\\':
  ------------------
  |  Branch (1040:17): [True: 2.12k, False: 7.55M]
  ------------------
 1041|  2.12k|                    *output_pointer = '\\';
 1042|  2.12k|                    break;
 1043|  2.51k|                case '\"':
  ------------------
  |  Branch (1043:17): [True: 2.51k, False: 7.55M]
  ------------------
 1044|  2.51k|                    *output_pointer = '\"';
 1045|  2.51k|                    break;
 1046|  13.5k|                case '\b':
  ------------------
  |  Branch (1046:17): [True: 13.5k, False: 7.54M]
  ------------------
 1047|  13.5k|                    *output_pointer = 'b';
 1048|  13.5k|                    break;
 1049|  17.3k|                case '\f':
  ------------------
  |  Branch (1049:17): [True: 17.3k, False: 7.54M]
  ------------------
 1050|  17.3k|                    *output_pointer = 'f';
 1051|  17.3k|                    break;
 1052|  52.8k|                case '\n':
  ------------------
  |  Branch (1052:17): [True: 52.8k, False: 7.50M]
  ------------------
 1053|  52.8k|                    *output_pointer = 'n';
 1054|  52.8k|                    break;
 1055|  9.70k|                case '\r':
  ------------------
  |  Branch (1055:17): [True: 9.70k, False: 7.55M]
  ------------------
 1056|  9.70k|                    *output_pointer = 'r';
 1057|  9.70k|                    break;
 1058|  12.1k|                case '\t':
  ------------------
  |  Branch (1058:17): [True: 12.1k, False: 7.54M]
  ------------------
 1059|  12.1k|                    *output_pointer = 't';
 1060|  12.1k|                    break;
 1061|  7.45M|                default:
  ------------------
  |  Branch (1061:17): [True: 7.45M, False: 110k]
  ------------------
 1062|       |                    /* escape and print as unicode codepoint */
 1063|  7.45M|                    sprintf((char*)output_pointer, "u%04x", *input_pointer);
 1064|  7.45M|                    output_pointer += 4;
 1065|  7.45M|                    break;
 1066|  7.56M|            }
 1067|  7.56M|        }
 1068|  10.1M|    }
 1069|  2.73k|    output[output_length + 1] = '\"';
 1070|  2.73k|    output[output_length + 2] = '\0';
 1071|       |
 1072|  2.73k|    return true;
  ------------------
  |  |   65|  2.73k|#define true ((cJSON_bool)1)
  ------------------
 1073|  2.73k|}
cJSON.c:print_array:
 1596|   237k|{
 1597|   237k|    unsigned char *output_pointer = NULL;
 1598|   237k|    size_t length = 0;
 1599|   237k|    cJSON *current_element = item->child;
 1600|       |
 1601|   237k|    if (output_buffer == NULL)
  ------------------
  |  Branch (1601:9): [True: 0, False: 237k]
  ------------------
 1602|      0|    {
 1603|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1604|      0|    }
 1605|       |
 1606|   237k|    if (output_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   237k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1606:9): [True: 0, False: 237k]
  ------------------
 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|   237k|    output_pointer = ensure(output_buffer, 1);
 1614|   237k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1614:9): [True: 0, False: 237k]
  ------------------
 1615|      0|    {
 1616|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1617|      0|    }
 1618|       |
 1619|   237k|    *output_pointer = '[';
 1620|   237k|    output_buffer->offset++;
 1621|   237k|    output_buffer->depth++;
 1622|       |
 1623|   874k|    while (current_element != NULL)
  ------------------
  |  Branch (1623:12): [True: 637k, False: 237k]
  ------------------
 1624|   637k|    {
 1625|   637k|        if (!print_value(current_element, output_buffer))
  ------------------
  |  Branch (1625:13): [True: 0, False: 637k]
  ------------------
 1626|      0|        {
 1627|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1628|      0|        }
 1629|   637k|        update_offset(output_buffer);
 1630|   637k|        if (current_element->next)
  ------------------
  |  Branch (1630:13): [True: 403k, False: 234k]
  ------------------
 1631|   403k|        {
 1632|   403k|            length = (size_t) (output_buffer->format ? 2 : 1);
  ------------------
  |  Branch (1632:32): [True: 395k, False: 7.19k]
  ------------------
 1633|   403k|            output_pointer = ensure(output_buffer, length + 1);
 1634|   403k|            if (output_pointer == NULL)
  ------------------
  |  Branch (1634:17): [True: 0, False: 403k]
  ------------------
 1635|      0|            {
 1636|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1637|      0|            }
 1638|   403k|            *output_pointer++ = ',';
 1639|   403k|            if(output_buffer->format)
  ------------------
  |  Branch (1639:16): [True: 395k, False: 7.19k]
  ------------------
 1640|   395k|            {
 1641|   395k|                *output_pointer++ = ' ';
 1642|   395k|            }
 1643|   403k|            *output_pointer = '\0';
 1644|   403k|            output_buffer->offset += length;
 1645|   403k|        }
 1646|   637k|        current_element = current_element->next;
 1647|   637k|    }
 1648|       |
 1649|   237k|    output_pointer = ensure(output_buffer, 2);
 1650|   237k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1650:9): [True: 0, False: 237k]
  ------------------
 1651|      0|    {
 1652|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1653|      0|    }
 1654|   237k|    *output_pointer++ = ']';
 1655|   237k|    *output_pointer = '\0';
 1656|   237k|    output_buffer->depth--;
 1657|       |
 1658|   237k|    return true;
  ------------------
  |  |   65|   237k|#define true ((cJSON_bool)1)
  ------------------
 1659|   237k|}
cJSON.c:print_object:
 1781|   398k|{
 1782|   398k|    unsigned char *output_pointer = NULL;
 1783|   398k|    size_t length = 0;
 1784|   398k|    cJSON *current_item = item->child;
 1785|       |
 1786|   398k|    if (output_buffer == NULL)
  ------------------
  |  Branch (1786:9): [True: 0, False: 398k]
  ------------------
 1787|      0|    {
 1788|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1789|      0|    }
 1790|       |
 1791|   398k|    if (output_buffer->depth >= CJSON_NESTING_LIMIT)
  ------------------
  |  |  137|   398k|#define CJSON_NESTING_LIMIT 1000
  ------------------
  |  Branch (1791:9): [True: 0, False: 398k]
  ------------------
 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|   398k|    length = (size_t) (output_buffer->format ? 2 : 1); /* fmt: {\n */
  ------------------
  |  Branch (1797:24): [True: 397k, False: 1.60k]
  ------------------
 1798|   398k|    output_pointer = ensure(output_buffer, length + 1);
 1799|   398k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1799:9): [True: 0, False: 398k]
  ------------------
 1800|      0|    {
 1801|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1802|      0|    }
 1803|       |
 1804|   398k|    *output_pointer++ = '{';
 1805|   398k|    output_buffer->depth++;
 1806|   398k|    if (output_buffer->format)
  ------------------
  |  Branch (1806:9): [True: 397k, False: 1.60k]
  ------------------
 1807|   397k|    {
 1808|   397k|        *output_pointer++ = '\n';
 1809|   397k|    }
 1810|   398k|    output_buffer->offset += length;
 1811|       |
 1812|   417k|    while (current_item)
  ------------------
  |  Branch (1812:12): [True: 18.5k, False: 398k]
  ------------------
 1813|  18.5k|    {
 1814|  18.5k|        if (output_buffer->format)
  ------------------
  |  Branch (1814:13): [True: 13.9k, False: 4.55k]
  ------------------
 1815|  13.9k|        {
 1816|  13.9k|            size_t i;
 1817|  13.9k|            output_pointer = ensure(output_buffer, output_buffer->depth);
 1818|  13.9k|            if (output_pointer == NULL)
  ------------------
  |  Branch (1818:17): [True: 0, False: 13.9k]
  ------------------
 1819|      0|            {
 1820|      0|                return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1821|      0|            }
 1822|  4.18M|            for (i = 0; i < output_buffer->depth; i++)
  ------------------
  |  Branch (1822:25): [True: 4.17M, False: 13.9k]
  ------------------
 1823|  4.17M|            {
 1824|  4.17M|                *output_pointer++ = '\t';
 1825|  4.17M|            }
 1826|  13.9k|            output_buffer->offset += output_buffer->depth;
 1827|  13.9k|        }
 1828|       |
 1829|       |        /* print key */
 1830|  18.5k|        if (!print_string_ptr((unsigned char*)current_item->string, output_buffer))
  ------------------
  |  Branch (1830:13): [True: 0, False: 18.5k]
  ------------------
 1831|      0|        {
 1832|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1833|      0|        }
 1834|  18.5k|        update_offset(output_buffer);
 1835|       |
 1836|  18.5k|        length = (size_t) (output_buffer->format ? 2 : 1);
  ------------------
  |  Branch (1836:28): [True: 13.9k, False: 4.55k]
  ------------------
 1837|  18.5k|        output_pointer = ensure(output_buffer, length);
 1838|  18.5k|        if (output_pointer == NULL)
  ------------------
  |  Branch (1838:13): [True: 0, False: 18.5k]
  ------------------
 1839|      0|        {
 1840|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1841|      0|        }
 1842|  18.5k|        *output_pointer++ = ':';
 1843|  18.5k|        if (output_buffer->format)
  ------------------
  |  Branch (1843:13): [True: 13.9k, False: 4.55k]
  ------------------
 1844|  13.9k|        {
 1845|  13.9k|            *output_pointer++ = '\t';
 1846|  13.9k|        }
 1847|  18.5k|        output_buffer->offset += length;
 1848|       |
 1849|       |        /* print value */
 1850|  18.5k|        if (!print_value(current_item, output_buffer))
  ------------------
  |  Branch (1850:13): [True: 0, False: 18.5k]
  ------------------
 1851|      0|        {
 1852|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1853|      0|        }
 1854|  18.5k|        update_offset(output_buffer);
 1855|       |
 1856|       |        /* print comma if not last */
 1857|  18.5k|        length = ((size_t)(output_buffer->format ? 1 : 0) + (size_t)(current_item->next ? 1 : 0));
  ------------------
  |  Branch (1857:28): [True: 13.9k, False: 4.55k]
  |  Branch (1857:70): [True: 9.03k, False: 9.52k]
  ------------------
 1858|  18.5k|        output_pointer = ensure(output_buffer, length + 1);
 1859|  18.5k|        if (output_pointer == NULL)
  ------------------
  |  Branch (1859:13): [True: 0, False: 18.5k]
  ------------------
 1860|      0|        {
 1861|      0|            return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1862|      0|        }
 1863|  18.5k|        if (current_item->next)
  ------------------
  |  Branch (1863:13): [True: 9.03k, False: 9.52k]
  ------------------
 1864|  9.03k|        {
 1865|  9.03k|            *output_pointer++ = ',';
 1866|  9.03k|        }
 1867|       |
 1868|  18.5k|        if (output_buffer->format)
  ------------------
  |  Branch (1868:13): [True: 13.9k, False: 4.55k]
  ------------------
 1869|  13.9k|        {
 1870|  13.9k|            *output_pointer++ = '\n';
 1871|  13.9k|        }
 1872|  18.5k|        *output_pointer = '\0';
 1873|  18.5k|        output_buffer->offset += length;
 1874|       |
 1875|  18.5k|        current_item = current_item->next;
 1876|  18.5k|    }
 1877|       |
 1878|   398k|    output_pointer = ensure(output_buffer, output_buffer->format ? (output_buffer->depth + 1) : 2);
  ------------------
  |  Branch (1878:44): [True: 397k, False: 1.60k]
  ------------------
 1879|   398k|    if (output_pointer == NULL)
  ------------------
  |  Branch (1879:9): [True: 0, False: 398k]
  ------------------
 1880|      0|    {
 1881|      0|        return false;
  ------------------
  |  |   70|      0|#define false ((cJSON_bool)0)
  ------------------
 1882|      0|    }
 1883|   398k|    if (output_buffer->format)
  ------------------
  |  Branch (1883:9): [True: 397k, False: 1.60k]
  ------------------
 1884|   397k|    {
 1885|   397k|        size_t i;
 1886|   217M|        for (i = 0; i < (output_buffer->depth - 1); i++)
  ------------------
  |  Branch (1886:21): [True: 216M, False: 397k]
  ------------------
 1887|   216M|        {
 1888|   216M|            *output_pointer++ = '\t';
 1889|   216M|        }
 1890|   397k|    }
 1891|   398k|    *output_pointer++ = '}';
 1892|   398k|    *output_pointer = '\0';
 1893|   398k|    output_buffer->depth--;
 1894|       |
 1895|   398k|    return true;
  ------------------
  |  |   65|   398k|#define true ((cJSON_bool)1)
  ------------------
 1896|   398k|}
cJSON.c:skip_oneline_comment:
 2876|    443|{
 2877|    443|    *input += static_strlen("//");
  ------------------
  |  |  184|    443|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2878|       |
 2879|  31.0k|    for (; (*input)[0] != '\0'; ++(*input))
  ------------------
  |  Branch (2879:12): [True: 31.0k, False: 21]
  ------------------
 2880|  31.0k|    {
 2881|  31.0k|        if ((*input)[0] == '\n') {
  ------------------
  |  Branch (2881:13): [True: 422, False: 30.6k]
  ------------------
 2882|    422|            *input += static_strlen("\n");
  ------------------
  |  |  184|    422|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2883|    422|            return;
 2884|    422|        }
 2885|  31.0k|    }
 2886|    443|}
cJSON.c:skip_multiline_comment:
 2889|    338|{
 2890|    338|    *input += static_strlen("/*");
  ------------------
  |  |  184|    338|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2891|       |
 2892|  2.02k|    for (; (*input)[0] != '\0'; ++(*input))
  ------------------
  |  Branch (2892:12): [True: 1.97k, False: 45]
  ------------------
 2893|  1.97k|    {
 2894|  1.97k|        if (((*input)[0] == '*') && ((*input)[1] == '/'))
  ------------------
  |  Branch (2894:13): [True: 558, False: 1.42k]
  |  Branch (2894:37): [True: 293, False: 265]
  ------------------
 2895|    293|        {
 2896|    293|            *input += static_strlen("*/");
  ------------------
  |  |  184|    293|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2897|    293|            return;
 2898|    293|        }
 2899|  1.97k|    }
 2900|    338|}
cJSON.c:minify_string:
 2902|  16.1k|static void minify_string(char **input, char **output) {
 2903|  16.1k|    (*output)[0] = (*input)[0];
 2904|  16.1k|    *input += static_strlen("\"");
  ------------------
  |  |  184|  16.1k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2905|  16.1k|    *output += static_strlen("\"");
  ------------------
  |  |  184|  16.1k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2906|       |
 2907|       |
 2908|  10.6M|    for (; (*input)[0] != '\0'; (void)++(*input), ++(*output)) {
  ------------------
  |  Branch (2908:12): [True: 10.6M, False: 37]
  ------------------
 2909|  10.6M|        (*output)[0] = (*input)[0];
 2910|       |
 2911|  10.6M|        if ((*input)[0] == '\"') {
  ------------------
  |  Branch (2911:13): [True: 16.0k, False: 10.6M]
  ------------------
 2912|  16.0k|            (*output)[0] = '\"';
 2913|  16.0k|            *input += static_strlen("\"");
  ------------------
  |  |  184|  16.0k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2914|  16.0k|            *output += static_strlen("\"");
  ------------------
  |  |  184|  16.0k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2915|  16.0k|            return;
 2916|  10.6M|        } else if (((*input)[0] == '\\') && ((*input)[1] == '\"')) {
  ------------------
  |  Branch (2916:20): [True: 42.3k, False: 10.6M]
  |  Branch (2916:45): [True: 2.78k, False: 39.5k]
  ------------------
 2917|  2.78k|            (*output)[1] = (*input)[1];
 2918|  2.78k|            *input += static_strlen("\"");
  ------------------
  |  |  184|  2.78k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2919|  2.78k|            *output += static_strlen("\"");
  ------------------
  |  |  184|  2.78k|#define static_strlen(string_literal) (sizeof(string_literal) - sizeof(""))
  ------------------
 2920|  2.78k|        }
 2921|  10.6M|    }
 2922|  16.1k|}
cJSON.c:compare_double:
  590|    949|{
  591|    949|    double maxVal = fabs(a) > fabs(b) ? fabs(a) : fabs(b);
  ------------------
  |  Branch (591:21): [True: 383, False: 566]
  ------------------
  592|       |    return (fabs(a - b) <= maxVal * DBL_EPSILON);
  593|    949|}

LLVMFuzzerTestOneInput:
   14|  2.10k|{
   15|  2.10k|    cJSON *json;
   16|  2.10k|    size_t offset = 4;
   17|  2.10k|    unsigned char *copied;
   18|  2.10k|    char *printed_json = NULL;
   19|  2.10k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.10k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.10k]
  ------------------
   23|  2.10k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 9, False: 2.09k]
  ------------------
   24|  2.09k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 415, False: 1.67k]
  |  Branch (24:26): [True: 14, False: 401]
  ------------------
   25|  2.07k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.38k, False: 698]
  |  Branch (25:26): [True: 13, False: 1.36k]
  ------------------
   26|  2.06k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.00k, False: 1.05k]
  |  Branch (26:26): [True: 12, False: 997]
  ------------------
   27|  2.05k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 995, False: 1.05k]
  |  Branch (27:26): [True: 17, False: 978]
  ------------------
   28|       |
   29|  2.03k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.64k, False: 393]
  ------------------
   30|  2.03k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 685, False: 1.35k]
  ------------------
   31|  2.03k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 1.04k, False: 990]
  ------------------
   32|  2.03k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 1.05k, False: 978]
  ------------------
   33|       |
   34|  2.03k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.03k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 944, False: 1.09k]
  ------------------
   37|       |
   38|  1.09k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 582, False: 511]
  ------------------
   39|    582|    {
   40|    582|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    582|    }
   42|    511|    else
   43|    511|    {
   44|       |        /* unbuffered printing */
   45|    511|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 245, False: 266]
  ------------------
   46|    245|        {
   47|    245|            printed_json = cJSON_Print(json);
   48|    245|        }
   49|    266|        else
   50|    266|        {
   51|    266|            printed_json = cJSON_PrintUnformatted(json);
   52|    266|        }
   53|    511|    }
   54|       |
   55|  1.09k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.09k, False: 0]
  ------------------
   56|       |
   57|  1.09k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 902, False: 191]
  ------------------
   58|    902|    {
   59|    902|        copied = (unsigned char*)malloc(size);
   60|    902|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 902]
  ------------------
   61|       |
   62|    902|        memcpy(copied, data, size);
   63|       |
   64|    902|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    902|        free(copied);
   67|    902|    }
   68|       |
   69|  1.09k|    cJSON_Delete(json);
   70|       |
   71|  1.09k|    return 0;
   72|  1.09k|}

