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

LLVMFuzzerTestOneInput:
   14|  2.09k|{
   15|  2.09k|    cJSON *json;
   16|  2.09k|    size_t offset = 4;
   17|  2.09k|    unsigned char *copied;
   18|  2.09k|    char *printed_json = NULL;
   19|  2.09k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.09k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.09k]
  ------------------
   23|  2.09k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 9, False: 2.08k]
  ------------------
   24|  2.08k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 425, False: 1.65k]
  |  Branch (24:26): [True: 15, False: 410]
  ------------------
   25|  2.06k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.28k, False: 782]
  |  Branch (25:26): [True: 12, False: 1.27k]
  ------------------
   26|  2.05k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.04k, False: 1.01k]
  |  Branch (26:26): [True: 14, False: 1.03k]
  ------------------
   27|  2.04k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 1.02k, False: 1.02k]
  |  Branch (27:26): [True: 14, False: 1.00k]
  ------------------
   28|       |
   29|  2.02k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.63k, False: 395]
  ------------------
   30|  2.02k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 770, False: 1.25k]
  ------------------
   31|  2.02k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 1.00k, False: 1.02k]
  ------------------
   32|  2.02k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 1.02k, False: 1.00k]
  ------------------
   33|       |
   34|  2.02k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.02k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 936, False: 1.09k]
  ------------------
   37|       |
   38|  1.09k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 548, False: 543]
  ------------------
   39|    548|    {
   40|    548|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    548|    }
   42|    543|    else
   43|    543|    {
   44|       |        /* unbuffered printing */
   45|    543|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 266, False: 277]
  ------------------
   46|    266|        {
   47|    266|            printed_json = cJSON_Print(json);
   48|    266|        }
   49|    277|        else
   50|    277|        {
   51|    277|            printed_json = cJSON_PrintUnformatted(json);
   52|    277|        }
   53|    543|    }
   54|       |
   55|  1.09k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.09k, False: 0]
  ------------------
   56|       |
   57|  1.09k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 895, False: 196]
  ------------------
   58|    895|    {
   59|    895|        copied = (unsigned char*)malloc(size);
   60|    895|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 895]
  ------------------
   61|       |
   62|    895|        memcpy(copied, data, size);
   63|       |
   64|    895|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    895|        free(copied);
   67|    895|    }
   68|       |
   69|  1.09k|    cJSON_Delete(json);
   70|       |
   71|  1.09k|    return 0;
   72|  1.09k|}

