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

LLVMFuzzerTestOneInput:
   14|  2.08k|{
   15|  2.08k|    cJSON *json;
   16|  2.08k|    size_t offset = 4;
   17|  2.08k|    unsigned char *copied;
   18|  2.08k|    char *printed_json = NULL;
   19|  2.08k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.08k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.08k]
  ------------------
   23|  2.08k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 9, False: 2.07k]
  ------------------
   24|  2.07k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 421, False: 1.65k]
  |  Branch (24:26): [True: 15, False: 406]
  ------------------
   25|  2.05k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.35k, False: 702]
  |  Branch (25:26): [True: 14, False: 1.34k]
  ------------------
   26|  2.04k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.02k, False: 1.02k]
  |  Branch (26:26): [True: 12, False: 1.01k]
  ------------------
   27|  2.03k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 965, False: 1.06k]
  |  Branch (27:26): [True: 17, False: 948]
  ------------------
   28|       |
   29|  2.01k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.62k, False: 395]
  ------------------
   30|  2.01k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 688, False: 1.32k]
  ------------------
   31|  2.01k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 1.01k, False: 1.00k]
  ------------------
   32|  2.01k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 1.06k, False: 948]
  ------------------
   33|       |
   34|  2.01k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.01k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 927, False: 1.08k]
  ------------------
   37|       |
   38|  1.08k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 578, False: 511]
  ------------------
   39|    578|    {
   40|    578|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    578|    }
   42|    511|    else
   43|    511|    {
   44|       |        /* unbuffered printing */
   45|    511|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 249, False: 262]
  ------------------
   46|    249|        {
   47|    249|            printed_json = cJSON_Print(json);
   48|    249|        }
   49|    262|        else
   50|    262|        {
   51|    262|            printed_json = cJSON_PrintUnformatted(json);
   52|    262|        }
   53|    511|    }
   54|       |
   55|  1.08k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.08k, False: 0]
  ------------------
   56|       |
   57|  1.08k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 896, False: 193]
  ------------------
   58|    896|    {
   59|    896|        copied = (unsigned char*)malloc(size);
   60|    896|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 896]
  ------------------
   61|       |
   62|    896|        memcpy(copied, data, size);
   63|       |
   64|    896|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    896|        free(copied);
   67|    896|    }
   68|       |
   69|  1.08k|    cJSON_Delete(json);
   70|       |
   71|  1.08k|    return 0;
   72|  1.08k|}

