jv_get_kind:
  102|   130M|jv_kind jv_get_kind(jv x) {
  103|   130M|  return JVP_KIND(x);
  ------------------
  |  |   90|   130M|#define JVP_KIND(j)   (JVP_FLAGS(j) & KIND_MASK)
  |  |  ------------------
  |  |  |  |   89|   130M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |               #define JVP_KIND(j)   (JVP_FLAGS(j) & KIND_MASK)
  |  |  ------------------
  |  |  |  |   77|   130M|#define KIND_MASK   0xF
  |  |  ------------------
  ------------------
  104|   130M|}
jv_true:
  126|    312|jv jv_true(void) {
  127|    312|  return JV_TRUE;
  128|    312|}
jv_false:
  130|    926|jv jv_false(void) {
  131|    926|  return JV_FALSE;
  132|    926|}
jv_null:
  134|  2.58k|jv jv_null(void) {
  135|  2.58k|  return JV_NULL;
  136|  2.58k|}
jv_invalid_with_msg:
  153|  3.76k|jv jv_invalid_with_msg(jv err) {
  154|  3.76k|  jvp_invalid* i = jv_mem_alloc(sizeof(jvp_invalid));
  155|  3.76k|  i->refcnt = JV_REFCNT_INIT;
  156|  3.76k|  i->errmsg = err;
  157|       |
  158|  3.76k|  jv x = {JVP_FLAGS_INVALID_MSG, 0, 0, 0, {&i->refcnt}};
  ------------------
  |  |  146|  3.76k|#define JVP_FLAGS_INVALID_MSG   JVP_MAKE_FLAGS(JV_KIND_INVALID, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  3.76k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  3.76k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  3.76k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  159|  3.76k|  return x;
  160|  3.76k|}
jv_invalid:
  162|   965k|jv jv_invalid(void) {
  163|   965k|  return JV_INVALID;
  164|   965k|}
jv_invalid_get_msg:
  166|  1.88k|jv jv_invalid_get_msg(jv inv) {
  167|  1.88k|  assert(JVP_HAS_KIND(inv, JV_KIND_INVALID));
  ------------------
  |  Branch (167:3): [True: 0, False: 1.88k]
  |  Branch (167:3): [True: 1.88k, False: 0]
  ------------------
  168|       |
  169|  1.88k|  jv x;
  170|  1.88k|  if (JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG)) {
  ------------------
  |  |   92|  1.88k|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  1.88k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 1.88k, False: 0]
  |  |  ------------------
  ------------------
  171|  1.88k|    x = jv_copy(((jvp_invalid*)inv.u.ptr)->errmsg);
  172|  1.88k|  }
  173|      0|  else {
  174|      0|    x = jv_null();
  175|      0|  }
  176|       |
  177|  1.88k|  jv_free(inv);
  178|  1.88k|  return x;
  179|  1.88k|}
jv_invalid_has_msg:
  181|  6.03k|int jv_invalid_has_msg(jv inv) {
  182|  6.03k|  assert(JVP_HAS_KIND(inv, JV_KIND_INVALID));
  ------------------
  |  Branch (182:3): [True: 0, False: 6.03k]
  |  Branch (182:3): [True: 6.03k, False: 0]
  ------------------
  183|  6.03k|  int r = JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG);
  ------------------
  |  |   92|  6.03k|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  6.03k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  ------------------
  184|  6.03k|  jv_free(inv);
  185|  6.03k|  return r;
  186|  6.03k|}
jv_tsd_dec_ctx_fini:
  491|      1|void jv_tsd_dec_ctx_fini(void) {
  492|      1|  jv_mem_free(pthread_getspecific(dec_ctx_key));
  493|       |  pthread_setspecific(dec_ctx_key, NULL);
  494|      1|}
jv_tsd_dec_ctx_init:
  496|      1|void jv_tsd_dec_ctx_init(void) {
  497|      1|  if (pthread_key_create(&dec_ctx_key, jv_mem_free) != 0) {
  ------------------
  |  Branch (497:7): [True: 0, False: 1]
  ------------------
  498|      0|    fprintf(stderr, "error: cannot create thread specific key");
  499|      0|    abort();
  500|      0|  }
  501|      1|  atexit(jv_tsd_dec_ctx_fini);
  502|      1|}
jv_number_get_literal:
  658|  7.01M|const char* jv_number_get_literal(jv n) {
  659|  7.01M|  assert(JVP_HAS_KIND(n, JV_KIND_NUMBER));
  ------------------
  |  Branch (659:3): [True: 0, False: 7.01M]
  |  Branch (659:3): [True: 7.01M, False: 0]
  ------------------
  660|       |
  661|  7.01M|  if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) {
  ------------------
  |  |   92|  14.0M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  7.01M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 13.3k, False: 7.00M]
  |  |  |  Branch (92:50): [True: 7.01M, Folded]
  |  |  ------------------
  ------------------
  662|  13.3k|    return jvp_literal_number_literal(n);
  663|  7.00M|  } else {
  664|       |    return NULL;
  665|  7.00M|  }
  666|  7.01M|}
jv_number_with_literal:
  668|   743k|jv jv_number_with_literal(const char * literal) {
  669|   743k|  return jvp_literal_number_new(literal);
  670|   743k|}
jv_number:
  673|  16.6M|jv jv_number(double x) {
  674|  16.6M|  jv j = {
  675|  16.6M|#ifdef USE_DECNUM
  676|  16.6M|    JVP_FLAGS_NUMBER_NATIVE,
  ------------------
  |  |  205|  16.6M|#define JVP_FLAGS_NUMBER_NATIVE       JVP_MAKE_FLAGS(JV_KIND_NUMBER, JVP_MAKE_PFLAGS(JVP_NUMBER_NATIVE, 0))
  |  |  ------------------
  |  |  |  |   87|  33.2M|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  16.6M|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  16.6M|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (87:61): [Folded, False: 16.6M]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  677|       |#else
  678|       |    JV_KIND_NUMBER,
  679|       |#endif
  680|  16.6M|    0, 0, 0, {.number = x}
  681|  16.6M|  };
  682|  16.6M|  return j;
  683|  16.6M|}
jv_number_value:
  698|  7.00M|double jv_number_value(jv j) {
  699|  7.00M|  assert(JVP_HAS_KIND(j, JV_KIND_NUMBER));
  ------------------
  |  Branch (699:3): [True: 0, False: 7.00M]
  |  Branch (699:3): [True: 7.00M, False: 0]
  ------------------
  700|  7.00M|#ifdef USE_DECNUM
  701|  7.00M|  if (JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)) {
  ------------------
  |  |   92|  14.0M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  7.00M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 5.19k, False: 7.00M]
  |  |  |  Branch (92:50): [True: 7.00M, Folded]
  |  |  ------------------
  ------------------
  702|  5.19k|    jvp_literal_number* n = jvp_literal_number_ptr(j);
  703|       |
  704|  5.19k|    if (isnan(n->num_double)) {
  ------------------
  |  Branch (704:9): [True: 5.19k, False: 0]
  ------------------
  705|  5.19k|      n->num_double = jvp_literal_number_to_double(j);
  706|  5.19k|    }
  707|       |
  708|  5.19k|    return n->num_double;
  709|  5.19k|  }
  710|  7.00M|#endif
  711|  7.00M|  return j.u.number;
  712|  7.00M|}
jvp_number_is_nan:
  727|  7.01M|int jvp_number_is_nan(jv n) {
  728|  7.01M|  assert(JVP_HAS_KIND(n, JV_KIND_NUMBER));
  ------------------
  |  Branch (728:3): [True: 0, False: 7.01M]
  |  Branch (728:3): [True: 7.01M, False: 0]
  ------------------
  729|       |
  730|  7.01M|#ifdef USE_DECNUM
  731|  7.01M|  if (JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL)) {
  ------------------
  |  |   92|  14.0M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  7.01M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 13.3k, False: 7.00M]
  |  |  |  Branch (92:50): [True: 7.01M, Folded]
  |  |  ------------------
  ------------------
  732|  13.3k|    decNumber *pdec = jvp_dec_number_ptr(n);
  733|  13.3k|    return decNumberIsNaN(pdec);
  ------------------
  |  |  172|  13.3k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  13.3k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  13.3k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  734|  13.3k|  }
  735|  7.00M|#endif
  736|  7.00M|  return isnan(n.u.number);
  737|  7.01M|}
jv_array_sized:
  982|   492k|jv jv_array_sized(int n) {
  983|   492k|  return jvp_array_new(n);
  984|   492k|}
jv_array:
  986|   491k|jv jv_array(void) {
  987|   491k|  return jv_array_sized(16);
  988|   491k|}
jv_array_length:
  990|  17.8M|int jv_array_length(jv j) {
  991|  17.8M|  assert(JVP_HAS_KIND(j, JV_KIND_ARRAY));
  ------------------
  |  Branch (991:3): [True: 0, False: 17.8M]
  |  Branch (991:3): [True: 17.8M, False: 0]
  ------------------
  992|  17.8M|  int len = jvp_array_length(j);
  993|  17.8M|  jv_free(j);
  994|  17.8M|  return len;
  995|  17.8M|}
jv_array_get:
  997|  7.16M|jv jv_array_get(jv j, int idx) {
  998|  7.16M|  assert(JVP_HAS_KIND(j, JV_KIND_ARRAY));
  ------------------
  |  Branch (998:3): [True: 0, False: 7.16M]
  |  Branch (998:3): [True: 7.16M, False: 0]
  ------------------
  999|  7.16M|  jv* slot = jvp_array_read(j, idx);
 1000|  7.16M|  jv val;
 1001|  7.16M|  if (slot) {
  ------------------
  |  Branch (1001:7): [True: 7.16M, False: 0]
  ------------------
 1002|  7.16M|    val = jv_copy(*slot);
 1003|  7.16M|  } else {
 1004|      0|    val = jv_invalid();
 1005|      0|  }
 1006|  7.16M|  jv_free(j);
 1007|  7.16M|  return val;
 1008|  7.16M|}
jv_array_set:
 1010|  17.5M|jv jv_array_set(jv j, int idx, jv val) {
 1011|  17.5M|  assert(JVP_HAS_KIND(j, JV_KIND_ARRAY));
  ------------------
  |  Branch (1011:3): [True: 0, False: 17.5M]
  |  Branch (1011:3): [True: 17.5M, False: 0]
  ------------------
 1012|       |
 1013|  17.5M|  if (idx < 0)
  ------------------
  |  Branch (1013:7): [True: 0, False: 17.5M]
  ------------------
 1014|      0|    idx = jvp_array_length(j) + idx;
 1015|  17.5M|  if (idx < 0) {
  ------------------
  |  Branch (1015:7): [True: 0, False: 17.5M]
  ------------------
 1016|      0|    jv_free(j);
 1017|      0|    jv_free(val);
 1018|      0|    return jv_invalid_with_msg(jv_string("Out of bounds negative array index"));
 1019|      0|  }
 1020|  17.5M|  if (idx > (INT_MAX >> 2) - jvp_array_offset(j)) {
  ------------------
  |  Branch (1020:7): [True: 0, False: 17.5M]
  ------------------
 1021|      0|    jv_free(j);
 1022|      0|    jv_free(val);
 1023|      0|    return jv_invalid_with_msg(jv_string("Array index too large"));
 1024|      0|  }
 1025|       |  // copy/free of val,j coalesced
 1026|  17.5M|  jv* slot = jvp_array_write(&j, idx);
 1027|  17.5M|  jv_free(*slot);
 1028|  17.5M|  *slot = val;
 1029|  17.5M|  return j;
 1030|  17.5M|}
jv_array_append:
 1032|  17.5M|jv jv_array_append(jv j, jv val) {
 1033|       |  // copy/free of val,j coalesced
 1034|  17.5M|  return jv_array_set(j, jv_array_length(jv_copy(j)), val);
 1035|  17.5M|}
jv_array_slice:
 1050|    204|jv jv_array_slice(jv a, int start, int end) {
 1051|    204|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (1051:3): [True: 0, False: 204]
  |  Branch (1051:3): [True: 204, False: 0]
  ------------------
 1052|       |  // copy/free of a coalesced
 1053|    204|  return jvp_array_slice(a, start, end);
 1054|    204|}
jv_string_sized:
 1312|  22.4k|jv jv_string_sized(const char* str, int len) {
 1313|  22.4k|  return
 1314|  22.4k|    jvp_utf8_is_valid(str, str+len) ?
  ------------------
  |  Branch (1314:5): [True: 16.7k, False: 5.75k]
  ------------------
 1315|  16.7k|    jvp_string_new(str, len) :
 1316|  22.4k|    jvp_string_copy_replace_bad(str, len);
 1317|  22.4k|}
jv_string:
 1323|    372|jv jv_string(const char* str) {
 1324|    372|  return jv_string_sized(str, strlen(str));
 1325|    372|}
jv_string_length_bytes:
 1327|  36.2k|int jv_string_length_bytes(jv j) {
 1328|  36.2k|  assert(JVP_HAS_KIND(j, JV_KIND_STRING));
  ------------------
  |  Branch (1328:3): [True: 0, False: 36.2k]
  |  Branch (1328:3): [True: 36.2k, False: 0]
  ------------------
 1329|  36.2k|  int r = jvp_string_length(jvp_string_ptr(j));
 1330|  36.2k|  jv_free(j);
 1331|  36.2k|  return r;
 1332|  36.2k|}
jv_string_value:
 1481|  38.1k|const char* jv_string_value(jv j) {
 1482|  38.1k|  assert(JVP_HAS_KIND(j, JV_KIND_STRING));
  ------------------
  |  Branch (1482:3): [True: 0, False: 38.1k]
  |  Branch (1482:3): [True: 38.1k, False: 0]
  ------------------
 1483|  38.1k|  return jvp_string_ptr(j)->data;
 1484|  38.1k|}
jv_string_vfmt:
 1563|  3.94k|jv jv_string_vfmt(const char* fmt, va_list ap) {
 1564|  3.94k|  int size = 1024;
 1565|  4.30k|  while (1) {
  ------------------
  |  Branch (1565:10): [True: 4.30k, Folded]
  ------------------
 1566|  4.30k|    char* buf = jv_mem_alloc(size);
 1567|  4.30k|    va_list ap2;
 1568|  4.30k|    va_copy(ap2, ap);
 1569|  4.30k|    int n = vsnprintf(buf, size, fmt, ap2);
 1570|  4.30k|    va_end(ap2);
 1571|       |    /*
 1572|       |     * NOTE: here we support old vsnprintf()s that return -1 because the
 1573|       |     * buffer is too small.
 1574|       |     */
 1575|  4.30k|    if (n >= 0 && n < size) {
  ------------------
  |  Branch (1575:9): [True: 4.30k, False: 0]
  |  Branch (1575:19): [True: 3.94k, False: 353]
  ------------------
 1576|  3.94k|      jv ret = jv_string_sized(buf, n);
 1577|  3.94k|      jv_mem_free(buf);
 1578|  3.94k|      return ret;
 1579|  3.94k|    } else {
 1580|    353|      jv_mem_free(buf);
 1581|    353|      size = (n > 0) ? /* standard */ (n * 2) : /* not standard */ (size * 2);
  ------------------
  |  Branch (1581:14): [True: 353, False: 0]
  ------------------
 1582|    353|    }
 1583|  4.30k|  }
 1584|  3.94k|}
jv_string_fmt:
 1586|  1.88k|jv jv_string_fmt(const char* fmt, ...) {
 1587|  1.88k|  va_list args;
 1588|  1.88k|  va_start(args, fmt);
 1589|  1.88k|  jv res = jv_string_vfmt(fmt, args);
 1590|       |  va_end(args);
 1591|  1.88k|  return res;
 1592|  1.88k|}
jv_object:
 1849|  67.1k|jv jv_object(void) {
 1850|  67.1k|  return jvp_object_new(8);
 1851|  67.1k|}
jv_object_get:
 1853|  4.47k|jv jv_object_get(jv object, jv key) {
 1854|  4.47k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1854:3): [True: 0, False: 4.47k]
  |  Branch (1854:3): [True: 4.47k, False: 0]
  ------------------
 1855|  4.47k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1855:3): [True: 0, False: 4.47k]
  |  Branch (1855:3): [True: 4.47k, False: 0]
  ------------------
 1856|  4.47k|  jv* slot = jvp_object_read(object, key);
 1857|  4.47k|  jv val;
 1858|  4.47k|  if (slot) {
  ------------------
  |  Branch (1858:7): [True: 4.47k, False: 0]
  ------------------
 1859|  4.47k|    val = jv_copy(*slot);
 1860|  4.47k|  } else {
 1861|      0|    val = jv_invalid();
 1862|      0|  }
 1863|  4.47k|  jv_free(object);
 1864|  4.47k|  jv_free(key);
 1865|  4.47k|  return val;
 1866|  4.47k|}
jv_object_set:
 1878|  13.7k|jv jv_object_set(jv object, jv key, jv value) {
 1879|  13.7k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1879:3): [True: 0, False: 13.7k]
  |  Branch (1879:3): [True: 13.7k, False: 0]
  ------------------
 1880|  13.7k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1880:3): [True: 0, False: 13.7k]
  |  Branch (1880:3): [True: 13.7k, False: 0]
  ------------------
 1881|       |  // copy/free of object, key, value coalesced
 1882|  13.7k|  jv* slot;
 1883|  13.7k|  if (!jvp_object_write(&object, key, &slot)) {
  ------------------
  |  Branch (1883:7): [True: 0, False: 13.7k]
  ------------------
 1884|      0|    jv_free(object);
 1885|      0|    jv_free(value);
 1886|      0|    return jv_invalid_with_msg(jv_string("Object too big"));
 1887|      0|  }
 1888|  13.7k|  jv_free(*slot);
 1889|  13.7k|  *slot = value;
 1890|  13.7k|  return object;
 1891|  13.7k|}
jv_object_length:
 1901|  12.4k|int jv_object_length(jv object) {
 1902|  12.4k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1902:3): [True: 0, False: 12.4k]
  |  Branch (1902:3): [True: 12.4k, False: 0]
  ------------------
 1903|  12.4k|  int n = jvp_object_length(object);
 1904|  12.4k|  jv_free(object);
 1905|  12.4k|  return n;
 1906|  12.4k|}
jv_object_iter_valid:
 1965|  6.79k|int jv_object_iter_valid(jv object, int i) {
 1966|  6.79k|  return i != ITER_FINISHED;
 1967|  6.79k|}
jv_object_iter:
 1969|  1.49k|int jv_object_iter(jv object) {
 1970|  1.49k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1970:3): [True: 0, False: 1.49k]
  |  Branch (1970:3): [True: 1.49k, False: 0]
  ------------------
 1971|  1.49k|  return jv_object_iter_next(object, -1);
 1972|  1.49k|}
jv_object_iter_next:
 1974|  6.79k|int jv_object_iter_next(jv object, int iter) {
 1975|  6.79k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1975:3): [True: 0, False: 6.79k]
  |  Branch (1975:3): [True: 6.79k, False: 0]
  ------------------
 1976|  6.79k|  assert(iter != ITER_FINISHED);
  ------------------
  |  Branch (1976:3): [True: 0, False: 6.79k]
  |  Branch (1976:3): [True: 6.79k, False: 0]
  ------------------
 1977|  6.79k|  struct object_slot* slot;
 1978|  17.2k|  do {
 1979|  17.2k|    iter++;
 1980|  17.2k|    if (iter >= jvp_object_size(object))
  ------------------
  |  Branch (1980:9): [True: 1.49k, False: 15.7k]
  ------------------
 1981|  1.49k|      return ITER_FINISHED;
 1982|  15.7k|    slot = jvp_object_get_slot(object, iter);
 1983|  15.7k|  } while (jv_get_kind(slot->string) == JV_KIND_NULL);
  ------------------
  |  Branch (1983:12): [True: 10.4k, False: 5.30k]
  ------------------
 1984|  6.79k|  assert(jv_get_kind(jvp_object_get_slot(object,iter)->string)
  ------------------
  |  Branch (1984:3): [True: 0, False: 5.30k]
  |  Branch (1984:3): [True: 5.30k, False: 0]
  ------------------
 1985|  5.30k|         == JV_KIND_STRING);
 1986|  5.30k|  return iter;
 1987|  5.30k|}
jv_object_iter_key:
 1989|  5.30k|jv jv_object_iter_key(jv object, int iter) {
 1990|  5.30k|  jv s = jvp_object_get_slot(object, iter)->string;
 1991|  5.30k|  assert(JVP_HAS_KIND(s, JV_KIND_STRING));
  ------------------
  |  Branch (1991:3): [True: 0, False: 5.30k]
  |  Branch (1991:3): [True: 5.30k, False: 0]
  ------------------
 1992|  5.30k|  return jv_copy(s);
 1993|  5.30k|}
jv_object_iter_value:
 1995|  5.30k|jv jv_object_iter_value(jv object, int iter) {
 1996|  5.30k|  return jv_copy(jvp_object_get_slot(object, iter)->value);
 1997|  5.30k|}
jv_copy:
 2002|  78.1M|jv jv_copy(jv j) {
 2003|  78.1M|  if (JVP_IS_ALLOCATED(j)) {
  ------------------
  |  |   95|  78.1M|#define JVP_IS_ALLOCATED(j) (j.kind_flags & JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  Branch (95:29): [True: 27.1M, False: 51.0M]
  |  |  ------------------
  ------------------
 2004|  27.1M|    jvp_refcnt_inc(j.u.ptr);
 2005|  27.1M|  }
 2006|  78.1M|  return j;
 2007|  78.1M|}
jv_free:
 2014|  51.1M|void jv_free(jv j) {
 2015|  51.1M|  jv* pending = NULL;
 2016|  51.1M|  size_t len = 0, cap = 0;
 2017|   114M|  while (1) {
  ------------------
  |  Branch (2017:10): [True: 114M, Folded]
  ------------------
 2018|   114M|    switch (JVP_KIND(j)) {
  ------------------
  |  |   90|   114M|#define JVP_KIND(j)   (JVP_FLAGS(j) & KIND_MASK)
  |  |  ------------------
  |  |  |  |   89|   114M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |               #define JVP_KIND(j)   (JVP_FLAGS(j) & KIND_MASK)
  |  |  ------------------
  |  |  |  |   77|   114M|#define KIND_MASK   0xF
  |  |  ------------------
  |  |  |  Branch (90:23): [True: 97.1M, False: 17.5M]
  |  |  ------------------
  ------------------
 2019|  25.6M|      case JV_KIND_ARRAY:
  ------------------
  |  Branch (2019:7): [True: 25.6M, False: 89.0M]
  ------------------
 2020|  25.6M|        if (jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  Branch (2020:13): [True: 496k, False: 25.1M]
  ------------------
 2021|   496k|          jvp_array* arr = jvp_array_ptr(j);
 2022|   496k|          if (len + arr->length > cap) {
  ------------------
  |  Branch (2022:15): [True: 7.45k, False: 488k]
  ------------------
 2023|  7.45k|            cap = (len + arr->length) * 2;
 2024|  7.45k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2025|  7.45k|          }
 2026|  63.9M|          for (int i = 0; i < arr->length; i++)
  ------------------
  |  Branch (2026:27): [True: 63.4M, False: 496k]
  ------------------
 2027|  63.4M|            pending[len++] = arr->elements[i];
 2028|   496k|          jv_mem_free(arr);
 2029|   496k|        }
 2030|  25.6M|        break;
 2031|   107k|      case JV_KIND_OBJECT:
  ------------------
  |  Branch (2031:7): [True: 107k, False: 114M]
  ------------------
 2032|   107k|        if (jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  Branch (2032:13): [True: 67.1k, False: 39.9k]
  ------------------
 2033|  67.1k|          int sz = jvp_object_size(j);
 2034|  67.1k|          if (len + sz > cap) {
  ------------------
  |  Branch (2034:15): [True: 56.3k, False: 10.7k]
  ------------------
 2035|  56.3k|            cap = (len + sz) * 2;
 2036|  56.3k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2037|  56.3k|          }
 2038|   613k|          for (int i = 0; i < sz; i++) {
  ------------------
  |  Branch (2038:27): [True: 546k, False: 67.1k]
  ------------------
 2039|   546k|            struct object_slot* slot = jvp_object_get_slot(j, i);
 2040|   546k|            if (jv_get_kind(slot->string) != JV_KIND_NULL) {
  ------------------
  |  Branch (2040:17): [True: 11.2k, False: 535k]
  ------------------
 2041|  11.2k|              jvp_string_free(slot->string);
 2042|  11.2k|              pending[len++] = slot->value;
 2043|  11.2k|            }
 2044|   546k|          }
 2045|  67.1k|          jv_mem_free(jvp_object_ptr(j));
 2046|  67.1k|        }
 2047|   107k|        break;
 2048|   967k|      case JV_KIND_INVALID:
  ------------------
  |  Branch (2048:7): [True: 967k, False: 113M]
  ------------------
 2049|   967k|        if (JVP_HAS_FLAGS(j, JVP_FLAGS_INVALID_MSG) && jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  |   92|  1.93M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|   967k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 7.16k, False: 960k]
  |  |  ------------------
  ------------------
  |  Branch (2049:56): [True: 3.76k, False: 3.40k]
  ------------------
 2050|  3.76k|          if (len + 1 > cap) {
  ------------------
  |  Branch (2050:15): [True: 3.76k, False: 0]
  ------------------
 2051|  3.76k|            cap = (len + 1) * 2;
 2052|  3.76k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2053|  3.76k|          }
 2054|  3.76k|          pending[len++] = ((jvp_invalid*)j.u.ptr)->errmsg;
 2055|  3.76k|          jv_mem_free(j.u.ptr);
 2056|  3.76k|        }
 2057|   967k|        break;
 2058|  65.3k|      case JV_KIND_STRING:
  ------------------
  |  Branch (2058:7): [True: 65.3k, False: 114M]
  ------------------
 2059|  65.3k|        jvp_string_free(j);
 2060|  65.3k|        break;
 2061|  70.3M|      case JV_KIND_NUMBER:
  ------------------
  |  Branch (2061:7): [True: 70.3M, False: 44.3M]
  ------------------
 2062|  70.3M|        jvp_number_free(j);
 2063|  70.3M|        break;
 2064|   114M|    }
 2065|   114M|    if (len == 0) break;
  ------------------
  |  Branch (2065:9): [True: 51.1M, False: 63.4M]
  ------------------
 2066|  63.4M|    j = pending[--len];
 2067|  63.4M|  }
 2068|  51.1M|  jv_mem_free(pending);
 2069|  51.1M|}
jv_get_refcnt:
 2071|  1.67M|int jv_get_refcnt(jv j) {
 2072|  1.67M|  if (JVP_IS_ALLOCATED(j)) {
  ------------------
  |  |   95|  1.67M|#define JVP_IS_ALLOCATED(j) (j.kind_flags & JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  Branch (95:29): [True: 28.1k, False: 1.64M]
  |  |  ------------------
  ------------------
 2073|  28.1k|    return j.u.ptr->count;
 2074|  1.64M|  } else {
 2075|  1.64M|    return 1;
 2076|  1.64M|  }
 2077|  1.67M|}
jv.c:jvp_literal_number_literal:
  622|  13.3k|static const char* jvp_literal_number_literal(jv n) {
  623|  13.3k|  assert(JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (623:3): [True: 0, Folded]
  |  Branch (623:3): [True: 0, False: 13.3k]
  |  Branch (623:3): [True: 13.3k, Folded]
  |  Branch (623:3): [True: 13.3k, False: 0]
  ------------------
  624|  13.3k|  decNumber *pdec = jvp_dec_number_ptr(n);
  625|  13.3k|  jvp_literal_number* plit = jvp_literal_number_ptr(n);
  626|       |
  627|  13.3k|  if (decNumberIsNaN(pdec)) {
  ------------------
  |  |  172|  13.3k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  13.3k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  13.3k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 0, False: 13.3k]
  |  |  ------------------
  ------------------
  628|      0|    return "null";
  629|      0|  }
  630|       |
  631|  13.3k|  if (decNumberIsInfinite(pdec)) {
  ------------------
  |  |  171|  13.3k|  #define decNumberIsInfinite(dn)  (((dn)->bits&DECINF)!=0)
  |  |  ------------------
  |  |  |  |   32|  13.3k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |  |  Branch (171:36): [True: 5.19k, False: 8.13k]
  |  |  ------------------
  ------------------
  632|       |    // We cannot preserve the literal data of numbers outside the limited
  633|       |    // range of exponent. Since `decNumberToString` returns "Infinity"
  634|       |    // (or "-Infinity"), and to reduce stack allocations as possible, we
  635|       |    // normalize infinities in the callers instead of printing the maximum
  636|       |    // (or minimum) double here.
  637|  5.19k|    return NULL;
  638|  5.19k|  }
  639|       |
  640|  8.13k|  if (plit->literal_data == NULL) {
  ------------------
  |  Branch (640:7): [True: 8.13k, False: 0]
  ------------------
  641|  8.13k|    int len = jvp_dec_number_ptr(n)->digits + 15 /* 14 + NUL */;
  642|  8.13k|    plit->literal_data = jv_mem_alloc(len);
  643|       |
  644|       |    // Preserve the actual precision as we have parsed it
  645|       |    // don't do decNumberTrim(pdec);
  646|       |
  647|  8.13k|    decNumberToString(pdec, plit->literal_data);
  648|  8.13k|  }
  649|       |
  650|  8.13k|  return plit->literal_data;
  651|  13.3k|}
jv.c:jvp_literal_number_new:
  572|   743k|static jv jvp_literal_number_new(const char * literal) {
  573|   743k|  size_t len = strlen(literal);
  574|   743k|  if (len > DEC_MAX_DIGITS)
  ------------------
  |  |   88|   743k|  #define DEC_MAX_DIGITS 999999999
  ------------------
  |  Branch (574:7): [True: 0, False: 743k]
  ------------------
  575|      0|    return JV_INVALID;
  576|   743k|  jvp_literal_number* n = jvp_literal_number_alloc(len);
  577|       |
  578|   743k|  decContext *ctx = DEC_CONTEXT();
  ------------------
  |  |  487|   743k|#define DEC_CONTEXT() tsd_dec_ctx_get(&dec_ctx_key)
  ------------------
  579|   743k|  decContextClearStatus(ctx, DEC_Conversion_syntax);
  ------------------
  |  |  128|   743k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  580|   743k|  decNumberFromString(&n->num_decimal, literal, ctx);
  581|       |
  582|   743k|  if (ctx->status & DEC_Conversion_syntax) {
  ------------------
  |  |  128|   743k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  |  Branch (582:7): [True: 505, False: 743k]
  ------------------
  583|    505|    jv_mem_free(n);
  584|    505|    return JV_INVALID;
  585|    505|  }
  586|   743k|  if (decNumberIsNaN(&n->num_decimal)) {
  ------------------
  |  |  172|   743k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|   743k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|   743k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 1.16k, False: 741k]
  |  |  ------------------
  ------------------
  587|       |    // Reject NaN with payload.
  588|  1.16k|    if (n->num_decimal.digits > 1 || *n->num_decimal.lsu != 0) {
  ------------------
  |  Branch (588:9): [True: 36, False: 1.12k]
  |  Branch (588:38): [True: 4, False: 1.12k]
  ------------------
  589|     40|      jv_mem_free(n);
  590|     40|      return JV_INVALID;
  591|     40|    }
  592|  1.12k|    jv_mem_free(n);
  593|  1.12k|    return jv_number(NAN);
  594|  1.16k|  }
  595|       |
  596|   741k|  jv r = {JVP_FLAGS_NUMBER_LITERAL, 0, 0, 0, {&n->refcnt}};
  ------------------
  |  |  206|   741k|#define JVP_FLAGS_NUMBER_LITERAL      JVP_MAKE_FLAGS(JV_KIND_NUMBER, JVP_MAKE_PFLAGS(JVP_NUMBER_DECIMAL, 1))
  |  |  ------------------
  |  |  |  |   87|  1.48M|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   741k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|   741k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (87:61): [True: 741k, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  597|   741k|  return r;
  598|   743k|}
jv.c:jvp_literal_number_ptr:
  547|   760k|static jvp_literal_number* jvp_literal_number_ptr(jv j) {
  548|   760k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (548:3): [True: 0, Folded]
  |  Branch (548:3): [True: 0, False: 760k]
  |  Branch (548:3): [True: 760k, Folded]
  |  Branch (548:3): [True: 760k, False: 0]
  ------------------
  549|   760k|  return (jvp_literal_number*)j.u.ptr;
  550|   760k|}
jv.c:jvp_literal_number_to_double:
  600|  5.19k|static double jvp_literal_number_to_double(jv j) {
  601|  5.19k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (601:3): [True: 0, Folded]
  |  Branch (601:3): [True: 0, False: 5.19k]
  |  Branch (601:3): [True: 5.19k, Folded]
  |  Branch (601:3): [True: 5.19k, False: 0]
  ------------------
  602|  5.19k|  decContext dblCtx;
  603|       |
  604|       |  // init as decimal64 but change digits to allow conversion to binary64 (double)
  605|  5.19k|  decContextDefault(&dblCtx, DEC_INIT_DECIMAL64);
  ------------------
  |  |  229|  5.19k|  #define DEC_INIT_DECIMAL64   64
  ------------------
  606|  5.19k|  dblCtx.digits = DEC_NUMBER_DOUBLE_PRECISION;
  ------------------
  |  |  209|  5.19k|#define DEC_NUMBER_DOUBLE_PRECISION   (17)
  ------------------
  607|       |
  608|  5.19k|  decNumber *p_dec_number = jvp_dec_number_ptr(j);
  609|  5.19k|  decNumberDoublePrecision dec_double;
  610|  5.19k|  char literal[DEC_NUMBER_DOUBLE_PRECISION + DEC_NUMBER_STRING_GUARD + 1];
  611|       |
  612|       |  // reduce the number to the shortest possible form
  613|       |  // that fits into the 64 bit floating point representation
  614|  5.19k|  decNumberReduce(&dec_double.number, p_dec_number, &dblCtx);
  615|       |
  616|  5.19k|  decNumberToString(&dec_double.number, literal);
  617|       |
  618|  5.19k|  char *end;
  619|  5.19k|  return jvp_strtod(tsd_dtoa_context_get(), literal, &end);
  620|  5.19k|}
jv.c:jvp_dec_number_ptr:
  552|  39.9k|static decNumber* jvp_dec_number_ptr(jv j) {
  553|  39.9k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (553:3): [True: 0, Folded]
  |  Branch (553:3): [True: 0, False: 39.9k]
  |  Branch (553:3): [True: 39.9k, Folded]
  |  Branch (553:3): [True: 39.9k, False: 0]
  ------------------
  554|  39.9k|  return &(((jvp_literal_number*)j.u.ptr)->num_decimal);
  555|  39.9k|}
jv.c:jvp_literal_number_alloc:
  557|   743k|static jvp_literal_number* jvp_literal_number_alloc(unsigned literal_length) {
  558|       |  /* The number of units needed is ceil(DECNUMDIGITS/DECDPUN)         */
  559|   743k|  int units = ((literal_length+DECDPUN-1)/DECDPUN);
  ------------------
  |  |   43|   743k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
                int units = ((literal_length+DECDPUN-1)/DECDPUN);
  ------------------
  |  |   43|   743k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  560|       |
  561|   743k|  jvp_literal_number* n = jv_mem_alloc(
  562|   743k|    sizeof(jvp_literal_number)
  563|   743k|    + sizeof(decNumberUnit) * units
  564|   743k|  );
  565|       |
  566|   743k|  n->refcnt = JV_REFCNT_INIT;
  567|   743k|  n->num_double = NAN;
  568|       |  n->literal_data = NULL;
  569|   743k|  return n;
  570|   743k|}
jv.c:tsd_dec_ctx_get:
  504|   743k|static decContext* tsd_dec_ctx_get(pthread_key_t *key) {
  505|   743k|  pthread_once(&dec_ctx_once, jv_tsd_dec_ctx_init); // cannot fail
  506|   743k|  decContext *ctx = (decContext*)pthread_getspecific(*key);
  507|   743k|  if (ctx) {
  ------------------
  |  Branch (507:7): [True: 743k, False: 1]
  ------------------
  508|   743k|    return ctx;
  509|   743k|  }
  510|       |
  511|      1|  ctx = malloc(sizeof(decContext));
  512|      1|  if (ctx) {
  ------------------
  |  Branch (512:7): [True: 1, False: 0]
  ------------------
  513|      1|    if (key == &dec_ctx_key)
  ------------------
  |  Branch (513:9): [True: 1, False: 0]
  ------------------
  514|      1|    {
  515|      1|      decContextDefault(ctx, DEC_INIT_BASE);
  ------------------
  |  |  227|      1|  #define DEC_INIT_BASE         0
  ------------------
  516|       |      // make sure (Int)D2U(rhs->exponent-lhs->exponent) does not overflow
  517|      1|      ctx->digits = MIN(DEC_MAX_DIGITS,
  ------------------
  |  |   49|      1|  ({ __typeof__ (a) _a = (a); \
  |  |   50|      1|   __typeof__ (b) _b = (b); \
  |  |   51|      1|   _a < _b ? _a : _b; })
  |  |  ------------------
  |  |  |  Branch (51:4): [True: 0, False: 1]
  |  |  ------------------
  ------------------
  518|      1|          INT32_MAX - (DECDPUN - 1) - (ctx->emax - ctx->emin - 1));
  519|      1|      ctx->traps = 0; /*no errors*/
  520|      1|    }
  521|      1|    if (pthread_setspecific(*key, ctx) != 0) {
  ------------------
  |  Branch (521:9): [True: 0, False: 1]
  ------------------
  522|      0|      fprintf(stderr, "error: cannot store thread specific data");
  523|      0|      abort();
  524|      0|    }
  525|      1|  }
  526|      1|  return ctx;
  527|      1|}
jv.c:jvp_array_new:
  840|   492k|static jv jvp_array_new(unsigned size) {
  841|   492k|  jv r = {JVP_FLAGS_ARRAY, 0, 0, 0, {&jvp_array_alloc(size)->refcnt}};
  ------------------
  |  |  813|   492k|#define JVP_FLAGS_ARRAY   JVP_MAKE_FLAGS(JV_KIND_ARRAY, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|   492k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   492k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|   492k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  842|   492k|  return r;
  843|   492k|}
jv.c:jvp_array_alloc:
  832|   496k|static jvp_array* jvp_array_alloc(unsigned size) {
  833|   496k|  jvp_array* a = jv_mem_alloc(sizeof(jvp_array) + sizeof(jv) * size);
  834|   496k|  a->refcnt.count = 1;
  835|   496k|  a->length = 0;
  836|   496k|  a->alloc_length = size;
  837|   496k|  return a;
  838|   496k|}
jv.c:jvp_array_length:
  845|  70.9M|static int jvp_array_length(jv a) {
  846|  70.9M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (846:3): [True: 0, False: 70.9M]
  |  Branch (846:3): [True: 70.9M, False: 0]
  ------------------
  847|  70.9M|  return a.size;
  848|  70.9M|}
jv.c:jvp_array_read:
  855|  7.16M|static jv* jvp_array_read(jv a, int i) {
  856|  7.16M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (856:3): [True: 0, False: 7.16M]
  |  Branch (856:3): [True: 7.16M, False: 0]
  ------------------
  857|  7.16M|  if (i >= 0 && i < jvp_array_length(a)) {
  ------------------
  |  Branch (857:7): [True: 7.16M, False: 0]
  |  Branch (857:17): [True: 7.16M, False: 0]
  ------------------
  858|  7.16M|    jvp_array* array = jvp_array_ptr(a);
  859|  7.16M|    assert(i + jvp_array_offset(a) < array->length);
  ------------------
  |  Branch (859:5): [True: 0, False: 7.16M]
  |  Branch (859:5): [True: 7.16M, False: 0]
  ------------------
  860|  7.16M|    return &array->elements[i + jvp_array_offset(a)];
  861|  7.16M|  } else {
  862|      0|    return 0;
  863|      0|  }
  864|  7.16M|}
jv.c:jvp_array_offset:
  850|  95.3M|static int jvp_array_offset(jv a) {
  851|  95.3M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (851:3): [True: 0, False: 95.3M]
  |  Branch (851:3): [True: 95.3M, False: 0]
  ------------------
  852|  95.3M|  return a.offset;
  853|  95.3M|}
jv.c:jvp_array_write:
  866|  17.5M|static jv* jvp_array_write(jv* a, int i) {
  867|  17.5M|  assert(i >= 0);
  ------------------
  |  Branch (867:3): [True: 0, False: 17.5M]
  |  Branch (867:3): [True: 17.5M, False: 0]
  ------------------
  868|  17.5M|  jvp_array* array = jvp_array_ptr(*a);
  869|       |
  870|  17.5M|  int pos = i + jvp_array_offset(*a);
  871|  17.5M|  if (pos < array->alloc_length && jvp_refcnt_unshared(a->u.ptr)) {
  ------------------
  |  Branch (871:7): [True: 17.5M, False: 3.71k]
  |  Branch (871:36): [True: 17.5M, False: 194]
  ------------------
  872|       |    // use existing array space
  873|  35.0M|    for (int j = array->length; j <= pos; j++) {
  ------------------
  |  Branch (873:33): [True: 17.5M, False: 17.5M]
  ------------------
  874|  17.5M|      array->elements[j] = JV_NULL;
  875|  17.5M|    }
  876|  17.5M|    array->length = imax(pos + 1, array->length);
  877|  17.5M|    a->size = imax(i + 1, a->size);
  878|  17.5M|    return &array->elements[pos];
  879|  17.5M|  } else {
  880|       |    // allocate a new array
  881|  3.90k|    int new_length = imax(i + 1, jvp_array_length(*a));
  882|  3.90k|    jvp_array* new_array = jvp_array_alloc(ARRAY_SIZE_ROUND_UP(new_length));
  ------------------
  |  |  812|  3.90k|#define ARRAY_SIZE_ROUND_UP(n) (((n)*3)/2)
  ------------------
  883|  3.90k|    int j;
  884|  45.9M|    for (j = 0; j < jvp_array_length(*a); j++) {
  ------------------
  |  Branch (884:17): [True: 45.9M, False: 3.90k]
  ------------------
  885|  45.9M|      new_array->elements[j] =
  886|  45.9M|        jv_copy(array->elements[j + jvp_array_offset(*a)]);
  887|  45.9M|    }
  888|  7.70k|    for (; j < new_length; j++) {
  ------------------
  |  Branch (888:12): [True: 3.80k, False: 3.90k]
  ------------------
  889|  3.80k|      new_array->elements[j] = JV_NULL;
  890|  3.80k|    }
  891|  3.90k|    new_array->length = new_length;
  892|  3.90k|    jv_free(*a);
  893|  3.90k|    jv new_jv = {JVP_FLAGS_ARRAY, 0, 0, new_length, {&new_array->refcnt}};
  ------------------
  |  |  813|  3.90k|#define JVP_FLAGS_ARRAY   JVP_MAKE_FLAGS(JV_KIND_ARRAY, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  3.90k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  3.90k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  3.90k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  894|  3.90k|    *a = new_jv;
  895|  3.90k|    return &new_array->elements[i];
  896|  3.90k|  }
  897|  17.5M|}
jv.c:jvp_refcnt_unshared:
   72|  17.5M|static int jvp_refcnt_unshared(jv_refcnt* c) {
   73|  17.5M|  assert(c->count > 0);
  ------------------
  |  Branch (73:3): [True: 0, False: 17.5M]
  |  Branch (73:3): [True: 17.5M, False: 0]
  ------------------
   74|  17.5M|  return c->count == 1;
   75|  17.5M|}
jv.c:imax:
  815|  35.0M|static int imax(int a, int b) {
  816|  35.0M|  if (a>b) return a;
  ------------------
  |  Branch (816:7): [True: 35.0M, False: 3.13k]
  ------------------
  817|  3.13k|  else return b;
  818|  35.0M|}
jv.c:jvp_array_slice:
  953|    204|static jv jvp_array_slice(jv a, int start, int end) {
  954|    204|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (954:3): [True: 0, False: 204]
  |  Branch (954:3): [True: 204, False: 0]
  ------------------
  955|    204|  int len = jvp_array_length(a);
  956|    204|  jvp_clamp_slice_params(len, &start, &end);
  957|    204|  assert(0 <= start && start <= end && end <= len);
  ------------------
  |  Branch (957:3): [True: 0, False: 204]
  |  Branch (957:3): [True: 0, False: 0]
  |  Branch (957:3): [True: 0, False: 0]
  |  Branch (957:3): [True: 204, False: 0]
  |  Branch (957:3): [True: 204, False: 0]
  |  Branch (957:3): [True: 204, False: 0]
  ------------------
  958|       |
  959|       |  // FIXME: maybe slice should reallocate if the slice is small enough
  960|    204|  if (start == end) {
  ------------------
  |  Branch (960:7): [True: 26, False: 178]
  ------------------
  961|     26|    jv_free(a);
  962|     26|    return jv_array();
  963|     26|  }
  964|       |
  965|    178|  if (a.offset + start >= 1 << (sizeof(a.offset) * CHAR_BIT)) {
  ------------------
  |  Branch (965:7): [True: 0, False: 178]
  ------------------
  966|      0|    jv r = jv_array_sized(end - start);
  967|      0|    for (int i = start; i < end; i++)
  ------------------
  |  Branch (967:25): [True: 0, False: 0]
  ------------------
  968|      0|      r = jv_array_append(r, jv_array_get(jv_copy(a), i));
  969|      0|    jv_free(a);
  970|      0|    return r;
  971|    178|  } else {
  972|    178|    a.offset += start;
  973|    178|    a.size = end - start;
  974|    178|    return a;
  975|    178|  }
  976|    178|}
jv.c:jvp_string_new:
 1141|  16.7k|static jv jvp_string_new(const char* data, uint32_t length) {
 1142|  16.7k|  jvp_string* s = jvp_string_alloc(length);
 1143|  16.7k|  s->length_hashed = length << 1;
 1144|  16.7k|  if (data != NULL)
  ------------------
  |  Branch (1144:7): [True: 16.7k, False: 0]
  ------------------
 1145|  16.7k|    memcpy(s->data, data, length);
 1146|  16.7k|  s->data[length] = 0;
 1147|  16.7k|  jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}};
  ------------------
  |  | 1087|  16.7k|#define JVP_FLAGS_STRING  JVP_MAKE_FLAGS(JV_KIND_STRING, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  16.7k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  16.7k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  16.7k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1148|  16.7k|  return r;
 1149|  16.7k|}
jv.c:jvp_string_alloc:
 1104|  22.4k|static jvp_string* jvp_string_alloc(uint32_t size) {
 1105|  22.4k|  jvp_string* s = jv_mem_alloc(sizeof(jvp_string) + size + 1);
 1106|  22.4k|  s->refcnt.count = 1;
 1107|  22.4k|  s->alloc_length = size;
 1108|  22.4k|  return s;
 1109|  22.4k|}
jv.c:jvp_string_copy_replace_bad:
 1112|  5.75k|static jv jvp_string_copy_replace_bad(const char* data, uint32_t length) {
 1113|  5.75k|  const char* end = data + length;
 1114|  5.75k|  const char* i = data;
 1115|       |
 1116|       |  // worst case: all bad bytes, each becomes a 3-byte U+FFFD
 1117|  5.75k|  uint64_t maxlength = (uint64_t)length * 3 + 1;
 1118|  5.75k|  if (maxlength >= INT_MAX) {
  ------------------
  |  Branch (1118:7): [True: 0, False: 5.75k]
  ------------------
 1119|      0|    return jv_invalid_with_msg(jv_string("String too long"));
 1120|      0|  }
 1121|       |
 1122|  5.75k|  jvp_string* s = jvp_string_alloc(maxlength);
 1123|  5.75k|  char* out = s->data;
 1124|  5.75k|  int c = 0;
 1125|       |
 1126|  35.5M|  while ((i = jvp_utf8_next(i, end, &c))) {
  ------------------
  |  Branch (1126:10): [True: 35.5M, False: 5.75k]
  ------------------
 1127|  35.5M|    if (c == -1) {
  ------------------
  |  Branch (1127:9): [True: 21.5M, False: 14.0M]
  ------------------
 1128|  21.5M|      c = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
 1129|  21.5M|    }
 1130|  35.5M|    out += jvp_utf8_encode(c, out);
 1131|  35.5M|    assert(out < s->data + maxlength);
  ------------------
  |  Branch (1131:5): [True: 0, False: 35.5M]
  |  Branch (1131:5): [True: 35.5M, False: 0]
  ------------------
 1132|  35.5M|  }
 1133|  5.75k|  length = out - s->data;
 1134|  5.75k|  s->data[length] = 0;
 1135|  5.75k|  s->length_hashed = length << 1;
 1136|  5.75k|  jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}};
  ------------------
  |  | 1087|  5.75k|#define JVP_FLAGS_STRING  JVP_MAKE_FLAGS(JV_KIND_STRING, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  5.75k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  5.75k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  5.75k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1137|  5.75k|  return r;
 1138|  5.75k|}
jv.c:jvp_string_length:
 1168|  71.0k|static uint32_t jvp_string_length(jvp_string* s) {
 1169|  71.0k|  return s->length_hashed >> 1;
 1170|  71.0k|}
jv.c:jvp_string_ptr:
 1099|   245k|static jvp_string* jvp_string_ptr(jv a) {
 1100|   245k|  assert(JVP_HAS_KIND(a, JV_KIND_STRING));
  ------------------
  |  Branch (1100:3): [True: 0, False: 245k]
  |  Branch (1100:3): [True: 245k, False: 0]
  ------------------
 1101|   245k|  return (jvp_string*)a.u.ptr;
 1102|   245k|}
jv.c:jvp_string_hash:
 1240|  78.0k|static uint32_t jvp_string_hash(jv jstr) {
 1241|  78.0k|  jvp_string* str = jvp_string_ptr(jstr);
 1242|  78.0k|  if (str->length_hashed & 1)
  ------------------
  |  Branch (1242:7): [True: 64.2k, False: 13.7k]
  ------------------
 1243|  64.2k|    return str->hash;
 1244|       |
 1245|       |  /* The following is based on MurmurHash3.
 1246|       |     MurmurHash3 was written by Austin Appleby, and is placed
 1247|       |     in the public domain. */
 1248|       |
 1249|  13.7k|  const uint8_t* data = (const uint8_t*)str->data;
 1250|  13.7k|  int len = (int)jvp_string_length(str);
 1251|  13.7k|  const int nblocks = len / 4;
 1252|       |
 1253|  13.7k|  uint32_t h1 = jvp_hash_seed();
 1254|       |
 1255|  13.7k|  const uint32_t c1 = 0xcc9e2d51;
 1256|  13.7k|  const uint32_t c2 = 0x1b873593;
 1257|  13.7k|  const uint32_t* blocks = (const uint32_t *)(data + nblocks*4);
 1258|       |
 1259|  6.66M|  for(int i = -nblocks; i; i++) {
  ------------------
  |  Branch (1259:25): [True: 6.65M, False: 13.7k]
  ------------------
 1260|  6.65M|    uint32_t k1 = blocks[i]; //FIXME: endianness/alignment
 1261|       |
 1262|  6.65M|    k1 *= c1;
 1263|  6.65M|    k1 = rotl32(k1,15);
 1264|  6.65M|    k1 *= c2;
 1265|       |
 1266|  6.65M|    h1 ^= k1;
 1267|  6.65M|    h1 = rotl32(h1,13);
 1268|  6.65M|    h1 = h1*5+0xe6546b64;
 1269|  6.65M|  }
 1270|       |
 1271|  13.7k|  const uint8_t* tail = (const uint8_t*)(data + nblocks*4);
 1272|       |
 1273|  13.7k|  uint32_t k1 = 0;
 1274|       |
 1275|  13.7k|  switch(len & 3) {
  ------------------
  |  Branch (1275:10): [True: 10.3k, False: 3.42k]
  ------------------
 1276|  1.67k|  case 3: k1 ^= tail[2] << 16;
  ------------------
  |  Branch (1276:3): [True: 1.67k, False: 12.0k]
  ------------------
 1277|  1.67k|          JQ_FALLTHROUGH;
  ------------------
  |  |   14|  1.67k|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 1278|  3.80k|  case 2: k1 ^= tail[1] << 8;
  ------------------
  |  Branch (1278:3): [True: 2.12k, False: 11.6k]
  ------------------
 1279|  3.80k|          JQ_FALLTHROUGH;
  ------------------
  |  |   14|  3.80k|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 1280|  10.3k|  case 1: k1 ^= tail[0];
  ------------------
  |  Branch (1280:3): [True: 6.52k, False: 7.22k]
  ------------------
 1281|  10.3k|          k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1;
 1282|  13.7k|  }
 1283|       |
 1284|  13.7k|  h1 ^= len;
 1285|       |
 1286|  13.7k|  h1 ^= h1 >> 16;
 1287|  13.7k|  h1 *= 0x85ebca6b;
 1288|  13.7k|  h1 ^= h1 >> 13;
 1289|  13.7k|  h1 *= 0xc2b2ae35;
 1290|  13.7k|  h1 ^= h1 >> 16;
 1291|       |
 1292|  13.7k|  str->length_hashed |= 1;
 1293|  13.7k|  str->hash = h1;
 1294|       |
 1295|  13.7k|  return h1;
 1296|  13.7k|}
jv.c:jvp_hash_seed:
 1231|  13.7k|static uint32_t jvp_hash_seed(void) {
 1232|  13.7k|  pthread_once(&hash_seed_once, jvp_hash_seed_init);
 1233|  13.7k|  return hash_seed;
 1234|  13.7k|}
jv.c:jvp_hash_seed_init:
 1211|      1|static void jvp_hash_seed_init(void) {
 1212|      1|  uint32_t seed;
 1213|       |#if defined(HAVE_ARC4RANDOM)
 1214|       |  seed = arc4random();
 1215|       |#elif defined(HAVE_GETENTROPY)
 1216|      1|  if (getentropy(&seed, sizeof(seed)) != 0)
  ------------------
  |  Branch (1216:7): [True: 0, False: 1]
  ------------------
 1217|      0|    seed = (uint32_t)getpid() ^ (uint32_t)time(NULL);
 1218|       |#else
 1219|       |  int fd = open("/dev/urandom", O_RDONLY);
 1220|       |  if (fd >= 0) {
 1221|       |    if (read(fd, &seed, sizeof(seed)) != 4)
 1222|       |      seed = (uint32_t)getpid() ^ (uint32_t)time(NULL);
 1223|       |    close(fd);
 1224|       |  } else {
 1225|       |    seed = (uint32_t)getpid() ^ (uint32_t)time(NULL);
 1226|       |  }
 1227|       |#endif
 1228|      1|  hash_seed = seed;
 1229|      1|}
jv.c:rotl32:
 1236|  13.3M|static uint32_t rotl32 (uint32_t x, int8_t r){
 1237|  13.3M|  return (x << r) | (x >> (32 - r));
 1238|  13.3M|}
jv.c:jvp_clamp_slice_params:
  918|    204|{
  919|    204|  if (*pstart < 0) *pstart = len + *pstart;
  ------------------
  |  Branch (919:7): [True: 0, False: 204]
  ------------------
  920|    204|  if (*pend < 0) *pend = len + *pend;
  ------------------
  |  Branch (920:7): [True: 0, False: 204]
  ------------------
  921|       |
  922|    204|  if (*pstart < 0) *pstart = 0;
  ------------------
  |  Branch (922:7): [True: 0, False: 204]
  ------------------
  923|    204|  if (*pstart > len) *pstart = len;
  ------------------
  |  Branch (923:7): [True: 0, False: 204]
  ------------------
  924|    204|  if (*pend > len) *pend = len;
  ------------------
  |  Branch (924:7): [True: 0, False: 204]
  ------------------
  925|    204|  if (*pend < *pstart) *pend = *pstart;
  ------------------
  |  Branch (925:7): [True: 0, False: 204]
  ------------------
  926|    204|}
jv.c:jvp_object_new:
 1615|  67.8k|static jv jvp_object_new(int size) {
 1616|       |  // Allocates an object of (size) slots and (size*2) hash buckets.
 1617|       |
 1618|       |  // size must be a power of two
 1619|  67.8k|  assert(size > 0 && (size & (size - 1)) == 0);
  ------------------
  |  Branch (1619:3): [True: 0, False: 67.8k]
  |  Branch (1619:3): [True: 0, False: 0]
  |  Branch (1619:3): [True: 67.8k, False: 0]
  |  Branch (1619:3): [True: 67.8k, False: 0]
  ------------------
 1620|       |
 1621|  67.8k|  jvp_object* obj = jv_mem_alloc(sizeof(jvp_object) +
 1622|  67.8k|                                 sizeof(struct object_slot) * size +
 1623|  67.8k|                                 sizeof(int) * (size * 2));
 1624|  67.8k|  obj->refcnt.count = 1;
 1625|   624k|  for (int i=0; i<size; i++) {
  ------------------
  |  Branch (1625:17): [True: 556k, False: 67.8k]
  ------------------
 1626|   556k|    obj->elements[i].next = i - 1;
 1627|   556k|    obj->elements[i].string = JV_NULL;
 1628|   556k|    obj->elements[i].hash = 0;
 1629|   556k|    obj->elements[i].value = JV_NULL;
 1630|   556k|  }
 1631|  67.8k|  obj->next_free = 0;
 1632|  67.8k|  int* hashbuckets = (int*)(&obj->elements[size]);
 1633|  1.18M|  for (int i=0; i<size*2; i++) {
  ------------------
  |  Branch (1633:17): [True: 1.11M, False: 67.8k]
  ------------------
 1634|  1.11M|    hashbuckets[i] = -1;
 1635|  1.11M|  }
 1636|  67.8k|  jv r = {JVP_FLAGS_OBJECT, 0, 0, size, {&obj->refcnt}};
  ------------------
  |  | 1598|  67.8k|#define JVP_FLAGS_OBJECT  JVP_MAKE_FLAGS(JV_KIND_OBJECT, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  67.8k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  67.8k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  67.8k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1637|  67.8k|  return r;
 1638|  67.8k|}
jv.c:jvp_object_read:
 1698|  4.47k|static jv* jvp_object_read(jv object, jv key) {
 1699|  4.47k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1699:3): [True: 0, False: 4.47k]
  |  Branch (1699:3): [True: 4.47k, False: 0]
  ------------------
 1700|  4.47k|  int* bucket = jvp_object_find_bucket(object, key);
 1701|  4.47k|  struct object_slot* slot = jvp_object_find_slot(object, key, bucket);
 1702|  4.47k|  if (slot == 0) return 0;
  ------------------
  |  Branch (1702:7): [True: 0, False: 4.47k]
  ------------------
 1703|  4.47k|  else return &slot->value;
 1704|  4.47k|}
jv.c:jvp_object_find_bucket:
 1659|  28.5k|static int* jvp_object_find_bucket(jv object, jv key) {
 1660|  28.5k|  return jvp_object_buckets(object) + (jvp_object_mask(object) & jvp_string_hash(key));
 1661|  28.5k|}
jv.c:jvp_object_buckets:
 1655|  28.5k|static int* jvp_object_buckets(jv o) {
 1656|  28.5k|  return (int*)(&jvp_object_ptr(o)->elements[o.size]);
 1657|  28.5k|}
jv.c:jvp_object_mask:
 1645|  28.5k|static uint32_t jvp_object_mask(jv o) {
 1646|  28.5k|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1646:3): [True: 0, False: 28.5k]
  |  Branch (1646:3): [True: 28.5k, False: 0]
  ------------------
 1647|  28.5k|  return (o.size * 2) - 1;
 1648|  28.5k|}
jv.c:jvp_object_find_slot:
 1673|  28.5k|static struct object_slot* jvp_object_find_slot(jv object, jv keystr, int* bucket) {
 1674|  28.5k|  uint32_t hash = jvp_string_hash(keystr);
 1675|  28.5k|  for (struct object_slot* curr = jvp_object_get_slot(object, *bucket);
 1676|  33.8k|       curr;
  ------------------
  |  Branch (1676:8): [True: 12.3k, False: 21.5k]
  ------------------
 1677|  28.5k|       curr = jvp_object_next_slot(object, curr)) {
 1678|  12.3k|    if (curr->hash == hash && jvp_string_equal(keystr, curr->string)) {
  ------------------
  |  Branch (1678:9): [True: 7.02k, False: 5.29k]
  |  Branch (1678:31): [True: 7.02k, False: 0]
  ------------------
 1679|  7.02k|      return curr;
 1680|  7.02k|    }
 1681|  12.3k|  }
 1682|  21.5k|  return 0;
 1683|  28.5k|}
jv.c:jvp_string_equal:
 1299|  7.02k|static int jvp_string_equal(jv a, jv b) {
 1300|  7.02k|  assert(JVP_HAS_KIND(a, JV_KIND_STRING));
  ------------------
  |  Branch (1300:3): [True: 0, False: 7.02k]
  |  Branch (1300:3): [True: 7.02k, False: 0]
  ------------------
 1301|  7.02k|  assert(JVP_HAS_KIND(b, JV_KIND_STRING));
  ------------------
  |  Branch (1301:3): [True: 0, False: 7.02k]
  |  Branch (1301:3): [True: 7.02k, False: 0]
  ------------------
 1302|  7.02k|  jvp_string* stra = jvp_string_ptr(a);
 1303|  7.02k|  jvp_string* strb = jvp_string_ptr(b);
 1304|  7.02k|  if (jvp_string_length(stra) != jvp_string_length(strb)) return 0;
  ------------------
  |  Branch (1304:7): [True: 0, False: 7.02k]
  ------------------
 1305|  7.02k|  return memcmp(stra->data, strb->data, jvp_string_length(stra)) == 0;
 1306|  7.02k|}
jv.c:jvp_object_next_slot:
 1669|  5.29k|static struct object_slot* jvp_object_next_slot(jv object, struct object_slot* slot) {
 1670|  5.29k|  return jvp_object_get_slot(object, slot->next);
 1671|  5.29k|}
jv.c:jvp_object_write:
 1755|  13.7k|static int jvp_object_write(jv* object, jv key, jv **valpp) {
 1756|  13.7k|  *object = jvp_object_unshare(*object);
 1757|  13.7k|  int* bucket = jvp_object_find_bucket(*object, key);
 1758|  13.7k|  struct object_slot* slot = jvp_object_find_slot(*object, key, bucket);
 1759|  13.7k|  if (slot) {
  ------------------
  |  Branch (1759:7): [True: 2.54k, False: 11.2k]
  ------------------
 1760|       |    // already has the key
 1761|  2.54k|    jvp_string_free(key);
 1762|  2.54k|    *valpp = &slot->value;
 1763|  2.54k|    return 1;
 1764|  2.54k|  }
 1765|  11.2k|  slot = jvp_object_add_slot(*object, key, bucket);
 1766|  11.2k|  if (slot) {
  ------------------
  |  Branch (1766:7): [True: 10.4k, False: 716]
  ------------------
 1767|  10.4k|    slot->value = jv_invalid();
 1768|  10.4k|  } else {
 1769|    716|    if (!jvp_object_rehash(object)) {
  ------------------
  |  Branch (1769:9): [True: 0, False: 716]
  ------------------
 1770|      0|      jvp_string_free(key);
 1771|      0|      *valpp = NULL;
 1772|      0|      return 0;
 1773|      0|    }
 1774|    716|    bucket = jvp_object_find_bucket(*object, key);
 1775|    716|    assert(!jvp_object_find_slot(*object, key, bucket));
  ------------------
  |  Branch (1775:5): [True: 0, False: 716]
  |  Branch (1775:5): [True: 716, False: 0]
  ------------------
 1776|    716|    slot = jvp_object_add_slot(*object, key, bucket);
 1777|    716|    assert(slot);
  ------------------
  |  Branch (1777:5): [True: 0, False: 716]
  |  Branch (1777:5): [True: 716, False: 0]
  ------------------
 1778|    716|    slot->value = jv_invalid();
 1779|    716|  }
 1780|  11.2k|  *valpp = &slot->value;
 1781|  11.2k|  return 1;
 1782|  11.2k|}
jv.c:jvp_object_unshare:
 1729|  13.7k|static jv jvp_object_unshare(jv object) {
 1730|  13.7k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1730:3): [True: 0, False: 13.7k]
  |  Branch (1730:3): [True: 13.7k, False: 0]
  ------------------
 1731|  13.7k|  if (jvp_refcnt_unshared(object.u.ptr))
  ------------------
  |  Branch (1731:7): [True: 13.7k, False: 0]
  ------------------
 1732|  13.7k|    return object;
 1733|       |
 1734|      0|  jv new_object = jvp_object_new(jvp_object_size(object));
 1735|      0|  jvp_object_ptr(new_object)->next_free = jvp_object_ptr(object)->next_free;
 1736|      0|  for (int i=0; i<jvp_object_size(new_object); i++) {
  ------------------
  |  Branch (1736:17): [True: 0, False: 0]
  ------------------
 1737|      0|    struct object_slot* old_slot = jvp_object_get_slot(object, i);
 1738|      0|    struct object_slot* new_slot = jvp_object_get_slot(new_object, i);
 1739|      0|    *new_slot = *old_slot;
 1740|      0|    if (jv_get_kind(old_slot->string) != JV_KIND_NULL) {
  ------------------
  |  Branch (1740:9): [True: 0, False: 0]
  ------------------
 1741|      0|      new_slot->string = jv_copy(old_slot->string);
 1742|      0|      new_slot->value = jv_copy(old_slot->value);
 1743|      0|    }
 1744|      0|  }
 1745|       |
 1746|      0|  int* old_buckets = jvp_object_buckets(object);
 1747|      0|  int* new_buckets = jvp_object_buckets(new_object);
 1748|      0|  memcpy(new_buckets, old_buckets, sizeof(int) * jvp_object_size(new_object)*2);
 1749|       |
 1750|      0|  jv_free(object);
 1751|      0|  assert(jvp_refcnt_unshared(new_object.u.ptr));
  ------------------
  |  Branch (1751:3): [True: 0, False: 0]
  |  Branch (1751:3): [True: 0, False: 0]
  ------------------
 1752|      0|  return new_object;
 1753|      0|}
jv.c:jvp_object_add_slot:
 1685|  21.5k|static struct object_slot* jvp_object_add_slot(jv object, jv key, int* bucket) {
 1686|  21.5k|  jvp_object* o = jvp_object_ptr(object);
 1687|  21.5k|  int newslot_idx = o->next_free;
 1688|  21.5k|  if (newslot_idx == jvp_object_size(object)) return 0;
  ------------------
  |  Branch (1688:7): [True: 716, False: 20.8k]
  ------------------
 1689|  20.8k|  struct object_slot* newslot = jvp_object_get_slot(object, newslot_idx);
 1690|  20.8k|  o->next_free++;
 1691|  20.8k|  newslot->next = *bucket;
 1692|  20.8k|  *bucket = newslot_idx;
 1693|  20.8k|  newslot->hash = jvp_string_hash(key);
 1694|  20.8k|  newslot->string = key;
 1695|  20.8k|  return newslot;
 1696|  21.5k|}
jv.c:jvp_object_rehash:
 1706|    716|static int jvp_object_rehash(jv *objectp) {
 1707|    716|  jv object = *objectp;
 1708|    716|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1708:3): [True: 0, False: 716]
  |  Branch (1708:3): [True: 716, False: 0]
  ------------------
 1709|    716|  assert(jvp_refcnt_unshared(object.u.ptr));
  ------------------
  |  Branch (1709:3): [True: 0, False: 716]
  |  Branch (1709:3): [True: 716, False: 0]
  ------------------
 1710|    716|  int size = jvp_object_size(object);
 1711|    716|  if (size > INT_MAX >> 2)
  ------------------
  |  Branch (1711:7): [True: 0, False: 716]
  ------------------
 1712|      0|    return 0;
 1713|    716|  jv new_object = jvp_object_new(size * 2);
 1714|  10.3k|  for (int i=0; i<size; i++) {
  ------------------
  |  Branch (1714:17): [True: 9.64k, False: 716]
  ------------------
 1715|  9.64k|    struct object_slot* slot = jvp_object_get_slot(object, i);
 1716|  9.64k|    if (jv_get_kind(slot->string) == JV_KIND_NULL) continue;
  ------------------
  |  Branch (1716:9): [True: 0, False: 9.64k]
  ------------------
 1717|  9.64k|    int* new_bucket = jvp_object_find_bucket(new_object, slot->string);
 1718|  9.64k|    assert(!jvp_object_find_slot(new_object, slot->string, new_bucket));
  ------------------
  |  Branch (1718:5): [True: 0, False: 9.64k]
  |  Branch (1718:5): [True: 9.64k, False: 0]
  ------------------
 1719|  9.64k|    struct object_slot* new_slot = jvp_object_add_slot(new_object, slot->string, new_bucket);
 1720|  9.64k|    assert(new_slot);
  ------------------
  |  Branch (1720:5): [True: 0, False: 9.64k]
  |  Branch (1720:5): [True: 9.64k, False: 0]
  ------------------
 1721|  9.64k|    new_slot->value = slot->value;
 1722|  9.64k|  }
 1723|       |  // references are transported, just drop the old table
 1724|    716|  jv_mem_free(jvp_object_ptr(object));
 1725|    716|  *objectp = new_object;
 1726|    716|  return 1;
 1727|    716|}
jv.c:jvp_object_length:
 1805|  12.4k|static int jvp_object_length(jv object) {
 1806|  12.4k|  int n = 0;
 1807|   119k|  for (int i=0; i<jvp_object_size(object); i++) {
  ------------------
  |  Branch (1807:17): [True: 106k, False: 12.4k]
  ------------------
 1808|   106k|    struct object_slot* slot = jvp_object_get_slot(object, i);
 1809|   106k|    if (jv_get_kind(slot->string) != JV_KIND_NULL) n++;
  ------------------
  |  Branch (1809:9): [True: 9.78k, False: 97.1k]
  ------------------
 1810|   106k|  }
 1811|  12.4k|  return n;
 1812|  12.4k|}
jv.c:jvp_object_size:
 1650|   954k|static int jvp_object_size(jv o) {
 1651|   954k|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1651:3): [True: 0, False: 954k]
  |  Branch (1651:3): [True: 954k, False: 0]
  ------------------
 1652|   954k|  return o.size;
 1653|   954k|}
jv.c:jvp_object_get_slot:
 1663|   749k|static struct object_slot* jvp_object_get_slot(jv object, int slot) {
 1664|   749k|  assert(slot == -1 || (slot >= 0 && slot < jvp_object_size(object)));
  ------------------
  |  Branch (1664:3): [True: 0, False: 0]
  |  Branch (1664:3): [True: 0, False: 0]
  |  Branch (1664:3): [True: 749k, False: 0]
  |  Branch (1664:3): [True: 728k, False: 0]
  |  Branch (1664:3): [True: 728k, False: 0]
  |  Branch (1664:3): [True: 21.5k, False: 728k]
  ------------------
 1665|   749k|  if (slot == -1) return 0;
  ------------------
  |  Branch (1665:7): [True: 21.5k, False: 728k]
  ------------------
 1666|   728k|  else return &jvp_object_ptr(object)->elements[slot];
 1667|   749k|}
jv.c:jvp_refcnt_inc:
   63|  27.1M|static void jvp_refcnt_inc(jv_refcnt* c) {
   64|  27.1M|  c->count++;
   65|  27.1M|}
jv.c:jvp_refcnt_dec:
   67|  28.4M|static int jvp_refcnt_dec(jv_refcnt* c) {
   68|  28.4M|  c->count--;
   69|  28.4M|  return c->count == 0;
   70|  28.4M|}
jv.c:jvp_array_ptr:
  827|  25.2M|static jvp_array* jvp_array_ptr(jv a) {
  828|  25.2M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (828:3): [True: 0, False: 25.2M]
  |  Branch (828:3): [True: 25.2M, False: 0]
  ------------------
  829|  25.2M|  return (jvp_array*)a.u.ptr;
  830|  25.2M|}
jv.c:jvp_string_free:
 1161|  79.0k|static void jvp_string_free(jv js) {
 1162|  79.0k|  jvp_string* s = jvp_string_ptr(js);
 1163|  79.0k|  if (jvp_refcnt_dec(&s->refcnt)) {
  ------------------
  |  Branch (1163:7): [True: 22.4k, False: 56.5k]
  ------------------
 1164|  22.4k|    jv_mem_free(s);
 1165|  22.4k|  }
 1166|  79.0k|}
jv.c:jvp_object_ptr:
 1640|   846k|static jvp_object* jvp_object_ptr(jv o) {
 1641|   846k|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1641:3): [True: 0, False: 846k]
  |  Branch (1641:3): [True: 846k, False: 0]
  ------------------
 1642|   846k|  return (jvp_object*)o.u.ptr;
 1643|   846k|}
jv.c:jvp_number_free:
  685|  70.3M|static void jvp_number_free(jv j) {
  686|  70.3M|  assert(JVP_HAS_KIND(j, JV_KIND_NUMBER));
  ------------------
  |  Branch (686:3): [True: 0, False: 70.3M]
  |  Branch (686:3): [True: 70.3M, False: 0]
  ------------------
  687|  70.3M|#ifdef USE_DECNUM
  688|  70.3M|  if (JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL) && jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  |   92|   140M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  70.3M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 2.62M, False: 67.6M]
  |  |  |  Branch (92:50): [True: 70.3M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (688:53): [True: 741k, False: 1.88M]
  ------------------
  689|   741k|    jvp_literal_number* n = jvp_literal_number_ptr(j);
  690|   741k|    if (n->literal_data) {
  ------------------
  |  Branch (690:9): [True: 8.13k, False: 733k]
  ------------------
  691|  8.13k|      jv_mem_free(n->literal_data);
  692|  8.13k|    }
  693|   741k|    jv_mem_free(n);
  694|   741k|  }
  695|  70.3M|#endif
  696|  70.3M|}

jq_fuzz_parse_extended.c:jv_is_valid:
   52|  4.44k|static int jv_is_valid(jv x) { return jv_get_kind(x) != JV_KIND_INVALID; }
jv_parse.c:jv_is_valid:
   52|   117M|static int jv_is_valid(jv x) { return jv_get_kind(x) != JV_KIND_INVALID; }

jv_mem_alloc:
  141|  1.35M|void* jv_mem_alloc(size_t sz) {
  142|  1.35M|  void* p = malloc(sz);
  143|  1.35M|  if (!p) {
  ------------------
  |  Branch (143:7): [True: 0, False: 1.35M]
  ------------------
  144|      0|    memory_exhausted();
  145|      0|  }
  146|  1.35M|  return p;
  147|  1.35M|}
jv_mem_calloc:
  153|    985|void* jv_mem_calloc(size_t nemb, size_t sz) {
  154|    985|  assert(nemb > 0 && sz > 0);
  ------------------
  |  Branch (154:3): [True: 0, False: 985]
  |  Branch (154:3): [True: 0, False: 0]
  |  Branch (154:3): [True: 985, False: 0]
  |  Branch (154:3): [True: 985, False: 0]
  ------------------
  155|    985|  void* p = calloc(nemb, sz);
  156|    985|  if (!p) {
  ------------------
  |  Branch (156:7): [True: 0, False: 985]
  ------------------
  157|      0|    memory_exhausted();
  158|      0|  }
  159|    985|  return p;
  160|    985|}
jv_mem_free:
  179|  52.5M|void jv_mem_free(void* p) {
  180|  52.5M|  free(p);
  181|  52.5M|}
jv_mem_realloc:
  183|  73.1k|void* jv_mem_realloc(void* p, size_t sz) {
  184|  73.1k|  p = realloc(p, sz);
  185|  73.1k|  if (!p) {
  ------------------
  |  Branch (185:7): [True: 0, False: 73.1k]
  ------------------
  186|      0|    memory_exhausted();
  187|      0|  }
  188|  73.1k|  return p;
  189|  73.1k|}

jv_keys:
  584|    985|jv jv_keys(jv x) {
  585|    985|  if (jv_get_kind(x) == JV_KIND_OBJECT) {
  ------------------
  |  Branch (585:7): [True: 985, False: 0]
  ------------------
  586|    985|    int nkeys = jv_object_length(jv_copy(x));
  587|    985|    if (nkeys == 0) {
  ------------------
  |  Branch (587:9): [True: 0, False: 985]
  ------------------
  588|      0|      jv_free(x);
  589|      0|      return jv_array();
  590|      0|    }
  591|    985|    jv* keys = jv_mem_calloc(nkeys, sizeof(jv));
  592|    985|    int kidx = 0;
  593|  4.47k|    jv_object_foreach(x, key, value) {
  ------------------
  |  |  159|  1.97k|  for (int jv_i__ = jv_object_iter(t), jv_j__ = 1; jv_j__; jv_j__ = 0)  \
  |  |  ------------------
  |  |  |  Branch (159:52): [True: 985, False: 985]
  |  |  ------------------
  |  |  160|    985|    for (jv k, v;                                                       \
  |  |  161|  5.46k|         jv_object_iter_valid((t), jv_i__) ?                            \
  |  |  ------------------
  |  |  |  Branch (161:10): [True: 4.47k, False: 985]
  |  |  |  Branch (161:10): [True: 4.47k, False: 985]
  |  |  ------------------
  |  |  162|  5.46k|           (k = jv_object_iter_key(t, jv_i__),                          \
  |  |  163|  4.47k|            v = jv_object_iter_value(t, jv_i__),                        \
  |  |  164|  4.47k|            1)                                                          \
  |  |  165|  5.46k|           : 0;                                                         \
  |  |  166|  4.47k|         jv_i__ = jv_object_iter_next(t, jv_i__))                       \
  ------------------
  594|  4.47k|      keys[kidx++] = key;
  595|  4.47k|      jv_free(value);
  596|  4.47k|    }
  597|    985|    qsort(keys, nkeys, sizeof(jv), string_cmp);
  598|    985|    jv answer = jv_array_sized(nkeys);
  599|  5.46k|    for (int i = 0; i<nkeys; i++) {
  ------------------
  |  Branch (599:21): [True: 4.47k, False: 985]
  ------------------
  600|  4.47k|      answer = jv_array_append(answer, keys[i]);
  601|  4.47k|    }
  602|    985|    jv_mem_free(keys);
  603|    985|    jv_free(x);
  604|    985|    return answer;
  605|    985|  } else if (jv_get_kind(x) == JV_KIND_ARRAY) {
  ------------------
  |  Branch (605:14): [True: 0, False: 0]
  ------------------
  606|      0|    int n = jv_array_length(x);
  607|      0|    jv answer = jv_array();
  608|      0|    for (int i=0; i<n; i++){
  ------------------
  |  Branch (608:19): [True: 0, False: 0]
  ------------------
  609|      0|      answer = jv_array_set(answer, i, jv_number(i));
  610|      0|    }
  611|      0|    return answer;
  612|      0|  } else {
  613|      0|    assert(0 && "jv_keys passed something neither object nor array");
  ------------------
  |  Branch (613:5): [Folded, False: 0]
  |  Branch (613:5): [True: 0, False: 0]
  |  Branch (613:5): [Folded, False: 0]
  |  Branch (613:5): [True: 0, False: 0]
  ------------------
  614|      0|    return jv_invalid();
  615|      0|  }
  616|    985|}
jv_aux.c:string_cmp:
  561|  14.8k|static int string_cmp(const void* pa, const void* pb){
  562|  14.8k|  const jv* a = pa;
  563|  14.8k|  const jv* b = pb;
  564|  14.8k|  int lena = jv_string_length_bytes(jv_copy(*a));
  565|  14.8k|  int lenb = jv_string_length_bytes(jv_copy(*b));
  566|  14.8k|  int minlen = lena < lenb ? lena : lenb;
  ------------------
  |  Branch (566:16): [True: 5.01k, False: 9.81k]
  ------------------
  567|  14.8k|  int r = memcmp(jv_string_value(*a), jv_string_value(*b), minlen);
  568|  14.8k|  if (r == 0) r = lena - lenb;
  ------------------
  |  Branch (568:7): [True: 1.48k, False: 13.3k]
  ------------------
  569|  14.8k|  return r;
  570|  14.8k|}

jvp_dtoa_context_init:
  522|  4.44k|void jvp_dtoa_context_init(struct dtoa_context* C) {
  523|  4.44k|  int i;
  524|  40.0k|  for (i=0; i<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); i++) {
  ------------------
  |  Branch (524:13): [True: 35.5k, False: 4.44k]
  ------------------
  525|  35.5k|    C->freelist[i] = 0;
  526|  35.5k|  }
  527|  4.44k|  C->p5s = 0;
  528|  4.44k|}
jvp_dtoa_context_free:
  569|  4.44k|void jvp_dtoa_context_free(struct dtoa_context* C) {
  570|  4.44k|  int k;
  571|  4.45k|  while (C->p5s) {
  ------------------
  |  Branch (571:10): [True: 7, False: 4.44k]
  ------------------
  572|      7|    Bigint* p5 = C->p5s;
  573|      7|    C->p5s = p5->next;
  574|      7|    Bfree(C, p5);
  575|      7|  }
  576|  40.0k|  for (k=0; k<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); k++) {
  ------------------
  |  Branch (576:13): [True: 35.5k, False: 4.44k]
  ------------------
  577|  35.5k|    while (C->freelist[k]) {
  ------------------
  |  Branch (577:12): [True: 18, False: 35.5k]
  ------------------
  578|     18|      Bigint* v = C->freelist[k];
  579|     18|      C->freelist[k] = v->next;
  580|     18|      FREE(v);
  ------------------
  |  |  200|     18|#define FREE jv_mem_free
  ------------------
  581|     18|    }
  582|  35.5k|  }
  583|  4.44k|}
jvp_strtod:
 2331|  5.19k|{
 2332|  5.19k|	int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
 2333|       |#ifdef Honor_FLT_ROUNDS
 2334|       |	int test_scale;
 2335|       |#endif
 2336|  5.19k|	int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
 2337|  5.19k|	CONST char *s, *s0, *s1;
  ------------------
  |  |  298|  5.19k|#define CONST const
  ------------------
 2338|  5.19k|	double aadj, aadj1;
 2339|  5.19k|	Long L;
  ------------------
  |  |  193|  5.19k|#define Long int
  ------------------
 2340|  5.19k|	U aadj2, adj, rv, rv0;
 2341|  5.19k|	ULong y, z;
 2342|  5.19k|	BCinfo bc;
 2343|  5.19k|	Bigint *bb=0, *bb1, *bd=0, *bd0, *bs=0, *delta=0;
 2344|  5.19k|#ifdef Avoid_Underflow
 2345|  5.19k|	ULong Lsb, Lsb1;
 2346|  5.19k|#endif
 2347|       |#ifdef SET_INEXACT
 2348|       |	int oldinexact;
 2349|       |#endif
 2350|  5.19k|#ifndef NO_STRTOD_BIGCOMP
 2351|  5.19k|	int req_bigcomp = 0;
 2352|  5.19k|#endif
 2353|       |#ifdef Honor_FLT_ROUNDS /*{*/
 2354|       |#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
 2355|       |	bc.rounding = Flt_Rounds;
 2356|       |#else /*}{*/
 2357|       |	bc.rounding = 1;
 2358|       |	switch(fegetround()) {
 2359|       |	  case FE_TOWARDZERO:	bc.rounding = 0; break;
 2360|       |	  case FE_UPWARD:	bc.rounding = 2; break;
 2361|       |	  case FE_DOWNWARD:	bc.rounding = 3;
 2362|       |	  }
 2363|       |#endif /*}}*/
 2364|       |#endif /*}*/
 2365|       |#ifdef USE_LOCALE
 2366|       |	CONST char *s2;
 2367|       |#endif
 2368|       |
 2369|  5.19k|	sign = nz0 = nz1 = nz = bc.dplen = bc.uflchk = 0;
 2370|  5.19k|	dval(&rv) = 0.;
  ------------------
  |  |  314|  5.19k|#define dval(x) (x)->d
  ------------------
 2371|  5.19k|	switch(*(s = s00)) {
 2372|    204|		case '-':
  ------------------
  |  Branch (2372:3): [True: 204, False: 4.99k]
  ------------------
 2373|    204|			sign = 1;
 2374|       |			/* no break */
 2375|    204|			JQ_FALLTHROUGH;
  ------------------
  |  |   14|    204|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 2376|    204|		case '+':
  ------------------
  |  Branch (2376:3): [True: 0, False: 5.19k]
  ------------------
 2377|    204|			if (*++s)
  ------------------
  |  Branch (2377:8): [True: 204, False: 0]
  ------------------
 2378|    204|				break;
 2379|       |			/* no break */
 2380|      0|			JQ_FALLTHROUGH;
  ------------------
  |  |   14|      0|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 2381|      0|		case 0:
  ------------------
  |  Branch (2381:3): [True: 0, False: 5.19k]
  ------------------
 2382|      0|			goto ret0;
 2383|  4.99k|		default:
  ------------------
  |  Branch (2383:3): [True: 4.99k, False: 204]
  ------------------
 2384|  4.99k|			break;
 2385|  5.19k|		}
 2386|  5.19k|	if (*s == '0') {
  ------------------
  |  Branch (2386:6): [True: 0, False: 5.19k]
  ------------------
 2387|       |#ifndef NO_HEX_FP /*{*/
 2388|       |		switch(s[1]) {
 2389|       |		  case 'x':
 2390|       |		  case 'X':
 2391|       |#ifdef Honor_FLT_ROUNDS
 2392|       |			gethex(C, &s, &rv, bc.rounding, sign);
 2393|       |#else
 2394|       |			gethex(C, &s, &rv, 1, sign);
 2395|       |#endif
 2396|       |			goto ret;
 2397|       |		  }
 2398|       |#endif /*}*/
 2399|      0|		nz0 = 1;
 2400|      0|		while(*++s == '0') ;
  ------------------
  |  Branch (2400:9): [True: 0, False: 0]
  ------------------
 2401|      0|		if (!*s)
  ------------------
  |  Branch (2401:7): [True: 0, False: 0]
  ------------------
 2402|      0|			goto ret;
 2403|      0|		}
 2404|  5.19k|	s0 = s;
 2405|  5.19k|	y = z = 0;
 2406|  5.19k|	for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
  ------------------
  |  Branch (2406:19): [True: 5.19k, False: 0]
  |  Branch (2406:38): [True: 0, False: 5.19k]
  ------------------
 2407|      0|		if (nd < 9)
  ------------------
  |  Branch (2407:7): [True: 0, False: 0]
  ------------------
 2408|      0|			y = 10*y + c - '0';
 2409|      0|		else if (nd < 16)
  ------------------
  |  Branch (2409:12): [True: 0, False: 0]
  ------------------
 2410|      0|			z = 10*z + c - '0';
 2411|  5.19k|	nd0 = nd;
 2412|  5.19k|	bc.dp0 = bc.dp1 = s - s0;
 2413|  5.19k|	for(s1 = s; s1 > s0 && *--s1 == '0'; )
  ------------------
  |  Branch (2413:14): [True: 0, False: 5.19k]
  |  Branch (2413:25): [True: 0, False: 0]
  ------------------
 2414|      0|		++nz1;
 2415|       |#ifdef USE_LOCALE
 2416|       |	s1 = localeconv()->decimal_point;
 2417|       |	if (c == *s1) {
 2418|       |		c = '.';
 2419|       |		if (*++s1) {
 2420|       |			s2 = s;
 2421|       |			for(;;) {
 2422|       |				if (*++s2 != *s1) {
 2423|       |					c = 0;
 2424|       |					break;
 2425|       |					}
 2426|       |				if (!*++s1) {
 2427|       |					s = s2;
 2428|       |					break;
 2429|       |					}
 2430|       |				}
 2431|       |			}
 2432|       |		}
 2433|       |#endif
 2434|  5.19k|	if (c == '.') {
  ------------------
  |  Branch (2434:6): [True: 0, False: 5.19k]
  ------------------
 2435|      0|		c = *++s;
 2436|      0|		bc.dp1 = s - s0;
 2437|      0|		bc.dplen = bc.dp1 - bc.dp0;
 2438|      0|		if (!nd) {
  ------------------
  |  Branch (2438:7): [True: 0, False: 0]
  ------------------
 2439|      0|			for(; c == '0'; c = *++s)
  ------------------
  |  Branch (2439:10): [True: 0, False: 0]
  ------------------
 2440|      0|				nz++;
 2441|      0|			if (c > '0' && c <= '9') {
  ------------------
  |  Branch (2441:8): [True: 0, False: 0]
  |  Branch (2441:19): [True: 0, False: 0]
  ------------------
 2442|      0|				bc.dp0 = s0 - s;
 2443|      0|				bc.dp1 = bc.dp0 + bc.dplen;
 2444|      0|				s0 = s;
 2445|      0|				nf += nz;
 2446|      0|				nz = 0;
 2447|      0|				goto have_dig;
 2448|      0|				}
 2449|      0|			goto dig_done;
 2450|      0|			}
 2451|      0|		for(; c >= '0' && c <= '9'; c = *++s) {
  ------------------
  |  Branch (2451:9): [True: 0, False: 0]
  |  Branch (2451:21): [True: 0, False: 0]
  ------------------
 2452|      0| have_dig:
 2453|      0|			nz++;
 2454|      0|			if (c -= '0') {
  ------------------
  |  Branch (2454:8): [True: 0, False: 0]
  ------------------
 2455|      0|				nf += nz;
 2456|      0|				for(i = 1; i < nz; i++)
  ------------------
  |  Branch (2456:16): [True: 0, False: 0]
  ------------------
 2457|      0|					if (nd++ < 9)
  ------------------
  |  Branch (2457:10): [True: 0, False: 0]
  ------------------
 2458|      0|						y *= 10;
 2459|      0|					else if (nd <= DBL_DIG + 1)
  ------------------
  |  Branch (2459:15): [True: 0, False: 0]
  ------------------
 2460|      0|						z *= 10;
 2461|      0|				if (nd++ < 9)
  ------------------
  |  Branch (2461:9): [True: 0, False: 0]
  ------------------
 2462|      0|					y = 10*y + c;
 2463|      0|				else if (nd <= DBL_DIG + 1)
  ------------------
  |  Branch (2463:14): [True: 0, False: 0]
  ------------------
 2464|      0|					z = 10*z + c;
 2465|      0|				nz = nz1 = 0;
 2466|      0|				}
 2467|      0|			}
 2468|      0|		}
 2469|  5.19k| dig_done:
 2470|  5.19k|	e = 0;
 2471|  5.19k|	if (c == 'e' || c == 'E') {
  ------------------
  |  Branch (2471:6): [True: 0, False: 5.19k]
  |  Branch (2471:18): [True: 0, False: 5.19k]
  ------------------
 2472|      0|		if (!nd && !nz && !nz0) {
  ------------------
  |  Branch (2472:7): [True: 0, False: 0]
  |  Branch (2472:14): [True: 0, False: 0]
  |  Branch (2472:21): [True: 0, False: 0]
  ------------------
 2473|      0|			goto ret0;
 2474|      0|			}
 2475|      0|		s00 = s;
 2476|      0|		esign = 0;
 2477|      0|		switch(c = *++s) {
  ------------------
  |  Branch (2477:10): [True: 0, False: 0]
  ------------------
 2478|      0|			case '-':
  ------------------
  |  Branch (2478:4): [True: 0, False: 0]
  ------------------
 2479|      0|				esign = 1;
 2480|      0|				JQ_FALLTHROUGH;
  ------------------
  |  |   14|      0|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 2481|      0|			case '+':
  ------------------
  |  Branch (2481:4): [True: 0, False: 0]
  ------------------
 2482|      0|				c = *++s;
 2483|      0|			}
 2484|      0|		if (c >= '0' && c <= '9') {
  ------------------
  |  Branch (2484:7): [True: 0, False: 0]
  |  Branch (2484:19): [True: 0, False: 0]
  ------------------
 2485|      0|			while(c == '0')
  ------------------
  |  Branch (2485:10): [True: 0, False: 0]
  ------------------
 2486|      0|				c = *++s;
 2487|      0|			if (c > '0' && c <= '9') {
  ------------------
  |  Branch (2487:8): [True: 0, False: 0]
  |  Branch (2487:19): [True: 0, False: 0]
  ------------------
 2488|      0|				L = c - '0';
 2489|      0|				s1 = s;
 2490|      0|				while((c = *++s) >= '0' && c <= '9')
  ------------------
  |  Branch (2490:11): [True: 0, False: 0]
  |  Branch (2490:32): [True: 0, False: 0]
  ------------------
 2491|      0|					L = 10*L + c - '0';
 2492|      0|				if (s - s1 > 8 || L > 19999)
  ------------------
  |  Branch (2492:9): [True: 0, False: 0]
  |  Branch (2492:23): [True: 0, False: 0]
  ------------------
 2493|       |					/* Avoid confusion from exponents
 2494|       |					 * so large that e might overflow.
 2495|       |					 */
 2496|      0|					e = 19999; /* safe for 16 bit ints */
 2497|      0|				else
 2498|      0|					e = (int)L;
 2499|      0|				if (esign)
  ------------------
  |  Branch (2499:9): [True: 0, False: 0]
  ------------------
 2500|      0|					e = -e;
 2501|      0|				}
 2502|      0|			else
 2503|      0|				e = 0;
 2504|      0|			}
 2505|      0|		else
 2506|      0|			s = s00;
 2507|      0|		}
 2508|  5.19k|	if (!nd) {
  ------------------
  |  Branch (2508:6): [True: 5.19k, False: 0]
  ------------------
 2509|  5.19k|		if (!nz && !nz0) {
  ------------------
  |  Branch (2509:7): [True: 5.19k, False: 0]
  |  Branch (2509:14): [True: 5.19k, False: 0]
  ------------------
 2510|  5.19k|#ifdef INFNAN_CHECK
 2511|       |			/* Check for Nan and Infinity */
 2512|  5.19k|			if (!bc.dplen)
  ------------------
  |  Branch (2512:8): [True: 5.19k, False: 0]
  ------------------
 2513|  5.19k|			 switch(c) {
  ------------------
  |  Branch (2513:12): [True: 5.19k, False: 0]
  ------------------
 2514|      0|			  case 'i':
  ------------------
  |  Branch (2514:6): [True: 0, False: 5.19k]
  ------------------
 2515|  5.19k|			  case 'I':
  ------------------
  |  Branch (2515:6): [True: 5.19k, False: 0]
  ------------------
 2516|  5.19k|				if (match(C, &s,"nf")) {
  ------------------
  |  Branch (2516:9): [True: 5.19k, False: 0]
  ------------------
 2517|  5.19k|					--s;
 2518|  5.19k|					if (!match(C, &s,"inity"))
  ------------------
  |  Branch (2518:10): [True: 0, False: 5.19k]
  ------------------
 2519|      0|						++s;
 2520|  5.19k|					word0(&rv) = 0x7ff00000;
  ------------------
  |  |  308|  5.19k|#define word0(x) (x)->L[1]
  ------------------
 2521|  5.19k|					word1(&rv) = 0;
  ------------------
  |  |  309|  5.19k|#define word1(x) (x)->L[0]
  ------------------
 2522|  5.19k|					goto ret;
 2523|  5.19k|					}
 2524|      0|				break;
 2525|      0|			  case 'n':
  ------------------
  |  Branch (2525:6): [True: 0, False: 5.19k]
  ------------------
 2526|      0|			  case 'N':
  ------------------
  |  Branch (2526:6): [True: 0, False: 5.19k]
  ------------------
 2527|      0|				if (match(C, &s, "an")) {
  ------------------
  |  Branch (2527:9): [True: 0, False: 0]
  ------------------
 2528|      0|					word0(&rv) = NAN_WORD0;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					word0(&rv) = NAN_WORD0;
  ------------------
  |  | 1425|      0|#define NAN_WORD0 0x7ff80000
  ------------------
 2529|      0|					word1(&rv) = NAN_WORD1;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              					word1(&rv) = NAN_WORD1;
  ------------------
  |  | 1429|      0|#define NAN_WORD1 0
  ------------------
 2530|       |#ifndef No_Hex_NaN
 2531|       |					if (*s == '(') /*)*/
 2532|       |						hexnan(C, &rv, &s);
 2533|       |#endif
 2534|      0|					goto ret;
 2535|      0|					}
 2536|  5.19k|			  }
 2537|      0|#endif /* INFNAN_CHECK */
 2538|      0| ret0:
 2539|      0|			s = s00;
 2540|      0|			sign = 0;
 2541|      0|			}
 2542|      0|		goto ret;
 2543|  5.19k|		}
 2544|      0|	bc.e0 = e1 = e -= nf;
 2545|       |
 2546|       |	/* Now we have nd0 digits, starting at s0, followed by a
 2547|       |	 * decimal point, followed by nd-nd0 digits.  The number we're
 2548|       |	 * after is the integer represented by those digits times
 2549|       |	 * 10**e */
 2550|       |
 2551|      0|	if (!nd0)
  ------------------
  |  Branch (2551:6): [True: 0, False: 0]
  ------------------
 2552|      0|		nd0 = nd;
 2553|      0|	k = nd < DBL_DIG + 1 ? nd : DBL_DIG + 1;
  ------------------
  |  Branch (2553:6): [True: 0, False: 0]
  ------------------
 2554|      0|	dval(&rv) = y;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2555|      0|	if (k > 9) {
  ------------------
  |  Branch (2555:6): [True: 0, False: 0]
  ------------------
 2556|       |#ifdef SET_INEXACT
 2557|       |		if (k > DBL_DIG)
 2558|       |			oldinexact = get_inexact();
 2559|       |#endif
 2560|      0|		dval(&rv) = tens[k - 9] * dval(&rv) + z;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              		dval(&rv) = tens[k - 9] * dval(&rv) + z;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2561|      0|		}
 2562|      0|	bd0 = 0;
 2563|      0|	if (nd <= DBL_DIG
  ------------------
  |  Branch (2563:6): [True: 0, False: 0]
  ------------------
 2564|      0|#ifndef RND_PRODQUOT
 2565|      0|#ifndef Honor_FLT_ROUNDS
 2566|      0|		&& Flt_Rounds == 1
  ------------------
  |  |  380|      0|#define Flt_Rounds FLT_ROUNDS
  ------------------
  |  Branch (2566:6): [True: 0, False: 0]
  ------------------
 2567|      0|#endif
 2568|      0|#endif
 2569|      0|			) {
 2570|      0|		if (!e)
  ------------------
  |  Branch (2570:7): [True: 0, False: 0]
  ------------------
 2571|      0|			goto ret;
 2572|      0|#ifndef ROUND_BIASED_without_Round_Up
 2573|      0|		if (e > 0) {
  ------------------
  |  Branch (2573:7): [True: 0, False: 0]
  ------------------
 2574|      0|			if (e <= Ten_pmax) {
  ------------------
  |  |  360|      0|#define Ten_pmax 22
  ------------------
  |  Branch (2574:8): [True: 0, False: 0]
  ------------------
 2575|       |#ifdef VAX
 2576|       |				goto vax_ovfl_check;
 2577|       |#else
 2578|       |#ifdef Honor_FLT_ROUNDS
 2579|       |				/* round correctly FLT_ROUNDS = 2 or 3 */
 2580|       |				if (sign) {
 2581|       |					rv.d = -rv.d;
 2582|       |					sign = 0;
 2583|       |					}
 2584|       |#endif
 2585|      0|				/* rv = */ rounded_product(dval(&rv), tens[e]);
  ------------------
  |  |  474|      0|#define rounded_product(a,b) a *= b
  ------------------
 2586|      0|				goto ret;
 2587|      0|#endif
 2588|      0|				}
 2589|      0|			i = DBL_DIG - nd;
 2590|      0|			if (e <= Ten_pmax + i) {
  ------------------
  |  |  360|      0|#define Ten_pmax 22
  ------------------
  |  Branch (2590:8): [True: 0, False: 0]
  ------------------
 2591|       |				/* A fancier test would sometimes let us do
 2592|       |				 * this for larger i values.
 2593|       |				 */
 2594|       |#ifdef Honor_FLT_ROUNDS
 2595|       |				/* round correctly FLT_ROUNDS = 2 or 3 */
 2596|       |				if (sign) {
 2597|       |					rv.d = -rv.d;
 2598|       |					sign = 0;
 2599|       |					}
 2600|       |#endif
 2601|      0|				e -= i;
 2602|      0|				dval(&rv) *= tens[i];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2603|       |#ifdef VAX
 2604|       |				/* VAX exponent range is so narrow we must
 2605|       |				 * worry about overflow here...
 2606|       |				 */
 2607|       | vax_ovfl_check:
 2608|       |				word0(&rv) -= P*Exp_msk1;
 2609|       |				/* rv = */ rounded_product(dval(&rv), tens[e]);
 2610|       |				if ((word0(&rv) & Exp_mask)
 2611|       |				 > Exp_msk1*(DBL_MAX_EXP+Bias-1-P))
 2612|       |					goto ovfl;
 2613|       |				word0(&rv) += P*Exp_msk1;
 2614|       |#else
 2615|      0|				/* rv = */ rounded_product(dval(&rv), tens[e]);
  ------------------
  |  |  474|      0|#define rounded_product(a,b) a *= b
  ------------------
 2616|      0|#endif
 2617|      0|				goto ret;
 2618|      0|				}
 2619|      0|			}
 2620|      0|#ifndef Inaccurate_Divide
 2621|      0|		else if (e >= -Ten_pmax) {
  ------------------
  |  |  360|      0|#define Ten_pmax 22
  ------------------
  |  Branch (2621:12): [True: 0, False: 0]
  ------------------
 2622|       |#ifdef Honor_FLT_ROUNDS
 2623|       |			/* round correctly FLT_ROUNDS = 2 or 3 */
 2624|       |			if (sign) {
 2625|       |				rv.d = -rv.d;
 2626|       |				sign = 0;
 2627|       |				}
 2628|       |#endif
 2629|      0|			/* rv = */ rounded_quotient(dval(&rv), tens[-e]);
  ------------------
  |  |  475|      0|#define rounded_quotient(a,b) a /= b
  ------------------
 2630|      0|			goto ret;
 2631|      0|			}
 2632|      0|#endif
 2633|      0|#endif /* ROUND_BIASED_without_Round_Up */
 2634|      0|		}
 2635|      0|	e1 += nd - k;
 2636|       |
 2637|      0|#ifdef IEEE_Arith
 2638|       |#ifdef SET_INEXACT
 2639|       |	bc.inexact = 1;
 2640|       |	if (k <= DBL_DIG)
 2641|       |		oldinexact = get_inexact();
 2642|       |#endif
 2643|      0|#ifdef Avoid_Underflow
 2644|      0|	bc.scale = 0;
 2645|      0|#endif
 2646|       |#ifdef Honor_FLT_ROUNDS
 2647|       |	if (bc.rounding >= 2) {
 2648|       |		if (sign)
 2649|       |			bc.rounding = bc.rounding == 2 ? 0 : 2;
 2650|       |		else
 2651|       |			if (bc.rounding != 2)
 2652|       |				bc.rounding = 0;
 2653|       |		}
 2654|       |#endif
 2655|      0|#endif /*IEEE_Arith*/
 2656|       |
 2657|       |	/* Get starting approximation = rv * 10**e1 */
 2658|       |
 2659|      0|	if (e1 > 0) {
  ------------------
  |  Branch (2659:6): [True: 0, False: 0]
  ------------------
 2660|      0|		if ((i = e1 & 15))
  ------------------
  |  Branch (2660:7): [True: 0, False: 0]
  ------------------
 2661|      0|			dval(&rv) *= tens[i];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2662|      0|		if (e1 &= ~15) {
  ------------------
  |  Branch (2662:7): [True: 0, False: 0]
  ------------------
 2663|      0|			if (e1 > DBL_MAX_10_EXP) {
  ------------------
  |  Branch (2663:8): [True: 0, False: 0]
  ------------------
 2664|      0| ovfl:
 2665|       |				/* Can't trust HUGE_VAL */
 2666|      0|#ifdef IEEE_Arith
 2667|       |#ifdef Honor_FLT_ROUNDS
 2668|       |				switch(bc.rounding) {
 2669|       |				  case 0: /* toward 0 */
 2670|       |				  case 3: /* toward -infinity */
 2671|       |					word0(&rv) = Big0;
 2672|       |					word1(&rv) = Big1;
 2673|       |					break;
 2674|       |				  default:
 2675|       |					word0(&rv) = Exp_mask;
 2676|       |					word1(&rv) = 0;
 2677|       |				  }
 2678|       |#else /*Honor_FLT_ROUNDS*/
 2679|      0|				word0(&rv) = Exp_mask;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) = Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 2680|      0|				word1(&rv) = 0;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 2681|      0|#endif /*Honor_FLT_ROUNDS*/
 2682|       |#ifdef SET_INEXACT
 2683|       |				/* set overflow bit */
 2684|       |				dval(&rv0) = 1e300;
 2685|       |				dval(&rv0) *= dval(&rv0);
 2686|       |#endif
 2687|       |#else /*IEEE_Arith*/
 2688|       |				word0(&rv) = Big0;
 2689|       |				word1(&rv) = Big1;
 2690|       |#endif /*IEEE_Arith*/
 2691|      0| range_err:
 2692|      0|				if (bd0) {
  ------------------
  |  Branch (2692:9): [True: 0, False: 0]
  ------------------
 2693|      0|					Bfree(C, bb);
 2694|      0|					Bfree(C, bd);
 2695|      0|					Bfree(C, bs);
 2696|      0|					Bfree(C, bd0);
 2697|      0|					Bfree(C, delta);
 2698|      0|					}
 2699|       |#ifndef NO_ERRNO
 2700|       |				errno = ERANGE;
 2701|       |#endif
 2702|      0|				goto ret;
 2703|      0|				}
 2704|      0|			e1 >>= 4;
 2705|      0|			for(j = 0; e1 > 1; j++, e1 >>= 1)
  ------------------
  |  Branch (2705:15): [True: 0, False: 0]
  ------------------
 2706|      0|				if (e1 & 1)
  ------------------
  |  Branch (2706:9): [True: 0, False: 0]
  ------------------
 2707|      0|					dval(&rv) *= bigtens[j];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2708|       |		/* The last multiplication could overflow. */
 2709|      0|			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 2710|      0|			dval(&rv) *= bigtens[j];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2711|      0|			if ((z = word0(&rv) & Exp_mask)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			if ((z = word0(&rv) & Exp_mask)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (2711:8): [True: 0, False: 0]
  ------------------
 2712|      0|			 > Exp_msk1*(DBL_MAX_EXP+Bias-P))
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
              			 > Exp_msk1*(DBL_MAX_EXP+Bias-P))
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              			 > Exp_msk1*(DBL_MAX_EXP+Bias-P))
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 2713|      0|				goto ovfl;
 2714|      0|			if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) {
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
              			if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) {
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              			if (z > Exp_msk1*(DBL_MAX_EXP+Bias-1-P)) {
  ------------------
  |  |  350|      0|#define P 53
  ------------------
  |  Branch (2714:8): [True: 0, False: 0]
  ------------------
 2715|       |				/* set to largest number */
 2716|       |				/* (Can't trust DBL_MAX) */
 2717|      0|				word0(&rv) = Big0;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) = Big0;
  ------------------
  |  |  478|      0|#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  359|      0|#define Frac_mask1 0xfffff
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  347|      0|#define Exp_msk1    0x100000
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  352|      0|#define Bias 1023
  |  |  ------------------
  ------------------
 2718|      0|				word1(&rv) = Big1;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              				word1(&rv) = Big1;
  ------------------
  |  |  479|      0|#define Big1 0xffffffff
  ------------------
 2719|      0|				}
 2720|      0|			else
 2721|      0|				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 2722|      0|			}
 2723|      0|		}
 2724|      0|	else if (e1 < 0) {
  ------------------
  |  Branch (2724:11): [True: 0, False: 0]
  ------------------
 2725|      0|		e1 = -e1;
 2726|      0|		if ((i = e1 & 15))
  ------------------
  |  Branch (2726:7): [True: 0, False: 0]
  ------------------
 2727|      0|			dval(&rv) /= tens[i];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2728|      0|		if (e1 >>= 4) {
  ------------------
  |  Branch (2728:7): [True: 0, False: 0]
  ------------------
 2729|      0|			if (e1 >= 1 << n_bigtens)
  ------------------
  |  | 1375|      0|#define n_bigtens 5
  ------------------
  |  Branch (2729:8): [True: 0, False: 0]
  ------------------
 2730|      0|				goto undfl;
 2731|      0|#ifdef Avoid_Underflow
 2732|      0|			if (e1 & Scale_Bit)
  ------------------
  |  | 1374|      0|#define Scale_Bit 0x10
  ------------------
  |  Branch (2732:8): [True: 0, False: 0]
  ------------------
 2733|      0|				bc.scale = 2*P;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 2734|      0|			for(j = 0; e1 > 0; j++, e1 >>= 1)
  ------------------
  |  Branch (2734:15): [True: 0, False: 0]
  ------------------
 2735|      0|				if (e1 & 1)
  ------------------
  |  Branch (2735:9): [True: 0, False: 0]
  ------------------
 2736|      0|					dval(&rv) *= tinytens[j];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2737|      0|			if (bc.scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask)
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			if (bc.scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			if (bc.scale && (j = 2*P + 1 - ((word0(&rv) & Exp_mask)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (2737:8): [True: 0, False: 0]
  |  Branch (2737:20): [True: 0, False: 0]
  ------------------
 2738|      0|						>> Exp_shift)) > 0) {
  ------------------
  |  |  345|      0|#define Exp_shift  20
  ------------------
 2739|       |				/* scaled rv is denormal; clear j low bits */
 2740|      0|				if (j >= 32) {
  ------------------
  |  Branch (2740:9): [True: 0, False: 0]
  ------------------
 2741|      0|					if (j > 54)
  ------------------
  |  Branch (2741:10): [True: 0, False: 0]
  ------------------
 2742|      0|						goto undfl;
 2743|      0|					word1(&rv) = 0;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 2744|      0|					if (j >= 53)
  ------------------
  |  Branch (2744:10): [True: 0, False: 0]
  ------------------
 2745|      0|					 word0(&rv) = (P+2)*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					 word0(&rv) = (P+2)*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              					 word0(&rv) = (P+2)*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 2746|      0|					else
 2747|      0|					 word0(&rv) &= 0xffffffff << (j-32);
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
 2748|      0|					}
 2749|      0|				else
 2750|      0|					word1(&rv) &= 0xffffffff << j;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 2751|      0|				}
 2752|       |#else
 2753|       |			for(j = 0; e1 > 1; j++, e1 >>= 1)
 2754|       |				if (e1 & 1)
 2755|       |					dval(&rv) *= tinytens[j];
 2756|       |			/* The last multiplication could underflow. */
 2757|       |			dval(&rv0) = dval(&rv);
 2758|       |			dval(&rv) *= tinytens[j];
 2759|       |			if (!dval(&rv)) {
 2760|       |				dval(&rv) = 2.*dval(&rv0);
 2761|       |				dval(&rv) *= tinytens[j];
 2762|       |#endif
 2763|      0|				if (!dval(&rv)) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (2763:9): [True: 0, False: 0]
  ------------------
 2764|      0| undfl:
 2765|      0|					dval(&rv) = 0.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 2766|      0|					goto range_err;
 2767|      0|					}
 2768|       |#ifndef Avoid_Underflow
 2769|       |				word0(&rv) = Tiny0;
 2770|       |				word1(&rv) = Tiny1;
 2771|       |				/* The refinement below will clean
 2772|       |				 * this approximation up.
 2773|       |				 */
 2774|       |				}
 2775|       |#endif
 2776|      0|			}
 2777|      0|		}
 2778|       |
 2779|       |	/* Now the hard part -- adjusting rv to the correct value.*/
 2780|       |
 2781|       |	/* Put digits into bd: true value = bd * 10^e */
 2782|       |
 2783|      0|	bc.nd = nd - nz1;
 2784|      0|#ifndef NO_STRTOD_BIGCOMP
 2785|      0|	bc.nd0 = nd0;	/* Only needed if nd > strtod_diglim, but done here */
 2786|       |			/* to silence an erroneous warning about bc.nd0 */
 2787|       |			/* possibly not being initialized. */
 2788|      0|	if (nd > strtod_diglim) {
  ------------------
  |  |  323|      0|#define strtod_diglim STRTOD_DIGLIM
  |  |  ------------------
  |  |  |  |  317|      0|#define STRTOD_DIGLIM 40
  |  |  ------------------
  ------------------
  |  Branch (2788:6): [True: 0, False: 0]
  ------------------
 2789|       |		/* ASSERT(strtod_diglim >= 18); 18 == one more than the */
 2790|       |		/* minimum number of decimal digits to distinguish double values */
 2791|       |		/* in IEEE arithmetic. */
 2792|      0|		i = j = 18;
 2793|      0|		if (i > nd0)
  ------------------
  |  Branch (2793:7): [True: 0, False: 0]
  ------------------
 2794|      0|			j += bc.dplen;
 2795|      0|		for(;;) {
 2796|      0|			if (--j < bc.dp1 && j >= bc.dp0)
  ------------------
  |  Branch (2796:8): [True: 0, False: 0]
  |  Branch (2796:24): [True: 0, False: 0]
  ------------------
 2797|      0|				j = bc.dp0 - 1;
 2798|      0|			if (s0[j] != '0')
  ------------------
  |  Branch (2798:8): [True: 0, False: 0]
  ------------------
 2799|      0|				break;
 2800|      0|			--i;
 2801|      0|			}
 2802|      0|		e += nd - i;
 2803|      0|		nd = i;
 2804|      0|		if (nd0 > nd)
  ------------------
  |  Branch (2804:7): [True: 0, False: 0]
  ------------------
 2805|      0|			nd0 = nd;
 2806|      0|		if (nd < 9) { /* must recompute y */
  ------------------
  |  Branch (2806:7): [True: 0, False: 0]
  ------------------
 2807|      0|			y = 0;
 2808|      0|			for(i = 0; i < nd0; ++i)
  ------------------
  |  Branch (2808:15): [True: 0, False: 0]
  ------------------
 2809|      0|				y = 10*y + s0[i] - '0';
 2810|      0|			for(j = bc.dp1; i < nd; ++i)
  ------------------
  |  Branch (2810:20): [True: 0, False: 0]
  ------------------
 2811|      0|				y = 10*y + s0[j++] - '0';
 2812|      0|			}
 2813|      0|		}
 2814|      0|#endif
 2815|      0|	bd0 = s2b(C, s0, nd0, nd, y, bc.dplen);
 2816|       |
 2817|      0|	for(;;) {
 2818|      0|		bd = Balloc(C, bd0->k);
 2819|      0|		Bcopy(bd, bd0);
  ------------------
  |  |  586|      0|#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
  |  |  587|      0|y->wds*sizeof(Long) + 2*sizeof(int))
  ------------------
 2820|      0|		bb = d2b(C, &rv, &bbe, &bbbits);	/* rv = bb * 2^bbe */
 2821|      0|		bs = i2b(C, 1);
 2822|       |
 2823|      0|		if (e >= 0) {
  ------------------
  |  Branch (2823:7): [True: 0, False: 0]
  ------------------
 2824|      0|			bb2 = bb5 = 0;
 2825|      0|			bd2 = bd5 = e;
 2826|      0|			}
 2827|      0|		else {
 2828|      0|			bb2 = bb5 = -e;
 2829|      0|			bd2 = bd5 = 0;
 2830|      0|			}
 2831|      0|		if (bbe >= 0)
  ------------------
  |  Branch (2831:7): [True: 0, False: 0]
  ------------------
 2832|      0|			bb2 += bbe;
 2833|      0|		else
 2834|      0|			bd2 -= bbe;
 2835|      0|		bs2 = bb2;
 2836|       |#ifdef Honor_FLT_ROUNDS
 2837|       |		if (bc.rounding != 1)
 2838|       |			bs2++;
 2839|       |#endif
 2840|      0|#ifdef Avoid_Underflow
 2841|      0|		Lsb = LSB;
  ------------------
  |  |  364|      0|#define LSB 1
  ------------------
 2842|      0|		Lsb1 = 0;
 2843|      0|		j = bbe - bc.scale;
 2844|      0|		i = j + bbbits - 1;	/* logb(rv) */
 2845|      0|		j = P + 1 - bbbits;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 2846|      0|		if (i < Emin) {	/* denormal */
  ------------------
  |  |  354|      0|#define Emin (-1022)
  ------------------
  |  Branch (2846:7): [True: 0, False: 0]
  ------------------
 2847|      0|			i = Emin - i;
  ------------------
  |  |  354|      0|#define Emin (-1022)
  ------------------
 2848|      0|			j -= i;
 2849|      0|			if (i < 32)
  ------------------
  |  Branch (2849:8): [True: 0, False: 0]
  ------------------
 2850|      0|				Lsb <<= i;
 2851|      0|			else if (i < 52)
  ------------------
  |  Branch (2851:13): [True: 0, False: 0]
  ------------------
 2852|      0|				Lsb1 = Lsb << (i-32);
 2853|      0|			else
 2854|      0|				Lsb1 = Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 2855|      0|			}
 2856|       |#else /*Avoid_Underflow*/
 2857|       |#ifdef Sudden_Underflow
 2858|       |#ifdef IBM
 2859|       |		j = 1 + 4*P - 3 - bbbits + ((bbe + bbbits - 1) & 3);
 2860|       |#else
 2861|       |		j = P + 1 - bbbits;
 2862|       |#endif
 2863|       |#else /*Sudden_Underflow*/
 2864|       |		j = bbe;
 2865|       |		i = j + bbbits - 1;	/* logb(rv) */
 2866|       |		if (i < Emin)	/* denormal */
 2867|       |			j += P - Emin;
 2868|       |		else
 2869|       |			j = P + 1 - bbbits;
 2870|       |#endif /*Sudden_Underflow*/
 2871|       |#endif /*Avoid_Underflow*/
 2872|      0|		bb2 += j;
 2873|      0|		bd2 += j;
 2874|      0|#ifdef Avoid_Underflow
 2875|      0|		bd2 += bc.scale;
 2876|      0|#endif
 2877|      0|		i = bb2 < bd2 ? bb2 : bd2;
  ------------------
  |  Branch (2877:7): [True: 0, False: 0]
  ------------------
 2878|      0|		if (i > bs2)
  ------------------
  |  Branch (2878:7): [True: 0, False: 0]
  ------------------
 2879|      0|			i = bs2;
 2880|      0|		if (i > 0) {
  ------------------
  |  Branch (2880:7): [True: 0, False: 0]
  ------------------
 2881|      0|			bb2 -= i;
 2882|      0|			bd2 -= i;
 2883|      0|			bs2 -= i;
 2884|      0|			}
 2885|      0|		if (bb5 > 0) {
  ------------------
  |  Branch (2885:7): [True: 0, False: 0]
  ------------------
 2886|      0|			bs = pow5mult(C, bs, bb5);
 2887|      0|			bb1 = mult(C, bs, bb);
 2888|      0|			Bfree(C, bb);
 2889|      0|			bb = bb1;
 2890|      0|			}
 2891|      0|		if (bb2 > 0)
  ------------------
  |  Branch (2891:7): [True: 0, False: 0]
  ------------------
 2892|      0|			bb = lshift(C, bb, bb2);
 2893|      0|		if (bd5 > 0)
  ------------------
  |  Branch (2893:7): [True: 0, False: 0]
  ------------------
 2894|      0|			bd = pow5mult(C, bd, bd5);
 2895|      0|		if (bd2 > 0)
  ------------------
  |  Branch (2895:7): [True: 0, False: 0]
  ------------------
 2896|      0|			bd = lshift(C, bd, bd2);
 2897|      0|		if (bs2 > 0)
  ------------------
  |  Branch (2897:7): [True: 0, False: 0]
  ------------------
 2898|      0|			bs = lshift(C, bs, bs2);
 2899|      0|		delta = diff(C, bb, bd);
 2900|      0|		bc.dsign = delta->sign;
 2901|      0|		delta->sign = 0;
 2902|      0|		i = cmp(C, delta, bs);
 2903|      0|#ifndef NO_STRTOD_BIGCOMP /*{*/
 2904|      0|		if (bc.nd > nd && i <= 0) {
  ------------------
  |  Branch (2904:7): [True: 0, False: 0]
  |  Branch (2904:21): [True: 0, False: 0]
  ------------------
 2905|      0|			if (bc.dsign) {
  ------------------
  |  Branch (2905:8): [True: 0, False: 0]
  ------------------
 2906|       |				/* Must use bigcomp(C, ). */
 2907|      0|				req_bigcomp = 1;
 2908|      0|				break;
 2909|      0|				}
 2910|       |#ifdef Honor_FLT_ROUNDS
 2911|       |			if (bc.rounding != 1) {
 2912|       |				if (i < 0) {
 2913|       |					req_bigcomp = 1;
 2914|       |					break;
 2915|       |					}
 2916|       |				}
 2917|       |			else
 2918|       |#endif
 2919|      0|				i = -1;	/* Discarded digits make delta smaller. */
 2920|      0|			}
 2921|      0|#endif /*}*/
 2922|       |#ifdef Honor_FLT_ROUNDS /*{*/
 2923|       |		if (bc.rounding != 1) {
 2924|       |			if (i < 0) {
 2925|       |				/* Error is less than an ulp */
 2926|       |				if (!delta->x[0] && delta->wds <= 1) {
 2927|       |					/* exact */
 2928|       |#ifdef SET_INEXACT
 2929|       |					bc.inexact = 0;
 2930|       |#endif
 2931|       |					break;
 2932|       |					}
 2933|       |				if (bc.rounding) {
 2934|       |					if (bc.dsign) {
 2935|       |						adj.d = 1.;
 2936|       |						goto apply_adj;
 2937|       |						}
 2938|       |					}
 2939|       |				else if (!bc.dsign) {
 2940|       |					adj.d = -1.;
 2941|       |					if (!word1(&rv)
 2942|       |					 && !(word0(&rv) & Frac_mask)) {
 2943|       |						y = word0(&rv) & Exp_mask;
 2944|       |						test_scale = y;
 2945|       |#ifdef Avoid_Underflow
 2946|       |						test_scale = (!bc.scale || y > 2*P*Exp_msk1);
 2947|       |#endif
 2948|       |						if (test_scale) {
 2949|       |						  delta = lshift(C, delta,Log2P);
 2950|       |						  if (cmp(C, delta, bs) <= 0)
 2951|       |							adj.d = -0.5;
 2952|       |						  }
 2953|       |						}
 2954|       | apply_adj:
 2955|       |#ifdef Avoid_Underflow /*{*/
 2956|       |					if (bc.scale && (y = word0(&rv) & Exp_mask)
 2957|       |						<= 2*P*Exp_msk1)
 2958|       |					  word0(&adj) += (2*P+1)*Exp_msk1 - y;
 2959|       |#else
 2960|       |#ifdef Sudden_Underflow
 2961|       |					if ((word0(&rv) & Exp_mask) <=
 2962|       |							P*Exp_msk1) {
 2963|       |						word0(&rv) += P*Exp_msk1;
 2964|       |						dval(&rv) += adj.d*ulp(C, dval(&rv));
 2965|       |						word0(&rv) -= P*Exp_msk1;
 2966|       |						}
 2967|       |					else
 2968|       |#endif /*Sudden_Underflow*/
 2969|       |#endif /*Avoid_Underflow}*/
 2970|       |					dval(&rv) += adj.d*ulp(C, &rv);
 2971|       |					}
 2972|       |				break;
 2973|       |				}
 2974|       |			adj.d = ratio(C, delta, bs);
 2975|       |			if (adj.d < 1.)
 2976|       |				adj.d = 1.;
 2977|       |			if (adj.d <= 0x7ffffffe) {
 2978|       |				/* adj = rounding ? ceil(adj) : floor(adj); */
 2979|       |				y = adj.d;
 2980|       |				if (y != adj.d) {
 2981|       |					if (!((bc.rounding>>1) ^ bc.dsign))
 2982|       |						y++;
 2983|       |					adj.d = y;
 2984|       |					}
 2985|       |				}
 2986|       |#ifdef Avoid_Underflow /*{*/
 2987|       |			if (bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
 2988|       |				word0(&adj) += (2*P+1)*Exp_msk1 - y;
 2989|       |#else
 2990|       |#ifdef Sudden_Underflow
 2991|       |			if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) {
 2992|       |				word0(&rv) += P*Exp_msk1;
 2993|       |				adj.d *= ulp(C, dval(&rv));
 2994|       |				if (bc.dsign)
 2995|       |					dval(&rv) += adj.d;
 2996|       |				else
 2997|       |					dval(&rv) -= adj.d;
 2998|       |				word0(&rv) -= P*Exp_msk1;
 2999|       |				goto cont;
 3000|       |				}
 3001|       |#endif /*Sudden_Underflow*/
 3002|       |#endif /*Avoid_Underflow}*/
 3003|       |			adj.d *= ulp(C, &rv);
 3004|       |			if (bc.dsign) {
 3005|       |				if (word0(&rv) == Big0 && word1(&rv) == Big1)
 3006|       |					goto ovfl;
 3007|       |				dval(&rv) += adj.d;
 3008|       |				}
 3009|       |			else
 3010|       |				dval(&rv) -= adj.d;
 3011|       |			goto cont;
 3012|       |			}
 3013|       |#endif /*}Honor_FLT_ROUNDS*/
 3014|       |
 3015|      0|		if (i < 0) {
  ------------------
  |  Branch (3015:7): [True: 0, False: 0]
  ------------------
 3016|       |			/* Error is less than half an ulp -- check for
 3017|       |			 * special case of mantissa a power of two.
 3018|       |			 */
 3019|      0|			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  |  |  ------------------
  |  |  |  Branch (309:18): [True: 0, False: 0]
  |  |  ------------------
  ------------------
              			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask
  ------------------
  |  |  362|      0|#define Bndry_mask  0xfffff
  ------------------
  |  Branch (3019:8): [True: 0, False: 0]
  |  Branch (3019:34): [True: 0, False: 0]
  ------------------
 3020|      0|#ifdef IEEE_Arith /*{*/
 3021|      0|#ifdef Avoid_Underflow
 3022|      0|			 || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			 || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
              			 || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			 || (word0(&rv) & Exp_mask) <= (2*P+1)*Exp_msk1
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3022:8): [True: 0, False: 0]
  ------------------
 3023|       |#else
 3024|       |			 || (word0(&rv) & Exp_mask) <= Exp_msk1
 3025|       |#endif
 3026|      0|#endif /*}*/
 3027|      0|				) {
 3028|       |#ifdef SET_INEXACT
 3029|       |				if (!delta->x[0] && delta->wds <= 1)
 3030|       |					bc.inexact = 0;
 3031|       |#endif
 3032|      0|				break;
 3033|      0|				}
 3034|      0|			if (!delta->x[0] && delta->wds <= 1) {
  ------------------
  |  Branch (3034:8): [True: 0, False: 0]
  |  Branch (3034:24): [True: 0, False: 0]
  ------------------
 3035|       |				/* exact result */
 3036|       |#ifdef SET_INEXACT
 3037|       |				bc.inexact = 0;
 3038|       |#endif
 3039|      0|				break;
 3040|      0|				}
 3041|      0|			delta = lshift(C, delta,Log2P);
  ------------------
  |  |  366|      0|#define Log2P 1
  ------------------
 3042|      0|			if (cmp(C, delta, bs) > 0)
  ------------------
  |  Branch (3042:8): [True: 0, False: 0]
  ------------------
 3043|      0|				goto drop_down;
 3044|      0|			break;
 3045|      0|			}
 3046|      0|		if (i == 0) {
  ------------------
  |  Branch (3046:7): [True: 0, False: 0]
  ------------------
 3047|       |			/* exactly half-way between */
 3048|      0|			if (bc.dsign) {
  ------------------
  |  Branch (3048:8): [True: 0, False: 0]
  ------------------
 3049|      0|				if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
  ------------------
  |  |  363|      0|#define Bndry_mask1 0xfffff
  ------------------
              				if ((word0(&rv) & Bndry_mask1) == Bndry_mask1
  ------------------
  |  |  363|      0|#define Bndry_mask1 0xfffff
  ------------------
  |  Branch (3049:9): [True: 0, False: 0]
  ------------------
 3050|      0|				 &&  word1(&rv) == (
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (3050:10): [True: 0, False: 0]
  ------------------
 3051|      0|#ifdef Avoid_Underflow
 3052|      0|			(bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			(bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
              			(bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			(bc.scale && (y = word0(&rv) & Exp_mask) <= 2*P*Exp_msk1)
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3052:5): [True: 0, False: 0]
  |  Branch (3052:17): [True: 0, False: 0]
  ------------------
 3053|      0|		? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) :
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              		? (0xffffffff & (0xffffffff << (2*P+1-(y>>Exp_shift)))) :
  ------------------
  |  |  345|      0|#define Exp_shift  20
  ------------------
 3054|      0|#endif
 3055|      0|						   0xffffffff)) {
 3056|       |					/*boundary case -- increment exponent*/
 3057|      0|					if (word0(&rv) == Big0 && word1(&rv) == Big1)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					if (word0(&rv) == Big0 && word1(&rv) == Big1)
  ------------------
  |  |  478|      0|#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  359|      0|#define Frac_mask1 0xfffff
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  347|      0|#define Exp_msk1    0x100000
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  352|      0|#define Bias 1023
  |  |  ------------------
  ------------------
              					if (word0(&rv) == Big0 && word1(&rv) == Big1)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              					if (word0(&rv) == Big0 && word1(&rv) == Big1)
  ------------------
  |  |  479|      0|#define Big1 0xffffffff
  ------------------
  |  Branch (3057:10): [True: 0, False: 0]
  |  Branch (3057:32): [True: 0, False: 0]
  ------------------
 3058|      0|						goto ovfl;
 3059|      0|					word0(&rv) = (word0(&rv) & Exp_mask)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					word0(&rv) = (word0(&rv) & Exp_mask)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					word0(&rv) = (word0(&rv) & Exp_mask)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 3060|      0|						+ Exp_msk1
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3061|       |#ifdef IBM
 3062|       |						| Exp_msk1 >> 4
 3063|       |#endif
 3064|      0|						;
 3065|      0|					word1(&rv) = 0;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 3066|      0|#ifdef Avoid_Underflow
 3067|      0|					bc.dsign = 0;
 3068|      0|#endif
 3069|      0|					break;
 3070|      0|					}
 3071|      0|				}
 3072|      0|			else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
  ------------------
  |  |  362|      0|#define Bndry_mask  0xfffff
  ------------------
              			else if (!(word0(&rv) & Bndry_mask) && !word1(&rv)) {
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (3072:13): [True: 0, False: 0]
  |  Branch (3072:43): [True: 0, False: 0]
  ------------------
 3073|      0| drop_down:
 3074|       |				/* boundary case -- decrement exponent */
 3075|       |#ifdef Sudden_Underflow /*{{*/
 3076|       |				L = word0(&rv) & Exp_mask;
 3077|       |#ifdef IBM
 3078|       |				if (L <  Exp_msk1)
 3079|       |#else
 3080|       |#ifdef Avoid_Underflow
 3081|       |				if (L <= (bc.scale ? (2*P+1)*Exp_msk1 : Exp_msk1))
 3082|       |#else
 3083|       |				if (L <= Exp_msk1)
 3084|       |#endif /*Avoid_Underflow*/
 3085|       |#endif /*IBM*/
 3086|       |					{
 3087|       |					if (bc.nd >nd) {
 3088|       |						bc.uflchk = 1;
 3089|       |						break;
 3090|       |						}
 3091|       |					goto undfl;
 3092|       |					}
 3093|       |				L -= Exp_msk1;
 3094|       |#else /*Sudden_Underflow}{*/
 3095|      0|#ifdef Avoid_Underflow
 3096|      0|				if (bc.scale) {
  ------------------
  |  Branch (3096:9): [True: 0, False: 0]
  ------------------
 3097|      0|					L = word0(&rv) & Exp_mask;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              					L = word0(&rv) & Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 3098|      0|					if (L <= (2*P+1)*Exp_msk1) {
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              					if (L <= (2*P+1)*Exp_msk1) {
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3098:10): [True: 0, False: 0]
  ------------------
 3099|      0|						if (L > (P+2)*Exp_msk1)
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              						if (L > (P+2)*Exp_msk1)
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3099:11): [True: 0, False: 0]
  ------------------
 3100|       |							/* round even ==> */
 3101|       |							/* accept rv */
 3102|      0|							break;
 3103|       |						/* rv = smallest denormal */
 3104|      0|						if (bc.nd >nd) {
  ------------------
  |  Branch (3104:11): [True: 0, False: 0]
  ------------------
 3105|      0|							bc.uflchk = 1;
 3106|      0|							break;
 3107|      0|							}
 3108|      0|						goto undfl;
 3109|      0|						}
 3110|      0|					}
 3111|      0|#endif /*Avoid_Underflow*/
 3112|      0|				L = (word0(&rv) & Exp_mask) - Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				L = (word0(&rv) & Exp_mask) - Exp_msk1;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
              				L = (word0(&rv) & Exp_mask) - Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3113|      0|#endif /*Sudden_Underflow}}*/
 3114|      0|				word0(&rv) = L | Bndry_mask1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) = L | Bndry_mask1;
  ------------------
  |  |  363|      0|#define Bndry_mask1 0xfffff
  ------------------
 3115|      0|				word1(&rv) = 0xffffffff;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 3116|       |#ifdef IBM
 3117|       |				goto cont;
 3118|       |#else
 3119|      0|#ifndef NO_STRTOD_BIGCOMP
 3120|      0|				if (bc.nd > nd)
  ------------------
  |  Branch (3120:9): [True: 0, False: 0]
  ------------------
 3121|      0|					goto cont;
 3122|      0|#endif
 3123|      0|				break;
 3124|      0|#endif
 3125|      0|				}
 3126|      0|#ifndef ROUND_BIASED
 3127|      0|#ifdef Avoid_Underflow
 3128|      0|			if (Lsb1) {
  ------------------
  |  Branch (3128:8): [True: 0, False: 0]
  ------------------
 3129|      0|				if (!(word0(&rv) & Lsb1))
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
  |  Branch (3129:9): [True: 0, False: 0]
  ------------------
 3130|      0|					break;
 3131|      0|				}
 3132|      0|			else if (!(word1(&rv) & Lsb))
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (3132:13): [True: 0, False: 0]
  ------------------
 3133|      0|				break;
 3134|       |#else
 3135|       |			if (!(word1(&rv) & LSB))
 3136|       |				break;
 3137|       |#endif
 3138|      0|#endif
 3139|      0|			if (bc.dsign)
  ------------------
  |  Branch (3139:8): [True: 0, False: 0]
  ------------------
 3140|      0|#ifdef Avoid_Underflow
 3141|      0|				dval(&rv) += sulp(C, &rv, &bc);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3142|       |#else
 3143|       |				dval(&rv) += ulp(C, &rv);
 3144|       |#endif
 3145|      0|#ifndef ROUND_BIASED
 3146|      0|			else {
 3147|      0|#ifdef Avoid_Underflow
 3148|      0|				dval(&rv) -= sulp(C, &rv, &bc);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3149|       |#else
 3150|       |				dval(&rv) -= ulp(C, &rv);
 3151|       |#endif
 3152|      0|#ifndef Sudden_Underflow
 3153|      0|				if (!dval(&rv)) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3153:9): [True: 0, False: 0]
  ------------------
 3154|      0|					if (bc.nd >nd) {
  ------------------
  |  Branch (3154:10): [True: 0, False: 0]
  ------------------
 3155|      0|						bc.uflchk = 1;
 3156|      0|						break;
 3157|      0|						}
 3158|      0|					goto undfl;
 3159|      0|					}
 3160|      0|#endif
 3161|      0|				}
 3162|      0|#ifdef Avoid_Underflow
 3163|      0|			bc.dsign = 1 - bc.dsign;
 3164|      0|#endif
 3165|      0|#endif
 3166|      0|			break;
 3167|      0|			}
 3168|      0|		if ((aadj = ratio(C, delta, bs)) <= 2.) {
  ------------------
  |  Branch (3168:7): [True: 0, False: 0]
  ------------------
 3169|      0|			if (bc.dsign)
  ------------------
  |  Branch (3169:8): [True: 0, False: 0]
  ------------------
 3170|      0|				aadj = aadj1 = 1.;
 3171|      0|			else if (word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  |  |  ------------------
  |  |  |  Branch (309:18): [True: 0, False: 0]
  |  |  ------------------
  ------------------
              			else if (word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			else if (word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  362|      0|#define Bndry_mask  0xfffff
  ------------------
  |  Branch (3171:27): [True: 0, False: 0]
  ------------------
 3172|      0|#ifndef Sudden_Underflow
 3173|      0|				if (word1(&rv) == Tiny1 && !word0(&rv)) {
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              				if (word1(&rv) == Tiny1 && !word0(&rv)) {
  ------------------
  |  |  368|      0|#define Tiny1 1
  ------------------
              				if (word1(&rv) == Tiny1 && !word0(&rv)) {
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
  |  Branch (3173:9): [True: 0, False: 0]
  |  Branch (3173:32): [True: 0, False: 0]
  ------------------
 3174|      0|					if (bc.nd >nd) {
  ------------------
  |  Branch (3174:10): [True: 0, False: 0]
  ------------------
 3175|      0|						bc.uflchk = 1;
 3176|      0|						break;
 3177|      0|						}
 3178|      0|					goto undfl;
 3179|      0|					}
 3180|      0|#endif
 3181|      0|				aadj = 1.;
 3182|      0|				aadj1 = -1.;
 3183|      0|				}
 3184|      0|			else {
 3185|       |				/* special case -- power of FLT_RADIX to be */
 3186|       |				/* rounded down... */
 3187|       |
 3188|      0|				if (aadj < 2./FLT_RADIX)
  ------------------
  |  Branch (3188:9): [True: 0, False: 0]
  ------------------
 3189|      0|					aadj = 1./FLT_RADIX;
 3190|      0|				else
 3191|      0|					aadj *= 0.5;
 3192|      0|				aadj1 = -aadj;
 3193|      0|				}
 3194|      0|			}
 3195|      0|		else {
 3196|      0|			aadj *= 0.5;
 3197|      0|			aadj1 = bc.dsign ? aadj : -aadj;
  ------------------
  |  Branch (3197:12): [True: 0, False: 0]
  ------------------
 3198|       |#ifdef Check_FLT_ROUNDS
 3199|       |			switch(bc.rounding) {
 3200|       |				case 2: /* towards +infinity */
 3201|       |					aadj1 -= 0.5;
 3202|       |					break;
 3203|       |				case 0: /* towards 0 */
 3204|       |				case 3: /* towards -infinity */
 3205|       |					aadj1 += 0.5;
 3206|       |				}
 3207|       |#else
 3208|      0|			if (Flt_Rounds == 0)
  ------------------
  |  |  380|      0|#define Flt_Rounds FLT_ROUNDS
  ------------------
  |  Branch (3208:8): [True: 0, False: 0]
  ------------------
 3209|      0|				aadj1 += 0.5;
 3210|      0|#endif /*Check_FLT_ROUNDS*/
 3211|      0|			}
 3212|      0|		y = word0(&rv) & Exp_mask;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		y = word0(&rv) & Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 3213|       |
 3214|       |		/* Check for overflow */
 3215|       |
 3216|      0|		if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
              		if (y == Exp_msk1*(DBL_MAX_EXP+Bias-1)) {
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
  |  Branch (3216:7): [True: 0, False: 0]
  ------------------
 3217|      0|			dval(&rv0) = dval(&rv);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              			dval(&rv0) = dval(&rv);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3218|      0|			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			word0(&rv) -= P*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3219|      0|			adj.d = aadj1 * ulp(C, &rv);
 3220|      0|			dval(&rv) += adj.d;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3221|      0|			if ((word0(&rv) & Exp_mask) >=
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			if ((word0(&rv) & Exp_mask) >=
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (3221:8): [True: 0, False: 0]
  ------------------
 3222|      0|					Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
              					Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              					Exp_msk1*(DBL_MAX_EXP+Bias-P)) {
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 3223|      0|				if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
  ------------------
  |  |  478|      0|#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  359|      0|#define Frac_mask1 0xfffff
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  347|      0|#define Exp_msk1    0x100000
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  352|      0|#define Bias 1023
  |  |  ------------------
  ------------------
              				if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              				if (word0(&rv0) == Big0 && word1(&rv0) == Big1)
  ------------------
  |  |  479|      0|#define Big1 0xffffffff
  ------------------
  |  Branch (3223:9): [True: 0, False: 0]
  |  Branch (3223:32): [True: 0, False: 0]
  ------------------
 3224|      0|					goto ovfl;
 3225|      0|				word0(&rv) = Big0;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) = Big0;
  ------------------
  |  |  478|      0|#define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  359|      0|#define Frac_mask1 0xfffff
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  347|      0|#define Exp_msk1    0x100000
  |  |  ------------------
  |  |               #define Big0 (Frac_mask1 | Exp_msk1*(DBL_MAX_EXP+Bias-1))
  |  |  ------------------
  |  |  |  |  352|      0|#define Bias 1023
  |  |  ------------------
  ------------------
 3226|      0|				word1(&rv) = Big1;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              				word1(&rv) = Big1;
  ------------------
  |  |  479|      0|#define Big1 0xffffffff
  ------------------
 3227|      0|				goto cont;
 3228|      0|				}
 3229|      0|			else
 3230|      0|				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              				word0(&rv) += P*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3231|      0|			}
 3232|      0|		else {
 3233|      0|#ifdef Avoid_Underflow
 3234|      0|			if (bc.scale && y <= 2*P*Exp_msk1) {
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              			if (bc.scale && y <= 2*P*Exp_msk1) {
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3234:8): [True: 0, False: 0]
  |  Branch (3234:20): [True: 0, False: 0]
  ------------------
 3235|      0|				if (aadj <= 0x7fffffff) {
  ------------------
  |  Branch (3235:9): [True: 0, False: 0]
  ------------------
 3236|      0|					if ((z = aadj) <= 0)
  ------------------
  |  Branch (3236:10): [True: 0, False: 0]
  ------------------
 3237|      0|						z = 1;
 3238|      0|					aadj = z;
 3239|      0|					aadj1 = bc.dsign ? aadj : -aadj;
  ------------------
  |  Branch (3239:14): [True: 0, False: 0]
  ------------------
 3240|      0|					}
 3241|      0|				dval(&aadj2) = aadj1;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3242|      0|				word0(&aadj2) += (2*P+1)*Exp_msk1 - y;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&aadj2) += (2*P+1)*Exp_msk1 - y;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              				word0(&aadj2) += (2*P+1)*Exp_msk1 - y;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3243|      0|				aadj1 = dval(&aadj2);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3244|      0|				adj.d = aadj1 * ulp(C, &rv);
 3245|      0|				dval(&rv) += adj.d;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3246|      0|				if (rv.d == 0.)
  ------------------
  |  Branch (3246:9): [True: 0, False: 0]
  ------------------
 3247|       |#ifdef NO_STRTOD_BIGCOMP
 3248|       |					goto undfl;
 3249|       |#else
 3250|      0|					{
 3251|      0|					if (bc.nd > nd)
  ------------------
  |  Branch (3251:10): [True: 0, False: 0]
  ------------------
 3252|      0|						bc.dsign = 1;
 3253|      0|					break;
 3254|      0|					}
 3255|      0|#endif
 3256|      0|				}
 3257|      0|			else {
 3258|      0|				adj.d = aadj1 * ulp(C, &rv);
 3259|      0|				dval(&rv) += adj.d;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3260|      0|				}
 3261|       |#else
 3262|       |#ifdef Sudden_Underflow
 3263|       |			if ((word0(&rv) & Exp_mask) <= P*Exp_msk1) {
 3264|       |				dval(&rv0) = dval(&rv);
 3265|       |				word0(&rv) += P*Exp_msk1;
 3266|       |				adj.d = aadj1 * ulp(C, &rv);
 3267|       |				dval(&rv) += adj.d;
 3268|       |#ifdef IBM
 3269|       |				if ((word0(&rv) & Exp_mask) <  P*Exp_msk1)
 3270|       |#else
 3271|       |				if ((word0(&rv) & Exp_mask) <= P*Exp_msk1)
 3272|       |#endif
 3273|       |					{
 3274|       |					if (word0(&rv0) == Tiny0
 3275|       |					 && word1(&rv0) == Tiny1) {
 3276|       |						if (bc.nd >nd) {
 3277|       |							bc.uflchk = 1;
 3278|       |							break;
 3279|       |							}
 3280|       |						goto undfl;
 3281|       |						}
 3282|       |					word0(&rv) = Tiny0;
 3283|       |					word1(&rv) = Tiny1;
 3284|       |					goto cont;
 3285|       |					}
 3286|       |				else
 3287|       |					word0(&rv) -= P*Exp_msk1;
 3288|       |				}
 3289|       |			else {
 3290|       |				adj.d = aadj1 * ulp(C, &rv);
 3291|       |				dval(&rv) += adj.d;
 3292|       |				}
 3293|       |#else /*Sudden_Underflow*/
 3294|       |			/* Compute adj so that the IEEE rounding rules will
 3295|       |			 * correctly round rv + adj in some half-way cases.
 3296|       |			 * If rv * ulp(C, rv) is denormalized (i.e.,
 3297|       |			 * y <= (P-1)*Exp_msk1), we must adjust aadj to avoid
 3298|       |			 * trouble from bits lost to denormalization;
 3299|       |			 * example: 1.2e-307 .
 3300|       |			 */
 3301|       |			if (y <= (P-1)*Exp_msk1 && aadj > 1.) {
 3302|       |				aadj1 = (double)(int)(aadj + 0.5);
 3303|       |				if (!bc.dsign)
 3304|       |					aadj1 = -aadj1;
 3305|       |				}
 3306|       |			adj.d = aadj1 * ulp(C, &rv);
 3307|       |			dval(&rv) += adj.d;
 3308|       |#endif /*Sudden_Underflow*/
 3309|       |#endif /*Avoid_Underflow*/
 3310|      0|			}
 3311|      0|		z = word0(&rv) & Exp_mask;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		z = word0(&rv) & Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 3312|      0|#ifndef SET_INEXACT
 3313|      0|		if (bc.nd == nd) {
  ------------------
  |  Branch (3313:7): [True: 0, False: 0]
  ------------------
 3314|      0|#ifdef Avoid_Underflow
 3315|      0|		if (!bc.scale)
  ------------------
  |  Branch (3315:7): [True: 0, False: 0]
  ------------------
 3316|      0|#endif
 3317|      0|		if (y == z) {
  ------------------
  |  Branch (3317:7): [True: 0, False: 0]
  ------------------
 3318|       |			/* Can we stop now? */
 3319|      0|			L = (Long)aadj;
 3320|      0|			aadj -= L;
 3321|       |			/* The tolerances below are conservative. */
 3322|      0|			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  |  |  ------------------
  |  |  |  Branch (309:18): [True: 0, False: 0]
  |  |  ------------------
  ------------------
              			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              			if (bc.dsign || word1(&rv) || word0(&rv) & Bndry_mask) {
  ------------------
  |  |  362|      0|#define Bndry_mask  0xfffff
  ------------------
  |  Branch (3322:8): [True: 0, False: 0]
  |  Branch (3322:34): [True: 0, False: 0]
  ------------------
 3323|      0|				if (aadj < .4999999 || aadj > .5000001)
  ------------------
  |  Branch (3323:9): [True: 0, False: 0]
  |  Branch (3323:28): [True: 0, False: 0]
  ------------------
 3324|      0|					break;
 3325|      0|				}
 3326|      0|			else if (aadj < .4999999/FLT_RADIX)
  ------------------
  |  Branch (3326:13): [True: 0, False: 0]
  ------------------
 3327|      0|				break;
 3328|      0|			}
 3329|      0|		}
 3330|      0|#endif
 3331|      0| cont:
 3332|      0|		Bfree(C, bb);
 3333|      0|		Bfree(C, bd);
 3334|      0|		Bfree(C, bs);
 3335|      0|		Bfree(C, delta);
 3336|      0|		}
 3337|      0|	Bfree(C, bb);
 3338|      0|	Bfree(C, bd);
 3339|      0|	Bfree(C, bs);
 3340|      0|	Bfree(C, bd0);
 3341|      0|	Bfree(C, delta);
 3342|      0|#ifndef NO_STRTOD_BIGCOMP
 3343|      0|	if (req_bigcomp) {
  ------------------
  |  Branch (3343:6): [True: 0, False: 0]
  ------------------
 3344|      0|		bd0 = 0;
 3345|      0|		bc.e0 += nz1;
 3346|      0|		bigcomp(C, &rv, s0, &bc);
 3347|      0|		y = word0(&rv) & Exp_mask;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		y = word0(&rv) & Exp_mask;
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
 3348|      0|		if (y == Exp_mask)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (3348:7): [True: 0, False: 0]
  ------------------
 3349|      0|			goto ovfl;
 3350|      0|		if (y == 0 && rv.d == 0.)
  ------------------
  |  Branch (3350:7): [True: 0, False: 0]
  |  Branch (3350:17): [True: 0, False: 0]
  ------------------
 3351|      0|			goto undfl;
 3352|      0|		}
 3353|      0|#endif
 3354|       |#ifdef SET_INEXACT
 3355|       |	if (bc.inexact) {
 3356|       |		if (!oldinexact) {
 3357|       |			word0(&rv0) = Exp_1 + (70 << Exp_shift);
 3358|       |			word1(&rv0) = 0;
 3359|       |			dval(&rv0) += 1.;
 3360|       |			}
 3361|       |		}
 3362|       |	else if (!oldinexact)
 3363|       |		clear_inexact();
 3364|       |#endif
 3365|      0|#ifdef Avoid_Underflow
 3366|      0|	if (bc.scale) {
  ------------------
  |  Branch (3366:6): [True: 0, False: 0]
  ------------------
 3367|      0|		word0(&rv0) = Exp_1 - 2*P*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		word0(&rv0) = Exp_1 - 2*P*Exp_msk1;
  ------------------
  |  |  355|      0|#define Exp_1  0x3ff00000
  ------------------
              		word0(&rv0) = Exp_1 - 2*P*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              		word0(&rv0) = Exp_1 - 2*P*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3368|      0|		word1(&rv0) = 0;
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 3369|      0|		dval(&rv) *= dval(&rv0);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              		dval(&rv) *= dval(&rv0);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3370|       |#ifndef NO_ERRNO
 3371|       |		/* try to avoid the bug of testing an 8087 register value */
 3372|       |#ifdef IEEE_Arith
 3373|       |		if (!(word0(&rv) & Exp_mask))
 3374|       |#else
 3375|       |		if (word0(&rv) == 0 && word1(&rv) == 0)
 3376|       |#endif
 3377|       |			errno = ERANGE;
 3378|       |#endif
 3379|      0|		}
 3380|      0|#endif /* Avoid_Underflow */
 3381|       |#ifdef SET_INEXACT
 3382|       |	if (bc.inexact && !(word0(&rv) & Exp_mask)) {
 3383|       |		/* set underflow bit */
 3384|       |		dval(&rv0) = 1e-300;
 3385|       |		dval(&rv0) *= dval(&rv0);
 3386|       |		}
 3387|       |#endif
 3388|  5.19k| ret:
 3389|  5.19k|	if (se)
  ------------------
  |  Branch (3389:6): [True: 5.19k, False: 0]
  ------------------
 3390|  5.19k|		*se = (char *)s;
 3391|  5.19k|	return sign ? -dval(&rv) : dval(&rv);
  ------------------
  |  |  314|    204|#define dval(x) (x)->d
  ------------------
              	return sign ? -dval(&rv) : dval(&rv);
  ------------------
  |  |  314|  4.99k|#define dval(x) (x)->d
  ------------------
  |  Branch (3391:9): [True: 204, False: 4.99k]
  ------------------
 3392|      0|	}
jvp_freedtoa:
 3430|  7.02M|{
 3431|  7.02M|	Bigint *b = (Bigint *)((int *)s - 1);
 3432|  7.02M|	b->maxwds = 1 << (b->k = *(int*)b);
 3433|  7.02M|	Bfree(C, b);
 3434|  7.02M|	}
jvp_dtoa:
 3473|  7.02M|{
 3474|       | /*	Arguments ndigits, decpt, sign are similar to those
 3475|       |	of ecvt and fcvt; trailing zeros are suppressed from
 3476|       |	the returned string.  If not null, *rve is set to point
 3477|       |	to the end of the return value.  If d is +-Infinity or NaN,
 3478|       |	then *decpt is set to 9999.
 3479|       |
 3480|       |	mode:
 3481|       |		0 ==> shortest string that yields d when read in
 3482|       |			and rounded to nearest.
 3483|       |		1 ==> like 0, but with Steele & White stopping rule;
 3484|       |			e.g. with IEEE P754 arithmetic , mode 0 gives
 3485|       |			1e23 whereas mode 1 gives 9.999999999999999e22.
 3486|       |		2 ==> max(1,ndigits) significant digits.  This gives a
 3487|       |			return value similar to that of ecvt, except
 3488|       |			that trailing zeros are suppressed.
 3489|       |		3 ==> through ndigits past the decimal point.  This
 3490|       |			gives a return value similar to that from fcvt,
 3491|       |			except that trailing zeros are suppressed, and
 3492|       |			ndigits can be negative.
 3493|       |		4,5 ==> similar to 2 and 3, respectively, but (in
 3494|       |			round-nearest mode) with the tests of mode 0 to
 3495|       |			possibly return a shorter string that rounds to d.
 3496|       |			With IEEE arithmetic and compilation with
 3497|       |			-DHonor_FLT_ROUNDS, modes 4 and 5 behave the same
 3498|       |			as modes 2 and 3 when FLT_ROUNDS != 1.
 3499|       |		6-9 ==> Debugging modes similar to mode - 4:  don't try
 3500|       |			fast floating-point estimate (if applicable).
 3501|       |
 3502|       |		Values of mode other than 0-9 are treated as mode 0.
 3503|       |
 3504|       |		Sufficient space is allocated to the return value
 3505|       |		to hold the suppressed trailing zeros.
 3506|       |	*/
 3507|       |
 3508|  7.02M|	int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
 3509|  7.02M|		j, j1=0, k, k0, k_check, leftright, m2, m5, s2, s5,
 3510|  7.02M|		spec_case, try_quick;
 3511|  7.02M|	Long L;
  ------------------
  |  |  193|  7.02M|#define Long int
  ------------------
 3512|  7.02M|#ifndef Sudden_Underflow
 3513|  7.02M|	int denorm;
 3514|  7.02M|	ULong x;
 3515|  7.02M|#endif
 3516|  7.02M|	Bigint *b, *b1, *delta, *mlo, *mhi, *S;
 3517|  7.02M|	U d2, eps, u;
 3518|  7.02M|	double ds;
 3519|  7.02M|	char *s, *s0;
 3520|  7.02M|#ifndef No_leftright
 3521|  7.02M|#ifdef IEEE_Arith
 3522|  7.02M|	U eps1;
 3523|  7.02M|#endif
 3524|  7.02M|#endif
 3525|       |#ifdef SET_INEXACT
 3526|       |	int inexact, oldinexact;
 3527|       |#endif
 3528|       |#ifdef Honor_FLT_ROUNDS /*{*/
 3529|       |	int Rounding;
 3530|       |#ifdef Trust_FLT_ROUNDS /*{{ only define this if FLT_ROUNDS really works! */
 3531|       |	Rounding = Flt_Rounds;
 3532|       |#else /*}{*/
 3533|       |	Rounding = 1;
 3534|       |	switch(fegetround()) {
 3535|       |	  case FE_TOWARDZERO:	Rounding = 0; break;
 3536|       |	  case FE_UPWARD:	Rounding = 2; break;
 3537|       |	  case FE_DOWNWARD:	Rounding = 3;
 3538|       |	  }
 3539|       |#endif /*}}*/
 3540|       |#endif /*}*/
 3541|       |
 3542|       |
 3543|  7.02M|	u.d = dd;
 3544|  7.02M|	if (word0(&u) & Sign_bit) {
  ------------------
  |  |  308|  7.02M|#define word0(x) (x)->L[1]
  ------------------
              	if (word0(&u) & Sign_bit) {
  ------------------
  |  |  365|  7.02M|#define Sign_bit 0x80000000
  ------------------
  |  Branch (3544:6): [True: 204, False: 7.02M]
  ------------------
 3545|       |		/* set sign for everything, including 0's and NaNs */
 3546|    204|		*sign = 1;
 3547|    204|		word0(&u) &= ~Sign_bit;	/* clear sign bit */
  ------------------
  |  |  308|    204|#define word0(x) (x)->L[1]
  ------------------
              		word0(&u) &= ~Sign_bit;	/* clear sign bit */
  ------------------
  |  |  365|    204|#define Sign_bit 0x80000000
  ------------------
 3548|    204|		}
 3549|  7.02M|	else
 3550|  7.02M|		*sign = 0;
 3551|       |
 3552|  7.02M|#if defined(IEEE_Arith) + defined(VAX)
 3553|  7.02M|#ifdef IEEE_Arith
 3554|  7.02M|	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  308|  7.02M|#define word0(x) (x)->L[1]
  ------------------
              	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  349|  7.02M|#define Exp_mask  0x7ff00000
  ------------------
              	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  349|  7.02M|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (3554:6): [True: 0, False: 7.02M]
  ------------------
 3555|       |#else
 3556|       |	if (word0(&u)  == 0x8000)
 3557|       |#endif
 3558|      0|		{
 3559|       |		/* Infinity or NaN */
 3560|      0|		*decpt = 9999;
 3561|      0|#ifdef IEEE_Arith
 3562|      0|		if (!word1(&u) && !(word0(&u) & 0xfffff))
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
              		if (!word1(&u) && !(word0(&u) & 0xfffff))
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
  |  Branch (3562:7): [True: 0, False: 0]
  |  Branch (3562:21): [True: 0, False: 0]
  ------------------
 3563|      0|			return nrv_alloc(C, "Infinity", rve, 8);
 3564|      0|#endif
 3565|      0|		return nrv_alloc(C, "NaN", rve, 3);
 3566|      0|		}
 3567|  7.02M|#endif
 3568|       |#ifdef IBM
 3569|       |	dval(&u) += 0; /* normalize */
 3570|       |#endif
 3571|  7.02M|	if (!dval(&u)) {
  ------------------
  |  |  314|  7.02M|#define dval(x) (x)->d
  ------------------
  |  Branch (3571:6): [True: 7.00M, False: 22.0k]
  ------------------
 3572|  7.00M|		*decpt = 1;
 3573|  7.00M|		return nrv_alloc(C, "0", rve, 1);
 3574|  7.00M|		}
 3575|       |
 3576|       |#ifdef SET_INEXACT
 3577|       |	try_quick = oldinexact = get_inexact();
 3578|       |	inexact = 1;
 3579|       |#endif
 3580|       |#ifdef Honor_FLT_ROUNDS
 3581|       |	if (Rounding >= 2) {
 3582|       |		if (*sign)
 3583|       |			Rounding = Rounding == 2 ? 0 : 2;
 3584|       |		else
 3585|       |			if (Rounding != 2)
 3586|       |				Rounding = 0;
 3587|       |		}
 3588|       |#endif
 3589|       |
 3590|  22.0k|	b = d2b(C, &u, &be, &bbits);
 3591|       |#ifdef Sudden_Underflow
 3592|       |	i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
 3593|       |#else
 3594|  22.0k|	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  346|  22.0k|#define Exp_shift1 20
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  349|  22.0k|#define Exp_mask  0x7ff00000
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  346|  22.0k|#define Exp_shift1 20
  ------------------
  |  Branch (3594:6): [True: 22.0k, False: 0]
  ------------------
 3595|  22.0k|#endif
 3596|  22.0k|		dval(&d2) = dval(&u);
  ------------------
  |  |  314|  22.0k|#define dval(x) (x)->d
  ------------------
              		dval(&d2) = dval(&u);
  ------------------
  |  |  314|  22.0k|#define dval(x) (x)->d
  ------------------
 3597|  22.0k|		word0(&d2) &= Frac_mask1;
  ------------------
  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  ------------------
              		word0(&d2) &= Frac_mask1;
  ------------------
  |  |  359|  22.0k|#define Frac_mask1 0xfffff
  ------------------
 3598|  22.0k|		word0(&d2) |= Exp_11;
  ------------------
  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  ------------------
              		word0(&d2) |= Exp_11;
  ------------------
  |  |  356|  22.0k|#define Exp_11 0x3ff00000
  ------------------
 3599|       |#ifdef IBM
 3600|       |		if (j = 11 - hi0bits(C, word0(&d2) & Frac_mask))
 3601|       |			dval(&d2) /= 1 << j;
 3602|       |#endif
 3603|       |
 3604|       |		/* log(x)	~=~ log(1.5) + (x-1.5)/1.5
 3605|       |		 * log10(x)	 =  log(x) / log(10)
 3606|       |		 *		~=~ log(1.5)/log(10) + (x-1.5)/(1.5*log(10))
 3607|       |		 * log10(d) = (i-Bias)*log(2)/log(10) + log10(d2)
 3608|       |		 *
 3609|       |		 * This suggests computing an approximation k to log10(d) by
 3610|       |		 *
 3611|       |		 * k = (i - Bias)*0.301029995663981
 3612|       |		 *	+ ( (d2-1.5)*0.289529654602168 + 0.176091259055681 );
 3613|       |		 *
 3614|       |		 * We want k to be too large rather than too small.
 3615|       |		 * The error in the first-order Taylor series approximation
 3616|       |		 * is in our favor, so we just round up the constant enough
 3617|       |		 * to compensate for any error in the multiplication of
 3618|       |		 * (i - Bias) by 0.301029995663981; since |i - Bias| <= 1077,
 3619|       |		 * and 1077 * 0.30103 * 2^-52 ~=~ 7.2e-14,
 3620|       |		 * adding 1e-13 to the constant term more than suffices.
 3621|       |		 * Hence we adjust the constant term to 0.1760912590558.
 3622|       |		 * (We could get a more accurate k by invoking log10,
 3623|       |		 *  but this is probably not worthwhile.)
 3624|       |		 */
 3625|       |
 3626|  22.0k|		i -= Bias;
  ------------------
  |  |  352|  22.0k|#define Bias 1023
  ------------------
 3627|       |#ifdef IBM
 3628|       |		i <<= 2;
 3629|       |		i += j;
 3630|       |#endif
 3631|  22.0k|#ifndef Sudden_Underflow
 3632|  22.0k|		denorm = 0;
 3633|  22.0k|		}
 3634|      0|	else {
 3635|       |		/* d is denormalized */
 3636|       |
 3637|      0|		i = bbits + be + (Bias + (P-1) - 1);
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              		i = bbits + be + (Bias + (P-1) - 1);
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 3638|      0|		x = i > 32  ? word0(&u) << (64 - i) | word1(&u) >> (i - 32)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		x = i > 32  ? word0(&u) << (64 - i) | word1(&u) >> (i - 32)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (3638:7): [True: 0, False: 0]
  ------------------
 3639|      0|			    : word1(&u) << (32 - i);
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
 3640|      0|		dval(&d2) = x;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3641|      0|		word0(&d2) -= 31*Exp_msk1; /* adjust exponent */
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		word0(&d2) -= 31*Exp_msk1; /* adjust exponent */
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3642|      0|		i -= (Bias + (P-1) - 1) + 1;
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              		i -= (Bias + (P-1) - 1) + 1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 3643|      0|		denorm = 1;
 3644|      0|		}
 3645|  22.0k|#endif
 3646|  22.0k|	ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
  ------------------
  |  |  314|  22.0k|#define dval(x) (x)->d
  ------------------
 3647|  22.0k|	k = (int)ds;
 3648|  22.0k|	if (ds < 0. && ds != k)
  ------------------
  |  Branch (3648:6): [True: 0, False: 22.0k]
  |  Branch (3648:17): [True: 0, False: 0]
  ------------------
 3649|      0|		k--;	/* want k = floor(ds) */
 3650|  22.0k|	k_check = 1;
 3651|  22.0k|	if (k >= 0 && k <= Ten_pmax) {
  ------------------
  |  |  360|  22.0k|#define Ten_pmax 22
  ------------------
  |  Branch (3651:6): [True: 22.0k, False: 0]
  |  Branch (3651:16): [True: 16.8k, False: 5.19k]
  ------------------
 3652|  16.8k|		if (dval(&u) < tens[k])
  ------------------
  |  |  314|  16.8k|#define dval(x) (x)->d
  ------------------
  |  Branch (3652:7): [True: 0, False: 16.8k]
  ------------------
 3653|      0|			k--;
 3654|  16.8k|		k_check = 0;
 3655|  16.8k|		}
 3656|  22.0k|	j = bbits - i - 1;
 3657|  22.0k|	if (j >= 0) {
  ------------------
  |  Branch (3657:6): [True: 16.8k, False: 5.19k]
  ------------------
 3658|  16.8k|		b2 = 0;
 3659|  16.8k|		s2 = j;
 3660|  16.8k|		}
 3661|  5.19k|	else {
 3662|  5.19k|		b2 = -j;
 3663|  5.19k|		s2 = 0;
 3664|  5.19k|		}
 3665|  22.0k|	if (k >= 0) {
  ------------------
  |  Branch (3665:6): [True: 22.0k, False: 0]
  ------------------
 3666|  22.0k|		b5 = 0;
 3667|  22.0k|		s5 = k;
 3668|  22.0k|		s2 += k;
 3669|  22.0k|		}
 3670|      0|	else {
 3671|      0|		b2 -= k;
 3672|      0|		b5 = -k;
 3673|      0|		s5 = 0;
 3674|      0|		}
 3675|  22.0k|	if (mode < 0 || mode > 9)
  ------------------
  |  Branch (3675:6): [True: 0, False: 22.0k]
  |  Branch (3675:18): [True: 0, False: 22.0k]
  ------------------
 3676|      0|		mode = 0;
 3677|       |
 3678|  22.0k|#ifndef SET_INEXACT
 3679|       |#ifdef Check_FLT_ROUNDS
 3680|       |	try_quick = Rounding == 1;
 3681|       |#else
 3682|  22.0k|	try_quick = 1;
 3683|  22.0k|#endif
 3684|  22.0k|#endif /*SET_INEXACT*/
 3685|       |
 3686|  22.0k|	if (mode > 5) {
  ------------------
  |  Branch (3686:6): [True: 0, False: 22.0k]
  ------------------
 3687|      0|		mode -= 4;
 3688|      0|		try_quick = 0;
 3689|      0|		}
 3690|  22.0k|	leftright = 1;
 3691|  22.0k|	ilim = ilim1 = -1;	/* Values for cases 0 and 1; done here to */
 3692|       |				/* silence erroneous "gcc -Wall" warning. */
 3693|  22.0k|	switch(mode) {
  ------------------
  |  Branch (3693:9): [True: 22.0k, False: 0]
  ------------------
 3694|  22.0k|		case 0:
  ------------------
  |  Branch (3694:3): [True: 22.0k, False: 0]
  ------------------
 3695|  22.0k|		case 1:
  ------------------
  |  Branch (3695:3): [True: 0, False: 22.0k]
  ------------------
 3696|  22.0k|			i = 18;
 3697|  22.0k|			ndigits = 0;
 3698|  22.0k|			break;
 3699|      0|		case 2:
  ------------------
  |  Branch (3699:3): [True: 0, False: 22.0k]
  ------------------
 3700|      0|			leftright = 0;
 3701|       |			/* no break */
 3702|      0|			JQ_FALLTHROUGH;
  ------------------
  |  |   14|      0|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 3703|      0|		case 4:
  ------------------
  |  Branch (3703:3): [True: 0, False: 22.0k]
  ------------------
 3704|      0|			if (ndigits <= 0)
  ------------------
  |  Branch (3704:8): [True: 0, False: 0]
  ------------------
 3705|      0|				ndigits = 1;
 3706|      0|			ilim = ilim1 = i = ndigits;
 3707|      0|			break;
 3708|      0|		case 3:
  ------------------
  |  Branch (3708:3): [True: 0, False: 22.0k]
  ------------------
 3709|      0|			leftright = 0;
 3710|       |			/* no break */
 3711|      0|			JQ_FALLTHROUGH;
  ------------------
  |  |   14|      0|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 3712|      0|		case 5:
  ------------------
  |  Branch (3712:3): [True: 0, False: 22.0k]
  ------------------
 3713|      0|			i = ndigits + k + 1;
 3714|      0|			ilim = i;
 3715|      0|			ilim1 = i - 1;
 3716|      0|			if (i <= 0)
  ------------------
  |  Branch (3716:8): [True: 0, False: 0]
  ------------------
 3717|      0|				i = 1;
 3718|  22.0k|		}
 3719|  22.0k|	s = s0 = rv_alloc(C, i);
 3720|       |
 3721|       |#ifdef Honor_FLT_ROUNDS
 3722|       |	if (mode > 1 && Rounding != 1)
 3723|       |		leftright = 0;
 3724|       |#endif
 3725|       |
 3726|  22.0k|	if (ilim >= 0 && ilim <= Quick_max && try_quick) {
  ------------------
  |  |  369|  22.0k|#define Quick_max 14
  ------------------
  |  Branch (3726:6): [True: 0, False: 22.0k]
  |  Branch (3726:19): [True: 0, False: 0]
  |  Branch (3726:40): [True: 0, False: 0]
  ------------------
 3727|       |
 3728|       |		/* Try to get by with floating-point arithmetic. */
 3729|       |
 3730|      0|		i = 0;
 3731|      0|		dval(&d2) = dval(&u);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              		dval(&d2) = dval(&u);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3732|      0|		k0 = k;
 3733|      0|		ilim0 = ilim;
 3734|      0|		ieps = 2; /* conservative */
 3735|      0|		if (k > 0) {
  ------------------
  |  Branch (3735:7): [True: 0, False: 0]
  ------------------
 3736|      0|			ds = tens[k&0xf];
 3737|      0|			j = k >> 4;
 3738|      0|			if (j & Bletch) {
  ------------------
  |  |  361|      0|#define Bletch 0x10
  ------------------
  |  Branch (3738:8): [True: 0, False: 0]
  ------------------
 3739|       |				/* prevent overflows */
 3740|      0|				j &= Bletch - 1;
  ------------------
  |  |  361|      0|#define Bletch 0x10
  ------------------
 3741|      0|				dval(&u) /= bigtens[n_bigtens-1];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              				dval(&u) /= bigtens[n_bigtens-1];
  ------------------
  |  | 1375|      0|#define n_bigtens 5
  ------------------
 3742|      0|				ieps++;
 3743|      0|				}
 3744|      0|			for(; j; j >>= 1, i++)
  ------------------
  |  Branch (3744:10): [True: 0, False: 0]
  ------------------
 3745|      0|				if (j & 1) {
  ------------------
  |  Branch (3745:9): [True: 0, False: 0]
  ------------------
 3746|      0|					ieps++;
 3747|      0|					ds *= bigtens[i];
 3748|      0|					}
 3749|      0|			dval(&u) /= ds;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3750|      0|			}
 3751|      0|		else if ((j1 = -k)) {
  ------------------
  |  Branch (3751:12): [True: 0, False: 0]
  ------------------
 3752|      0|			dval(&u) *= tens[j1 & 0xf];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3753|      0|			for(j = j1 >> 4; j; j >>= 1, i++)
  ------------------
  |  Branch (3753:21): [True: 0, False: 0]
  ------------------
 3754|      0|				if (j & 1) {
  ------------------
  |  Branch (3754:9): [True: 0, False: 0]
  ------------------
 3755|      0|					ieps++;
 3756|      0|					dval(&u) *= bigtens[i];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3757|      0|					}
 3758|      0|			}
 3759|      0|		if (k_check && dval(&u) < 1. && ilim > 0) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3759:7): [True: 0, False: 0]
  |  Branch (3759:18): [True: 0, False: 0]
  |  Branch (3759:35): [True: 0, False: 0]
  ------------------
 3760|      0|			if (ilim1 <= 0)
  ------------------
  |  Branch (3760:8): [True: 0, False: 0]
  ------------------
 3761|      0|				goto fast_failed;
 3762|      0|			ilim = ilim1;
 3763|      0|			k--;
 3764|      0|			dval(&u) *= 10.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3765|      0|			ieps++;
 3766|      0|			}
 3767|      0|		dval(&eps) = ieps*dval(&u) + 7.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              		dval(&eps) = ieps*dval(&u) + 7.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3768|      0|		word0(&eps) -= (P-1)*Exp_msk1;
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		word0(&eps) -= (P-1)*Exp_msk1;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
              		word0(&eps) -= (P-1)*Exp_msk1;
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
 3769|      0|		if (ilim == 0) {
  ------------------
  |  Branch (3769:7): [True: 0, False: 0]
  ------------------
 3770|      0|			S = mhi = 0;
 3771|      0|			dval(&u) -= 5.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3772|      0|			if (dval(&u) > dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              			if (dval(&u) > dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3772:8): [True: 0, False: 0]
  ------------------
 3773|      0|				goto one_digit;
 3774|      0|			if (dval(&u) < -dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              			if (dval(&u) < -dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3774:8): [True: 0, False: 0]
  ------------------
 3775|      0|				goto no_digits;
 3776|      0|			goto fast_failed;
 3777|      0|			}
 3778|      0|#ifndef No_leftright
 3779|      0|		if (leftright) {
  ------------------
  |  Branch (3779:7): [True: 0, False: 0]
  ------------------
 3780|       |			/* Use Steele & White method of only
 3781|       |			 * generating digits needed.
 3782|       |			 */
 3783|      0|			dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              			dval(&eps) = 0.5/tens[ilim-1] - dval(&eps);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3784|      0|#ifdef IEEE_Arith
 3785|      0|			if (k0 < 0 && j1 >= 307) {
  ------------------
  |  Branch (3785:8): [True: 0, False: 0]
  |  Branch (3785:18): [True: 0, False: 0]
  ------------------
 3786|      0|				eps1.d = 1.01e256; /* 1.01 allows roundoff in the next few lines */
 3787|      0|				word0(&eps1) -= Exp_msk1 * (Bias+P-1);
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              				word0(&eps1) -= Exp_msk1 * (Bias+P-1);
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
              				word0(&eps1) -= Exp_msk1 * (Bias+P-1);
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              				word0(&eps1) -= Exp_msk1 * (Bias+P-1);
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 3788|      0|				dval(&eps1) *= tens[j1 & 0xf];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3789|      0|				for(i = 0, j = (j1-256) >> 4; j; j >>= 1, i++)
  ------------------
  |  Branch (3789:35): [True: 0, False: 0]
  ------------------
 3790|      0|					if (j & 1)
  ------------------
  |  Branch (3790:10): [True: 0, False: 0]
  ------------------
 3791|      0|						dval(&eps1) *= bigtens[i];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3792|      0|				if (eps.d < eps1.d)
  ------------------
  |  Branch (3792:9): [True: 0, False: 0]
  ------------------
 3793|      0|					eps.d = eps1.d;
 3794|      0|				}
 3795|      0|#endif
 3796|      0|			for(i = 0;;) {
 3797|      0|				L = dval(&u);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3798|      0|				dval(&u) -= L;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3799|      0|				*s++ = '0' + (int)L;
 3800|      0|				if (1. - dval(&u) < dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              				if (1. - dval(&u) < dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3800:9): [True: 0, False: 0]
  ------------------
 3801|      0|					goto bump_up;
 3802|      0|				if (dval(&u) < dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              				if (dval(&u) < dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3802:9): [True: 0, False: 0]
  ------------------
 3803|      0|					goto ret1;
 3804|      0|				if (++i >= ilim)
  ------------------
  |  Branch (3804:9): [True: 0, False: 0]
  ------------------
 3805|      0|					break;
 3806|      0|				dval(&eps) *= 10.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3807|      0|				dval(&u) *= 10.;
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3808|      0|				}
 3809|      0|			}
 3810|      0|		else {
 3811|      0|#endif
 3812|       |			/* Generate ilim digits, then fix them up. */
 3813|      0|			dval(&eps) *= tens[ilim-1];
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3814|      0|			for(i = 1;; i++, dval(&u) *= 10.) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3815|      0|				L = (Long)(dval(&u));
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3816|      0|				if (!(dval(&u) -= L))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3816:9): [True: 0, False: 0]
  ------------------
 3817|      0|					ilim = i;
 3818|      0|				*s++ = '0' + (int)L;
 3819|      0|				if (i == ilim) {
  ------------------
  |  Branch (3819:9): [True: 0, False: 0]
  ------------------
 3820|      0|					if (dval(&u) > 0.5 + dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              					if (dval(&u) > 0.5 + dval(&eps))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3820:10): [True: 0, False: 0]
  ------------------
 3821|      0|						goto bump_up;
 3822|      0|					else if (dval(&u) < 0.5 - dval(&eps)) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              					else if (dval(&u) < 0.5 - dval(&eps)) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3822:15): [True: 0, False: 0]
  ------------------
 3823|      0|						while(*--s == '0');
  ------------------
  |  Branch (3823:13): [True: 0, False: 0]
  ------------------
 3824|      0|						s++;
 3825|      0|						goto ret1;
 3826|      0|						}
 3827|      0|					break;
 3828|      0|					}
 3829|      0|				}
 3830|      0|#ifndef No_leftright
 3831|      0|			}
 3832|      0|#endif
 3833|      0| fast_failed:
 3834|      0|		s = s0;
 3835|      0|		dval(&u) = dval(&d2);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              		dval(&u) = dval(&d2);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3836|      0|		k = k0;
 3837|      0|		ilim = ilim0;
 3838|      0|		}
 3839|       |
 3840|       |	/* Do we have a "small" integer? */
 3841|       |
 3842|  22.0k|	if (be >= 0 && k <= Int_max) {
  ------------------
  |  |  370|  22.0k|#define Int_max 14
  ------------------
  |  Branch (3842:6): [True: 22.0k, False: 0]
  |  Branch (3842:17): [True: 16.8k, False: 5.19k]
  ------------------
 3843|       |		/* Yes. */
 3844|  16.8k|		ds = tens[k];
 3845|  16.8k|		if (ndigits < 0 && ilim <= 0) {
  ------------------
  |  Branch (3845:7): [True: 0, False: 16.8k]
  |  Branch (3845:22): [True: 0, False: 0]
  ------------------
 3846|      0|			S = mhi = 0;
 3847|      0|			if (ilim < 0 || dval(&u) <= 5*ds)
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3847:8): [True: 0, False: 0]
  |  Branch (3847:20): [True: 0, False: 0]
  ------------------
 3848|      0|				goto no_digits;
 3849|      0|			goto one_digit;
 3850|      0|			}
 3851|  16.8k|		for(i = 1;; i++, dval(&u) *= 10.) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3852|  16.8k|			L = (Long)(dval(&u) / ds);
  ------------------
  |  |  314|  16.8k|#define dval(x) (x)->d
  ------------------
 3853|  16.8k|			dval(&u) -= L*ds;
  ------------------
  |  |  314|  16.8k|#define dval(x) (x)->d
  ------------------
 3854|       |#ifdef Check_FLT_ROUNDS
 3855|       |			/* If FLT_ROUNDS == 2, L will usually be high by 1 */
 3856|       |			if (dval(&u) < 0) {
 3857|       |				L--;
 3858|       |				dval(&u) += ds;
 3859|       |				}
 3860|       |#endif
 3861|  16.8k|			*s++ = '0' + (int)L;
 3862|  16.8k|			if (!dval(&u)) {
  ------------------
  |  |  314|  16.8k|#define dval(x) (x)->d
  ------------------
  |  Branch (3862:8): [True: 16.8k, False: 0]
  ------------------
 3863|       |#ifdef SET_INEXACT
 3864|       |				inexact = 0;
 3865|       |#endif
 3866|  16.8k|				break;
 3867|  16.8k|				}
 3868|      0|			if (i == ilim) {
  ------------------
  |  Branch (3868:8): [True: 0, False: 0]
  ------------------
 3869|       |#ifdef Honor_FLT_ROUNDS
 3870|       |				if (mode > 1)
 3871|       |				switch(Rounding) {
 3872|       |				  case 0: goto ret1;
 3873|       |				  case 2: goto bump_up;
 3874|       |				  }
 3875|       |#endif
 3876|      0|				dval(&u) += dval(&u);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              				dval(&u) += dval(&u);
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3877|       |#ifdef ROUND_BIASED
 3878|       |				if (dval(&u) >= ds)
 3879|       |#else
 3880|      0|				if (dval(&u) > ds || (dval(&u) == ds && L & 1))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
              				if (dval(&u) > ds || (dval(&u) == ds && L & 1))
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
  |  Branch (3880:9): [True: 0, False: 0]
  |  Branch (3880:27): [True: 0, False: 0]
  |  Branch (3880:45): [True: 0, False: 0]
  ------------------
 3881|      0|#endif
 3882|      0|					{
 3883|      0| bump_up:
 3884|      0|					while(*--s == '9')
  ------------------
  |  Branch (3884:12): [True: 0, False: 0]
  ------------------
 3885|      0|						if (s == s0) {
  ------------------
  |  Branch (3885:11): [True: 0, False: 0]
  ------------------
 3886|      0|							k++;
 3887|      0|							*s = '0';
 3888|      0|							break;
 3889|      0|							}
 3890|      0|					++*s++;
 3891|      0|					}
 3892|      0|				break;
 3893|      0|				}
 3894|      0|			}
 3895|  16.8k|		goto ret1;
 3896|  16.8k|		}
 3897|       |
 3898|  5.19k|	m2 = b2;
 3899|  5.19k|	m5 = b5;
 3900|  5.19k|	mhi = mlo = 0;
 3901|  5.19k|	if (leftright) {
  ------------------
  |  Branch (3901:6): [True: 5.19k, False: 0]
  ------------------
 3902|  5.19k|		i =
 3903|  5.19k|#ifndef Sudden_Underflow
 3904|  5.19k|			denorm ? be + (Bias + (P-1) - 1 + 1) :
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              			denorm ? be + (Bias + (P-1) - 1 + 1) :
  ------------------
  |  |  350|      0|#define P 53
  ------------------
  |  Branch (3904:4): [True: 0, False: 5.19k]
  ------------------
 3905|  5.19k|#endif
 3906|       |#ifdef IBM
 3907|       |			1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3);
 3908|       |#else
 3909|  5.19k|			1 + P - bbits;
  ------------------
  |  |  350|  5.19k|#define P 53
  ------------------
 3910|  5.19k|#endif
 3911|  5.19k|		b2 += i;
 3912|  5.19k|		s2 += i;
 3913|  5.19k|		mhi = i2b(C, 1);
 3914|  5.19k|		}
 3915|  5.19k|	if (m2 > 0 && s2 > 0) {
  ------------------
  |  Branch (3915:6): [True: 5.19k, False: 0]
  |  Branch (3915:16): [True: 5.19k, False: 0]
  ------------------
 3916|  5.19k|		i = m2 < s2 ? m2 : s2;
  ------------------
  |  Branch (3916:7): [True: 0, False: 5.19k]
  ------------------
 3917|  5.19k|		b2 -= i;
 3918|  5.19k|		m2 -= i;
 3919|  5.19k|		s2 -= i;
 3920|  5.19k|		}
 3921|  5.19k|	if (b5 > 0) {
  ------------------
  |  Branch (3921:6): [True: 0, False: 5.19k]
  ------------------
 3922|      0|		if (leftright) {
  ------------------
  |  Branch (3922:7): [True: 0, False: 0]
  ------------------
 3923|      0|			if (m5 > 0) {
  ------------------
  |  Branch (3923:8): [True: 0, False: 0]
  ------------------
 3924|      0|				mhi = pow5mult(C, mhi, m5);
 3925|      0|				b1 = mult(C, mhi, b);
 3926|      0|				Bfree(C, b);
 3927|      0|				b = b1;
 3928|      0|				}
 3929|      0|			if ((j = b5 - m5))
  ------------------
  |  Branch (3929:8): [True: 0, False: 0]
  ------------------
 3930|      0|				b = pow5mult(C, b, j);
 3931|      0|			}
 3932|      0|		else
 3933|      0|			b = pow5mult(C, b, b5);
 3934|      0|		}
 3935|  5.19k|	S = i2b(C, 1);
 3936|  5.19k|	if (s5 > 0)
  ------------------
  |  Branch (3936:6): [True: 5.19k, False: 0]
  ------------------
 3937|  5.19k|		S = pow5mult(C, S, s5);
 3938|       |
 3939|       |	/* Check for special case that d is a normalized power of 2. */
 3940|       |
 3941|  5.19k|	spec_case = 0;
 3942|  5.19k|	if ((mode < 2 || leftright)
  ------------------
  |  Branch (3942:7): [True: 5.19k, False: 0]
  |  Branch (3942:19): [True: 0, False: 0]
  ------------------
 3943|       |#ifdef Honor_FLT_ROUNDS
 3944|       |			&& Rounding == 1
 3945|       |#endif
 3946|  5.19k|				) {
 3947|  5.19k|		if (!word1(&u) && !(word0(&u) & Bndry_mask)
  ------------------
  |  |  309|  10.3k|#define word1(x) (x)->L[0]
  ------------------
              		if (!word1(&u) && !(word0(&u) & Bndry_mask)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		if (!word1(&u) && !(word0(&u) & Bndry_mask)
  ------------------
  |  |  362|      0|#define Bndry_mask  0xfffff
  ------------------
  |  Branch (3947:7): [True: 0, False: 5.19k]
  |  Branch (3947:21): [True: 0, False: 0]
  ------------------
 3948|      0|#ifndef Sudden_Underflow
 3949|      0|		 && word0(&u) & (Exp_mask & ~Exp_msk1)
  ------------------
  |  |  308|      0|#define word0(x) (x)->L[1]
  ------------------
              		 && word0(&u) & (Exp_mask & ~Exp_msk1)
  ------------------
  |  |  349|      0|#define Exp_mask  0x7ff00000
  ------------------
              		 && word0(&u) & (Exp_mask & ~Exp_msk1)
  ------------------
  |  |  347|      0|#define Exp_msk1    0x100000
  ------------------
  |  Branch (3949:7): [True: 0, False: 0]
  ------------------
 3950|  5.19k|#endif
 3951|  5.19k|				) {
 3952|       |			/* The special case */
 3953|      0|			b2 += Log2P;
  ------------------
  |  |  366|      0|#define Log2P 1
  ------------------
 3954|      0|			s2 += Log2P;
  ------------------
  |  |  366|      0|#define Log2P 1
  ------------------
 3955|      0|			spec_case = 1;
 3956|      0|			}
 3957|  5.19k|		}
 3958|       |
 3959|       |	/* Arrange for convenient computation of quotients:
 3960|       |	 * shift left if necessary so divisor has 4 leading 0 bits.
 3961|       |	 *
 3962|       |	 * Perhaps we should just compute leading 28 bits of S once
 3963|       |	 * and for all and pass them and a shift to quorem, so it
 3964|       |	 * can do shifts and ors to compute the numerator for q.
 3965|       |	 */
 3966|  5.19k|	i = dshift(C, S, s2);
 3967|  5.19k|	b2 += i;
 3968|  5.19k|	m2 += i;
 3969|  5.19k|	s2 += i;
 3970|  5.19k|	if (b2 > 0)
  ------------------
  |  Branch (3970:6): [True: 5.19k, False: 0]
  ------------------
 3971|  5.19k|		b = lshift(C, b, b2);
 3972|  5.19k|	if (s2 > 0)
  ------------------
  |  Branch (3972:6): [True: 5.19k, False: 0]
  ------------------
 3973|  5.19k|		S = lshift(C, S, s2);
 3974|  5.19k|	if (k_check) {
  ------------------
  |  Branch (3974:6): [True: 5.19k, False: 0]
  ------------------
 3975|  5.19k|		if (cmp(C, b,S) < 0) {
  ------------------
  |  Branch (3975:7): [True: 0, False: 5.19k]
  ------------------
 3976|      0|			k--;
 3977|      0|			b = multadd(C, b, 10, 0);	/* we botched the k estimate */
 3978|      0|			if (leftright)
  ------------------
  |  Branch (3978:8): [True: 0, False: 0]
  ------------------
 3979|      0|				mhi = multadd(C, mhi, 10, 0);
 3980|      0|			ilim = ilim1;
 3981|      0|			}
 3982|  5.19k|		}
 3983|  5.19k|	if (ilim <= 0 && (mode == 3 || mode == 5)) {
  ------------------
  |  Branch (3983:6): [True: 5.19k, False: 0]
  |  Branch (3983:20): [True: 0, False: 5.19k]
  |  Branch (3983:33): [True: 0, False: 5.19k]
  ------------------
 3984|      0|		if (ilim < 0 || cmp(C, b,S = multadd(C, S,5,0)) <= 0) {
  ------------------
  |  Branch (3984:7): [True: 0, False: 0]
  |  Branch (3984:19): [True: 0, False: 0]
  ------------------
 3985|       |			/* no digits, fcvt style */
 3986|      0| no_digits:
 3987|      0|			k = -1 - ndigits;
 3988|      0|			goto ret;
 3989|      0|			}
 3990|      0| one_digit:
 3991|      0|		*s++ = '1';
 3992|      0|		k++;
 3993|      0|		goto ret;
 3994|      0|		}
 3995|  5.19k|	if (leftright) {
  ------------------
  |  Branch (3995:6): [True: 5.19k, False: 0]
  ------------------
 3996|  5.19k|		if (m2 > 0)
  ------------------
  |  Branch (3996:7): [True: 5.19k, False: 0]
  ------------------
 3997|  5.19k|			mhi = lshift(C, mhi, m2);
 3998|       |
 3999|       |		/* Compute mlo -- check for special case
 4000|       |		 * that d is a normalized power of 2.
 4001|       |		 */
 4002|       |
 4003|  5.19k|		mlo = mhi;
 4004|  5.19k|		if (spec_case) {
  ------------------
  |  Branch (4004:7): [True: 0, False: 5.19k]
  ------------------
 4005|      0|			mhi = Balloc(C, mhi->k);
 4006|      0|			Bcopy(mhi, mlo);
  ------------------
  |  |  586|      0|#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
  |  |  587|      0|y->wds*sizeof(Long) + 2*sizeof(int))
  ------------------
 4007|      0|			mhi = lshift(C, mhi, Log2P);
  ------------------
  |  |  366|      0|#define Log2P 1
  ------------------
 4008|      0|			}
 4009|       |
 4010|  88.3k|		for(i = 1;;i++) {
 4011|  88.3k|			dig = quorem(C, b,S) + '0';
 4012|       |			/* Do we yet have the shortest decimal string
 4013|       |			 * that will round to d?
 4014|       |			 */
 4015|  88.3k|			j = cmp(C, b, mlo);
 4016|  88.3k|			delta = diff(C, S, mhi);
 4017|  88.3k|			j1 = delta->sign ? 1 : cmp(C, b, delta);
  ------------------
  |  Branch (4017:9): [True: 0, False: 88.3k]
  ------------------
 4018|  88.3k|			Bfree(C, delta);
 4019|  88.3k|#ifndef ROUND_BIASED
 4020|  88.3k|			if (j1 == 0 && mode != 1 && !(word1(&u) & 1)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (4020:8): [True: 0, False: 88.3k]
  |  Branch (4020:19): [True: 0, False: 0]
  |  Branch (4020:32): [True: 0, False: 0]
  ------------------
 4021|       |#ifdef Honor_FLT_ROUNDS
 4022|       |				&& Rounding >= 1
 4023|       |#endif
 4024|  88.3k|								   ) {
 4025|      0|				if (dig == '9')
  ------------------
  |  Branch (4025:9): [True: 0, False: 0]
  ------------------
 4026|      0|					goto round_9_up;
 4027|      0|				if (j > 0)
  ------------------
  |  Branch (4027:9): [True: 0, False: 0]
  ------------------
 4028|      0|					dig++;
 4029|       |#ifdef SET_INEXACT
 4030|       |				else if (!b->x[0] && b->wds <= 1)
 4031|       |					inexact = 0;
 4032|       |#endif
 4033|      0|				*s++ = dig;
 4034|      0|				goto ret;
 4035|      0|				}
 4036|  88.3k|#endif
 4037|  88.3k|			if (j < 0 || (j == 0 && mode != 1
  ------------------
  |  Branch (4037:8): [True: 5.19k, False: 83.1k]
  |  Branch (4037:18): [True: 0, False: 83.1k]
  |  Branch (4037:28): [True: 0, False: 0]
  ------------------
 4038|      0|#ifndef ROUND_BIASED
 4039|      0|							&& !(word1(&u) & 1)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (4039:11): [True: 0, False: 0]
  ------------------
 4040|  83.1k|#endif
 4041|  83.1k|					)) {
 4042|  5.19k|				if (!b->x[0] && b->wds <= 1) {
  ------------------
  |  Branch (4042:9): [True: 0, False: 5.19k]
  |  Branch (4042:21): [True: 0, False: 0]
  ------------------
 4043|       |#ifdef SET_INEXACT
 4044|       |					inexact = 0;
 4045|       |#endif
 4046|      0|					goto accept_dig;
 4047|      0|					}
 4048|       |#ifdef Honor_FLT_ROUNDS
 4049|       |				if (mode > 1)
 4050|       |				 switch(Rounding) {
 4051|       |				  case 0: goto accept_dig;
 4052|       |				  case 2: goto keep_dig;
 4053|       |				  }
 4054|       |#endif /*Honor_FLT_ROUNDS*/
 4055|  5.19k|				if (j1 > 0) {
  ------------------
  |  Branch (4055:9): [True: 5.19k, False: 0]
  ------------------
 4056|  5.19k|					b = lshift(C, b, 1);
 4057|  5.19k|					j1 = cmp(C, b, S);
 4058|       |#ifdef ROUND_BIASED
 4059|       |					if (j1 >= 0 /*)*/
 4060|       |#else
 4061|  5.19k|					if ((j1 > 0 || (j1 == 0 && dig & 1))
  ------------------
  |  Branch (4061:11): [True: 0, False: 5.19k]
  |  Branch (4061:22): [True: 0, False: 5.19k]
  |  Branch (4061:33): [True: 0, False: 0]
  ------------------
 4062|      0|#endif
 4063|      0|					&& dig++ == '9')
  ------------------
  |  Branch (4063:9): [True: 0, False: 0]
  ------------------
 4064|      0|						goto round_9_up;
 4065|  5.19k|					}
 4066|  5.19k| accept_dig:
 4067|  5.19k|				*s++ = dig;
 4068|  5.19k|				goto ret;
 4069|  5.19k|				}
 4070|  83.1k|			if (j1 > 0) {
  ------------------
  |  Branch (4070:8): [True: 0, False: 83.1k]
  ------------------
 4071|       |#ifdef Honor_FLT_ROUNDS
 4072|       |				if (!Rounding)
 4073|       |					goto accept_dig;
 4074|       |#endif
 4075|      0|				if (dig == '9') { /* possible if i == 1 */
  ------------------
  |  Branch (4075:9): [True: 0, False: 0]
  ------------------
 4076|      0| round_9_up:
 4077|      0|					*s++ = '9';
 4078|      0|					goto roundoff;
 4079|      0|					}
 4080|      0|				*s++ = dig + 1;
 4081|      0|				goto ret;
 4082|      0|				}
 4083|       |#ifdef Honor_FLT_ROUNDS
 4084|       | keep_dig:
 4085|       |#endif
 4086|  83.1k|			*s++ = dig;
 4087|  83.1k|			if (i == ilim)
  ------------------
  |  Branch (4087:8): [True: 0, False: 83.1k]
  ------------------
 4088|      0|				break;
 4089|  83.1k|			b = multadd(C, b, 10, 0);
 4090|  83.1k|			if (mlo == mhi)
  ------------------
  |  Branch (4090:8): [True: 83.1k, False: 0]
  ------------------
 4091|  83.1k|				mlo = mhi = multadd(C, mhi, 10, 0);
 4092|      0|			else {
 4093|      0|				mlo = multadd(C, mlo, 10, 0);
 4094|      0|				mhi = multadd(C, mhi, 10, 0);
 4095|      0|				}
 4096|  83.1k|			}
 4097|  5.19k|		}
 4098|      0|	else
 4099|      0|		for(i = 1;; i++) {
 4100|      0|			*s++ = dig = quorem(C, b,S) + '0';
 4101|      0|			if (!b->x[0] && b->wds <= 1) {
  ------------------
  |  Branch (4101:8): [True: 0, False: 0]
  |  Branch (4101:20): [True: 0, False: 0]
  ------------------
 4102|       |#ifdef SET_INEXACT
 4103|       |				inexact = 0;
 4104|       |#endif
 4105|      0|				goto ret;
 4106|      0|				}
 4107|      0|			if (i >= ilim)
  ------------------
  |  Branch (4107:8): [True: 0, False: 0]
  ------------------
 4108|      0|				break;
 4109|      0|			b = multadd(C, b, 10, 0);
 4110|      0|			}
 4111|       |
 4112|       |	/* Round off last digit */
 4113|       |
 4114|       |#ifdef Honor_FLT_ROUNDS
 4115|       |	switch(Rounding) {
 4116|       |	  case 0: goto trimzeros;
 4117|       |	  case 2: goto roundoff;
 4118|       |	  }
 4119|       |#endif
 4120|      0|	b = lshift(C, b, 1);
 4121|      0|	j = cmp(C, b, S);
 4122|       |#ifdef ROUND_BIASED
 4123|       |	if (j >= 0)
 4124|       |#else
 4125|      0|	if (j > 0 || (j == 0 && dig & 1))
  ------------------
  |  Branch (4125:6): [True: 0, False: 0]
  |  Branch (4125:16): [True: 0, False: 0]
  |  Branch (4125:26): [True: 0, False: 0]
  ------------------
 4126|      0|#endif
 4127|      0|		{
 4128|      0| roundoff:
 4129|      0|		while(*--s == '9')
  ------------------
  |  Branch (4129:9): [True: 0, False: 0]
  ------------------
 4130|      0|			if (s == s0) {
  ------------------
  |  Branch (4130:8): [True: 0, False: 0]
  ------------------
 4131|      0|				k++;
 4132|      0|				*s++ = '1';
 4133|      0|				goto ret;
 4134|      0|				}
 4135|      0|		++*s++;
 4136|      0|		}
 4137|      0|	else {
 4138|       |#ifdef Honor_FLT_ROUNDS
 4139|       | trimzeros:
 4140|       |#endif
 4141|      0|		while(*--s == '0');
  ------------------
  |  Branch (4141:9): [True: 0, False: 0]
  ------------------
 4142|      0|		s++;
 4143|      0|		}
 4144|  5.19k| ret:
 4145|  5.19k|	Bfree(C, S);
 4146|  5.19k|	if (mhi) {
  ------------------
  |  Branch (4146:6): [True: 5.19k, False: 0]
  ------------------
 4147|  5.19k|		if (mlo && mlo != mhi)
  ------------------
  |  Branch (4147:7): [True: 5.19k, False: 0]
  |  Branch (4147:14): [True: 0, False: 5.19k]
  ------------------
 4148|      0|			Bfree(C, mlo);
 4149|  5.19k|		Bfree(C, mhi);
 4150|  5.19k|		}
 4151|  22.0k| ret1:
 4152|       |#ifdef SET_INEXACT
 4153|       |	if (inexact) {
 4154|       |		if (!oldinexact) {
 4155|       |			word0(&u) = Exp_1 + (70 << Exp_shift);
 4156|       |			word1(&u) = 0;
 4157|       |			dval(&u) += 1.;
 4158|       |			}
 4159|       |		}
 4160|       |	else if (!oldinexact)
 4161|       |		clear_inexact();
 4162|       |#endif
 4163|  22.0k|	Bfree(C, b);
 4164|  22.0k|	*s = 0;
 4165|  22.0k|	*decpt = k + 1;
 4166|  22.0k|	if (rve)
  ------------------
  |  Branch (4166:6): [True: 22.0k, False: 0]
  ------------------
 4167|  22.0k|		*rve = s;
 4168|  22.0k|	return s0;
 4169|  5.19k|	}
jvp_dtoa_fmt:
 4207|  7.02M|{
 4208|  7.02M|	register int i, k;
 4209|  7.02M|	register char *s;
 4210|  7.02M|	int decpt, j, sign;
 4211|  7.02M|	char *b0, *s0, *se;
 4212|       |
 4213|  7.02M|	b0 = b;
 4214|       |#ifdef IGNORE_ZERO_SIGN
 4215|       |	if (!x) {
 4216|       |		*b++ = '0';
 4217|       |		*b = 0;
 4218|       |		goto done;
 4219|       |		}
 4220|       |#endif
 4221|  7.02M|	s = s0 = jvp_dtoa(C, x, 0, 0, &decpt, &sign, &se);
 4222|  7.02M|	if (sign)
  ------------------
  |  Branch (4222:6): [True: 204, False: 7.02M]
  ------------------
 4223|    204|		*b++ = '-';
 4224|  7.02M|	if (decpt == 9999) /* Infinity or Nan */ {
  ------------------
  |  Branch (4224:6): [True: 0, False: 7.02M]
  ------------------
 4225|      0|		while((*b++ = *s++));
  ------------------
  |  Branch (4225:9): [True: 0, False: 0]
  ------------------
 4226|      0|		goto done0;
 4227|      0|		}
 4228|  7.02M|	if (decpt <= -4 || decpt > se - s + 15) {
  ------------------
  |  Branch (4228:6): [True: 0, False: 7.02M]
  |  Branch (4228:21): [True: 5.19k, False: 7.01M]
  ------------------
 4229|  5.19k|		*b++ = *s++;
 4230|  5.19k|		if (*s) {
  ------------------
  |  Branch (4230:7): [True: 5.19k, False: 0]
  ------------------
 4231|  5.19k|			*b++ = '.';
 4232|  88.3k|			while((*b = *s++))
  ------------------
  |  Branch (4232:10): [True: 83.1k, False: 5.19k]
  ------------------
 4233|  83.1k|				b++;
 4234|  5.19k|			}
 4235|  5.19k|		*b++ = 'e';
 4236|       |		/* sprintf(b, "%+.2d", decpt - 1); */
 4237|  5.19k|		if (--decpt < 0) {
  ------------------
  |  Branch (4237:7): [True: 0, False: 5.19k]
  ------------------
 4238|      0|			*b++ = '-';
 4239|      0|			decpt = -decpt;
 4240|      0|			}
 4241|  5.19k|		else
 4242|  5.19k|			*b++ = '+';
 4243|  10.3k|		for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10);
  ------------------
  |  Branch (4243:22): [True: 5.19k, False: 5.19k]
  ------------------
 4244|  15.5k|		for(;;) {
 4245|  15.5k|			i = decpt / k;
 4246|  15.5k|			*b++ = i + '0';
 4247|  15.5k|			if (--j <= 0)
  ------------------
  |  Branch (4247:8): [True: 5.19k, False: 10.3k]
  ------------------
 4248|  5.19k|				break;
 4249|  10.3k|			decpt -= i*k;
 4250|  10.3k|			decpt *= 10;
 4251|  10.3k|			}
 4252|  5.19k|		*b = 0;
 4253|  5.19k|		}
 4254|  7.01M|	else if (decpt <= 0) {
  ------------------
  |  Branch (4254:11): [True: 0, False: 7.01M]
  ------------------
 4255|      0|		*b++ = '0';
 4256|      0|		*b++ = '.';
 4257|      0|		for(; decpt < 0; decpt++)
  ------------------
  |  Branch (4257:9): [True: 0, False: 0]
  ------------------
 4258|      0|			*b++ = '0';
 4259|      0|		while((*b++ = *s++));
  ------------------
  |  Branch (4259:9): [True: 0, False: 0]
  ------------------
 4260|      0|		}
 4261|  7.01M|	else {
 4262|  14.0M|		while((*b = *s++)) {
  ------------------
  |  Branch (4262:9): [True: 7.01M, False: 7.01M]
  ------------------
 4263|  7.01M|			b++;
 4264|  7.01M|			if (--decpt == 0 && *s)
  ------------------
  |  Branch (4264:8): [True: 7.01M, False: 0]
  |  Branch (4264:24): [True: 0, False: 7.01M]
  ------------------
 4265|      0|				*b++ = '.';
 4266|  7.01M|			}
 4267|  7.01M|		for(; decpt > 0; decpt--)
  ------------------
  |  Branch (4267:9): [True: 0, False: 7.01M]
  ------------------
 4268|      0|			*b++ = '0';
 4269|  7.01M|		*b = 0;
 4270|  7.01M|		}
 4271|  7.02M| done0:
 4272|  7.02M|	jvp_freedtoa(C, s0);
 4273|  7.02M|        goto done;
 4274|  7.02M| done:
 4275|  7.02M|	return b0;
 4276|  7.02M|	}
jv_dtoa.c:Bfree:
  553|  7.18M|{
  554|  7.18M|	if (v) {
  ------------------
  |  Branch (554:6): [True: 7.18M, False: 0]
  ------------------
  555|  7.18M|		if (v->k > Kmax)
  ------------------
  |  |    3|  7.18M|#define Kmax 7
  ------------------
  |  Branch (555:7): [True: 0, False: 7.18M]
  ------------------
  556|      0|#ifdef FREE
  557|      0|			FREE((void*)v);
  ------------------
  |  |  200|      0|#define FREE jv_mem_free
  ------------------
  558|       |#else
  559|       |			free((void*)v);
  560|       |#endif
  561|  7.18M|		else {
  562|  7.18M|			v->next = C->freelist[v->k];
  563|  7.18M|			C->freelist[v->k] = v;
  564|  7.18M|			}
  565|  7.18M|		}
  566|  7.18M|	}
jv_dtoa.c:match:
 1435|  10.3k|{
 1436|  10.3k|	int c, d;
 1437|  10.3k|	CONST char *s = *sp;
  ------------------
  |  |  298|  10.3k|#define CONST const
  ------------------
 1438|       |
 1439|  46.7k|	while((d = *t++)) {
  ------------------
  |  Branch (1439:8): [True: 36.3k, False: 10.3k]
  ------------------
 1440|  36.3k|		if ((c = *++s) >= 'A' && c <= 'Z')
  ------------------
  |  Branch (1440:7): [True: 36.3k, False: 0]
  |  Branch (1440:28): [True: 0, False: 36.3k]
  ------------------
 1441|      0|			c += 'a' - 'A';
 1442|  36.3k|		if (c != d)
  ------------------
  |  Branch (1442:7): [True: 0, False: 36.3k]
  ------------------
 1443|      0|			return 0;
 1444|  36.3k|		}
 1445|  10.3k|	*sp = s + 1;
 1446|  10.3k|	return 1;
 1447|  10.3k|	}
jv_dtoa.c:Balloc:
  532|  7.18M|{
  533|  7.18M|	int x;
  534|  7.18M|	Bigint *rv;
  535|       |
  536|       |	/* The k > Kmax case does not need ACQUIRE_DTOA_LOCK(0), */
  537|       |	/* but this case seems very unlikely. */
  538|  7.18M|	if (k <= Kmax && (rv = C->freelist[k]))
  ------------------
  |  |    3|  14.3M|#define Kmax 7
  ------------------
  |  Branch (538:6): [True: 7.18M, False: 0]
  |  Branch (538:19): [True: 7.18M, False: 18]
  ------------------
  539|  7.18M|		C->freelist[k] = rv->next;
  540|     18|	else {
  541|     18|		x = 1 << k;
  542|     18|		rv = (Bigint *)MALLOC(sizeof(Bigint) + (x-1)*sizeof(ULong));
  ------------------
  |  |  199|     18|#define MALLOC jv_mem_alloc
  ------------------
  543|     18|		rv->k = k;
  544|     18|		rv->maxwds = x;
  545|     18|		}
  546|  7.18M|	rv->sign = rv->wds = 0;
  547|  7.18M|	return rv;
  548|  7.18M|	}
jv_dtoa.c:d2b:
 1187|  22.0k|{
 1188|  22.0k|	Bigint *b;
 1189|  22.0k|	int de, k;
 1190|  22.0k|	ULong *x, y, z;
 1191|  22.0k|#ifndef Sudden_Underflow
 1192|  22.0k|	int i;
 1193|  22.0k|#endif
 1194|       |#ifdef VAX
 1195|       |	ULong d0, d1;
 1196|       |	d0 = word0(d) >> 16 | word0(d) << 16;
 1197|       |	d1 = word1(d) >> 16 | word1(d) << 16;
 1198|       |#else
 1199|  22.0k|#define d0 word0(d)
 1200|  22.0k|#define d1 word1(d)
 1201|  22.0k|#endif
 1202|       |
 1203|  22.0k|#ifdef Pack_32
 1204|  22.0k|	b = Balloc(C, 1);
 1205|       |#else
 1206|       |	b = Balloc(C, 2);
 1207|       |#endif
 1208|  22.0k|	x = b->x;
 1209|       |
 1210|  22.0k|	z = d0 & Frac_mask;
  ------------------
  |  | 1199|  22.0k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  |  |  ------------------
  ------------------
              	z = d0 & Frac_mask;
  ------------------
  |  |  358|  22.0k|#define Frac_mask  0xfffff
  ------------------
 1211|  22.0k|	d0 &= 0x7fffffff;	/* clear sign bit, which we ignore */
  ------------------
  |  | 1199|  22.0k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  |  |  ------------------
  ------------------
 1212|       |#ifdef Sudden_Underflow
 1213|       |	de = (int)(d0 >> Exp_shift);
 1214|       |#ifndef IBM
 1215|       |	z |= Exp_msk11;
 1216|       |#endif
 1217|       |#else
 1218|  22.0k|	if ((de = (int)(d0 >> Exp_shift)))
  ------------------
  |  | 1199|  22.0k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  22.0k|#define word0(x) (x)->L[1]
  |  |  ------------------
  ------------------
              	if ((de = (int)(d0 >> Exp_shift)))
  ------------------
  |  |  345|  22.0k|#define Exp_shift  20
  ------------------
  |  Branch (1218:6): [True: 22.0k, False: 0]
  ------------------
 1219|  22.0k|		z |= Exp_msk1;
  ------------------
  |  |  347|  22.0k|#define Exp_msk1    0x100000
  ------------------
 1220|  22.0k|#endif
 1221|  22.0k|#ifdef Pack_32
 1222|  22.0k|	if ((y = d1)) {
  ------------------
  |  | 1200|  22.0k|#define d1 word1(d)
  |  |  ------------------
  |  |  |  |  309|  22.0k|#define word1(x) (x)->L[0]
  |  |  ------------------
  ------------------
  |  Branch (1222:6): [True: 5.19k, False: 16.8k]
  ------------------
 1223|  5.19k|		if ((k = lo0bits(C, &y))) {
  ------------------
  |  Branch (1223:7): [True: 0, False: 5.19k]
  ------------------
 1224|      0|			x[0] = y | z << (32 - k);
 1225|      0|			z >>= k;
 1226|      0|			}
 1227|  5.19k|		else
 1228|  5.19k|			x[0] = y;
 1229|  5.19k|#ifndef Sudden_Underflow
 1230|  5.19k|		i =
 1231|  5.19k|#endif
 1232|  5.19k|		    b->wds = (x[1] = z) ? 2 : 1;
  ------------------
  |  Branch (1232:16): [True: 5.19k, False: 0]
  ------------------
 1233|  5.19k|		}
 1234|  16.8k|	else {
 1235|  16.8k|		k = lo0bits(C, &z);
 1236|  16.8k|		x[0] = z;
 1237|  16.8k|#ifndef Sudden_Underflow
 1238|  16.8k|		i =
 1239|  16.8k|#endif
 1240|  16.8k|		    b->wds = 1;
 1241|  16.8k|		k += 32;
 1242|  16.8k|		}
 1243|       |#else
 1244|       |	if (y = d1) {
 1245|       |		if (k = lo0bits(C, &y))
 1246|       |			if (k >= 16) {
 1247|       |				x[0] = y | z << 32 - k & 0xffff;
 1248|       |				x[1] = z >> k - 16 & 0xffff;
 1249|       |				x[2] = z >> k;
 1250|       |				i = 2;
 1251|       |				}
 1252|       |			else {
 1253|       |				x[0] = y & 0xffff;
 1254|       |				x[1] = y >> 16 | z << 16 - k & 0xffff;
 1255|       |				x[2] = z >> k & 0xffff;
 1256|       |				x[3] = z >> k+16;
 1257|       |				i = 3;
 1258|       |				}
 1259|       |		else {
 1260|       |			x[0] = y & 0xffff;
 1261|       |			x[1] = y >> 16;
 1262|       |			x[2] = z & 0xffff;
 1263|       |			x[3] = z >> 16;
 1264|       |			i = 3;
 1265|       |			}
 1266|       |		}
 1267|       |	else {
 1268|       |#ifdef DEBUG
 1269|       |		if (!z)
 1270|       |			Bug("Zero passed to d2b");
 1271|       |#endif
 1272|       |		k = lo0bits(C, &z);
 1273|       |		if (k >= 16) {
 1274|       |			x[0] = z;
 1275|       |			i = 0;
 1276|       |			}
 1277|       |		else {
 1278|       |			x[0] = z & 0xffff;
 1279|       |			x[1] = z >> 16;
 1280|       |			i = 1;
 1281|       |			}
 1282|       |		k += 32;
 1283|       |		}
 1284|       |	while(!x[i])
 1285|       |		--i;
 1286|       |	b->wds = i + 1;
 1287|       |#endif
 1288|  22.0k|#ifndef Sudden_Underflow
 1289|  22.0k|	if (de) {
  ------------------
  |  Branch (1289:6): [True: 22.0k, False: 0]
  ------------------
 1290|  22.0k|#endif
 1291|       |#ifdef IBM
 1292|       |		*e = (de - Bias - (P-1) << 2) + k;
 1293|       |		*bits = 4*P + 8 - k - hi0bits(C, word0(d) & Frac_mask);
 1294|       |#else
 1295|  22.0k|		*e = de - Bias - (P-1) + k;
  ------------------
  |  |  352|  22.0k|#define Bias 1023
  ------------------
              		*e = de - Bias - (P-1) + k;
  ------------------
  |  |  350|  22.0k|#define P 53
  ------------------
 1296|  22.0k|		*bits = P - k;
  ------------------
  |  |  350|  22.0k|#define P 53
  ------------------
 1297|  22.0k|#endif
 1298|  22.0k|#ifndef Sudden_Underflow
 1299|  22.0k|		}
 1300|      0|	else {
 1301|      0|		*e = de - Bias - (P-1) + 1 + k;
  ------------------
  |  |  352|      0|#define Bias 1023
  ------------------
              		*e = de - Bias - (P-1) + 1 + k;
  ------------------
  |  |  350|      0|#define P 53
  ------------------
 1302|      0|#ifdef Pack_32
 1303|      0|		*bits = 32*i - hi0bits(C, x[i-1]);
 1304|       |#else
 1305|       |		*bits = (i+2)*16 - hi0bits(C, x[i]);
 1306|       |#endif
 1307|      0|		}
 1308|  22.0k|#endif
 1309|  22.0k|	return b;
 1310|  22.0k|	}
jv_dtoa.c:lo0bits:
  709|  22.0k|{
  710|  22.0k|	int k;
  711|  22.0k|	ULong x = *y;
  712|       |
  713|  22.0k|	if (x & 7) {
  ------------------
  |  Branch (713:6): [True: 5.19k, False: 16.8k]
  ------------------
  714|  5.19k|		if (x & 1)
  ------------------
  |  Branch (714:7): [True: 5.19k, False: 0]
  ------------------
  715|  5.19k|			return 0;
  716|      0|		if (x & 2) {
  ------------------
  |  Branch (716:7): [True: 0, False: 0]
  ------------------
  717|      0|			*y = x >> 1;
  718|      0|			return 1;
  719|      0|			}
  720|      0|		*y = x >> 2;
  721|      0|		return 2;
  722|      0|		}
  723|  16.8k|	k = 0;
  724|  16.8k|	if (!(x & 0xffff)) {
  ------------------
  |  Branch (724:6): [True: 16.8k, False: 0]
  ------------------
  725|  16.8k|		k = 16;
  726|  16.8k|		x >>= 16;
  727|  16.8k|		}
  728|  16.8k|	if (!(x & 0xff)) {
  ------------------
  |  Branch (728:6): [True: 0, False: 16.8k]
  ------------------
  729|      0|		k += 8;
  730|      0|		x >>= 8;
  731|      0|		}
  732|  16.8k|	if (!(x & 0xf)) {
  ------------------
  |  Branch (732:6): [True: 16.8k, False: 0]
  ------------------
  733|  16.8k|		k += 4;
  734|  16.8k|		x >>= 4;
  735|  16.8k|		}
  736|  16.8k|	if (!(x & 0x3)) {
  ------------------
  |  Branch (736:6): [True: 0, False: 16.8k]
  ------------------
  737|      0|		k += 2;
  738|      0|		x >>= 2;
  739|      0|		}
  740|  16.8k|	if (!(x & 1)) {
  ------------------
  |  Branch (740:6): [True: 0, False: 16.8k]
  ------------------
  741|      0|		k++;
  742|      0|		x >>= 1;
  743|      0|		if (!x)
  ------------------
  |  Branch (743:7): [True: 0, False: 0]
  ------------------
  744|      0|			return 32;
  745|      0|		}
  746|  16.8k|	*y = x;
  747|  16.8k|	return k;
  748|  16.8k|	}
jv_dtoa.c:hi0bits:
  679|  5.19k|{
  680|  5.19k|	int k = 0;
  681|       |
  682|  5.19k|	if (!(x & 0xffff0000)) {
  ------------------
  |  Branch (682:6): [True: 5.19k, False: 0]
  ------------------
  683|  5.19k|		k = 16;
  684|  5.19k|		x <<= 16;
  685|  5.19k|		}
  686|  5.19k|	if (!(x & 0xff000000)) {
  ------------------
  |  Branch (686:6): [True: 0, False: 5.19k]
  ------------------
  687|      0|		k += 8;
  688|      0|		x <<= 8;
  689|      0|		}
  690|  5.19k|	if (!(x & 0xf0000000)) {
  ------------------
  |  Branch (690:6): [True: 5.19k, False: 0]
  ------------------
  691|  5.19k|		k += 4;
  692|  5.19k|		x <<= 4;
  693|  5.19k|		}
  694|  5.19k|	if (!(x & 0xc0000000)) {
  ------------------
  |  Branch (694:6): [True: 0, False: 5.19k]
  ------------------
  695|      0|		k += 2;
  696|      0|		x <<= 2;
  697|      0|		}
  698|  5.19k|	if (!(x & 0x80000000)) {
  ------------------
  |  Branch (698:6): [True: 0, False: 5.19k]
  ------------------
  699|      0|		k++;
  700|      0|		if (!(x & 0x40000000))
  ------------------
  |  Branch (700:7): [True: 0, False: 0]
  ------------------
  701|      0|			return 32;
  702|      0|		}
  703|  5.19k|	return k;
  704|  5.19k|	}
jv_dtoa.c:i2b:
  753|  10.3k|{
  754|  10.3k|	Bigint *b;
  755|       |
  756|  10.3k|	b = Balloc(C, 1);
  757|  10.3k|	b->x[0] = i;
  758|  10.3k|	b->wds = 1;
  759|  10.3k|	return b;
  760|  10.3k|	}
jv_dtoa.c:pow5mult:
  872|  5.19k|{
  873|  5.19k|	Bigint *b1, *p5, *p51;
  874|  5.19k|	int i;
  875|  5.19k|	static const int p05[3] = { 5, 25, 125 };
  876|       |
  877|  5.19k|	if ((i = k & 3))
  ------------------
  |  Branch (877:6): [True: 0, False: 5.19k]
  ------------------
  878|      0|		b = multadd(C, b, p05[i-1], 0);
  879|       |
  880|  5.19k|	if (!(k >>= 2))
  ------------------
  |  Branch (880:6): [True: 0, False: 5.19k]
  ------------------
  881|      0|		return b;
  882|  5.19k|	if (!(p5 = C->p5s)) {
  ------------------
  |  Branch (882:6): [True: 1, False: 5.19k]
  ------------------
  883|       |		/* first time */
  884|      1|		p5 = C->p5s = i2b(C, 625);
  885|      1|		p5->next = 0;
  886|      1|		}
  887|  36.3k|	for(;;) {
  888|  36.3k|		if (k & 1) {
  ------------------
  |  Branch (888:7): [True: 20.7k, False: 15.5k]
  ------------------
  889|  20.7k|			b1 = mult(C, b, p5);
  890|  20.7k|			Bfree(C, b);
  891|  20.7k|			b = b1;
  892|  20.7k|			}
  893|  36.3k|		if (!(k >>= 1))
  ------------------
  |  Branch (893:7): [True: 5.19k, False: 31.1k]
  ------------------
  894|  5.19k|			break;
  895|  31.1k|		if (!(p51 = p5->next)) {
  ------------------
  |  Branch (895:7): [True: 6, False: 31.1k]
  ------------------
  896|      6|			p51 = p5->next = mult(C, p5,p5);
  897|      6|			p51->next = 0;
  898|      6|			}
  899|  31.1k|		p5 = p51;
  900|  31.1k|		}
  901|  5.19k|	return b;
  902|  5.19k|	}
jv_dtoa.c:mult:
  765|  20.7k|{
  766|  20.7k|	Bigint *c;
  767|  20.7k|	int k, wa, wb, wc;
  768|  20.7k|	ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
  769|  20.7k|	ULong y;
  770|  20.7k|#ifdef ULLong
  771|  20.7k|	ULLong carry, z;
  ------------------
  |  |  506|  20.7k|#define ULLong unsigned Llong
  ------------------
  772|       |#else
  773|       |	ULong carry, z;
  774|       |#ifdef Pack_32
  775|       |	ULong z2;
  776|       |#endif
  777|       |#endif
  778|       |
  779|  20.7k|	if (a->wds < b->wds) {
  ------------------
  |  Branch (779:6): [True: 15.5k, False: 5.20k]
  ------------------
  780|  15.5k|		c = a;
  781|  15.5k|		a = b;
  782|  15.5k|		b = c;
  783|  15.5k|		}
  784|  20.7k|	k = a->k;
  785|  20.7k|	wa = a->wds;
  786|  20.7k|	wb = b->wds;
  787|  20.7k|	wc = wa + wb;
  788|  20.7k|	if (wc > a->maxwds)
  ------------------
  |  Branch (788:6): [True: 10.3k, False: 10.3k]
  ------------------
  789|  10.3k|		k++;
  790|  20.7k|	c = Balloc(C, k);
  791|   192k|	for(x = c->x, xa = x + wc; x < xa; x++)
  ------------------
  |  Branch (791:29): [True: 171k, False: 20.7k]
  ------------------
  792|   171k|		*x = 0;
  793|  20.7k|	xa = a->x;
  794|  20.7k|	xae = xa + wa;
  795|  20.7k|	xb = b->x;
  796|  20.7k|	xbe = xb + wb;
  797|  20.7k|	xc0 = c->x;
  798|  20.7k|#ifdef ULLong
  799|  62.3k|	for(; xb < xbe; xc0++) {
  ------------------
  |  Branch (799:8): [True: 41.5k, False: 20.7k]
  ------------------
  800|  41.5k|		if ((y = *xb++)) {
  ------------------
  |  Branch (800:7): [True: 41.5k, False: 0]
  ------------------
  801|  41.5k|			x = xa;
  802|  41.5k|			xc = xc0;
  803|  41.5k|			carry = 0;
  804|   441k|			do {
  805|   441k|				z = *x++ * (ULLong)y + *xc + carry;
  806|   441k|				carry = z >> 32;
  807|   441k|				*xc++ = z & FFFFFFFF;
  ------------------
  |  |  489|   441k|#define FFFFFFFF 0xffffffffUL
  ------------------
  808|   441k|				}
  809|   441k|				while(x < xae);
  ------------------
  |  Branch (809:11): [True: 400k, False: 41.5k]
  ------------------
  810|  41.5k|			*xc = carry;
  811|  41.5k|			}
  812|  41.5k|		}
  813|       |#else
  814|       |#ifdef Pack_32
  815|       |	for(; xb < xbe; xb++, xc0++) {
  816|       |		if (y = *xb & 0xffff) {
  817|       |			x = xa;
  818|       |			xc = xc0;
  819|       |			carry = 0;
  820|       |			do {
  821|       |				z = (*x & 0xffff) * y + (*xc & 0xffff) + carry;
  822|       |				carry = z >> 16;
  823|       |				z2 = (*x++ >> 16) * y + (*xc >> 16) + carry;
  824|       |				carry = z2 >> 16;
  825|       |				Storeinc(xc, z2, z);
  826|       |				}
  827|       |				while(x < xae);
  828|       |			*xc = carry;
  829|       |			}
  830|       |		if (y = *xb >> 16) {
  831|       |			x = xa;
  832|       |			xc = xc0;
  833|       |			carry = 0;
  834|       |			z2 = *xc;
  835|       |			do {
  836|       |				z = (*x & 0xffff) * y + (*xc >> 16) + carry;
  837|       |				carry = z >> 16;
  838|       |				Storeinc(xc, z, z2);
  839|       |				z2 = (*x++ >> 16) * y + (*xc & 0xffff) + carry;
  840|       |				carry = z2 >> 16;
  841|       |				}
  842|       |				while(x < xae);
  843|       |			*xc = z2;
  844|       |			}
  845|       |		}
  846|       |#else
  847|       |	for(; xb < xbe; xc0++) {
  848|       |		if (y = *xb++) {
  849|       |			x = xa;
  850|       |			xc = xc0;
  851|       |			carry = 0;
  852|       |			do {
  853|       |				z = *x++ * y + *xc + carry;
  854|       |				carry = z >> 16;
  855|       |				*xc++ = z & 0xffff;
  856|       |				}
  857|       |				while(x < xae);
  858|       |			*xc = carry;
  859|       |			}
  860|       |		}
  861|       |#endif
  862|       |#endif
  863|  36.3k|	for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
  ------------------
  |  Branch (863:33): [True: 36.3k, False: 0]
  |  Branch (863:43): [True: 15.5k, False: 20.7k]
  ------------------
  864|  20.7k|	c->wds = wc;
  865|  20.7k|	return c;
  866|  20.7k|	}
jv_dtoa.c:lshift:
  907|  20.7k|{
  908|  20.7k|	int i, k1, n, n1;
  909|  20.7k|	Bigint *b1;
  910|  20.7k|	ULong *x, *x1, *xe, z;
  911|       |
  912|  20.7k|#ifdef Pack_32
  913|  20.7k|	n = k >> 5;
  914|       |#else
  915|       |	n = k >> 4;
  916|       |#endif
  917|  20.7k|	k1 = b->k;
  918|  20.7k|	n1 = n + b->wds + 1;
  919|  62.3k|	for(i = b->maxwds; n1 > i; i <<= 1)
  ------------------
  |  Branch (919:21): [True: 41.5k, False: 20.7k]
  ------------------
  920|  41.5k|		k1++;
  921|  20.7k|	b1 = Balloc(C, k1);
  922|  20.7k|	x1 = b1->x;
  923|   239k|	for(i = 0; i < n; i++)
  ------------------
  |  Branch (923:13): [True: 218k, False: 20.7k]
  ------------------
  924|   218k|		*x1++ = 0;
  925|  20.7k|	x = b->x;
  926|  20.7k|	xe = x + b->wds;
  927|  20.7k|#ifdef Pack_32
  928|  20.7k|	if (k &= 0x1f) {
  ------------------
  |  Branch (928:6): [True: 20.7k, False: 0]
  ------------------
  929|  20.7k|		k1 = 32 - k;
  930|  20.7k|		z = 0;
  931|   254k|		do {
  932|   254k|			*x1++ = *x << k | z;
  933|   254k|			z = *x++ >> k1;
  934|   254k|			}
  935|   254k|			while(x < xe);
  ------------------
  |  Branch (935:10): [True: 233k, False: 20.7k]
  ------------------
  936|  20.7k|		if ((*x1 = z))
  ------------------
  |  Branch (936:7): [True: 0, False: 20.7k]
  ------------------
  937|      0|			++n1;
  938|  20.7k|		}
  939|       |#else
  940|       |	if (k &= 0xf) {
  941|       |		k1 = 16 - k;
  942|       |		z = 0;
  943|       |		do {
  944|       |			*x1++ = *x << k  & 0xffff | z;
  945|       |			z = *x++ >> k1;
  946|       |			}
  947|       |			while(x < xe);
  948|       |		if (*x1 = z)
  949|       |			++n1;
  950|       |		}
  951|       |#endif
  952|      0|	else do
  953|      0|		*x1++ = *x++;
  954|      0|		while(x < xe);
  ------------------
  |  Branch (954:9): [True: 0, False: 0]
  ------------------
  955|  20.7k|	b1->wds = n1 - 1;
  956|  20.7k|	Bfree(C, b);
  957|  20.7k|	return b1;
  958|  20.7k|	}
jv_dtoa.c:diff:
  993|  88.3k|{
  994|  88.3k|	Bigint *c;
  995|  88.3k|	int i, wa, wb;
  996|  88.3k|	ULong *xa, *xae, *xb, *xbe, *xc;
  997|  88.3k|#ifdef ULLong
  998|  88.3k|	ULLong borrow, y;
  ------------------
  |  |  506|  88.3k|#define ULLong unsigned Llong
  ------------------
  999|       |#else
 1000|       |	ULong borrow, y;
 1001|       |#ifdef Pack_32
 1002|       |	ULong z;
 1003|       |#endif
 1004|       |#endif
 1005|       |
 1006|  88.3k|	i = cmp(C, a,b);
 1007|  88.3k|	if (!i) {
  ------------------
  |  Branch (1007:6): [True: 0, False: 88.3k]
  ------------------
 1008|      0|		c = Balloc(C, 0);
 1009|      0|		c->wds = 1;
 1010|      0|		c->x[0] = 0;
 1011|      0|		return c;
 1012|      0|		}
 1013|  88.3k|	if (i < 0) {
  ------------------
  |  Branch (1013:6): [True: 0, False: 88.3k]
  ------------------
 1014|      0|		c = a;
 1015|      0|		a = b;
 1016|      0|		b = c;
 1017|      0|		i = 1;
 1018|      0|		}
 1019|  88.3k|	else
 1020|  88.3k|		i = 0;
 1021|  88.3k|	c = Balloc(C, a->k);
 1022|  88.3k|	c->sign = i;
 1023|  88.3k|	wa = a->wds;
 1024|  88.3k|	xa = a->x;
 1025|  88.3k|	xae = xa + wa;
 1026|  88.3k|	wb = b->wds;
 1027|  88.3k|	xb = b->x;
 1028|  88.3k|	xbe = xb + wb;
 1029|  88.3k|	xc = c->x;
 1030|  88.3k|	borrow = 0;
 1031|  88.3k|#ifdef ULLong
 1032|  1.99M|	do {
 1033|  1.99M|		y = (ULLong)*xa++ - *xb++ - borrow;
 1034|  1.99M|		borrow = y >> 32 & (ULong)1;
 1035|  1.99M|		*xc++ = y & FFFFFFFF;
  ------------------
  |  |  489|  1.99M|#define FFFFFFFF 0xffffffffUL
  ------------------
 1036|  1.99M|		}
 1037|  1.99M|		while(xb < xbe);
  ------------------
  |  Branch (1037:9): [True: 1.90M, False: 88.3k]
  ------------------
 1038|   129k|	while(xa < xae) {
  ------------------
  |  Branch (1038:8): [True: 41.5k, False: 88.3k]
  ------------------
 1039|  41.5k|		y = *xa++ - borrow;
 1040|  41.5k|		borrow = y >> 32 & (ULong)1;
 1041|  41.5k|		*xc++ = y & FFFFFFFF;
  ------------------
  |  |  489|  41.5k|#define FFFFFFFF 0xffffffffUL
  ------------------
 1042|  41.5k|		}
 1043|       |#else
 1044|       |#ifdef Pack_32
 1045|       |	do {
 1046|       |		y = (*xa & 0xffff) - (*xb & 0xffff) - borrow;
 1047|       |		borrow = (y & 0x10000) >> 16;
 1048|       |		z = (*xa++ >> 16) - (*xb++ >> 16) - borrow;
 1049|       |		borrow = (z & 0x10000) >> 16;
 1050|       |		Storeinc(xc, z, y);
 1051|       |		}
 1052|       |		while(xb < xbe);
 1053|       |	while(xa < xae) {
 1054|       |		y = (*xa & 0xffff) - borrow;
 1055|       |		borrow = (y & 0x10000) >> 16;
 1056|       |		z = (*xa++ >> 16) - borrow;
 1057|       |		borrow = (z & 0x10000) >> 16;
 1058|       |		Storeinc(xc, z, y);
 1059|       |		}
 1060|       |#else
 1061|       |	do {
 1062|       |		y = *xa++ - *xb++ - borrow;
 1063|       |		borrow = (y & 0x10000) >> 16;
 1064|       |		*xc++ = y & 0xffff;
 1065|       |		}
 1066|       |		while(xb < xbe);
 1067|       |	while(xa < xae) {
 1068|       |		y = *xa++ - borrow;
 1069|       |		borrow = (y & 0x10000) >> 16;
 1070|       |		*xc++ = y & 0xffff;
 1071|       |		}
 1072|       |#endif
 1073|       |#endif
 1074|  88.3k|	while(!*--xc)
  ------------------
  |  Branch (1074:8): [True: 0, False: 88.3k]
  ------------------
 1075|      0|		wa--;
 1076|  88.3k|	c->wds = wa;
 1077|  88.3k|	return c;
 1078|  88.3k|	}
jv_dtoa.c:cmp:
  963|   363k|{
  964|   363k|	ULong *xa, *xa0, *xb, *xb0;
  965|   363k|	int i, j;
  966|       |
  967|   363k|	i = a->wds;
  968|   363k|	j = b->wds;
  969|       |#ifdef DEBUG
  970|       |	if (i > 1 && !a->x[i-1])
  971|       |		Bug("cmp called with a->x[a->wds-1] == 0");
  972|       |	if (j > 1 && !b->x[j-1])
  973|       |		Bug("cmp called with b->x[b->wds-1] == 0");
  974|       |#endif
  975|   363k|	if (i -= j)
  ------------------
  |  Branch (975:6): [True: 83.1k, False: 280k]
  ------------------
  976|  83.1k|		return i;
  977|   280k|	xa0 = a->x;
  978|   280k|	xa = xa0 + j;
  979|   280k|	xb0 = b->x;
  980|   280k|	xb = xb0 + j;
  981|   280k|	for(;;) {
  982|   280k|		if (*--xa != *--xb)
  ------------------
  |  Branch (982:7): [True: 280k, False: 0]
  ------------------
  983|   280k|			return *xa < *xb ? -1 : 1;
  ------------------
  |  Branch (983:11): [True: 181k, False: 98.7k]
  ------------------
  984|      0|		if (xa <= xa0)
  ------------------
  |  Branch (984:7): [True: 0, False: 0]
  ------------------
  985|      0|			break;
  986|      0|		}
  987|      0|	return 0;
  988|   280k|	}
jv_dtoa.c:nrv_alloc:
 3412|  7.00M|{
 3413|  7.00M|	char *rv, *t;
 3414|       |
 3415|  7.00M|	t = rv = rv_alloc(C, n);
 3416|  14.0M|	while((*t = *s++)) t++;
  ------------------
  |  Branch (3416:8): [True: 7.00M, False: 7.00M]
  ------------------
 3417|  7.00M|	if (rve)
  ------------------
  |  Branch (3417:6): [True: 7.00M, False: 0]
  ------------------
 3418|  7.00M|		*rve = t;
 3419|  7.00M|	return rv;
 3420|  7.00M|	}
jv_dtoa.c:rv_alloc:
 3396|  7.02M|{
 3397|  7.02M|	int j, k, *r;
 3398|       |
 3399|  7.02M|	j = sizeof(ULong);
 3400|  7.02M|	for(k = 0;
 3401|  7.02M|            (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
  ------------------
  |  Branch (3401:13): [True: 0, False: 7.02M]
  ------------------
 3402|  7.02M|		j <<= 1)
 3403|      0|			k++;
 3404|  7.02M|	r = (int*)Balloc(C, k);
 3405|  7.02M|	*r = k;
 3406|  7.02M|	return
 3407|  7.02M|		(char *)(r+1);
 3408|  7.02M|	}
jv_dtoa.c:dshift:
 1978|  5.19k|{
 1979|  5.19k|	int rv = hi0bits(C, b->x[b->wds-1]) - 4;
 1980|  5.19k|	if (p2 > 0)
  ------------------
  |  Branch (1980:6): [True: 0, False: 5.19k]
  ------------------
 1981|      0|		rv -= p2;
 1982|  5.19k|	return rv & kmask;
  ------------------
  |  | 1518|  5.19k|#define kmask 31
  ------------------
 1983|  5.19k|	}
jv_dtoa.c:multadd:
  592|   166k|{
  593|   166k|	int i, wds;
  594|   166k|#ifdef ULLong
  595|   166k|	ULong *x;
  596|   166k|	ULLong carry, y;
  ------------------
  |  |  506|   166k|#define ULLong unsigned Llong
  ------------------
  597|       |#else
  598|       |	ULong carry, *x, y;
  599|       |#ifdef Pack_32
  600|       |	ULong xi, z;
  601|       |#endif
  602|       |#endif
  603|   166k|	Bigint *b1;
  604|       |
  605|   166k|	wds = b->wds;
  606|   166k|	x = b->x;
  607|   166k|	i = 0;
  608|   166k|	carry = a;
  609|  3.78M|	do {
  610|  3.78M|#ifdef ULLong
  611|  3.78M|		y = *x * (ULLong)m + carry;
  612|  3.78M|		carry = y >> 32;
  613|  3.78M|		*x++ = y & FFFFFFFF;
  ------------------
  |  |  489|  3.78M|#define FFFFFFFF 0xffffffffUL
  ------------------
  614|       |#else
  615|       |#ifdef Pack_32
  616|       |		xi = *x;
  617|       |		y = (xi & 0xffff) * m + carry;
  618|       |		z = (xi >> 16) * m + (y >> 16);
  619|       |		carry = z >> 16;
  620|       |		*x++ = (z << 16) + (y & 0xffff);
  621|       |#else
  622|       |		y = *x * m + carry;
  623|       |		carry = y >> 16;
  624|       |		*x++ = y & 0xffff;
  625|       |#endif
  626|       |#endif
  627|  3.78M|		}
  628|  3.78M|		while(++i < wds);
  ------------------
  |  Branch (628:9): [True: 3.61M, False: 166k]
  ------------------
  629|   166k|	if (carry) {
  ------------------
  |  Branch (629:6): [True: 5.19k, False: 161k]
  ------------------
  630|  5.19k|		if (wds >= b->maxwds) {
  ------------------
  |  Branch (630:7): [True: 0, False: 5.19k]
  ------------------
  631|      0|			b1 = Balloc(C, b->k+1);
  632|      0|			Bcopy(b1, b);
  ------------------
  |  |  586|      0|#define Bcopy(x,y) memcpy((char *)&x->sign, (char *)&y->sign, \
  |  |  587|      0|y->wds*sizeof(Long) + 2*sizeof(int))
  ------------------
  633|      0|			Bfree(C, b);
  634|      0|			b = b1;
  635|      0|			}
  636|  5.19k|		b->x[wds++] = carry;
  637|  5.19k|		b->wds = wds;
  638|  5.19k|		}
  639|   166k|	return b;
  640|   166k|	}
jv_dtoa.c:quorem:
 1988|  88.3k|{
 1989|  88.3k|	int n;
 1990|  88.3k|	ULong *bx, *bxe, q, *sx, *sxe;
 1991|  88.3k|#ifdef ULLong
 1992|  88.3k|	ULLong borrow, carry, y, ys;
  ------------------
  |  |  506|  88.3k|#define ULLong unsigned Llong
  ------------------
 1993|       |#else
 1994|       |	ULong borrow, carry, y, ys;
 1995|       |#ifdef Pack_32
 1996|       |	ULong si, z, zs;
 1997|       |#endif
 1998|       |#endif
 1999|       |
 2000|  88.3k|	n = S->wds;
 2001|       |#ifdef DEBUG
 2002|       |	/*debug*/ if (b->wds > n)
 2003|       |	/*debug*/	Bug("oversize b in quorem");
 2004|       |#endif
 2005|  88.3k|	if (b->wds < n)
  ------------------
  |  Branch (2005:6): [True: 0, False: 88.3k]
  ------------------
 2006|      0|		return 0;
 2007|  88.3k|	sx = S->x;
 2008|  88.3k|	sxe = sx + --n;
 2009|  88.3k|	bx = b->x;
 2010|  88.3k|	bxe = bx + n;
 2011|  88.3k|	q = *bxe / (*sxe + 1);	/* ensure q <= true quotient */
 2012|       |#ifdef DEBUG
 2013|       |#ifdef NO_STRTOD_BIGCOMP
 2014|       |	/*debug*/ if (q > 9)
 2015|       |#else
 2016|       |	/* An oversized q is possible when quorem is called from bigcomp and */
 2017|       |	/* the input is near, e.g., twice the smallest denormalized number. */
 2018|       |	/*debug*/ if (q > 15)
 2019|       |#endif
 2020|       |	/*debug*/	Bug("oversized quotient in quorem");
 2021|       |#endif
 2022|  88.3k|	if (q) {
  ------------------
  |  Branch (2022:6): [True: 88.3k, False: 0]
  ------------------
 2023|  88.3k|		borrow = 0;
 2024|  88.3k|		carry = 0;
 2025|  2.03M|		do {
 2026|  2.03M|#ifdef ULLong
 2027|  2.03M|			ys = *sx++ * (ULLong)q + carry;
 2028|  2.03M|			carry = ys >> 32;
 2029|  2.03M|			y = *bx - (ys & FFFFFFFF) - borrow;
  ------------------
  |  |  489|  2.03M|#define FFFFFFFF 0xffffffffUL
  ------------------
 2030|  2.03M|			borrow = y >> 32 & (ULong)1;
 2031|  2.03M|			*bx++ = y & FFFFFFFF;
  ------------------
  |  |  489|  2.03M|#define FFFFFFFF 0xffffffffUL
  ------------------
 2032|       |#else
 2033|       |#ifdef Pack_32
 2034|       |			si = *sx++;
 2035|       |			ys = (si & 0xffff) * q + carry;
 2036|       |			zs = (si >> 16) * q + (ys >> 16);
 2037|       |			carry = zs >> 16;
 2038|       |			y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
 2039|       |			borrow = (y & 0x10000) >> 16;
 2040|       |			z = (*bx >> 16) - (zs & 0xffff) - borrow;
 2041|       |			borrow = (z & 0x10000) >> 16;
 2042|       |			Storeinc(bx, z, y);
 2043|       |#else
 2044|       |			ys = *sx++ * q + carry;
 2045|       |			carry = ys >> 16;
 2046|       |			y = *bx - (ys & 0xffff) - borrow;
 2047|       |			borrow = (y & 0x10000) >> 16;
 2048|       |			*bx++ = y & 0xffff;
 2049|       |#endif
 2050|       |#endif
 2051|  2.03M|			}
 2052|  2.03M|			while(sx <= sxe);
  ------------------
  |  Branch (2052:10): [True: 1.94M, False: 88.3k]
  ------------------
 2053|  88.3k|		if (!*bxe) {
  ------------------
  |  Branch (2053:7): [True: 0, False: 88.3k]
  ------------------
 2054|      0|			bx = b->x;
 2055|      0|			while(--bxe > bx && !*bxe)
  ------------------
  |  Branch (2055:10): [True: 0, False: 0]
  |  Branch (2055:24): [True: 0, False: 0]
  ------------------
 2056|      0|				--n;
 2057|      0|			b->wds = n;
 2058|      0|			}
 2059|  88.3k|		}
 2060|  88.3k|	if (cmp(C, b, S) >= 0) {
  ------------------
  |  Branch (2060:6): [True: 0, False: 88.3k]
  ------------------
 2061|      0|		q++;
 2062|      0|		borrow = 0;
 2063|      0|		carry = 0;
 2064|      0|		bx = b->x;
 2065|      0|		sx = S->x;
 2066|      0|		do {
 2067|      0|#ifdef ULLong
 2068|      0|			ys = *sx++ + carry;
 2069|      0|			carry = ys >> 32;
 2070|      0|			y = *bx - (ys & FFFFFFFF) - borrow;
  ------------------
  |  |  489|      0|#define FFFFFFFF 0xffffffffUL
  ------------------
 2071|      0|			borrow = y >> 32 & (ULong)1;
 2072|      0|			*bx++ = y & FFFFFFFF;
  ------------------
  |  |  489|      0|#define FFFFFFFF 0xffffffffUL
  ------------------
 2073|       |#else
 2074|       |#ifdef Pack_32
 2075|       |			si = *sx++;
 2076|       |			ys = (si & 0xffff) + carry;
 2077|       |			zs = (si >> 16) + (ys >> 16);
 2078|       |			carry = zs >> 16;
 2079|       |			y = (*bx & 0xffff) - (ys & 0xffff) - borrow;
 2080|       |			borrow = (y & 0x10000) >> 16;
 2081|       |			z = (*bx >> 16) - (zs & 0xffff) - borrow;
 2082|       |			borrow = (z & 0x10000) >> 16;
 2083|       |			Storeinc(bx, z, y);
 2084|       |#else
 2085|       |			ys = *sx++ + carry;
 2086|       |			carry = ys >> 16;
 2087|       |			y = *bx - (ys & 0xffff) - borrow;
 2088|       |			borrow = (y & 0x10000) >> 16;
 2089|       |			*bx++ = y & 0xffff;
 2090|       |#endif
 2091|       |#endif
 2092|      0|			}
 2093|      0|			while(sx <= sxe);
  ------------------
  |  Branch (2093:10): [True: 0, False: 0]
  ------------------
 2094|      0|		bx = b->x;
 2095|      0|		bxe = bx + n;
 2096|      0|		if (!*bxe) {
  ------------------
  |  Branch (2096:7): [True: 0, False: 0]
  ------------------
 2097|      0|			while(--bxe > bx && !*bxe)
  ------------------
  |  Branch (2097:10): [True: 0, False: 0]
  |  Branch (2097:24): [True: 0, False: 0]
  ------------------
 2098|      0|				--n;
 2099|      0|			b->wds = n;
 2100|      0|			}
 2101|      0|		}
 2102|  88.3k|	return q;
 2103|  88.3k|	}

tsd_dtoa_context_get:
   39|  7.76k|inline struct dtoa_context *tsd_dtoa_context_get(void) {
   40|  7.76k|  pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
   41|  7.76k|  struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
   42|  7.76k|  if (!ctx) {
  ------------------
  |  Branch (42:7): [True: 1, False: 7.76k]
  ------------------
   43|      1|    ctx = jv_mem_alloc(sizeof(struct dtoa_context));
   44|      1|    jvp_dtoa_context_init(ctx);
   45|      1|    if (pthread_setspecific(dtoa_ctx_key, ctx) != 0) {
  ------------------
  |  Branch (45:9): [True: 0, False: 1]
  ------------------
   46|      0|      jv_mem_free(ctx);
   47|      0|      fprintf(stderr, "error: cannot set thread specific data");
   48|      0|      abort();
   49|      0|    }
   50|      1|  }
   51|  7.76k|  return ctx;
   52|  7.76k|}
jv_dtoa_tsd.c:jv_tsd_dtoa_ctx_init:
   31|      1|void jv_tsd_dtoa_ctx_init(void) {
   32|      1|  if (pthread_key_create(&dtoa_ctx_key, tsd_dtoa_ctx_dtor) != 0) {
  ------------------
  |  Branch (32:7): [True: 0, False: 1]
  ------------------
   33|      0|    fprintf(stderr, "error: cannot create thread specific key");
   34|      0|    abort();
   35|      0|  }
   36|      1|  atexit(jv_tsd_dtoa_ctx_fini);
   37|      1|}
jv_dtoa_tsd.c:tsd_dtoa_ctx_dtor:
   12|      1|static void tsd_dtoa_ctx_dtor(void *ctx) {
   13|      1|  if (ctx) {
  ------------------
  |  Branch (13:7): [True: 1, False: 0]
  ------------------
   14|      1|    jvp_dtoa_context_free((struct dtoa_context *)ctx);
   15|      1|    jv_mem_free(ctx);
   16|      1|  }
   17|      1|}
jv_dtoa_tsd.c:jv_tsd_dtoa_ctx_fini:
   22|      1|void jv_tsd_dtoa_ctx_fini(void) {
   23|      1|  struct dtoa_context *ctx = pthread_getspecific(dtoa_ctx_key);
   24|      1|  tsd_dtoa_ctx_dtor(ctx);
   25|       |  pthread_setspecific(dtoa_ctx_key, NULL);
   26|      1|}

jv_parser_set_buf:
  740|  4.44k|void jv_parser_set_buf(struct jv_parser* p, const char* buf, int length, int is_partial) {
  741|  4.44k|  assert((p->curr_buf == 0 || p->curr_buf_pos == p->curr_buf_length)
  ------------------
  |  Branch (741:3): [True: 4.44k, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 4.44k, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 4.44k, False: 0]
  ------------------
  742|  4.44k|         && "previous buffer not exhausted");
  743|  8.99k|  while (length > 0 && p->bom_strip_position < sizeof(UTF8_BOM)) {
  ------------------
  |  Branch (743:10): [True: 8.97k, False: 17]
  |  Branch (743:24): [True: 4.55k, False: 4.42k]
  ------------------
  744|  4.55k|    if ((unsigned char)*buf == UTF8_BOM[p->bom_strip_position]) {
  ------------------
  |  Branch (744:9): [True: 123, False: 4.42k]
  ------------------
  745|       |      // matched a BOM character
  746|    123|      buf++;
  747|    123|      length--;
  748|    123|      p->bom_strip_position++;
  749|  4.42k|    } else {
  750|  4.42k|      if (p->bom_strip_position == 0) {
  ------------------
  |  Branch (750:11): [True: 4.31k, False: 114]
  ------------------
  751|       |        // no BOM in this document
  752|  4.31k|        p->bom_strip_position = sizeof(UTF8_BOM);
  753|  4.31k|      } else {
  754|       |        // malformed BOM (prefix present, rest missing)
  755|    114|        p->bom_strip_position = 0xff;
  756|    114|      }
  757|  4.42k|    }
  758|  4.55k|  }
  759|  4.44k|  p->curr_buf = buf;
  760|  4.44k|  p->curr_buf_length = length;
  761|  4.44k|  p->curr_buf_pos = 0;
  762|  4.44k|  p->curr_buf_is_partial = is_partial;
  763|  4.44k|}
jv_parser_next:
  777|  7.62k|jv jv_parser_next(struct jv_parser* p) {
  778|  7.62k|  if (p->eof)
  ------------------
  |  Branch (778:7): [True: 1.47k, False: 6.15k]
  ------------------
  779|  1.47k|    return jv_invalid();
  780|  6.15k|  if (!p->curr_buf)
  ------------------
  |  Branch (780:7): [True: 62, False: 6.09k]
  ------------------
  781|     62|    return jv_invalid(); // Need a buffer
  782|  6.09k|  if (p->bom_strip_position == 0xff) {
  ------------------
  |  Branch (782:7): [True: 151, False: 5.94k]
  ------------------
  783|    151|    if (!(p->flags & JV_PARSE_SEQ))
  ------------------
  |  Branch (783:9): [True: 20, False: 131]
  ------------------
  784|     20|      return jv_invalid_with_msg(jv_string("Malformed BOM"));
  785|    131|    p->st =JV_PARSER_WAITING_FOR_RS;
  786|    131|    parser_reset(p);
  787|    131|  }
  788|  6.07k|  jv value = jv_invalid();
  789|  6.07k|  if ((p->flags & JV_PARSE_STREAMING) && stream_check_done(p, &value))
  ------------------
  |  Branch (789:7): [True: 1.81k, False: 4.26k]
  |  Branch (789:42): [True: 4, False: 1.81k]
  ------------------
  790|      4|    return value;
  791|  6.07k|  char ch;
  792|  6.07k|  presult msg = 0;
  793|  81.1M|  while (!msg && p->curr_buf_pos < p->curr_buf_length) {
  ------------------
  |  Branch (793:10): [True: 81.1M, False: 2.18k]
  |  Branch (793:18): [True: 81.1M, False: 3.89k]
  ------------------
  794|  81.1M|    ch = p->curr_buf[p->curr_buf_pos++];
  795|  81.1M|    if (p->st == JV_PARSER_WAITING_FOR_RS) {
  ------------------
  |  Branch (795:9): [True: 1.78k, False: 81.1M]
  ------------------
  796|  1.78k|      if (ch == '\n') {
  ------------------
  |  Branch (796:11): [True: 203, False: 1.58k]
  ------------------
  797|    203|        p->line++;
  798|    203|        p->column = 0;
  799|  1.58k|      } else {
  800|  1.58k|        p->column++;
  801|  1.58k|      }
  802|  1.78k|      if (ch == '\036')
  ------------------
  |  Branch (802:11): [True: 130, False: 1.65k]
  ------------------
  803|    130|        p->st = JV_PARSER_NORMAL;
  804|  1.78k|      continue; // need to resync, wait for RS
  805|  1.78k|    }
  806|  81.1M|    msg = scan(p, ch, &value);
  807|  81.1M|  }
  808|  6.07k|  if (msg == OK) {
  ------------------
  |  Branch (808:7): [True: 1.64k, False: 4.42k]
  ------------------
  809|  1.64k|    return value;
  810|  4.42k|  } else if (msg) {
  ------------------
  |  Branch (810:14): [True: 537, False: 3.89k]
  ------------------
  811|    537|    jv_free(value);
  812|    537|    if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) {
  ------------------
  |  Branch (812:9): [True: 454, False: 83]
  |  Branch (812:25): [True: 122, False: 332]
  ------------------
  813|       |      // Skip to the next RS
  814|    122|      p->st = JV_PARSER_WAITING_FOR_RS;
  815|    122|      value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column);
  816|    122|      parser_reset(p);
  817|    122|      return value;
  818|    122|    }
  819|    415|    value = make_error(p, "%s at line %d, column %d", msg, p->line, p->column);
  820|    415|    parser_reset(p);
  821|    415|    if (!(p->flags & JV_PARSE_SEQ)) {
  ------------------
  |  Branch (821:9): [True: 332, False: 83]
  ------------------
  822|       |      // We're not parsing a JSON text sequence; throw this buffer away.
  823|       |      // XXX We should fail permanently here.
  824|    332|      p->curr_buf = 0;
  825|    332|      p->curr_buf_pos = 0;
  826|    332|    } // Else ch must be RS; don't clear buf so we can start parsing again after this ch
  827|    415|    return value;
  828|  3.89k|  } else if (p->curr_buf_is_partial) {
  ------------------
  |  Branch (828:14): [True: 0, False: 3.89k]
  ------------------
  829|      0|    assert(p->curr_buf_pos == p->curr_buf_length);
  ------------------
  |  Branch (829:5): [True: 0, False: 0]
  |  Branch (829:5): [True: 0, False: 0]
  ------------------
  830|       |    // need another buffer
  831|      0|    return jv_invalid();
  832|  3.89k|  } else {
  833|       |    // at EOF
  834|  3.89k|    p->eof = 1;
  835|  3.89k|    assert(p->curr_buf_pos == p->curr_buf_length);
  ------------------
  |  Branch (835:5): [True: 0, False: 3.89k]
  |  Branch (835:5): [True: 3.89k, False: 0]
  ------------------
  836|  3.89k|    jv_free(value);
  837|  3.89k|    if (p->st == JV_PARSER_WAITING_FOR_RS)
  ------------------
  |  Branch (837:9): [True: 89, False: 3.80k]
  ------------------
  838|     89|      return make_error(p, "Unfinished abandoned text at EOF at line %d, column %d", p->line, p->column);
  839|  3.80k|    if (p->st != JV_PARSER_NORMAL) {
  ------------------
  |  Branch (839:9): [True: 80, False: 3.72k]
  ------------------
  840|     80|      value = make_error(p, "Unfinished string at EOF at line %d, column %d", p->line, p->column);
  841|     80|      parser_reset(p);
  842|     80|      p->st = JV_PARSER_WAITING_FOR_RS;
  843|     80|      return value;
  844|     80|    }
  845|  3.72k|    if ((msg = check_literal(p))) {
  ------------------
  |  Branch (845:9): [True: 553, False: 3.16k]
  ------------------
  846|    553|      value = make_error(p, "%s at EOF at line %d, column %d", msg, p->line, p->column);
  847|    553|      parser_reset(p);
  848|    553|      p->st = JV_PARSER_WAITING_FOR_RS;
  849|    553|      return value;
  850|    553|    }
  851|  3.16k|    if (((p->flags & JV_PARSE_STREAMING) && p->stacklen != 0) ||
  ------------------
  |  Branch (851:10): [True: 852, False: 2.31k]
  |  Branch (851:45): [True: 312, False: 540]
  ------------------
  852|  2.85k|        (!(p->flags & JV_PARSE_STREAMING) && p->stackpos != 0)) {
  ------------------
  |  Branch (852:10): [True: 2.31k, False: 540]
  |  Branch (852:46): [True: 494, False: 1.82k]
  ------------------
  853|    806|      value = make_error(p, "Unfinished JSON term at EOF at line %d, column %d", p->line, p->column);
  854|    806|      parser_reset(p);
  855|    806|      p->st = JV_PARSER_WAITING_FOR_RS;
  856|    806|      return value;
  857|    806|    }
  858|       |    // p->next is either invalid (nothing here, but no syntax error)
  859|       |    // or valid (this is the value). either way it's the thing to return
  860|  2.36k|    if ((p->flags & JV_PARSE_STREAMING) && jv_is_valid(p->next)) {
  ------------------
  |  Branch (860:9): [True: 540, False: 1.82k]
  |  Branch (860:44): [True: 385, False: 155]
  ------------------
  861|    385|      value = JV_ARRAY(jv_copy(p->path), p->next); // except in streaming mode we've got to make it [path,value]
  ------------------
  |  |  111|    385|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|    385|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    385|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    385|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    385|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  862|  1.97k|    } else {
  863|  1.97k|      value = p->next;
  864|  1.97k|    }
  865|  2.36k|    p->next = jv_invalid();
  866|  2.36k|    if ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && jv_get_kind(value) == JV_KIND_NUMBER) {
  ------------------
  |  Branch (866:9): [True: 23, False: 2.33k]
  |  Branch (866:38): [True: 20, False: 3]
  |  Branch (866:60): [True: 4, False: 16]
  ------------------
  867|      4|      jv_free(value);
  868|      4|      return make_error(p, "Potentially truncated top-level numeric value at EOF at line %d, column %d", p->line, p->column);
  869|      4|    }
  870|  2.35k|    return value;
  871|  2.36k|  }
  872|  6.07k|}
jv_parse_sized_custom_flags:
  874|  4.44k|jv jv_parse_sized_custom_flags(const char* string, int length, int flags) {
  875|  4.44k|  struct jv_parser parser;
  876|  4.44k|  parser_init(&parser, flags);
  877|  4.44k|  jv_parser_set_buf(&parser, string, length, 0);
  878|  4.44k|  jv value = jv_parser_next(&parser);
  879|  4.44k|  if (jv_is_valid(value)) {
  ------------------
  |  Branch (879:7): [True: 3.18k, False: 1.26k]
  ------------------
  880|  3.18k|    jv next = jv_parser_next(&parser);
  881|  3.18k|    if (jv_is_valid(next)) {
  ------------------
  |  Branch (881:9): [True: 289, False: 2.89k]
  ------------------
  882|       |      // multiple JSON values, we only wanted one
  883|    289|      jv_free(value);
  884|    289|      jv_free(next);
  885|    289|      value = jv_invalid_with_msg(jv_string("Unexpected extra JSON values"));
  886|  2.89k|    } else if (jv_invalid_has_msg(jv_copy(next))) {
  ------------------
  |  Branch (886:16): [True: 330, False: 2.56k]
  ------------------
  887|       |      // parser error after the first JSON value
  888|    330|      jv_free(value);
  889|    330|      value = next;
  890|  2.56k|    } else {
  891|       |      // a single valid JSON value
  892|  2.56k|      jv_free(next);
  893|  2.56k|    }
  894|  3.18k|  } else if (jv_invalid_has_msg(jv_copy(value))) {
  ------------------
  |  Branch (894:14): [True: 1.19k, False: 63]
  ------------------
  895|       |    // parse error, we'll return it
  896|  1.19k|  } else {
  897|       |    // no value at all
  898|     63|    jv_free(value);
  899|     63|    value = jv_invalid_with_msg(jv_string("Expected JSON value"));
  900|     63|  }
  901|  4.44k|  parser_free(&parser);
  902|       |
  903|  4.44k|  if (!jv_is_valid(value) && jv_invalid_has_msg(jv_copy(value))) {
  ------------------
  |  Branch (903:7): [True: 1.88k, False: 2.56k]
  |  Branch (903:30): [True: 1.88k, False: 0]
  ------------------
  904|  1.88k|    jv msg = jv_invalid_get_msg(value);
  905|  1.88k|    value = jv_invalid_with_msg(jv_string_fmt("%s (while parsing '%.*s')",
  906|  1.88k|                                              jv_string_value(msg),
  907|  1.88k|                                              length,
  908|  1.88k|                                              string));
  909|  1.88k|    jv_free(msg);
  910|  1.88k|  }
  911|  4.44k|  return value;
  912|  4.44k|}
jv_parse_custom_flags:
  922|  4.44k|jv jv_parse_custom_flags(const char* string, int flags) {
  923|  4.44k|  return jv_parse_sized_custom_flags(string, strlen(string), flags);
  924|  4.44k|}
jv_parse.c:parser_init:
   70|  4.44k|static void parser_init(struct jv_parser* p, int flags) {
   71|  4.44k|  p->flags = flags;
   72|  4.44k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (72:7): [True: 1.33k, False: 3.11k]
  ------------------
   73|  1.33k|    p->path = jv_array();
   74|  3.11k|  } else {
   75|  3.11k|    p->path = jv_invalid();
   76|  3.11k|    p->flags &= ~(JV_PARSE_STREAM_ERRORS);
   77|  3.11k|  }
   78|  4.44k|  p->stack = 0;
   79|  4.44k|  p->stacklen = p->stackpos = 0;
   80|  4.44k|  p->last_seen = JV_LAST_NONE;
   81|  4.44k|  p->output = jv_invalid();
   82|  4.44k|  p->next = jv_invalid();
   83|  4.44k|  p->tokenlen = 256;
   84|  4.44k|  p->tokenbuf = jv_mem_alloc(p->tokenlen);
   85|  4.44k|  p->tokenpos = 0;
   86|  4.44k|  if ((p->flags & JV_PARSE_SEQ))
  ------------------
  |  Branch (86:7): [True: 313, False: 4.13k]
  ------------------
   87|    313|    p->st = JV_PARSER_WAITING_FOR_RS;
   88|  4.13k|  else
   89|  4.13k|    p->st = JV_PARSER_NORMAL;
   90|  4.44k|  p->eof = 0;
   91|  4.44k|  p->curr_buf = 0;
   92|  4.44k|  p->curr_buf_length = p->curr_buf_pos = p->curr_buf_is_partial = 0;
   93|  4.44k|  p->bom_strip_position = 0;
   94|  4.44k|  p->last_ch_was_ws = 0;
   95|  4.44k|  p->line = 1;
   96|  4.44k|  p->column = 0;
   97|  4.44k|  jvp_dtoa_context_init(&p->dtoa);
   98|  4.44k|}
jv_parse.c:parser_free:
  118|  4.44k|static void parser_free(struct jv_parser* p) {
  119|  4.44k|  parser_reset(p);
  120|  4.44k|  jv_free(p->path);
  121|  4.44k|  jv_free(p->output);
  122|  4.44k|  jv_mem_free(p->stack);
  123|  4.44k|  jv_mem_free(p->tokenbuf);
  124|  4.44k|  jvp_dtoa_context_free(&p->dtoa);
  125|  4.44k|}
jv_parse.c:parser_reset:
  100|  6.57k|static void parser_reset(struct jv_parser* p) {
  101|  6.57k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (101:7): [True: 2.20k, False: 4.36k]
  ------------------
  102|  2.20k|    jv_free(p->path);
  103|  2.20k|    p->path = jv_array();
  104|  2.20k|    p->stacklen = 0;
  105|  2.20k|  }
  106|  6.57k|  p->last_seen = JV_LAST_NONE;
  107|  6.57k|  jv_free(p->output);
  108|  6.57k|  p->output = jv_invalid();
  109|  6.57k|  jv_free(p->next);
  110|  6.57k|  p->next = jv_invalid();
  111|   405k|  for (int i=0; i<p->stackpos; i++)
  ------------------
  |  Branch (111:17): [True: 398k, False: 6.57k]
  ------------------
  112|   398k|    jv_free(p->stack[i]);
  113|  6.57k|  p->stackpos = 0;
  114|  6.57k|  p->tokenpos = 0;
  115|  6.57k|  p->st = JV_PARSER_NORMAL;
  116|  6.57k|}
jv_parse.c:stream_check_done:
  603|  62.5M|static int stream_check_done(struct jv_parser* p, jv* out) {
  604|  62.5M|  if (p->stacklen == 0 && jv_is_valid(p->next)) {
  ------------------
  |  Branch (604:7): [True: 28.2M, False: 34.2M]
  |  Branch (604:27): [True: 209, False: 28.2M]
  ------------------
  605|    209|    *out = JV_ARRAY(jv_copy(p->path),p->next);
  ------------------
  |  |  111|    209|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|    209|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    209|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    209|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    209|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  606|    209|    p->next = jv_invalid();
  607|    209|    return 1;
  608|  62.5M|  } else if (jv_is_valid(p->output)) {
  ------------------
  |  Branch (608:14): [True: 255, False: 62.5M]
  ------------------
  609|    255|    if (jv_array_length(jv_copy(p->output)) > 2) {
  ------------------
  |  Branch (609:9): [True: 12, False: 243]
  ------------------
  610|       |      // At end of an array or object, necessitating one more output by
  611|       |      // which to indicate this
  612|     12|      *out = jv_array_slice(jv_copy(p->output), 0, 2);
  613|     12|      p->output = jv_array_slice(p->output, 0, 1);      // arrange one more output
  614|    243|    } else {
  615|       |      // No further processing needed
  616|    243|      *out = p->output;
  617|    243|      p->output = jv_invalid();
  618|    243|    }
  619|    255|    return 1;
  620|  62.5M|  } else {
  621|  62.5M|    return 0;
  622|  62.5M|  }
  623|  62.5M|}
jv_parse.c:scan:
  654|  81.1M|static pfunc scan(struct jv_parser* p, char ch, jv* out) {
  655|  81.1M|  p->column++;
  656|  81.1M|  if (ch == '\n') {
  ------------------
  |  Branch (656:7): [True: 4.55k, False: 81.1M]
  ------------------
  657|  4.55k|    p->line++;
  658|  4.55k|    p->column = 0;
  659|  4.55k|  }
  660|  81.1M|  if ((p->flags & JV_PARSE_SEQ)
  ------------------
  |  Branch (660:7): [True: 6.00M, False: 75.1M]
  ------------------
  661|  6.00M|      && ch == '\036' /* ASCII RS; see draft-ietf-json-sequence-07 */) {
  ------------------
  |  Branch (661:10): [True: 107, False: 6.00M]
  ------------------
  662|    107|    if (check_truncation(p)) {
  ------------------
  |  |  649|    107|   (((p)->flags & JV_PARSE_STREAMING) ? stream_seq_check_truncation((p)) : seq_check_truncation((p)))
  |  |  ------------------
  |  |  |  Branch (649:4): [True: 67, False: 40]
  |  |  |  Branch (649:5): [True: 50, False: 57]
  |  |  ------------------
  ------------------
  663|     67|      if (check_literal(p) == 0 && is_top_num(p))
  ------------------
  |  |  652|     43|   (((p)->flags & JV_PARSE_STREAMING) ? stream_is_top_num((p)) : parse_is_top_num((p)))
  |  |  ------------------
  |  |  |  Branch (652:4): [True: 1, False: 42]
  |  |  |  Branch (652:5): [True: 23, False: 20]
  |  |  ------------------
  ------------------
  |  Branch (663:11): [True: 43, False: 24]
  ------------------
  664|      1|        return "Potentially truncated top-level numeric value";
  665|     66|      return "Truncated value";
  666|     67|    }
  667|     40|    TRY(check_literal(p));
  ------------------
  |  |   18|     40|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 16, False: 24]
  |  |  |  Branch (18:74): [Folded, False: 24]
  |  |  ------------------
  ------------------
  668|     24|    if (p->st == JV_PARSER_NORMAL && check_done(p, out))
  ------------------
  |  |  643|     23|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 3, False: 20]
  |  |  |  Branch (643:5): [True: 6, False: 17]
  |  |  ------------------
  ------------------
  |  Branch (668:9): [True: 23, False: 1]
  ------------------
  669|      3|      return OK;
  670|       |    // shouldn't happen?
  671|     24|    assert(!jv_is_valid(*out));
  ------------------
  |  Branch (671:5): [True: 0, False: 21]
  |  Branch (671:5): [True: 21, False: 0]
  ------------------
  672|     21|    parser_reset(p);
  673|     21|    jv_free(*out);
  674|     21|    *out = jv_invalid();
  675|     21|    return OK;
  676|     21|  }
  677|  81.1M|  presult answer = 0;
  678|  81.1M|  p->last_ch_was_ws = 0;
  679|  81.1M|  if (p->st == JV_PARSER_NORMAL) {
  ------------------
  |  Branch (679:7): [True: 62.4M, False: 18.7M]
  ------------------
  680|  62.4M|    chclass cls = classify(ch);
  681|  62.4M|    if (cls == WHITESPACE)
  ------------------
  |  Branch (681:9): [True: 3.21k, False: 62.4M]
  ------------------
  682|  3.21k|      p->last_ch_was_ws = 1;
  683|  62.4M|    if (cls != LITERAL) {
  ------------------
  |  Branch (683:9): [True: 18.1M, False: 44.2M]
  ------------------
  684|  18.1M|      TRY(check_literal(p));
  ------------------
  |  |   18|  18.1M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 44, False: 18.1M]
  |  |  |  Branch (18:74): [Folded, False: 18.1M]
  |  |  ------------------
  ------------------
  685|  18.1M|      if (check_done(p, out)) answer = OK;
  ------------------
  |  |  643|  18.1M|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 264, False: 18.1M]
  |  |  |  Branch (643:5): [True: 16.6M, False: 1.49M]
  |  |  ------------------
  ------------------
  686|  18.1M|    }
  687|  62.4M|    switch (cls) {
  ------------------
  |  Branch (687:13): [True: 62.4M, False: 0]
  ------------------
  688|  44.2M|    case LITERAL:
  ------------------
  |  Branch (688:5): [True: 44.2M, False: 18.1M]
  ------------------
  689|  44.2M|      TRY(tokenadd(p, ch));
  ------------------
  |  |   18|  44.2M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 0, False: 44.2M]
  |  |  |  Branch (18:74): [Folded, False: 44.2M]
  |  |  ------------------
  ------------------
  690|  44.2M|      break;
  691|  44.2M|    case WHITESPACE:
  ------------------
  |  Branch (691:5): [True: 3.21k, False: 62.4M]
  ------------------
  692|  3.21k|      break;
  693|  18.4k|    case QUOTE:
  ------------------
  |  Branch (693:5): [True: 18.4k, False: 62.4M]
  ------------------
  694|  18.4k|      p->st = JV_PARSER_STRING;
  695|  18.4k|      break;
  696|  18.1M|    case STRUCTURE:
  ------------------
  |  Branch (696:5): [True: 18.1M, False: 44.3M]
  ------------------
  697|  18.1M|      TRY(token(p, ch));
  ------------------
  |  |   18|  36.2M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:37): [True: 16.6M, False: 1.47M]
  |  |  |  Branch (18:45): [True: 210, False: 18.1M]
  |  |  |  Branch (18:74): [Folded, False: 18.1M]
  |  |  ------------------
  ------------------
  698|  18.1M|      break;
  699|  18.1M|    case INVALID:
  ------------------
  |  Branch (699:5): [True: 0, False: 62.4M]
  ------------------
  700|      0|      return "Invalid character";
  701|  62.4M|    }
  702|  62.4M|    if (check_done(p, out)) answer = OK;
  ------------------
  |  |  643|  62.4M|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 1.01k, False: 62.4M]
  |  |  |  Branch (643:5): [True: 45.8M, False: 16.5M]
  |  |  ------------------
  ------------------
  703|  62.4M|  } else {
  704|  18.7M|    if (ch == '"' && p->st == JV_PARSER_STRING) {
  ------------------
  |  Branch (704:9): [True: 18.8k, False: 18.7M]
  |  Branch (704:22): [True: 18.3k, False: 488]
  ------------------
  705|  18.3k|      TRY(found_string(p));
  ------------------
  |  |   18|  18.3k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 200, False: 18.1k]
  |  |  |  Branch (18:74): [Folded, False: 18.1k]
  |  |  ------------------
  ------------------
  706|  18.1k|      p->st = JV_PARSER_NORMAL;
  707|  18.1k|      if (check_done(p, out)) answer = OK;
  ------------------
  |  |  643|  18.1k|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 352, False: 17.8k]
  |  |  |  Branch (643:5): [True: 1.70k, False: 16.4k]
  |  |  ------------------
  ------------------
  708|  18.7M|    } else {
  709|  18.7M|      TRY(tokenadd(p, ch));
  ------------------
  |  |   18|  18.7M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 0, False: 18.7M]
  |  |  |  Branch (18:74): [Folded, False: 18.7M]
  |  |  ------------------
  ------------------
  710|  18.7M|      if (ch == '\\' && p->st == JV_PARSER_STRING) {
  ------------------
  |  Branch (710:11): [True: 11.9k, False: 18.7M]
  |  Branch (710:25): [True: 9.39k, False: 2.57k]
  ------------------
  711|  9.39k|        p->st = JV_PARSER_STRING_ESCAPE;
  712|  18.7M|      } else {
  713|  18.7M|        p->st = JV_PARSER_STRING;
  714|  18.7M|      }
  715|  18.7M|    }
  716|  18.7M|  }
  717|  81.1M|  return answer;
  718|  81.1M|}
jv_parse.c:stream_seq_check_truncation:
  629|     50|static int stream_seq_check_truncation(struct jv_parser* p) {
  630|     50|  jv_kind k = jv_get_kind(p->next);
  631|     50|  return (p->stacklen > 0 || k == JV_KIND_NUMBER || k == JV_KIND_TRUE || k == JV_KIND_FALSE || k == JV_KIND_NULL);
  ------------------
  |  Branch (631:11): [True: 27, False: 23]
  |  Branch (631:30): [True: 0, False: 23]
  |  Branch (631:53): [True: 0, False: 23]
  |  Branch (631:74): [True: 0, False: 23]
  |  Branch (631:96): [True: 0, False: 23]
  ------------------
  632|     50|}
jv_parse.c:seq_check_truncation:
  625|     57|static int seq_check_truncation(struct jv_parser* p) {
  626|     57|  return (!p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER));
  ------------------
  |  Branch (626:11): [True: 41, False: 16]
  |  Branch (626:34): [True: 17, False: 24]
  |  Branch (626:53): [True: 23, False: 1]
  |  Branch (626:72): [True: 0, False: 1]
  ------------------
  627|     57|}
jv_parse.c:stream_is_top_num:
  638|     23|static int stream_is_top_num(struct jv_parser* p) {
  639|     23|  return (p->stacklen == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER);
  ------------------
  |  Branch (639:11): [True: 0, False: 23]
  |  Branch (639:31): [True: 0, False: 0]
  ------------------
  640|     23|}
jv_parse.c:parse_is_top_num:
  634|     20|static int parse_is_top_num(struct jv_parser* p) {
  635|     20|  return (p->stackpos == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER);
  ------------------
  |  Branch (635:11): [True: 3, False: 17]
  |  Branch (635:31): [True: 1, False: 2]
  ------------------
  636|     20|}
jv_parse.c:parse_check_done:
  593|  18.1M|static int parse_check_done(struct jv_parser* p, jv* out) {
  594|  18.1M|  if (p->stackpos == 0 && jv_is_valid(p->next)) {
  ------------------
  |  Branch (594:7): [True: 8.26M, False: 9.83M]
  |  Branch (594:27): [True: 1.17k, False: 8.26M]
  ------------------
  595|  1.17k|    *out = p->next;
  596|  1.17k|    p->next = jv_invalid();
  597|  1.17k|    return 1;
  598|  18.1M|  } else {
  599|  18.1M|    return 0;
  600|  18.1M|  }
  601|  18.1M|}
jv_parse.c:classify:
  564|  62.4M|static chclass classify(char c) {
  565|  62.4M|  switch (c) {
  566|      0|  case '\0':
  ------------------
  |  Branch (566:3): [True: 0, False: 62.4M]
  ------------------
  567|       |    // RFC 8259 forbids raw NUL in JSON text. Treating it as a literal lets it
  568|       |    // slip into the token buffer, where check_literal() reads the buffer as a
  569|       |    // NUL-terminated C string and silently truncates the token. Reject it.
  570|      0|    return INVALID;
  571|    250|  case ' ':
  ------------------
  |  Branch (571:3): [True: 250, False: 62.4M]
  ------------------
  572|    605|  case '\t':
  ------------------
  |  Branch (572:3): [True: 355, False: 62.4M]
  ------------------
  573|    847|  case '\r':
  ------------------
  |  Branch (573:3): [True: 242, False: 62.4M]
  ------------------
  574|  3.21k|  case '\n':
  ------------------
  |  Branch (574:3): [True: 2.36k, False: 62.4M]
  ------------------
  575|  3.21k|    return WHITESPACE;
  576|  18.4k|  case '"':
  ------------------
  |  Branch (576:3): [True: 18.4k, False: 62.4M]
  ------------------
  577|  18.4k|    return QUOTE;
  578|  17.1M|  case '[':
  ------------------
  |  Branch (578:3): [True: 17.1M, False: 45.3M]
  ------------------
  579|  17.8M|  case ',':
  ------------------
  |  Branch (579:3): [True: 752k, False: 61.6M]
  ------------------
  580|  18.0M|  case ']':
  ------------------
  |  Branch (580:3): [True: 145k, False: 62.2M]
  ------------------
  581|  18.0M|  case '{':
  ------------------
  |  Branch (581:3): [True: 67.5k, False: 62.3M]
  ------------------
  582|  18.1M|  case ':':
  ------------------
  |  Branch (582:3): [True: 16.9k, False: 62.4M]
  ------------------
  583|  18.1M|  case '}':
  ------------------
  |  Branch (583:3): [True: 11.3k, False: 62.4M]
  ------------------
  584|  18.1M|    return STRUCTURE;
  585|  44.2M|  default:
  ------------------
  |  Branch (585:3): [True: 44.2M, False: 18.1M]
  ------------------
  586|  44.2M|    return LITERAL;
  587|  62.4M|  }
  588|  62.4M|}
jv_parse.c:tokenadd:
  423|  63.0M|static pfunc tokenadd(struct jv_parser* p, char c) {
  424|  63.0M|  assert(p->tokenpos <= p->tokenlen);
  ------------------
  |  Branch (424:3): [True: 0, False: 63.0M]
  |  Branch (424:3): [True: 63.0M, False: 0]
  ------------------
  425|  63.0M|  if (p->tokenpos >= (p->tokenlen - 1)) {
  ------------------
  |  Branch (425:7): [True: 2.68k, False: 63.0M]
  ------------------
  426|  2.68k|    if (p->tokenlen > INT_MAX / 2)
  ------------------
  |  Branch (426:9): [True: 0, False: 2.68k]
  ------------------
  427|      0|      return "Token too long";
  428|  2.68k|    p->tokenlen *= 2;
  429|  2.68k|    p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen);
  430|  2.68k|  }
  431|  63.0M|  assert(p->tokenpos < p->tokenlen);
  ------------------
  |  Branch (431:3): [True: 0, False: 63.0M]
  |  Branch (431:3): [True: 63.0M, False: 0]
  ------------------
  432|  63.0M|  p->tokenbuf[p->tokenpos++] = c;
  433|  63.0M|  return 0;
  434|  63.0M|}
jv_parse.c:stream_token:
  243|  16.6M|static pfunc stream_token(struct jv_parser* p, char ch) {
  244|  16.6M|  jv_kind k;
  245|  16.6M|  jv last;
  246|       |
  247|  16.6M|  switch (ch) {
  ------------------
  |  Branch (247:11): [True: 16.6M, False: 0]
  ------------------
  248|  16.6M|  case '[':
  ------------------
  |  Branch (248:3): [True: 16.6M, False: 2.42k]
  ------------------
  249|  16.6M|    if (jv_is_valid(p->next))
  ------------------
  |  Branch (249:9): [True: 7, False: 16.6M]
  ------------------
  250|      7|      return "Expected a separator between values";
  251|  16.6M|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (251:9): [True: 7, False: 16.6M]
  ------------------
  252|       |      // Looks like {["foo"]}
  253|      7|      return "Expected string key after '{', not '['";
  254|  16.6M|    if (p->last_seen == JV_LAST_COMMA) {
  ------------------
  |  Branch (254:9): [True: 12, False: 16.6M]
  ------------------
  255|     12|      last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  256|     12|      k = jv_get_kind(last);
  257|     12|      jv_free(last);
  258|     12|      if (k != JV_KIND_NUMBER)
  ------------------
  |  Branch (258:11): [True: 1, False: 11]
  ------------------
  259|       |        // Looks like {"x":"y",["foo"]}
  260|      1|        return "Expected string key after ',' in object, not '['";
  261|     12|    }
  262|  16.6M|    p->path = jv_array_append(p->path, jv_number(0)); // push
  263|  16.6M|    p->last_seen = JV_LAST_OPEN_ARRAY;
  264|  16.6M|    p->stacklen++;
  265|  16.6M|    break;
  266|       |
  267|    531|  case '{':
  ------------------
  |  Branch (267:3): [True: 531, False: 16.6M]
  ------------------
  268|    531|    if (p->last_seen == JV_LAST_VALUE)
  ------------------
  |  Branch (268:9): [True: 4, False: 527]
  ------------------
  269|      4|      return "Expected a separator between values";
  270|    527|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (270:9): [True: 3, False: 524]
  ------------------
  271|       |      // Looks like {{"foo":"bar"}}
  272|      3|      return "Expected string key after '{', not '{'";
  273|    524|    if (p->last_seen == JV_LAST_COMMA) {
  ------------------
  |  Branch (273:9): [True: 3, False: 521]
  ------------------
  274|      3|      last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  275|      3|      k = jv_get_kind(last);
  276|      3|      jv_free(last);
  277|      3|      if (k != JV_KIND_NUMBER)
  ------------------
  |  Branch (277:11): [True: 1, False: 2]
  ------------------
  278|       |        // Looks like {"x":"y",{"foo":"bar"}}
  279|      1|        return "Expected string key after ',' in object, not '{'";
  280|      3|    }
  281|       |    // Push object key: null, since we don't know it yet
  282|    523|    p->path = jv_array_append(p->path, jv_null()); // push
  283|    523|    p->last_seen = JV_LAST_OPEN_OBJECT;
  284|    523|    p->stacklen++;
  285|    523|    break;
  286|       |
  287|  1.55k|  case ':':
  ------------------
  |  Branch (287:3): [True: 1.55k, False: 16.6M]
  ------------------
  288|  1.55k|    last = jv_invalid();
  289|  1.55k|    if (p->stacklen == 0 || jv_get_kind(last = jv_array_get(jv_copy(p->path), p->stacklen - 1)) == JV_KIND_NUMBER) {
  ------------------
  |  Branch (289:9): [True: 11, False: 1.54k]
  |  Branch (289:29): [True: 8, False: 1.53k]
  ------------------
  290|     19|      jv_free(last);
  291|     19|      return "':' not as part of an object";
  292|     19|    }
  293|  1.53k|    jv_free(last);
  294|  1.53k|    if (!jv_is_valid(p->next) || p->last_seen == JV_LAST_NONE)
  ------------------
  |  Branch (294:9): [True: 13, False: 1.52k]
  |  Branch (294:34): [True: 0, False: 1.52k]
  ------------------
  295|     13|      return "Expected string key before ':'";
  296|  1.52k|    if (jv_get_kind(p->next) != JV_KIND_STRING)
  ------------------
  |  Branch (296:9): [True: 6, False: 1.51k]
  ------------------
  297|      6|      return "Object keys must be strings";
  298|  1.51k|    if (p->last_seen != JV_LAST_VALUE)
  ------------------
  |  Branch (298:9): [True: 0, False: 1.51k]
  ------------------
  299|      0|      return "':' should follow a key";
  300|  1.51k|    p->last_seen = JV_LAST_COLON;
  301|  1.51k|    p->path = jv_array_set(p->path, p->stacklen - 1, p->next);
  302|  1.51k|    p->next = jv_invalid();
  303|  1.51k|    break;
  304|       |
  305|    119|  case ',':
  ------------------
  |  Branch (305:3): [True: 119, False: 16.6M]
  ------------------
  306|    119|    if (p->last_seen != JV_LAST_VALUE)
  ------------------
  |  Branch (306:9): [True: 15, False: 104]
  ------------------
  307|     15|      return "Expected value before ','";
  308|    104|    if (p->stacklen == 0)
  ------------------
  |  Branch (308:9): [True: 0, False: 104]
  ------------------
  309|      0|      return "',' not as part of an object or array";
  310|    104|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  311|    104|    k = jv_get_kind(last);
  312|    104|    if (k == JV_KIND_NUMBER) {
  ------------------
  |  Branch (312:9): [True: 76, False: 28]
  ------------------
  313|     76|      int idx = jv_number_value(last);
  314|       |
  315|     76|      if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (315:11): [True: 60, False: 16]
  ------------------
  316|     60|        p->output = JV_ARRAY(jv_copy(p->path), p->next);
  ------------------
  |  |  111|     60|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|     60|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     60|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|     60|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     60|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|     60|        p->next = jv_invalid();
  318|     60|      }
  319|     76|      p->path = jv_array_set(p->path, p->stacklen - 1, jv_number(idx + 1));
  320|     76|      p->last_seen = JV_LAST_COMMA;
  321|     76|    } else if (k == JV_KIND_STRING) {
  ------------------
  |  Branch (321:16): [True: 25, False: 3]
  ------------------
  322|     25|      if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (322:11): [True: 11, False: 14]
  ------------------
  323|     11|        p->output = JV_ARRAY(jv_copy(p->path), p->next);
  ------------------
  |  |  111|     11|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|     11|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     11|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|     11|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     11|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  324|     11|        p->next = jv_invalid();
  325|     11|      }
  326|     25|      p->path = jv_array_set(p->path, p->stacklen - 1, jv_null()); // ready for another key:value pair
  327|     25|      p->last_seen = JV_LAST_COMMA;
  328|     25|    } else {
  329|      3|      assert(k == JV_KIND_NULL);
  ------------------
  |  Branch (329:7): [True: 0, False: 3]
  |  Branch (329:7): [True: 3, False: 0]
  ------------------
  330|       |      // this case hits on input like {,}
  331|       |      // make sure to handle input like {"a", "b"} and {"a":, ...}
  332|      3|      jv_free(last);
  333|      3|      return "Objects must consist of key:value pairs";
  334|      3|    }
  335|    101|    jv_free(last);
  336|    101|    break;
  337|       |
  338|    111|  case ']':
  ------------------
  |  Branch (338:3): [True: 111, False: 16.6M]
  ------------------
  339|    111|    if (p->stacklen == 0)
  ------------------
  |  Branch (339:9): [True: 7, False: 104]
  ------------------
  340|      7|      return "Unmatched ']' at the top-level";
  341|    104|    if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (341:9): [True: 3, False: 101]
  ------------------
  342|      3|      return "Expected another array element";
  343|    101|    if (p->last_seen == JV_LAST_OPEN_ARRAY)
  ------------------
  |  Branch (343:9): [True: 87, False: 14]
  ------------------
  344|    101|      assert(!jv_is_valid(p->next));
  ------------------
  |  Branch (344:7): [True: 0, False: 87]
  |  Branch (344:7): [True: 87, False: 0]
  ------------------
  345|       |
  346|    101|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  347|    101|    k = jv_get_kind(last);
  348|    101|    jv_free(last);
  349|       |
  350|    101|    if (k != JV_KIND_NUMBER)
  ------------------
  |  Branch (350:9): [True: 4, False: 97]
  ------------------
  351|      4|      return "Unmatched ']' in the middle of an object";
  352|     97|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (352:9): [True: 9, False: 88]
  ------------------
  353|      9|      p->output = JV_ARRAY(jv_copy(p->path), p->next, jv_true());
  ------------------
  |  |  111|      9|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|      9|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      9|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      9|#define JV_ARRAY_3(e1,e2,e3) (jv_array_append(JV_ARRAY_2(e1,e2),e3))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      9|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  100|      9|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  354|      9|      p->next = jv_invalid();
  355|     88|    } else if (p->last_seen != JV_LAST_OPEN_ARRAY) {
  ------------------
  |  Branch (355:16): [True: 1, False: 87]
  ------------------
  356|      1|      p->output = JV_ARRAY(jv_copy(p->path));
  ------------------
  |  |  111|      1|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|      1|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      1|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  100|      1|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  357|      1|    }
  358|       |
  359|     97|    p->path = jv_array_slice(p->path, 0, --(p->stacklen)); // pop
  360|       |    //assert(!jv_is_valid(p->next));
  361|     97|    jv_free(p->next);
  362|     97|    p->next = jv_invalid();
  363|       |
  364|     97|    if (p->last_seen == JV_LAST_OPEN_ARRAY)
  ------------------
  |  Branch (364:9): [True: 87, False: 10]
  ------------------
  365|     87|      p->output = JV_ARRAY(jv_copy(p->path), jv_array()); // Empty arrays are leaves
  ------------------
  |  |  111|     87|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|     87|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     87|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|     87|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     87|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  366|       |
  367|     97|    if (p->stacklen == 0)
  ------------------
  |  Branch (367:9): [True: 12, False: 85]
  ------------------
  368|     12|      p->last_seen = JV_LAST_NONE;
  369|     85|    else
  370|     85|      p->last_seen = JV_LAST_VALUE;
  371|     97|    break;
  372|       |
  373|    103|  case '}':
  ------------------
  |  Branch (373:3): [True: 103, False: 16.6M]
  ------------------
  374|    103|    if (p->stacklen == 0)
  ------------------
  |  Branch (374:9): [True: 8, False: 95]
  ------------------
  375|      8|      return "Unmatched '}' at the top-level";
  376|     95|    if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (376:9): [True: 1, False: 94]
  ------------------
  377|      1|      return "Expected another key:value pair";
  378|     94|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (378:9): [True: 79, False: 15]
  ------------------
  379|     94|      assert(!jv_is_valid(p->next));
  ------------------
  |  Branch (379:7): [True: 0, False: 79]
  |  Branch (379:7): [True: 79, False: 0]
  ------------------
  380|       |
  381|     94|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  382|     94|    k = jv_get_kind(last);
  383|     94|    jv_free(last);
  384|     94|    if (k == JV_KIND_NUMBER)
  ------------------
  |  Branch (384:9): [True: 4, False: 90]
  ------------------
  385|      4|      return "Unmatched '}' in the middle of an array";
  386|       |
  387|     90|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (387:9): [True: 7, False: 83]
  ------------------
  388|      7|      if (k != JV_KIND_STRING)
  ------------------
  |  Branch (388:11): [True: 4, False: 3]
  ------------------
  389|      4|        return "Objects must consist of key:value pairs";
  390|      3|      p->output = JV_ARRAY(jv_copy(p->path), p->next, jv_true());
  ------------------
  |  |  111|      3|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|      3|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      3|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  102|      3|#define JV_ARRAY_3(e1,e2,e3) (jv_array_append(JV_ARRAY_2(e1,e2),e3))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  101|      3|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  |  |  100|      3|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  391|      3|      p->next = jv_invalid();
  392|     83|    } else {
  393|       |      // Perhaps {"a":[]}
  394|     83|      if (p->last_seen == JV_LAST_COLON)
  ------------------
  |  Branch (394:11): [True: 3, False: 80]
  ------------------
  395|       |        // Looks like {"a":}
  396|      3|        return "Missing value in key:value pair";
  397|     80|      if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (397:11): [True: 0, False: 80]
  ------------------
  398|       |        // Looks like {"a":0,}
  399|      0|        return "Expected another key-value pair";
  400|     80|      if (p->last_seen == JV_LAST_OPEN_ARRAY)
  ------------------
  |  Branch (400:11): [True: 0, False: 80]
  ------------------
  401|      0|        return "Unmatched '}' in the middle of an array";
  402|     80|      if (p->last_seen != JV_LAST_VALUE && p->last_seen != JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (402:11): [True: 79, False: 1]
  |  Branch (402:44): [True: 0, False: 79]
  ------------------
  403|      0|        return "Unmatched '}'";
  404|     80|      if (p->last_seen != JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (404:11): [True: 1, False: 79]
  ------------------
  405|      1|        p->output = JV_ARRAY(jv_copy(p->path));
  ------------------
  |  |  111|      1|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|      1|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|      1|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  100|      1|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  406|     80|    }
  407|     83|    p->path = jv_array_slice(p->path, 0, --(p->stacklen)); // pop
  408|     83|    jv_free(p->next);
  409|     83|    p->next = jv_invalid();
  410|       |
  411|     83|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (411:9): [True: 79, False: 4]
  ------------------
  412|     79|      p->output = JV_ARRAY(jv_copy(p->path), jv_object()); // Empty arrays are leaves
  ------------------
  |  |  111|     79|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|     79|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     79|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|     79|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     79|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  413|       |
  414|     83|    if (p->stacklen == 0)
  ------------------
  |  Branch (414:9): [True: 14, False: 69]
  ------------------
  415|     14|      p->last_seen = JV_LAST_NONE;
  416|     69|    else
  417|     69|      p->last_seen = JV_LAST_VALUE;
  418|     83|    break;
  419|  16.6M|  }
  420|  16.6M|  return 0;
  421|  16.6M|}
jv_parse.c:parse_token:
  158|  1.47M|static pfunc parse_token(struct jv_parser* p, char ch) {
  159|  1.47M|  switch (ch) {
  ------------------
  |  Branch (159:11): [True: 1.47M, False: 0]
  ------------------
  160|   486k|  case '[':
  ------------------
  |  Branch (160:3): [True: 486k, False: 991k]
  ------------------
  161|   486k|    if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing";
  ------------------
  |  |   15|   486k|#define MAX_PARSING_DEPTH (10000)
  ------------------
  |  Branch (161:9): [True: 2, False: 486k]
  ------------------
  162|   486k|    if (jv_is_valid(p->next)) return "Expected separator between values";
  ------------------
  |  Branch (162:9): [True: 16, False: 486k]
  ------------------
  163|   486k|    push(p, jv_array());
  164|   486k|    break;
  165|       |
  166|  67.0k|  case '{':
  ------------------
  |  Branch (166:3): [True: 67.0k, False: 1.41M]
  ------------------
  167|  67.0k|    if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing";
  ------------------
  |  |   15|  67.0k|#define MAX_PARSING_DEPTH (10000)
  ------------------
  |  Branch (167:9): [True: 1, False: 67.0k]
  ------------------
  168|  67.0k|    if (jv_is_valid(p->next)) return "Expected separator between values";
  ------------------
  |  Branch (168:9): [True: 4, False: 67.0k]
  ------------------
  169|  67.0k|    push(p, jv_object());
  170|  67.0k|    break;
  171|       |
  172|  15.3k|  case ':':
  ------------------
  |  Branch (172:3): [True: 15.3k, False: 1.46M]
  ------------------
  173|  15.3k|    if (!jv_is_valid(p->next))
  ------------------
  |  Branch (173:9): [True: 8, False: 15.3k]
  ------------------
  174|      8|      return "Expected string key before ':'";
  175|  15.3k|    if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT)
  ------------------
  |  Branch (175:9): [True: 0, False: 15.3k]
  |  Branch (175:29): [True: 3, False: 15.3k]
  ------------------
  176|      3|      return "':' not as part of an object";
  177|  15.3k|    if (jv_get_kind(p->next) != JV_KIND_STRING)
  ------------------
  |  Branch (177:9): [True: 7, False: 15.3k]
  ------------------
  178|      7|      return "Object keys must be strings";
  179|  15.3k|    push(p, p->next);
  180|  15.3k|    p->next = jv_invalid();
  181|  15.3k|    break;
  182|       |
  183|   752k|  case ',':
  ------------------
  |  Branch (183:3): [True: 752k, False: 725k]
  ------------------
  184|   752k|    if (!jv_is_valid(p->next))
  ------------------
  |  Branch (184:9): [True: 12, False: 752k]
  ------------------
  185|     12|      return "Expected value before ','";
  186|   752k|    if (p->stackpos == 0)
  ------------------
  |  Branch (186:9): [True: 0, False: 752k]
  ------------------
  187|      0|      return "',' not as part of an object or array";
  188|   752k|    if (jv_get_kind(p->stack[p->stackpos-1]) == JV_KIND_ARRAY) {
  ------------------
  |  Branch (188:9): [True: 740k, False: 12.0k]
  ------------------
  189|   740k|      p->stack[p->stackpos-1] = jv_array_append(p->stack[p->stackpos-1], p->next);
  190|   740k|      p->next = jv_invalid();
  191|   740k|    } else if (jv_get_kind(p->stack[p->stackpos-1]) == JV_KIND_STRING) {
  ------------------
  |  Branch (191:16): [True: 12.0k, False: 6]
  ------------------
  192|  12.0k|      assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT);
  ------------------
  |  Branch (192:7): [True: 0, False: 12.0k]
  |  Branch (192:7): [True: 0, False: 0]
  |  Branch (192:7): [True: 12.0k, False: 0]
  |  Branch (192:7): [True: 12.0k, False: 0]
  ------------------
  193|  12.0k|      p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2],
  194|  12.0k|                                              p->stack[p->stackpos-1], p->next);
  195|  12.0k|      p->stackpos--;
  196|  12.0k|      p->next = jv_invalid();
  197|  12.0k|    } else {
  198|       |      // this case hits on input like {"a", "b"}
  199|      6|      return "Objects must consist of key:value pairs";
  200|      6|    }
  201|   752k|    break;
  202|       |
  203|   752k|  case ']':
  ------------------
  |  Branch (203:3): [True: 144k, False: 1.33M]
  ------------------
  204|   144k|    if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_ARRAY)
  ------------------
  |  Branch (204:9): [True: 8, False: 144k]
  |  Branch (204:29): [True: 4, False: 144k]
  ------------------
  205|     12|      return "Unmatched ']'";
  206|   144k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (206:9): [True: 144k, False: 452]
  ------------------
  207|   144k|      p->stack[p->stackpos-1] = jv_array_append(p->stack[p->stackpos-1], p->next);
  208|   144k|      p->next = jv_invalid();
  209|   144k|    } else {
  210|    452|      if (jv_array_length(jv_copy(p->stack[p->stackpos-1])) != 0) {
  ------------------
  |  Branch (210:11): [True: 2, False: 450]
  ------------------
  211|       |        // this case hits on input like [1,2,3,]
  212|      2|        return "Expected another array element";
  213|      2|      }
  214|    452|    }
  215|   144k|    jv_free(p->next);
  216|   144k|    p->next = p->stack[--p->stackpos];
  217|   144k|    break;
  218|       |
  219|  11.2k|  case '}':
  ------------------
  |  Branch (219:3): [True: 11.2k, False: 1.46M]
  ------------------
  220|  11.2k|    if (p->stackpos == 0)
  ------------------
  |  Branch (220:9): [True: 6, False: 11.2k]
  ------------------
  221|      6|      return "Unmatched '}'";
  222|  11.2k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (222:9): [True: 1.69k, False: 9.58k]
  ------------------
  223|  1.69k|      if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_STRING)
  ------------------
  |  Branch (223:11): [True: 11, False: 1.68k]
  ------------------
  224|     11|        return "Objects must consist of key:value pairs";
  225|  1.69k|      assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT);
  ------------------
  |  Branch (225:7): [True: 0, False: 1.68k]
  |  Branch (225:7): [True: 0, False: 0]
  |  Branch (225:7): [True: 1.68k, False: 0]
  |  Branch (225:7): [True: 1.68k, False: 0]
  ------------------
  226|  1.68k|      p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2],
  227|  1.68k|                                              p->stack[p->stackpos-1], p->next);
  228|  1.68k|      p->stackpos--;
  229|  1.68k|      p->next = jv_invalid();
  230|  9.58k|    } else {
  231|  9.58k|      if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT)
  ------------------
  |  Branch (231:11): [True: 6, False: 9.58k]
  ------------------
  232|      6|        return "Unmatched '}'";
  233|  9.58k|      if (jv_object_length(jv_copy(p->stack[p->stackpos-1])) != 0)
  ------------------
  |  Branch (233:11): [True: 1, False: 9.57k]
  ------------------
  234|      1|        return "Expected another key-value pair";
  235|  9.58k|    }
  236|  11.2k|    jv_free(p->next);
  237|  11.2k|    p->next = p->stack[--p->stackpos];
  238|  11.2k|    break;
  239|  1.47M|  }
  240|  1.47M|  return 0;
  241|  1.47M|}
jv_parse.c:push:
  148|   568k|static void push(struct jv_parser* p, jv v) {
  149|   568k|  assert(p->stackpos <= p->stacklen);
  ------------------
  |  Branch (149:3): [True: 0, False: 568k]
  |  Branch (149:3): [True: 568k, False: 0]
  ------------------
  150|   568k|  if (p->stackpos == p->stacklen) {
  ------------------
  |  Branch (150:7): [True: 2.95k, False: 565k]
  ------------------
  151|  2.95k|    p->stacklen = p->stacklen * 2 + 10;
  152|  2.95k|    p->stack = jv_mem_realloc(p->stack, p->stacklen * sizeof(jv));
  153|  2.95k|  }
  154|   568k|  assert(p->stackpos < p->stacklen);
  ------------------
  |  Branch (154:3): [True: 0, False: 568k]
  |  Branch (154:3): [True: 568k, False: 0]
  ------------------
  155|   568k|  p->stack[p->stackpos++] = v;
  156|   568k|}
jv_parse.c:found_string:
  451|  18.3k|static pfunc found_string(struct jv_parser* p) {
  452|  18.3k|  char* in = p->tokenbuf;
  453|  18.3k|  char* out = p->tokenbuf;
  454|  18.3k|  char* end = p->tokenbuf + p->tokenpos;
  455|       |
  456|  10.4M|  while (in < end) {
  ------------------
  |  Branch (456:10): [True: 10.4M, False: 18.1k]
  ------------------
  457|  10.4M|    char c = *in++;
  458|  10.4M|    if (c == '\\') {
  ------------------
  |  Branch (458:9): [True: 5.18k, False: 10.4M]
  ------------------
  459|  5.18k|      if (in >= end)
  ------------------
  |  Branch (459:11): [True: 0, False: 5.18k]
  ------------------
  460|      0|        return "Expected escape character at end of string";
  461|  5.18k|      c = *in++;
  462|  5.18k|      switch (c) {
  463|  1.31k|      case '\\':
  ------------------
  |  Branch (463:7): [True: 1.31k, False: 3.87k]
  ------------------
  464|  1.64k|      case '"':
  ------------------
  |  Branch (464:7): [True: 329, False: 4.85k]
  ------------------
  465|  1.94k|      case '/': *out++ = c;    break;
  ------------------
  |  Branch (465:7): [True: 304, False: 4.88k]
  ------------------
  466|    225|      case 'b': *out++ = '\b'; break;
  ------------------
  |  Branch (466:7): [True: 225, False: 4.95k]
  ------------------
  467|    423|      case 'f': *out++ = '\f'; break;
  ------------------
  |  Branch (467:7): [True: 423, False: 4.76k]
  ------------------
  468|    256|      case 't': *out++ = '\t'; break;
  ------------------
  |  Branch (468:7): [True: 256, False: 4.92k]
  ------------------
  469|    359|      case 'n': *out++ = '\n'; break;
  ------------------
  |  Branch (469:7): [True: 359, False: 4.82k]
  ------------------
  470|    360|      case 'r': *out++ = '\r'; break;
  ------------------
  |  Branch (470:7): [True: 360, False: 4.82k]
  ------------------
  471|       |
  472|  1.61k|      case 'u':
  ------------------
  |  Branch (472:7): [True: 1.61k, False: 3.57k]
  ------------------
  473|       |        /* ahh, the complicated case */
  474|  1.61k|        if (in + 4 > end)
  ------------------
  |  Branch (474:13): [True: 3, False: 1.60k]
  ------------------
  475|      3|          return "Invalid \\uXXXX escape";
  476|  1.60k|        int hexvalue = unhex4(in);
  477|  1.60k|        if (hexvalue < 0)
  ------------------
  |  Branch (477:13): [True: 29, False: 1.57k]
  ------------------
  478|     29|          return "Invalid characters in \\uXXXX escape";
  479|  1.57k|        unsigned long codepoint = (unsigned long)hexvalue;
  480|  1.57k|        in += 4;
  481|  1.57k|        if (0xD800 <= codepoint && codepoint <= 0xDBFF) {
  ------------------
  |  Branch (481:13): [True: 1.07k, False: 509]
  |  Branch (481:36): [True: 496, False: 574]
  ------------------
  482|       |          /* who thought UTF-16 surrogate pairs were a good idea? */
  483|    496|          if (in + 6 > end || in[0] != '\\' || in[1] != 'u')
  ------------------
  |  Branch (483:15): [True: 14, False: 482]
  |  Branch (483:31): [True: 9, False: 473]
  |  Branch (483:48): [True: 15, False: 458]
  ------------------
  484|     38|            return "Invalid \\uXXXX\\uXXXX surrogate pair escape";
  485|    458|          unsigned long surrogate = unhex4(in+2);
  486|    458|          if (!(0xDC00 <= surrogate && surrogate <= 0xDFFF))
  ------------------
  |  Branch (486:17): [True: 430, False: 28]
  |  Branch (486:40): [True: 403, False: 27]
  ------------------
  487|     55|            return "Invalid \\uXXXX\\uXXXX surrogate pair escape";
  488|    403|          in += 6;
  489|    403|          codepoint = 0x10000 + (((codepoint - 0xD800) << 10)
  490|    403|                                 |(surrogate - 0xDC00));
  491|    403|        }
  492|  1.48k|        if (codepoint > 0x10FFFF)
  ------------------
  |  Branch (492:13): [True: 0, False: 1.48k]
  ------------------
  493|      0|          codepoint = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
  494|  1.48k|        out += jvp_utf8_encode(codepoint, out);
  495|  1.48k|        break;
  496|       |
  497|      3|      default:
  ------------------
  |  Branch (497:7): [True: 3, False: 5.18k]
  ------------------
  498|      3|        return "Invalid escape";
  499|  5.18k|      }
  500|  10.4M|    } else {
  501|  10.4M|      if (!(c & ~0x1F))
  ------------------
  |  Branch (501:11): [True: 51, False: 10.4M]
  ------------------
  502|     51|        return "Invalid string: control characters from U+0000 through U+001F must be escaped";
  503|  10.4M|      *out++ = c;
  504|  10.4M|    }
  505|  10.4M|  }
  506|  18.1k|  TRY(value(p, jv_string_sized(p->tokenbuf, out - p->tokenbuf)));
  ------------------
  |  |   18|  18.1k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 21, False: 18.1k]
  |  |  |  Branch (18:74): [Folded, False: 18.1k]
  |  |  ------------------
  ------------------
  507|  18.1k|  p->tokenpos = 0;
  508|  18.1k|  return 0;
  509|  18.1k|}
jv_parse.c:unhex4:
  436|  2.06k|static int unhex4(char* hex) {
  437|  2.06k|  int r = 0;
  438|  10.2k|  for (int i=0; i<4; i++) {
  ------------------
  |  Branch (438:17): [True: 8.18k, False: 2.01k]
  ------------------
  439|  8.18k|    char c = *hex++;
  440|  8.18k|    int n;
  441|  8.18k|    if ('0' <= c && c <= '9') n = c - '0';
  ------------------
  |  Branch (441:9): [True: 8.16k, False: 28]
  |  Branch (441:21): [True: 3.24k, False: 4.91k]
  ------------------
  442|  4.94k|    else if ('a' <= c && c <= 'f') n = c - 'a' + 10;
  ------------------
  |  Branch (442:14): [True: 2.44k, False: 2.49k]
  |  Branch (442:26): [True: 2.43k, False: 10]
  ------------------
  443|  2.50k|    else if ('A' <= c && c <= 'F') n = c - 'A' + 10;
  ------------------
  |  Branch (443:14): [True: 2.47k, False: 34]
  |  Branch (443:26): [True: 2.45k, False: 19]
  ------------------
  444|     53|    else return -1;
  445|  8.13k|    r <<= 4;
  446|  8.13k|    r |= n;
  447|  8.13k|  }
  448|  2.01k|  return r;
  449|  2.06k|}
jv_parse.c:value:
  127|   762k|static pfunc value(struct jv_parser* p, jv val) {
  128|   762k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (128:7): [True: 2.29k, False: 760k]
  ------------------
  129|  2.29k|    if (jv_is_valid(p->next) || p->last_seen == JV_LAST_VALUE) {
  ------------------
  |  Branch (129:9): [True: 20, False: 2.27k]
  |  Branch (129:33): [True: 2, False: 2.27k]
  ------------------
  130|     22|      jv_free(val);
  131|     22|      return "Expected separator between values";
  132|     22|    }
  133|  2.27k|    if (p->stacklen > 0)
  ------------------
  |  Branch (133:9): [True: 1.68k, False: 594]
  ------------------
  134|  1.68k|      p->last_seen = JV_LAST_VALUE;
  135|    594|    else
  136|    594|      p->last_seen = JV_LAST_NONE;
  137|   760k|  } else {
  138|   760k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (138:9): [True: 15, False: 760k]
  ------------------
  139|     15|      jv_free(val);
  140|     15|      return "Expected separator between values";
  141|     15|    }
  142|   760k|  }
  143|   762k|  jv_free(p->next);
  144|   762k|  p->next = val;
  145|   762k|  return 0;
  146|   762k|}
jv_parse.c:make_error:
  767|  2.06k|static jv make_error(struct jv_parser* p, const char *fmt, ...) {
  768|  2.06k|  va_list ap;
  769|  2.06k|  va_start(ap, fmt);
  770|  2.06k|  jv e = jv_string_vfmt(fmt, ap);
  771|  2.06k|  va_end(ap);
  772|  2.06k|  if ((p->flags & JV_PARSE_STREAM_ERRORS))
  ------------------
  |  Branch (772:7): [True: 561, False: 1.50k]
  ------------------
  773|    561|    return JV_ARRAY(e, jv_copy(p->path));
  ------------------
  |  |  111|    561|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  ------------------
  |  |  |  |  109|    561|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    561|  JV_ARRAY_IDX(__VA_ARGS__, JV_ARRAY_9, JV_ARRAY_8, JV_ARRAY_7, JV_ARRAY_6, JV_ARRAY_5, JV_ARRAY_4, JV_ARRAY_3, JV_ARRAY_2, JV_ARRAY_1, dummy)(__VA_ARGS__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  101|    561|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    561|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|  1.50k|  return jv_invalid_with_msg(e);
  775|  2.06k|}
jv_parse.c:check_literal:
  511|  18.1M|static pfunc check_literal(struct jv_parser* p) {
  512|  18.1M|  if (p->tokenpos == 0) return 0;
  ------------------
  |  Branch (512:7): [True: 17.4M, False: 745k]
  ------------------
  513|       |
  514|   745k|  const char* pattern = 0;
  515|   745k|  int plen;
  516|   745k|  jv v;
  517|   745k|  switch (p->tokenbuf[0]) {
  ------------------
  |  Branch (517:11): [True: 2.06k, False: 743k]
  ------------------
  518|    300|  case 't': pattern = "true"; plen = 4; v = jv_true(); break;
  ------------------
  |  Branch (518:3): [True: 300, False: 744k]
  ------------------
  519|    926|  case 'f': pattern = "false"; plen = 5; v = jv_false(); break;
  ------------------
  |  Branch (519:3): [True: 926, False: 744k]
  ------------------
  520|      6|  case '\'':
  ------------------
  |  Branch (520:3): [True: 6, False: 745k]
  ------------------
  521|      6|    return "Invalid string literal; expected \", but got '";
  522|    835|  case 'n':
  ------------------
  |  Branch (522:3): [True: 835, False: 744k]
  ------------------
  523|       |    // if it starts with 'n', it could be a literal "nan"
  524|    835|    if (p->tokenpos > 1 && p->tokenbuf[1] == 'u') {
  ------------------
  |  Branch (524:9): [True: 828, False: 7]
  |  Branch (524:28): [True: 273, False: 555]
  ------------------
  525|    273|      pattern = "null"; plen = 4; v = jv_null();
  526|    273|    }
  527|   745k|  }
  528|   745k|  if (pattern) {
  ------------------
  |  Branch (528:7): [True: 1.49k, False: 743k]
  ------------------
  529|  1.49k|    if (p->tokenpos != plen) return "Invalid literal";
  ------------------
  |  Branch (529:9): [True: 55, False: 1.44k]
  ------------------
  530|  8.09k|    for (int i=0; i<plen; i++)
  ------------------
  |  Branch (530:19): [True: 6.67k, False: 1.42k]
  ------------------
  531|  6.67k|      if (p->tokenbuf[i] != pattern[i])
  ------------------
  |  Branch (531:11): [True: 15, False: 6.65k]
  ------------------
  532|     15|        return "Invalid literal";
  533|  1.42k|    TRY(value(p, v));
  ------------------
  |  |   18|  1.42k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 3, False: 1.42k]
  |  |  |  Branch (18:74): [Folded, False: 1.42k]
  |  |  ------------------
  ------------------
  534|   743k|  } else {
  535|       |    // FIXME: better parser
  536|   743k|    p->tokenbuf[p->tokenpos] = 0;
  537|   743k|#ifdef USE_DECNUM
  538|   743k|    jv number = jv_number_with_literal(p->tokenbuf);
  539|   743k|    if (jv_get_kind(number) == JV_KIND_INVALID) {
  ------------------
  |  Branch (539:9): [True: 545, False: 743k]
  ------------------
  540|    545|      return "Invalid numeric literal";
  541|    545|    }
  542|   743k|    TRY(value(p, number));
  ------------------
  |  |   18|   743k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 13, False: 743k]
  |  |  |  Branch (18:74): [Folded, False: 743k]
  |  |  ------------------
  ------------------
  543|       |#else
  544|       |    char *end = 0;
  545|       |    double d = jvp_strtod(&p->dtoa, p->tokenbuf, &end);
  546|       |    if (end == 0 || *end != 0) {
  547|       |      return "Invalid numeric literal";
  548|       |    }
  549|       |    TRY(value(p, jv_number(d)));
  550|       |#endif
  551|   743k|  }
  552|   744k|  p->tokenpos = 0;
  553|   744k|  return 0;
  554|   745k|}

jv_dumpf:
  389|  2.56k|void jv_dumpf(jv x, FILE *f, int flags) {
  390|  2.56k|  jv_dump_term(tsd_dtoa_context_get(), x, flags, 0, f, 0);
  391|  2.56k|}
jv_dump:
  393|  2.56k|void jv_dump(jv x, int flags) {
  394|       |  jv_dumpf(x, stdout, flags);
  395|  2.56k|}
jv_print.c:jv_dump_term:
  219|  7.16M|static void jv_dump_term(struct dtoa_context* C, jv x, int flags, int indent, FILE* F, jv* S) {
  220|  7.16M|  char buf[JVP_DTOA_FMT_MAX_LEN];
  221|  7.16M|  const char* color = 0;
  222|  7.16M|  double refcnt = (flags & JV_PRINT_REFCOUNT) ? jv_get_refcnt(x) - 1 : -1;
  ------------------
  |  Branch (222:19): [True: 1.67M, False: 5.49M]
  ------------------
  223|  7.16M|  if ((flags & JV_PRINT_COLOR) && jv_get_kind(x) != JV_KIND_INVALID) {
  ------------------
  |  Branch (223:7): [True: 1.68M, False: 5.48M]
  |  Branch (223:35): [True: 1.68M, False: 0]
  ------------------
  224|  1.68M|    color = colors[(int)jv_get_kind(x) - 1];
  225|  1.68M|    put_str(color, F, S, flags & JV_PRINT_ISATTY);
  226|  1.68M|  }
  227|  7.16M|  if (indent > MAX_PRINT_DEPTH) {
  ------------------
  |  |   21|  7.16M|#define MAX_PRINT_DEPTH (10000)
  ------------------
  |  Branch (227:7): [True: 0, False: 7.16M]
  ------------------
  228|      0|    put_str("<skipped: too deep>", F, S, flags & JV_PRINT_ISATTY);
  229|  7.16M|  } else switch (jv_get_kind(x)) {
  230|      0|  default:
  ------------------
  |  Branch (230:3): [True: 0, False: 7.16M]
  ------------------
  231|      0|  case JV_KIND_INVALID:
  ------------------
  |  Branch (231:3): [True: 0, False: 7.16M]
  ------------------
  232|      0|    if (flags & JV_PRINT_INVALID) {
  ------------------
  |  Branch (232:9): [True: 0, False: 0]
  ------------------
  233|      0|      jv msg = jv_invalid_get_msg(jv_copy(x));
  234|      0|      if (jv_get_kind(msg) == JV_KIND_STRING) {
  ------------------
  |  Branch (234:11): [True: 0, False: 0]
  ------------------
  235|      0|        put_str("<invalid:", F, S, flags & JV_PRINT_ISATTY);
  236|      0|        jvp_dump_string(msg, flags | JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
  237|      0|        put_char('>', F, S, flags & JV_PRINT_ISATTY);
  238|      0|      } else {
  239|      0|        put_str("<invalid>", F, S, flags & JV_PRINT_ISATTY);
  240|      0|      }
  241|      0|    } else {
  242|      0|      assert(0 && "Invalid value");
  ------------------
  |  Branch (242:7): [Folded, False: 0]
  |  Branch (242:7): [True: 0, False: 0]
  |  Branch (242:7): [Folded, False: 0]
  |  Branch (242:7): [True: 0, False: 0]
  ------------------
  243|      0|    }
  244|      0|    break;
  245|    296|  case JV_KIND_NULL:
  ------------------
  |  Branch (245:3): [True: 296, False: 7.16M]
  ------------------
  246|    296|    put_str("null", F, S, flags & JV_PRINT_ISATTY);
  247|    296|    break;
  248|    594|  case JV_KIND_FALSE:
  ------------------
  |  Branch (248:3): [True: 594, False: 7.16M]
  ------------------
  249|    594|    put_str("false", F, S, flags & JV_PRINT_ISATTY);
  250|    594|    break;
  251|    196|  case JV_KIND_TRUE:
  ------------------
  |  Branch (251:3): [True: 196, False: 7.16M]
  ------------------
  252|    196|    put_str("true", F, S, flags & JV_PRINT_ISATTY);
  253|    196|    break;
  254|  7.01M|  case JV_KIND_NUMBER: {
  ------------------
  |  Branch (254:3): [True: 7.01M, False: 150k]
  ------------------
  255|  7.01M|    if (jvp_number_is_nan(x)) {
  ------------------
  |  Branch (255:9): [True: 270, False: 7.01M]
  ------------------
  256|    270|      jv_dump_term(C, jv_null(), flags, indent, F, S);
  257|  7.01M|    } else {
  258|  7.01M|#ifdef USE_DECNUM
  259|  7.01M|      const char * literal_data = jv_number_get_literal(x);
  260|  7.01M|      if (literal_data) {
  ------------------
  |  Branch (260:11): [True: 8.13k, False: 7.00M]
  ------------------
  261|  8.13k|        put_str(literal_data, F, S, flags & JV_PRINT_ISATTY);
  262|  7.00M|      } else {
  263|  7.00M|#endif
  264|  7.00M|        double d = jv_number_value(x);
  265|  7.00M|        if (d != d) {
  ------------------
  |  Branch (265:13): [True: 0, False: 7.00M]
  ------------------
  266|       |          // JSON doesn't have NaN, so we'll render it as "null"
  267|      0|          put_str("null", F, S, flags & JV_PRINT_ISATTY);
  268|  7.00M|        } else {
  269|       |          // Normalise infinities to something we can print in valid JSON
  270|  7.00M|          if (d > DBL_MAX) d = DBL_MAX;
  ------------------
  |  Branch (270:15): [True: 4.99k, False: 7.00M]
  ------------------
  271|  7.00M|          if (d < -DBL_MAX) d = -DBL_MAX;
  ------------------
  |  Branch (271:15): [True: 204, False: 7.00M]
  ------------------
  272|  7.00M|          put_str(jvp_dtoa_fmt(C, buf, d), F, S, flags & JV_PRINT_ISATTY);
  273|  7.00M|        }
  274|  7.00M|      }
  275|  7.01M|#ifdef USE_DECNUM
  276|  7.01M|    }
  277|  7.01M|#endif
  278|  7.01M|    break;
  279|      0|  }
  280|  1.30k|  case JV_KIND_STRING:
  ------------------
  |  Branch (280:3): [True: 1.30k, False: 7.16M]
  ------------------
  281|  1.30k|    jvp_dump_string(x, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
  282|  1.30k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (282:9): [True: 625, False: 680]
  ------------------
  283|    625|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  284|  1.30k|    break;
  285|   146k|  case JV_KIND_ARRAY: {
  ------------------
  |  Branch (285:3): [True: 146k, False: 7.01M]
  ------------------
  286|   146k|    if (jv_array_length(jv_copy(x)) == 0) {
  ------------------
  |  Branch (286:9): [True: 881, False: 145k]
  ------------------
  287|    881|      put_str("[]", F, S, flags & JV_PRINT_ISATTY);
  288|    881|      break;
  289|    881|    }
  290|   145k|    put_char('[', F, S, flags & JV_PRINT_ISATTY);
  291|  7.15M|    jv_array_foreach(x, i, elem) {
  ------------------
  |  |   93|   145k|  for (int jv_len__ = jv_array_length(jv_copy(a)), i=0, jv_j__ = 1;     \
  |  |   94|   290k|       jv_j__; jv_j__ = 0)                                              \
  |  |  ------------------
  |  |  |  Branch (94:8): [True: 145k, False: 145k]
  |  |  ------------------
  |  |   95|   145k|    for (jv x;                                                          \
  |  |   96|  7.30M|         i < jv_len__ ?                                                 \
  |  |  ------------------
  |  |  |  Branch (96:10): [True: 7.15M, False: 145k]
  |  |  |  Branch (96:10): [True: 7.15M, False: 145k]
  |  |  ------------------
  |  |   97|  7.30M|           (x = jv_array_get(jv_copy(a), i), 1) : 0;                    \
  |  |   98|  7.15M|         i++)
  ------------------
  292|  7.15M|      if (i!=0) {
  ------------------
  |  Branch (292:11): [True: 7.01M, False: 145k]
  ------------------
  293|  7.01M|        if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (293:13): [True: 1.65M, False: 5.36M]
  ------------------
  294|  7.01M|        put_char(',', F, S, flags & JV_PRINT_ISATTY);
  295|  7.01M|      }
  296|  7.15M|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  1.67M|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  1.67M|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (296:11): [True: 1.67M, False: 5.47M]
  ------------------
  297|  7.15M|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (297:11): [True: 5.93M, False: 1.22M]
  ------------------
  298|  5.93M|        put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  299|  5.93M|        put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY);
  300|  5.93M|      }
  301|  7.15M|      jv_dump_term(C, elem, flags, indent + 1, F, S);
  302|  7.15M|    }
  303|   145k|    if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (303:9): [True: 123k, False: 22.0k]
  ------------------
  304|   123k|      put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  305|   123k|      put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY);
  306|   123k|    }
  307|   145k|    if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (307:9): [True: 28.9k, False: 116k]
  ------------------
  308|   145k|    put_char(']', F, S, flags & JV_PRINT_ISATTY);
  309|   145k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (309:9): [True: 16.4k, False: 128k]
  ------------------
  310|  16.4k|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  311|   145k|    break;
  312|   146k|  }
  313|  1.89k|  case JV_KIND_OBJECT: {
  ------------------
  |  Branch (313:3): [True: 1.89k, False: 7.16M]
  ------------------
  314|  1.89k|    if (jv_object_length(jv_copy(x)) == 0) {
  ------------------
  |  Branch (314:9): [True: 404, False: 1.49k]
  ------------------
  315|    404|      put_str("{}", F, S, flags & JV_PRINT_ISATTY);
  316|    404|      break;
  317|    404|    }
  318|  1.49k|    put_char('{', F, S, flags & JV_PRINT_ISATTY);
  319|  1.49k|    int first = 1;
  320|  1.49k|    int i = 0;
  321|  1.49k|    jv keyset = jv_null();
  322|  6.79k|    while (1) {
  ------------------
  |  Branch (322:12): [True: 6.79k, Folded]
  ------------------
  323|  6.79k|      jv key, value;
  324|  6.79k|      if (flags & JV_PRINT_SORTED) {
  ------------------
  |  Branch (324:11): [True: 5.46k, False: 1.33k]
  ------------------
  325|  5.46k|        if (first) {
  ------------------
  |  Branch (325:13): [True: 985, False: 4.47k]
  ------------------
  326|    985|          keyset = jv_keys(jv_copy(x));
  327|    985|          i = 0;
  328|  4.47k|        } else {
  329|  4.47k|          i++;
  330|  4.47k|        }
  331|  5.46k|        if (i >= jv_array_length(jv_copy(keyset))) {
  ------------------
  |  Branch (331:13): [True: 985, False: 4.47k]
  ------------------
  332|    985|          jv_free(keyset);
  333|    985|          break;
  334|    985|        }
  335|  4.47k|        key = jv_array_get(jv_copy(keyset), i);
  336|  4.47k|        value = jv_object_get(jv_copy(x), jv_copy(key));
  337|  4.47k|      } else {
  338|  1.33k|        if (first) {
  ------------------
  |  Branch (338:13): [True: 505, False: 825]
  ------------------
  339|    505|          i = jv_object_iter(x);
  340|    825|        } else {
  341|    825|          i = jv_object_iter_next(x, i);
  342|    825|        }
  343|  1.33k|        if (!jv_object_iter_valid(x, i)) break;
  ------------------
  |  Branch (343:13): [True: 505, False: 825]
  ------------------
  344|    825|        key = jv_object_iter_key(x, i);
  345|    825|        value = jv_object_iter_value(x, i);
  346|    825|      }
  347|       |
  348|  5.30k|      if (!first) {
  ------------------
  |  Branch (348:11): [True: 3.81k, False: 1.49k]
  ------------------
  349|  3.81k|        if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (349:13): [True: 3.13k, False: 680]
  ------------------
  350|  3.81k|        put_char(',', F, S, flags & JV_PRINT_ISATTY);
  351|  3.81k|      }
  352|  5.30k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  4.06k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  4.06k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (352:11): [True: 4.06k, False: 1.24k]
  ------------------
  353|  5.30k|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (353:11): [True: 3.95k, False: 1.34k]
  ------------------
  354|  3.95k|        put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  355|  3.95k|        put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY);
  356|  3.95k|      }
  357|       |
  358|  5.30k|      first = 0;
  359|  5.30k|      if (color) put_str(FIELD_COLOR, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   37|  4.06k|#define FIELD_COLOR (colors[7])
  ------------------
  |  Branch (359:11): [True: 4.06k, False: 1.24k]
  ------------------
  360|  5.30k|      jvp_dump_string(key, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
  361|  5.30k|      jv_free(key);
  362|  5.30k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  4.06k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  4.06k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (362:11): [True: 4.06k, False: 1.24k]
  ------------------
  363|       |
  364|  5.30k|      if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (364:11): [True: 4.06k, False: 1.24k]
  ------------------
  365|  5.30k|      put_char(':', F, S, flags & JV_PRINT_ISATTY);
  366|  5.30k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  4.06k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  4.06k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (366:11): [True: 4.06k, False: 1.24k]
  ------------------
  367|  5.30k|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (367:11): [True: 3.95k, False: 1.34k]
  ------------------
  368|  3.95k|        put_char(' ', F, S, flags & JV_PRINT_ISATTY);
  369|  3.95k|      }
  370|       |
  371|  5.30k|      jv_dump_term(C, value, flags, indent + 1, F, S);
  372|  5.30k|    }
  373|  1.49k|    if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (373:9): [True: 770, False: 720]
  ------------------
  374|    770|      put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  375|    770|      put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY);
  376|    770|    }
  377|  1.49k|    if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (377:9): [True: 927, False: 563]
  ------------------
  378|  1.49k|    put_char('}', F, S, flags & JV_PRINT_ISATTY);
  379|  1.49k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (379:9): [True: 848, False: 642]
  ------------------
  380|    848|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  381|  1.49k|  }
  382|  7.16M|  }
  383|  7.16M|  jv_free(x);
  384|  7.16M|  if (color) {
  ------------------
  |  Branch (384:7): [True: 1.68M, False: 5.48M]
  ------------------
  385|  1.68M|    put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  1.68M|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  1.68M|#define ESC "\033"
  |  |  ------------------
  ------------------
  386|  1.68M|  }
  387|  7.16M|}
jv_print.c:put_str:
  129|  16.6M|static void put_str(const char* s, FILE* fout, jv* strout, int T) {
  130|  16.6M|  put_buf(s, strlen(s), fout, strout, T);
  131|  16.6M|}
jv_print.c:put_buf:
   98|  1.02G|static void put_buf(const char *s, int len, FILE *fout, jv *strout, int is_tty) {
   99|  1.02G|  if (strout) {
  ------------------
  |  Branch (99:7): [True: 0, False: 1.02G]
  ------------------
  100|      0|    *strout = jv_string_append_buf(*strout, s, len);
  101|  1.02G|  } else {
  102|       |#ifdef WIN32
  103|       |  /* See util.h */
  104|       |  if (is_tty) {
  105|       |    wchar_t *ws;
  106|       |    size_t wl;
  107|       |    if (len == -1)
  108|       |      len = strlen(s);
  109|       |    wl = MultiByteToWideChar(CP_UTF8, 0, s, len, NULL, 0);
  110|       |    ws = jv_mem_calloc(wl + 1, sizeof(*ws));
  111|       |    if (!ws)
  112|       |      return;
  113|       |    wl = MultiByteToWideChar(CP_UTF8, 0, s, len, ws, wl + 1);
  114|       |    ws[wl] = 0;
  115|       |    WriteConsoleW((HANDLE)_get_osfhandle(fileno(fout)), ws, wl, NULL, NULL);
  116|       |    free(ws);
  117|       |  } else
  118|       |    fwrite(s, 1, len, fout);
  119|       |#else
  120|  1.02G|  fwrite(s, 1, len, fout);
  121|  1.02G|#endif
  122|  1.02G|  }
  123|  1.02G|}
jv_print.c:jvp_dump_string:
  144|  6.60k|static void jvp_dump_string(jv str, int ascii_only, FILE* F, jv* S, int T) {
  145|  6.60k|  assert(jv_get_kind(str) == JV_KIND_STRING);
  ------------------
  |  Branch (145:3): [True: 0, False: 6.60k]
  |  Branch (145:3): [True: 6.60k, False: 0]
  ------------------
  146|  6.60k|  const char* i = jv_string_value(str);
  147|  6.60k|  const char* end = i + jv_string_length_bytes(jv_copy(str));
  148|  6.60k|  const char* cstart;
  149|  6.60k|  int c = 0;
  150|  6.60k|  char buf[32];
  151|  6.60k|  put_char('"', F, S, T);
  152|  6.59M|  while ((i = jvp_utf8_next((cstart = i), end, &c))) {
  ------------------
  |  Branch (152:10): [True: 6.58M, False: 6.60k]
  ------------------
  153|  6.58M|    assert(c != -1);
  ------------------
  |  Branch (153:5): [True: 0, False: 6.58M]
  |  Branch (153:5): [True: 6.58M, False: 0]
  ------------------
  154|  6.58M|    int unicode_escape = 0;
  155|  6.58M|    if (0x20 <= c && c <= 0x7E) {
  ------------------
  |  Branch (155:9): [True: 6.58M, False: 1.51k]
  |  Branch (155:22): [True: 654k, False: 5.92M]
  ------------------
  156|       |      // printable ASCII
  157|   654k|      if (c == '"' || c == '\\') {
  ------------------
  |  Branch (157:11): [True: 204, False: 654k]
  |  Branch (157:23): [True: 1.07k, False: 653k]
  ------------------
  158|  1.28k|        put_char('\\', F, S, T);
  159|  1.28k|      }
  160|   654k|      put_char(c, F, S, T);
  161|  5.92M|    } else if (c < 0x20 || c == 0x7F) {
  ------------------
  |  Branch (161:16): [True: 1.51k, False: 5.92M]
  |  Branch (161:28): [True: 347, False: 5.92M]
  ------------------
  162|       |      // ASCII control character
  163|  1.86k|      switch (c) {
  164|    222|      case '\b':
  ------------------
  |  Branch (164:7): [True: 222, False: 1.64k]
  ------------------
  165|    222|        put_char('\\', F, S, T);
  166|    222|        put_char('b', F, S, T);
  167|    222|        break;
  168|    210|      case '\t':
  ------------------
  |  Branch (168:7): [True: 210, False: 1.65k]
  ------------------
  169|    210|        put_char('\\', F, S, T);
  170|    210|        put_char('t', F, S, T);
  171|    210|        break;
  172|    276|      case '\r':
  ------------------
  |  Branch (172:7): [True: 276, False: 1.58k]
  ------------------
  173|    276|        put_char('\\', F, S, T);
  174|    276|        put_char('r', F, S, T);
  175|    276|        break;
  176|    258|      case '\n':
  ------------------
  |  Branch (176:7): [True: 258, False: 1.60k]
  ------------------
  177|    258|        put_char('\\', F, S, T);
  178|    258|        put_char('n', F, S, T);
  179|    258|        break;
  180|    227|      case '\f':
  ------------------
  |  Branch (180:7): [True: 227, False: 1.63k]
  ------------------
  181|    227|        put_char('\\', F, S, T);
  182|    227|        put_char('f', F, S, T);
  183|    227|        break;
  184|    672|      default:
  ------------------
  |  Branch (184:7): [True: 672, False: 1.19k]
  ------------------
  185|    672|        unicode_escape = 1;
  186|    672|        break;
  187|  1.86k|      }
  188|  5.92M|    } else {
  189|  5.92M|      if (ascii_only) {
  ------------------
  |  Branch (189:11): [True: 2.87M, False: 3.05M]
  ------------------
  190|  2.87M|        unicode_escape = 1;
  191|  3.05M|      } else {
  192|  3.05M|        put_buf(cstart, i - cstart, F, S, T);
  193|  3.05M|      }
  194|  5.92M|    }
  195|  6.58M|    if (unicode_escape) {
  ------------------
  |  Branch (195:9): [True: 2.87M, False: 3.70M]
  ------------------
  196|  2.87M|      if (c <= 0xffff) {
  ------------------
  |  Branch (196:11): [True: 2.87M, False: 548]
  ------------------
  197|  2.87M|        snprintf(buf, sizeof(buf), "\\u%04x", c);
  198|  2.87M|      } else {
  199|    548|        c -= 0x10000;
  200|    548|        snprintf(buf, sizeof(buf), "\\u%04x\\u%04x",
  201|    548|                0xD800 | ((c & 0xffc00) >> 10),
  202|    548|                0xDC00 | (c & 0x003ff));
  203|    548|      }
  204|  2.87M|      put_str(buf, F, S, T);
  205|  2.87M|    }
  206|  6.58M|  }
  207|  6.60k|  assert(c != -1);
  ------------------
  |  Branch (207:3): [True: 0, False: 6.60k]
  |  Branch (207:3): [True: 6.60k, False: 0]
  ------------------
  208|  6.60k|  put_char('"', F, S, T);
  209|  6.60k|}
jv_print.c:put_char:
  125|  1.00G|static void put_char(char c, FILE* fout, jv* strout, int T) {
  126|  1.00G|  put_buf(&c, 1, fout, strout, T);
  127|  1.00G|}
jv_print.c:put_refcnt:
  211|  17.9k|static void put_refcnt(struct dtoa_context* C, int refcnt, FILE *F, jv* S, int T){
  212|  17.9k|  char buf[JVP_DTOA_FMT_MAX_LEN];
  213|  17.9k|  put_char(' ', F, S, T);
  214|  17.9k|  put_char('(', F, S, T);
  215|  17.9k|  put_str(jvp_dtoa_fmt(C, buf, refcnt), F, S, T);
  216|  17.9k|  put_char(')', F, S, T);
  217|  17.9k|}
jv_print.c:put_indent:
  133|  6.06M|static void put_indent(int n, int flags, FILE* fout, jv* strout, int T) {
  134|  6.06M|  if (flags & JV_PRINT_TAB) {
  ------------------
  |  Branch (134:7): [True: 5.44M, False: 620k]
  ------------------
  135|   495M|    while (n--)
  ------------------
  |  Branch (135:12): [True: 490M, False: 5.44M]
  ------------------
  136|   490M|      put_char('\t', fout, strout, T);
  137|  5.44M|  } else {
  138|   620k|    n *= ((flags & (JV_PRINT_SPACE0 | JV_PRINT_SPACE1 | JV_PRINT_SPACE2)) >> 8);
  139|   502M|    while (n--)
  ------------------
  |  Branch (139:12): [True: 501M, False: 620k]
  ------------------
  140|   501M|      put_char(' ', fout, strout, T);
  141|   620k|  }
  142|  6.06M|}

jvp_utf8_next:
   30|  64.0M|const char* jvp_utf8_next(const char* in, const char* end, int* codepoint_ret) {
   31|  64.0M|  assert(in <= end);
  ------------------
  |  Branch (31:3): [True: 0, False: 64.0M]
  |  Branch (31:3): [True: 64.0M, False: 0]
  ------------------
   32|  64.0M|  if (in == end) {
  ------------------
  |  Branch (32:7): [True: 29.1k, False: 63.9M]
  ------------------
   33|  29.1k|    return 0;
   34|  29.1k|  }
   35|  63.9M|  int codepoint = -1;
   36|  63.9M|  unsigned char first = (unsigned char)in[0];
   37|  63.9M|  int length = utf8_coding_length[first];
   38|  63.9M|  if ((first & 0x80) == 0) {
  ------------------
  |  Branch (38:7): [True: 36.4M, False: 27.5M]
  ------------------
   39|       |    /* Fast-path for ASCII */
   40|  36.4M|    codepoint = first;
   41|  36.4M|    length = 1;
   42|  36.4M|  } else if (length == 0 || length == UTF8_CONTINUATION_BYTE) {
  ------------------
  |  |    1|  24.2M|#define UTF8_CONTINUATION_BYTE ((unsigned char)255)
  ------------------
  |  Branch (42:14): [True: 3.25M, False: 24.2M]
  |  Branch (42:29): [True: 17.5M, False: 6.68M]
  ------------------
   43|       |    /* Bad single byte - either an invalid byte or an out-of-place continuation byte */
   44|  20.8M|    length = 1;
   45|  20.8M|  } else if (length > end - in) {
  ------------------
  |  Branch (45:14): [True: 1.30k, False: 6.68M]
  ------------------
   46|       |    /* String ends before UTF8 sequence ends */
   47|  1.30k|    length = end - in;
   48|  6.68M|  } else {
   49|  6.68M|    codepoint = ((unsigned)in[0]) & utf8_coding_bits[first];
   50|  18.5M|    for (int i=1; i<length; i++) {
  ------------------
  |  Branch (50:19): [True: 12.6M, False: 5.94M]
  ------------------
   51|  12.6M|      unsigned ch = (unsigned char)in[i];
   52|  12.6M|      if (utf8_coding_length[ch] != UTF8_CONTINUATION_BYTE){
  ------------------
  |  |    1|  12.6M|#define UTF8_CONTINUATION_BYTE ((unsigned char)255)
  ------------------
  |  Branch (52:11): [True: 742k, False: 11.8M]
  ------------------
   53|       |        /* Invalid UTF8 sequence - not followed by the right number of continuation bytes */
   54|   742k|        codepoint = -1;
   55|   742k|        length = i;
   56|   742k|        break;
   57|   742k|      }
   58|  11.8M|      codepoint = (codepoint << 6) | (ch & 0x3f);
   59|  11.8M|    }
   60|  6.68M|    if (codepoint < utf8_first_codepoint[length]) {
  ------------------
  |  Branch (60:9): [True: 742k, False: 5.94M]
  ------------------
   61|       |      /* Overlong UTF8 sequence */
   62|   742k|      codepoint = -1;
   63|   742k|    }
   64|  6.68M|    if (0xD800 <= codepoint && codepoint <= 0xDFFF) {
  ------------------
  |  Branch (64:9): [True: 5.93M, False: 747k]
  |  Branch (64:32): [True: 462, False: 5.93M]
  ------------------
   65|       |      /* Surrogate codepoints can't be encoded in UTF8 */
   66|    462|      codepoint = -1;
   67|    462|    }
   68|  6.68M|    if (codepoint > 0x10FFFF) {
  ------------------
  |  Branch (68:9): [True: 207, False: 6.68M]
  ------------------
   69|       |      /* Outside Unicode range */
   70|    207|      codepoint = -1;
   71|    207|    }
   72|  6.68M|  }
   73|  63.9M|  assert(length > 0);
  ------------------
  |  Branch (73:3): [True: 0, False: 63.9M]
  |  Branch (73:3): [True: 63.9M, False: 0]
  ------------------
   74|  63.9M|  *codepoint_ret = codepoint;
   75|  63.9M|  return in + length;
   76|  63.9M|}
jvp_utf8_is_valid:
   78|  22.4k|int jvp_utf8_is_valid(const char* in, const char* end) {
   79|  22.4k|  int codepoint;
   80|  21.8M|  while ((in = jvp_utf8_next(in, end, &codepoint))) {
  ------------------
  |  Branch (80:10): [True: 21.8M, False: 16.7k]
  ------------------
   81|  21.8M|    if (codepoint == -1) return 0;
  ------------------
  |  Branch (81:9): [True: 5.75k, False: 21.8M]
  ------------------
   82|  21.8M|  }
   83|  16.7k|  return 1;
   84|  22.4k|}
jvp_utf8_encode_length:
   94|  35.5M|int jvp_utf8_encode_length(int codepoint) {
   95|  35.5M|  if (codepoint <= 0x7F) return 1;
  ------------------
  |  Branch (95:7): [True: 13.9M, False: 21.5M]
  ------------------
   96|  21.5M|  else if (codepoint <= 0x7FF) return 2;
  ------------------
  |  Branch (96:12): [True: 3.67k, False: 21.5M]
  ------------------
   97|  21.5M|  else if (codepoint <= 0xFFFF) return 3;
  ------------------
  |  Branch (97:12): [True: 21.5M, False: 1.61k]
  ------------------
   98|  1.61k|  else return 4;
   99|  35.5M|}
jvp_utf8_encode:
  101|  35.5M|int jvp_utf8_encode(int codepoint, char* out) {
  102|  35.5M|  assert(codepoint >= 0 && codepoint <= 0x10FFFF);
  ------------------
  |  Branch (102:3): [True: 0, False: 35.5M]
  |  Branch (102:3): [True: 0, False: 0]
  |  Branch (102:3): [True: 35.5M, False: 0]
  |  Branch (102:3): [True: 35.5M, False: 0]
  ------------------
  103|  35.5M|  char* start = out;
  104|  35.5M|  if (codepoint <= 0x7F) {
  ------------------
  |  Branch (104:7): [True: 13.9M, False: 21.5M]
  ------------------
  105|  13.9M|    *out++ = codepoint;
  106|  21.5M|  } else if (codepoint <= 0x7FF) {
  ------------------
  |  Branch (106:14): [True: 3.67k, False: 21.5M]
  ------------------
  107|  3.67k|    *out++ = 0xC0 + ((codepoint & 0x7C0) >> 6);
  108|  3.67k|    *out++ = 0x80 + ((codepoint & 0x03F));
  109|  21.5M|  } else if(codepoint <= 0xFFFF) {
  ------------------
  |  Branch (109:13): [True: 21.5M, False: 1.61k]
  ------------------
  110|  21.5M|    *out++ = 0xE0 + ((codepoint & 0xF000) >> 12);
  111|  21.5M|    *out++ = 0x80 + ((codepoint & 0x0FC0) >> 6);
  112|  21.5M|    *out++ = 0x80 + ((codepoint & 0x003F));
  113|  21.5M|  } else {
  114|  1.61k|    *out++ = 0xF0 + ((codepoint & 0x1C0000) >> 18);
  115|  1.61k|    *out++ = 0x80 + ((codepoint & 0x03F000) >> 12);
  116|  1.61k|    *out++ = 0x80 + ((codepoint & 0x000FC0) >> 6);
  117|  1.61k|    *out++ = 0x80 + ((codepoint & 0x00003F));
  118|  1.61k|  }
  119|  35.5M|  assert(out - start == jvp_utf8_encode_length(codepoint));
  ------------------
  |  Branch (119:3): [True: 0, False: 35.5M]
  |  Branch (119:3): [True: 35.5M, False: 0]
  ------------------
  120|  35.5M|  return out - start;
  121|  35.5M|}

LLVMFuzzerTestOneInput:
    7|  4.44k|int LLVMFuzzerTestOneInput(uint8_t *data, size_t size) {
    8|  4.44k|  if (size < 8) {
  ------------------
  |  Branch (8:7): [True: 4, False: 4.44k]
  ------------------
    9|      4|    return 0;
   10|      4|  }
   11|       |
   12|  4.44k|  int fuzz_flags = *(int*)data;
   13|  4.44k|  data += 4;
   14|  4.44k|  size -= 4;
   15|  4.44k|  int dump_flags = *(int*)data;
   16|  4.44k|  data += 4;
   17|  4.44k|  size -= 4;
   18|       |
   19|       |  // Creat null-terminated string
   20|  4.44k|  char *null_terminated = (char *)malloc(size + 1);
   21|  4.44k|  memcpy(null_terminated, (char *)data, size);
   22|  4.44k|  null_terminated[size] = '\0';
   23|       |
   24|       |  // Fuzzer entrypoint
   25|  4.44k|  jv res = jv_parse_custom_flags(null_terminated, fuzz_flags);
   26|  4.44k|  if (jv_is_valid(res)) {
  ------------------
  |  Branch (26:7): [True: 2.56k, False: 1.88k]
  ------------------
   27|  2.56k|    jv_dump(res, dump_flags);
   28|  2.56k|  } else {
   29|  1.88k|    jv_free(res);
   30|  1.88k|  }
   31|       |
   32|       |  // Free the null-terminated string
   33|  4.44k|  free(null_terminated);
   34|       |
   35|  4.44k|  return 0;
   36|  4.44k|}

decContextClearStatus:
   54|   743k|decContext *decContextClearStatus(decContext *context, uInt mask) {
   55|   743k|  context->status&=~mask;
   56|   743k|  return context;
   57|   743k|  } // decContextClearStatus
decContextDefault:
   72|  5.19k|decContext * decContextDefault(decContext *context, Int kind) {
   73|       |  // set defaults...
   74|  5.19k|  context->digits=9;                         // 9 digits
   75|  5.19k|  context->emax=DEC_MAX_EMAX;                // 9-digit exponents
  ------------------
  |  |   90|  5.19k|  #define DEC_MAX_EMAX   999999999
  ------------------
   76|  5.19k|  context->emin=DEC_MIN_EMIN;                // .. balanced
  ------------------
  |  |   93|  5.19k|  #define DEC_MIN_EMIN  -999999999
  ------------------
   77|  5.19k|  context->round=DEC_ROUND_HALF_UP;          // 0.5 rises
   78|  5.19k|  context->traps=DEC_Errors;                 // all but informational
  ------------------
  |  |  183|  5.19k|  #define DEC_Errors (DEC_IEEE_754_Division_by_zero |                 \
  |  |  ------------------
  |  |  |  |  167|  5.19k|  #define DEC_IEEE_754_Division_by_zero  (DEC_Division_by_zero)
  |  |  |  |  ------------------
  |  |  |  |  |  |  129|  5.19k|    #define DEC_Division_by_zero     0x00000002
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  184|  5.19k|                      DEC_IEEE_754_Invalid_operation |                \
  |  |  ------------------
  |  |  |  |  173|  5.19k|  #define DEC_IEEE_754_Invalid_operation (DEC_Conversion_syntax |     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|  5.19k|    #define DEC_Conversion_syntax    0x00000001
  |  |  |  |  ------------------
  |  |  |  |  174|  5.19k|                                          DEC_Division_impossible |   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  5.19k|    #define DEC_Division_impossible  0x00000004
  |  |  |  |  ------------------
  |  |  |  |  175|  5.19k|                                          DEC_Division_undefined |    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  5.19k|    #define DEC_Division_undefined   0x00000008
  |  |  |  |  ------------------
  |  |  |  |  176|  5.19k|                                          DEC_Insufficient_storage |  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|  5.19k|    #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails]  */
  |  |  |  |  ------------------
  |  |  |  |  177|  5.19k|                                          DEC_Invalid_context |       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|  5.19k|    #define DEC_Invalid_context      0x00000040
  |  |  |  |  ------------------
  |  |  |  |  178|  5.19k|                                          DEC_Invalid_operation)
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|  5.19k|    #define DEC_Invalid_operation    0x00000080
  |  |  |  |  ------------------
  |  |  ------------------
  |  |  185|  5.19k|                      DEC_IEEE_754_Overflow | DEC_IEEE_754_Underflow)
  |  |  ------------------
  |  |  |  |  179|  5.19k|  #define DEC_IEEE_754_Overflow          (DEC_Overflow)
  |  |  |  |  ------------------
  |  |  |  |  |  |  139|  5.19k|    #define DEC_Overflow             0x00000200
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                                     DEC_IEEE_754_Overflow | DEC_IEEE_754_Underflow)
  |  |  ------------------
  |  |  |  |  180|  5.19k|  #define DEC_IEEE_754_Underflow         (DEC_Underflow)
  |  |  |  |  ------------------
  |  |  |  |  |  |  143|  5.19k|    #define DEC_Underflow            0x00002000
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
   79|  5.19k|  context->status=0;                         // cleared
   80|  5.19k|  context->clamp=0;                          // no clamping
   81|       |  #if DECSUBSET
   82|       |  context->extended=0;                       // cleared
   83|       |  #endif
   84|  5.19k|  switch (kind) {
   85|      1|    case DEC_INIT_BASE:
  ------------------
  |  |  227|      1|  #define DEC_INIT_BASE         0
  ------------------
  |  Branch (85:5): [True: 1, False: 5.19k]
  ------------------
   86|       |      // [use defaults]
   87|      1|      break;
   88|      0|    case DEC_INIT_DECIMAL32:
  ------------------
  |  |  228|      0|  #define DEC_INIT_DECIMAL32   32
  ------------------
  |  Branch (88:5): [True: 0, False: 5.19k]
  ------------------
   89|      0|      context->digits=7;                     // digits
   90|      0|      context->emax=96;                      // Emax
   91|      0|      context->emin=-95;                     // Emin
   92|      0|      context->round=DEC_ROUND_HALF_EVEN;    // 0.5 to nearest even
   93|      0|      context->traps=0;                      // no traps set
   94|      0|      context->clamp=1;                      // clamp exponents
   95|       |      #if DECSUBSET
   96|       |      context->extended=1;                   // set
   97|       |      #endif
   98|      0|      break;
   99|  5.19k|    case DEC_INIT_DECIMAL64:
  ------------------
  |  |  229|  5.19k|  #define DEC_INIT_DECIMAL64   64
  ------------------
  |  Branch (99:5): [True: 5.19k, False: 1]
  ------------------
  100|  5.19k|      context->digits=16;                    // digits
  101|  5.19k|      context->emax=384;                     // Emax
  102|  5.19k|      context->emin=-383;                    // Emin
  103|  5.19k|      context->round=DEC_ROUND_HALF_EVEN;    // 0.5 to nearest even
  104|  5.19k|      context->traps=0;                      // no traps set
  105|  5.19k|      context->clamp=1;                      // clamp exponents
  106|       |      #if DECSUBSET
  107|       |      context->extended=1;                   // set
  108|       |      #endif
  109|  5.19k|      break;
  110|      0|    case DEC_INIT_DECIMAL128:
  ------------------
  |  |  230|      0|  #define DEC_INIT_DECIMAL128 128
  ------------------
  |  Branch (110:5): [True: 0, False: 5.19k]
  ------------------
  111|      0|      context->digits=34;                    // digits
  112|      0|      context->emax=6144;                    // Emax
  113|      0|      context->emin=-6143;                   // Emin
  114|      0|      context->round=DEC_ROUND_HALF_EVEN;    // 0.5 to nearest even
  115|      0|      context->traps=0;                      // no traps set
  116|      0|      context->clamp=1;                      // clamp exponents
  117|       |      #if DECSUBSET
  118|       |      context->extended=1;                   // set
  119|       |      #endif
  120|      0|      break;
  121|       |
  122|      0|    default:                                 // invalid Kind
  ------------------
  |  Branch (122:5): [True: 0, False: 5.19k]
  ------------------
  123|       |      // use defaults, and ..
  124|      0|      decContextSetStatus(context, DEC_Invalid_operation); // trap
  ------------------
  |  |  135|      0|    #define DEC_Invalid_operation    0x00000080
  ------------------
  125|  5.19k|    }
  126|       |
  127|  5.19k|  return context;} // decContextDefault
decContextSetStatus:
  211|  18.3k|decContext * decContextSetStatus(decContext *context, uInt status) {
  212|  18.3k|  context->status|=status;
  213|  18.3k|  if (status & context->traps) raise(SIGFPE);
  ------------------
  |  Branch (213:7): [True: 0, False: 18.3k]
  ------------------
  214|  18.3k|  return context;} // decContextSetStatus

decNumberToString:
  448|  13.3k|char * decNumberToString(const decNumber *dn, char *string){
  449|  13.3k|  decToString(dn, string, 0);
  450|  13.3k|  return string;
  451|  13.3k|  } // DecNumberToString
decNumberFromString:
  479|   743k|                                decContext *set) {
  480|   743k|  Int   exponent=0;                // working exponent [assume 0]
  ------------------
  |  |   92|   743k|  #define Int    int32_t
  ------------------
  481|   743k|  uByte bits=0;                    // working flags [assume +ve]
  ------------------
  |  |   89|   743k|  #define uByte  uint8_t
  ------------------
  482|   743k|  Unit  *res;                      // where result will be built
  ------------------
  |  |   94|   743k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   743k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  483|   743k|  Unit  resbuff[SD2U(DECBUFFER+9)];// local buffer in case need temporary
  ------------------
  |  |   94|   743k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   743k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  484|       |                                   // [+9 allows for ln() constants]
  485|   743k|  Unit  *allocres=NULL;            // -> allocated result, iff allocated
  ------------------
  |  |   94|   743k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   743k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  486|   743k|  Int   d=0;                       // count of digits found in decimal part
  ------------------
  |  |   92|   743k|  #define Int    int32_t
  ------------------
  487|   743k|  const char *dotchar=NULL;        // where dot was found
  488|   743k|  const char *cfirst=chars;        // -> first character of decimal part
  489|   743k|  const char *last=NULL;           // -> last digit of decimal part
  490|   743k|  const char *c;                   // work
  491|   743k|  Unit  *up;                       // ..
  ------------------
  |  |   94|   743k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   743k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  492|   743k|  #if DECDPUN>1
  493|   743k|  Int   cut, out;                  // ..
  ------------------
  |  |   92|   743k|  #define Int    int32_t
  ------------------
  494|   743k|  #endif
  495|   743k|  Int   residue;                   // rounding residue
  ------------------
  |  |   92|   743k|  #define Int    int32_t
  ------------------
  496|   743k|  uInt  status=0;                  // error code
  ------------------
  |  |   93|   743k|  #define uInt   uint32_t
  ------------------
  497|       |
  498|       |  #if DECCHECK
  499|       |  if (decCheckOperands(DECUNRESU, DECUNUSED, DECUNUSED, set))
  500|       |    return decNumberZero(dn);
  501|       |  #endif
  502|       |
  503|   743k|  do {                             // status & malloc protection
  504|  36.2M|    for (c=chars;; c++) {          // -> input character
  505|  36.2M|      if (*c>='0' && *c<='9') {    // test for Arabic digit
  ------------------
  |  Branch (505:11): [True: 35.5M, False: 712k]
  |  Branch (505:22): [True: 35.5M, False: 35.0k]
  ------------------
  506|  35.5M|        last=c;
  507|  35.5M|        d++;                       // count of real digits
  508|  35.5M|        continue;                  // still in decimal part
  509|  35.5M|        }
  510|   747k|      if (*c=='.' && dotchar==NULL) { // first '.'
  ------------------
  |  Branch (510:11): [True: 1.48k, False: 745k]
  |  Branch (510:22): [True: 1.48k, False: 3]
  ------------------
  511|  1.48k|        dotchar=c;                 // record offset into decimal part
  512|  1.48k|        if (c==cfirst) cfirst++;   // first digit must follow
  ------------------
  |  Branch (512:13): [True: 550, False: 931]
  ------------------
  513|  1.48k|        continue;}
  514|   745k|      if (c==chars) {              // first in string...
  ------------------
  |  Branch (514:11): [True: 8.86k, False: 736k]
  ------------------
  515|  8.86k|        if (*c=='-') {             // valid - sign
  ------------------
  |  Branch (515:13): [True: 1.85k, False: 7.01k]
  ------------------
  516|  1.85k|          cfirst++;
  517|  1.85k|          bits=DECNEG;
  ------------------
  |  |   31|  1.85k|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  ------------------
  518|  1.85k|          continue;}
  519|  7.01k|        if (*c=='+') {             // valid + sign
  ------------------
  |  Branch (519:13): [True: 316, False: 6.69k]
  ------------------
  520|    316|          cfirst++;
  521|    316|          continue;}
  522|  7.01k|        }
  523|       |      // *c is not a digit, or a valid +, -, or '.'
  524|   743k|      break;
  525|   745k|      } // c
  526|       |
  527|   743k|    if (last==NULL) {              // no digits yet
  ------------------
  |  Branch (527:9): [True: 6.92k, False: 736k]
  ------------------
  528|  6.92k|      status=DEC_Conversion_syntax;// assume the worst
  ------------------
  |  |  128|  6.92k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  529|  6.92k|      if (*c=='\0') break;         // and no more to come...
  ------------------
  |  Branch (529:11): [True: 30, False: 6.89k]
  ------------------
  530|       |      #if DECSUBSET
  531|       |      // if subset then infinities and NaNs are not allowed
  532|       |      if (!set->extended) break;   // hopeless
  533|       |      #endif
  534|       |      // Infinities and NaNs are possible, here
  535|  6.89k|      if (dotchar!=NULL) break;    // .. unless had a dot
  ------------------
  |  Branch (535:11): [True: 5, False: 6.88k]
  ------------------
  536|  6.88k|      decNumberZero(dn);           // be optimistic
  537|  6.88k|      if (decBiStr(c, "infinity", "INFINITY")
  ------------------
  |  Branch (537:11): [True: 194, False: 6.69k]
  ------------------
  538|  6.69k|       || decBiStr(c, "inf", "INF")) {
  ------------------
  |  Branch (538:11): [True: 5.16k, False: 1.53k]
  ------------------
  539|  5.35k|        dn->bits=bits | DECINF;
  ------------------
  |  |   32|  5.35k|  #define DECINF    0x40      /* 1=Infinity                           */
  ------------------
  540|  5.35k|        status=0;                  // is OK
  541|  5.35k|        break; // all done
  542|  5.35k|        }
  543|       |      // a NaN expected
  544|       |      // 2003.09.10 NaNs are now permitted to have a sign
  545|  1.53k|      dn->bits=bits | DECNAN;      // assume simple NaN
  ------------------
  |  |   33|  1.53k|  #define DECNAN    0x20      /* 1=NaN                                */
  ------------------
  546|  1.53k|      if (*c=='s' || *c=='S') {    // looks like an sNaN
  ------------------
  |  Branch (546:11): [True: 195, False: 1.33k]
  |  Branch (546:22): [True: 195, False: 1.14k]
  ------------------
  547|    390|        c++;
  548|    390|        dn->bits=bits | DECSNAN;
  ------------------
  |  |   34|    390|  #define DECSNAN   0x10      /* 1=sNaN                               */
  ------------------
  549|    390|        }
  550|  1.53k|      if (*c!='n' && *c!='N') break;    // check caseless "NaN"
  ------------------
  |  Branch (550:11): [True: 938, False: 594]
  |  Branch (550:22): [True: 285, False: 653]
  ------------------
  551|  1.24k|      c++;
  552|  1.24k|      if (*c!='a' && *c!='A') break;    // ..
  ------------------
  |  Branch (552:11): [True: 666, False: 581]
  |  Branch (552:22): [True: 37, False: 629]
  ------------------
  553|  1.21k|      c++;
  554|  1.21k|      if (*c!='n' && *c!='N') break;    // ..
  ------------------
  |  Branch (554:11): [True: 542, False: 668]
  |  Branch (554:22): [True: 28, False: 514]
  ------------------
  555|  1.18k|      c++;
  556|       |      // now either nothing, or nnnn payload, expected
  557|       |      // -> start of integer and skip leading 0s [including plain 0]
  558|  38.5k|      for (cfirst=c; *cfirst=='0';) cfirst++;
  ------------------
  |  Branch (558:22): [True: 37.3k, False: 1.18k]
  ------------------
  559|  1.18k|      if (*cfirst=='\0') {         // "NaN" or "sNaN", maybe with all 0s
  ------------------
  |  Branch (559:11): [True: 1.12k, False: 61]
  ------------------
  560|  1.12k|        status=0;                  // it's good
  561|  1.12k|        break;                     // ..
  562|  1.12k|        }
  563|       |      // something other than 0s; setup last and d as usual [no dots]
  564|   227k|      for (c=cfirst;; c++, d++) {
  565|   227k|        if (*c<'0' || *c>'9') break; // test for Arabic digit
  ------------------
  |  Branch (565:13): [True: 55, False: 227k]
  |  Branch (565:23): [True: 6, False: 227k]
  ------------------
  566|   227k|        last=c;
  567|   227k|        }
  568|     61|      if (*c!='\0') break;         // not all digits
  ------------------
  |  Branch (568:11): [True: 21, False: 40]
  ------------------
  569|     40|      if (d>set->digits-1) {
  ------------------
  |  Branch (569:11): [True: 0, False: 40]
  ------------------
  570|       |        // [NB: payload in a decNumber can be full length unless
  571|       |        // clamped, in which case can only be digits-1]
  572|      0|        if (set->clamp) break;
  ------------------
  |  Branch (572:13): [True: 0, False: 0]
  ------------------
  573|      0|        if (d>set->digits) break;
  ------------------
  |  Branch (573:13): [True: 0, False: 0]
  ------------------
  574|      0|        } // too many digits?
  575|       |      // good; drop through to convert the integer to coefficient
  576|     40|      status=0;                    // syntax is OK
  577|     40|      bits=dn->bits;               // for copy-back
  578|     40|      } // last==NULL
  579|       |
  580|   736k|     else if (*c!='\0') {          // more to process...
  ------------------
  |  Branch (580:15): [True: 28.3k, False: 708k]
  ------------------
  581|       |      // had some digits; exponent is only valid sequence now
  582|  28.3k|      Flag nege;                   // 1=negative exponent
  ------------------
  |  |   87|  28.3k|  #define Flag   uint8_t
  ------------------
  583|  28.3k|      const char *firstexp;        // -> first significant exponent digit
  584|  28.3k|      status=DEC_Conversion_syntax;// assume the worst
  ------------------
  |  |  128|  28.3k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  585|  28.3k|      uInt expa=0;                 // accumulator for exponent
  ------------------
  |  |   93|  28.3k|  #define uInt   uint32_t
  ------------------
  586|  28.3k|      if (*c!='e' && *c!='E') break;
  ------------------
  |  Branch (586:11): [True: 27.3k, False: 1.06k]
  |  Branch (586:22): [True: 46, False: 27.2k]
  ------------------
  587|       |      /* Found 'e' or 'E' -- now process explicit exponent */
  588|       |      // 1998.07.11: sign no longer required
  589|  28.3k|      nege=0;
  590|  28.3k|      c++;                         // to (possible) sign
  591|  28.3k|      if (*c=='-') {nege=1; c++;}
  ------------------
  |  Branch (591:11): [True: 25.8k, False: 2.45k]
  ------------------
  592|  2.45k|       else if (*c=='+') c++;
  ------------------
  |  Branch (592:17): [True: 194, False: 2.26k]
  ------------------
  593|  28.3k|      if (*c=='\0') break;
  ------------------
  |  Branch (593:11): [True: 26, False: 28.3k]
  ------------------
  594|       |
  595|  28.8k|      for (; *c=='0' && *(c+1)!='\0';) c++;  // strip insignificant zeros
  ------------------
  |  Branch (595:14): [True: 628, False: 28.2k]
  |  Branch (595:25): [True: 519, False: 109]
  ------------------
  596|  28.3k|      firstexp=c;                            // save exponent digit place
  597|   988k|      for (; ;c++) {
  598|   988k|        if (*c<'0' || *c>'9') break;         // not a digit
  ------------------
  |  Branch (598:13): [True: 28.3k, False: 960k]
  |  Branch (598:23): [True: 4, False: 960k]
  ------------------
  599|   960k|        expa=X10(expa)+(Int)*c-(Int)'0';
  ------------------
  |  |  163|   960k|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
  600|   960k|        } // c
  601|       |      // if not now on a '\0', *c must not be a digit
  602|  28.3k|      if (*c!='\0') break;
  ------------------
  |  Branch (602:11): [True: 27, False: 28.2k]
  ------------------
  603|       |
  604|       |      // (this next test must be after the syntax checks)
  605|       |      // if it was too long the exponent may have wrapped, so check
  606|       |      // carefully and set it to a certain overflow if wrap possible
  607|  28.2k|      if (c>=firstexp+9+1) {
  ------------------
  |  Branch (607:11): [True: 22.0k, False: 6.28k]
  ------------------
  608|  22.0k|        if (c>firstexp+9+1 || *firstexp>'1') expa=DECNUMMAXE*2;
  ------------------
  |  |  183|    817|  #define DECNUMMAXE 999999999  /* maximum adjusted exponent ditto    */
  ------------------
  |  Branch (608:13): [True: 339, False: 21.6k]
  |  Branch (608:31): [True: 478, False: 21.1k]
  ------------------
  609|       |        // [up to 1999999999 is OK, for example 1E-1000000998]
  610|  22.0k|        }
  611|  28.2k|      exponent=(Int)expa;               // save exponent
  612|  28.2k|      if (nege) exponent=-exponent;     // was negative
  ------------------
  |  Branch (612:11): [True: 25.8k, False: 2.40k]
  ------------------
  613|  28.2k|      status=0;                         // is OK
  614|  28.2k|      } // stuff after digits
  615|       |
  616|       |    // Here when whole string has been inspected; syntax is good
  617|       |    // cfirst->first digit (never dot), last->last digit (ditto)
  618|       |
  619|       |    // strip leading zeros/dot [leave final 0 if all 0's]
  620|   736k|    if (*cfirst=='0') {                 // [cfirst has stepped over .]
  ------------------
  |  Branch (620:9): [True: 647k, False: 89.3k]
  ------------------
  621|   702k|      for (c=cfirst; c<last; c++, cfirst++) {
  ------------------
  |  Branch (621:22): [True: 59.5k, False: 642k]
  ------------------
  622|  59.5k|        if (*c=='.') continue;          // ignore dots
  ------------------
  |  Branch (622:13): [True: 211, False: 59.3k]
  ------------------
  623|  59.3k|        if (*c!='0') break;             // non-zero found
  ------------------
  |  Branch (623:13): [True: 4.79k, False: 54.5k]
  ------------------
  624|  54.5k|        d--;                            // 0 stripped
  625|  54.5k|        } // c
  626|       |      #if DECSUBSET
  627|       |      // make a rapid exit for easy zeros if !extended
  628|       |      if (*cfirst=='0' && !set->extended) {
  629|       |        decNumberZero(dn);              // clean result
  630|       |        break;                          // [could be return]
  631|       |        }
  632|       |      #endif
  633|   647k|      } // at least one leading 0
  634|       |
  635|       |    // Handle decimal point...
  636|   736k|    if (dotchar!=NULL && dotchar<last)  // non-trailing '.' found?
  ------------------
  |  Branch (636:9): [True: 1.46k, False: 735k]
  |  Branch (636:26): [True: 1.15k, False: 311]
  ------------------
  637|  1.15k|      exponent-=(last-dotchar);         // adjust exponent
  638|       |    // [we can now ignore the .]
  639|       |
  640|       |    // OK, the digits string is good.  Assemble in the decNumber, or in
  641|       |    // a temporary units array if rounding is needed
  642|   736k|    if (d<=set->digits) res=dn->lsu;    // fits into supplied decNumber
  ------------------
  |  Branch (642:9): [True: 736k, False: 0]
  ------------------
  643|      0|     else {                             // rounding needed
  644|      0|      Int needbytes=D2U(d)*sizeof(Unit);// bytes needed
  ------------------
  |  |   92|      0|  #define Int    int32_t
  ------------------
                    Int needbytes=D2U(d)*sizeof(Unit);// bytes needed
  ------------------
  |  |  264|      0|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|      0|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
  645|      0|      res=resbuff;                      // assume use local buffer
  646|      0|      if (needbytes>(Int)sizeof(resbuff)) { // too big for local
  ------------------
  |  Branch (646:11): [True: 0, False: 0]
  ------------------
  647|      0|        allocres=(Unit *)malloc(needbytes);
  648|      0|        if (allocres==NULL) {status|=DEC_Insufficient_storage; break;}
  ------------------
  |  |  132|      0|    #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails]  */
  ------------------
  |  Branch (648:13): [True: 0, False: 0]
  ------------------
  649|      0|        res=allocres;
  650|      0|        }
  651|      0|      }
  652|       |    // res now -> number lsu, buffer, or allocated storage for Unit array
  653|       |
  654|       |    // Place the coefficient into the selected Unit array
  655|       |    // [this is often 70% of the cost of this function when DECDPUN>1]
  656|   736k|    #if DECDPUN>1
  657|   736k|    out=0;                         // accumulator
  658|   736k|    up=res+D2U(d)-1;               // -> msu
  ------------------
  |  |  264|   736k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|   736k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    943|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    943|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 735k, False: 943]
  |  |  ------------------
  ------------------
  659|   736k|    cut=d-(up-res)*DECDPUN;        // digits in top unit
  ------------------
  |  |   43|   736k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  660|  34.2M|    for (c=cfirst;; c++) {         // along the digits
  661|  34.2M|      if (*c=='.') continue;       // ignore '.' [don't decrement cut]
  ------------------
  |  Branch (661:11): [True: 407, False: 34.2M]
  ------------------
  662|  34.2M|      out=X10(out)+(Int)*c-(Int)'0';
  ------------------
  |  |  163|  34.2M|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
  663|  34.2M|      if (c==last) break;          // done [never get to trailing '.']
  ------------------
  |  Branch (663:11): [True: 736k, False: 33.5M]
  ------------------
  664|  33.5M|      cut--;
  665|  33.5M|      if (cut>0) continue;         // more for this unit
  ------------------
  |  Branch (665:11): [True: 22.3M, False: 11.1M]
  ------------------
  666|  11.1M|      *up=(Unit)out;               // write unit
  667|  11.1M|      up--;                        // prepare for unit below..
  668|  11.1M|      cut=DECDPUN;                 // ..
  ------------------
  |  |   43|  11.1M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  669|  11.1M|      out=0;                       // ..
  670|  11.1M|      } // c
  671|   736k|    *up=(Unit)out;                 // write lsu
  672|       |
  673|       |    #else
  674|       |    // DECDPUN==1
  675|       |    up=res;                        // -> lsu
  676|       |    for (c=last; c>=cfirst; c--) { // over each character, from least
  677|       |      if (*c=='.') continue;       // ignore . [don't step up]
  678|       |      *up=(Unit)((Int)*c-(Int)'0');
  679|       |      up++;
  680|       |      } // c
  681|       |    #endif
  682|       |
  683|   736k|    dn->bits=bits;
  684|   736k|    dn->exponent=exponent;
  685|   736k|    dn->digits=d;
  686|       |
  687|       |    // if not in number (too long) shorten into the number
  688|   736k|    if (d>set->digits) {
  ------------------
  |  Branch (688:9): [True: 0, False: 736k]
  ------------------
  689|      0|      residue=0;
  690|      0|      decSetCoeff(dn, set, res, d, &residue, &status);
  691|       |      // always check for overflow or subnormal and round as needed
  692|      0|      decFinalize(dn, set, &residue, &status);
  693|      0|      }
  694|   736k|     else { // no rounding, but may still have overflow or subnormal
  695|       |      // [these tests are just for performance; finalize repeats them]
  696|   736k|      if ((dn->exponent-1<set->emin-dn->digits)
  ------------------
  |  Branch (696:11): [True: 21.2k, False: 715k]
  ------------------
  697|   715k|       || (dn->exponent-1>set->emax-set->digits)) {
  ------------------
  |  Branch (697:11): [True: 1.21k, False: 714k]
  ------------------
  698|  22.4k|        residue=0;
  699|  22.4k|        decFinalize(dn, set, &residue, &status);
  700|  22.4k|        }
  701|   736k|      }
  702|       |    // decNumberShow(dn);
  703|   736k|    } while(0);                         // [for break]
  ------------------
  |  Branch (703:13): [Folded, False: 736k]
  ------------------
  704|       |
  705|   743k|  if (allocres!=NULL) free(allocres);   // drop any storage used
  ------------------
  |  Branch (705:7): [True: 0, False: 743k]
  ------------------
  706|   743k|  if (status!=0) decStatus(dn, status, set);
  ------------------
  |  Branch (706:7): [True: 18.3k, False: 725k]
  ------------------
  707|   743k|  return dn;
  708|   743k|  } /* decNumberFromString */
decNumberReduce:
 2310|  5.19k|                            decContext *set) {
 2311|       |  #if DECSUBSET
 2312|       |  decNumber *allocrhs=NULL;        // non-NULL if rounded rhs allocated
 2313|       |  #endif
 2314|  5.19k|  uInt status=0;                   // as usual
  ------------------
  |  |   93|  5.19k|  #define uInt   uint32_t
  ------------------
 2315|  5.19k|  Int  residue=0;                  // as usual
  ------------------
  |  |   92|  5.19k|  #define Int    int32_t
  ------------------
 2316|  5.19k|  Int  dropped;                    // work
  ------------------
  |  |   92|  5.19k|  #define Int    int32_t
  ------------------
 2317|       |
 2318|       |  #if DECCHECK
 2319|       |  if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
 2320|       |  #endif
 2321|       |
 2322|  5.19k|  do {                             // protect allocated storage
 2323|       |    #if DECSUBSET
 2324|       |    if (!set->extended) {
 2325|       |      // reduce operand and set lostDigits status, as needed
 2326|       |      if (rhs->digits>set->digits) {
 2327|       |        allocrhs=decRoundOperand(rhs, set, &status);
 2328|       |        if (allocrhs==NULL) break;
 2329|       |        rhs=allocrhs;
 2330|       |        }
 2331|       |      }
 2332|       |    #endif
 2333|       |    // [following code does not require input rounding]
 2334|       |
 2335|       |    // Infinities copy through; NaNs need usual treatment
 2336|  5.19k|    if (decNumberIsNaN(rhs)) {
  ------------------
  |  |  172|  5.19k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  5.19k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  5.19k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 0, False: 5.19k]
  |  |  ------------------
  ------------------
 2337|      0|      decNaNs(res, rhs, NULL, set, &status);
 2338|      0|      break;
 2339|      0|      }
 2340|       |
 2341|       |    // reduce result to the requested length and copy to result
 2342|  5.19k|    decCopyFit(res, rhs, set, &residue, &status); // copy & round
 2343|  5.19k|    decFinish(res, set, &residue, &status);       // cleanup/set flags
  ------------------
  |  |  267|  5.19k|#define decFinish(a,b,c,d) decFinalize(a,b,c,d)
  ------------------
 2344|  5.19k|    decTrim(res, set, 1, 0, &dropped);            // normalize in place
 2345|       |                                                  // [may clamp]
 2346|  5.19k|    } while(0);                              // end protected
  ------------------
  |  Branch (2346:13): [Folded, False: 5.19k]
  ------------------
 2347|       |
 2348|       |  #if DECSUBSET
 2349|       |  if (allocrhs !=NULL) free(allocrhs);       // ..
 2350|       |  #endif
 2351|  5.19k|  if (status!=0) decStatus(res, status, set);// then report status
  ------------------
  |  Branch (2351:7): [True: 0, False: 5.19k]
  ------------------
 2352|  5.19k|  return res;
 2353|  5.19k|  } // decNumberReduce
decNumberZero:
 3588|  8.02k|decNumber * decNumberZero(decNumber *dn) {
 3589|       |
 3590|       |  #if DECCHECK
 3591|       |  if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
 3592|       |  #endif
 3593|       |
 3594|  8.02k|  dn->bits=0;
 3595|  8.02k|  dn->exponent=0;
 3596|  8.02k|  dn->digits=1;
 3597|  8.02k|  dn->lsu[0]=0;
 3598|  8.02k|  return dn;
 3599|  8.02k|  } // decNumberZero
decNumber.c:decToString:
 3621|  13.3k|static void decToString(const decNumber *dn, char *string, Flag eng) {
 3622|  13.3k|  Int exp=dn->exponent;       // local copy
  ------------------
  |  |   92|  13.3k|  #define Int    int32_t
  ------------------
 3623|  13.3k|  Int e;                      // E-part value
  ------------------
  |  |   92|  13.3k|  #define Int    int32_t
  ------------------
 3624|  13.3k|  Int pre;                    // digits before the '.'
  ------------------
  |  |   92|  13.3k|  #define Int    int32_t
  ------------------
 3625|  13.3k|  Int cut;                    // for counting digits in a Unit
  ------------------
  |  |   92|  13.3k|  #define Int    int32_t
  ------------------
 3626|  13.3k|  char *c=string;             // work [output pointer]
 3627|  13.3k|  const Unit *up=dn->lsu+D2U(dn->digits)-1; // -> msu [input pointer]
  ------------------
  |  |  264|  13.3k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|  13.3k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    445|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    445|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 12.8k, False: 445]
  |  |  ------------------
  ------------------
 3628|  13.3k|  uInt u, pow;                // work
  ------------------
  |  |   93|  13.3k|  #define uInt   uint32_t
  ------------------
 3629|       |
 3630|       |  #if DECCHECK
 3631|       |  if (decCheckOperands(DECUNRESU, dn, DECUNUSED, DECUNCONT)) {
 3632|       |    strcpy(string, "?");
 3633|       |    return;}
 3634|       |  #endif
 3635|       |
 3636|  13.3k|  if (decNumberIsNegative(dn)) {   // Negatives get a minus
  ------------------
  |  |  173|  13.3k|  #define decNumberIsNegative(dn)  (((dn)->bits&DECNEG)!=0)
  |  |  ------------------
  |  |  |  |   31|  13.3k|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  |  |  ------------------
  |  |  |  Branch (173:36): [True: 424, False: 12.9k]
  |  |  ------------------
  ------------------
 3637|    424|    *c='-';
 3638|    424|    c++;
 3639|    424|    }
 3640|  13.3k|  if (dn->bits&DECSPECIAL) {       // Is a special value
  ------------------
  |  |   36|  13.3k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   32|  13.3k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   33|  13.3k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   34|  13.3k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  |  Branch (3640:7): [True: 5.19k, False: 8.13k]
  ------------------
 3641|  5.19k|    if (decNumberIsInfinite(dn)) {
  ------------------
  |  |  171|  5.19k|  #define decNumberIsInfinite(dn)  (((dn)->bits&DECINF)!=0)
  |  |  ------------------
  |  |  |  |   32|  5.19k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |  |  Branch (171:36): [True: 5.19k, False: 0]
  |  |  ------------------
  ------------------
 3642|  5.19k|      strcpy(c,   "Inf");
 3643|  5.19k|      strcpy(c+3, "inity");
 3644|  5.19k|      return;}
 3645|       |    // a NaN
 3646|      0|    if (dn->bits&DECSNAN) {        // signalling NaN
  ------------------
  |  |   34|      0|  #define DECSNAN   0x10      /* 1=sNaN                               */
  ------------------
  |  Branch (3646:9): [True: 0, False: 0]
  ------------------
 3647|      0|      *c='s';
 3648|      0|      c++;
 3649|      0|      }
 3650|      0|    strcpy(c, "NaN");
 3651|      0|    c+=3;                          // step past
 3652|       |    // if not a clean non-zero coefficient, that's all there is in a
 3653|       |    // NaN string
 3654|      0|    if (exp!=0 || (*dn->lsu==0 && dn->digits==1)) return;
  ------------------
  |  Branch (3654:9): [True: 0, False: 0]
  |  Branch (3654:20): [True: 0, False: 0]
  |  Branch (3654:35): [True: 0, False: 0]
  ------------------
 3655|       |    // [drop through to add integer]
 3656|      0|    }
 3657|       |
 3658|       |  // calculate how many digits in msu, and hence first cut
 3659|  8.13k|  cut=MSUDIGITS(dn->digits);       // [faster than remainder]
  ------------------
  |  |  271|  8.13k|  #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |  264|  8.13k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  249|  8.13k|  #define DECMAXD2U 49
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    445|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    445|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (264:21): [True: 7.68k, False: 445]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                 #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |   43|  8.13k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  ------------------
 3660|  8.13k|  cut--;                           // power of ten for digit
 3661|       |
 3662|  8.13k|  if (exp==0) {                    // simple integer [common fastpath]
  ------------------
  |  Branch (3662:7): [True: 5.39k, False: 2.73k]
  ------------------
 3663|  1.37M|    for (;up>=dn->lsu; up--) {     // each Unit from msu
  ------------------
  |  Branch (3663:11): [True: 1.37M, False: 5.39k]
  ------------------
 3664|  1.37M|      u=*up;                       // contains DECDPUN digits to lay out
 3665|  5.47M|      for (; cut>=0; c++, cut--) TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  4.10M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  4.10M|    *(c)='0';                             \
  |  |  290|  4.10M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  4.10M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 2.97M, False: 1.12M]
  |  |  ------------------
  |  |  292|  2.97M|      pow*=4;                             \
  |  |  293|  2.97M|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.97M, False: 9.03k]
  |  |  ------------------
  |  |  294|  2.97M|      pow/=2;                             \
  |  |  295|  2.97M|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 3.84k, False: 2.97M]
  |  |  ------------------
  |  |  296|  2.97M|      pow/=2;                             \
  |  |  297|  2.97M|      }                                   \
  |  |  298|  4.10M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 7.31k, False: 4.09M]
  |  |  ------------------
  |  |  299|  4.10M|    pow/=2;                               \
  |  |  300|  4.10M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 2.97M, False: 1.12M]
  |  |  ------------------
  |  |  301|  4.10M|    }
  ------------------
  |  Branch (3665:14): [True: 4.10M, False: 1.37M]
  ------------------
 3666|  1.37M|      cut=DECDPUN-1;               // next Unit has all digits
  ------------------
  |  |   43|  1.37M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3667|  1.37M|      }
 3668|  5.39k|    *c='\0';                       // terminate the string
 3669|  5.39k|    return;}
 3670|       |
 3671|       |  /* non-0 exponent -- assume plain form */
 3672|  2.73k|  pre=dn->digits+exp;              // digits before '.'
 3673|  2.73k|  e=0;                             // no E
 3674|  2.73k|  if ((exp>0) || (pre<-5)) {       // need exponential form
  ------------------
  |  Branch (3674:7): [True: 969, False: 1.76k]
  |  Branch (3674:18): [True: 935, False: 832]
  ------------------
 3675|  1.90k|    e=exp+dn->digits-1;            // calculate E value
 3676|  1.90k|    pre=1;                         // assume one digit before '.'
 3677|  1.90k|    if (eng && (e!=0)) {           // engineering: may need to adjust
  ------------------
  |  Branch (3677:9): [True: 0, False: 1.90k]
  |  Branch (3677:16): [True: 0, False: 0]
  ------------------
 3678|      0|      Int adj;                     // adjustment
  ------------------
  |  |   92|      0|  #define Int    int32_t
  ------------------
 3679|       |      // The C remainder operator is undefined for negative numbers, so
 3680|       |      // a positive remainder calculation must be used here
 3681|      0|      if (e<0) {
  ------------------
  |  Branch (3681:11): [True: 0, False: 0]
  ------------------
 3682|      0|        adj=(-e)%3;
 3683|      0|        if (adj!=0) adj=3-adj;
  ------------------
  |  Branch (3683:13): [True: 0, False: 0]
  ------------------
 3684|      0|        }
 3685|      0|       else { // e>0
 3686|      0|        adj=e%3;
 3687|      0|        }
 3688|      0|      e=e-adj;
 3689|       |      // if dealing with zero still produce an exponent which is a
 3690|       |      // multiple of three, as expected, but there will only be the
 3691|       |      // one zero before the E, still.  Otherwise note the padding.
 3692|      0|      if (!ISZERO(dn)) pre+=adj;
  ------------------
  |  |  255|      0|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|      0|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  178|      0|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  179|      0|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|      0|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|      0|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 3693|      0|       else {  // is zero
 3694|      0|        if (adj!=0) {              // 0.00Esnn needed
  ------------------
  |  Branch (3694:13): [True: 0, False: 0]
  ------------------
 3695|      0|          e=e+3;
 3696|      0|          pre=-(2-adj);
 3697|      0|          }
 3698|      0|        } // zero
 3699|      0|      } // eng
 3700|  1.90k|    } // need exponent
 3701|       |
 3702|       |  /* lay out the digits of the coefficient, adding 0s and . as needed */
 3703|  2.73k|  u=*up;
 3704|  2.73k|  if (pre>0) {                     // xxx.xxx or xx00 (engineering) form
  ------------------
  |  Branch (3704:7): [True: 2.26k, False: 475]
  ------------------
 3705|  2.26k|    Int n=pre;
  ------------------
  |  |   92|  2.26k|  #define Int    int32_t
  ------------------
 3706|  1.85M|    for (; pre>0; pre--, c++, cut--) {
  ------------------
  |  Branch (3706:12): [True: 1.85M, False: 2.26k]
  ------------------
 3707|  1.85M|      if (cut<0) {                 // need new Unit
  ------------------
  |  Branch (3707:11): [True: 617k, False: 1.23M]
  ------------------
 3708|   617k|        if (up==dn->lsu) break;    // out of input digits (pre>digits)
  ------------------
  |  Branch (3708:13): [True: 0, False: 617k]
  ------------------
 3709|   617k|        up--;
 3710|   617k|        cut=DECDPUN-1;
  ------------------
  |  |   43|   617k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3711|   617k|        u=*up;
 3712|   617k|        }
 3713|  1.85M|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  1.85M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  1.85M|    *(c)='0';                             \
  |  |  290|  1.85M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  1.85M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 798k, False: 1.05M]
  |  |  ------------------
  |  |  292|   798k|      pow*=4;                             \
  |  |  293|   798k|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 795k, False: 3.35k]
  |  |  ------------------
  |  |  294|   798k|      pow/=2;                             \
  |  |  295|   798k|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 2.49k, False: 796k]
  |  |  ------------------
  |  |  296|   798k|      pow/=2;                             \
  |  |  297|   798k|      }                                   \
  |  |  298|  1.85M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 2.38k, False: 1.85M]
  |  |  ------------------
  |  |  299|  1.85M|    pow/=2;                               \
  |  |  300|  1.85M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 798k, False: 1.05M]
  |  |  ------------------
  |  |  301|  1.85M|    }
  ------------------
 3714|  1.85M|      }
 3715|  2.26k|    if (n<dn->digits) {            // more to come, after '.'
  ------------------
  |  Branch (3715:9): [True: 645, False: 1.61k]
  ------------------
 3716|    645|      *c='.'; c++;
 3717|  20.1M|      for (;; c++, cut--) {
 3718|  20.1M|        if (cut<0) {               // need new Unit
  ------------------
  |  Branch (3718:13): [True: 6.72M, False: 13.4M]
  ------------------
 3719|  6.72M|          if (up==dn->lsu) break;  // out of input digits
  ------------------
  |  Branch (3719:15): [True: 645, False: 6.72M]
  ------------------
 3720|  6.72M|          up--;
 3721|  6.72M|          cut=DECDPUN-1;
  ------------------
  |  |   43|  6.72M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3722|  6.72M|          u=*up;
 3723|  6.72M|          }
 3724|  20.1M|        TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  20.1M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  20.1M|    *(c)='0';                             \
  |  |  290|  20.1M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  20.1M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 2.28M, False: 17.8M]
  |  |  ------------------
  |  |  292|  2.28M|      pow*=4;                             \
  |  |  293|  2.28M|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.27M, False: 7.64k]
  |  |  ------------------
  |  |  294|  2.28M|      pow/=2;                             \
  |  |  295|  2.28M|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 5.05k, False: 2.27M]
  |  |  ------------------
  |  |  296|  2.28M|      pow/=2;                             \
  |  |  297|  2.28M|      }                                   \
  |  |  298|  20.1M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 5.14k, False: 20.1M]
  |  |  ------------------
  |  |  299|  20.1M|    pow/=2;                               \
  |  |  300|  20.1M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 2.28M, False: 17.8M]
  |  |  ------------------
  |  |  301|  20.1M|    }
  ------------------
 3725|  20.1M|        }
 3726|    645|      }
 3727|  1.61k|     else for (; pre>0; pre--, c++) *c='0'; // 0 padding (for engineering) needed
  ------------------
  |  Branch (3727:18): [True: 0, False: 1.61k]
  ------------------
 3728|  2.26k|    }
 3729|    475|   else {                          // 0.xxx or 0.000xxx form
 3730|    475|    *c='0'; c++;
 3731|    475|    *c='.'; c++;
 3732|    681|    for (; pre<0; pre++, c++) *c='0';   // add any 0's after '.'
  ------------------
  |  Branch (3732:12): [True: 206, False: 475]
  ------------------
 3733|  2.48k|    for (; ; c++, cut--) {
 3734|  2.48k|      if (cut<0) {                 // need new Unit
  ------------------
  |  Branch (3734:11): [True: 962, False: 1.52k]
  ------------------
 3735|    962|        if (up==dn->lsu) break;    // out of input digits
  ------------------
  |  Branch (3735:13): [True: 475, False: 487]
  ------------------
 3736|    487|        up--;
 3737|    487|        cut=DECDPUN-1;
  ------------------
  |  |   43|    487|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3738|    487|        u=*up;
 3739|    487|        }
 3740|  2.01k|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  2.01k|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  2.01k|    *(c)='0';                             \
  |  |  290|  2.01k|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  2.01k|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 964, False: 1.04k]
  |  |  ------------------
  |  |  292|    964|      pow*=4;                             \
  |  |  293|    964|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 357, False: 607]
  |  |  ------------------
  |  |  294|    964|      pow/=2;                             \
  |  |  295|    964|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 540, False: 424]
  |  |  ------------------
  |  |  296|    964|      pow/=2;                             \
  |  |  297|    964|      }                                   \
  |  |  298|  2.01k|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 380, False: 1.63k]
  |  |  ------------------
  |  |  299|  2.01k|    pow/=2;                               \
  |  |  300|  2.01k|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 908, False: 1.10k]
  |  |  ------------------
  |  |  301|  2.01k|    }
  ------------------
 3741|  2.01k|      }
 3742|    475|    }
 3743|       |
 3744|       |  /* Finally add the E-part, if needed.  It will never be 0, has a
 3745|       |     base maximum and minimum of +999999999 through -999999999, but
 3746|       |     could range down to -1999999998 for anormal numbers */
 3747|  2.73k|  if (e!=0) {
  ------------------
  |  Branch (3747:7): [True: 1.90k, False: 832]
  ------------------
 3748|  1.90k|    Flag had=0;               // 1=had non-zero
  ------------------
  |  |   87|  1.90k|  #define Flag   uint8_t
  ------------------
 3749|  1.90k|    *c='E'; c++;
 3750|  1.90k|    *c='+'; c++;              // assume positive
 3751|  1.90k|    u=e;                      // ..
 3752|  1.90k|    if (e<0) {
  ------------------
  |  Branch (3752:9): [True: 935, False: 969]
  ------------------
 3753|    935|      *(c-1)='-';             // oops, need -
 3754|    935|      u=-e;                   // uInt, please
 3755|    935|      }
 3756|       |    // lay out the exponent [_itoa or equivalent is not ANSI C]
 3757|  20.9k|    for (cut=9; cut>=0; cut--) {
  ------------------
  |  Branch (3757:17): [True: 19.0k, False: 1.90k]
  ------------------
 3758|  19.0k|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  19.0k|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  19.0k|    *(c)='0';                             \
  |  |  290|  19.0k|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  19.0k|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 7.95k, False: 11.0k]
  |  |  ------------------
  |  |  292|  7.95k|      pow*=4;                             \
  |  |  293|  7.95k|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.29k, False: 5.66k]
  |  |  ------------------
  |  |  294|  7.95k|      pow/=2;                             \
  |  |  295|  7.95k|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 4.16k, False: 3.78k]
  |  |  ------------------
  |  |  296|  7.95k|      pow/=2;                             \
  |  |  297|  7.95k|      }                                   \
  |  |  298|  19.0k|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 3.58k, False: 15.4k]
  |  |  ------------------
  |  |  299|  19.0k|    pow/=2;                               \
  |  |  300|  19.0k|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 5.83k, False: 13.2k]
  |  |  ------------------
  |  |  301|  19.0k|    }
  ------------------
 3759|  19.0k|      if (*c=='0' && !had) continue;    // skip leading zeros
  ------------------
  |  Branch (3759:11): [True: 9.37k, False: 9.66k]
  |  Branch (3759:22): [True: 8.73k, False: 640]
  ------------------
 3760|  10.3k|      had=1;                            // had non-0
 3761|  10.3k|      c++;                              // step for next
 3762|  10.3k|      } // cut
 3763|  1.90k|    }
 3764|  2.73k|  *c='\0';          // terminate the string (all paths)
 3765|  2.73k|  return;
 3766|  8.13k|  } // decToString
decNumber.c:decUnitAddSub:
 6339|  3.29k|                         Unit *c, Int m) {
 6340|  3.29k|  const Unit *alsu=a;              // A lsu [need to remember it]
 6341|  3.29k|  Unit *clsu=c;                    // C ditto
  ------------------
  |  |   94|  3.29k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.29k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6342|  3.29k|  Unit *minC;                      // low water mark for C
  ------------------
  |  |   94|  3.29k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.29k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6343|  3.29k|  Unit *maxC;                      // high water mark for C
  ------------------
  |  |   94|  3.29k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.29k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6344|  3.29k|  eInt carry=0;                    // carry integer (could be Long)
  ------------------
  |  |  203|  3.29k|  #define eInt  Int           // extended integer
  |  |  ------------------
  |  |  |  |   92|  3.29k|  #define Int    int32_t
  |  |  ------------------
  ------------------
 6345|  3.29k|  Int  add;                        // work
  ------------------
  |  |   92|  3.29k|  #define Int    int32_t
  ------------------
 6346|  3.29k|  #if DECDPUN<=4                   // myriadal, millenary, etc.
 6347|  3.29k|  Int  est;                        // estimated quotient
  ------------------
  |  |   92|  3.29k|  #define Int    int32_t
  ------------------
 6348|  3.29k|  #endif
 6349|       |
 6350|       |  #if DECTRACE
 6351|       |  if (alength<1 || blength<1)
 6352|       |    printf("decUnitAddSub: alen blen m %ld %ld [%ld]\n", alength, blength, m);
 6353|       |  #endif
 6354|       |
 6355|  3.29k|  maxC=c+alength;                  // A is usually the longer
 6356|  3.29k|  minC=c+blength;                  // .. and B the shorter
 6357|  3.29k|  if (bshift!=0) {                 // B is shifted; low As copy across
  ------------------
  |  Branch (6357:7): [True: 0, False: 3.29k]
  ------------------
 6358|      0|    minC+=bshift;
 6359|       |    // if in place [common], skip copy unless there's a gap [rare]
 6360|      0|    if (a==c && bshift<=alength) {
  ------------------
  |  Branch (6360:9): [True: 0, False: 0]
  |  Branch (6360:17): [True: 0, False: 0]
  ------------------
 6361|      0|      c+=bshift;
 6362|      0|      a+=bshift;
 6363|      0|      }
 6364|      0|     else for (; c<clsu+bshift; a++, c++) {  // copy needed
  ------------------
  |  Branch (6364:18): [True: 0, False: 0]
  ------------------
 6365|      0|      if (a<alsu+alength) *c=*a;
  ------------------
  |  Branch (6365:11): [True: 0, False: 0]
  ------------------
 6366|      0|       else *c=0;
 6367|      0|      }
 6368|      0|    }
 6369|  3.29k|  if (minC>maxC) { // swap
  ------------------
  |  Branch (6369:7): [True: 0, False: 3.29k]
  ------------------
 6370|      0|    Unit *hold=minC;
  ------------------
  |  |   94|      0|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|      0|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6371|      0|    minC=maxC;
 6372|      0|    maxC=hold;
 6373|      0|    }
 6374|       |
 6375|       |  // For speed, do the addition as two loops; the first where both A
 6376|       |  // and B contribute, and the second (if necessary) where only one or
 6377|       |  // other of the numbers contribute.
 6378|       |  // Carry handling is the same (i.e., duplicated) in each case.
 6379|  6.59k|  for (; c<minC; c++) {
  ------------------
  |  Branch (6379:10): [True: 3.29k, False: 3.29k]
  ------------------
 6380|  3.29k|    carry+=*a;
 6381|  3.29k|    a++;
 6382|  3.29k|    carry+=((eInt)*b)*m;                // [special-casing m=1/-1
 6383|  3.29k|    b++;                                // here is not a win]
 6384|       |    // here carry is new Unit of digits; it could be +ve or -ve
 6385|  3.29k|    if ((ueInt)carry<=DECDPUNMAX) {     // fastpath 0-DECDPUNMAX
  ------------------
  |  |  209|  3.29k|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6385:9): [True: 3.06k, False: 231]
  ------------------
 6386|  3.06k|      *c=(Unit)carry;
 6387|  3.06k|      carry=0;
 6388|  3.06k|      continue;
 6389|  3.06k|      }
 6390|       |    #if DECDPUN==4                           // use divide-by-multiply
 6391|       |      if (carry>=0) {
 6392|       |        est=(((ueInt)carry>>11)*53687)>>18;
 6393|       |        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
 6394|       |        carry=est;                           // likely quotient [89%]
 6395|       |        if (*c<DECDPUNMAX+1) continue;       // estimate was correct
 6396|       |        carry++;
 6397|       |        *c-=DECDPUNMAX+1;
 6398|       |        continue;
 6399|       |        }
 6400|       |      // negative case
 6401|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6402|       |      est=(((ueInt)carry>>11)*53687)>>18;
 6403|       |      *c=(Unit)(carry-est*(DECDPUNMAX+1));
 6404|       |      carry=est-(DECDPUNMAX+1);              // correctly negative
 6405|       |      if (*c<DECDPUNMAX+1) continue;         // was OK
 6406|       |      carry++;
 6407|       |      *c-=DECDPUNMAX+1;
 6408|       |    #elif DECDPUN==3
 6409|    231|      if (carry>=0) {
  ------------------
  |  Branch (6409:11): [True: 231, False: 0]
  ------------------
 6410|    231|        est=(((ueInt)carry>>3)*16777)>>21;
 6411|    231|        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
  ------------------
  |  |  209|    231|    #define DECDPUNMAX 999
  ------------------
 6412|    231|        carry=est;                           // likely quotient [99%]
 6413|    231|        if (*c<DECDPUNMAX+1) continue;       // estimate was correct
  ------------------
  |  |  209|    231|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6413:13): [True: 0, False: 231]
  ------------------
 6414|    231|        carry++;
 6415|    231|        *c-=DECDPUNMAX+1;
  ------------------
  |  |  209|    231|    #define DECDPUNMAX 999
  ------------------
 6416|    231|        continue;
 6417|    231|        }
 6418|       |      // negative case
 6419|      0|      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
                    carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6420|      0|      est=(((ueInt)carry>>3)*16777)>>21;
 6421|      0|      *c=(Unit)(carry-est*(DECDPUNMAX+1));
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6422|      0|      carry=est-(DECDPUNMAX+1);              // correctly negative
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6423|      0|      if (*c<DECDPUNMAX+1) continue;         // was OK
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6423:11): [True: 0, False: 0]
  ------------------
 6424|      0|      carry++;
 6425|      0|      *c-=DECDPUNMAX+1;
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6426|       |    #elif DECDPUN<=2
 6427|       |      // Can use QUOT10 as carry <= 4 digits
 6428|       |      if (carry>=0) {
 6429|       |        est=QUOT10(carry, DECDPUN);
 6430|       |        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
 6431|       |        carry=est;                           // quotient
 6432|       |        continue;
 6433|       |        }
 6434|       |      // negative case
 6435|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6436|       |      est=QUOT10(carry, DECDPUN);
 6437|       |      *c=(Unit)(carry-est*(DECDPUNMAX+1));
 6438|       |      carry=est-(DECDPUNMAX+1);              // correctly negative
 6439|       |    #else
 6440|       |      // remainder operator is undefined if negative, so must test
 6441|       |      if ((ueInt)carry<(DECDPUNMAX+1)*2) {   // fastpath carry +1
 6442|       |        *c=(Unit)(carry-(DECDPUNMAX+1));     // [helps additions]
 6443|       |        carry=1;
 6444|       |        continue;
 6445|       |        }
 6446|       |      if (carry>=0) {
 6447|       |        *c=(Unit)(carry%(DECDPUNMAX+1));
 6448|       |        carry=carry/(DECDPUNMAX+1);
 6449|       |        continue;
 6450|       |        }
 6451|       |      // negative case
 6452|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6453|       |      *c=(Unit)(carry%(DECDPUNMAX+1));
 6454|       |      carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
 6455|       |    #endif
 6456|      0|    } // c
 6457|       |
 6458|       |  // now may have one or other to complete
 6459|       |  // [pretest to avoid loop setup/shutdown]
 6460|  2.13M|  if (c<maxC) for (; c<maxC; c++) {
  ------------------
  |  Branch (6460:7): [True: 2.00k, False: 1.29k]
  |  Branch (6460:22): [True: 2.13M, False: 2.00k]
  ------------------
 6461|  2.13M|    if (a<alsu+alength) {               // still in A
  ------------------
  |  Branch (6461:9): [True: 2.13M, False: 0]
  ------------------
 6462|  2.13M|      carry+=*a;
 6463|  2.13M|      a++;
 6464|  2.13M|      }
 6465|      0|     else {                             // inside B
 6466|      0|      carry+=((eInt)*b)*m;
 6467|      0|      b++;
 6468|      0|      }
 6469|       |    // here carry is new Unit of digits; it could be +ve or -ve and
 6470|       |    // magnitude up to DECDPUNMAX squared
 6471|  2.13M|    if ((ueInt)carry<=DECDPUNMAX) {     // fastpath 0-DECDPUNMAX
  ------------------
  |  |  209|  2.13M|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6471:9): [True: 1.65M, False: 478k]
  ------------------
 6472|  1.65M|      *c=(Unit)carry;
 6473|  1.65M|      carry=0;
 6474|  1.65M|      continue;
 6475|  1.65M|      }
 6476|       |    // result for this unit is negative or >DECDPUNMAX
 6477|       |    #if DECDPUN==4                           // use divide-by-multiply
 6478|       |      if (carry>=0) {
 6479|       |        est=(((ueInt)carry>>11)*53687)>>18;
 6480|       |        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
 6481|       |        carry=est;                           // likely quotient [79.7%]
 6482|       |        if (*c<DECDPUNMAX+1) continue;       // estimate was correct
 6483|       |        carry++;
 6484|       |        *c-=DECDPUNMAX+1;
 6485|       |        continue;
 6486|       |        }
 6487|       |      // negative case
 6488|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6489|       |      est=(((ueInt)carry>>11)*53687)>>18;
 6490|       |      *c=(Unit)(carry-est*(DECDPUNMAX+1));
 6491|       |      carry=est-(DECDPUNMAX+1);              // correctly negative
 6492|       |      if (*c<DECDPUNMAX+1) continue;         // was OK
 6493|       |      carry++;
 6494|       |      *c-=DECDPUNMAX+1;
 6495|       |    #elif DECDPUN==3
 6496|   478k|      if (carry>=0) {
  ------------------
  |  Branch (6496:11): [True: 478k, False: 0]
  ------------------
 6497|   478k|        est=(((ueInt)carry>>3)*16777)>>21;
 6498|   478k|        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
  ------------------
  |  |  209|   478k|    #define DECDPUNMAX 999
  ------------------
 6499|   478k|        carry=est;                           // likely quotient [99%]
 6500|   478k|        if (*c<DECDPUNMAX+1) continue;       // estimate was correct
  ------------------
  |  |  209|   478k|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6500:13): [True: 0, False: 478k]
  ------------------
 6501|   478k|        carry++;
 6502|   478k|        *c-=DECDPUNMAX+1;
  ------------------
  |  |  209|   478k|    #define DECDPUNMAX 999
  ------------------
 6503|   478k|        continue;
 6504|   478k|        }
 6505|       |      // negative case
 6506|      0|      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
                    carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6507|      0|      est=(((ueInt)carry>>3)*16777)>>21;
 6508|      0|      *c=(Unit)(carry-est*(DECDPUNMAX+1));
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6509|      0|      carry=est-(DECDPUNMAX+1);              // correctly negative
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6510|      0|      if (*c<DECDPUNMAX+1) continue;         // was OK
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6510:11): [True: 0, False: 0]
  ------------------
 6511|      0|      carry++;
 6512|      0|      *c-=DECDPUNMAX+1;
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6513|       |    #elif DECDPUN<=2
 6514|       |      if (carry>=0) {
 6515|       |        est=QUOT10(carry, DECDPUN);
 6516|       |        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
 6517|       |        carry=est;                           // quotient
 6518|       |        continue;
 6519|       |        }
 6520|       |      // negative case
 6521|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6522|       |      est=QUOT10(carry, DECDPUN);
 6523|       |      *c=(Unit)(carry-est*(DECDPUNMAX+1));
 6524|       |      carry=est-(DECDPUNMAX+1);              // correctly negative
 6525|       |    #else
 6526|       |      if ((ueInt)carry<(DECDPUNMAX+1)*2){    // fastpath carry 1
 6527|       |        *c=(Unit)(carry-(DECDPUNMAX+1));
 6528|       |        carry=1;
 6529|       |        continue;
 6530|       |        }
 6531|       |      // remainder operator is undefined if negative, so must test
 6532|       |      if (carry>=0) {
 6533|       |        *c=(Unit)(carry%(DECDPUNMAX+1));
 6534|       |        carry=carry/(DECDPUNMAX+1);
 6535|       |        continue;
 6536|       |        }
 6537|       |      // negative case
 6538|       |      carry=carry+(eInt)(DECDPUNMAX+1)*(DECDPUNMAX+1); // make positive
 6539|       |      *c=(Unit)(carry%(DECDPUNMAX+1));
 6540|       |      carry=carry/(DECDPUNMAX+1)-(DECDPUNMAX+1);
 6541|       |    #endif
 6542|      0|    } // c
 6543|       |
 6544|       |  // OK, all A and B processed; might still have carry or borrow
 6545|       |  // return number of Units in the result, negated if a borrow
 6546|  3.29k|  if (carry==0) return c-clsu;     // no carry, so no more to do
  ------------------
  |  Branch (6546:7): [True: 3.29k, False: 0]
  ------------------
 6547|      0|  if (carry>0) {                   // positive carry
  ------------------
  |  Branch (6547:7): [True: 0, False: 0]
  ------------------
 6548|      0|    *c=(Unit)carry;                // place as new unit
 6549|      0|    c++;                           // ..
 6550|      0|    return c-clsu;
 6551|      0|    }
 6552|       |  // -ve carry: it's a borrow; complement needed
 6553|      0|  add=1;                           // temporary carry...
 6554|      0|  for (c=clsu; c<maxC; c++) {
  ------------------
  |  Branch (6554:16): [True: 0, False: 0]
  ------------------
 6555|      0|    add=DECDPUNMAX+add-*c;
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
 6556|      0|    if (add<=DECDPUNMAX) {
  ------------------
  |  |  209|      0|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6556:9): [True: 0, False: 0]
  ------------------
 6557|      0|      *c=(Unit)add;
 6558|      0|      add=0;
 6559|      0|      }
 6560|      0|     else {
 6561|      0|      *c=0;
 6562|      0|      add=1;
 6563|      0|      }
 6564|      0|    }
 6565|       |  // add an extra unit iff it would be non-zero
 6566|       |  #if DECTRACE
 6567|       |    printf("UAS borrow: add %ld, carry %ld\n", add, carry);
 6568|       |  #endif
 6569|      0|  if ((add-carry-1)!=0) {
  ------------------
  |  Branch (6569:7): [True: 0, False: 0]
  ------------------
 6570|      0|    *c=(Unit)(add-carry-1);
 6571|      0|    c++;                      // interesting, include it
 6572|      0|    }
 6573|      0|  return clsu-c;              // -ve result indicates borrowed
 6574|      0|  } // decUnitAddSub
decNumber.c:decApplyRound:
 7071|  7.60k|                          uInt *status) {
 7072|  7.60k|  Int  bump;                  // 1 if coefficient needs to be incremented
  ------------------
  |  |   92|  7.60k|  #define Int    int32_t
  ------------------
 7073|       |                              // -1 if coefficient needs to be decremented
 7074|       |
 7075|  7.60k|  if (residue==0) return;     // nothing to apply
  ------------------
  |  Branch (7075:7): [True: 1.37k, False: 6.23k]
  ------------------
 7076|       |
 7077|  6.23k|  bump=0;                     // assume a smooth ride
 7078|       |
 7079|       |  // now decide whether, and how, to round, depending on mode
 7080|  6.23k|  switch (set->round) {
 7081|      0|    case DEC_ROUND_05UP: {    // round zero or five up (for reround)
  ------------------
  |  Branch (7081:5): [True: 0, False: 6.23k]
  ------------------
 7082|       |      // This is the same as DEC_ROUND_DOWN unless there is a
 7083|       |      // positive residue and the lsd of dn is 0 or 5, in which case
 7084|       |      // it is bumped; when residue is <0, the number is therefore
 7085|       |      // bumped down unless the final digit was 1 or 6 (in which
 7086|       |      // case it is bumped down and then up -- a no-op)
 7087|      0|      Int lsd5=*dn->lsu%5;     // get lsd and quintate
  ------------------
  |  |   92|      0|  #define Int    int32_t
  ------------------
 7088|      0|      if (residue<0 && lsd5!=1) bump=-1;
  ------------------
  |  Branch (7088:11): [True: 0, False: 0]
  |  Branch (7088:24): [True: 0, False: 0]
  ------------------
 7089|      0|       else if (residue>0 && lsd5==0) bump=1;
  ------------------
  |  Branch (7089:17): [True: 0, False: 0]
  |  Branch (7089:30): [True: 0, False: 0]
  ------------------
 7090|       |      // [bump==1 could be applied directly; use common path for clarity]
 7091|      0|      break;} // r-05
 7092|       |
 7093|      0|    case DEC_ROUND_DOWN: {
  ------------------
  |  Branch (7093:5): [True: 0, False: 6.23k]
  ------------------
 7094|       |      // no change, except if negative residue
 7095|      0|      if (residue<0) bump=-1;
  ------------------
  |  Branch (7095:11): [True: 0, False: 0]
  ------------------
 7096|      0|      break;} // r-d
 7097|       |
 7098|      0|    case DEC_ROUND_HALF_DOWN: {
  ------------------
  |  Branch (7098:5): [True: 0, False: 6.23k]
  ------------------
 7099|      0|      if (residue>5) bump=1;
  ------------------
  |  Branch (7099:11): [True: 0, False: 0]
  ------------------
 7100|      0|      break;} // r-h-d
 7101|       |
 7102|      0|    case DEC_ROUND_HALF_EVEN: {
  ------------------
  |  Branch (7102:5): [True: 0, False: 6.23k]
  ------------------
 7103|      0|      if (residue>5) bump=1;            // >0.5 goes up
  ------------------
  |  Branch (7103:11): [True: 0, False: 0]
  ------------------
 7104|      0|       else if (residue==5) {           // exactly 0.5000...
  ------------------
  |  Branch (7104:17): [True: 0, False: 0]
  ------------------
 7105|       |        // 0.5 goes up iff [new] lsd is odd
 7106|      0|        if (*dn->lsu & 0x01) bump=1;
  ------------------
  |  Branch (7106:13): [True: 0, False: 0]
  ------------------
 7107|      0|        }
 7108|      0|      break;} // r-h-e
 7109|       |
 7110|  6.23k|    case DEC_ROUND_HALF_UP: {
  ------------------
  |  Branch (7110:5): [True: 6.23k, False: 0]
  ------------------
 7111|  6.23k|      if (residue>=5) bump=1;
  ------------------
  |  Branch (7111:11): [True: 4.37k, False: 1.85k]
  ------------------
 7112|  6.23k|      break;} // r-h-u
 7113|       |
 7114|      0|    case DEC_ROUND_UP: {
  ------------------
  |  Branch (7114:5): [True: 0, False: 6.23k]
  ------------------
 7115|      0|      if (residue>0) bump=1;
  ------------------
  |  Branch (7115:11): [True: 0, False: 0]
  ------------------
 7116|      0|      break;} // r-u
 7117|       |
 7118|      0|    case DEC_ROUND_CEILING: {
  ------------------
  |  Branch (7118:5): [True: 0, False: 6.23k]
  ------------------
 7119|       |      // same as _UP for positive numbers, and as _DOWN for negatives
 7120|       |      // [negative residue cannot occur on 0]
 7121|      0|      if (decNumberIsNegative(dn)) {
  ------------------
  |  |  173|      0|  #define decNumberIsNegative(dn)  (((dn)->bits&DECNEG)!=0)
  |  |  ------------------
  |  |  |  |   31|      0|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  |  |  ------------------
  |  |  |  Branch (173:36): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 7122|      0|        if (residue<0) bump=-1;
  ------------------
  |  Branch (7122:13): [True: 0, False: 0]
  ------------------
 7123|      0|        }
 7124|      0|       else {
 7125|      0|        if (residue>0) bump=1;
  ------------------
  |  Branch (7125:13): [True: 0, False: 0]
  ------------------
 7126|      0|        }
 7127|      0|      break;} // r-c
 7128|       |
 7129|      0|    case DEC_ROUND_FLOOR: {
  ------------------
  |  Branch (7129:5): [True: 0, False: 6.23k]
  ------------------
 7130|       |      // same as _UP for negative numbers, and as _DOWN for positive
 7131|       |      // [negative residue cannot occur on 0]
 7132|      0|      if (!decNumberIsNegative(dn)) {
  ------------------
  |  |  173|      0|  #define decNumberIsNegative(dn)  (((dn)->bits&DECNEG)!=0)
  |  |  ------------------
  |  |  |  |   31|      0|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  |  |  ------------------
  ------------------
  |  Branch (7132:11): [True: 0, False: 0]
  ------------------
 7133|      0|        if (residue<0) bump=-1;
  ------------------
  |  Branch (7133:13): [True: 0, False: 0]
  ------------------
 7134|      0|        }
 7135|      0|       else {
 7136|      0|        if (residue>0) bump=1;
  ------------------
  |  Branch (7136:13): [True: 0, False: 0]
  ------------------
 7137|      0|        }
 7138|      0|      break;} // r-f
 7139|       |
 7140|      0|    default: {      // e.g., DEC_ROUND_MAX
  ------------------
  |  Branch (7140:5): [True: 0, False: 6.23k]
  ------------------
 7141|      0|      *status|=DEC_Invalid_context;
  ------------------
  |  |  134|      0|    #define DEC_Invalid_context      0x00000040
  ------------------
 7142|       |      #if DECTRACE || (DECCHECK && DECVERB)
 7143|       |      printf("Unknown rounding mode: %d\n", set->round);
 7144|       |      #endif
 7145|      0|      break;}
 7146|  6.23k|    } // switch
 7147|       |
 7148|       |  // now bump the number, up or down, if need be
 7149|  6.23k|  if (bump==0) return;                       // no action required
  ------------------
  |  Branch (7149:7): [True: 1.85k, False: 4.37k]
  ------------------
 7150|       |
 7151|       |  // Simply use decUnitAddSub unless bumping up and the number is
 7152|       |  // all nines.  In this special case set to 100... explicitly
 7153|       |  // and adjust the exponent by one (as otherwise could overflow
 7154|       |  // the array)
 7155|       |  // Similarly handle all-nines result if bumping down.
 7156|  4.37k|  if (bump>0) {
  ------------------
  |  Branch (7156:7): [True: 4.37k, False: 0]
  ------------------
 7157|  4.37k|    Unit *up;                                // work
  ------------------
  |  |   94|  4.37k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  4.37k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 7158|  4.37k|    uInt count=dn->digits;                   // digits to be checked
  ------------------
  |  |   93|  4.37k|  #define uInt   uint32_t
  ------------------
 7159|  5.11M|    for (up=dn->lsu; ; up++) {
 7160|  5.11M|      if (count<=DECDPUN) {
  ------------------
  |  |   43|  5.11M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (7160:11): [True: 2.58k, False: 5.11M]
  ------------------
 7161|       |        // this is the last Unit (the msu)
 7162|  2.58k|        if (*up!=powers[count]-1) break;     // not still 9s
  ------------------
  |  |  177|  2.58k|#define powers      DECPOWERS      // old internal name
  ------------------
  |  Branch (7162:13): [True: 1.49k, False: 1.08k]
  ------------------
 7163|       |        // here if it, too, is all nines
 7164|  1.08k|        *up=(Unit)powers[count-1];           // here 999 -> 100 etc.
  ------------------
  |  |  177|  1.08k|#define powers      DECPOWERS      // old internal name
  ------------------
 7165|  4.63M|        for (up=up-1; up>=dn->lsu; up--) *up=0; // others all to 0
  ------------------
  |  Branch (7165:23): [True: 4.63M, False: 1.08k]
  ------------------
 7166|  1.08k|        dn->exponent++;                      // and bump exponent
 7167|       |        // [which, very rarely, could cause Overflow...]
 7168|  1.08k|        if ((dn->exponent+dn->digits)>set->emax+1) {
  ------------------
  |  Branch (7168:13): [True: 0, False: 1.08k]
  ------------------
 7169|      0|          decSetOverflow(dn, set, status);
 7170|      0|          }
 7171|  1.08k|        return;                              // done
 7172|  2.58k|        }
 7173|       |      // a full unit to check, with more to come
 7174|  5.11M|      if (*up!=DECDPUNMAX) break;            // not still 9s
  ------------------
  |  |  209|  5.11M|    #define DECDPUNMAX 999
  ------------------
  |  Branch (7174:11): [True: 1.79k, False: 5.11M]
  ------------------
 7175|  5.11M|      count-=DECDPUN;
  ------------------
  |  |   43|  5.11M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7176|  5.11M|      } // up
 7177|  4.37k|    } // bump>0
 7178|      0|   else {                                    // -1
 7179|       |    // here checking for a pre-bump of 1000... (leading 1, all
 7180|       |    // other digits zero)
 7181|      0|    Unit *up, *sup;                          // work
  ------------------
  |  |   94|      0|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|      0|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 7182|      0|    uInt count=dn->digits;                   // digits to be checked
  ------------------
  |  |   93|      0|  #define uInt   uint32_t
  ------------------
 7183|      0|    for (up=dn->lsu; ; up++) {
 7184|      0|      if (count<=DECDPUN) {
  ------------------
  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (7184:11): [True: 0, False: 0]
  ------------------
 7185|       |        // this is the last Unit (the msu)
 7186|      0|        if (*up!=powers[count-1]) break;     // not 100..
  ------------------
  |  |  177|      0|#define powers      DECPOWERS      // old internal name
  ------------------
  |  Branch (7186:13): [True: 0, False: 0]
  ------------------
 7187|       |        // here if have the 1000... case
 7188|      0|        sup=up;                              // save msu pointer
 7189|      0|        *up=(Unit)powers[count]-1;           // here 100 in msu -> 999
  ------------------
  |  |  177|      0|#define powers      DECPOWERS      // old internal name
  ------------------
 7190|       |        // others all to all-nines, too
 7191|      0|        for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1;
  ------------------
  |  |  177|      0|#define powers      DECPOWERS      // old internal name
  ------------------
                      for (up=up-1; up>=dn->lsu; up--) *up=(Unit)powers[DECDPUN]-1;
  ------------------
  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (7191:23): [True: 0, False: 0]
  ------------------
 7192|      0|        dn->exponent--;                      // and bump exponent
 7193|       |
 7194|       |        // iff the number was at the subnormal boundary (exponent=etiny)
 7195|       |        // then the exponent is now out of range, so it will in fact get
 7196|       |        // clamped to etiny and the final 9 dropped.
 7197|       |        // printf(">> emin=%d exp=%d sdig=%d\n", set->emin,
 7198|       |        //        dn->exponent, set->digits);
 7199|      0|        if (dn->exponent+1==set->emin-set->digits+1) {
  ------------------
  |  Branch (7199:13): [True: 0, False: 0]
  ------------------
 7200|      0|          if (count==1 && dn->digits==1) *sup=0;  // here 9 -> 0[.9]
  ------------------
  |  Branch (7200:15): [True: 0, False: 0]
  |  Branch (7200:27): [True: 0, False: 0]
  ------------------
 7201|      0|           else {
 7202|      0|            *sup=(Unit)powers[count-1]-1;    // here 999.. in msu -> 99..
  ------------------
  |  |  177|      0|#define powers      DECPOWERS      // old internal name
  ------------------
 7203|      0|            dn->digits--;
 7204|      0|            }
 7205|      0|          dn->exponent++;
 7206|      0|          *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  143|      0|    #define DEC_Underflow            0x00002000
  ------------------
                        *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  142|      0|    #define DEC_Subnormal            0x00001000
  ------------------
                        *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  133|      0|    #define DEC_Inexact              0x00000020
  ------------------
                        *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  141|      0|    #define DEC_Rounded              0x00000800
  ------------------
 7207|      0|          }
 7208|      0|        return;                              // done
 7209|      0|        }
 7210|       |
 7211|       |      // a full unit to check, with more to come
 7212|      0|      if (*up!=0) break;                     // not still 0s
  ------------------
  |  Branch (7212:11): [True: 0, False: 0]
  ------------------
 7213|      0|      count-=DECDPUN;
  ------------------
  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7214|      0|      } // up
 7215|       |
 7216|      0|    } // bump<0
 7217|       |
 7218|       |  // Actual bump needed.  Do it.
 7219|  3.29k|  decUnitAddSub(dn->lsu, D2U(dn->digits), uarrone, 1, 0, dn->lsu, bump);
  ------------------
  |  |  264|  3.29k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|  3.29k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    245|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    245|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 3.05k, False: 245]
  |  |  ------------------
  ------------------
 7220|  3.29k|  } // decApplyRound
decNumber.c:decSetOverflow:
 7348|    945|static void decSetOverflow(decNumber *dn, decContext *set, uInt *status) {
 7349|    945|  Flag needmax=0;                  // result is maximum finite value
  ------------------
  |  |   87|    945|  #define Flag   uint8_t
  ------------------
 7350|    945|  uByte sign=dn->bits&DECNEG;      // clean and save sign bit
  ------------------
  |  |   89|    945|  #define uByte  uint8_t
  ------------------
                uByte sign=dn->bits&DECNEG;      // clean and save sign bit
  ------------------
  |  |   31|    945|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  ------------------
 7351|       |
 7352|    945|  if (ISZERO(dn)) {                // zero does not overflow magnitude
  ------------------
  |  |  255|    945|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|    945|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 516, False: 429]
  |  |  |  |  ------------------
  |  |  |  |  178|    945|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 314, False: 202]
  |  |  |  |  ------------------
  |  |  |  |  179|    945|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    314|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|    314|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|    314|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|    314|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 314, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7353|    314|    Int emax=set->emax;                      // limit value
  ------------------
  |  |   92|    314|  #define Int    int32_t
  ------------------
 7354|    314|    if (set->clamp) emax-=set->digits-1;     // lower if clamping
  ------------------
  |  Branch (7354:9): [True: 0, False: 314]
  ------------------
 7355|    314|    if (dn->exponent>emax) {                 // clamp required
  ------------------
  |  Branch (7355:9): [True: 314, False: 0]
  ------------------
 7356|    314|      dn->exponent=emax;
 7357|    314|      *status|=DEC_Clamped;
  ------------------
  |  |  140|    314|    #define DEC_Clamped              0x00000400
  ------------------
 7358|    314|      }
 7359|    314|    return;
 7360|    314|    }
 7361|       |
 7362|    631|  decNumberZero(dn);
 7363|    631|  switch (set->round) {
 7364|      0|    case DEC_ROUND_DOWN: {
  ------------------
  |  Branch (7364:5): [True: 0, False: 631]
  ------------------
 7365|      0|      needmax=1;                   // never Infinity
 7366|      0|      break;} // r-d
 7367|      0|    case DEC_ROUND_05UP: {
  ------------------
  |  Branch (7367:5): [True: 0, False: 631]
  ------------------
 7368|      0|      needmax=1;                   // never Infinity
 7369|      0|      break;} // r-05
 7370|      0|    case DEC_ROUND_CEILING: {
  ------------------
  |  Branch (7370:5): [True: 0, False: 631]
  ------------------
 7371|      0|      if (sign) needmax=1;         // Infinity if non-negative
  ------------------
  |  Branch (7371:11): [True: 0, False: 0]
  ------------------
 7372|      0|      break;} // r-c
 7373|      0|    case DEC_ROUND_FLOOR: {
  ------------------
  |  Branch (7373:5): [True: 0, False: 631]
  ------------------
 7374|      0|      if (!sign) needmax=1;        // Infinity if negative
  ------------------
  |  Branch (7374:11): [True: 0, False: 0]
  ------------------
 7375|      0|      break;} // r-f
 7376|    631|    default: break;                // Infinity in all other cases
  ------------------
  |  Branch (7376:5): [True: 631, False: 0]
  ------------------
 7377|    631|    }
 7378|    631|  if (needmax) {
  ------------------
  |  Branch (7378:7): [True: 0, False: 631]
  ------------------
 7379|      0|    decSetMaxValue(dn, set);
 7380|      0|    dn->bits=sign;                 // set sign
 7381|      0|    }
 7382|    631|   else dn->bits=sign|DECINF;      // Value is +/-Infinity
  ------------------
  |  |   32|    631|  #define DECINF    0x40      /* 1=Infinity                           */
  ------------------
 7383|    631|  *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  139|    631|    #define DEC_Overflow             0x00000200
  ------------------
                *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  133|    631|    #define DEC_Inexact              0x00000020
  ------------------
                *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  141|    631|    #define DEC_Rounded              0x00000800
  ------------------
 7384|    631|  } // decSetOverflow
decNumber.c:decTrim:
 6592|  5.19k|                           Flag noclamp, Int *dropped) {
 6593|  5.19k|  Int   d, exp;                    // work
  ------------------
  |  |   92|  5.19k|  #define Int    int32_t
  ------------------
 6594|  5.19k|  uInt  cut;                       // ..
  ------------------
  |  |   93|  5.19k|  #define uInt   uint32_t
  ------------------
 6595|  5.19k|  Unit  *up;                       // -> current Unit
  ------------------
  |  |   94|  5.19k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  5.19k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6596|       |
 6597|       |  #if DECCHECK
 6598|       |  if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
 6599|       |  #endif
 6600|       |
 6601|  5.19k|  *dropped=0;                           // assume no zeros dropped
 6602|  5.19k|  if ((dn->bits & DECSPECIAL)           // fast exit if special ..
  ------------------
  |  |   36|  5.19k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   32|  5.19k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   33|  5.19k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   34|  5.19k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  |  Branch (6602:7): [True: 5.19k, False: 0]
  ------------------
 6603|  5.19k|    || (*dn->lsu & 0x01)) return dn;    // .. or odd
  ------------------
  |  Branch (6603:8): [True: 0, False: 0]
  ------------------
 6604|      0|  if (ISZERO(dn)) {                     // .. or 0
  ------------------
  |  |  255|      0|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|      0|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  178|      0|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  179|      0|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|      0|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|      0|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 6605|      0|    dn->exponent=0;                     // (sign is preserved)
 6606|      0|    return dn;
 6607|      0|    }
 6608|       |
 6609|       |  // have a finite number which is even
 6610|      0|  exp=dn->exponent;
 6611|      0|  cut=1;                           // digit (1-DECDPUN) in Unit
 6612|      0|  up=dn->lsu;                      // -> current Unit
 6613|      0|  for (d=0; d<dn->digits-1; d++) { // [don't strip the final digit]
  ------------------
  |  Branch (6613:13): [True: 0, False: 0]
  ------------------
 6614|       |    // slice by powers
 6615|      0|    #if DECDPUN<=4
 6616|      0|      uInt quot=QUOT10(*up, cut);
  ------------------
  |  |   93|      0|  #define uInt   uint32_t
  ------------------
                    uInt quot=QUOT10(*up, cut);
  ------------------
  |  |  210|      0|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 6617|      0|      if ((*up-quot*powers[cut])!=0) break;  // found non-0 digit
  ------------------
  |  |  177|      0|#define powers      DECPOWERS      // old internal name
  ------------------
  |  Branch (6617:11): [True: 0, False: 0]
  ------------------
 6618|       |    #else
 6619|       |      if (*up%powers[cut]!=0) break;         // found non-0 digit
 6620|       |    #endif
 6621|       |    // have a trailing 0
 6622|      0|    if (!all) {                    // trimming
  ------------------
  |  Branch (6622:9): [True: 0, False: 0]
  ------------------
 6623|       |      // [if exp>0 then all trailing 0s are significant for trim]
 6624|      0|      if (exp<=0) {                // if digit might be significant
  ------------------
  |  Branch (6624:11): [True: 0, False: 0]
  ------------------
 6625|      0|        if (exp==0) break;         // then quit
  ------------------
  |  Branch (6625:13): [True: 0, False: 0]
  ------------------
 6626|      0|        exp++;                     // next digit might be significant
 6627|      0|        }
 6628|      0|      }
 6629|      0|    cut++;                         // next power
 6630|      0|    if (cut>DECDPUN) {             // need new Unit
  ------------------
  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6630:9): [True: 0, False: 0]
  ------------------
 6631|      0|      up++;
 6632|      0|      cut=1;
 6633|      0|      }
 6634|      0|    } // d
 6635|      0|  if (d==0) return dn;             // none to drop
  ------------------
  |  Branch (6635:7): [True: 0, False: 0]
  ------------------
 6636|       |
 6637|       |  // may need to limit drop if clamping
 6638|      0|  if (set->clamp && !noclamp) {
  ------------------
  |  Branch (6638:7): [True: 0, False: 0]
  |  Branch (6638:21): [True: 0, False: 0]
  ------------------
 6639|      0|    Int maxd=set->emax-set->digits+1-dn->exponent;
  ------------------
  |  |   92|      0|  #define Int    int32_t
  ------------------
 6640|      0|    if (maxd<=0) return dn;        // nothing possible
  ------------------
  |  Branch (6640:9): [True: 0, False: 0]
  ------------------
 6641|      0|    if (d>maxd) d=maxd;
  ------------------
  |  Branch (6641:9): [True: 0, False: 0]
  ------------------
 6642|      0|    }
 6643|       |
 6644|       |  // effect the drop
 6645|      0|  decShiftToLeast(dn->lsu, D2U(dn->digits), d);
  ------------------
  |  |  264|      0|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|      0|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 0, False: 0]
  |  |  ------------------
  ------------------
 6646|      0|  dn->exponent+=d;                 // maintain numerical value
 6647|      0|  dn->digits-=d;                   // new length
 6648|      0|  *dropped=d;                      // report the count
 6649|      0|  return dn;
 6650|      0|  } // decTrim
decNumber.c:decShiftToMost:
 6685|  1.08k|static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
 6686|  1.08k|  Unit  *target, *source, *first;  // work
  ------------------
  |  |   94|  1.08k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  1.08k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6687|  1.08k|  Int   cut;                       // odd 0's to add
  ------------------
  |  |   92|  1.08k|  #define Int    int32_t
  ------------------
 6688|  1.08k|  uInt  next;                      // work
  ------------------
  |  |   93|  1.08k|  #define uInt   uint32_t
  ------------------
 6689|       |
 6690|  1.08k|  if (shift==0) return digits;     // [fastpath] nothing to do
  ------------------
  |  Branch (6690:7): [True: 0, False: 1.08k]
  ------------------
 6691|  1.08k|  if ((digits+shift)<=DECDPUN) {   // [fastpath] single-unit case
  ------------------
  |  |   43|  1.08k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6691:7): [True: 465, False: 616]
  ------------------
 6692|    465|    *uar=(Unit)(*uar*powers[shift]);
  ------------------
  |  |  177|    465|#define powers      DECPOWERS      // old internal name
  ------------------
 6693|    465|    return digits+shift;
 6694|    465|    }
 6695|       |
 6696|    616|  next=0;                          // all paths
 6697|    616|  source=uar+D2U(digits)-1;        // where msu comes from
  ------------------
  |  |  264|    616|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    616|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    293|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    293|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 323, False: 293]
  |  |  ------------------
  ------------------
 6698|    616|  target=source+D2U(shift);        // where upper part of first cut goes
  ------------------
  |  |  264|    616|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    616|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 616, False: 0]
  |  |  ------------------
  ------------------
 6699|    616|  cut=DECDPUN-MSUDIGITS(shift);    // where to slice
  ------------------
  |  |   43|    616|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
                cut=DECDPUN-MSUDIGITS(shift);    // where to slice
  ------------------
  |  |  271|    616|  #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |  264|    616|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  249|    616|  #define DECMAXD2U 49
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|      0|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (264:21): [True: 616, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                 #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    616|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  ------------------
 6700|    616|  if (cut==0) {                    // unit-boundary case
  ------------------
  |  Branch (6700:7): [True: 0, False: 616]
  ------------------
 6701|      0|    for (; source>=uar; source--, target--) *target=*source;
  ------------------
  |  Branch (6701:12): [True: 0, False: 0]
  ------------------
 6702|      0|    }
 6703|    616|   else {
 6704|    616|    first=uar+D2U(digits+shift)-1; // where msu of source will end up
  ------------------
  |  |  264|    616|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    616|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    327|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    327|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 289, False: 327]
  |  |  ------------------
  ------------------
 6705|  4.63M|    for (; source>=uar; source--, target--) {
  ------------------
  |  Branch (6705:12): [True: 4.63M, False: 616]
  ------------------
 6706|       |      // split the source Unit and accumulate remainder for next
 6707|  4.63M|      #if DECDPUN<=4
 6708|  4.63M|        uInt quot=QUOT10(*source, cut);
  ------------------
  |  |   93|  4.63M|  #define uInt   uint32_t
  ------------------
                      uInt quot=QUOT10(*source, cut);
  ------------------
  |  |  210|  4.63M|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 6709|  4.63M|        uInt rem=*source-quot*powers[cut];
  ------------------
  |  |   93|  4.63M|  #define uInt   uint32_t
  ------------------
                      uInt rem=*source-quot*powers[cut];
  ------------------
  |  |  177|  4.63M|#define powers      DECPOWERS      // old internal name
  ------------------
 6710|  4.63M|        next+=quot;
 6711|       |      #else
 6712|       |        uInt rem=*source%powers[cut];
 6713|       |        next+=*source/powers[cut];
 6714|       |      #endif
 6715|  4.63M|      if (target<=first) *target=(Unit)next;   // write to target iff valid
  ------------------
  |  Branch (6715:11): [True: 4.63M, False: 513]
  ------------------
 6716|  4.63M|      next=rem*powers[DECDPUN-cut];            // save remainder for next Unit
  ------------------
  |  |  177|  4.63M|#define powers      DECPOWERS      // old internal name
  ------------------
                    next=rem*powers[DECDPUN-cut];            // save remainder for next Unit
  ------------------
  |  |   43|  4.63M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6717|  4.63M|      }
 6718|    616|    } // shift-move
 6719|       |
 6720|       |  // propagate any partial unit to one below and clear the rest
 6721|  1.23k|  for (; target>=uar; target--) {
  ------------------
  |  Branch (6721:10): [True: 616, False: 616]
  ------------------
 6722|    616|    *target=(Unit)next;
 6723|    616|    next=0;
 6724|    616|    }
 6725|    616|  return digits+shift;
 6726|  1.08k|  } // decShiftToMost
decNumber.c:decCopyFit:
 6844|  5.19k|                       decContext *set, Int *residue, uInt *status) {
 6845|  5.19k|  dest->bits=src->bits;
 6846|  5.19k|  dest->exponent=src->exponent;
 6847|  5.19k|  decSetCoeff(dest, set, src->lsu, src->digits, residue, status);
 6848|  5.19k|  } // decCopyFit
decNumber.c:decSetCoeff:
 6890|  12.8k|                        Int len, Int *residue, uInt *status) {
 6891|  12.8k|  Int   discard;              // number of digits to discard
  ------------------
  |  |   92|  12.8k|  #define Int    int32_t
  ------------------
 6892|  12.8k|  uInt  cut;                  // cut point in Unit
  ------------------
  |  |   93|  12.8k|  #define uInt   uint32_t
  ------------------
 6893|  12.8k|  const Unit *up;             // work
 6894|  12.8k|  Unit  *target;              // ..
  ------------------
  |  |   94|  12.8k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  12.8k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6895|  12.8k|  Int   count;                // ..
  ------------------
  |  |   92|  12.8k|  #define Int    int32_t
  ------------------
 6896|  12.8k|  #if DECDPUN<=4
 6897|  12.8k|  uInt  temp;                 // ..
  ------------------
  |  |   93|  12.8k|  #define uInt   uint32_t
  ------------------
 6898|  12.8k|  #endif
 6899|       |
 6900|  12.8k|  discard=len-set->digits;    // digits to discard
 6901|  12.8k|  if (discard<=0) {           // no digits are being discarded
  ------------------
  |  Branch (6901:7): [True: 5.19k, False: 7.60k]
  ------------------
 6902|  5.19k|    if (dn->lsu!=lsu) {       // copy needed
  ------------------
  |  Branch (6902:9): [True: 5.19k, False: 0]
  ------------------
 6903|       |      // copy the coefficient array to the result number; no shift needed
 6904|  5.19k|      count=len;              // avoids D2U
 6905|  5.19k|      up=lsu;
 6906|  10.3k|      for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
  ------------------
  |  |   43|  5.19k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6906:28): [True: 5.19k, False: 5.19k]
  ------------------
 6907|  5.19k|        *target=*up;
 6908|  5.19k|      dn->digits=len;         // set the new length
 6909|  5.19k|      }
 6910|       |    // dn->exponent and residue are unchanged, record any inexactitude
 6911|  5.19k|    if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded);
  ------------------
  |  |  133|      0|    #define DEC_Inexact              0x00000020
  ------------------
                  if (*residue!=0) *status|=(DEC_Inexact | DEC_Rounded);
  ------------------
  |  |  141|      0|    #define DEC_Rounded              0x00000800
  ------------------
  |  Branch (6911:9): [True: 0, False: 5.19k]
  ------------------
 6912|  5.19k|    return;
 6913|  5.19k|    }
 6914|       |
 6915|       |  // some digits must be discarded ...
 6916|  7.60k|  dn->exponent+=discard;      // maintain numerical value
 6917|  7.60k|  *status|=DEC_Rounded;       // accumulate Rounded status
  ------------------
  |  |  141|  7.60k|    #define DEC_Rounded              0x00000800
  ------------------
 6918|  7.60k|  if (*residue>1) *residue=1; // previous residue now to right, so reduce
  ------------------
  |  Branch (6918:7): [True: 0, False: 7.60k]
  ------------------
 6919|       |
 6920|  7.60k|  if (discard>len) {          // everything, +1, is being discarded
  ------------------
  |  Branch (6920:7): [True: 306, False: 7.30k]
  ------------------
 6921|       |    // guard digit is 0
 6922|       |    // residue is all the number [NB could be all 0s]
 6923|    306|    if (*residue<=0) {        // not already positive
  ------------------
  |  Branch (6923:9): [True: 306, False: 0]
  ------------------
 6924|    306|      count=len;              // avoids D2U
 6925|    531|      for (up=lsu; count>0; up++, count-=DECDPUN) if (*up!=0) { // found non-0
  ------------------
  |  |   43|    225|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6925:20): [True: 531, False: 0]
  |  Branch (6925:55): [True: 306, False: 225]
  ------------------
 6926|    306|        *residue=1;
 6927|    306|        break;                // no need to check any others
 6928|    306|        }
 6929|    306|      }
 6930|    306|    if (*residue!=0) *status|=DEC_Inexact; // record inexactitude
  ------------------
  |  |  133|    306|    #define DEC_Inexact              0x00000020
  ------------------
  |  Branch (6930:9): [True: 306, False: 0]
  ------------------
 6931|    306|    *dn->lsu=0;               // coefficient will now be 0
 6932|    306|    dn->digits=1;             // ..
 6933|    306|    return;
 6934|    306|    } // total discard
 6935|       |
 6936|       |  // partial discard [most common case]
 6937|       |  // here, at least the first (most significant) discarded digit exists
 6938|       |
 6939|       |  // spin up the number, noting residue during the spin, until get to
 6940|       |  // the Unit with the first discarded digit.  When reach it, extract
 6941|       |  // it and remember its position
 6942|  7.30k|  count=0;
 6943|  50.0k|  for (up=lsu;; up++) {
 6944|  50.0k|    count+=DECDPUN;
  ------------------
  |  |   43|  50.0k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6945|  50.0k|    if (count>=discard) break; // full ones all checked
  ------------------
  |  Branch (6945:9): [True: 7.30k, False: 42.7k]
  ------------------
 6946|  42.7k|    if (*up!=0) *residue=1;
  ------------------
  |  Branch (6946:9): [True: 40.7k, False: 1.97k]
  ------------------
 6947|  42.7k|    } // up
 6948|       |
 6949|       |  // here up -> Unit with first discarded digit
 6950|  7.30k|  cut=discard-(count-DECDPUN)-1;
  ------------------
  |  |   43|  7.30k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6951|  7.30k|  if (cut==DECDPUN-1) {       // unit-boundary case (fast)
  ------------------
  |  |   43|  7.30k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6951:7): [True: 2.20k, False: 5.10k]
  ------------------
 6952|  2.20k|    Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |   94|  2.20k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  2.20k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
                  Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |  177|  2.20k|#define powers      DECPOWERS      // old internal name
  ------------------
                  Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |   43|  2.20k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6953|       |    // set residue directly
 6954|  2.20k|    if (*up>=half) {
  ------------------
  |  Branch (6954:9): [True: 541, False: 1.65k]
  ------------------
 6955|    541|      if (*up>half) *residue=7;
  ------------------
  |  Branch (6955:11): [True: 217, False: 324]
  ------------------
 6956|    324|      else *residue+=5;       // add sticky bit
 6957|    541|      }
 6958|  1.65k|     else { // <half
 6959|  1.65k|      if (*up!=0) *residue=3; // [else is 0, leave as sticky bit]
  ------------------
  |  Branch (6959:11): [True: 1.34k, False: 316]
  ------------------
 6960|  1.65k|      }
 6961|  2.20k|    if (set->digits<=0) {     // special for Quantize/Subnormal :-(
  ------------------
  |  Branch (6961:9): [True: 677, False: 1.52k]
  ------------------
 6962|    677|      *dn->lsu=0;             // .. result is 0
 6963|    677|      dn->digits=1;           // ..
 6964|    677|      }
 6965|  1.52k|     else {                   // shift to least
 6966|  1.52k|      count=set->digits;      // now digits to end up with
 6967|  1.52k|      dn->digits=count;       // set the new length
 6968|  1.52k|      up++;                   // move to next
 6969|       |      // on unit boundary, so shift-down copy loop is simple
 6970|  1.01M|      for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
  ------------------
  |  |   43|  1.00M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6970:28): [True: 1.00M, False: 1.52k]
  ------------------
 6971|  1.00M|        *target=*up;
 6972|  1.52k|      }
 6973|  2.20k|    } // unit-boundary case
 6974|       |
 6975|  5.10k|   else { // discard digit is in low digit(s), and not top digit
 6976|  5.10k|    uInt  discard1;                // first discarded digit
  ------------------
  |  |   93|  5.10k|  #define uInt   uint32_t
  ------------------
 6977|  5.10k|    uInt  quot, rem;               // for divisions
  ------------------
  |  |   93|  5.10k|  #define uInt   uint32_t
  ------------------
 6978|  5.10k|    if (cut==0) quot=*up;          // is at bottom of unit
  ------------------
  |  Branch (6978:9): [True: 3.28k, False: 1.81k]
  ------------------
 6979|  1.81k|     else /* cut>0 */ {            // it's not at bottom of unit
 6980|  1.81k|      #if DECDPUN<=4
 6981|  1.81k|        quot=QUOT10(*up, cut);
  ------------------
  |  |  210|  1.81k|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 6982|  1.81k|        rem=*up-quot*powers[cut];
  ------------------
  |  |  177|  1.81k|#define powers      DECPOWERS      // old internal name
  ------------------
 6983|       |      #else
 6984|       |        rem=*up%powers[cut];
 6985|       |        quot=*up/powers[cut];
 6986|       |      #endif
 6987|  1.81k|      if (rem!=0) *residue=1;
  ------------------
  |  Branch (6987:11): [True: 423, False: 1.39k]
  ------------------
 6988|  1.81k|      }
 6989|       |    // discard digit is now at bottom of quot
 6990|  5.10k|    #if DECDPUN<=4
 6991|  5.10k|      temp=(quot*6554)>>16;        // fast /10
 6992|       |      // Vowels algorithm here not a win (9 instructions)
 6993|  5.10k|      discard1=quot-X10(temp);
  ------------------
  |  |  163|  5.10k|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
 6994|  5.10k|      quot=temp;
 6995|       |    #else
 6996|       |      discard1=quot%10;
 6997|       |      quot=quot/10;
 6998|       |    #endif
 6999|       |    // here, discard1 is the guard digit, and residue is everything
 7000|       |    // else [use mapping array to accumulate residue safely]
 7001|  5.10k|    *residue+=resmap[discard1];
 7002|  5.10k|    cut++;                         // update cut
 7003|       |    // here: up -> Unit of the array with bottom digit
 7004|       |    //       cut is the division point for each Unit
 7005|       |    //       quot holds the uncut high-order digits for the current unit
 7006|  5.10k|    if (set->digits<=0) {          // special for Quantize/Subnormal :-(
  ------------------
  |  Branch (7006:9): [True: 903, False: 4.19k]
  ------------------
 7007|    903|      *dn->lsu=0;                  // .. result is 0
 7008|    903|      dn->digits=1;                // ..
 7009|    903|      }
 7010|  4.19k|     else {                        // shift to least needed
 7011|  4.19k|      count=set->digits;           // now digits to end up with
 7012|  4.19k|      dn->digits=count;            // set the new length
 7013|       |      // shift-copy the coefficient array to the result number
 7014|  7.54M|      for (target=dn->lsu; ; target++) {
 7015|  7.54M|        *target=(Unit)quot;
 7016|  7.54M|        count-=(DECDPUN-cut);
  ------------------
  |  |   43|  7.54M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7017|  7.54M|        if (count<=0) break;
  ------------------
  |  Branch (7017:13): [True: 2.88k, False: 7.54M]
  ------------------
 7018|  7.54M|        up++;
 7019|  7.54M|        quot=*up;
 7020|  7.54M|        #if DECDPUN<=4
 7021|  7.54M|          quot=QUOT10(quot, cut);
  ------------------
  |  |  210|  7.54M|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 7022|  7.54M|          rem=*up-quot*powers[cut];
  ------------------
  |  |  177|  7.54M|#define powers      DECPOWERS      // old internal name
  ------------------
 7023|       |        #else
 7024|       |          rem=quot%powers[cut];
 7025|       |          quot=quot/powers[cut];
 7026|       |        #endif
 7027|  7.54M|        *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
  ------------------
  |  |  177|  7.54M|#define powers      DECPOWERS      // old internal name
  ------------------
                      *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
  ------------------
  |  |   43|  7.54M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7028|  7.54M|        count-=cut;
 7029|  7.54M|        if (count<=0) break;
  ------------------
  |  Branch (7029:13): [True: 1.31k, False: 7.54M]
  ------------------
 7030|  7.54M|        } // shift-copy loop
 7031|  4.19k|      } // shift to least
 7032|  5.10k|    } // not unit boundary
 7033|       |
 7034|  7.30k|  if (*residue!=0) *status|=DEC_Inexact; // record inexactitude
  ------------------
  |  |  133|  5.92k|    #define DEC_Inexact              0x00000020
  ------------------
  |  Branch (7034:7): [True: 5.92k, False: 1.37k]
  ------------------
 7035|  7.30k|  return;
 7036|  7.60k|  } // decSetCoeff
decNumber.c:decFinalize:
 7275|  27.6k|                        uInt *status) {
 7276|  27.6k|  Int shift;                            // shift needed if clamping
  ------------------
  |  |   92|  27.6k|  #define Int    int32_t
  ------------------
 7277|  27.6k|  Int tinyexp=set->emin-dn->digits+1;   // precalculate subnormal boundary
  ------------------
  |  |   92|  27.6k|  #define Int    int32_t
  ------------------
 7278|       |
 7279|       |  // Must be careful, here, when checking the exponent as the
 7280|       |  // adjusted exponent could overflow 31 bits [because it may already
 7281|       |  // be up to twice the expected].
 7282|       |
 7283|       |  // First test for subnormal.  This must be done before any final
 7284|       |  // round as the result could be rounded to Nmin or 0.
 7285|  27.6k|  if (dn->exponent<=tinyexp) {          // prefilter
  ------------------
  |  Branch (7285:7): [True: 21.2k, False: 6.41k]
  ------------------
 7286|  21.2k|    Int comp;
  ------------------
  |  |   92|  21.2k|  #define Int    int32_t
  ------------------
 7287|  21.2k|    decNumber nmin;
 7288|       |    // A very nasty case here is dn == Nmin and residue<0
 7289|  21.2k|    if (dn->exponent<tinyexp) {
  ------------------
  |  Branch (7289:9): [True: 21.2k, False: 0]
  ------------------
 7290|       |      // Go handle subnormals; this will apply round if needed.
 7291|  21.2k|      decSetSubnormal(dn, set, residue, status);
 7292|  21.2k|      return;
 7293|  21.2k|      }
 7294|       |    // Equals case: only subnormal if dn=Nmin and negative residue
 7295|      0|    decNumberZero(&nmin);
 7296|      0|    nmin.lsu[0]=1;
 7297|      0|    nmin.exponent=set->emin;
 7298|      0|    comp=decCompare(dn, &nmin, 1);                // (signless compare)
 7299|      0|    if (comp==BADINT) {                           // oops
  ------------------
  |  |  194|      0|#define BADINT  (Int)0x80000000    // most-negative Int; error indicator
  ------------------
  |  Branch (7299:9): [True: 0, False: 0]
  ------------------
 7300|      0|      *status|=DEC_Insufficient_storage;          // abandon...
  ------------------
  |  |  132|      0|    #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails]  */
  ------------------
 7301|      0|      return;
 7302|      0|      }
 7303|      0|    if (*residue<0 && comp==0) {                  // neg residue and dn==Nmin
  ------------------
  |  Branch (7303:9): [True: 0, False: 0]
  |  Branch (7303:23): [True: 0, False: 0]
  ------------------
 7304|      0|      decApplyRound(dn, set, *residue, status);   // might force down
 7305|      0|      decSetSubnormal(dn, set, residue, status);
 7306|      0|      return;
 7307|      0|      }
 7308|      0|    }
 7309|       |
 7310|       |  // now apply any pending round (this could raise overflow).
 7311|  6.41k|  if (*residue!=0) decApplyRound(dn, set, *residue, status);
  ------------------
  |  Branch (7311:7): [True: 0, False: 6.41k]
  ------------------
 7312|       |
 7313|       |  // Check for overflow [redundant in the 'rare' case] or clamp
 7314|  6.41k|  if (dn->exponent<=set->emax-set->digits+1) return;   // neither needed
  ------------------
  |  Branch (7314:7): [True: 5.19k, False: 1.21k]
  ------------------
 7315|       |
 7316|       |
 7317|       |  // here when might have an overflow or clamp to do
 7318|  1.21k|  if (dn->exponent>set->emax-dn->digits+1) {           // too big
  ------------------
  |  Branch (7318:7): [True: 945, False: 269]
  ------------------
 7319|    945|    decSetOverflow(dn, set, status);
 7320|    945|    return;
 7321|    945|    }
 7322|       |  // here when the result is normal but in clamp range
 7323|    269|  if (!set->clamp) return;
  ------------------
  |  Branch (7323:7): [True: 269, False: 0]
  ------------------
 7324|       |
 7325|       |  // here when need to apply the IEEE exponent clamp (fold-down)
 7326|      0|  shift=dn->exponent-(set->emax-set->digits+1);
 7327|       |
 7328|       |  // shift coefficient (if non-zero)
 7329|      0|  if (!ISZERO(dn)) {
  ------------------
  |  |  255|      0|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|      0|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  178|      0|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  |  |  179|      0|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|      0|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|      0|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|      0|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|      0|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 0, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7330|      0|    dn->digits=decShiftToMost(dn->lsu, dn->digits, shift);
 7331|      0|    }
 7332|      0|  dn->exponent-=shift;   // adjust the exponent to match
 7333|      0|  *status|=DEC_Clamped;  // and record the dirty deed
  ------------------
  |  |  140|      0|    #define DEC_Clamped              0x00000400
  ------------------
 7334|      0|  return;
 7335|    269|  } // decFinalize
decNumber.c:decSetSubnormal:
 7429|  21.2k|                            uInt *status) {
 7430|  21.2k|  decContext workset;         // work
 7431|  21.2k|  Int        etiny, adjust;   // ..
  ------------------
  |  |   92|  21.2k|  #define Int    int32_t
  ------------------
 7432|       |
 7433|       |  #if DECSUBSET
 7434|       |  // simple set to zero and 'hard underflow' for subset
 7435|       |  if (!set->extended) {
 7436|       |    decNumberZero(dn);
 7437|       |    // always full overflow
 7438|       |    *status|=DEC_Underflow | DEC_Subnormal | DEC_Inexact | DEC_Rounded;
 7439|       |    return;
 7440|       |    }
 7441|       |  #endif
 7442|       |
 7443|       |  // Full arithmetic -- allow subnormals, rounded to minimum exponent
 7444|       |  // (Etiny) if needed
 7445|  21.2k|  etiny=set->emin-(set->digits-1);      // smallest allowed exponent
 7446|       |
 7447|  21.2k|  if ISZERO(dn) {                       // value is zero
  ------------------
  |  |  255|  21.2k|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|  21.2k|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 14.7k, False: 6.48k]
  |  |  |  |  ------------------
  |  |  |  |  178|  21.2k|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 13.2k, False: 1.48k]
  |  |  |  |  ------------------
  |  |  |  |  179|  21.2k|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  13.2k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|  13.2k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|  13.2k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|  13.2k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 13.2k, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7448|       |    // residue can never be non-zero here
 7449|       |    #if DECCHECK
 7450|       |      if (*residue!=0) {
 7451|       |        printf("++ Subnormal 0 residue %ld\n", (LI)*residue);
 7452|       |        *status|=DEC_Invalid_operation;
 7453|       |        }
 7454|       |    #endif
 7455|  13.2k|    if (dn->exponent<etiny) {           // clamp required
  ------------------
  |  Branch (7455:9): [True: 8.96k, False: 4.29k]
  ------------------
 7456|  8.96k|      dn->exponent=etiny;
 7457|  8.96k|      *status|=DEC_Clamped;
  ------------------
  |  |  140|  8.96k|    #define DEC_Clamped              0x00000400
  ------------------
 7458|  8.96k|      }
 7459|  13.2k|    return;
 7460|  13.2k|    }
 7461|       |
 7462|  7.96k|  *status|=DEC_Subnormal;               // have a non-zero subnormal
  ------------------
  |  |  142|  7.96k|    #define DEC_Subnormal            0x00001000
  ------------------
 7463|  7.96k|  adjust=etiny-dn->exponent;            // calculate digits to remove
 7464|  7.96k|  if (adjust<=0) {                      // not out of range; unrounded
  ------------------
  |  Branch (7464:7): [True: 360, False: 7.60k]
  ------------------
 7465|       |    // residue can never be non-zero here, except in the Nmin-residue
 7466|       |    // case (which is a subnormal result), so can take fast-path here
 7467|       |    // it may already be inexact (from setting the coefficient)
 7468|    360|    if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  133|    360|    #define DEC_Inexact              0x00000020
  ------------------
                  if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  143|      0|    #define DEC_Underflow            0x00002000
  ------------------
  |  Branch (7468:9): [True: 0, False: 360]
  ------------------
 7469|    360|    return;
 7470|    360|    }
 7471|       |
 7472|       |  // adjust>0, so need to rescale the result so exponent becomes Etiny
 7473|       |  // [this code is similar to that in rescale]
 7474|  7.60k|  workset=*set;                         // clone rounding, etc.
 7475|  7.60k|  workset.digits=dn->digits-adjust;     // set requested length
 7476|  7.60k|  workset.emin-=adjust;                 // and adjust emin to match
 7477|       |  // [note that the latter can be <1, here, similar to Rescale case]
 7478|  7.60k|  decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status);
 7479|  7.60k|  decApplyRound(dn, &workset, *residue, status);
 7480|       |
 7481|       |  // Use 754 default rule: Underflow is set iff Inexact
 7482|       |  // [independent of whether trapped]
 7483|  7.60k|  if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  133|  7.60k|    #define DEC_Inexact              0x00000020
  ------------------
                if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  143|  6.23k|    #define DEC_Underflow            0x00002000
  ------------------
  |  Branch (7483:7): [True: 6.23k, False: 1.37k]
  ------------------
 7484|       |
 7485|       |  // if rounded up a 999s case, exponent will be off by one; adjust
 7486|       |  // back if so [it will fit, because it was shortened earlier]
 7487|  7.60k|  if (dn->exponent>etiny) {
  ------------------
  |  Branch (7487:7): [True: 1.08k, False: 6.52k]
  ------------------
 7488|  1.08k|    dn->digits=decShiftToMost(dn->lsu, dn->digits, 1);
 7489|  1.08k|    dn->exponent--;                     // (re)adjust the exponent.
 7490|  1.08k|    }
 7491|       |
 7492|       |  // if rounded to zero, it is by definition clamped...
 7493|  7.60k|  if (ISZERO(dn)) *status|=DEC_Clamped;
  ------------------
  |  |  255|  7.60k|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|  7.60k|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 2.48k, False: 5.12k]
  |  |  |  |  ------------------
  |  |  |  |  178|  7.60k|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 658, False: 1.82k]
  |  |  |  |  ------------------
  |  |  |  |  179|  7.60k|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    658|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|    658|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|    658|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|    658|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 658, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                if (ISZERO(dn)) *status|=DEC_Clamped;
  ------------------
  |  |  140|    658|    #define DEC_Clamped              0x00000400
  ------------------
 7494|  7.60k|  } // decSetSubnormal
decNumber.c:decBiStr:
 7667|  13.5k|static Flag decBiStr(const char *targ, const char *str1, const char *str2) {
 7668|  46.1k|  for (;;targ++, str1++, str2++) {
 7669|  46.1k|    if (*targ!=*str1 && *targ!=*str2) return 0;
  ------------------
  |  Branch (7669:9): [True: 33.2k, False: 12.9k]
  |  Branch (7669:25): [True: 8.22k, False: 25.0k]
  ------------------
 7670|       |    // *targ has a match in one (or both, if terminator)
 7671|  37.9k|    if (*targ=='\0') break;
  ------------------
  |  Branch (7671:9): [True: 5.35k, False: 32.6k]
  ------------------
 7672|  37.9k|    } // forever
 7673|  5.35k|  return 1;
 7674|  13.5k|  } // decBiStr
decNumber.c:decStatus:
 7741|  18.3k|static void decStatus(decNumber *dn, uInt status, decContext *set) {
 7742|  18.3k|  if (status & DEC_NaNs) {              // error status -> NaN
  ------------------
  |  |  187|  18.3k|  #define DEC_NaNs    DEC_IEEE_754_Invalid_operation
  |  |  ------------------
  |  |  |  |  173|  18.3k|  #define DEC_IEEE_754_Invalid_operation (DEC_Conversion_syntax |     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|  18.3k|    #define DEC_Conversion_syntax    0x00000001
  |  |  |  |  ------------------
  |  |  |  |  174|  18.3k|                                          DEC_Division_impossible |   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  18.3k|    #define DEC_Division_impossible  0x00000004
  |  |  |  |  ------------------
  |  |  |  |  175|  18.3k|                                          DEC_Division_undefined |    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  18.3k|    #define DEC_Division_undefined   0x00000008
  |  |  |  |  ------------------
  |  |  |  |  176|  18.3k|                                          DEC_Insufficient_storage |  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|  18.3k|    #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails]  */
  |  |  |  |  ------------------
  |  |  |  |  177|  18.3k|                                          DEC_Invalid_context |       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|  18.3k|    #define DEC_Invalid_context      0x00000040
  |  |  |  |  ------------------
  |  |  |  |  178|  18.3k|                                          DEC_Invalid_operation)
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|  18.3k|    #define DEC_Invalid_operation    0x00000080
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (7742:7): [True: 505, False: 17.8k]
  ------------------
 7743|       |    // if cause was an sNaN, clear and propagate [NaN is already set up]
 7744|    505|    if (status & DEC_sNaN) status&=~DEC_sNaN;
  ------------------
  |  |  193|    505|#define DEC_sNaN     0x40000000    // local status: sNaN signal
  ------------------
                  if (status & DEC_sNaN) status&=~DEC_sNaN;
  ------------------
  |  |  193|      0|#define DEC_sNaN     0x40000000    // local status: sNaN signal
  ------------------
  |  Branch (7744:9): [True: 0, False: 505]
  ------------------
 7745|    505|     else {
 7746|    505|      decNumberZero(dn);                // other error: clean throughout
 7747|    505|      dn->bits=DECNAN;                  // and make a quiet NaN
  ------------------
  |  |   33|    505|  #define DECNAN    0x20      /* 1=NaN                                */
  ------------------
 7748|    505|      }
 7749|    505|    }
 7750|  18.3k|  decContextSetStatus(set, status);     // [may not return]
 7751|  18.3k|  return;
 7752|  18.3k|  } // decStatus

