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

LLVMFuzzerTestOneInput:
   14|  2.10k|{
   15|  2.10k|    cJSON *json;
   16|  2.10k|    size_t offset = 4;
   17|  2.10k|    unsigned char *copied;
   18|  2.10k|    char *printed_json = NULL;
   19|  2.10k|    int minify, require_termination, formatted, buffered;
   20|       |
   21|       |
   22|  2.10k|    if(size <= offset) return 0;
  ------------------
  |  Branch (22:8): [True: 4, False: 2.10k]
  ------------------
   23|  2.10k|    if(data[size-1] != '\0') return 0;
  ------------------
  |  Branch (23:8): [True: 11, False: 2.08k]
  ------------------
   24|  2.08k|    if(data[0] != '1' && data[0] != '0') return 0;
  ------------------
  |  Branch (24:8): [True: 454, False: 1.63k]
  |  Branch (24:26): [True: 16, False: 438]
  ------------------
   25|  2.07k|    if(data[1] != '1' && data[1] != '0') return 0;
  ------------------
  |  Branch (25:8): [True: 1.30k, False: 765]
  |  Branch (25:26): [True: 12, False: 1.29k]
  ------------------
   26|  2.06k|    if(data[2] != '1' && data[2] != '0') return 0;
  ------------------
  |  Branch (26:8): [True: 1.06k, False: 993]
  |  Branch (26:26): [True: 14, False: 1.05k]
  ------------------
   27|  2.04k|    if(data[3] != '1' && data[3] != '0') return 0;
  ------------------
  |  Branch (27:8): [True: 1.06k, False: 982]
  |  Branch (27:26): [True: 15, False: 1.05k]
  ------------------
   28|       |
   29|  2.03k|    minify              = data[0] == '1' ? 1 : 0;
  ------------------
  |  Branch (29:27): [True: 1.60k, False: 424]
  ------------------
   30|  2.03k|    require_termination = data[1] == '1' ? 1 : 0;
  ------------------
  |  Branch (30:27): [True: 753, False: 1.27k]
  ------------------
   31|  2.03k|    formatted           = data[2] == '1' ? 1 : 0;
  ------------------
  |  Branch (31:27): [True: 985, False: 1.04k]
  ------------------
   32|  2.03k|    buffered            = data[3] == '1' ? 1 : 0;
  ------------------
  |  Branch (32:27): [True: 982, False: 1.05k]
  ------------------
   33|       |
   34|  2.03k|    json = cJSON_ParseWithOpts((const char*)data + offset, NULL, require_termination);
   35|       |
   36|  2.03k|    if(json == NULL) return 0;
  ------------------
  |  Branch (36:8): [True: 937, False: 1.09k]
  ------------------
   37|       |
   38|  1.09k|    if(buffered)
  ------------------
  |  Branch (38:8): [True: 534, False: 561]
  ------------------
   39|    534|    {
   40|    534|        printed_json = cJSON_PrintBuffered(json, 1, formatted);
   41|    534|    }
   42|    561|    else
   43|    561|    {
   44|       |        /* unbuffered printing */
   45|    561|        if(formatted)
  ------------------
  |  Branch (45:12): [True: 262, False: 299]
  ------------------
   46|    262|        {
   47|    262|            printed_json = cJSON_Print(json);
   48|    262|        }
   49|    299|        else
   50|    299|        {
   51|    299|            printed_json = cJSON_PrintUnformatted(json);
   52|    299|        }
   53|    561|    }
   54|       |
   55|  1.09k|    if(printed_json != NULL) free(printed_json);
  ------------------
  |  Branch (55:8): [True: 1.09k, False: 0]
  ------------------
   56|       |
   57|  1.09k|    if(minify)
  ------------------
  |  Branch (57:8): [True: 873, False: 222]
  ------------------
   58|    873|    {
   59|    873|        copied = (unsigned char*)malloc(size);
   60|    873|        if(copied == NULL) return 0;
  ------------------
  |  Branch (60:12): [True: 0, False: 873]
  ------------------
   61|       |
   62|    873|        memcpy(copied, data, size);
   63|       |
   64|    873|        cJSON_Minify((char*)copied + offset);
   65|       |
   66|    873|        free(copied);
   67|    873|    }
   68|       |
   69|  1.09k|    cJSON_Delete(json);
   70|       |
   71|  1.09k|    return 0;
   72|  1.09k|}

