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

LLVMFuzzerTestOneInput:
   14|  2.12k|{
   15|  2.12k|    cJSON *json;
   16|  2.12k|    size_t offset = 4;
   17|  2.12k|    unsigned char *copied;
   18|  2.12k|    char *printed_json = NULL;
   19|  2.12k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.12k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.11k]
  ------------------
   23|  2.11k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 10, False: 2.10k]
  ------------------
   24|  2.10k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 518, False: 1.58k]
  |  Branch (24:26): [True: 13, False: 505]
  ------------------
   25|  2.09k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.38k, False: 710]
  |  Branch (25:26): [True: 13, False: 1.37k]
  ------------------
   26|  2.08k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.06k, False: 1.01k]
  |  Branch (26:26): [True: 15, False: 1.04k]
  ------------------
   27|  2.06k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 1.02k, False: 1.03k]
  |  Branch (27:26): [True: 16, False: 1.01k]
  ------------------
   28|       |
   29|  2.04k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.55k, False: 492]
  ------------------
   30|  2.04k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 693, False: 1.35k]
  ------------------
   31|  2.04k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 1.00k, False: 1.04k]
  ------------------
   32|  2.04k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 1.03k, False: 1.01k]
  ------------------
   33|       |
   34|  2.04k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.04k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 968, False: 1.08k]
  ------------------
   37|       |
   38|  1.08k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 552, False: 529]
  ------------------
   39|    552|    {
   40|    552|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    552|    }
   42|    529|    else
   43|    529|    {
   44|       |        /* unbuffered printing */
   45|    529|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 243, False: 286]
  ------------------
   46|    243|        {
   47|    243|            printed_json = cJSON_Print(json);
   48|    243|        }
   49|    286|        else
   50|    286|        {
   51|    286|            printed_json = cJSON_PrintUnformatted(json);
   52|    286|        }
   53|    529|    }
   54|       |
   55|  1.08k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.08k, False: 0]
  ------------------
   56|       |
   57|  1.08k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 836, False: 245]
  ------------------
   58|    836|    {
   59|    836|        copied = (unsigned char*)malloc(size);
   60|    836|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 836]
  ------------------
   61|       |
   62|    836|        memcpy(copied, data, size);
   63|       |
   64|    836|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    836|        free(copied);
   67|    836|    }
   68|       |
   69|  1.08k|    cJSON_Delete(json);
   70|       |
   71|  1.08k|    return 0;
   72|  1.08k|}

