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|    304|jv jv_true(void) {
  127|    304|  return JV_TRUE;
  128|    304|}
jv_false:
  130|  5.20k|jv jv_false(void) {
  131|  5.20k|  return JV_FALSE;
  132|  5.20k|}
jv_null:
  134|  2.50k|jv jv_null(void) {
  135|  2.50k|  return JV_NULL;
  136|  2.50k|}
jv_invalid_with_msg:
  153|  3.62k|jv jv_invalid_with_msg(jv err) {
  154|  3.62k|  jvp_invalid* i = jv_mem_alloc(sizeof(jvp_invalid));
  155|  3.62k|  i->refcnt = JV_REFCNT_INIT;
  156|  3.62k|  i->errmsg = err;
  157|       |
  158|  3.62k|  jv x = {JVP_FLAGS_INVALID_MSG, 0, 0, 0, {&i->refcnt}};
  ------------------
  |  |  146|  3.62k|#define JVP_FLAGS_INVALID_MSG   JVP_MAKE_FLAGS(JV_KIND_INVALID, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  3.62k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  3.62k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  3.62k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  159|  3.62k|  return x;
  160|  3.62k|}
jv_invalid:
  162|   985k|jv jv_invalid(void) {
  163|   985k|  return JV_INVALID;
  164|   985k|}
jv_invalid_get_msg:
  166|  1.81k|jv jv_invalid_get_msg(jv inv) {
  167|  1.81k|  assert(JVP_HAS_KIND(inv, JV_KIND_INVALID));
  ------------------
  |  Branch (167:3): [True: 0, False: 1.81k]
  |  Branch (167:3): [True: 1.81k, False: 0]
  ------------------
  168|       |
  169|  1.81k|  jv x;
  170|  1.81k|  if (JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG)) {
  ------------------
  |  |   92|  1.81k|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  1.81k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 1.81k, False: 0]
  |  |  ------------------
  ------------------
  171|  1.81k|    x = jv_copy(((jvp_invalid*)inv.u.ptr)->errmsg);
  172|  1.81k|  }
  173|      0|  else {
  174|      0|    x = jv_null();
  175|      0|  }
  176|       |
  177|  1.81k|  jv_free(inv);
  178|  1.81k|  return x;
  179|  1.81k|}
jv_invalid_has_msg:
  181|  5.87k|int jv_invalid_has_msg(jv inv) {
  182|  5.87k|  assert(JVP_HAS_KIND(inv, JV_KIND_INVALID));
  ------------------
  |  Branch (182:3): [True: 0, False: 5.87k]
  |  Branch (182:3): [True: 5.87k, False: 0]
  ------------------
  183|  5.87k|  int r = JVP_HAS_FLAGS(inv, JVP_FLAGS_INVALID_MSG);
  ------------------
  |  |   92|  5.87k|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  5.87k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  ------------------
  184|  5.87k|  jv_free(inv);
  185|  5.87k|  return r;
  186|  5.87k|}
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.00M|const char* jv_number_get_literal(jv n) {
  659|  7.00M|  assert(JVP_HAS_KIND(n, JV_KIND_NUMBER));
  ------------------
  |  Branch (659:3): [True: 0, False: 7.00M]
  |  Branch (659:3): [True: 7.00M, False: 0]
  ------------------
  660|       |
  661|  7.00M|  if (JVP_HAS_FLAGS(n, 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: 14.1k, False: 6.98M]
  |  |  |  Branch (92:50): [True: 7.00M, Folded]
  |  |  ------------------
  ------------------
  662|  14.1k|    return jvp_literal_number_literal(n);
  663|  6.98M|  } else {
  664|       |    return NULL;
  665|  6.98M|  }
  666|  7.00M|}
jv_number_with_literal:
  668|   747k|jv jv_number_with_literal(const char * literal) {
  669|   747k|  return jvp_literal_number_new(literal);
  670|   747k|}
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.3M|#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|  6.99M|double jv_number_value(jv j) {
  699|  6.99M|  assert(JVP_HAS_KIND(j, JV_KIND_NUMBER));
  ------------------
  |  Branch (699:3): [True: 0, False: 6.99M]
  |  Branch (699:3): [True: 6.99M, False: 0]
  ------------------
  700|  6.99M|#ifdef USE_DECNUM
  701|  6.99M|  if (JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL)) {
  ------------------
  |  |   92|  13.9M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|  6.99M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 5.15k, False: 6.98M]
  |  |  |  Branch (92:50): [True: 6.99M, Folded]
  |  |  ------------------
  ------------------
  702|  5.15k|    jvp_literal_number* n = jvp_literal_number_ptr(j);
  703|       |
  704|  5.15k|    if (isnan(n->num_double)) {
  ------------------
  |  Branch (704:9): [True: 5.15k, False: 0]
  ------------------
  705|  5.15k|      n->num_double = jvp_literal_number_to_double(j);
  706|  5.15k|    }
  707|       |
  708|  5.15k|    return n->num_double;
  709|  5.15k|  }
  710|  6.98M|#endif
  711|  6.98M|  return j.u.number;
  712|  6.99M|}
jvp_number_is_nan:
  727|  7.00M|int jvp_number_is_nan(jv n) {
  728|  7.00M|  assert(JVP_HAS_KIND(n, JV_KIND_NUMBER));
  ------------------
  |  Branch (728:3): [True: 0, False: 7.00M]
  |  Branch (728:3): [True: 7.00M, False: 0]
  ------------------
  729|       |
  730|  7.00M|#ifdef USE_DECNUM
  731|  7.00M|  if (JVP_HAS_FLAGS(n, 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: 14.1k, False: 6.98M]
  |  |  |  Branch (92:50): [True: 7.00M, Folded]
  |  |  ------------------
  ------------------
  732|  14.1k|    decNumber *pdec = jvp_dec_number_ptr(n);
  733|  14.1k|    return decNumberIsNaN(pdec);
  ------------------
  |  |  172|  14.1k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  14.1k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  14.1k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  734|  14.1k|  }
  735|  6.98M|#endif
  736|  6.98M|  return isnan(n.u.number);
  737|  7.00M|}
jv_array_sized:
  982|   434k|jv jv_array_sized(int n) {
  983|   434k|  return jvp_array_new(n);
  984|   434k|}
jv_array:
  986|   433k|jv jv_array(void) {
  987|   433k|  return jv_array_sized(16);
  988|   433k|}
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.14M|jv jv_array_get(jv j, int idx) {
  998|  7.14M|  assert(JVP_HAS_KIND(j, JV_KIND_ARRAY));
  ------------------
  |  Branch (998:3): [True: 0, False: 7.14M]
  |  Branch (998:3): [True: 7.14M, False: 0]
  ------------------
  999|  7.14M|  jv* slot = jvp_array_read(j, idx);
 1000|  7.14M|  jv val;
 1001|  7.14M|  if (slot) {
  ------------------
  |  Branch (1001:7): [True: 7.14M, False: 0]
  ------------------
 1002|  7.14M|    val = jv_copy(*slot);
 1003|  7.14M|  } else {
 1004|      0|    val = jv_invalid();
 1005|      0|  }
 1006|  7.14M|  jv_free(j);
 1007|  7.14M|  return val;
 1008|  7.14M|}
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|    205|jv jv_array_slice(jv a, int start, int end) {
 1051|    205|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (1051:3): [True: 0, False: 205]
  |  Branch (1051:3): [True: 205, False: 0]
  ------------------
 1052|       |  // copy/free of a coalesced
 1053|    205|  return jvp_array_slice(a, start, end);
 1054|    205|}
jv_string_sized:
 1312|  30.7k|jv jv_string_sized(const char* str, int len) {
 1313|  30.7k|  return
 1314|  30.7k|    jvp_utf8_is_valid(str, str+len) ?
  ------------------
  |  Branch (1314:5): [True: 20.9k, False: 9.84k]
  ------------------
 1315|  20.9k|    jvp_string_new(str, len) :
 1316|  30.7k|    jvp_string_copy_replace_bad(str, len);
 1317|  30.7k|}
jv_string:
 1323|    338|jv jv_string(const char* str) {
 1324|    338|  return jv_string_sized(str, strlen(str));
 1325|    338|}
jv_string_length_bytes:
 1327|  39.1k|int jv_string_length_bytes(jv j) {
 1328|  39.1k|  assert(JVP_HAS_KIND(j, JV_KIND_STRING));
  ------------------
  |  Branch (1328:3): [True: 0, False: 39.1k]
  |  Branch (1328:3): [True: 39.1k, False: 0]
  ------------------
 1329|  39.1k|  int r = jvp_string_length(jvp_string_ptr(j));
 1330|  39.1k|  jv_free(j);
 1331|  39.1k|  return r;
 1332|  39.1k|}
jv_string_value:
 1481|  40.9k|const char* jv_string_value(jv j) {
 1482|  40.9k|  assert(JVP_HAS_KIND(j, JV_KIND_STRING));
  ------------------
  |  Branch (1482:3): [True: 0, False: 40.9k]
  |  Branch (1482:3): [True: 40.9k, False: 0]
  ------------------
 1483|  40.9k|  return jvp_string_ptr(j)->data;
 1484|  40.9k|}
jv_string_vfmt:
 1563|  3.81k|jv jv_string_vfmt(const char* fmt, va_list ap) {
 1564|  3.81k|  int size = 1024;
 1565|  4.16k|  while (1) {
  ------------------
  |  Branch (1565:10): [True: 4.16k, Folded]
  ------------------
 1566|  4.16k|    char* buf = jv_mem_alloc(size);
 1567|  4.16k|    va_list ap2;
 1568|  4.16k|    va_copy(ap2, ap);
 1569|  4.16k|    int n = vsnprintf(buf, size, fmt, ap2);
 1570|  4.16k|    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.16k|    if (n >= 0 && n < size) {
  ------------------
  |  Branch (1575:9): [True: 4.16k, False: 0]
  |  Branch (1575:19): [True: 3.81k, False: 341]
  ------------------
 1576|  3.81k|      jv ret = jv_string_sized(buf, n);
 1577|  3.81k|      jv_mem_free(buf);
 1578|  3.81k|      return ret;
 1579|  3.81k|    } else {
 1580|    341|      jv_mem_free(buf);
 1581|    341|      size = (n > 0) ? /* standard */ (n * 2) : /* not standard */ (size * 2);
  ------------------
  |  Branch (1581:14): [True: 341, False: 0]
  ------------------
 1582|    341|    }
 1583|  4.16k|  }
 1584|  3.81k|}
jv_string_fmt:
 1586|  1.81k|jv jv_string_fmt(const char* fmt, ...) {
 1587|  1.81k|  va_list args;
 1588|  1.81k|  va_start(args, fmt);
 1589|  1.81k|  jv res = jv_string_vfmt(fmt, args);
 1590|       |  va_end(args);
 1591|  1.81k|  return res;
 1592|  1.81k|}
jv_object:
 1849|  93.5k|jv jv_object(void) {
 1850|  93.5k|  return jvp_object_new(8);
 1851|  93.5k|}
jv_object_get:
 1853|  4.88k|jv jv_object_get(jv object, jv key) {
 1854|  4.88k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1854:3): [True: 0, False: 4.88k]
  |  Branch (1854:3): [True: 4.88k, False: 0]
  ------------------
 1855|  4.88k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1855:3): [True: 0, False: 4.88k]
  |  Branch (1855:3): [True: 4.88k, False: 0]
  ------------------
 1856|  4.88k|  jv* slot = jvp_object_read(object, key);
 1857|  4.88k|  jv val;
 1858|  4.88k|  if (slot) {
  ------------------
  |  Branch (1858:7): [True: 4.88k, False: 0]
  ------------------
 1859|  4.88k|    val = jv_copy(*slot);
 1860|  4.88k|  } else {
 1861|      0|    val = jv_invalid();
 1862|      0|  }
 1863|  4.88k|  jv_free(object);
 1864|  4.88k|  jv_free(key);
 1865|  4.88k|  return val;
 1866|  4.88k|}
jv_object_set:
 1878|  21.8k|jv jv_object_set(jv object, jv key, jv value) {
 1879|  21.8k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1879:3): [True: 0, False: 21.8k]
  |  Branch (1879:3): [True: 21.8k, False: 0]
  ------------------
 1880|  21.8k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1880:3): [True: 0, False: 21.8k]
  |  Branch (1880:3): [True: 21.8k, False: 0]
  ------------------
 1881|       |  // copy/free of object, key, value coalesced
 1882|  21.8k|  jv* slot;
 1883|  21.8k|  if (!jvp_object_write(&object, key, &slot)) {
  ------------------
  |  Branch (1883:7): [True: 0, False: 21.8k]
  ------------------
 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|  21.8k|  jv_free(*slot);
 1889|  21.8k|  *slot = value;
 1890|  21.8k|  return object;
 1891|  21.8k|}
jv_object_length:
 1901|  11.5k|int jv_object_length(jv object) {
 1902|  11.5k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1902:3): [True: 0, False: 11.5k]
  |  Branch (1902:3): [True: 11.5k, False: 0]
  ------------------
 1903|  11.5k|  int n = jvp_object_length(object);
 1904|  11.5k|  jv_free(object);
 1905|  11.5k|  return n;
 1906|  11.5k|}
jv_object_iter_valid:
 1965|  7.42k|int jv_object_iter_valid(jv object, int i) {
 1966|  7.42k|  return i != ITER_FINISHED;
 1967|  7.42k|}
jv_object_iter:
 1969|  1.44k|int jv_object_iter(jv object) {
 1970|  1.44k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1970:3): [True: 0, False: 1.44k]
  |  Branch (1970:3): [True: 1.44k, False: 0]
  ------------------
 1971|  1.44k|  return jv_object_iter_next(object, -1);
 1972|  1.44k|}
jv_object_iter_next:
 1974|  7.42k|int jv_object_iter_next(jv object, int iter) {
 1975|  7.42k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1975:3): [True: 0, False: 7.42k]
  |  Branch (1975:3): [True: 7.42k, False: 0]
  ------------------
 1976|  7.42k|  assert(iter != ITER_FINISHED);
  ------------------
  |  Branch (1976:3): [True: 0, False: 7.42k]
  |  Branch (1976:3): [True: 7.42k, False: 0]
  ------------------
 1977|  7.42k|  struct object_slot* slot;
 1978|  17.4k|  do {
 1979|  17.4k|    iter++;
 1980|  17.4k|    if (iter >= jvp_object_size(object))
  ------------------
  |  Branch (1980:9): [True: 1.44k, False: 16.0k]
  ------------------
 1981|  1.44k|      return ITER_FINISHED;
 1982|  16.0k|    slot = jvp_object_get_slot(object, iter);
 1983|  16.0k|  } while (jv_get_kind(slot->string) == JV_KIND_NULL);
  ------------------
  |  Branch (1983:12): [True: 10.0k, False: 5.98k]
  ------------------
 1984|  7.42k|  assert(jv_get_kind(jvp_object_get_slot(object,iter)->string)
  ------------------
  |  Branch (1984:3): [True: 0, False: 5.98k]
  |  Branch (1984:3): [True: 5.98k, False: 0]
  ------------------
 1985|  5.98k|         == JV_KIND_STRING);
 1986|  5.98k|  return iter;
 1987|  5.98k|}
jv_object_iter_key:
 1989|  5.98k|jv jv_object_iter_key(jv object, int iter) {
 1990|  5.98k|  jv s = jvp_object_get_slot(object, iter)->string;
 1991|  5.98k|  assert(JVP_HAS_KIND(s, JV_KIND_STRING));
  ------------------
  |  Branch (1991:3): [True: 0, False: 5.98k]
  |  Branch (1991:3): [True: 5.98k, False: 0]
  ------------------
 1992|  5.98k|  return jv_copy(s);
 1993|  5.98k|}
jv_object_iter_value:
 1995|  5.98k|jv jv_object_iter_value(jv object, int iter) {
 1996|  5.98k|  return jv_copy(jvp_object_get_slot(object, iter)->value);
 1997|  5.98k|}
jv_copy:
 2002|  78.0M|jv jv_copy(jv j) {
 2003|  78.0M|  if (JVP_IS_ALLOCATED(j)) {
  ------------------
  |  |   95|  78.0M|#define JVP_IS_ALLOCATED(j) (j.kind_flags & JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  Branch (95:29): [True: 27.0M, False: 51.0M]
  |  |  ------------------
  ------------------
 2004|  27.0M|    jvp_refcnt_inc(j.u.ptr);
 2005|  27.0M|  }
 2006|  78.0M|  return j;
 2007|  78.0M|}
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.0M, False: 17.5M]
  |  |  ------------------
  ------------------
 2019|  25.5M|      case JV_KIND_ARRAY:
  ------------------
  |  Branch (2019:7): [True: 25.5M, False: 89.0M]
  ------------------
 2020|  25.5M|        if (jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  Branch (2020:13): [True: 438k, False: 25.1M]
  ------------------
 2021|   438k|          jvp_array* arr = jvp_array_ptr(j);
 2022|   438k|          if (len + arr->length > cap) {
  ------------------
  |  Branch (2022:15): [True: 7.22k, False: 430k]
  ------------------
 2023|  7.22k|            cap = (len + arr->length) * 2;
 2024|  7.22k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2025|  7.22k|          }
 2026|  63.8M|          for (int i = 0; i < arr->length; i++)
  ------------------
  |  Branch (2026:27): [True: 63.4M, False: 438k]
  ------------------
 2027|  63.4M|            pending[len++] = arr->elements[i];
 2028|   438k|          jv_mem_free(arr);
 2029|   438k|        }
 2030|  25.5M|        break;
 2031|   132k|      case JV_KIND_OBJECT:
  ------------------
  |  Branch (2031:7): [True: 132k, False: 114M]
  ------------------
 2032|   132k|        if (jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  Branch (2032:13): [True: 93.5k, False: 38.7k]
  ------------------
 2033|  93.5k|          int sz = jvp_object_size(j);
 2034|  93.5k|          if (len + sz > cap) {
  ------------------
  |  Branch (2034:15): [True: 83.8k, False: 9.70k]
  ------------------
 2035|  83.8k|            cap = (len + sz) * 2;
 2036|  83.8k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2037|  83.8k|          }
 2038|   855k|          for (int i = 0; i < sz; i++) {
  ------------------
  |  Branch (2038:27): [True: 762k, False: 93.5k]
  ------------------
 2039|   762k|            struct object_slot* slot = jvp_object_get_slot(j, i);
 2040|   762k|            if (jv_get_kind(slot->string) != JV_KIND_NULL) {
  ------------------
  |  Branch (2040:17): [True: 18.2k, False: 744k]
  ------------------
 2041|  18.2k|              jvp_string_free(slot->string);
 2042|  18.2k|              pending[len++] = slot->value;
 2043|  18.2k|            }
 2044|   762k|          }
 2045|  93.5k|          jv_mem_free(jvp_object_ptr(j));
 2046|  93.5k|        }
 2047|   132k|        break;
 2048|   986k|      case JV_KIND_INVALID:
  ------------------
  |  Branch (2048:7): [True: 986k, False: 113M]
  ------------------
 2049|   986k|        if (JVP_HAS_FLAGS(j, JVP_FLAGS_INVALID_MSG) && jvp_refcnt_dec(j.u.ptr)) {
  ------------------
  |  |   92|  1.97M|#define JVP_HAS_FLAGS(j, flags) (JVP_FLAGS(j) == flags)
  |  |  ------------------
  |  |  |  |   89|   986k|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 6.92k, False: 980k]
  |  |  ------------------
  ------------------
  |  Branch (2049:56): [True: 3.62k, False: 3.30k]
  ------------------
 2050|  3.62k|          if (len + 1 > cap) {
  ------------------
  |  Branch (2050:15): [True: 3.62k, False: 0]
  ------------------
 2051|  3.62k|            cap = (len + 1) * 2;
 2052|  3.62k|            pending = jv_mem_realloc(pending, cap * sizeof(jv));
 2053|  3.62k|          }
 2054|  3.62k|          pending[len++] = ((jvp_invalid*)j.u.ptr)->errmsg;
 2055|  3.62k|          jv_mem_free(j.u.ptr);
 2056|  3.62k|        }
 2057|   986k|        break;
 2058|  69.6k|      case JV_KIND_STRING:
  ------------------
  |  Branch (2058:7): [True: 69.6k, False: 114M]
  ------------------
 2059|  69.6k|        jvp_string_free(j);
 2060|  69.6k|        break;
 2061|  70.2M|      case JV_KIND_NUMBER:
  ------------------
  |  Branch (2061:7): [True: 70.2M, False: 44.3M]
  ------------------
 2062|  70.2M|        jvp_number_free(j);
 2063|  70.2M|        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.94M|int jv_get_refcnt(jv j) {
 2072|  1.94M|  if (JVP_IS_ALLOCATED(j)) {
  ------------------
  |  |   95|  1.94M|#define JVP_IS_ALLOCATED(j) (j.kind_flags & JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  Branch (95:29): [True: 38.0k, False: 1.91M]
  |  |  ------------------
  ------------------
 2073|  38.0k|    return j.u.ptr->count;
 2074|  1.91M|  } else {
 2075|  1.91M|    return 1;
 2076|  1.91M|  }
 2077|  1.94M|}
jv.c:jvp_literal_number_literal:
  622|  14.1k|static const char* jvp_literal_number_literal(jv n) {
  623|  14.1k|  assert(JVP_HAS_FLAGS(n, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (623:3): [True: 0, Folded]
  |  Branch (623:3): [True: 0, False: 14.1k]
  |  Branch (623:3): [True: 14.1k, Folded]
  |  Branch (623:3): [True: 14.1k, False: 0]
  ------------------
  624|  14.1k|  decNumber *pdec = jvp_dec_number_ptr(n);
  625|  14.1k|  jvp_literal_number* plit = jvp_literal_number_ptr(n);
  626|       |
  627|  14.1k|  if (decNumberIsNaN(pdec)) {
  ------------------
  |  |  172|  14.1k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  14.1k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  14.1k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 0, False: 14.1k]
  |  |  ------------------
  ------------------
  628|      0|    return "null";
  629|      0|  }
  630|       |
  631|  14.1k|  if (decNumberIsInfinite(pdec)) {
  ------------------
  |  |  171|  14.1k|  #define decNumberIsInfinite(dn)  (((dn)->bits&DECINF)!=0)
  |  |  ------------------
  |  |  |  |   32|  14.1k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |  |  Branch (171:36): [True: 5.15k, False: 9.03k]
  |  |  ------------------
  ------------------
  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.15k|    return NULL;
  638|  5.15k|  }
  639|       |
  640|  9.03k|  if (plit->literal_data == NULL) {
  ------------------
  |  Branch (640:7): [True: 9.03k, False: 0]
  ------------------
  641|  9.03k|    int len = jvp_dec_number_ptr(n)->digits + 15 /* 14 + NUL */;
  642|  9.03k|    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|  9.03k|    decNumberToString(pdec, plit->literal_data);
  648|  9.03k|  }
  649|       |
  650|  9.03k|  return plit->literal_data;
  651|  14.1k|}
jv.c:jvp_literal_number_new:
  572|   747k|static jv jvp_literal_number_new(const char * literal) {
  573|   747k|  size_t len = strlen(literal);
  574|   747k|  if (len > DEC_MAX_DIGITS)
  ------------------
  |  |   88|   747k|  #define DEC_MAX_DIGITS 999999999
  ------------------
  |  Branch (574:7): [True: 0, False: 747k]
  ------------------
  575|      0|    return JV_INVALID;
  576|   747k|  jvp_literal_number* n = jvp_literal_number_alloc(len);
  577|       |
  578|   747k|  decContext *ctx = DEC_CONTEXT();
  ------------------
  |  |  487|   747k|#define DEC_CONTEXT() tsd_dec_ctx_get(&dec_ctx_key)
  ------------------
  579|   747k|  decContextClearStatus(ctx, DEC_Conversion_syntax);
  ------------------
  |  |  128|   747k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  580|   747k|  decNumberFromString(&n->num_decimal, literal, ctx);
  581|       |
  582|   747k|  if (ctx->status & DEC_Conversion_syntax) {
  ------------------
  |  |  128|   747k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  |  Branch (582:7): [True: 473, False: 747k]
  ------------------
  583|    473|    jv_mem_free(n);
  584|    473|    return JV_INVALID;
  585|    473|  }
  586|   747k|  if (decNumberIsNaN(&n->num_decimal)) {
  ------------------
  |  |  172|   747k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|   747k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|   747k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 1.17k, False: 745k]
  |  |  ------------------
  ------------------
  587|       |    // Reject NaN with payload.
  588|  1.17k|    if (n->num_decimal.digits > 1 || *n->num_decimal.lsu != 0) {
  ------------------
  |  Branch (588:9): [True: 36, False: 1.13k]
  |  Branch (588:38): [True: 4, False: 1.13k]
  ------------------
  589|     40|      jv_mem_free(n);
  590|     40|      return JV_INVALID;
  591|     40|    }
  592|  1.13k|    jv_mem_free(n);
  593|  1.13k|    return jv_number(NAN);
  594|  1.17k|  }
  595|       |
  596|   745k|  jv r = {JVP_FLAGS_NUMBER_LITERAL, 0, 0, 0, {&n->refcnt}};
  ------------------
  |  |  206|   745k|#define JVP_FLAGS_NUMBER_LITERAL      JVP_MAKE_FLAGS(JV_KIND_NUMBER, JVP_MAKE_PFLAGS(JVP_NUMBER_DECIMAL, 1))
  |  |  ------------------
  |  |  |  |   87|  1.49M|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   745k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|   745k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (87:61): [True: 745k, Folded]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  597|   745k|  return r;
  598|   747k|}
jv.c:jvp_literal_number_ptr:
  547|   765k|static jvp_literal_number* jvp_literal_number_ptr(jv j) {
  548|   765k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (548:3): [True: 0, Folded]
  |  Branch (548:3): [True: 0, False: 765k]
  |  Branch (548:3): [True: 765k, Folded]
  |  Branch (548:3): [True: 765k, False: 0]
  ------------------
  549|   765k|  return (jvp_literal_number*)j.u.ptr;
  550|   765k|}
jv.c:jvp_literal_number_to_double:
  600|  5.15k|static double jvp_literal_number_to_double(jv j) {
  601|  5.15k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (601:3): [True: 0, Folded]
  |  Branch (601:3): [True: 0, False: 5.15k]
  |  Branch (601:3): [True: 5.15k, Folded]
  |  Branch (601:3): [True: 5.15k, False: 0]
  ------------------
  602|  5.15k|  decContext dblCtx;
  603|       |
  604|       |  // init as decimal64 but change digits to allow conversion to binary64 (double)
  605|  5.15k|  decContextDefault(&dblCtx, DEC_INIT_DECIMAL64);
  ------------------
  |  |  229|  5.15k|  #define DEC_INIT_DECIMAL64   64
  ------------------
  606|  5.15k|  dblCtx.digits = DEC_NUMBER_DOUBLE_PRECISION;
  ------------------
  |  |  209|  5.15k|#define DEC_NUMBER_DOUBLE_PRECISION   (17)
  ------------------
  607|       |
  608|  5.15k|  decNumber *p_dec_number = jvp_dec_number_ptr(j);
  609|  5.15k|  decNumberDoublePrecision dec_double;
  610|  5.15k|  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.15k|  decNumberReduce(&dec_double.number, p_dec_number, &dblCtx);
  615|       |
  616|  5.15k|  decNumberToString(&dec_double.number, literal);
  617|       |
  618|  5.15k|  char *end;
  619|  5.15k|  return jvp_strtod(tsd_dtoa_context_get(), literal, &end);
  620|  5.15k|}
jv.c:jvp_dec_number_ptr:
  552|  42.5k|static decNumber* jvp_dec_number_ptr(jv j) {
  553|  42.5k|  assert(JVP_HAS_FLAGS(j, JVP_FLAGS_NUMBER_LITERAL));
  ------------------
  |  Branch (553:3): [True: 0, Folded]
  |  Branch (553:3): [True: 0, False: 42.5k]
  |  Branch (553:3): [True: 42.5k, Folded]
  |  Branch (553:3): [True: 42.5k, False: 0]
  ------------------
  554|  42.5k|  return &(((jvp_literal_number*)j.u.ptr)->num_decimal);
  555|  42.5k|}
jv.c:jvp_literal_number_alloc:
  557|   747k|static jvp_literal_number* jvp_literal_number_alloc(unsigned literal_length) {
  558|       |  /* The number of units needed is ceil(DECNUMDIGITS/DECDPUN)         */
  559|   747k|  int units = ((literal_length+DECDPUN-1)/DECDPUN);
  ------------------
  |  |   43|   747k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
                int units = ((literal_length+DECDPUN-1)/DECDPUN);
  ------------------
  |  |   43|   747k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  560|       |
  561|   747k|  jvp_literal_number* n = jv_mem_alloc(
  562|   747k|    sizeof(jvp_literal_number)
  563|   747k|    + sizeof(decNumberUnit) * units
  564|   747k|  );
  565|       |
  566|   747k|  n->refcnt = JV_REFCNT_INIT;
  567|   747k|  n->num_double = NAN;
  568|       |  n->literal_data = NULL;
  569|   747k|  return n;
  570|   747k|}
jv.c:tsd_dec_ctx_get:
  504|   747k|static decContext* tsd_dec_ctx_get(pthread_key_t *key) {
  505|   747k|  pthread_once(&dec_ctx_once, jv_tsd_dec_ctx_init); // cannot fail
  506|   747k|  decContext *ctx = (decContext*)pthread_getspecific(*key);
  507|   747k|  if (ctx) {
  ------------------
  |  Branch (507:7): [True: 747k, False: 1]
  ------------------
  508|   747k|    return ctx;
  509|   747k|  }
  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|   434k|static jv jvp_array_new(unsigned size) {
  841|   434k|  jv r = {JVP_FLAGS_ARRAY, 0, 0, 0, {&jvp_array_alloc(size)->refcnt}};
  ------------------
  |  |  813|   434k|#define JVP_FLAGS_ARRAY   JVP_MAKE_FLAGS(JV_KIND_ARRAY, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|   434k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|   434k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|   434k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  842|   434k|  return r;
  843|   434k|}
jv.c:jvp_array_alloc:
  832|   438k|static jvp_array* jvp_array_alloc(unsigned size) {
  833|   438k|  jvp_array* a = jv_mem_alloc(sizeof(jvp_array) + sizeof(jv) * size);
  834|   438k|  a->refcnt.count = 1;
  835|   438k|  a->length = 0;
  836|   438k|  a->alloc_length = size;
  837|   438k|  return a;
  838|   438k|}
jv.c:jvp_array_length:
  845|  70.8M|static int jvp_array_length(jv a) {
  846|  70.8M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (846:3): [True: 0, False: 70.8M]
  |  Branch (846:3): [True: 70.8M, False: 0]
  ------------------
  847|  70.8M|  return a.size;
  848|  70.8M|}
jv.c:jvp_array_read:
  855|  7.14M|static jv* jvp_array_read(jv a, int i) {
  856|  7.14M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (856:3): [True: 0, False: 7.14M]
  |  Branch (856:3): [True: 7.14M, False: 0]
  ------------------
  857|  7.14M|  if (i >= 0 && i < jvp_array_length(a)) {
  ------------------
  |  Branch (857:7): [True: 7.14M, False: 0]
  |  Branch (857:17): [True: 7.14M, False: 0]
  ------------------
  858|  7.14M|    jvp_array* array = jvp_array_ptr(a);
  859|  7.14M|    assert(i + jvp_array_offset(a) < array->length);
  ------------------
  |  Branch (859:5): [True: 0, False: 7.14M]
  |  Branch (859:5): [True: 7.14M, False: 0]
  ------------------
  860|  7.14M|    return &array->elements[i + jvp_array_offset(a)];
  861|  7.14M|  } else {
  862|      0|    return 0;
  863|      0|  }
  864|  7.14M|}
jv.c:jvp_array_offset:
  850|  95.2M|static int jvp_array_offset(jv a) {
  851|  95.2M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (851:3): [True: 0, False: 95.2M]
  |  Branch (851:3): [True: 95.2M, False: 0]
  ------------------
  852|  95.2M|  return a.offset;
  853|  95.2M|}
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: 181]
  ------------------
  872|       |    // use existing array space
  873|  35.1M|    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.89k|    int new_length = imax(i + 1, jvp_array_length(*a));
  882|  3.89k|    jvp_array* new_array = jvp_array_alloc(ARRAY_SIZE_ROUND_UP(new_length));
  ------------------
  |  |  812|  3.89k|#define ARRAY_SIZE_ROUND_UP(n) (((n)*3)/2)
  ------------------
  883|  3.89k|    int j;
  884|  45.8M|    for (j = 0; j < jvp_array_length(*a); j++) {
  ------------------
  |  Branch (884:17): [True: 45.8M, False: 3.89k]
  ------------------
  885|  45.8M|      new_array->elements[j] =
  886|  45.8M|        jv_copy(array->elements[j + jvp_array_offset(*a)]);
  887|  45.8M|    }
  888|  7.70k|    for (; j < new_length; j++) {
  ------------------
  |  Branch (888:12): [True: 3.80k, False: 3.89k]
  ------------------
  889|  3.80k|      new_array->elements[j] = JV_NULL;
  890|  3.80k|    }
  891|  3.89k|    new_array->length = new_length;
  892|  3.89k|    jv_free(*a);
  893|  3.89k|    jv new_jv = {JVP_FLAGS_ARRAY, 0, 0, new_length, {&new_array->refcnt}};
  ------------------
  |  |  813|  3.89k|#define JVP_FLAGS_ARRAY   JVP_MAKE_FLAGS(JV_KIND_ARRAY, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  3.89k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  3.89k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  3.89k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  894|  3.89k|    *a = new_jv;
  895|  3.89k|    return &new_array->elements[i];
  896|  3.89k|  }
  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.1M|static int imax(int a, int b) {
  816|  35.1M|  if (a>b) return a;
  ------------------
  |  Branch (816:7): [True: 35.1M, False: 3.15k]
  ------------------
  817|  3.15k|  else return b;
  818|  35.1M|}
jv.c:jvp_array_slice:
  953|    205|static jv jvp_array_slice(jv a, int start, int end) {
  954|    205|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (954:3): [True: 0, False: 205]
  |  Branch (954:3): [True: 205, False: 0]
  ------------------
  955|    205|  int len = jvp_array_length(a);
  956|    205|  jvp_clamp_slice_params(len, &start, &end);
  957|    205|  assert(0 <= start && start <= end && end <= len);
  ------------------
  |  Branch (957:3): [True: 0, False: 205]
  |  Branch (957:3): [True: 0, False: 0]
  |  Branch (957:3): [True: 0, False: 0]
  |  Branch (957:3): [True: 205, False: 0]
  |  Branch (957:3): [True: 205, False: 0]
  |  Branch (957:3): [True: 205, False: 0]
  ------------------
  958|       |
  959|       |  // FIXME: maybe slice should reallocate if the slice is small enough
  960|    205|  if (start == end) {
  ------------------
  |  Branch (960:7): [True: 25, False: 180]
  ------------------
  961|     25|    jv_free(a);
  962|     25|    return jv_array();
  963|     25|  }
  964|       |
  965|    180|  if (a.offset + start >= 1 << (sizeof(a.offset) * CHAR_BIT)) {
  ------------------
  |  Branch (965:7): [True: 0, False: 180]
  ------------------
  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|    180|  } else {
  972|    180|    a.offset += start;
  973|    180|    a.size = end - start;
  974|    180|    return a;
  975|    180|  }
  976|    180|}
jv.c:jvp_string_new:
 1141|  20.9k|static jv jvp_string_new(const char* data, uint32_t length) {
 1142|  20.9k|  jvp_string* s = jvp_string_alloc(length);
 1143|  20.9k|  s->length_hashed = length << 1;
 1144|  20.9k|  if (data != NULL)
  ------------------
  |  Branch (1144:7): [True: 20.9k, False: 0]
  ------------------
 1145|  20.9k|    memcpy(s->data, data, length);
 1146|  20.9k|  s->data[length] = 0;
 1147|  20.9k|  jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}};
  ------------------
  |  | 1087|  20.9k|#define JVP_FLAGS_STRING  JVP_MAKE_FLAGS(JV_KIND_STRING, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  20.9k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  20.9k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  20.9k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1148|  20.9k|  return r;
 1149|  20.9k|}
jv.c:jvp_string_alloc:
 1104|  30.7k|static jvp_string* jvp_string_alloc(uint32_t size) {
 1105|  30.7k|  jvp_string* s = jv_mem_alloc(sizeof(jvp_string) + size + 1);
 1106|  30.7k|  s->refcnt.count = 1;
 1107|  30.7k|  s->alloc_length = size;
 1108|  30.7k|  return s;
 1109|  30.7k|}
jv.c:jvp_string_copy_replace_bad:
 1112|  9.84k|static jv jvp_string_copy_replace_bad(const char* data, uint32_t length) {
 1113|  9.84k|  const char* end = data + length;
 1114|  9.84k|  const char* i = data;
 1115|       |
 1116|       |  // worst case: all bad bytes, each becomes a 3-byte U+FFFD
 1117|  9.84k|  uint64_t maxlength = (uint64_t)length * 3 + 1;
 1118|  9.84k|  if (maxlength >= INT_MAX) {
  ------------------
  |  Branch (1118:7): [True: 0, False: 9.84k]
  ------------------
 1119|      0|    return jv_invalid_with_msg(jv_string("String too long"));
 1120|      0|  }
 1121|       |
 1122|  9.84k|  jvp_string* s = jvp_string_alloc(maxlength);
 1123|  9.84k|  char* out = s->data;
 1124|  9.84k|  int c = 0;
 1125|       |
 1126|  33.9M|  while ((i = jvp_utf8_next(i, end, &c))) {
  ------------------
  |  Branch (1126:10): [True: 33.9M, False: 9.84k]
  ------------------
 1127|  33.9M|    if (c == -1) {
  ------------------
  |  Branch (1127:9): [True: 22.4M, False: 11.4M]
  ------------------
 1128|  22.4M|      c = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
 1129|  22.4M|    }
 1130|  33.9M|    out += jvp_utf8_encode(c, out);
 1131|  33.9M|    assert(out < s->data + maxlength);
  ------------------
  |  Branch (1131:5): [True: 0, False: 33.9M]
  |  Branch (1131:5): [True: 33.9M, False: 0]
  ------------------
 1132|  33.9M|  }
 1133|  9.84k|  length = out - s->data;
 1134|  9.84k|  s->data[length] = 0;
 1135|  9.84k|  s->length_hashed = length << 1;
 1136|  9.84k|  jv r = {JVP_FLAGS_STRING, 0, 0, 0, {&s->refcnt}};
  ------------------
  |  | 1087|  9.84k|#define JVP_FLAGS_STRING  JVP_MAKE_FLAGS(JV_KIND_STRING, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  9.84k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  9.84k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  9.84k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1137|  9.84k|  return r;
 1138|  9.84k|}
jv.c:jvp_string_length:
 1168|  86.1k|static uint32_t jvp_string_length(jvp_string* s) {
 1169|  86.1k|  return s->length_hashed >> 1;
 1170|  86.1k|}
jv.c:jvp_string_ptr:
 1099|   303k|static jvp_string* jvp_string_ptr(jv a) {
 1100|   303k|  assert(JVP_HAS_KIND(a, JV_KIND_STRING));
  ------------------
  |  Branch (1100:3): [True: 0, False: 303k]
  |  Branch (1100:3): [True: 303k, False: 0]
  ------------------
 1101|   303k|  return (jvp_string*)a.u.ptr;
 1102|   303k|}
jv.c:jvp_string_hash:
 1240|   115k|static uint32_t jvp_string_hash(jv jstr) {
 1241|   115k|  jvp_string* str = jvp_string_ptr(jstr);
 1242|   115k|  if (str->length_hashed & 1)
  ------------------
  |  Branch (1242:7): [True: 93.4k, False: 21.8k]
  ------------------
 1243|  93.4k|    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|  21.8k|  const uint8_t* data = (const uint8_t*)str->data;
 1250|  21.8k|  int len = (int)jvp_string_length(str);
 1251|  21.8k|  const int nblocks = len / 4;
 1252|       |
 1253|  21.8k|  uint32_t h1 = jvp_hash_seed();
 1254|       |
 1255|  21.8k|  const uint32_t c1 = 0xcc9e2d51;
 1256|  21.8k|  const uint32_t c2 = 0x1b873593;
 1257|  21.8k|  const uint32_t* blocks = (const uint32_t *)(data + nblocks*4);
 1258|       |
 1259|  6.60M|  for(int i = -nblocks; i; i++) {
  ------------------
  |  Branch (1259:25): [True: 6.58M, False: 21.8k]
  ------------------
 1260|  6.58M|    uint32_t k1 = blocks[i]; //FIXME: endianness/alignment
 1261|       |
 1262|  6.58M|    k1 *= c1;
 1263|  6.58M|    k1 = rotl32(k1,15);
 1264|  6.58M|    k1 *= c2;
 1265|       |
 1266|  6.58M|    h1 ^= k1;
 1267|  6.58M|    h1 = rotl32(h1,13);
 1268|  6.58M|    h1 = h1*5+0xe6546b64;
 1269|  6.58M|  }
 1270|       |
 1271|  21.8k|  const uint8_t* tail = (const uint8_t*)(data + nblocks*4);
 1272|       |
 1273|  21.8k|  uint32_t k1 = 0;
 1274|       |
 1275|  21.8k|  switch(len & 3) {
  ------------------
  |  Branch (1275:10): [True: 16.7k, False: 5.03k]
  ------------------
 1276|  2.93k|  case 3: k1 ^= tail[2] << 16;
  ------------------
  |  Branch (1276:3): [True: 2.93k, False: 18.8k]
  ------------------
 1277|  2.93k|          JQ_FALLTHROUGH;
  ------------------
  |  |   14|  2.93k|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 1278|  5.86k|  case 2: k1 ^= tail[1] << 8;
  ------------------
  |  Branch (1278:3): [True: 2.93k, False: 18.8k]
  ------------------
 1279|  5.86k|          JQ_FALLTHROUGH;
  ------------------
  |  |   14|  5.86k|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 1280|  16.7k|  case 1: k1 ^= tail[0];
  ------------------
  |  Branch (1280:3): [True: 10.9k, False: 10.8k]
  ------------------
 1281|  16.7k|          k1 *= c1; k1 = rotl32(k1,15); k1 *= c2; h1 ^= k1;
 1282|  21.8k|  }
 1283|       |
 1284|  21.8k|  h1 ^= len;
 1285|       |
 1286|  21.8k|  h1 ^= h1 >> 16;
 1287|  21.8k|  h1 *= 0x85ebca6b;
 1288|  21.8k|  h1 ^= h1 >> 13;
 1289|  21.8k|  h1 *= 0xc2b2ae35;
 1290|  21.8k|  h1 ^= h1 >> 16;
 1291|       |
 1292|  21.8k|  str->length_hashed |= 1;
 1293|  21.8k|  str->hash = h1;
 1294|       |
 1295|  21.8k|  return h1;
 1296|  21.8k|}
jv.c:jvp_hash_seed:
 1231|  21.8k|static uint32_t jvp_hash_seed(void) {
 1232|  21.8k|  pthread_once(&hash_seed_once, jvp_hash_seed_init);
 1233|  21.8k|  return hash_seed;
 1234|  21.8k|}
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.1M|static uint32_t rotl32 (uint32_t x, int8_t r){
 1237|  13.1M|  return (x << r) | (x >> (32 - r));
 1238|  13.1M|}
jv.c:jvp_clamp_slice_params:
  918|    205|{
  919|    205|  if (*pstart < 0) *pstart = len + *pstart;
  ------------------
  |  Branch (919:7): [True: 0, False: 205]
  ------------------
  920|    205|  if (*pend < 0) *pend = len + *pend;
  ------------------
  |  Branch (920:7): [True: 0, False: 205]
  ------------------
  921|       |
  922|    205|  if (*pstart < 0) *pstart = 0;
  ------------------
  |  Branch (922:7): [True: 0, False: 205]
  ------------------
  923|    205|  if (*pstart > len) *pstart = len;
  ------------------
  |  Branch (923:7): [True: 0, False: 205]
  ------------------
  924|    205|  if (*pend > len) *pend = len;
  ------------------
  |  Branch (924:7): [True: 0, False: 205]
  ------------------
  925|    205|  if (*pend < *pstart) *pend = *pstart;
  ------------------
  |  Branch (925:7): [True: 0, False: 205]
  ------------------
  926|    205|}
jv.c:jvp_object_new:
 1615|  94.6k|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|  94.6k|  assert(size > 0 && (size & (size - 1)) == 0);
  ------------------
  |  Branch (1619:3): [True: 0, False: 94.6k]
  |  Branch (1619:3): [True: 0, False: 0]
  |  Branch (1619:3): [True: 94.6k, False: 0]
  |  Branch (1619:3): [True: 94.6k, False: 0]
  ------------------
 1620|       |
 1621|  94.6k|  jvp_object* obj = jv_mem_alloc(sizeof(jvp_object) +
 1622|  94.6k|                                 sizeof(struct object_slot) * size +
 1623|  94.6k|                                 sizeof(int) * (size * 2));
 1624|  94.6k|  obj->refcnt.count = 1;
 1625|   870k|  for (int i=0; i<size; i++) {
  ------------------
  |  Branch (1625:17): [True: 776k, False: 94.6k]
  ------------------
 1626|   776k|    obj->elements[i].next = i - 1;
 1627|   776k|    obj->elements[i].string = JV_NULL;
 1628|   776k|    obj->elements[i].hash = 0;
 1629|   776k|    obj->elements[i].value = JV_NULL;
 1630|   776k|  }
 1631|  94.6k|  obj->next_free = 0;
 1632|  94.6k|  int* hashbuckets = (int*)(&obj->elements[size]);
 1633|  1.64M|  for (int i=0; i<size*2; i++) {
  ------------------
  |  Branch (1633:17): [True: 1.55M, False: 94.6k]
  ------------------
 1634|  1.55M|    hashbuckets[i] = -1;
 1635|  1.55M|  }
 1636|  94.6k|  jv r = {JVP_FLAGS_OBJECT, 0, 0, size, {&obj->refcnt}};
  ------------------
  |  | 1598|  94.6k|#define JVP_FLAGS_OBJECT  JVP_MAKE_FLAGS(JV_KIND_OBJECT, JVP_PAYLOAD_ALLOCATED)
  |  |  ------------------
  |  |  |  |   87|  94.6k|#define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   77|  94.6k|#define KIND_MASK   0xF
  |  |  |  |  ------------------
  |  |  |  |               #define JVP_MAKE_FLAGS(kind, pflags) ((kind & KIND_MASK) | (pflags & PFLAGS_MASK))
  |  |  |  |  ------------------
  |  |  |  |  |  |   78|  94.6k|#define PFLAGS_MASK 0xF0
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 1637|  94.6k|  return r;
 1638|  94.6k|}
jv.c:jvp_object_read:
 1698|  4.88k|static jv* jvp_object_read(jv object, jv key) {
 1699|  4.88k|  assert(JVP_HAS_KIND(key, JV_KIND_STRING));
  ------------------
  |  Branch (1699:3): [True: 0, False: 4.88k]
  |  Branch (1699:3): [True: 4.88k, False: 0]
  ------------------
 1700|  4.88k|  int* bucket = jvp_object_find_bucket(object, key);
 1701|  4.88k|  struct object_slot* slot = jvp_object_find_slot(object, key, bucket);
 1702|  4.88k|  if (slot == 0) return 0;
  ------------------
  |  Branch (1702:7): [True: 0, False: 4.88k]
  ------------------
 1703|  4.88k|  else return &slot->value;
 1704|  4.88k|}
jv.c:jvp_object_find_bucket:
 1659|  41.5k|static int* jvp_object_find_bucket(jv object, jv key) {
 1660|  41.5k|  return jvp_object_buckets(object) + (jvp_object_mask(object) & jvp_string_hash(key));
 1661|  41.5k|}
jv.c:jvp_object_buckets:
 1655|  41.5k|static int* jvp_object_buckets(jv o) {
 1656|  41.5k|  return (int*)(&jvp_object_ptr(o)->elements[o.size]);
 1657|  41.5k|}
jv.c:jvp_object_mask:
 1645|  41.5k|static uint32_t jvp_object_mask(jv o) {
 1646|  41.5k|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1646:3): [True: 0, False: 41.5k]
  |  Branch (1646:3): [True: 41.5k, False: 0]
  ------------------
 1647|  41.5k|  return (o.size * 2) - 1;
 1648|  41.5k|}
jv.c:jvp_object_find_slot:
 1673|  41.5k|static struct object_slot* jvp_object_find_slot(jv object, jv keystr, int* bucket) {
 1674|  41.5k|  uint32_t hash = jvp_string_hash(keystr);
 1675|  41.5k|  for (struct object_slot* curr = jvp_object_get_slot(object, *bucket);
 1676|  49.0k|       curr;
  ------------------
  |  Branch (1676:8): [True: 15.8k, False: 33.1k]
  ------------------
 1677|  41.5k|       curr = jvp_object_next_slot(object, curr)) {
 1678|  15.8k|    if (curr->hash == hash && jvp_string_equal(keystr, curr->string)) {
  ------------------
  |  Branch (1678:9): [True: 8.41k, False: 7.44k]
  |  Branch (1678:31): [True: 8.41k, False: 0]
  ------------------
 1679|  8.41k|      return curr;
 1680|  8.41k|    }
 1681|  15.8k|  }
 1682|  33.1k|  return 0;
 1683|  41.5k|}
jv.c:jvp_string_equal:
 1299|  8.41k|static int jvp_string_equal(jv a, jv b) {
 1300|  8.41k|  assert(JVP_HAS_KIND(a, JV_KIND_STRING));
  ------------------
  |  Branch (1300:3): [True: 0, False: 8.41k]
  |  Branch (1300:3): [True: 8.41k, False: 0]
  ------------------
 1301|  8.41k|  assert(JVP_HAS_KIND(b, JV_KIND_STRING));
  ------------------
  |  Branch (1301:3): [True: 0, False: 8.41k]
  |  Branch (1301:3): [True: 8.41k, False: 0]
  ------------------
 1302|  8.41k|  jvp_string* stra = jvp_string_ptr(a);
 1303|  8.41k|  jvp_string* strb = jvp_string_ptr(b);
 1304|  8.41k|  if (jvp_string_length(stra) != jvp_string_length(strb)) return 0;
  ------------------
  |  Branch (1304:7): [True: 0, False: 8.41k]
  ------------------
 1305|  8.41k|  return memcmp(stra->data, strb->data, jvp_string_length(stra)) == 0;
 1306|  8.41k|}
jv.c:jvp_object_next_slot:
 1669|  7.44k|static struct object_slot* jvp_object_next_slot(jv object, struct object_slot* slot) {
 1670|  7.44k|  return jvp_object_get_slot(object, slot->next);
 1671|  7.44k|}
jv.c:jvp_object_write:
 1755|  21.8k|static int jvp_object_write(jv* object, jv key, jv **valpp) {
 1756|  21.8k|  *object = jvp_object_unshare(*object);
 1757|  21.8k|  int* bucket = jvp_object_find_bucket(*object, key);
 1758|  21.8k|  struct object_slot* slot = jvp_object_find_slot(*object, key, bucket);
 1759|  21.8k|  if (slot) {
  ------------------
  |  Branch (1759:7): [True: 3.53k, False: 18.2k]
  ------------------
 1760|       |    // already has the key
 1761|  3.53k|    jvp_string_free(key);
 1762|  3.53k|    *valpp = &slot->value;
 1763|  3.53k|    return 1;
 1764|  3.53k|  }
 1765|  18.2k|  slot = jvp_object_add_slot(*object, key, bucket);
 1766|  18.2k|  if (slot) {
  ------------------
  |  Branch (1766:7): [True: 17.1k, False: 1.08k]
  ------------------
 1767|  17.1k|    slot->value = jv_invalid();
 1768|  17.1k|  } else {
 1769|  1.08k|    if (!jvp_object_rehash(object)) {
  ------------------
  |  Branch (1769:9): [True: 0, False: 1.08k]
  ------------------
 1770|      0|      jvp_string_free(key);
 1771|      0|      *valpp = NULL;
 1772|      0|      return 0;
 1773|      0|    }
 1774|  1.08k|    bucket = jvp_object_find_bucket(*object, key);
 1775|  1.08k|    assert(!jvp_object_find_slot(*object, key, bucket));
  ------------------
  |  Branch (1775:5): [True: 0, False: 1.08k]
  |  Branch (1775:5): [True: 1.08k, False: 0]
  ------------------
 1776|  1.08k|    slot = jvp_object_add_slot(*object, key, bucket);
 1777|  1.08k|    assert(slot);
  ------------------
  |  Branch (1777:5): [True: 0, False: 1.08k]
  |  Branch (1777:5): [True: 1.08k, False: 0]
  ------------------
 1778|  1.08k|    slot->value = jv_invalid();
 1779|  1.08k|  }
 1780|  18.2k|  *valpp = &slot->value;
 1781|  18.2k|  return 1;
 1782|  18.2k|}
jv.c:jvp_object_unshare:
 1729|  21.8k|static jv jvp_object_unshare(jv object) {
 1730|  21.8k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1730:3): [True: 0, False: 21.8k]
  |  Branch (1730:3): [True: 21.8k, False: 0]
  ------------------
 1731|  21.8k|  if (jvp_refcnt_unshared(object.u.ptr))
  ------------------
  |  Branch (1731:7): [True: 21.8k, False: 0]
  ------------------
 1732|  21.8k|    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|  33.1k|static struct object_slot* jvp_object_add_slot(jv object, jv key, int* bucket) {
 1686|  33.1k|  jvp_object* o = jvp_object_ptr(object);
 1687|  33.1k|  int newslot_idx = o->next_free;
 1688|  33.1k|  if (newslot_idx == jvp_object_size(object)) return 0;
  ------------------
  |  Branch (1688:7): [True: 1.08k, False: 32.0k]
  ------------------
 1689|  32.0k|  struct object_slot* newslot = jvp_object_get_slot(object, newslot_idx);
 1690|  32.0k|  o->next_free++;
 1691|  32.0k|  newslot->next = *bucket;
 1692|  32.0k|  *bucket = newslot_idx;
 1693|  32.0k|  newslot->hash = jvp_string_hash(key);
 1694|  32.0k|  newslot->string = key;
 1695|  32.0k|  return newslot;
 1696|  33.1k|}
jv.c:jvp_object_rehash:
 1706|  1.08k|static int jvp_object_rehash(jv *objectp) {
 1707|  1.08k|  jv object = *objectp;
 1708|  1.08k|  assert(JVP_HAS_KIND(object, JV_KIND_OBJECT));
  ------------------
  |  Branch (1708:3): [True: 0, False: 1.08k]
  |  Branch (1708:3): [True: 1.08k, False: 0]
  ------------------
 1709|  1.08k|  assert(jvp_refcnt_unshared(object.u.ptr));
  ------------------
  |  Branch (1709:3): [True: 0, False: 1.08k]
  |  Branch (1709:3): [True: 1.08k, False: 0]
  ------------------
 1710|  1.08k|  int size = jvp_object_size(object);
 1711|  1.08k|  if (size > INT_MAX >> 2)
  ------------------
  |  Branch (1711:7): [True: 0, False: 1.08k]
  ------------------
 1712|      0|    return 0;
 1713|  1.08k|  jv new_object = jvp_object_new(size * 2);
 1714|  14.8k|  for (int i=0; i<size; i++) {
  ------------------
  |  Branch (1714:17): [True: 13.7k, False: 1.08k]
  ------------------
 1715|  13.7k|    struct object_slot* slot = jvp_object_get_slot(object, i);
 1716|  13.7k|    if (jv_get_kind(slot->string) == JV_KIND_NULL) continue;
  ------------------
  |  Branch (1716:9): [True: 0, False: 13.7k]
  ------------------
 1717|  13.7k|    int* new_bucket = jvp_object_find_bucket(new_object, slot->string);
 1718|  13.7k|    assert(!jvp_object_find_slot(new_object, slot->string, new_bucket));
  ------------------
  |  Branch (1718:5): [True: 0, False: 13.7k]
  |  Branch (1718:5): [True: 13.7k, False: 0]
  ------------------
 1719|  13.7k|    struct object_slot* new_slot = jvp_object_add_slot(new_object, slot->string, new_bucket);
 1720|  13.7k|    assert(new_slot);
  ------------------
  |  Branch (1720:5): [True: 0, False: 13.7k]
  |  Branch (1720:5): [True: 13.7k, False: 0]
  ------------------
 1721|  13.7k|    new_slot->value = slot->value;
 1722|  13.7k|  }
 1723|       |  // references are transported, just drop the old table
 1724|  1.08k|  jv_mem_free(jvp_object_ptr(object));
 1725|  1.08k|  *objectp = new_object;
 1726|  1.08k|  return 1;
 1727|  1.08k|}
jv.c:jvp_object_length:
 1805|  11.5k|static int jvp_object_length(jv object) {
 1806|  11.5k|  int n = 0;
 1807|   111k|  for (int i=0; i<jvp_object_size(object); i++) {
  ------------------
  |  Branch (1807:17): [True: 100k, False: 11.5k]
  ------------------
 1808|   100k|    struct object_slot* slot = jvp_object_get_slot(object, i);
 1809|   100k|    if (jv_get_kind(slot->string) != JV_KIND_NULL) n++;
  ------------------
  |  Branch (1809:9): [True: 10.8k, False: 89.6k]
  ------------------
 1810|   100k|  }
 1811|  11.5k|  return n;
 1812|  11.5k|}
jv.c:jvp_object_size:
 1650|  1.21M|static int jvp_object_size(jv o) {
 1651|  1.21M|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1651:3): [True: 0, False: 1.21M]
  |  Branch (1651:3): [True: 1.21M, False: 0]
  ------------------
 1652|  1.21M|  return o.size;
 1653|  1.21M|}
jv.c:jvp_object_get_slot:
 1663|   991k|static struct object_slot* jvp_object_get_slot(jv object, int slot) {
 1664|   991k|  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: 991k, False: 0]
  |  Branch (1664:3): [True: 958k, False: 0]
  |  Branch (1664:3): [True: 958k, False: 0]
  |  Branch (1664:3): [True: 33.1k, False: 958k]
  ------------------
 1665|   991k|  if (slot == -1) return 0;
  ------------------
  |  Branch (1665:7): [True: 33.1k, False: 958k]
  ------------------
 1666|   958k|  else return &jvp_object_ptr(object)->elements[slot];
 1667|   991k|}
jv.c:jvp_refcnt_inc:
   63|  27.0M|static void jvp_refcnt_inc(jv_refcnt* c) {
   64|  27.0M|  c->count++;
   65|  27.0M|}
jv.c:jvp_refcnt_dec:
   67|  28.3M|static int jvp_refcnt_dec(jv_refcnt* c) {
   68|  28.3M|  c->count--;
   69|  28.3M|  return c->count == 0;
   70|  28.3M|}
jv.c:jvp_array_ptr:
  827|  25.1M|static jvp_array* jvp_array_ptr(jv a) {
  828|  25.1M|  assert(JVP_HAS_KIND(a, JV_KIND_ARRAY));
  ------------------
  |  Branch (828:3): [True: 0, False: 25.1M]
  |  Branch (828:3): [True: 25.1M, False: 0]
  ------------------
  829|  25.1M|  return (jvp_array*)a.u.ptr;
  830|  25.1M|}
jv.c:jvp_string_free:
 1161|  91.4k|static void jvp_string_free(jv js) {
 1162|  91.4k|  jvp_string* s = jvp_string_ptr(js);
 1163|  91.4k|  if (jvp_refcnt_dec(&s->refcnt)) {
  ------------------
  |  Branch (1163:7): [True: 30.7k, False: 60.7k]
  ------------------
 1164|  30.7k|    jv_mem_free(s);
 1165|  30.7k|  }
 1166|  91.4k|}
jv.c:jvp_object_ptr:
 1640|  1.12M|static jvp_object* jvp_object_ptr(jv o) {
 1641|  1.12M|  assert(JVP_HAS_KIND(o, JV_KIND_OBJECT));
  ------------------
  |  Branch (1641:3): [True: 0, False: 1.12M]
  |  Branch (1641:3): [True: 1.12M, False: 0]
  ------------------
 1642|  1.12M|  return (jvp_object*)o.u.ptr;
 1643|  1.12M|}
jv.c:jvp_number_free:
  685|  70.2M|static void jvp_number_free(jv j) {
  686|  70.2M|  assert(JVP_HAS_KIND(j, JV_KIND_NUMBER));
  ------------------
  |  Branch (686:3): [True: 0, False: 70.2M]
  |  Branch (686:3): [True: 70.2M, False: 0]
  ------------------
  687|  70.2M|#ifdef USE_DECNUM
  688|  70.2M|  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.2M|#define JVP_FLAGS(j)  ((j).kind_flags)
  |  |  ------------------
  |  |  |  Branch (92:33): [True: 2.55M, False: 67.6M]
  |  |  |  Branch (92:50): [True: 70.2M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (688:53): [True: 745k, False: 1.80M]
  ------------------
  689|   745k|    jvp_literal_number* n = jvp_literal_number_ptr(j);
  690|   745k|    if (n->literal_data) {
  ------------------
  |  Branch (690:9): [True: 9.03k, False: 736k]
  ------------------
  691|  9.03k|      jv_mem_free(n->literal_data);
  692|  9.03k|    }
  693|   745k|    jv_mem_free(n);
  694|   745k|  }
  695|  70.2M|#endif
  696|  70.2M|}

jq_fuzz_parse_extended.c:jv_is_valid:
   52|  4.33k|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.33M|void* jv_mem_alloc(size_t sz) {
  142|  1.33M|  void* p = malloc(sz);
  143|  1.33M|  if (!p) {
  ------------------
  |  Branch (143:7): [True: 0, False: 1.33M]
  ------------------
  144|      0|    memory_exhausted();
  145|      0|  }
  146|  1.33M|  return p;
  147|  1.33M|}
jv_mem_calloc:
  153|    806|void* jv_mem_calloc(size_t nemb, size_t sz) {
  154|    806|  assert(nemb > 0 && sz > 0);
  ------------------
  |  Branch (154:3): [True: 0, False: 806]
  |  Branch (154:3): [True: 0, False: 0]
  |  Branch (154:3): [True: 806, False: 0]
  |  Branch (154:3): [True: 806, False: 0]
  ------------------
  155|    806|  void* p = calloc(nemb, sz);
  156|    806|  if (!p) {
  ------------------
  |  Branch (156:7): [True: 0, False: 806]
  ------------------
  157|      0|    memory_exhausted();
  158|      0|  }
  159|    806|  return p;
  160|    806|}
jv_mem_free:
  179|  52.5M|void jv_mem_free(void* p) {
  180|  52.5M|  free(p);
  181|  52.5M|}
jv_mem_realloc:
  183|   100k|void* jv_mem_realloc(void* p, size_t sz) {
  184|   100k|  p = realloc(p, sz);
  185|   100k|  if (!p) {
  ------------------
  |  Branch (185:7): [True: 0, False: 100k]
  ------------------
  186|      0|    memory_exhausted();
  187|      0|  }
  188|   100k|  return p;
  189|   100k|}

jv_keys:
  584|    806|jv jv_keys(jv x) {
  585|    806|  if (jv_get_kind(x) == JV_KIND_OBJECT) {
  ------------------
  |  Branch (585:7): [True: 806, False: 0]
  ------------------
  586|    806|    int nkeys = jv_object_length(jv_copy(x));
  587|    806|    if (nkeys == 0) {
  ------------------
  |  Branch (587:9): [True: 0, False: 806]
  ------------------
  588|      0|      jv_free(x);
  589|      0|      return jv_array();
  590|      0|    }
  591|    806|    jv* keys = jv_mem_calloc(nkeys, sizeof(jv));
  592|    806|    int kidx = 0;
  593|  4.88k|    jv_object_foreach(x, key, value) {
  ------------------
  |  |  159|  1.61k|  for (int jv_i__ = jv_object_iter(t), jv_j__ = 1; jv_j__; jv_j__ = 0)  \
  |  |  ------------------
  |  |  |  Branch (159:52): [True: 806, False: 806]
  |  |  ------------------
  |  |  160|    806|    for (jv k, v;                                                       \
  |  |  161|  5.69k|         jv_object_iter_valid((t), jv_i__) ?                            \
  |  |  ------------------
  |  |  |  Branch (161:10): [True: 4.88k, False: 806]
  |  |  |  Branch (161:10): [True: 4.88k, False: 806]
  |  |  ------------------
  |  |  162|  5.69k|           (k = jv_object_iter_key(t, jv_i__),                          \
  |  |  163|  4.88k|            v = jv_object_iter_value(t, jv_i__),                        \
  |  |  164|  4.88k|            1)                                                          \
  |  |  165|  5.69k|           : 0;                                                         \
  |  |  166|  4.88k|         jv_i__ = jv_object_iter_next(t, jv_i__))                       \
  ------------------
  594|  4.88k|      keys[kidx++] = key;
  595|  4.88k|      jv_free(value);
  596|  4.88k|    }
  597|    806|    qsort(keys, nkeys, sizeof(jv), string_cmp);
  598|    806|    jv answer = jv_array_sized(nkeys);
  599|  5.69k|    for (int i = 0; i<nkeys; i++) {
  ------------------
  |  Branch (599:21): [True: 4.88k, False: 806]
  ------------------
  600|  4.88k|      answer = jv_array_append(answer, keys[i]);
  601|  4.88k|    }
  602|    806|    jv_mem_free(keys);
  603|    806|    jv_free(x);
  604|    806|    return answer;
  605|    806|  } 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|    806|}
jv_aux.c:string_cmp:
  561|  15.9k|static int string_cmp(const void* pa, const void* pb){
  562|  15.9k|  const jv* a = pa;
  563|  15.9k|  const jv* b = pb;
  564|  15.9k|  int lena = jv_string_length_bytes(jv_copy(*a));
  565|  15.9k|  int lenb = jv_string_length_bytes(jv_copy(*b));
  566|  15.9k|  int minlen = lena < lenb ? lena : lenb;
  ------------------
  |  Branch (566:16): [True: 5.20k, False: 10.7k]
  ------------------
  567|  15.9k|  int r = memcmp(jv_string_value(*a), jv_string_value(*b), minlen);
  568|  15.9k|  if (r == 0) r = lena - lenb;
  ------------------
  |  Branch (568:7): [True: 1.70k, False: 14.2k]
  ------------------
  569|  15.9k|  return r;
  570|  15.9k|}

jvp_dtoa_context_init:
  522|  4.33k|void jvp_dtoa_context_init(struct dtoa_context* C) {
  523|  4.33k|  int i;
  524|  38.9k|  for (i=0; i<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); i++) {
  ------------------
  |  Branch (524:13): [True: 34.6k, False: 4.33k]
  ------------------
  525|  34.6k|    C->freelist[i] = 0;
  526|  34.6k|  }
  527|  4.33k|  C->p5s = 0;
  528|  4.33k|}
jvp_dtoa_context_free:
  569|  4.33k|void jvp_dtoa_context_free(struct dtoa_context* C) {
  570|  4.33k|  int k;
  571|  4.33k|  while (C->p5s) {
  ------------------
  |  Branch (571:10): [True: 7, False: 4.33k]
  ------------------
  572|      7|    Bigint* p5 = C->p5s;
  573|      7|    C->p5s = p5->next;
  574|      7|    Bfree(C, p5);
  575|      7|  }
  576|  38.9k|  for (k=0; k<(int)(sizeof(C->freelist)/sizeof(C->freelist[0])); k++) {
  ------------------
  |  Branch (576:13): [True: 34.6k, False: 4.33k]
  ------------------
  577|  34.6k|    while (C->freelist[k]) {
  ------------------
  |  Branch (577:12): [True: 18, False: 34.6k]
  ------------------
  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|  34.6k|  }
  583|  4.33k|}
jvp_strtod:
 2331|  5.15k|{
 2332|  5.15k|	int bb2, bb5, bbe, bd2, bd5, bbbits, bs2, c, e, e1;
 2333|       |#ifdef Honor_FLT_ROUNDS
 2334|       |	int test_scale;
 2335|       |#endif
 2336|  5.15k|	int esign, i, j, k, nd, nd0, nf, nz, nz0, nz1, sign;
 2337|  5.15k|	CONST char *s, *s0, *s1;
  ------------------
  |  |  298|  5.15k|#define CONST const
  ------------------
 2338|  5.15k|	double aadj, aadj1;
 2339|  5.15k|	Long L;
  ------------------
  |  |  193|  5.15k|#define Long int
  ------------------
 2340|  5.15k|	U aadj2, adj, rv, rv0;
 2341|  5.15k|	ULong y, z;
 2342|  5.15k|	BCinfo bc;
 2343|  5.15k|	Bigint *bb=0, *bb1, *bd=0, *bd0, *bs=0, *delta=0;
 2344|  5.15k|#ifdef Avoid_Underflow
 2345|  5.15k|	ULong Lsb, Lsb1;
 2346|  5.15k|#endif
 2347|       |#ifdef SET_INEXACT
 2348|       |	int oldinexact;
 2349|       |#endif
 2350|  5.15k|#ifndef NO_STRTOD_BIGCOMP
 2351|  5.15k|	int req_bigcomp = 0;
 2352|  5.15k|#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.15k|	sign = nz0 = nz1 = nz = bc.dplen = bc.uflchk = 0;
 2370|  5.15k|	dval(&rv) = 0.;
  ------------------
  |  |  314|  5.15k|#define dval(x) (x)->d
  ------------------
 2371|  5.15k|	switch(*(s = s00)) {
 2372|    194|		case '-':
  ------------------
  |  Branch (2372:3): [True: 194, False: 4.96k]
  ------------------
 2373|    194|			sign = 1;
 2374|       |			/* no break */
 2375|    194|			JQ_FALLTHROUGH;
  ------------------
  |  |   14|    194|# define JQ_FALLTHROUGH __attribute__((fallthrough))
  ------------------
 2376|    194|		case '+':
  ------------------
  |  Branch (2376:3): [True: 0, False: 5.15k]
  ------------------
 2377|    194|			if (*++s)
  ------------------
  |  Branch (2377:8): [True: 194, False: 0]
  ------------------
 2378|    194|				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.15k]
  ------------------
 2382|      0|			goto ret0;
 2383|  4.96k|		default:
  ------------------
  |  Branch (2383:3): [True: 4.96k, False: 194]
  ------------------
 2384|  4.96k|			break;
 2385|  5.15k|		}
 2386|  5.15k|	if (*s == '0') {
  ------------------
  |  Branch (2386:6): [True: 0, False: 5.15k]
  ------------------
 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.15k|	s0 = s;
 2405|  5.15k|	y = z = 0;
 2406|  5.15k|	for(nd = nf = 0; (c = *s) >= '0' && c <= '9'; nd++, s++)
  ------------------
  |  Branch (2406:19): [True: 5.15k, False: 0]
  |  Branch (2406:38): [True: 0, False: 5.15k]
  ------------------
 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.15k|	nd0 = nd;
 2412|  5.15k|	bc.dp0 = bc.dp1 = s - s0;
 2413|  5.15k|	for(s1 = s; s1 > s0 && *--s1 == '0'; )
  ------------------
  |  Branch (2413:14): [True: 0, False: 5.15k]
  |  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.15k|	if (c == '.') {
  ------------------
  |  Branch (2434:6): [True: 0, False: 5.15k]
  ------------------
 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.15k| dig_done:
 2470|  5.15k|	e = 0;
 2471|  5.15k|	if (c == 'e' || c == 'E') {
  ------------------
  |  Branch (2471:6): [True: 0, False: 5.15k]
  |  Branch (2471:18): [True: 0, False: 5.15k]
  ------------------
 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.15k|	if (!nd) {
  ------------------
  |  Branch (2508:6): [True: 5.15k, False: 0]
  ------------------
 2509|  5.15k|		if (!nz && !nz0) {
  ------------------
  |  Branch (2509:7): [True: 5.15k, False: 0]
  |  Branch (2509:14): [True: 5.15k, False: 0]
  ------------------
 2510|  5.15k|#ifdef INFNAN_CHECK
 2511|       |			/* Check for Nan and Infinity */
 2512|  5.15k|			if (!bc.dplen)
  ------------------
  |  Branch (2512:8): [True: 5.15k, False: 0]
  ------------------
 2513|  5.15k|			 switch(c) {
  ------------------
  |  Branch (2513:12): [True: 5.15k, False: 0]
  ------------------
 2514|      0|			  case 'i':
  ------------------
  |  Branch (2514:6): [True: 0, False: 5.15k]
  ------------------
 2515|  5.15k|			  case 'I':
  ------------------
  |  Branch (2515:6): [True: 5.15k, False: 0]
  ------------------
 2516|  5.15k|				if (match(C, &s,"nf")) {
  ------------------
  |  Branch (2516:9): [True: 5.15k, False: 0]
  ------------------
 2517|  5.15k|					--s;
 2518|  5.15k|					if (!match(C, &s,"inity"))
  ------------------
  |  Branch (2518:10): [True: 0, False: 5.15k]
  ------------------
 2519|      0|						++s;
 2520|  5.15k|					word0(&rv) = 0x7ff00000;
  ------------------
  |  |  308|  5.15k|#define word0(x) (x)->L[1]
  ------------------
 2521|  5.15k|					word1(&rv) = 0;
  ------------------
  |  |  309|  5.15k|#define word1(x) (x)->L[0]
  ------------------
 2522|  5.15k|					goto ret;
 2523|  5.15k|					}
 2524|      0|				break;
 2525|      0|			  case 'n':
  ------------------
  |  Branch (2525:6): [True: 0, False: 5.15k]
  ------------------
 2526|      0|			  case 'N':
  ------------------
  |  Branch (2526:6): [True: 0, False: 5.15k]
  ------------------
 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.15k|			  }
 2537|      0|#endif /* INFNAN_CHECK */
 2538|      0| ret0:
 2539|      0|			s = s00;
 2540|      0|			sign = 0;
 2541|      0|			}
 2542|      0|		goto ret;
 2543|  5.15k|		}
 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.15k| ret:
 3389|  5.15k|	if (se)
  ------------------
  |  Branch (3389:6): [True: 5.15k, False: 0]
  ------------------
 3390|  5.15k|		*se = (char *)s;
 3391|  5.15k|	return sign ? -dval(&rv) : dval(&rv);
  ------------------
  |  |  314|    194|#define dval(x) (x)->d
  ------------------
              	return sign ? -dval(&rv) : dval(&rv);
  ------------------
  |  |  314|  4.96k|#define dval(x) (x)->d
  ------------------
  |  Branch (3391:9): [True: 194, False: 4.96k]
  ------------------
 3392|      0|	}
jvp_freedtoa:
 3430|  7.01M|{
 3431|  7.01M|	Bigint *b = (Bigint *)((int *)s - 1);
 3432|  7.01M|	b->maxwds = 1 << (b->k = *(int*)b);
 3433|  7.01M|	Bfree(C, b);
 3434|  7.01M|	}
jvp_dtoa:
 3473|  7.01M|{
 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.01M|	int bbits, b2, b5, be, dig, i, ieps, ilim, ilim0, ilim1,
 3509|  7.01M|		j, j1=0, k, k0, k_check, leftright, m2, m5, s2, s5,
 3510|  7.01M|		spec_case, try_quick;
 3511|  7.01M|	Long L;
  ------------------
  |  |  193|  7.01M|#define Long int
  ------------------
 3512|  7.01M|#ifndef Sudden_Underflow
 3513|  7.01M|	int denorm;
 3514|  7.01M|	ULong x;
 3515|  7.01M|#endif
 3516|  7.01M|	Bigint *b, *b1, *delta, *mlo, *mhi, *S;
 3517|  7.01M|	U d2, eps, u;
 3518|  7.01M|	double ds;
 3519|  7.01M|	char *s, *s0;
 3520|  7.01M|#ifndef No_leftright
 3521|  7.01M|#ifdef IEEE_Arith
 3522|  7.01M|	U eps1;
 3523|  7.01M|#endif
 3524|  7.01M|#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.01M|	u.d = dd;
 3544|  7.01M|	if (word0(&u) & Sign_bit) {
  ------------------
  |  |  308|  7.01M|#define word0(x) (x)->L[1]
  ------------------
              	if (word0(&u) & Sign_bit) {
  ------------------
  |  |  365|  7.01M|#define Sign_bit 0x80000000
  ------------------
  |  Branch (3544:6): [True: 194, False: 7.01M]
  ------------------
 3545|       |		/* set sign for everything, including 0's and NaNs */
 3546|    194|		*sign = 1;
 3547|    194|		word0(&u) &= ~Sign_bit;	/* clear sign bit */
  ------------------
  |  |  308|    194|#define word0(x) (x)->L[1]
  ------------------
              		word0(&u) &= ~Sign_bit;	/* clear sign bit */
  ------------------
  |  |  365|    194|#define Sign_bit 0x80000000
  ------------------
 3548|    194|		}
 3549|  7.01M|	else
 3550|  7.01M|		*sign = 0;
 3551|       |
 3552|  7.01M|#if defined(IEEE_Arith) + defined(VAX)
 3553|  7.01M|#ifdef IEEE_Arith
 3554|  7.01M|	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  308|  7.01M|#define word0(x) (x)->L[1]
  ------------------
              	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  349|  7.01M|#define Exp_mask  0x7ff00000
  ------------------
              	if ((word0(&u) & Exp_mask) == Exp_mask)
  ------------------
  |  |  349|  7.01M|#define Exp_mask  0x7ff00000
  ------------------
  |  Branch (3554:6): [True: 0, False: 7.01M]
  ------------------
 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.01M|#endif
 3568|       |#ifdef IBM
 3569|       |	dval(&u) += 0; /* normalize */
 3570|       |#endif
 3571|  7.01M|	if (!dval(&u)) {
  ------------------
  |  |  314|  7.01M|#define dval(x) (x)->d
  ------------------
  |  Branch (3571:6): [True: 6.98M, False: 31.3k]
  ------------------
 3572|  6.98M|		*decpt = 1;
 3573|  6.98M|		return nrv_alloc(C, "0", rve, 1);
 3574|  6.98M|		}
 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|  31.3k|	b = d2b(C, &u, &be, &bbits);
 3591|       |#ifdef Sudden_Underflow
 3592|       |	i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1));
 3593|       |#else
 3594|  31.3k|	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  308|  31.3k|#define word0(x) (x)->L[1]
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  346|  31.3k|#define Exp_shift1 20
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  349|  31.3k|#define Exp_mask  0x7ff00000
  ------------------
              	if ((i = (int)(word0(&u) >> Exp_shift1 & (Exp_mask>>Exp_shift1)))) {
  ------------------
  |  |  346|  31.3k|#define Exp_shift1 20
  ------------------
  |  Branch (3594:6): [True: 31.3k, False: 0]
  ------------------
 3595|  31.3k|#endif
 3596|  31.3k|		dval(&d2) = dval(&u);
  ------------------
  |  |  314|  31.3k|#define dval(x) (x)->d
  ------------------
              		dval(&d2) = dval(&u);
  ------------------
  |  |  314|  31.3k|#define dval(x) (x)->d
  ------------------
 3597|  31.3k|		word0(&d2) &= Frac_mask1;
  ------------------
  |  |  308|  31.3k|#define word0(x) (x)->L[1]
  ------------------
              		word0(&d2) &= Frac_mask1;
  ------------------
  |  |  359|  31.3k|#define Frac_mask1 0xfffff
  ------------------
 3598|  31.3k|		word0(&d2) |= Exp_11;
  ------------------
  |  |  308|  31.3k|#define word0(x) (x)->L[1]
  ------------------
              		word0(&d2) |= Exp_11;
  ------------------
  |  |  356|  31.3k|#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|  31.3k|		i -= Bias;
  ------------------
  |  |  352|  31.3k|#define Bias 1023
  ------------------
 3627|       |#ifdef IBM
 3628|       |		i <<= 2;
 3629|       |		i += j;
 3630|       |#endif
 3631|  31.3k|#ifndef Sudden_Underflow
 3632|  31.3k|		denorm = 0;
 3633|  31.3k|		}
 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|  31.3k|#endif
 3646|  31.3k|	ds = (dval(&d2)-1.5)*0.289529654602168 + 0.1760912590558 + i*0.301029995663981;
  ------------------
  |  |  314|  31.3k|#define dval(x) (x)->d
  ------------------
 3647|  31.3k|	k = (int)ds;
 3648|  31.3k|	if (ds < 0. && ds != k)
  ------------------
  |  Branch (3648:6): [True: 0, False: 31.3k]
  |  Branch (3648:17): [True: 0, False: 0]
  ------------------
 3649|      0|		k--;	/* want k = floor(ds) */
 3650|  31.3k|	k_check = 1;
 3651|  31.3k|	if (k >= 0 && k <= Ten_pmax) {
  ------------------
  |  |  360|  31.3k|#define Ten_pmax 22
  ------------------
  |  Branch (3651:6): [True: 31.3k, False: 0]
  |  Branch (3651:16): [True: 26.2k, False: 5.15k]
  ------------------
 3652|  26.2k|		if (dval(&u) < tens[k])
  ------------------
  |  |  314|  26.2k|#define dval(x) (x)->d
  ------------------
  |  Branch (3652:7): [True: 0, False: 26.2k]
  ------------------
 3653|      0|			k--;
 3654|  26.2k|		k_check = 0;
 3655|  26.2k|		}
 3656|  31.3k|	j = bbits - i - 1;
 3657|  31.3k|	if (j >= 0) {
  ------------------
  |  Branch (3657:6): [True: 26.2k, False: 5.15k]
  ------------------
 3658|  26.2k|		b2 = 0;
 3659|  26.2k|		s2 = j;
 3660|  26.2k|		}
 3661|  5.15k|	else {
 3662|  5.15k|		b2 = -j;
 3663|  5.15k|		s2 = 0;
 3664|  5.15k|		}
 3665|  31.3k|	if (k >= 0) {
  ------------------
  |  Branch (3665:6): [True: 31.3k, False: 0]
  ------------------
 3666|  31.3k|		b5 = 0;
 3667|  31.3k|		s5 = k;
 3668|  31.3k|		s2 += k;
 3669|  31.3k|		}
 3670|      0|	else {
 3671|      0|		b2 -= k;
 3672|      0|		b5 = -k;
 3673|      0|		s5 = 0;
 3674|      0|		}
 3675|  31.3k|	if (mode < 0 || mode > 9)
  ------------------
  |  Branch (3675:6): [True: 0, False: 31.3k]
  |  Branch (3675:18): [True: 0, False: 31.3k]
  ------------------
 3676|      0|		mode = 0;
 3677|       |
 3678|  31.3k|#ifndef SET_INEXACT
 3679|       |#ifdef Check_FLT_ROUNDS
 3680|       |	try_quick = Rounding == 1;
 3681|       |#else
 3682|  31.3k|	try_quick = 1;
 3683|  31.3k|#endif
 3684|  31.3k|#endif /*SET_INEXACT*/
 3685|       |
 3686|  31.3k|	if (mode > 5) {
  ------------------
  |  Branch (3686:6): [True: 0, False: 31.3k]
  ------------------
 3687|      0|		mode -= 4;
 3688|      0|		try_quick = 0;
 3689|      0|		}
 3690|  31.3k|	leftright = 1;
 3691|  31.3k|	ilim = ilim1 = -1;	/* Values for cases 0 and 1; done here to */
 3692|       |				/* silence erroneous "gcc -Wall" warning. */
 3693|  31.3k|	switch(mode) {
  ------------------
  |  Branch (3693:9): [True: 31.3k, False: 0]
  ------------------
 3694|  31.3k|		case 0:
  ------------------
  |  Branch (3694:3): [True: 31.3k, False: 0]
  ------------------
 3695|  31.3k|		case 1:
  ------------------
  |  Branch (3695:3): [True: 0, False: 31.3k]
  ------------------
 3696|  31.3k|			i = 18;
 3697|  31.3k|			ndigits = 0;
 3698|  31.3k|			break;
 3699|      0|		case 2:
  ------------------
  |  Branch (3699:3): [True: 0, False: 31.3k]
  ------------------
 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: 31.3k]
  ------------------
 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: 31.3k]
  ------------------
 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: 31.3k]
  ------------------
 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|  31.3k|		}
 3719|  31.3k|	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|  31.3k|	if (ilim >= 0 && ilim <= Quick_max && try_quick) {
  ------------------
  |  |  369|  31.3k|#define Quick_max 14
  ------------------
  |  Branch (3726:6): [True: 0, False: 31.3k]
  |  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|  31.3k|	if (be >= 0 && k <= Int_max) {
  ------------------
  |  |  370|  31.3k|#define Int_max 14
  ------------------
  |  Branch (3842:6): [True: 31.3k, False: 0]
  |  Branch (3842:17): [True: 26.2k, False: 5.15k]
  ------------------
 3843|       |		/* Yes. */
 3844|  26.2k|		ds = tens[k];
 3845|  26.2k|		if (ndigits < 0 && ilim <= 0) {
  ------------------
  |  Branch (3845:7): [True: 0, False: 26.2k]
  |  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|  26.2k|		for(i = 1;; i++, dval(&u) *= 10.) {
  ------------------
  |  |  314|      0|#define dval(x) (x)->d
  ------------------
 3852|  26.2k|			L = (Long)(dval(&u) / ds);
  ------------------
  |  |  314|  26.2k|#define dval(x) (x)->d
  ------------------
 3853|  26.2k|			dval(&u) -= L*ds;
  ------------------
  |  |  314|  26.2k|#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|  26.2k|			*s++ = '0' + (int)L;
 3862|  26.2k|			if (!dval(&u)) {
  ------------------
  |  |  314|  26.2k|#define dval(x) (x)->d
  ------------------
  |  Branch (3862:8): [True: 26.2k, False: 0]
  ------------------
 3863|       |#ifdef SET_INEXACT
 3864|       |				inexact = 0;
 3865|       |#endif
 3866|  26.2k|				break;
 3867|  26.2k|				}
 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|  26.2k|		goto ret1;
 3896|  26.2k|		}
 3897|       |
 3898|  5.15k|	m2 = b2;
 3899|  5.15k|	m5 = b5;
 3900|  5.15k|	mhi = mlo = 0;
 3901|  5.15k|	if (leftright) {
  ------------------
  |  Branch (3901:6): [True: 5.15k, False: 0]
  ------------------
 3902|  5.15k|		i =
 3903|  5.15k|#ifndef Sudden_Underflow
 3904|  5.15k|			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.15k]
  ------------------
 3905|  5.15k|#endif
 3906|       |#ifdef IBM
 3907|       |			1 + 4*P - 3 - bbits + ((bbits + be - 1) & 3);
 3908|       |#else
 3909|  5.15k|			1 + P - bbits;
  ------------------
  |  |  350|  5.15k|#define P 53
  ------------------
 3910|  5.15k|#endif
 3911|  5.15k|		b2 += i;
 3912|  5.15k|		s2 += i;
 3913|  5.15k|		mhi = i2b(C, 1);
 3914|  5.15k|		}
 3915|  5.15k|	if (m2 > 0 && s2 > 0) {
  ------------------
  |  Branch (3915:6): [True: 5.15k, False: 0]
  |  Branch (3915:16): [True: 5.15k, False: 0]
  ------------------
 3916|  5.15k|		i = m2 < s2 ? m2 : s2;
  ------------------
  |  Branch (3916:7): [True: 0, False: 5.15k]
  ------------------
 3917|  5.15k|		b2 -= i;
 3918|  5.15k|		m2 -= i;
 3919|  5.15k|		s2 -= i;
 3920|  5.15k|		}
 3921|  5.15k|	if (b5 > 0) {
  ------------------
  |  Branch (3921:6): [True: 0, False: 5.15k]
  ------------------
 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.15k|	S = i2b(C, 1);
 3936|  5.15k|	if (s5 > 0)
  ------------------
  |  Branch (3936:6): [True: 5.15k, False: 0]
  ------------------
 3937|  5.15k|		S = pow5mult(C, S, s5);
 3938|       |
 3939|       |	/* Check for special case that d is a normalized power of 2. */
 3940|       |
 3941|  5.15k|	spec_case = 0;
 3942|  5.15k|	if ((mode < 2 || leftright)
  ------------------
  |  Branch (3942:7): [True: 5.15k, False: 0]
  |  Branch (3942:19): [True: 0, False: 0]
  ------------------
 3943|       |#ifdef Honor_FLT_ROUNDS
 3944|       |			&& Rounding == 1
 3945|       |#endif
 3946|  5.15k|				) {
 3947|  5.15k|		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.15k]
  |  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.15k|#endif
 3951|  5.15k|				) {
 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.15k|		}
 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.15k|	i = dshift(C, S, s2);
 3967|  5.15k|	b2 += i;
 3968|  5.15k|	m2 += i;
 3969|  5.15k|	s2 += i;
 3970|  5.15k|	if (b2 > 0)
  ------------------
  |  Branch (3970:6): [True: 5.15k, False: 0]
  ------------------
 3971|  5.15k|		b = lshift(C, b, b2);
 3972|  5.15k|	if (s2 > 0)
  ------------------
  |  Branch (3972:6): [True: 5.15k, False: 0]
  ------------------
 3973|  5.15k|		S = lshift(C, S, s2);
 3974|  5.15k|	if (k_check) {
  ------------------
  |  Branch (3974:6): [True: 5.15k, False: 0]
  ------------------
 3975|  5.15k|		if (cmp(C, b,S) < 0) {
  ------------------
  |  Branch (3975:7): [True: 0, False: 5.15k]
  ------------------
 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.15k|		}
 3983|  5.15k|	if (ilim <= 0 && (mode == 3 || mode == 5)) {
  ------------------
  |  Branch (3983:6): [True: 5.15k, False: 0]
  |  Branch (3983:20): [True: 0, False: 5.15k]
  |  Branch (3983:33): [True: 0, False: 5.15k]
  ------------------
 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.15k|	if (leftright) {
  ------------------
  |  Branch (3995:6): [True: 5.15k, False: 0]
  ------------------
 3996|  5.15k|		if (m2 > 0)
  ------------------
  |  Branch (3996:7): [True: 5.15k, False: 0]
  ------------------
 3997|  5.15k|			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.15k|		mlo = mhi;
 4004|  5.15k|		if (spec_case) {
  ------------------
  |  Branch (4004:7): [True: 0, False: 5.15k]
  ------------------
 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|  87.6k|		for(i = 1;;i++) {
 4011|  87.6k|			dig = quorem(C, b,S) + '0';
 4012|       |			/* Do we yet have the shortest decimal string
 4013|       |			 * that will round to d?
 4014|       |			 */
 4015|  87.6k|			j = cmp(C, b, mlo);
 4016|  87.6k|			delta = diff(C, S, mhi);
 4017|  87.6k|			j1 = delta->sign ? 1 : cmp(C, b, delta);
  ------------------
  |  Branch (4017:9): [True: 0, False: 87.6k]
  ------------------
 4018|  87.6k|			Bfree(C, delta);
 4019|  87.6k|#ifndef ROUND_BIASED
 4020|  87.6k|			if (j1 == 0 && mode != 1 && !(word1(&u) & 1)
  ------------------
  |  |  309|      0|#define word1(x) (x)->L[0]
  ------------------
  |  Branch (4020:8): [True: 0, False: 87.6k]
  |  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|  87.6k|								   ) {
 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|  87.6k|#endif
 4037|  87.6k|			if (j < 0 || (j == 0 && mode != 1
  ------------------
  |  Branch (4037:8): [True: 5.15k, False: 82.4k]
  |  Branch (4037:18): [True: 0, False: 82.4k]
  |  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|  82.4k|#endif
 4041|  82.4k|					)) {
 4042|  5.15k|				if (!b->x[0] && b->wds <= 1) {
  ------------------
  |  Branch (4042:9): [True: 0, False: 5.15k]
  |  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.15k|				if (j1 > 0) {
  ------------------
  |  Branch (4055:9): [True: 5.15k, False: 0]
  ------------------
 4056|  5.15k|					b = lshift(C, b, 1);
 4057|  5.15k|					j1 = cmp(C, b, S);
 4058|       |#ifdef ROUND_BIASED
 4059|       |					if (j1 >= 0 /*)*/
 4060|       |#else
 4061|  5.15k|					if ((j1 > 0 || (j1 == 0 && dig & 1))
  ------------------
  |  Branch (4061:11): [True: 0, False: 5.15k]
  |  Branch (4061:22): [True: 0, False: 5.15k]
  |  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.15k|					}
 4066|  5.15k| accept_dig:
 4067|  5.15k|				*s++ = dig;
 4068|  5.15k|				goto ret;
 4069|  5.15k|				}
 4070|  82.4k|			if (j1 > 0) {
  ------------------
  |  Branch (4070:8): [True: 0, False: 82.4k]
  ------------------
 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|  82.4k|			*s++ = dig;
 4087|  82.4k|			if (i == ilim)
  ------------------
  |  Branch (4087:8): [True: 0, False: 82.4k]
  ------------------
 4088|      0|				break;
 4089|  82.4k|			b = multadd(C, b, 10, 0);
 4090|  82.4k|			if (mlo == mhi)
  ------------------
  |  Branch (4090:8): [True: 82.4k, False: 0]
  ------------------
 4091|  82.4k|				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|  82.4k|			}
 4097|  5.15k|		}
 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.15k| ret:
 4145|  5.15k|	Bfree(C, S);
 4146|  5.15k|	if (mhi) {
  ------------------
  |  Branch (4146:6): [True: 5.15k, False: 0]
  ------------------
 4147|  5.15k|		if (mlo && mlo != mhi)
  ------------------
  |  Branch (4147:7): [True: 5.15k, False: 0]
  |  Branch (4147:14): [True: 0, False: 5.15k]
  ------------------
 4148|      0|			Bfree(C, mlo);
 4149|  5.15k|		Bfree(C, mhi);
 4150|  5.15k|		}
 4151|  31.3k| 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|  31.3k|	Bfree(C, b);
 4164|  31.3k|	*s = 0;
 4165|  31.3k|	*decpt = k + 1;
 4166|  31.3k|	if (rve)
  ------------------
  |  Branch (4166:6): [True: 31.3k, False: 0]
  ------------------
 4167|  31.3k|		*rve = s;
 4168|  31.3k|	return s0;
 4169|  5.15k|	}
jvp_dtoa_fmt:
 4207|  7.01M|{
 4208|  7.01M|	register int i, k;
 4209|  7.01M|	register char *s;
 4210|  7.01M|	int decpt, j, sign;
 4211|  7.01M|	char *b0, *s0, *se;
 4212|       |
 4213|  7.01M|	b0 = b;
 4214|       |#ifdef IGNORE_ZERO_SIGN
 4215|       |	if (!x) {
 4216|       |		*b++ = '0';
 4217|       |		*b = 0;
 4218|       |		goto done;
 4219|       |		}
 4220|       |#endif
 4221|  7.01M|	s = s0 = jvp_dtoa(C, x, 0, 0, &decpt, &sign, &se);
 4222|  7.01M|	if (sign)
  ------------------
  |  Branch (4222:6): [True: 194, False: 7.01M]
  ------------------
 4223|    194|		*b++ = '-';
 4224|  7.01M|	if (decpt == 9999) /* Infinity or Nan */ {
  ------------------
  |  Branch (4224:6): [True: 0, False: 7.01M]
  ------------------
 4225|      0|		while((*b++ = *s++));
  ------------------
  |  Branch (4225:9): [True: 0, False: 0]
  ------------------
 4226|      0|		goto done0;
 4227|      0|		}
 4228|  7.01M|	if (decpt <= -4 || decpt > se - s + 15) {
  ------------------
  |  Branch (4228:6): [True: 0, False: 7.01M]
  |  Branch (4228:21): [True: 5.15k, False: 7.01M]
  ------------------
 4229|  5.15k|		*b++ = *s++;
 4230|  5.15k|		if (*s) {
  ------------------
  |  Branch (4230:7): [True: 5.15k, False: 0]
  ------------------
 4231|  5.15k|			*b++ = '.';
 4232|  87.6k|			while((*b = *s++))
  ------------------
  |  Branch (4232:10): [True: 82.4k, False: 5.15k]
  ------------------
 4233|  82.4k|				b++;
 4234|  5.15k|			}
 4235|  5.15k|		*b++ = 'e';
 4236|       |		/* sprintf(b, "%+.2d", decpt - 1); */
 4237|  5.15k|		if (--decpt < 0) {
  ------------------
  |  Branch (4237:7): [True: 0, False: 5.15k]
  ------------------
 4238|      0|			*b++ = '-';
 4239|      0|			decpt = -decpt;
 4240|      0|			}
 4241|  5.15k|		else
 4242|  5.15k|			*b++ = '+';
 4243|  10.3k|		for(j = 2, k = 10; 10*k <= decpt; j++, k *= 10);
  ------------------
  |  Branch (4243:22): [True: 5.15k, False: 5.15k]
  ------------------
 4244|  15.4k|		for(;;) {
 4245|  15.4k|			i = decpt / k;
 4246|  15.4k|			*b++ = i + '0';
 4247|  15.4k|			if (--j <= 0)
  ------------------
  |  Branch (4247:8): [True: 5.15k, False: 10.3k]
  ------------------
 4248|  5.15k|				break;
 4249|  10.3k|			decpt -= i*k;
 4250|  10.3k|			decpt *= 10;
 4251|  10.3k|			}
 4252|  5.15k|		*b = 0;
 4253|  5.15k|		}
 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.01M| done0:
 4272|  7.01M|	jvp_freedtoa(C, s0);
 4273|  7.01M|        goto done;
 4274|  7.01M| done:
 4275|  7.01M|	return b0;
 4276|  7.01M|	}
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.3k|	while((d = *t++)) {
  ------------------
  |  Branch (1439:8): [True: 36.0k, False: 10.3k]
  ------------------
 1440|  36.0k|		if ((c = *++s) >= 'A' && c <= 'Z')
  ------------------
  |  Branch (1440:7): [True: 36.0k, False: 0]
  |  Branch (1440:28): [True: 0, False: 36.0k]
  ------------------
 1441|      0|			c += 'a' - 'A';
 1442|  36.0k|		if (c != d)
  ------------------
  |  Branch (1442:7): [True: 0, False: 36.0k]
  ------------------
 1443|      0|			return 0;
 1444|  36.0k|		}
 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|  31.3k|{
 1188|  31.3k|	Bigint *b;
 1189|  31.3k|	int de, k;
 1190|  31.3k|	ULong *x, y, z;
 1191|  31.3k|#ifndef Sudden_Underflow
 1192|  31.3k|	int i;
 1193|  31.3k|#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|  31.3k|#define d0 word0(d)
 1200|  31.3k|#define d1 word1(d)
 1201|  31.3k|#endif
 1202|       |
 1203|  31.3k|#ifdef Pack_32
 1204|  31.3k|	b = Balloc(C, 1);
 1205|       |#else
 1206|       |	b = Balloc(C, 2);
 1207|       |#endif
 1208|  31.3k|	x = b->x;
 1209|       |
 1210|  31.3k|	z = d0 & Frac_mask;
  ------------------
  |  | 1199|  31.3k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  31.3k|#define word0(x) (x)->L[1]
  |  |  ------------------
  ------------------
              	z = d0 & Frac_mask;
  ------------------
  |  |  358|  31.3k|#define Frac_mask  0xfffff
  ------------------
 1211|  31.3k|	d0 &= 0x7fffffff;	/* clear sign bit, which we ignore */
  ------------------
  |  | 1199|  31.3k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  31.3k|#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|  31.3k|	if ((de = (int)(d0 >> Exp_shift)))
  ------------------
  |  | 1199|  31.3k|#define d0 word0(d)
  |  |  ------------------
  |  |  |  |  308|  31.3k|#define word0(x) (x)->L[1]
  |  |  ------------------
  ------------------
              	if ((de = (int)(d0 >> Exp_shift)))
  ------------------
  |  |  345|  31.3k|#define Exp_shift  20
  ------------------
  |  Branch (1218:6): [True: 31.3k, False: 0]
  ------------------
 1219|  31.3k|		z |= Exp_msk1;
  ------------------
  |  |  347|  31.3k|#define Exp_msk1    0x100000
  ------------------
 1220|  31.3k|#endif
 1221|  31.3k|#ifdef Pack_32
 1222|  31.3k|	if ((y = d1)) {
  ------------------
  |  | 1200|  31.3k|#define d1 word1(d)
  |  |  ------------------
  |  |  |  |  309|  31.3k|#define word1(x) (x)->L[0]
  |  |  ------------------
  ------------------
  |  Branch (1222:6): [True: 5.15k, False: 26.2k]
  ------------------
 1223|  5.15k|		if ((k = lo0bits(C, &y))) {
  ------------------
  |  Branch (1223:7): [True: 0, False: 5.15k]
  ------------------
 1224|      0|			x[0] = y | z << (32 - k);
 1225|      0|			z >>= k;
 1226|      0|			}
 1227|  5.15k|		else
 1228|  5.15k|			x[0] = y;
 1229|  5.15k|#ifndef Sudden_Underflow
 1230|  5.15k|		i =
 1231|  5.15k|#endif
 1232|  5.15k|		    b->wds = (x[1] = z) ? 2 : 1;
  ------------------
  |  Branch (1232:16): [True: 5.15k, False: 0]
  ------------------
 1233|  5.15k|		}
 1234|  26.2k|	else {
 1235|  26.2k|		k = lo0bits(C, &z);
 1236|  26.2k|		x[0] = z;
 1237|  26.2k|#ifndef Sudden_Underflow
 1238|  26.2k|		i =
 1239|  26.2k|#endif
 1240|  26.2k|		    b->wds = 1;
 1241|  26.2k|		k += 32;
 1242|  26.2k|		}
 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|  31.3k|#ifndef Sudden_Underflow
 1289|  31.3k|	if (de) {
  ------------------
  |  Branch (1289:6): [True: 31.3k, False: 0]
  ------------------
 1290|  31.3k|#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|  31.3k|		*e = de - Bias - (P-1) + k;
  ------------------
  |  |  352|  31.3k|#define Bias 1023
  ------------------
              		*e = de - Bias - (P-1) + k;
  ------------------
  |  |  350|  31.3k|#define P 53
  ------------------
 1296|  31.3k|		*bits = P - k;
  ------------------
  |  |  350|  31.3k|#define P 53
  ------------------
 1297|  31.3k|#endif
 1298|  31.3k|#ifndef Sudden_Underflow
 1299|  31.3k|		}
 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|  31.3k|#endif
 1309|  31.3k|	return b;
 1310|  31.3k|	}
jv_dtoa.c:lo0bits:
  709|  31.3k|{
  710|  31.3k|	int k;
  711|  31.3k|	ULong x = *y;
  712|       |
  713|  31.3k|	if (x & 7) {
  ------------------
  |  Branch (713:6): [True: 5.15k, False: 26.2k]
  ------------------
  714|  5.15k|		if (x & 1)
  ------------------
  |  Branch (714:7): [True: 5.15k, False: 0]
  ------------------
  715|  5.15k|			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|  26.2k|	k = 0;
  724|  26.2k|	if (!(x & 0xffff)) {
  ------------------
  |  Branch (724:6): [True: 26.2k, False: 0]
  ------------------
  725|  26.2k|		k = 16;
  726|  26.2k|		x >>= 16;
  727|  26.2k|		}
  728|  26.2k|	if (!(x & 0xff)) {
  ------------------
  |  Branch (728:6): [True: 0, False: 26.2k]
  ------------------
  729|      0|		k += 8;
  730|      0|		x >>= 8;
  731|      0|		}
  732|  26.2k|	if (!(x & 0xf)) {
  ------------------
  |  Branch (732:6): [True: 26.2k, False: 0]
  ------------------
  733|  26.2k|		k += 4;
  734|  26.2k|		x >>= 4;
  735|  26.2k|		}
  736|  26.2k|	if (!(x & 0x3)) {
  ------------------
  |  Branch (736:6): [True: 0, False: 26.2k]
  ------------------
  737|      0|		k += 2;
  738|      0|		x >>= 2;
  739|      0|		}
  740|  26.2k|	if (!(x & 1)) {
  ------------------
  |  Branch (740:6): [True: 0, False: 26.2k]
  ------------------
  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|  26.2k|	*y = x;
  747|  26.2k|	return k;
  748|  26.2k|	}
jv_dtoa.c:hi0bits:
  679|  5.15k|{
  680|  5.15k|	int k = 0;
  681|       |
  682|  5.15k|	if (!(x & 0xffff0000)) {
  ------------------
  |  Branch (682:6): [True: 5.15k, False: 0]
  ------------------
  683|  5.15k|		k = 16;
  684|  5.15k|		x <<= 16;
  685|  5.15k|		}
  686|  5.15k|	if (!(x & 0xff000000)) {
  ------------------
  |  Branch (686:6): [True: 0, False: 5.15k]
  ------------------
  687|      0|		k += 8;
  688|      0|		x <<= 8;
  689|      0|		}
  690|  5.15k|	if (!(x & 0xf0000000)) {
  ------------------
  |  Branch (690:6): [True: 5.15k, False: 0]
  ------------------
  691|  5.15k|		k += 4;
  692|  5.15k|		x <<= 4;
  693|  5.15k|		}
  694|  5.15k|	if (!(x & 0xc0000000)) {
  ------------------
  |  Branch (694:6): [True: 0, False: 5.15k]
  ------------------
  695|      0|		k += 2;
  696|      0|		x <<= 2;
  697|      0|		}
  698|  5.15k|	if (!(x & 0x80000000)) {
  ------------------
  |  Branch (698:6): [True: 0, False: 5.15k]
  ------------------
  699|      0|		k++;
  700|      0|		if (!(x & 0x40000000))
  ------------------
  |  Branch (700:7): [True: 0, False: 0]
  ------------------
  701|      0|			return 32;
  702|      0|		}
  703|  5.15k|	return k;
  704|  5.15k|	}
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.15k|{
  873|  5.15k|	Bigint *b1, *p5, *p51;
  874|  5.15k|	int i;
  875|  5.15k|	static const int p05[3] = { 5, 25, 125 };
  876|       |
  877|  5.15k|	if ((i = k & 3))
  ------------------
  |  Branch (877:6): [True: 0, False: 5.15k]
  ------------------
  878|      0|		b = multadd(C, b, p05[i-1], 0);
  879|       |
  880|  5.15k|	if (!(k >>= 2))
  ------------------
  |  Branch (880:6): [True: 0, False: 5.15k]
  ------------------
  881|      0|		return b;
  882|  5.15k|	if (!(p5 = C->p5s)) {
  ------------------
  |  Branch (882:6): [True: 1, False: 5.15k]
  ------------------
  883|       |		/* first time */
  884|      1|		p5 = C->p5s = i2b(C, 625);
  885|      1|		p5->next = 0;
  886|      1|		}
  887|  36.0k|	for(;;) {
  888|  36.0k|		if (k & 1) {
  ------------------
  |  Branch (888:7): [True: 20.6k, False: 15.4k]
  ------------------
  889|  20.6k|			b1 = mult(C, b, p5);
  890|  20.6k|			Bfree(C, b);
  891|  20.6k|			b = b1;
  892|  20.6k|			}
  893|  36.0k|		if (!(k >>= 1))
  ------------------
  |  Branch (893:7): [True: 5.15k, False: 30.9k]
  ------------------
  894|  5.15k|			break;
  895|  30.9k|		if (!(p51 = p5->next)) {
  ------------------
  |  Branch (895:7): [True: 6, False: 30.9k]
  ------------------
  896|      6|			p51 = p5->next = mult(C, p5,p5);
  897|      6|			p51->next = 0;
  898|      6|			}
  899|  30.9k|		p5 = p51;
  900|  30.9k|		}
  901|  5.15k|	return b;
  902|  5.15k|	}
jv_dtoa.c:mult:
  765|  20.6k|{
  766|  20.6k|	Bigint *c;
  767|  20.6k|	int k, wa, wb, wc;
  768|  20.6k|	ULong *x, *xa, *xae, *xb, *xbe, *xc, *xc0;
  769|  20.6k|	ULong y;
  770|  20.6k|#ifdef ULLong
  771|  20.6k|	ULLong carry, z;
  ------------------
  |  |  506|  20.6k|#define ULLong unsigned Llong
  ------------------
  772|       |#else
  773|       |	ULong carry, z;
  774|       |#ifdef Pack_32
  775|       |	ULong z2;
  776|       |#endif
  777|       |#endif
  778|       |
  779|  20.6k|	if (a->wds < b->wds) {
  ------------------
  |  Branch (779:6): [True: 15.4k, False: 5.16k]
  ------------------
  780|  15.4k|		c = a;
  781|  15.4k|		a = b;
  782|  15.4k|		b = c;
  783|  15.4k|		}
  784|  20.6k|	k = a->k;
  785|  20.6k|	wa = a->wds;
  786|  20.6k|	wb = b->wds;
  787|  20.6k|	wc = wa + wb;
  788|  20.6k|	if (wc > a->maxwds)
  ------------------
  |  Branch (788:6): [True: 10.3k, False: 10.3k]
  ------------------
  789|  10.3k|		k++;
  790|  20.6k|	c = Balloc(C, k);
  791|   190k|	for(x = c->x, xa = x + wc; x < xa; x++)
  ------------------
  |  Branch (791:29): [True: 170k, False: 20.6k]
  ------------------
  792|   170k|		*x = 0;
  793|  20.6k|	xa = a->x;
  794|  20.6k|	xae = xa + wa;
  795|  20.6k|	xb = b->x;
  796|  20.6k|	xbe = xb + wb;
  797|  20.6k|	xc0 = c->x;
  798|  20.6k|#ifdef ULLong
  799|  61.8k|	for(; xb < xbe; xc0++) {
  ------------------
  |  Branch (799:8): [True: 41.2k, False: 20.6k]
  ------------------
  800|  41.2k|		if ((y = *xb++)) {
  ------------------
  |  Branch (800:7): [True: 41.2k, False: 0]
  ------------------
  801|  41.2k|			x = xa;
  802|  41.2k|			xc = xc0;
  803|  41.2k|			carry = 0;
  804|   438k|			do {
  805|   438k|				z = *x++ * (ULLong)y + *xc + carry;
  806|   438k|				carry = z >> 32;
  807|   438k|				*xc++ = z & FFFFFFFF;
  ------------------
  |  |  489|   438k|#define FFFFFFFF 0xffffffffUL
  ------------------
  808|   438k|				}
  809|   438k|				while(x < xae);
  ------------------
  |  Branch (809:11): [True: 397k, False: 41.2k]
  ------------------
  810|  41.2k|			*xc = carry;
  811|  41.2k|			}
  812|  41.2k|		}
  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.0k|	for(xc0 = c->x, xc = xc0 + wc; wc > 0 && !*--xc; --wc) ;
  ------------------
  |  Branch (863:33): [True: 36.0k, False: 0]
  |  Branch (863:43): [True: 15.4k, False: 20.6k]
  ------------------
  864|  20.6k|	c->wds = wc;
  865|  20.6k|	return c;
  866|  20.6k|	}
jv_dtoa.c:lshift:
  907|  20.6k|{
  908|  20.6k|	int i, k1, n, n1;
  909|  20.6k|	Bigint *b1;
  910|  20.6k|	ULong *x, *x1, *xe, z;
  911|       |
  912|  20.6k|#ifdef Pack_32
  913|  20.6k|	n = k >> 5;
  914|       |#else
  915|       |	n = k >> 4;
  916|       |#endif
  917|  20.6k|	k1 = b->k;
  918|  20.6k|	n1 = n + b->wds + 1;
  919|  61.8k|	for(i = b->maxwds; n1 > i; i <<= 1)
  ------------------
  |  Branch (919:21): [True: 41.2k, False: 20.6k]
  ------------------
  920|  41.2k|		k1++;
  921|  20.6k|	b1 = Balloc(C, k1);
  922|  20.6k|	x1 = b1->x;
  923|   237k|	for(i = 0; i < n; i++)
  ------------------
  |  Branch (923:13): [True: 216k, False: 20.6k]
  ------------------
  924|   216k|		*x1++ = 0;
  925|  20.6k|	x = b->x;
  926|  20.6k|	xe = x + b->wds;
  927|  20.6k|#ifdef Pack_32
  928|  20.6k|	if (k &= 0x1f) {
  ------------------
  |  Branch (928:6): [True: 20.6k, False: 0]
  ------------------
  929|  20.6k|		k1 = 32 - k;
  930|  20.6k|		z = 0;
  931|   252k|		do {
  932|   252k|			*x1++ = *x << k | z;
  933|   252k|			z = *x++ >> k1;
  934|   252k|			}
  935|   252k|			while(x < xe);
  ------------------
  |  Branch (935:10): [True: 231k, False: 20.6k]
  ------------------
  936|  20.6k|		if ((*x1 = z))
  ------------------
  |  Branch (936:7): [True: 0, False: 20.6k]
  ------------------
  937|      0|			++n1;
  938|  20.6k|		}
  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.6k|	b1->wds = n1 - 1;
  956|  20.6k|	Bfree(C, b);
  957|  20.6k|	return b1;
  958|  20.6k|	}
jv_dtoa.c:diff:
  993|  87.6k|{
  994|  87.6k|	Bigint *c;
  995|  87.6k|	int i, wa, wb;
  996|  87.6k|	ULong *xa, *xae, *xb, *xbe, *xc;
  997|  87.6k|#ifdef ULLong
  998|  87.6k|	ULLong borrow, y;
  ------------------
  |  |  506|  87.6k|#define ULLong unsigned Llong
  ------------------
  999|       |#else
 1000|       |	ULong borrow, y;
 1001|       |#ifdef Pack_32
 1002|       |	ULong z;
 1003|       |#endif
 1004|       |#endif
 1005|       |
 1006|  87.6k|	i = cmp(C, a,b);
 1007|  87.6k|	if (!i) {
  ------------------
  |  Branch (1007:6): [True: 0, False: 87.6k]
  ------------------
 1008|      0|		c = Balloc(C, 0);
 1009|      0|		c->wds = 1;
 1010|      0|		c->x[0] = 0;
 1011|      0|		return c;
 1012|      0|		}
 1013|  87.6k|	if (i < 0) {
  ------------------
  |  Branch (1013:6): [True: 0, False: 87.6k]
  ------------------
 1014|      0|		c = a;
 1015|      0|		a = b;
 1016|      0|		b = c;
 1017|      0|		i = 1;
 1018|      0|		}
 1019|  87.6k|	else
 1020|  87.6k|		i = 0;
 1021|  87.6k|	c = Balloc(C, a->k);
 1022|  87.6k|	c->sign = i;
 1023|  87.6k|	wa = a->wds;
 1024|  87.6k|	xa = a->x;
 1025|  87.6k|	xae = xa + wa;
 1026|  87.6k|	wb = b->wds;
 1027|  87.6k|	xb = b->x;
 1028|  87.6k|	xbe = xb + wb;
 1029|  87.6k|	xc = c->x;
 1030|  87.6k|	borrow = 0;
 1031|  87.6k|#ifdef ULLong
 1032|  1.97M|	do {
 1033|  1.97M|		y = (ULLong)*xa++ - *xb++ - borrow;
 1034|  1.97M|		borrow = y >> 32 & (ULong)1;
 1035|  1.97M|		*xc++ = y & FFFFFFFF;
  ------------------
  |  |  489|  1.97M|#define FFFFFFFF 0xffffffffUL
  ------------------
 1036|  1.97M|		}
 1037|  1.97M|		while(xb < xbe);
  ------------------
  |  Branch (1037:9): [True: 1.88M, False: 87.6k]
  ------------------
 1038|   128k|	while(xa < xae) {
  ------------------
  |  Branch (1038:8): [True: 41.2k, False: 87.6k]
  ------------------
 1039|  41.2k|		y = *xa++ - borrow;
 1040|  41.2k|		borrow = y >> 32 & (ULong)1;
 1041|  41.2k|		*xc++ = y & FFFFFFFF;
  ------------------
  |  |  489|  41.2k|#define FFFFFFFF 0xffffffffUL
  ------------------
 1042|  41.2k|		}
 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|  87.6k|	while(!*--xc)
  ------------------
  |  Branch (1074:8): [True: 0, False: 87.6k]
  ------------------
 1075|      0|		wa--;
 1076|  87.6k|	c->wds = wa;
 1077|  87.6k|	return c;
 1078|  87.6k|	}
jv_dtoa.c:cmp:
  963|   360k|{
  964|   360k|	ULong *xa, *xa0, *xb, *xb0;
  965|   360k|	int i, j;
  966|       |
  967|   360k|	i = a->wds;
  968|   360k|	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|   360k|	if (i -= j)
  ------------------
  |  Branch (975:6): [True: 82.4k, False: 278k]
  ------------------
  976|  82.4k|		return i;
  977|   278k|	xa0 = a->x;
  978|   278k|	xa = xa0 + j;
  979|   278k|	xb0 = b->x;
  980|   278k|	xb = xb0 + j;
  981|   278k|	for(;;) {
  982|   278k|		if (*--xa != *--xb)
  ------------------
  |  Branch (982:7): [True: 278k, False: 0]
  ------------------
  983|   278k|			return *xa < *xb ? -1 : 1;
  ------------------
  |  Branch (983:11): [True: 180k, False: 97.9k]
  ------------------
  984|      0|		if (xa <= xa0)
  ------------------
  |  Branch (984:7): [True: 0, False: 0]
  ------------------
  985|      0|			break;
  986|      0|		}
  987|      0|	return 0;
  988|   278k|	}
jv_dtoa.c:nrv_alloc:
 3412|  6.98M|{
 3413|  6.98M|	char *rv, *t;
 3414|       |
 3415|  6.98M|	t = rv = rv_alloc(C, n);
 3416|  13.9M|	while((*t = *s++)) t++;
  ------------------
  |  Branch (3416:8): [True: 6.98M, False: 6.98M]
  ------------------
 3417|  6.98M|	if (rve)
  ------------------
  |  Branch (3417:6): [True: 6.98M, False: 0]
  ------------------
 3418|  6.98M|		*rve = t;
 3419|  6.98M|	return rv;
 3420|  6.98M|	}
jv_dtoa.c:rv_alloc:
 3396|  7.01M|{
 3397|  7.01M|	int j, k, *r;
 3398|       |
 3399|  7.01M|	j = sizeof(ULong);
 3400|  7.01M|	for(k = 0;
 3401|  7.01M|            (int)(sizeof(Bigint) - sizeof(ULong) - sizeof(int)) + j <= i;
  ------------------
  |  Branch (3401:13): [True: 0, False: 7.01M]
  ------------------
 3402|  7.01M|		j <<= 1)
 3403|      0|			k++;
 3404|  7.01M|	r = (int*)Balloc(C, k);
 3405|  7.01M|	*r = k;
 3406|  7.01M|	return
 3407|  7.01M|		(char *)(r+1);
 3408|  7.01M|	}
jv_dtoa.c:dshift:
 1978|  5.15k|{
 1979|  5.15k|	int rv = hi0bits(C, b->x[b->wds-1]) - 4;
 1980|  5.15k|	if (p2 > 0)
  ------------------
  |  Branch (1980:6): [True: 0, False: 5.15k]
  ------------------
 1981|      0|		rv -= p2;
 1982|  5.15k|	return rv & kmask;
  ------------------
  |  | 1518|  5.15k|#define kmask 31
  ------------------
 1983|  5.15k|	}
jv_dtoa.c:multadd:
  592|   164k|{
  593|   164k|	int i, wds;
  594|   164k|#ifdef ULLong
  595|   164k|	ULong *x;
  596|   164k|	ULLong carry, y;
  ------------------
  |  |  506|   164k|#define ULLong unsigned Llong
  ------------------
  597|       |#else
  598|       |	ULong carry, *x, y;
  599|       |#ifdef Pack_32
  600|       |	ULong xi, z;
  601|       |#endif
  602|       |#endif
  603|   164k|	Bigint *b1;
  604|       |
  605|   164k|	wds = b->wds;
  606|   164k|	x = b->x;
  607|   164k|	i = 0;
  608|   164k|	carry = a;
  609|  3.75M|	do {
  610|  3.75M|#ifdef ULLong
  611|  3.75M|		y = *x * (ULLong)m + carry;
  612|  3.75M|		carry = y >> 32;
  613|  3.75M|		*x++ = y & FFFFFFFF;
  ------------------
  |  |  489|  3.75M|#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.75M|		}
  628|  3.75M|		while(++i < wds);
  ------------------
  |  Branch (628:9): [True: 3.58M, False: 164k]
  ------------------
  629|   164k|	if (carry) {
  ------------------
  |  Branch (629:6): [True: 5.15k, False: 159k]
  ------------------
  630|  5.15k|		if (wds >= b->maxwds) {
  ------------------
  |  Branch (630:7): [True: 0, False: 5.15k]
  ------------------
  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.15k|		b->x[wds++] = carry;
  637|  5.15k|		b->wds = wds;
  638|  5.15k|		}
  639|   164k|	return b;
  640|   164k|	}
jv_dtoa.c:quorem:
 1988|  87.6k|{
 1989|  87.6k|	int n;
 1990|  87.6k|	ULong *bx, *bxe, q, *sx, *sxe;
 1991|  87.6k|#ifdef ULLong
 1992|  87.6k|	ULLong borrow, carry, y, ys;
  ------------------
  |  |  506|  87.6k|#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|  87.6k|	n = S->wds;
 2001|       |#ifdef DEBUG
 2002|       |	/*debug*/ if (b->wds > n)
 2003|       |	/*debug*/	Bug("oversize b in quorem");
 2004|       |#endif
 2005|  87.6k|	if (b->wds < n)
  ------------------
  |  Branch (2005:6): [True: 0, False: 87.6k]
  ------------------
 2006|      0|		return 0;
 2007|  87.6k|	sx = S->x;
 2008|  87.6k|	sxe = sx + --n;
 2009|  87.6k|	bx = b->x;
 2010|  87.6k|	bxe = bx + n;
 2011|  87.6k|	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|  87.6k|	if (q) {
  ------------------
  |  Branch (2022:6): [True: 87.6k, False: 0]
  ------------------
 2023|  87.6k|		borrow = 0;
 2024|  87.6k|		carry = 0;
 2025|  2.01M|		do {
 2026|  2.01M|#ifdef ULLong
 2027|  2.01M|			ys = *sx++ * (ULLong)q + carry;
 2028|  2.01M|			carry = ys >> 32;
 2029|  2.01M|			y = *bx - (ys & FFFFFFFF) - borrow;
  ------------------
  |  |  489|  2.01M|#define FFFFFFFF 0xffffffffUL
  ------------------
 2030|  2.01M|			borrow = y >> 32 & (ULong)1;
 2031|  2.01M|			*bx++ = y & FFFFFFFF;
  ------------------
  |  |  489|  2.01M|#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.01M|			}
 2052|  2.01M|			while(sx <= sxe);
  ------------------
  |  Branch (2052:10): [True: 1.92M, False: 87.6k]
  ------------------
 2053|  87.6k|		if (!*bxe) {
  ------------------
  |  Branch (2053:7): [True: 0, False: 87.6k]
  ------------------
 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|  87.6k|		}
 2060|  87.6k|	if (cmp(C, b, S) >= 0) {
  ------------------
  |  Branch (2060:6): [True: 0, False: 87.6k]
  ------------------
 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|  87.6k|	return q;
 2103|  87.6k|	}

tsd_dtoa_context_get:
   39|  7.67k|inline struct dtoa_context *tsd_dtoa_context_get(void) {
   40|  7.67k|  pthread_once(&dtoa_ctx_once, jv_tsd_dtoa_ctx_init); // cannot fail
   41|  7.67k|  struct dtoa_context *ctx = (struct dtoa_context*)pthread_getspecific(dtoa_ctx_key);
   42|  7.67k|  if (!ctx) {
  ------------------
  |  Branch (42:7): [True: 1, False: 7.67k]
  ------------------
   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.67k|  return ctx;
   52|  7.67k|}
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.33k|void jv_parser_set_buf(struct jv_parser* p, const char* buf, int length, int is_partial) {
  741|  4.33k|  assert((p->curr_buf == 0 || p->curr_buf_pos == p->curr_buf_length)
  ------------------
  |  Branch (741:3): [True: 4.33k, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 4.33k, False: 0]
  |  Branch (741:3): [True: 0, False: 0]
  |  Branch (741:3): [True: 4.33k, False: 0]
  ------------------
  742|  4.33k|         && "previous buffer not exhausted");
  743|  8.75k|  while (length > 0 && p->bom_strip_position < sizeof(UTF8_BOM)) {
  ------------------
  |  Branch (743:10): [True: 8.73k, False: 17]
  |  Branch (743:24): [True: 4.42k, False: 4.31k]
  ------------------
  744|  4.42k|    if ((unsigned char)*buf == UTF8_BOM[p->bom_strip_position]) {
  ------------------
  |  Branch (744:9): [True: 110, False: 4.31k]
  ------------------
  745|       |      // matched a BOM character
  746|    110|      buf++;
  747|    110|      length--;
  748|    110|      p->bom_strip_position++;
  749|  4.31k|    } else {
  750|  4.31k|      if (p->bom_strip_position == 0) {
  ------------------
  |  Branch (750:11): [True: 4.21k, False: 98]
  ------------------
  751|       |        // no BOM in this document
  752|  4.21k|        p->bom_strip_position = sizeof(UTF8_BOM);
  753|  4.21k|      } else {
  754|       |        // malformed BOM (prefix present, rest missing)
  755|     98|        p->bom_strip_position = 0xff;
  756|     98|      }
  757|  4.31k|    }
  758|  4.42k|  }
  759|  4.33k|  p->curr_buf = buf;
  760|  4.33k|  p->curr_buf_length = length;
  761|  4.33k|  p->curr_buf_pos = 0;
  762|  4.33k|  p->curr_buf_is_partial = is_partial;
  763|  4.33k|}
jv_parser_next:
  777|  7.44k|jv jv_parser_next(struct jv_parser* p) {
  778|  7.44k|  if (p->eof)
  ------------------
  |  Branch (778:7): [True: 1.43k, False: 6.00k]
  ------------------
  779|  1.43k|    return jv_invalid();
  780|  6.00k|  if (!p->curr_buf)
  ------------------
  |  Branch (780:7): [True: 57, False: 5.95k]
  ------------------
  781|     57|    return jv_invalid(); // Need a buffer
  782|  5.95k|  if (p->bom_strip_position == 0xff) {
  ------------------
  |  Branch (782:7): [True: 136, False: 5.81k]
  ------------------
  783|    136|    if (!(p->flags & JV_PARSE_SEQ))
  ------------------
  |  Branch (783:9): [True: 11, False: 125]
  ------------------
  784|     11|      return jv_invalid_with_msg(jv_string("Malformed BOM"));
  785|    125|    p->st =JV_PARSER_WAITING_FOR_RS;
  786|    125|    parser_reset(p);
  787|    125|  }
  788|  5.93k|  jv value = jv_invalid();
  789|  5.93k|  if ((p->flags & JV_PARSE_STREAMING) && stream_check_done(p, &value))
  ------------------
  |  Branch (789:7): [True: 1.77k, False: 4.16k]
  |  Branch (789:42): [True: 4, False: 1.76k]
  ------------------
  790|      4|    return value;
  791|  5.93k|  char ch;
  792|  5.93k|  presult msg = 0;
  793|  80.5M|  while (!msg && p->curr_buf_pos < p->curr_buf_length) {
  ------------------
  |  Branch (793:10): [True: 80.5M, False: 2.12k]
  |  Branch (793:18): [True: 80.5M, False: 3.80k]
  ------------------
  794|  80.5M|    ch = p->curr_buf[p->curr_buf_pos++];
  795|  80.5M|    if (p->st == JV_PARSER_WAITING_FOR_RS) {
  ------------------
  |  Branch (795:9): [True: 1.04M, False: 79.4M]
  ------------------
  796|  1.04M|      if (ch == '\n') {
  ------------------
  |  Branch (796:11): [True: 201, False: 1.04M]
  ------------------
  797|    201|        p->line++;
  798|    201|        p->column = 0;
  799|  1.04M|      } else {
  800|  1.04M|        p->column++;
  801|  1.04M|      }
  802|  1.04M|      if (ch == '\036')
  ------------------
  |  Branch (802:11): [True: 132, False: 1.04M]
  ------------------
  803|    132|        p->st = JV_PARSER_NORMAL;
  804|  1.04M|      continue; // need to resync, wait for RS
  805|  1.04M|    }
  806|  79.4M|    msg = scan(p, ch, &value);
  807|  79.4M|  }
  808|  5.93k|  if (msg == OK) {
  ------------------
  |  Branch (808:7): [True: 1.60k, False: 4.33k]
  ------------------
  809|  1.60k|    return value;
  810|  4.33k|  } else if (msg) {
  ------------------
  |  Branch (810:14): [True: 526, False: 3.80k]
  ------------------
  811|    526|    jv_free(value);
  812|    526|    if (ch != '\036' && (p->flags & JV_PARSE_SEQ)) {
  ------------------
  |  Branch (812:9): [True: 447, False: 79]
  |  Branch (812:25): [True: 124, False: 323]
  ------------------
  813|       |      // Skip to the next RS
  814|    124|      p->st = JV_PARSER_WAITING_FOR_RS;
  815|    124|      value = make_error(p, "%s at line %d, column %d (need RS to resync)", msg, p->line, p->column);
  816|    124|      parser_reset(p);
  817|    124|      return value;
  818|    124|    }
  819|    402|    value = make_error(p, "%s at line %d, column %d", msg, p->line, p->column);
  820|    402|    parser_reset(p);
  821|    402|    if (!(p->flags & JV_PARSE_SEQ)) {
  ------------------
  |  Branch (821:9): [True: 323, False: 79]
  ------------------
  822|       |      // We're not parsing a JSON text sequence; throw this buffer away.
  823|       |      // XXX We should fail permanently here.
  824|    323|      p->curr_buf = 0;
  825|    323|      p->curr_buf_pos = 0;
  826|    323|    } // Else ch must be RS; don't clear buf so we can start parsing again after this ch
  827|    402|    return value;
  828|  3.80k|  } else if (p->curr_buf_is_partial) {
  ------------------
  |  Branch (828:14): [True: 0, False: 3.80k]
  ------------------
  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.80k|  } else {
  833|       |    // at EOF
  834|  3.80k|    p->eof = 1;
  835|  3.80k|    assert(p->curr_buf_pos == p->curr_buf_length);
  ------------------
  |  Branch (835:5): [True: 0, False: 3.80k]
  |  Branch (835:5): [True: 3.80k, False: 0]
  ------------------
  836|  3.80k|    jv_free(value);
  837|  3.80k|    if (p->st == JV_PARSER_WAITING_FOR_RS)
  ------------------
  |  Branch (837:9): [True: 98, False: 3.71k]
  ------------------
  838|     98|      return make_error(p, "Unfinished abandoned text at EOF at line %d, column %d", p->line, p->column);
  839|  3.71k|    if (p->st != JV_PARSER_NORMAL) {
  ------------------
  |  Branch (839:9): [True: 81, False: 3.62k]
  ------------------
  840|     81|      value = make_error(p, "Unfinished string at EOF at line %d, column %d", p->line, p->column);
  841|     81|      parser_reset(p);
  842|     81|      p->st = JV_PARSER_WAITING_FOR_RS;
  843|     81|      return value;
  844|     81|    }
  845|  3.62k|    if ((msg = check_literal(p))) {
  ------------------
  |  Branch (845:9): [True: 521, False: 3.10k]
  ------------------
  846|    521|      value = make_error(p, "%s at EOF at line %d, column %d", msg, p->line, p->column);
  847|    521|      parser_reset(p);
  848|    521|      p->st = JV_PARSER_WAITING_FOR_RS;
  849|    521|      return value;
  850|    521|    }
  851|  3.10k|    if (((p->flags & JV_PARSE_STREAMING) && p->stacklen != 0) ||
  ------------------
  |  Branch (851:10): [True: 849, False: 2.25k]
  |  Branch (851:45): [True: 288, False: 561]
  ------------------
  852|  2.82k|        (!(p->flags & JV_PARSE_STREAMING) && p->stackpos != 0)) {
  ------------------
  |  Branch (852:10): [True: 2.25k, False: 561]
  |  Branch (852:46): [True: 490, False: 1.76k]
  ------------------
  853|    778|      value = make_error(p, "Unfinished JSON term at EOF at line %d, column %d", p->line, p->column);
  854|    778|      parser_reset(p);
  855|    778|      p->st = JV_PARSER_WAITING_FOR_RS;
  856|    778|      return value;
  857|    778|    }
  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.33k|    if ((p->flags & JV_PARSE_STREAMING) && jv_is_valid(p->next)) {
  ------------------
  |  Branch (860:9): [True: 561, False: 1.76k]
  |  Branch (860:44): [True: 404, False: 157]
  ------------------
  861|    404|      value = JV_ARRAY(jv_copy(p->path), p->next); // except in streaming mode we've got to make it [path,value]
  ------------------
  |  |  111|    404|  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|    404|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    404|  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|    404|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    404|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  862|  1.92k|    } else {
  863|  1.92k|      value = p->next;
  864|  1.92k|    }
  865|  2.33k|    p->next = jv_invalid();
  866|  2.33k|    if ((p->flags & JV_PARSE_SEQ) && !p->last_ch_was_ws && jv_get_kind(value) == JV_KIND_NUMBER) {
  ------------------
  |  Branch (866:9): [True: 25, False: 2.30k]
  |  Branch (866:38): [True: 21, False: 4]
  |  Branch (866:60): [True: 1, False: 20]
  ------------------
  867|      1|      jv_free(value);
  868|      1|      return make_error(p, "Potentially truncated top-level numeric value at EOF at line %d, column %d", p->line, p->column);
  869|      1|    }
  870|  2.32k|    return value;
  871|  2.33k|  }
  872|  5.93k|}
jv_parse_sized_custom_flags:
  874|  4.33k|jv jv_parse_sized_custom_flags(const char* string, int length, int flags) {
  875|  4.33k|  struct jv_parser parser;
  876|  4.33k|  parser_init(&parser, flags);
  877|  4.33k|  jv_parser_set_buf(&parser, string, length, 0);
  878|  4.33k|  jv value = jv_parser_next(&parser);
  879|  4.33k|  if (jv_is_valid(value)) {
  ------------------
  |  Branch (879:7): [True: 3.11k, False: 1.21k]
  ------------------
  880|  3.11k|    jv next = jv_parser_next(&parser);
  881|  3.11k|    if (jv_is_valid(next)) {
  ------------------
  |  Branch (881:9): [True: 265, False: 2.85k]
  ------------------
  882|       |      // multiple JSON values, we only wanted one
  883|    265|      jv_free(value);
  884|    265|      jv_free(next);
  885|    265|      value = jv_invalid_with_msg(jv_string("Unexpected extra JSON values"));
  886|  2.85k|    } else if (jv_invalid_has_msg(jv_copy(next))) {
  ------------------
  |  Branch (886:16): [True: 334, False: 2.51k]
  ------------------
  887|       |      // parser error after the first JSON value
  888|    334|      jv_free(value);
  889|    334|      value = next;
  890|  2.51k|    } else {
  891|       |      // a single valid JSON value
  892|  2.51k|      jv_free(next);
  893|  2.51k|    }
  894|  3.11k|  } else if (jv_invalid_has_msg(jv_copy(value))) {
  ------------------
  |  Branch (894:14): [True: 1.15k, False: 62]
  ------------------
  895|       |    // parse error, we'll return it
  896|  1.15k|  } else {
  897|       |    // no value at all
  898|     62|    jv_free(value);
  899|     62|    value = jv_invalid_with_msg(jv_string("Expected JSON value"));
  900|     62|  }
  901|  4.33k|  parser_free(&parser);
  902|       |
  903|  4.33k|  if (!jv_is_valid(value) && jv_invalid_has_msg(jv_copy(value))) {
  ------------------
  |  Branch (903:7): [True: 1.81k, False: 2.51k]
  |  Branch (903:30): [True: 1.81k, False: 0]
  ------------------
  904|  1.81k|    jv msg = jv_invalid_get_msg(value);
  905|  1.81k|    value = jv_invalid_with_msg(jv_string_fmt("%s (while parsing '%.*s')",
  906|  1.81k|                                              jv_string_value(msg),
  907|  1.81k|                                              length,
  908|  1.81k|                                              string));
  909|  1.81k|    jv_free(msg);
  910|  1.81k|  }
  911|  4.33k|  return value;
  912|  4.33k|}
jv_parse_custom_flags:
  922|  4.33k|jv jv_parse_custom_flags(const char* string, int flags) {
  923|  4.33k|  return jv_parse_sized_custom_flags(string, strlen(string), flags);
  924|  4.33k|}
jv_parse.c:parser_init:
   70|  4.33k|static void parser_init(struct jv_parser* p, int flags) {
   71|  4.33k|  p->flags = flags;
   72|  4.33k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (72:7): [True: 1.31k, False: 3.01k]
  ------------------
   73|  1.31k|    p->path = jv_array();
   74|  3.01k|  } else {
   75|  3.01k|    p->path = jv_invalid();
   76|  3.01k|    p->flags &= ~(JV_PARSE_STREAM_ERRORS);
   77|  3.01k|  }
   78|  4.33k|  p->stack = 0;
   79|  4.33k|  p->stacklen = p->stackpos = 0;
   80|  4.33k|  p->last_seen = JV_LAST_NONE;
   81|  4.33k|  p->output = jv_invalid();
   82|  4.33k|  p->next = jv_invalid();
   83|  4.33k|  p->tokenlen = 256;
   84|  4.33k|  p->tokenbuf = jv_mem_alloc(p->tokenlen);
   85|  4.33k|  p->tokenpos = 0;
   86|  4.33k|  if ((p->flags & JV_PARSE_SEQ))
  ------------------
  |  Branch (86:7): [True: 317, False: 4.01k]
  ------------------
   87|    317|    p->st = JV_PARSER_WAITING_FOR_RS;
   88|  4.01k|  else
   89|  4.01k|    p->st = JV_PARSER_NORMAL;
   90|  4.33k|  p->eof = 0;
   91|  4.33k|  p->curr_buf = 0;
   92|  4.33k|  p->curr_buf_length = p->curr_buf_pos = p->curr_buf_is_partial = 0;
   93|  4.33k|  p->bom_strip_position = 0;
   94|  4.33k|  p->last_ch_was_ws = 0;
   95|  4.33k|  p->line = 1;
   96|  4.33k|  p->column = 0;
   97|  4.33k|  jvp_dtoa_context_init(&p->dtoa);
   98|  4.33k|}
jv_parse.c:parser_free:
  118|  4.33k|static void parser_free(struct jv_parser* p) {
  119|  4.33k|  parser_reset(p);
  120|  4.33k|  jv_free(p->path);
  121|  4.33k|  jv_free(p->output);
  122|  4.33k|  jv_mem_free(p->stack);
  123|  4.33k|  jv_mem_free(p->tokenbuf);
  124|  4.33k|  jvp_dtoa_context_free(&p->dtoa);
  125|  4.33k|}
jv_parse.c:parser_reset:
  100|  6.38k|static void parser_reset(struct jv_parser* p) {
  101|  6.38k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (101:7): [True: 2.14k, False: 4.23k]
  ------------------
  102|  2.14k|    jv_free(p->path);
  103|  2.14k|    p->path = jv_array();
  104|  2.14k|    p->stacklen = 0;
  105|  2.14k|  }
  106|  6.38k|  p->last_seen = JV_LAST_NONE;
  107|  6.38k|  jv_free(p->output);
  108|  6.38k|  p->output = jv_invalid();
  109|  6.38k|  jv_free(p->next);
  110|  6.38k|  p->next = jv_invalid();
  111|   376k|  for (int i=0; i<p->stackpos; i++)
  ------------------
  |  Branch (111:17): [True: 370k, False: 6.38k]
  ------------------
  112|   370k|    jv_free(p->stack[i]);
  113|  6.38k|  p->stackpos = 0;
  114|  6.38k|  p->tokenpos = 0;
  115|  6.38k|  p->st = JV_PARSER_NORMAL;
  116|  6.38k|}
jv_parse.c:stream_check_done:
  603|  61.9M|static int stream_check_done(struct jv_parser* p, jv* out) {
  604|  61.9M|  if (p->stacklen == 0 && jv_is_valid(p->next)) {
  ------------------
  |  Branch (604:7): [True: 28.0M, False: 33.8M]
  |  Branch (604:27): [True: 187, False: 28.0M]
  ------------------
  605|    187|    *out = JV_ARRAY(jv_copy(p->path),p->next);
  ------------------
  |  |  111|    187|  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|    187|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    187|  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|    187|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    187|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  606|    187|    p->next = jv_invalid();
  607|    187|    return 1;
  608|  61.9M|  } else if (jv_is_valid(p->output)) {
  ------------------
  |  Branch (608:14): [True: 242, False: 61.9M]
  ------------------
  609|    242|    if (jv_array_length(jv_copy(p->output)) > 2) {
  ------------------
  |  Branch (609:9): [True: 12, False: 230]
  ------------------
  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|    230|    } else {
  615|       |      // No further processing needed
  616|    230|      *out = p->output;
  617|    230|      p->output = jv_invalid();
  618|    230|    }
  619|    242|    return 1;
  620|  61.9M|  } else {
  621|  61.9M|    return 0;
  622|  61.9M|  }
  623|  61.9M|}
jv_parse.c:scan:
  654|  79.4M|static pfunc scan(struct jv_parser* p, char ch, jv* out) {
  655|  79.4M|  p->column++;
  656|  79.4M|  if (ch == '\n') {
  ------------------
  |  Branch (656:7): [True: 4.64k, False: 79.4M]
  ------------------
  657|  4.64k|    p->line++;
  658|  4.64k|    p->column = 0;
  659|  4.64k|  }
  660|  79.4M|  if ((p->flags & JV_PARSE_SEQ)
  ------------------
  |  Branch (660:7): [True: 5.19M, False: 74.2M]
  ------------------
  661|  5.19M|      && ch == '\036' /* ASCII RS; see draft-ietf-json-sequence-07 */) {
  ------------------
  |  Branch (661:10): [True: 104, False: 5.19M]
  ------------------
  662|    104|    if (check_truncation(p)) {
  ------------------
  |  |  649|    104|   (((p)->flags & JV_PARSE_STREAMING) ? stream_seq_check_truncation((p)) : seq_check_truncation((p)))
  |  |  ------------------
  |  |  |  Branch (649:4): [True: 64, False: 40]
  |  |  |  Branch (649:5): [True: 50, False: 54]
  |  |  ------------------
  ------------------
  663|     64|      if (check_literal(p) == 0 && is_top_num(p))
  ------------------
  |  |  652|     41|   (((p)->flags & JV_PARSE_STREAMING) ? stream_is_top_num((p)) : parse_is_top_num((p)))
  |  |  ------------------
  |  |  |  Branch (652:4): [True: 1, False: 40]
  |  |  |  Branch (652:5): [True: 23, False: 18]
  |  |  ------------------
  ------------------
  |  Branch (663:11): [True: 41, False: 23]
  ------------------
  664|      1|        return "Potentially truncated top-level numeric value";
  665|     63|      return "Truncated value";
  666|     64|    }
  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: 15, False: 25]
  |  |  |  Branch (18:74): [Folded, False: 25]
  |  |  ------------------
  ------------------
  668|     25|    if (p->st == JV_PARSER_NORMAL && check_done(p, out))
  ------------------
  |  |  643|     24|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 3, False: 21]
  |  |  |  Branch (643:5): [True: 6, False: 18]
  |  |  ------------------
  ------------------
  |  Branch (668:9): [True: 24, False: 1]
  ------------------
  669|      3|      return OK;
  670|       |    // shouldn't happen?
  671|     25|    assert(!jv_is_valid(*out));
  ------------------
  |  Branch (671:5): [True: 0, False: 22]
  |  Branch (671:5): [True: 22, False: 0]
  ------------------
  672|     22|    parser_reset(p);
  673|     22|    jv_free(*out);
  674|     22|    *out = jv_invalid();
  675|     22|    return OK;
  676|     22|  }
  677|  79.4M|  presult answer = 0;
  678|  79.4M|  p->last_ch_was_ws = 0;
  679|  79.4M|  if (p->st == JV_PARSER_NORMAL) {
  ------------------
  |  Branch (679:7): [True: 59.9M, False: 19.5M]
  ------------------
  680|  59.9M|    chclass cls = classify(ch);
  681|  59.9M|    if (cls == WHITESPACE)
  ------------------
  |  Branch (681:9): [True: 3.41k, False: 59.9M]
  ------------------
  682|  3.41k|      p->last_ch_was_ws = 1;
  683|  59.9M|    if (cls != LITERAL) {
  ------------------
  |  Branch (683:9): [True: 18.1M, False: 41.7M]
  ------------------
  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: 46, 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: 248, False: 18.1M]
  |  |  |  Branch (643:5): [True: 16.6M, False: 1.48M]
  |  |  ------------------
  ------------------
  686|  18.1M|    }
  687|  59.9M|    switch (cls) {
  ------------------
  |  Branch (687:13): [True: 59.9M, False: 0]
  ------------------
  688|  41.7M|    case LITERAL:
  ------------------
  |  Branch (688:5): [True: 41.7M, False: 18.1M]
  ------------------
  689|  41.7M|      TRY(tokenadd(p, ch));
  ------------------
  |  |   18|  41.7M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 0, False: 41.7M]
  |  |  |  Branch (18:74): [Folded, False: 41.7M]
  |  |  ------------------
  ------------------
  690|  41.7M|      break;
  691|  41.7M|    case WHITESPACE:
  ------------------
  |  Branch (691:5): [True: 3.41k, False: 59.9M]
  ------------------
  692|  3.41k|      break;
  693|  26.8k|    case QUOTE:
  ------------------
  |  Branch (693:5): [True: 26.8k, False: 59.9M]
  ------------------
  694|  26.8k|      p->st = JV_PARSER_STRING;
  695|  26.8k|      break;
  696|  18.1M|    case STRUCTURE:
  ------------------
  |  Branch (696:5): [True: 18.1M, False: 41.8M]
  ------------------
  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.45M]
  |  |  |  Branch (18:45): [True: 209, 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: 59.9M]
  ------------------
  700|      0|      return "Invalid character";
  701|  59.9M|    }
  702|  59.9M|    if (check_done(p, out)) answer = OK;
  ------------------
  |  |  643|  59.9M|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 995, False: 59.9M]
  |  |  |  Branch (643:5): [True: 45.2M, False: 14.6M]
  |  |  ------------------
  ------------------
  703|  59.9M|  } else {
  704|  19.5M|    if (ch == '"' && p->st == JV_PARSER_STRING) {
  ------------------
  |  Branch (704:9): [True: 27.2k, False: 19.5M]
  |  Branch (704:22): [True: 26.7k, False: 417]
  ------------------
  705|  26.7k|      TRY(found_string(p));
  ------------------
  |  |   18|  26.7k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 192, False: 26.5k]
  |  |  |  Branch (18:74): [Folded, False: 26.5k]
  |  |  ------------------
  ------------------
  706|  26.5k|      p->st = JV_PARSER_NORMAL;
  707|  26.5k|      if (check_done(p, out)) answer = OK;
  ------------------
  |  |  643|  26.5k|   (((p)->flags & JV_PARSE_STREAMING) ? stream_check_done((p), (o)) : parse_check_done((p), (o)))
  |  |  ------------------
  |  |  |  Branch (643:4): [True: 346, False: 26.2k]
  |  |  |  Branch (643:5): [True: 1.70k, False: 24.8k]
  |  |  ------------------
  ------------------
  708|  19.5M|    } else {
  709|  19.5M|      TRY(tokenadd(p, ch));
  ------------------
  |  |   18|  19.5M|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 0, False: 19.5M]
  |  |  |  Branch (18:74): [Folded, False: 19.5M]
  |  |  ------------------
  ------------------
  710|  19.5M|      if (ch == '\\' && p->st == JV_PARSER_STRING) {
  ------------------
  |  Branch (710:11): [True: 14.2k, False: 19.5M]
  |  Branch (710:25): [True: 12.0k, False: 2.14k]
  ------------------
  711|  12.0k|        p->st = JV_PARSER_STRING_ESCAPE;
  712|  19.5M|      } else {
  713|  19.5M|        p->st = JV_PARSER_STRING;
  714|  19.5M|      }
  715|  19.5M|    }
  716|  19.5M|  }
  717|  79.4M|  return answer;
  718|  79.4M|}
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: 28, False: 22]
  |  Branch (631:30): [True: 0, False: 22]
  |  Branch (631:53): [True: 0, False: 22]
  |  Branch (631:74): [True: 0, False: 22]
  |  Branch (631:96): [True: 0, False: 22]
  ------------------
  632|     50|}
jv_parse.c:seq_check_truncation:
  625|     54|static int seq_check_truncation(struct jv_parser* p) {
  626|     54|  return (!p->last_ch_was_ws && (p->stackpos > 0 || p->tokenpos > 0 || jv_get_kind(p->next) == JV_KIND_NUMBER));
  ------------------
  |  Branch (626:11): [True: 37, False: 17]
  |  Branch (626:34): [True: 15, False: 22]
  |  Branch (626:53): [True: 21, False: 1]
  |  Branch (626:72): [True: 0, False: 1]
  ------------------
  627|     54|}
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|     18|static int parse_is_top_num(struct jv_parser* p) {
  635|     18|  return (p->stackpos == 0 && jv_get_kind(p->next) == JV_KIND_NUMBER);
  ------------------
  |  Branch (635:11): [True: 3, False: 15]
  |  Branch (635:31): [True: 1, False: 2]
  ------------------
  636|     18|}
jv_parse.c:parse_check_done:
  593|  16.1M|static int parse_check_done(struct jv_parser* p, jv* out) {
  594|  16.1M|  if (p->stackpos == 0 && jv_is_valid(p->next)) {
  ------------------
  |  Branch (594:7): [True: 8.11M, False: 8.04M]
  |  Branch (594:27): [True: 1.16k, False: 8.11M]
  ------------------
  595|  1.16k|    *out = p->next;
  596|  1.16k|    p->next = jv_invalid();
  597|  1.16k|    return 1;
  598|  16.1M|  } else {
  599|  16.1M|    return 0;
  600|  16.1M|  }
  601|  16.1M|}
jv_parse.c:classify:
  564|  59.9M|static chclass classify(char c) {
  565|  59.9M|  switch (c) {
  566|      0|  case '\0':
  ------------------
  |  Branch (566:3): [True: 0, False: 59.9M]
  ------------------
  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|    260|  case ' ':
  ------------------
  |  Branch (571:3): [True: 260, False: 59.9M]
  ------------------
  572|    498|  case '\t':
  ------------------
  |  Branch (572:3): [True: 238, False: 59.9M]
  ------------------
  573|    735|  case '\r':
  ------------------
  |  Branch (573:3): [True: 237, False: 59.9M]
  ------------------
  574|  3.41k|  case '\n':
  ------------------
  |  Branch (574:3): [True: 2.68k, False: 59.9M]
  ------------------
  575|  3.41k|    return WHITESPACE;
  576|  26.8k|  case '"':
  ------------------
  |  Branch (576:3): [True: 26.8k, False: 59.9M]
  ------------------
  577|  26.8k|    return QUOTE;
  578|  17.1M|  case '[':
  ------------------
  |  Branch (578:3): [True: 17.1M, False: 42.8M]
  ------------------
  579|  17.8M|  case ',':
  ------------------
  |  Branch (579:3): [True: 760k, False: 59.1M]
  ------------------
  580|  18.0M|  case ']':
  ------------------
  |  Branch (580:3): [True: 142k, False: 59.7M]
  ------------------
  581|  18.0M|  case '{':
  ------------------
  |  Branch (581:3): [True: 94.0k, False: 59.8M]
  ------------------
  582|  18.1M|  case ':':
  ------------------
  |  Branch (582:3): [True: 25.1k, False: 59.9M]
  ------------------
  583|  18.1M|  case '}':
  ------------------
  |  Branch (583:3): [True: 10.3k, False: 59.9M]
  ------------------
  584|  18.1M|    return STRUCTURE;
  585|  41.7M|  default:
  ------------------
  |  Branch (585:3): [True: 41.7M, False: 18.1M]
  ------------------
  586|  41.7M|    return LITERAL;
  587|  59.9M|  }
  588|  59.9M|}
jv_parse.c:tokenadd:
  423|  61.2M|static pfunc tokenadd(struct jv_parser* p, char c) {
  424|  61.2M|  assert(p->tokenpos <= p->tokenlen);
  ------------------
  |  Branch (424:3): [True: 0, False: 61.2M]
  |  Branch (424:3): [True: 61.2M, False: 0]
  ------------------
  425|  61.2M|  if (p->tokenpos >= (p->tokenlen - 1)) {
  ------------------
  |  Branch (425:7): [True: 2.64k, False: 61.2M]
  ------------------
  426|  2.64k|    if (p->tokenlen > INT_MAX / 2)
  ------------------
  |  Branch (426:9): [True: 0, False: 2.64k]
  ------------------
  427|      0|      return "Token too long";
  428|  2.64k|    p->tokenlen *= 2;
  429|  2.64k|    p->tokenbuf = jv_mem_realloc(p->tokenbuf, p->tokenlen);
  430|  2.64k|  }
  431|  61.2M|  assert(p->tokenpos < p->tokenlen);
  ------------------
  |  Branch (431:3): [True: 0, False: 61.2M]
  |  Branch (431:3): [True: 61.2M, False: 0]
  ------------------
  432|  61.2M|  p->tokenbuf[p->tokenpos++] = c;
  433|  61.2M|  return 0;
  434|  61.2M|}
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.39k]
  ------------------
  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: 5, False: 16.6M]
  ------------------
  252|       |      // Looks like {["foo"]}
  253|      5|      return "Expected string key after '{', not '['";
  254|  16.6M|    if (p->last_seen == JV_LAST_COMMA) {
  ------------------
  |  Branch (254:9): [True: 9, False: 16.6M]
  ------------------
  255|      9|      last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  256|      9|      k = jv_get_kind(last);
  257|      9|      jv_free(last);
  258|      9|      if (k != JV_KIND_NUMBER)
  ------------------
  |  Branch (258:11): [True: 1, False: 8]
  ------------------
  259|       |        // Looks like {"x":"y",["foo"]}
  260|      1|        return "Expected string key after ',' in object, not '['";
  261|      9|    }
  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|    502|  case '{':
  ------------------
  |  Branch (267:3): [True: 502, False: 16.6M]
  ------------------
  268|    502|    if (p->last_seen == JV_LAST_VALUE)
  ------------------
  |  Branch (268:9): [True: 3, False: 499]
  ------------------
  269|      3|      return "Expected a separator between values";
  270|    499|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (270:9): [True: 3, False: 496]
  ------------------
  271|       |      // Looks like {{"foo":"bar"}}
  272|      3|      return "Expected string key after '{', not '{'";
  273|    496|    if (p->last_seen == JV_LAST_COMMA) {
  ------------------
  |  Branch (273:9): [True: 3, False: 493]
  ------------------
  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|    495|    p->path = jv_array_append(p->path, jv_null()); // push
  283|    495|    p->last_seen = JV_LAST_OPEN_OBJECT;
  284|    495|    p->stacklen++;
  285|    495|    break;
  286|       |
  287|  1.57k|  case ':':
  ------------------
  |  Branch (287:3): [True: 1.57k, False: 16.6M]
  ------------------
  288|  1.57k|    last = jv_invalid();
  289|  1.57k|    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: 8, False: 1.56k]
  |  Branch (289:29): [True: 10, False: 1.55k]
  ------------------
  290|     18|      jv_free(last);
  291|     18|      return "':' not as part of an object";
  292|     18|    }
  293|  1.55k|    jv_free(last);
  294|  1.55k|    if (!jv_is_valid(p->next) || p->last_seen == JV_LAST_NONE)
  ------------------
  |  Branch (294:9): [True: 17, False: 1.54k]
  |  Branch (294:34): [True: 0, False: 1.54k]
  ------------------
  295|     17|      return "Expected string key before ':'";
  296|  1.54k|    if (jv_get_kind(p->next) != JV_KIND_STRING)
  ------------------
  |  Branch (296:9): [True: 7, False: 1.53k]
  ------------------
  297|      7|      return "Object keys must be strings";
  298|  1.53k|    if (p->last_seen != JV_LAST_VALUE)
  ------------------
  |  Branch (298:9): [True: 0, False: 1.53k]
  ------------------
  299|      0|      return "':' should follow a key";
  300|  1.53k|    p->last_seen = JV_LAST_COLON;
  301|  1.53k|    p->path = jv_array_set(p->path, p->stacklen - 1, p->next);
  302|  1.53k|    p->next = jv_invalid();
  303|  1.53k|    break;
  304|       |
  305|    106|  case ',':
  ------------------
  |  Branch (305:3): [True: 106, False: 16.6M]
  ------------------
  306|    106|    if (p->last_seen != JV_LAST_VALUE)
  ------------------
  |  Branch (306:9): [True: 15, False: 91]
  ------------------
  307|     15|      return "Expected value before ','";
  308|     91|    if (p->stacklen == 0)
  ------------------
  |  Branch (308:9): [True: 0, False: 91]
  ------------------
  309|      0|      return "',' not as part of an object or array";
  310|     91|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  311|     91|    k = jv_get_kind(last);
  312|     91|    if (k == JV_KIND_NUMBER) {
  ------------------
  |  Branch (312:9): [True: 64, False: 27]
  ------------------
  313|     64|      int idx = jv_number_value(last);
  314|       |
  315|     64|      if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (315:11): [True: 47, False: 17]
  ------------------
  316|     47|        p->output = JV_ARRAY(jv_copy(p->path), p->next);
  ------------------
  |  |  111|     47|  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|     47|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     47|  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|     47|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     47|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  317|     47|        p->next = jv_invalid();
  318|     47|      }
  319|     64|      p->path = jv_array_set(p->path, p->stacklen - 1, jv_number(idx + 1));
  320|     64|      p->last_seen = JV_LAST_COMMA;
  321|     64|    } else if (k == JV_KIND_STRING) {
  ------------------
  |  Branch (321:16): [True: 24, False: 3]
  ------------------
  322|     24|      if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (322:11): [True: 10, False: 14]
  ------------------
  323|     10|        p->output = JV_ARRAY(jv_copy(p->path), p->next);
  ------------------
  |  |  111|     10|  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|     10|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     10|  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|     10|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     10|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  324|     10|        p->next = jv_invalid();
  325|     10|      }
  326|     24|      p->path = jv_array_set(p->path, p->stacklen - 1, jv_null()); // ready for another key:value pair
  327|     24|      p->last_seen = JV_LAST_COMMA;
  328|     24|    } 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|     88|    jv_free(last);
  336|     88|    break;
  337|       |
  338|    109|  case ']':
  ------------------
  |  Branch (338:3): [True: 109, False: 16.6M]
  ------------------
  339|    109|    if (p->stacklen == 0)
  ------------------
  |  Branch (339:9): [True: 6, False: 103]
  ------------------
  340|      6|      return "Unmatched ']' at the top-level";
  341|    103|    if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (341:9): [True: 1, False: 102]
  ------------------
  342|      1|      return "Expected another array element";
  343|    102|    if (p->last_seen == JV_LAST_OPEN_ARRAY)
  ------------------
  |  Branch (343:9): [True: 85, False: 17]
  ------------------
  344|    102|      assert(!jv_is_valid(p->next));
  ------------------
  |  Branch (344:7): [True: 0, False: 85]
  |  Branch (344:7): [True: 85, False: 0]
  ------------------
  345|       |
  346|    102|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  347|    102|    k = jv_get_kind(last);
  348|    102|    jv_free(last);
  349|       |
  350|    102|    if (k != JV_KIND_NUMBER)
  ------------------
  |  Branch (350:9): [True: 5, False: 97]
  ------------------
  351|      5|      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: 3, False: 85]
  ------------------
  356|      3|      p->output = JV_ARRAY(jv_copy(p->path));
  ------------------
  |  |  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__)
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  100|      3|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  357|      3|    }
  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: 85, False: 12]
  ------------------
  365|     85|      p->output = JV_ARRAY(jv_copy(p->path), jv_array()); // Empty arrays are leaves
  ------------------
  |  |  111|     85|  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|     85|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     85|  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|     85|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     85|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  366|       |
  367|     97|    if (p->stacklen == 0)
  ------------------
  |  Branch (367:9): [True: 11, False: 86]
  ------------------
  368|     11|      p->last_seen = JV_LAST_NONE;
  369|     86|    else
  370|     86|      p->last_seen = JV_LAST_VALUE;
  371|     97|    break;
  372|       |
  373|    105|  case '}':
  ------------------
  |  Branch (373:3): [True: 105, False: 16.6M]
  ------------------
  374|    105|    if (p->stacklen == 0)
  ------------------
  |  Branch (374:9): [True: 8, False: 97]
  ------------------
  375|      8|      return "Unmatched '}' at the top-level";
  376|     97|    if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (376:9): [True: 1, False: 96]
  ------------------
  377|      1|      return "Expected another key:value pair";
  378|     96|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (378:9): [True: 80, False: 16]
  ------------------
  379|     96|      assert(!jv_is_valid(p->next));
  ------------------
  |  Branch (379:7): [True: 0, False: 80]
  |  Branch (379:7): [True: 80, False: 0]
  ------------------
  380|       |
  381|     96|    last = jv_array_get(jv_copy(p->path), p->stacklen - 1);
  382|     96|    k = jv_get_kind(last);
  383|     96|    jv_free(last);
  384|     96|    if (k == JV_KIND_NUMBER)
  ------------------
  |  Branch (384:9): [True: 5, False: 91]
  ------------------
  385|      5|      return "Unmatched '}' in the middle of an array";
  386|       |
  387|     91|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (387:9): [True: 7, False: 84]
  ------------------
  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|     84|    } else {
  393|       |      // Perhaps {"a":[]}
  394|     84|      if (p->last_seen == JV_LAST_COLON)
  ------------------
  |  Branch (394:11): [True: 3, False: 81]
  ------------------
  395|       |        // Looks like {"a":}
  396|      3|        return "Missing value in key:value pair";
  397|     81|      if (p->last_seen == JV_LAST_COMMA)
  ------------------
  |  Branch (397:11): [True: 0, False: 81]
  ------------------
  398|       |        // Looks like {"a":0,}
  399|      0|        return "Expected another key-value pair";
  400|     81|      if (p->last_seen == JV_LAST_OPEN_ARRAY)
  ------------------
  |  Branch (400:11): [True: 0, False: 81]
  ------------------
  401|      0|        return "Unmatched '}' in the middle of an array";
  402|     81|      if (p->last_seen != JV_LAST_VALUE && p->last_seen != JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (402:11): [True: 80, False: 1]
  |  Branch (402:44): [True: 0, False: 80]
  ------------------
  403|      0|        return "Unmatched '}'";
  404|     81|      if (p->last_seen != JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (404:11): [True: 1, False: 80]
  ------------------
  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|     81|    }
  407|     84|    p->path = jv_array_slice(p->path, 0, --(p->stacklen)); // pop
  408|     84|    jv_free(p->next);
  409|     84|    p->next = jv_invalid();
  410|       |
  411|     84|    if (p->last_seen == JV_LAST_OPEN_OBJECT)
  ------------------
  |  Branch (411:9): [True: 80, False: 4]
  ------------------
  412|     80|      p->output = JV_ARRAY(jv_copy(p->path), jv_object()); // Empty arrays are leaves
  ------------------
  |  |  111|     80|  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|     80|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|     80|  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|     80|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|     80|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  413|       |
  414|     84|    if (p->stacklen == 0)
  ------------------
  |  Branch (414:9): [True: 14, False: 70]
  ------------------
  415|     14|      p->last_seen = JV_LAST_NONE;
  416|     70|    else
  417|     70|      p->last_seen = JV_LAST_VALUE;
  418|     84|    break;
  419|  16.6M|  }
  420|  16.6M|  return 0;
  421|  16.6M|}
jv_parse.c:parse_token:
  158|  1.45M|static pfunc parse_token(struct jv_parser* p, char ch) {
  159|  1.45M|  switch (ch) {
  ------------------
  |  Branch (159:11): [True: 1.45M, False: 0]
  ------------------
  160|   428k|  case '[':
  ------------------
  |  Branch (160:3): [True: 428k, False: 1.03M]
  ------------------
  161|   428k|    if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing";
  ------------------
  |  |   15|   428k|#define MAX_PARSING_DEPTH (10000)
  ------------------
  |  Branch (161:9): [True: 1, False: 428k]
  ------------------
  162|   428k|    if (jv_is_valid(p->next)) return "Expected separator between values";
  ------------------
  |  Branch (162:9): [True: 12, False: 428k]
  ------------------
  163|   428k|    push(p, jv_array());
  164|   428k|    break;
  165|       |
  166|  93.4k|  case '{':
  ------------------
  |  Branch (166:3): [True: 93.4k, False: 1.36M]
  ------------------
  167|  93.4k|    if (p->stackpos >= MAX_PARSING_DEPTH) return "Exceeds depth limit for parsing";
  ------------------
  |  |   15|  93.4k|#define MAX_PARSING_DEPTH (10000)
  ------------------
  |  Branch (167:9): [True: 1, False: 93.4k]
  ------------------
  168|  93.4k|    if (jv_is_valid(p->next)) return "Expected separator between values";
  ------------------
  |  Branch (168:9): [True: 3, False: 93.4k]
  ------------------
  169|  93.4k|    push(p, jv_object());
  170|  93.4k|    break;
  171|       |
  172|  23.5k|  case ':':
  ------------------
  |  Branch (172:3): [True: 23.5k, False: 1.43M]
  ------------------
  173|  23.5k|    if (!jv_is_valid(p->next))
  ------------------
  |  Branch (173:9): [True: 15, False: 23.5k]
  ------------------
  174|     15|      return "Expected string key before ':'";
  175|  23.5k|    if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT)
  ------------------
  |  Branch (175:9): [True: 0, False: 23.5k]
  |  Branch (175:29): [True: 4, False: 23.5k]
  ------------------
  176|      4|      return "':' not as part of an object";
  177|  23.5k|    if (jv_get_kind(p->next) != JV_KIND_STRING)
  ------------------
  |  Branch (177:9): [True: 8, False: 23.4k]
  ------------------
  178|      8|      return "Object keys must be strings";
  179|  23.4k|    push(p, p->next);
  180|  23.4k|    p->next = jv_invalid();
  181|  23.4k|    break;
  182|       |
  183|   760k|  case ',':
  ------------------
  |  Branch (183:3): [True: 760k, False: 698k]
  ------------------
  184|   760k|    if (!jv_is_valid(p->next))
  ------------------
  |  Branch (184:9): [True: 13, False: 760k]
  ------------------
  185|     13|      return "Expected value before ','";
  186|   760k|    if (p->stackpos == 0)
  ------------------
  |  Branch (186:9): [True: 0, False: 760k]
  ------------------
  187|      0|      return "',' not as part of an object or array";
  188|   760k|    if (jv_get_kind(p->stack[p->stackpos-1]) == JV_KIND_ARRAY) {
  ------------------
  |  Branch (188:9): [True: 740k, False: 20.2k]
  ------------------
  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: 20.2k, False: 2]
  ------------------
  192|  20.2k|      assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT);
  ------------------
  |  Branch (192:7): [True: 0, False: 20.2k]
  |  Branch (192:7): [True: 0, False: 0]
  |  Branch (192:7): [True: 20.2k, False: 0]
  |  Branch (192:7): [True: 20.2k, False: 0]
  ------------------
  193|  20.2k|      p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2],
  194|  20.2k|                                              p->stack[p->stackpos-1], p->next);
  195|  20.2k|      p->stackpos--;
  196|  20.2k|      p->next = jv_invalid();
  197|  20.2k|    } else {
  198|       |      // this case hits on input like {"a", "b"}
  199|      2|      return "Objects must consist of key:value pairs";
  200|      2|    }
  201|   760k|    break;
  202|       |
  203|   760k|  case ']':
  ------------------
  |  Branch (203:3): [True: 142k, False: 1.31M]
  ------------------
  204|   142k|    if (p->stackpos == 0 || jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_ARRAY)
  ------------------
  |  Branch (204:9): [True: 7, False: 142k]
  |  Branch (204:29): [True: 3, False: 142k]
  ------------------
  205|     10|      return "Unmatched ']'";
  206|   142k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (206:9): [True: 142k, False: 454]
  ------------------
  207|   142k|      p->stack[p->stackpos-1] = jv_array_append(p->stack[p->stackpos-1], p->next);
  208|   142k|      p->next = jv_invalid();
  209|   142k|    } else {
  210|    454|      if (jv_array_length(jv_copy(p->stack[p->stackpos-1])) != 0) {
  ------------------
  |  Branch (210:11): [True: 1, False: 453]
  ------------------
  211|       |        // this case hits on input like [1,2,3,]
  212|      1|        return "Expected another array element";
  213|      1|      }
  214|    454|    }
  215|   142k|    jv_free(p->next);
  216|   142k|    p->next = p->stack[--p->stackpos];
  217|   142k|    break;
  218|       |
  219|  10.2k|  case '}':
  ------------------
  |  Branch (219:3): [True: 10.2k, False: 1.44M]
  ------------------
  220|  10.2k|    if (p->stackpos == 0)
  ------------------
  |  Branch (220:9): [True: 6, False: 10.2k]
  ------------------
  221|      6|      return "Unmatched '}'";
  222|  10.2k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (222:9): [True: 1.60k, False: 8.60k]
  ------------------
  223|  1.60k|      if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_STRING)
  ------------------
  |  Branch (223:11): [True: 13, False: 1.59k]
  ------------------
  224|     13|        return "Objects must consist of key:value pairs";
  225|  1.60k|      assert(p->stackpos > 1 && jv_get_kind(p->stack[p->stackpos-2]) == JV_KIND_OBJECT);
  ------------------
  |  Branch (225:7): [True: 0, False: 1.59k]
  |  Branch (225:7): [True: 0, False: 0]
  |  Branch (225:7): [True: 1.59k, False: 0]
  |  Branch (225:7): [True: 1.59k, False: 0]
  ------------------
  226|  1.59k|      p->stack[p->stackpos-2] = jv_object_set(p->stack[p->stackpos-2],
  227|  1.59k|                                              p->stack[p->stackpos-1], p->next);
  228|  1.59k|      p->stackpos--;
  229|  1.59k|      p->next = jv_invalid();
  230|  8.60k|    } else {
  231|  8.60k|      if (jv_get_kind(p->stack[p->stackpos-1]) != JV_KIND_OBJECT)
  ------------------
  |  Branch (231:11): [True: 6, False: 8.59k]
  ------------------
  232|      6|        return "Unmatched '}'";
  233|  8.59k|      if (jv_object_length(jv_copy(p->stack[p->stackpos-1])) != 0)
  ------------------
  |  Branch (233:11): [True: 1, False: 8.59k]
  ------------------
  234|      1|        return "Expected another key-value pair";
  235|  8.59k|    }
  236|  10.1k|    jv_free(p->next);
  237|  10.1k|    p->next = p->stack[--p->stackpos];
  238|  10.1k|    break;
  239|  1.45M|  }
  240|  1.45M|  return 0;
  241|  1.45M|}
jv_parse.c:push:
  148|   545k|static void push(struct jv_parser* p, jv v) {
  149|   545k|  assert(p->stackpos <= p->stacklen);
  ------------------
  |  Branch (149:3): [True: 0, False: 545k]
  |  Branch (149:3): [True: 545k, False: 0]
  ------------------
  150|   545k|  if (p->stackpos == p->stacklen) {
  ------------------
  |  Branch (150:7): [True: 2.89k, False: 542k]
  ------------------
  151|  2.89k|    p->stacklen = p->stacklen * 2 + 10;
  152|  2.89k|    p->stack = jv_mem_realloc(p->stack, p->stacklen * sizeof(jv));
  153|  2.89k|  }
  154|   545k|  assert(p->stackpos < p->stacklen);
  ------------------
  |  Branch (154:3): [True: 0, False: 545k]
  |  Branch (154:3): [True: 545k, False: 0]
  ------------------
  155|   545k|  p->stack[p->stackpos++] = v;
  156|   545k|}
jv_parse.c:found_string:
  451|  26.7k|static pfunc found_string(struct jv_parser* p) {
  452|  26.7k|  char* in = p->tokenbuf;
  453|  26.7k|  char* out = p->tokenbuf;
  454|  26.7k|  char* end = p->tokenbuf + p->tokenpos;
  455|       |
  456|  10.5M|  while (in < end) {
  ------------------
  |  Branch (456:10): [True: 10.5M, False: 26.6k]
  ------------------
  457|  10.5M|    char c = *in++;
  458|  10.5M|    if (c == '\\') {
  ------------------
  |  Branch (458:9): [True: 8.31k, False: 10.5M]
  ------------------
  459|  8.31k|      if (in >= end)
  ------------------
  |  Branch (459:11): [True: 0, False: 8.31k]
  ------------------
  460|      0|        return "Expected escape character at end of string";
  461|  8.31k|      c = *in++;
  462|  8.31k|      switch (c) {
  463|  1.81k|      case '\\':
  ------------------
  |  Branch (463:7): [True: 1.81k, False: 6.50k]
  ------------------
  464|  2.03k|      case '"':
  ------------------
  |  Branch (464:7): [True: 215, False: 8.10k]
  ------------------
  465|  2.43k|      case '/': *out++ = c;    break;
  ------------------
  |  Branch (465:7): [True: 399, False: 7.92k]
  ------------------
  466|    635|      case 'b': *out++ = '\b'; break;
  ------------------
  |  Branch (466:7): [True: 635, False: 7.68k]
  ------------------
  467|    727|      case 'f': *out++ = '\f'; break;
  ------------------
  |  Branch (467:7): [True: 727, False: 7.59k]
  ------------------
  468|    516|      case 't': *out++ = '\t'; break;
  ------------------
  |  Branch (468:7): [True: 516, False: 7.80k]
  ------------------
  469|    262|      case 'n': *out++ = '\n'; break;
  ------------------
  |  Branch (469:7): [True: 262, False: 8.05k]
  ------------------
  470|    475|      case 'r': *out++ = '\r'; break;
  ------------------
  |  Branch (470:7): [True: 475, False: 7.84k]
  ------------------
  471|       |
  472|  3.26k|      case 'u':
  ------------------
  |  Branch (472:7): [True: 3.26k, False: 5.05k]
  ------------------
  473|       |        /* ahh, the complicated case */
  474|  3.26k|        if (in + 4 > end)
  ------------------
  |  Branch (474:13): [True: 3, False: 3.26k]
  ------------------
  475|      3|          return "Invalid \\uXXXX escape";
  476|  3.26k|        int hexvalue = unhex4(in);
  477|  3.26k|        if (hexvalue < 0)
  ------------------
  |  Branch (477:13): [True: 28, False: 3.23k]
  ------------------
  478|     28|          return "Invalid characters in \\uXXXX escape";
  479|  3.23k|        unsigned long codepoint = (unsigned long)hexvalue;
  480|  3.23k|        in += 4;
  481|  3.23k|        if (0xD800 <= codepoint && codepoint <= 0xDBFF) {
  ------------------
  |  Branch (481:13): [True: 1.71k, False: 1.52k]
  |  Branch (481:36): [True: 494, False: 1.21k]
  ------------------
  482|       |          /* who thought UTF-16 surrogate pairs were a good idea? */
  483|    494|          if (in + 6 > end || in[0] != '\\' || in[1] != 'u')
  ------------------
  |  Branch (483:15): [True: 15, False: 479]
  |  Branch (483:31): [True: 9, False: 470]
  |  Branch (483:48): [True: 14, False: 456]
  ------------------
  484|     38|            return "Invalid \\uXXXX\\uXXXX surrogate pair escape";
  485|    456|          unsigned long surrogate = unhex4(in+2);
  486|    456|          if (!(0xDC00 <= surrogate && surrogate <= 0xDFFF))
  ------------------
  |  Branch (486:17): [True: 433, False: 23]
  |  Branch (486:40): [True: 407, False: 26]
  ------------------
  487|     49|            return "Invalid \\uXXXX\\uXXXX surrogate pair escape";
  488|    407|          in += 6;
  489|    407|          codepoint = 0x10000 + (((codepoint - 0xD800) << 10)
  490|    407|                                 |(surrogate - 0xDC00));
  491|    407|        }
  492|  3.15k|        if (codepoint > 0x10FFFF)
  ------------------
  |  Branch (492:13): [True: 0, False: 3.15k]
  ------------------
  493|      0|          codepoint = 0xFFFD; // U+FFFD REPLACEMENT CHARACTER
  494|  3.15k|        out += jvp_utf8_encode(codepoint, out);
  495|  3.15k|        break;
  496|       |
  497|      4|      default:
  ------------------
  |  Branch (497:7): [True: 4, False: 8.31k]
  ------------------
  498|      4|        return "Invalid escape";
  499|  8.31k|      }
  500|  10.5M|    } else {
  501|  10.5M|      if (!(c & ~0x1F))
  ------------------
  |  Branch (501:11): [True: 50, False: 10.5M]
  ------------------
  502|     50|        return "Invalid string: control characters from U+0000 through U+001F must be escaped";
  503|  10.5M|      *out++ = c;
  504|  10.5M|    }
  505|  10.5M|  }
  506|  26.6k|  TRY(value(p, jv_string_sized(p->tokenbuf, out - p->tokenbuf)));
  ------------------
  |  |   18|  26.6k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 20, False: 26.5k]
  |  |  |  Branch (18:74): [Folded, False: 26.5k]
  |  |  ------------------
  ------------------
  507|  26.5k|  p->tokenpos = 0;
  508|  26.5k|  return 0;
  509|  26.6k|}
jv_parse.c:unhex4:
  436|  3.72k|static int unhex4(char* hex) {
  437|  3.72k|  int r = 0;
  438|  18.4k|  for (int i=0; i<4; i++) {
  ------------------
  |  Branch (438:17): [True: 14.7k, False: 3.67k]
  ------------------
  439|  14.7k|    char c = *hex++;
  440|  14.7k|    int n;
  441|  14.7k|    if ('0' <= c && c <= '9') n = c - '0';
  ------------------
  |  Branch (441:9): [True: 14.7k, False: 26]
  |  Branch (441:21): [True: 7.46k, False: 7.30k]
  ------------------
  442|  7.33k|    else if ('a' <= c && c <= 'f') n = c - 'a' + 10;
  ------------------
  |  Branch (442:14): [True: 4.16k, False: 3.16k]
  |  Branch (442:26): [True: 4.15k, False: 13]
  ------------------
  443|  3.17k|    else if ('A' <= c && c <= 'F') n = c - 'A' + 10;
  ------------------
  |  Branch (443:14): [True: 3.14k, False: 31]
  |  Branch (443:26): [True: 3.12k, False: 19]
  ------------------
  444|     50|    else return -1;
  445|  14.7k|    r <<= 4;
  446|  14.7k|    r |= n;
  447|  14.7k|  }
  448|  3.67k|  return r;
  449|  3.72k|}
jv_parse.c:value:
  127|   779k|static pfunc value(struct jv_parser* p, jv val) {
  128|   779k|  if ((p->flags & JV_PARSE_STREAMING)) {
  ------------------
  |  Branch (128:7): [True: 2.29k, False: 777k]
  ------------------
  129|  2.29k|    if (jv_is_valid(p->next) || p->last_seen == JV_LAST_VALUE) {
  ------------------
  |  Branch (129:9): [True: 19, False: 2.27k]
  |  Branch (129:33): [True: 3, False: 2.26k]
  ------------------
  130|     22|      jv_free(val);
  131|     22|      return "Expected separator between values";
  132|     22|    }
  133|  2.26k|    if (p->stacklen > 0)
  ------------------
  |  Branch (133:9): [True: 1.67k, False: 591]
  ------------------
  134|  1.67k|      p->last_seen = JV_LAST_VALUE;
  135|    591|    else
  136|    591|      p->last_seen = JV_LAST_NONE;
  137|   777k|  } else {
  138|   777k|    if (jv_is_valid(p->next)) {
  ------------------
  |  Branch (138:9): [True: 15, False: 777k]
  ------------------
  139|     15|      jv_free(val);
  140|     15|      return "Expected separator between values";
  141|     15|    }
  142|   777k|  }
  143|   779k|  jv_free(p->next);
  144|   779k|  p->next = val;
  145|   779k|  return 0;
  146|   779k|}
jv_parse.c:make_error:
  767|  2.00k|static jv make_error(struct jv_parser* p, const char *fmt, ...) {
  768|  2.00k|  va_list ap;
  769|  2.00k|  va_start(ap, fmt);
  770|  2.00k|  jv e = jv_string_vfmt(fmt, ap);
  771|  2.00k|  va_end(ap);
  772|  2.00k|  if ((p->flags & JV_PARSE_STREAM_ERRORS))
  ------------------
  |  Branch (772:7): [True: 529, False: 1.47k]
  ------------------
  773|    529|    return JV_ARRAY(e, jv_copy(p->path));
  ------------------
  |  |  111|    529|  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|    529|#define JV_ARRAY_IDX(_1,_2,_3,_4,_5,_6,_7,_8,_9,NAME,...) NAME
  |  |  |  |  ------------------
  |  |  |  |  |  |  111|    529|  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|    529|#define JV_ARRAY_2(e1,e2) (jv_array_append(JV_ARRAY_1(e1),e2))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |  |  |  100|    529|#define JV_ARRAY_1(e) (jv_array_append(jv_array(),e))
  |  |  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  774|  1.47k|  return jv_invalid_with_msg(e);
  775|  2.00k|}
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: 753k]
  ------------------
  513|       |
  514|   753k|  const char* pattern = 0;
  515|   753k|  int plen;
  516|   753k|  jv v;
  517|   753k|  switch (p->tokenbuf[0]) {
  ------------------
  |  Branch (517:11): [True: 6.30k, False: 747k]
  ------------------
  518|    292|  case 't': pattern = "true"; plen = 4; v = jv_true(); break;
  ------------------
  |  Branch (518:3): [True: 292, False: 753k]
  ------------------
  519|  5.20k|  case 'f': pattern = "false"; plen = 5; v = jv_false(); break;
  ------------------
  |  Branch (519:3): [True: 5.20k, False: 748k]
  ------------------
  520|      8|  case '\'':
  ------------------
  |  Branch (520:3): [True: 8, False: 753k]
  ------------------
  521|      8|    return "Invalid string literal; expected \", but got '";
  522|    804|  case 'n':
  ------------------
  |  Branch (522:3): [True: 804, False: 752k]
  ------------------
  523|       |    // if it starts with 'n', it could be a literal "nan"
  524|    804|    if (p->tokenpos > 1 && p->tokenbuf[1] == 'u') {
  ------------------
  |  Branch (524:9): [True: 798, False: 6]
  |  Branch (524:28): [True: 264, False: 534]
  ------------------
  525|    264|      pattern = "null"; plen = 4; v = jv_null();
  526|    264|    }
  527|   753k|  }
  528|   753k|  if (pattern) {
  ------------------
  |  Branch (528:7): [True: 5.75k, False: 747k]
  ------------------
  529|  5.75k|    if (p->tokenpos != plen) return "Invalid literal";
  ------------------
  |  Branch (529:9): [True: 54, False: 5.70k]
  ------------------
  530|  33.6k|    for (int i=0; i<plen; i++)
  ------------------
  |  Branch (530:19): [True: 27.9k, False: 5.68k]
  ------------------
  531|  27.9k|      if (p->tokenbuf[i] != pattern[i])
  ------------------
  |  Branch (531:11): [True: 13, False: 27.9k]
  ------------------
  532|     13|        return "Invalid literal";
  533|  5.68k|    TRY(value(p, v));
  ------------------
  |  |   18|  5.68k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 3, False: 5.68k]
  |  |  |  Branch (18:74): [Folded, False: 5.68k]
  |  |  ------------------
  ------------------
  534|   747k|  } else {
  535|       |    // FIXME: better parser
  536|   747k|    p->tokenbuf[p->tokenpos] = 0;
  537|   747k|#ifdef USE_DECNUM
  538|   747k|    jv number = jv_number_with_literal(p->tokenbuf);
  539|   747k|    if (jv_get_kind(number) == JV_KIND_INVALID) {
  ------------------
  |  Branch (539:9): [True: 513, False: 747k]
  ------------------
  540|    513|      return "Invalid numeric literal";
  541|    513|    }
  542|   747k|    TRY(value(p, number));
  ------------------
  |  |   18|   747k|#define TRY(x) do {presult msg__ = (x); if (msg__) return msg__; } while(0)
  |  |  ------------------
  |  |  |  Branch (18:45): [True: 14, False: 747k]
  |  |  |  Branch (18:74): [Folded, False: 747k]
  |  |  ------------------
  ------------------
  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|   747k|  }
  552|   752k|  p->tokenpos = 0;
  553|   752k|  return 0;
  554|   753k|}

jv_dumpf:
  389|  2.51k|void jv_dumpf(jv x, FILE *f, int flags) {
  390|  2.51k|  jv_dump_term(tsd_dtoa_context_get(), x, flags, 0, f, 0);
  391|  2.51k|}
jv_dump:
  393|  2.51k|void jv_dump(jv x, int flags) {
  394|       |  jv_dumpf(x, stdout, flags);
  395|  2.51k|}
jv_print.c:jv_dump_term:
  219|  7.14M|static void jv_dump_term(struct dtoa_context* C, jv x, int flags, int indent, FILE* F, jv* S) {
  220|  7.14M|  char buf[JVP_DTOA_FMT_MAX_LEN];
  221|  7.14M|  const char* color = 0;
  222|  7.14M|  double refcnt = (flags & JV_PRINT_REFCOUNT) ? jv_get_refcnt(x) - 1 : -1;
  ------------------
  |  Branch (222:19): [True: 1.94M, False: 5.19M]
  ------------------
  223|  7.14M|  if ((flags & JV_PRINT_COLOR) && jv_get_kind(x) != JV_KIND_INVALID) {
  ------------------
  |  Branch (223:7): [True: 1.95M, False: 5.18M]
  |  Branch (223:35): [True: 1.95M, False: 0]
  ------------------
  224|  1.95M|    color = colors[(int)jv_get_kind(x) - 1];
  225|  1.95M|    put_str(color, F, S, flags & JV_PRINT_ISATTY);
  226|  1.95M|  }
  227|  7.14M|  if (indent > MAX_PRINT_DEPTH) {
  ------------------
  |  |   21|  7.14M|#define MAX_PRINT_DEPTH (10000)
  ------------------
  |  Branch (227:7): [True: 0, False: 7.14M]
  ------------------
  228|      0|    put_str("<skipped: too deep>", F, S, flags & JV_PRINT_ISATTY);
  229|  7.14M|  } else switch (jv_get_kind(x)) {
  230|      0|  default:
  ------------------
  |  Branch (230:3): [True: 0, False: 7.14M]
  ------------------
  231|      0|  case JV_KIND_INVALID:
  ------------------
  |  Branch (231:3): [True: 0, False: 7.14M]
  ------------------
  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|    291|  case JV_KIND_NULL:
  ------------------
  |  Branch (245:3): [True: 291, False: 7.14M]
  ------------------
  246|    291|    put_str("null", F, S, flags & JV_PRINT_ISATTY);
  247|    291|    break;
  248|    517|  case JV_KIND_FALSE:
  ------------------
  |  Branch (248:3): [True: 517, False: 7.14M]
  ------------------
  249|    517|    put_str("false", F, S, flags & JV_PRINT_ISATTY);
  250|    517|    break;
  251|    196|  case JV_KIND_TRUE:
  ------------------
  |  Branch (251:3): [True: 196, False: 7.14M]
  ------------------
  252|    196|    put_str("true", F, S, flags & JV_PRINT_ISATTY);
  253|    196|    break;
  254|  7.00M|  case JV_KIND_NUMBER: {
  ------------------
  |  Branch (254:3): [True: 7.00M, False: 148k]
  ------------------
  255|  7.00M|    if (jvp_number_is_nan(x)) {
  ------------------
  |  Branch (255:9): [True: 273, False: 7.00M]
  ------------------
  256|    273|      jv_dump_term(C, jv_null(), flags, indent, F, S);
  257|  7.00M|    } else {
  258|  7.00M|#ifdef USE_DECNUM
  259|  7.00M|      const char * literal_data = jv_number_get_literal(x);
  260|  7.00M|      if (literal_data) {
  ------------------
  |  Branch (260:11): [True: 9.03k, False: 6.99M]
  ------------------
  261|  9.03k|        put_str(literal_data, F, S, flags & JV_PRINT_ISATTY);
  262|  6.99M|      } else {
  263|  6.99M|#endif
  264|  6.99M|        double d = jv_number_value(x);
  265|  6.99M|        if (d != d) {
  ------------------
  |  Branch (265:13): [True: 0, False: 6.99M]
  ------------------
  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|  6.99M|        } else {
  269|       |          // Normalise infinities to something we can print in valid JSON
  270|  6.99M|          if (d > DBL_MAX) d = DBL_MAX;
  ------------------
  |  Branch (270:15): [True: 4.96k, False: 6.98M]
  ------------------
  271|  6.99M|          if (d < -DBL_MAX) d = -DBL_MAX;
  ------------------
  |  Branch (271:15): [True: 194, False: 6.99M]
  ------------------
  272|  6.99M|          put_str(jvp_dtoa_fmt(C, buf, d), F, S, flags & JV_PRINT_ISATTY);
  273|  6.99M|        }
  274|  6.99M|      }
  275|  7.00M|#ifdef USE_DECNUM
  276|  7.00M|    }
  277|  7.00M|#endif
  278|  7.00M|    break;
  279|      0|  }
  280|  1.25k|  case JV_KIND_STRING:
  ------------------
  |  Branch (280:3): [True: 1.25k, False: 7.14M]
  ------------------
  281|  1.25k|    jvp_dump_string(x, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
  282|  1.25k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (282:9): [True: 610, False: 640]
  ------------------
  283|    610|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  284|  1.25k|    break;
  285|   143k|  case JV_KIND_ARRAY: {
  ------------------
  |  Branch (285:3): [True: 143k, False: 7.00M]
  ------------------
  286|   143k|    if (jv_array_length(jv_copy(x)) == 0) {
  ------------------
  |  Branch (286:9): [True: 881, False: 143k]
  ------------------
  287|    881|      put_str("[]", F, S, flags & JV_PRINT_ISATTY);
  288|    881|      break;
  289|    881|    }
  290|   143k|    put_char('[', F, S, flags & JV_PRINT_ISATTY);
  291|  7.14M|    jv_array_foreach(x, i, elem) {
  ------------------
  |  |   93|   143k|  for (int jv_len__ = jv_array_length(jv_copy(a)), i=0, jv_j__ = 1;     \
  |  |   94|   286k|       jv_j__; jv_j__ = 0)                                              \
  |  |  ------------------
  |  |  |  Branch (94:8): [True: 143k, False: 143k]
  |  |  ------------------
  |  |   95|   143k|    for (jv x;                                                          \
  |  |   96|  7.28M|         i < jv_len__ ?                                                 \
  |  |  ------------------
  |  |  |  Branch (96:10): [True: 7.14M, False: 143k]
  |  |  |  Branch (96:10): [True: 7.14M, False: 143k]
  |  |  ------------------
  |  |   97|  7.28M|           (x = jv_array_get(jv_copy(a), i), 1) : 0;                    \
  |  |   98|  7.14M|         i++)
  ------------------
  292|  7.14M|      if (i!=0) {
  ------------------
  |  Branch (292:11): [True: 6.99M, False: 143k]
  ------------------
  293|  6.99M|        if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (293:13): [True: 1.91M, False: 5.08M]
  ------------------
  294|  6.99M|        put_char(',', F, S, flags & JV_PRINT_ISATTY);
  295|  6.99M|      }
  296|  7.14M|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  1.95M|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  1.95M|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (296:11): [True: 1.95M, False: 5.18M]
  ------------------
  297|  7.14M|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (297:11): [True: 5.89M, False: 1.24M]
  ------------------
  298|  5.89M|        put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  299|  5.89M|        put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY);
  300|  5.89M|      }
  301|  7.14M|      jv_dump_term(C, elem, flags, indent + 1, F, S);
  302|  7.14M|    }
  303|   143k|    if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (303:9): [True: 125k, False: 17.8k]
  ------------------
  304|   125k|      put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  305|   125k|      put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY);
  306|   125k|    }
  307|   143k|    if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (307:9): [True: 38.1k, False: 104k]
  ------------------
  308|   143k|    put_char(']', F, S, flags & JV_PRINT_ISATTY);
  309|   143k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (309:9): [True: 25.8k, False: 117k]
  ------------------
  310|  25.8k|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  311|   143k|    break;
  312|   143k|  }
  313|  2.11k|  case JV_KIND_OBJECT: {
  ------------------
  |  Branch (313:3): [True: 2.11k, False: 7.14M]
  ------------------
  314|  2.11k|    if (jv_object_length(jv_copy(x)) == 0) {
  ------------------
  |  Branch (314:9): [True: 673, False: 1.44k]
  ------------------
  315|    673|      put_str("{}", F, S, flags & JV_PRINT_ISATTY);
  316|    673|      break;
  317|    673|    }
  318|  1.44k|    put_char('{', F, S, flags & JV_PRINT_ISATTY);
  319|  1.44k|    int first = 1;
  320|  1.44k|    int i = 0;
  321|  1.44k|    jv keyset = jv_null();
  322|  7.42k|    while (1) {
  ------------------
  |  Branch (322:12): [True: 7.42k, Folded]
  ------------------
  323|  7.42k|      jv key, value;
  324|  7.42k|      if (flags & JV_PRINT_SORTED) {
  ------------------
  |  Branch (324:11): [True: 5.69k, False: 1.73k]
  ------------------
  325|  5.69k|        if (first) {
  ------------------
  |  Branch (325:13): [True: 806, False: 4.88k]
  ------------------
  326|    806|          keyset = jv_keys(jv_copy(x));
  327|    806|          i = 0;
  328|  4.88k|        } else {
  329|  4.88k|          i++;
  330|  4.88k|        }
  331|  5.69k|        if (i >= jv_array_length(jv_copy(keyset))) {
  ------------------
  |  Branch (331:13): [True: 806, False: 4.88k]
  ------------------
  332|    806|          jv_free(keyset);
  333|    806|          break;
  334|    806|        }
  335|  4.88k|        key = jv_array_get(jv_copy(keyset), i);
  336|  4.88k|        value = jv_object_get(jv_copy(x), jv_copy(key));
  337|  4.88k|      } else {
  338|  1.73k|        if (first) {
  ------------------
  |  Branch (338:13): [True: 639, False: 1.09k]
  ------------------
  339|    639|          i = jv_object_iter(x);
  340|  1.09k|        } else {
  341|  1.09k|          i = jv_object_iter_next(x, i);
  342|  1.09k|        }
  343|  1.73k|        if (!jv_object_iter_valid(x, i)) break;
  ------------------
  |  Branch (343:13): [True: 639, False: 1.09k]
  ------------------
  344|  1.09k|        key = jv_object_iter_key(x, i);
  345|  1.09k|        value = jv_object_iter_value(x, i);
  346|  1.09k|      }
  347|       |
  348|  5.98k|      if (!first) {
  ------------------
  |  Branch (348:11): [True: 4.53k, False: 1.44k]
  ------------------
  349|  4.53k|        if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (349:13): [True: 3.24k, False: 1.29k]
  ------------------
  350|  4.53k|        put_char(',', F, S, flags & JV_PRINT_ISATTY);
  351|  4.53k|      }
  352|  5.98k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  3.94k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  3.94k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (352:11): [True: 3.94k, False: 2.03k]
  ------------------
  353|  5.98k|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (353:11): [True: 3.44k, False: 2.53k]
  ------------------
  354|  3.44k|        put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  355|  3.44k|        put_indent(indent + 1, flags, F, S, flags & JV_PRINT_ISATTY);
  356|  3.44k|      }
  357|       |
  358|  5.98k|      first = 0;
  359|  5.98k|      if (color) put_str(FIELD_COLOR, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   37|  3.94k|#define FIELD_COLOR (colors[7])
  ------------------
  |  Branch (359:11): [True: 3.94k, False: 2.03k]
  ------------------
  360|  5.98k|      jvp_dump_string(key, flags & JV_PRINT_ASCII, F, S, flags & JV_PRINT_ISATTY);
  361|  5.98k|      jv_free(key);
  362|  5.98k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  3.94k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  3.94k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (362:11): [True: 3.94k, False: 2.03k]
  ------------------
  363|       |
  364|  5.98k|      if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (364:11): [True: 3.94k, False: 2.03k]
  ------------------
  365|  5.98k|      put_char(':', F, S, flags & JV_PRINT_ISATTY);
  366|  5.98k|      if (color) put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  3.94k|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  3.94k|#define ESC "\033"
  |  |  ------------------
  ------------------
  |  Branch (366:11): [True: 3.94k, False: 2.03k]
  ------------------
  367|  5.98k|      if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (367:11): [True: 3.44k, False: 2.53k]
  ------------------
  368|  3.44k|        put_char(' ', F, S, flags & JV_PRINT_ISATTY);
  369|  3.44k|      }
  370|       |
  371|  5.98k|      jv_dump_term(C, value, flags, indent + 1, F, S);
  372|  5.98k|    }
  373|  1.44k|    if (flags & JV_PRINT_PRETTY) {
  ------------------
  |  Branch (373:9): [True: 747, False: 698]
  ------------------
  374|    747|      put_char('\n', F, S, flags & JV_PRINT_ISATTY);
  375|    747|      put_indent(indent, flags, F, S, flags & JV_PRINT_ISATTY);
  376|    747|    }
  377|  1.44k|    if (color) put_str(color, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  Branch (377:9): [True: 702, False: 743]
  ------------------
  378|  1.44k|    put_char('}', F, S, flags & JV_PRINT_ISATTY);
  379|  1.44k|    if (flags & JV_PRINT_REFCOUNT)
  ------------------
  |  Branch (379:9): [True: 820, False: 625]
  ------------------
  380|    820|      put_refcnt(C, refcnt, F, S, flags & JV_PRINT_ISATTY);
  381|  1.44k|  }
  382|  7.14M|  }
  383|  7.14M|  jv_free(x);
  384|  7.14M|  if (color) {
  ------------------
  |  Branch (384:7): [True: 1.95M, False: 5.18M]
  ------------------
  385|  1.95M|    put_str(COLRESET, F, S, flags & JV_PRINT_ISATTY);
  ------------------
  |  |   26|  1.95M|#define COLRESET (ESC "[0m")
  |  |  ------------------
  |  |  |  |   24|  1.95M|#define ESC "\033"
  |  |  ------------------
  ------------------
  386|  1.95M|  }
  387|  7.14M|}
jv_print.c:put_str:
  129|  17.6M|static void put_str(const char* s, FILE* fout, jv* strout, int T) {
  130|  17.6M|  put_buf(s, strlen(s), fout, strout, T);
  131|  17.6M|}
jv_print.c:put_buf:
   98|  1.04G|static void put_buf(const char *s, int len, FILE *fout, jv *strout, int is_tty) {
   99|  1.04G|  if (strout) {
  ------------------
  |  Branch (99:7): [True: 0, False: 1.04G]
  ------------------
  100|      0|    *strout = jv_string_append_buf(*strout, s, len);
  101|  1.04G|  } 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.04G|  fwrite(s, 1, len, fout);
  121|  1.04G|#endif
  122|  1.04G|  }
  123|  1.04G|}
jv_print.c:jvp_dump_string:
  144|  7.23k|static void jvp_dump_string(jv str, int ascii_only, FILE* F, jv* S, int T) {
  145|  7.23k|  assert(jv_get_kind(str) == JV_KIND_STRING);
  ------------------
  |  Branch (145:3): [True: 0, False: 7.23k]
  |  Branch (145:3): [True: 7.23k, False: 0]
  ------------------
  146|  7.23k|  const char* i = jv_string_value(str);
  147|  7.23k|  const char* end = i + jv_string_length_bytes(jv_copy(str));
  148|  7.23k|  const char* cstart;
  149|  7.23k|  int c = 0;
  150|  7.23k|  char buf[32];
  151|  7.23k|  put_char('"', F, S, T);
  152|  6.46M|  while ((i = jvp_utf8_next((cstart = i), end, &c))) {
  ------------------
  |  Branch (152:10): [True: 6.45M, False: 7.23k]
  ------------------
  153|  6.45M|    assert(c != -1);
  ------------------
  |  Branch (153:5): [True: 0, False: 6.45M]
  |  Branch (153:5): [True: 6.45M, False: 0]
  ------------------
  154|  6.45M|    int unicode_escape = 0;
  155|  6.45M|    if (0x20 <= c && c <= 0x7E) {
  ------------------
  |  Branch (155:9): [True: 6.45M, False: 1.67k]
  |  Branch (155:22): [True: 778k, False: 5.67M]
  ------------------
  156|       |      // printable ASCII
  157|   778k|      if (c == '"' || c == '\\') {
  ------------------
  |  Branch (157:11): [True: 211, False: 778k]
  |  Branch (157:23): [True: 1.09k, False: 776k]
  ------------------
  158|  1.30k|        put_char('\\', F, S, T);
  159|  1.30k|      }
  160|   778k|      put_char(c, F, S, T);
  161|  5.67M|    } else if (c < 0x20 || c == 0x7F) {
  ------------------
  |  Branch (161:16): [True: 1.67k, False: 5.67M]
  |  Branch (161:28): [True: 391, False: 5.67M]
  ------------------
  162|       |      // ASCII control character
  163|  2.06k|      switch (c) {
  164|    249|      case '\b':
  ------------------
  |  Branch (164:7): [True: 249, False: 1.81k]
  ------------------
  165|    249|        put_char('\\', F, S, T);
  166|    249|        put_char('b', F, S, T);
  167|    249|        break;
  168|    194|      case '\t':
  ------------------
  |  Branch (168:7): [True: 194, False: 1.87k]
  ------------------
  169|    194|        put_char('\\', F, S, T);
  170|    194|        put_char('t', F, S, T);
  171|    194|        break;
  172|    270|      case '\r':
  ------------------
  |  Branch (172:7): [True: 270, False: 1.79k]
  ------------------
  173|    270|        put_char('\\', F, S, T);
  174|    270|        put_char('r', F, S, T);
  175|    270|        break;
  176|    222|      case '\n':
  ------------------
  |  Branch (176:7): [True: 222, False: 1.84k]
  ------------------
  177|    222|        put_char('\\', F, S, T);
  178|    222|        put_char('n', F, S, T);
  179|    222|        break;
  180|    425|      case '\f':
  ------------------
  |  Branch (180:7): [True: 425, False: 1.64k]
  ------------------
  181|    425|        put_char('\\', F, S, T);
  182|    425|        put_char('f', F, S, T);
  183|    425|        break;
  184|    708|      default:
  ------------------
  |  Branch (184:7): [True: 708, False: 1.36k]
  ------------------
  185|    708|        unicode_escape = 1;
  186|    708|        break;
  187|  2.06k|      }
  188|  5.67M|    } else {
  189|  5.67M|      if (ascii_only) {
  ------------------
  |  Branch (189:11): [True: 2.79M, False: 2.87M]
  ------------------
  190|  2.79M|        unicode_escape = 1;
  191|  2.87M|      } else {
  192|  2.87M|        put_buf(cstart, i - cstart, F, S, T);
  193|  2.87M|      }
  194|  5.67M|    }
  195|  6.45M|    if (unicode_escape) {
  ------------------
  |  Branch (195:9): [True: 2.79M, False: 3.65M]
  ------------------
  196|  2.79M|      if (c <= 0xffff) {
  ------------------
  |  Branch (196:11): [True: 2.79M, False: 515]
  ------------------
  197|  2.79M|        snprintf(buf, sizeof(buf), "\\u%04x", c);
  198|  2.79M|      } else {
  199|    515|        c -= 0x10000;
  200|    515|        snprintf(buf, sizeof(buf), "\\u%04x\\u%04x",
  201|    515|                0xD800 | ((c & 0xffc00) >> 10),
  202|    515|                0xDC00 | (c & 0x003ff));
  203|    515|      }
  204|  2.79M|      put_str(buf, F, S, T);
  205|  2.79M|    }
  206|  6.45M|  }
  207|  7.23k|  assert(c != -1);
  ------------------
  |  Branch (207:3): [True: 0, False: 7.23k]
  |  Branch (207:3): [True: 7.23k, False: 0]
  ------------------
  208|  7.23k|  put_char('"', F, S, T);
  209|  7.23k|}
jv_print.c:put_char:
  125|  1.02G|static void put_char(char c, FILE* fout, jv* strout, int T) {
  126|  1.02G|  put_buf(&c, 1, fout, strout, T);
  127|  1.02G|}
jv_print.c:put_refcnt:
  211|  27.2k|static void put_refcnt(struct dtoa_context* C, int refcnt, FILE *F, jv* S, int T){
  212|  27.2k|  char buf[JVP_DTOA_FMT_MAX_LEN];
  213|  27.2k|  put_char(' ', F, S, T);
  214|  27.2k|  put_char('(', F, S, T);
  215|  27.2k|  put_str(jvp_dtoa_fmt(C, buf, refcnt), F, S, T);
  216|  27.2k|  put_char(')', F, S, T);
  217|  27.2k|}
jv_print.c:put_indent:
  133|  6.02M|static void put_indent(int n, int flags, FILE* fout, jv* strout, int T) {
  134|  6.02M|  if (flags & JV_PRINT_TAB) {
  ------------------
  |  Branch (134:7): [True: 5.10M, False: 920k]
  ------------------
  135|   494M|    while (n--)
  ------------------
  |  Branch (135:12): [True: 489M, False: 5.10M]
  ------------------
  136|   489M|      put_char('\t', fout, strout, T);
  137|  5.10M|  } else {
  138|   920k|    n *= ((flags & (JV_PRINT_SPACE0 | JV_PRINT_SPACE1 | JV_PRINT_SPACE2)) >> 8);
  139|   521M|    while (n--)
  ------------------
  |  Branch (139:12): [True: 520M, False: 920k]
  ------------------
  140|   520M|      put_char(' ', fout, strout, T);
  141|   920k|  }
  142|  6.02M|}

jvp_utf8_next:
   30|  59.2M|const char* jvp_utf8_next(const char* in, const char* end, int* codepoint_ret) {
   31|  59.2M|  assert(in <= end);
  ------------------
  |  Branch (31:3): [True: 0, False: 59.2M]
  |  Branch (31:3): [True: 59.2M, False: 0]
  ------------------
   32|  59.2M|  if (in == end) {
  ------------------
  |  Branch (32:7): [True: 38.0k, False: 59.1M]
  ------------------
   33|  38.0k|    return 0;
   34|  38.0k|  }
   35|  59.1M|  int codepoint = -1;
   36|  59.1M|  unsigned char first = (unsigned char)in[0];
   37|  59.1M|  int length = utf8_coding_length[first];
   38|  59.1M|  if ((first & 0x80) == 0) {
  ------------------
  |  Branch (38:7): [True: 31.0M, False: 28.1M]
  ------------------
   39|       |    /* Fast-path for ASCII */
   40|  31.0M|    codepoint = first;
   41|  31.0M|    length = 1;
   42|  31.0M|  } else if (length == 0 || length == UTF8_CONTINUATION_BYTE) {
  ------------------
  |  |    1|  24.8M|#define UTF8_CONTINUATION_BYTE ((unsigned char)255)
  ------------------
  |  Branch (42:14): [True: 3.33M, False: 24.8M]
  |  Branch (42:29): [True: 18.3M, False: 6.48M]
  ------------------
   43|       |    /* Bad single byte - either an invalid byte or an out-of-place continuation byte */
   44|  21.7M|    length = 1;
   45|  21.7M|  } else if (length > end - in) {
  ------------------
  |  Branch (45:14): [True: 1.78k, False: 6.47M]
  ------------------
   46|       |    /* String ends before UTF8 sequence ends */
   47|  1.78k|    length = end - in;
   48|  6.47M|  } else {
   49|  6.47M|    codepoint = ((unsigned)in[0]) & utf8_coding_bits[first];
   50|  17.8M|    for (int i=1; i<length; i++) {
  ------------------
  |  Branch (50:19): [True: 12.1M, False: 5.70M]
  ------------------
   51|  12.1M|      unsigned ch = (unsigned char)in[i];
   52|  12.1M|      if (utf8_coding_length[ch] != UTF8_CONTINUATION_BYTE){
  ------------------
  |  |    1|  12.1M|#define UTF8_CONTINUATION_BYTE ((unsigned char)255)
  ------------------
  |  Branch (52:11): [True: 776k, False: 11.4M]
  ------------------
   53|       |        /* Invalid UTF8 sequence - not followed by the right number of continuation bytes */
   54|   776k|        codepoint = -1;
   55|   776k|        length = i;
   56|   776k|        break;
   57|   776k|      }
   58|  11.4M|      codepoint = (codepoint << 6) | (ch & 0x3f);
   59|  11.4M|    }
   60|  6.47M|    if (codepoint < utf8_first_codepoint[length]) {
  ------------------
  |  Branch (60:9): [True: 776k, False: 5.70M]
  ------------------
   61|       |      /* Overlong UTF8 sequence */
   62|   776k|      codepoint = -1;
   63|   776k|    }
   64|  6.47M|    if (0xD800 <= codepoint && codepoint <= 0xDFFF) {
  ------------------
  |  Branch (64:9): [True: 5.68M, False: 789k]
  |  Branch (64:32): [True: 1.18k, False: 5.68M]
  ------------------
   65|       |      /* Surrogate codepoints can't be encoded in UTF8 */
   66|  1.18k|      codepoint = -1;
   67|  1.18k|    }
   68|  6.47M|    if (codepoint > 0x10FFFF) {
  ------------------
  |  Branch (68:9): [True: 208, False: 6.47M]
  ------------------
   69|       |      /* Outside Unicode range */
   70|    208|      codepoint = -1;
   71|    208|    }
   72|  6.47M|  }
   73|  59.1M|  assert(length > 0);
  ------------------
  |  Branch (73:3): [True: 0, False: 59.1M]
  |  Branch (73:3): [True: 59.1M, False: 0]
  ------------------
   74|  59.1M|  *codepoint_ret = codepoint;
   75|  59.1M|  return in + length;
   76|  59.1M|}
jvp_utf8_is_valid:
   78|  30.7k|int jvp_utf8_is_valid(const char* in, const char* end) {
   79|  30.7k|  int codepoint;
   80|  18.7M|  while ((in = jvp_utf8_next(in, end, &codepoint))) {
  ------------------
  |  Branch (80:10): [True: 18.7M, False: 20.9k]
  ------------------
   81|  18.7M|    if (codepoint == -1) return 0;
  ------------------
  |  Branch (81:9): [True: 9.84k, False: 18.7M]
  ------------------
   82|  18.7M|  }
   83|  20.9k|  return 1;
   84|  30.7k|}
jvp_utf8_encode_length:
   94|  33.9M|int jvp_utf8_encode_length(int codepoint) {
   95|  33.9M|  if (codepoint <= 0x7F) return 1;
  ------------------
  |  Branch (95:7): [True: 11.4M, False: 22.5M]
  ------------------
   96|  22.5M|  else if (codepoint <= 0x7FF) return 2;
  ------------------
  |  Branch (96:12): [True: 11.9k, False: 22.4M]
  ------------------
   97|  22.4M|  else if (codepoint <= 0xFFFF) return 3;
  ------------------
  |  Branch (97:12): [True: 22.4M, False: 2.73k]
  ------------------
   98|  2.73k|  else return 4;
   99|  33.9M|}
jvp_utf8_encode:
  101|  33.9M|int jvp_utf8_encode(int codepoint, char* out) {
  102|  33.9M|  assert(codepoint >= 0 && codepoint <= 0x10FFFF);
  ------------------
  |  Branch (102:3): [True: 0, False: 33.9M]
  |  Branch (102:3): [True: 0, False: 0]
  |  Branch (102:3): [True: 33.9M, False: 0]
  |  Branch (102:3): [True: 33.9M, False: 0]
  ------------------
  103|  33.9M|  char* start = out;
  104|  33.9M|  if (codepoint <= 0x7F) {
  ------------------
  |  Branch (104:7): [True: 11.4M, False: 22.5M]
  ------------------
  105|  11.4M|    *out++ = codepoint;
  106|  22.5M|  } else if (codepoint <= 0x7FF) {
  ------------------
  |  Branch (106:14): [True: 11.9k, False: 22.4M]
  ------------------
  107|  11.9k|    *out++ = 0xC0 + ((codepoint & 0x7C0) >> 6);
  108|  11.9k|    *out++ = 0x80 + ((codepoint & 0x03F));
  109|  22.4M|  } else if(codepoint <= 0xFFFF) {
  ------------------
  |  Branch (109:13): [True: 22.4M, False: 2.73k]
  ------------------
  110|  22.4M|    *out++ = 0xE0 + ((codepoint & 0xF000) >> 12);
  111|  22.4M|    *out++ = 0x80 + ((codepoint & 0x0FC0) >> 6);
  112|  22.4M|    *out++ = 0x80 + ((codepoint & 0x003F));
  113|  22.4M|  } else {
  114|  2.73k|    *out++ = 0xF0 + ((codepoint & 0x1C0000) >> 18);
  115|  2.73k|    *out++ = 0x80 + ((codepoint & 0x03F000) >> 12);
  116|  2.73k|    *out++ = 0x80 + ((codepoint & 0x000FC0) >> 6);
  117|  2.73k|    *out++ = 0x80 + ((codepoint & 0x00003F));
  118|  2.73k|  }
  119|  33.9M|  assert(out - start == jvp_utf8_encode_length(codepoint));
  ------------------
  |  Branch (119:3): [True: 0, False: 33.9M]
  |  Branch (119:3): [True: 33.9M, False: 0]
  ------------------
  120|  33.9M|  return out - start;
  121|  33.9M|}

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

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

decNumberToString:
  448|  14.1k|char * decNumberToString(const decNumber *dn, char *string){
  449|  14.1k|  decToString(dn, string, 0);
  450|  14.1k|  return string;
  451|  14.1k|  } // DecNumberToString
decNumberFromString:
  479|   747k|                                decContext *set) {
  480|   747k|  Int   exponent=0;                // working exponent [assume 0]
  ------------------
  |  |   92|   747k|  #define Int    int32_t
  ------------------
  481|   747k|  uByte bits=0;                    // working flags [assume +ve]
  ------------------
  |  |   89|   747k|  #define uByte  uint8_t
  ------------------
  482|   747k|  Unit  *res;                      // where result will be built
  ------------------
  |  |   94|   747k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   747k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  483|   747k|  Unit  resbuff[SD2U(DECBUFFER+9)];// local buffer in case need temporary
  ------------------
  |  |   94|   747k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   747k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  484|       |                                   // [+9 allows for ln() constants]
  485|   747k|  Unit  *allocres=NULL;            // -> allocated result, iff allocated
  ------------------
  |  |   94|   747k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   747k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  486|   747k|  Int   d=0;                       // count of digits found in decimal part
  ------------------
  |  |   92|   747k|  #define Int    int32_t
  ------------------
  487|   747k|  const char *dotchar=NULL;        // where dot was found
  488|   747k|  const char *cfirst=chars;        // -> first character of decimal part
  489|   747k|  const char *last=NULL;           // -> last digit of decimal part
  490|   747k|  const char *c;                   // work
  491|   747k|  Unit  *up;                       // ..
  ------------------
  |  |   94|   747k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|   747k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
  492|   747k|  #if DECDPUN>1
  493|   747k|  Int   cut, out;                  // ..
  ------------------
  |  |   92|   747k|  #define Int    int32_t
  ------------------
  494|   747k|  #endif
  495|   747k|  Int   residue;                   // rounding residue
  ------------------
  |  |   92|   747k|  #define Int    int32_t
  ------------------
  496|   747k|  uInt  status=0;                  // error code
  ------------------
  |  |   93|   747k|  #define uInt   uint32_t
  ------------------
  497|       |
  498|       |  #if DECCHECK
  499|       |  if (decCheckOperands(DECUNRESU, DECUNUSED, DECUNUSED, set))
  500|       |    return decNumberZero(dn);
  501|       |  #endif
  502|       |
  503|   747k|  do {                             // status & malloc protection
  504|  33.6M|    for (c=chars;; c++) {          // -> input character
  505|  33.6M|      if (*c>='0' && *c<='9') {    // test for Arabic digit
  ------------------
  |  Branch (505:11): [True: 32.9M, False: 717k]
  |  Branch (505:22): [True: 32.9M, False: 34.7k]
  ------------------
  506|  32.9M|        last=c;
  507|  32.9M|        d++;                       // count of real digits
  508|  32.9M|        continue;                  // still in decimal part
  509|  32.9M|        }
  510|   752k|      if (*c=='.' && dotchar==NULL) { // first '.'
  ------------------
  |  Branch (510:11): [True: 2.38k, False: 749k]
  |  Branch (510:22): [True: 2.38k, False: 3]
  ------------------
  511|  2.38k|        dotchar=c;                 // record offset into decimal part
  512|  2.38k|        if (c==cfirst) cfirst++;   // first digit must follow
  ------------------
  |  Branch (512:13): [True: 664, False: 1.71k]
  ------------------
  513|  2.38k|        continue;}
  514|   749k|      if (c==chars) {              // first in string...
  ------------------
  |  Branch (514:11): [True: 8.82k, False: 740k]
  ------------------
  515|  8.82k|        if (*c=='-') {             // valid - sign
  ------------------
  |  Branch (515:13): [True: 1.83k, False: 6.99k]
  ------------------
  516|  1.83k|          cfirst++;
  517|  1.83k|          bits=DECNEG;
  ------------------
  |  |   31|  1.83k|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  ------------------
  518|  1.83k|          continue;}
  519|  6.99k|        if (*c=='+') {             // valid + sign
  ------------------
  |  Branch (519:13): [True: 311, False: 6.67k]
  ------------------
  520|    311|          cfirst++;
  521|    311|          continue;}
  522|  6.99k|        }
  523|       |      // *c is not a digit, or a valid +, -, or '.'
  524|   747k|      break;
  525|   749k|      } // c
  526|       |
  527|   747k|    if (last==NULL) {              // no digits yet
  ------------------
  |  Branch (527:9): [True: 6.90k, False: 740k]
  ------------------
  528|  6.90k|      status=DEC_Conversion_syntax;// assume the worst
  ------------------
  |  |  128|  6.90k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  529|  6.90k|      if (*c=='\0') break;         // and no more to come...
  ------------------
  |  Branch (529:11): [True: 30, False: 6.87k]
  ------------------
  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.87k|      if (dotchar!=NULL) break;    // .. unless had a dot
  ------------------
  |  Branch (535:11): [True: 5, False: 6.87k]
  ------------------
  536|  6.87k|      decNumberZero(dn);           // be optimistic
  537|  6.87k|      if (decBiStr(c, "infinity", "INFINITY")
  ------------------
  |  Branch (537:11): [True: 194, False: 6.68k]
  ------------------
  538|  6.68k|       || decBiStr(c, "inf", "INF")) {
  ------------------
  |  Branch (538:11): [True: 5.16k, False: 1.51k]
  ------------------
  539|  5.36k|        dn->bits=bits | DECINF;
  ------------------
  |  |   32|  5.36k|  #define DECINF    0x40      /* 1=Infinity                           */
  ------------------
  540|  5.36k|        status=0;                  // is OK
  541|  5.36k|        break; // all done
  542|  5.36k|        }
  543|       |      // a NaN expected
  544|       |      // 2003.09.10 NaNs are now permitted to have a sign
  545|  1.51k|      dn->bits=bits | DECNAN;      // assume simple NaN
  ------------------
  |  |   33|  1.51k|  #define DECNAN    0x20      /* 1=NaN                                */
  ------------------
  546|  1.51k|      if (*c=='s' || *c=='S') {    // looks like an sNaN
  ------------------
  |  Branch (546:11): [True: 197, False: 1.31k]
  |  Branch (546:22): [True: 194, False: 1.12k]
  ------------------
  547|    391|        c++;
  548|    391|        dn->bits=bits | DECSNAN;
  ------------------
  |  |   34|    391|  #define DECSNAN   0x10      /* 1=sNaN                               */
  ------------------
  549|    391|        }
  550|  1.51k|      if (*c!='n' && *c!='N') break;    // check caseless "NaN"
  ------------------
  |  Branch (550:11): [True: 940, False: 574]
  |  Branch (550:22): [True: 266, False: 674]
  ------------------
  551|  1.24k|      c++;
  552|  1.24k|      if (*c!='a' && *c!='A') break;    // ..
  ------------------
  |  Branch (552:11): [True: 688, False: 560]
  |  Branch (552:22): [True: 32, False: 656]
  ------------------
  553|  1.21k|      c++;
  554|  1.21k|      if (*c!='n' && *c!='N') break;    // ..
  ------------------
  |  Branch (554:11): [True: 538, False: 678]
  |  Branch (554:22): [True: 29, False: 509]
  ------------------
  555|  1.18k|      c++;
  556|       |      // now either nothing, or nnnn payload, expected
  557|       |      // -> start of integer and skip leading 0s [including plain 0]
  558|  1.39k|      for (cfirst=c; *cfirst=='0';) cfirst++;
  ------------------
  |  Branch (558:22): [True: 210, False: 1.18k]
  ------------------
  559|  1.18k|      if (*cfirst=='\0') {         // "NaN" or "sNaN", maybe with all 0s
  ------------------
  |  Branch (559:11): [True: 1.13k, False: 57]
  ------------------
  560|  1.13k|        status=0;                  // it's good
  561|  1.13k|        break;                     // ..
  562|  1.13k|        }
  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: 53, False: 227k]
  |  Branch (565:23): [True: 4, False: 227k]
  ------------------
  566|   227k|        last=c;
  567|   227k|        }
  568|     57|      if (*c!='\0') break;         // not all digits
  ------------------
  |  Branch (568:11): [True: 17, 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|   740k|     else if (*c!='\0') {          // more to process...
  ------------------
  |  Branch (580:15): [True: 28.1k, False: 712k]
  ------------------
  581|       |      // had some digits; exponent is only valid sequence now
  582|  28.1k|      Flag nege;                   // 1=negative exponent
  ------------------
  |  |   87|  28.1k|  #define Flag   uint8_t
  ------------------
  583|  28.1k|      const char *firstexp;        // -> first significant exponent digit
  584|  28.1k|      status=DEC_Conversion_syntax;// assume the worst
  ------------------
  |  |  128|  28.1k|    #define DEC_Conversion_syntax    0x00000001
  ------------------
  585|  28.1k|      uInt expa=0;                 // accumulator for exponent
  ------------------
  |  |   93|  28.1k|  #define uInt   uint32_t
  ------------------
  586|  28.1k|      if (*c!='e' && *c!='E') break;
  ------------------
  |  Branch (586:11): [True: 27.0k, False: 1.03k]
  |  Branch (586:22): [True: 37, False: 27.0k]
  ------------------
  587|       |      /* Found 'e' or 'E' -- now process explicit exponent */
  588|       |      // 1998.07.11: sign no longer required
  589|  28.0k|      nege=0;
  590|  28.0k|      c++;                         // to (possible) sign
  591|  28.0k|      if (*c=='-') {nege=1; c++;}
  ------------------
  |  Branch (591:11): [True: 25.3k, False: 2.70k]
  ------------------
  592|  2.70k|       else if (*c=='+') c++;
  ------------------
  |  Branch (592:17): [True: 194, False: 2.51k]
  ------------------
  593|  28.0k|      if (*c=='\0') break;
  ------------------
  |  Branch (593:11): [True: 29, False: 28.0k]
  ------------------
  594|       |
  595|  29.0k|      for (; *c=='0' && *(c+1)!='\0';) c++;  // strip insignificant zeros
  ------------------
  |  Branch (595:14): [True: 1.26k, False: 27.8k]
  |  Branch (595:25): [True: 1.03k, False: 230]
  ------------------
  596|  28.0k|      firstexp=c;                            // save exponent digit place
  597|   967k|      for (; ;c++) {
  598|   967k|        if (*c<'0' || *c>'9') break;         // not a digit
  ------------------
  |  Branch (598:13): [True: 28.0k, False: 939k]
  |  Branch (598:23): [True: 5, False: 939k]
  ------------------
  599|   939k|        expa=X10(expa)+(Int)*c-(Int)'0';
  ------------------
  |  |  163|   939k|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
  600|   939k|        } // c
  601|       |      // if not now on a '\0', *c must not be a digit
  602|  28.0k|      if (*c!='\0') break;
  ------------------
  |  Branch (602:11): [True: 28, False: 28.0k]
  ------------------
  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.0k|      if (c>=firstexp+9+1) {
  ------------------
  |  Branch (607:11): [True: 21.4k, False: 6.58k]
  ------------------
  608|  21.4k|        if (c>firstexp+9+1 || *firstexp>'1') expa=DECNUMMAXE*2;
  ------------------
  |  |  183|    751|  #define DECNUMMAXE 999999999  /* maximum adjusted exponent ditto    */
  ------------------
  |  Branch (608:13): [True: 311, False: 21.1k]
  |  Branch (608:31): [True: 440, False: 20.6k]
  ------------------
  609|       |        // [up to 1999999999 is OK, for example 1E-1000000998]
  610|  21.4k|        }
  611|  28.0k|      exponent=(Int)expa;               // save exponent
  612|  28.0k|      if (nege) exponent=-exponent;     // was negative
  ------------------
  |  Branch (612:11): [True: 25.3k, False: 2.65k]
  ------------------
  613|  28.0k|      status=0;                         // is OK
  614|  28.0k|      } // 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|   740k|    if (*cfirst=='0') {                 // [cfirst has stepped over .]
  ------------------
  |  Branch (620:9): [True: 648k, False: 91.9k]
  ------------------
  621|   705k|      for (c=cfirst; c<last; c++, cfirst++) {
  ------------------
  |  Branch (621:22): [True: 61.6k, False: 643k]
  ------------------
  622|  61.6k|        if (*c=='.') continue;          // ignore dots
  ------------------
  |  Branch (622:13): [True: 233, False: 61.4k]
  ------------------
  623|  61.4k|        if (*c!='0') break;             // non-zero found
  ------------------
  |  Branch (623:13): [True: 4.87k, False: 56.5k]
  ------------------
  624|  56.5k|        d--;                            // 0 stripped
  625|  56.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|   648k|      } // at least one leading 0
  634|       |
  635|       |    // Handle decimal point...
  636|   740k|    if (dotchar!=NULL && dotchar<last)  // non-trailing '.' found?
  ------------------
  |  Branch (636:9): [True: 2.36k, False: 738k]
  |  Branch (636:26): [True: 1.62k, False: 744]
  ------------------
  637|  1.62k|      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|   740k|    if (d<=set->digits) res=dn->lsu;    // fits into supplied decNumber
  ------------------
  |  Branch (642:9): [True: 740k, 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|   740k|    #if DECDPUN>1
  657|   740k|    out=0;                         // accumulator
  658|   740k|    up=res+D2U(d)-1;               // -> msu
  ------------------
  |  |  264|   740k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|   740k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    951|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    951|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 739k, False: 951]
  |  |  ------------------
  ------------------
  659|   740k|    cut=d-(up-res)*DECDPUN;        // digits in top unit
  ------------------
  |  |   43|   740k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  660|  32.4M|    for (c=cfirst;; c++) {         // along the digits
  661|  32.4M|      if (*c=='.') continue;       // ignore '.' [don't decrement cut]
  ------------------
  |  Branch (661:11): [True: 739, False: 32.4M]
  ------------------
  662|  32.4M|      out=X10(out)+(Int)*c-(Int)'0';
  ------------------
  |  |  163|  32.4M|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
  663|  32.4M|      if (c==last) break;          // done [never get to trailing '.']
  ------------------
  |  Branch (663:11): [True: 740k, False: 31.7M]
  ------------------
  664|  31.7M|      cut--;
  665|  31.7M|      if (cut>0) continue;         // more for this unit
  ------------------
  |  Branch (665:11): [True: 21.1M, False: 10.5M]
  ------------------
  666|  10.5M|      *up=(Unit)out;               // write unit
  667|  10.5M|      up--;                        // prepare for unit below..
  668|  10.5M|      cut=DECDPUN;                 // ..
  ------------------
  |  |   43|  10.5M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  669|  10.5M|      out=0;                       // ..
  670|  10.5M|      } // c
  671|   740k|    *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|   740k|    dn->bits=bits;
  684|   740k|    dn->exponent=exponent;
  685|   740k|    dn->digits=d;
  686|       |
  687|       |    // if not in number (too long) shorten into the number
  688|   740k|    if (d>set->digits) {
  ------------------
  |  Branch (688:9): [True: 0, False: 740k]
  ------------------
  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|   740k|     else { // no rounding, but may still have overflow or subnormal
  695|       |      // [these tests are just for performance; finalize repeats them]
  696|   740k|      if ((dn->exponent-1<set->emin-dn->digits)
  ------------------
  |  Branch (696:11): [True: 20.6k, False: 719k]
  ------------------
  697|   719k|       || (dn->exponent-1>set->emax-set->digits)) {
  ------------------
  |  Branch (697:11): [True: 1.22k, False: 718k]
  ------------------
  698|  21.9k|        residue=0;
  699|  21.9k|        decFinalize(dn, set, &residue, &status);
  700|  21.9k|        }
  701|   740k|      }
  702|       |    // decNumberShow(dn);
  703|   740k|    } while(0);                         // [for break]
  ------------------
  |  Branch (703:13): [Folded, False: 740k]
  ------------------
  704|       |
  705|   747k|  if (allocres!=NULL) free(allocres);   // drop any storage used
  ------------------
  |  Branch (705:7): [True: 0, False: 747k]
  ------------------
  706|   747k|  if (status!=0) decStatus(dn, status, set);
  ------------------
  |  Branch (706:7): [True: 17.8k, False: 729k]
  ------------------
  707|   747k|  return dn;
  708|   747k|  } /* decNumberFromString */
decNumberReduce:
 2310|  5.15k|                            decContext *set) {
 2311|       |  #if DECSUBSET
 2312|       |  decNumber *allocrhs=NULL;        // non-NULL if rounded rhs allocated
 2313|       |  #endif
 2314|  5.15k|  uInt status=0;                   // as usual
  ------------------
  |  |   93|  5.15k|  #define uInt   uint32_t
  ------------------
 2315|  5.15k|  Int  residue=0;                  // as usual
  ------------------
  |  |   92|  5.15k|  #define Int    int32_t
  ------------------
 2316|  5.15k|  Int  dropped;                    // work
  ------------------
  |  |   92|  5.15k|  #define Int    int32_t
  ------------------
 2317|       |
 2318|       |  #if DECCHECK
 2319|       |  if (decCheckOperands(res, DECUNUSED, rhs, set)) return res;
 2320|       |  #endif
 2321|       |
 2322|  5.15k|  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.15k|    if (decNumberIsNaN(rhs)) {
  ------------------
  |  |  172|  5.15k|  #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   33|  5.15k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define decNumberIsNaN(dn)       (((dn)->bits&(DECNAN|DECSNAN))!=0)
  |  |  ------------------
  |  |  |  |   34|  5.15k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  |  |  |  Branch (172:36): [True: 0, False: 5.15k]
  |  |  ------------------
  ------------------
 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.15k|    decCopyFit(res, rhs, set, &residue, &status); // copy & round
 2343|  5.15k|    decFinish(res, set, &residue, &status);       // cleanup/set flags
  ------------------
  |  |  267|  5.15k|#define decFinish(a,b,c,d) decFinalize(a,b,c,d)
  ------------------
 2344|  5.15k|    decTrim(res, set, 1, 0, &dropped);            // normalize in place
 2345|       |                                                  // [may clamp]
 2346|  5.15k|    } while(0);                              // end protected
  ------------------
  |  Branch (2346:13): [Folded, False: 5.15k]
  ------------------
 2347|       |
 2348|       |  #if DECSUBSET
 2349|       |  if (allocrhs !=NULL) free(allocrhs);       // ..
 2350|       |  #endif
 2351|  5.15k|  if (status!=0) decStatus(res, status, set);// then report status
  ------------------
  |  Branch (2351:7): [True: 0, False: 5.15k]
  ------------------
 2352|  5.15k|  return res;
 2353|  5.15k|  } // decNumberReduce
decNumberZero:
 3588|  7.94k|decNumber * decNumberZero(decNumber *dn) {
 3589|       |
 3590|       |  #if DECCHECK
 3591|       |  if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
 3592|       |  #endif
 3593|       |
 3594|  7.94k|  dn->bits=0;
 3595|  7.94k|  dn->exponent=0;
 3596|  7.94k|  dn->digits=1;
 3597|  7.94k|  dn->lsu[0]=0;
 3598|  7.94k|  return dn;
 3599|  7.94k|  } // decNumberZero
decNumber.c:decToString:
 3621|  14.1k|static void decToString(const decNumber *dn, char *string, Flag eng) {
 3622|  14.1k|  Int exp=dn->exponent;       // local copy
  ------------------
  |  |   92|  14.1k|  #define Int    int32_t
  ------------------
 3623|  14.1k|  Int e;                      // E-part value
  ------------------
  |  |   92|  14.1k|  #define Int    int32_t
  ------------------
 3624|  14.1k|  Int pre;                    // digits before the '.'
  ------------------
  |  |   92|  14.1k|  #define Int    int32_t
  ------------------
 3625|  14.1k|  Int cut;                    // for counting digits in a Unit
  ------------------
  |  |   92|  14.1k|  #define Int    int32_t
  ------------------
 3626|  14.1k|  char *c=string;             // work [output pointer]
 3627|  14.1k|  const Unit *up=dn->lsu+D2U(dn->digits)-1; // -> msu [input pointer]
  ------------------
  |  |  264|  14.1k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|  14.1k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    582|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    582|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 13.6k, False: 582]
  |  |  ------------------
  ------------------
 3628|  14.1k|  uInt u, pow;                // work
  ------------------
  |  |   93|  14.1k|  #define uInt   uint32_t
  ------------------
 3629|       |
 3630|       |  #if DECCHECK
 3631|       |  if (decCheckOperands(DECUNRESU, dn, DECUNUSED, DECUNCONT)) {
 3632|       |    strcpy(string, "?");
 3633|       |    return;}
 3634|       |  #endif
 3635|       |
 3636|  14.1k|  if (decNumberIsNegative(dn)) {   // Negatives get a minus
  ------------------
  |  |  173|  14.1k|  #define decNumberIsNegative(dn)  (((dn)->bits&DECNEG)!=0)
  |  |  ------------------
  |  |  |  |   31|  14.1k|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  |  |  ------------------
  |  |  |  Branch (173:36): [True: 413, False: 13.7k]
  |  |  ------------------
  ------------------
 3637|    413|    *c='-';
 3638|    413|    c++;
 3639|    413|    }
 3640|  14.1k|  if (dn->bits&DECSPECIAL) {       // Is a special value
  ------------------
  |  |   36|  14.1k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   32|  14.1k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   33|  14.1k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   34|  14.1k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  |  Branch (3640:7): [True: 5.15k, False: 9.03k]
  ------------------
 3641|  5.15k|    if (decNumberIsInfinite(dn)) {
  ------------------
  |  |  171|  5.15k|  #define decNumberIsInfinite(dn)  (((dn)->bits&DECINF)!=0)
  |  |  ------------------
  |  |  |  |   32|  5.15k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |  |  Branch (171:36): [True: 5.15k, False: 0]
  |  |  ------------------
  ------------------
 3642|  5.15k|      strcpy(c,   "Inf");
 3643|  5.15k|      strcpy(c+3, "inity");
 3644|  5.15k|      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|  9.03k|  cut=MSUDIGITS(dn->digits);       // [faster than remainder]
  ------------------
  |  |  271|  9.03k|  #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |  264|  9.03k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  249|  9.03k|  #define DECMAXD2U 49
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    582|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |   43|    582|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (264:21): [True: 8.45k, False: 582]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                 #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |   43|  9.03k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  ------------------
 3660|  9.03k|  cut--;                           // power of ten for digit
 3661|       |
 3662|  9.03k|  if (exp==0) {                    // simple integer [common fastpath]
  ------------------
  |  Branch (3662:7): [True: 6.20k, False: 2.82k]
  ------------------
 3663|  1.37M|    for (;up>=dn->lsu; up--) {     // each Unit from msu
  ------------------
  |  Branch (3663:11): [True: 1.36M, False: 6.20k]
  ------------------
 3664|  1.36M|      u=*up;                       // contains DECDPUN digits to lay out
 3665|  5.44M|      for (; cut>=0; c++, cut--) TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  4.08M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  4.08M|    *(c)='0';                             \
  |  |  290|  4.08M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  4.08M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 2.97M, False: 1.10M]
  |  |  ------------------
  |  |  292|  2.97M|      pow*=4;                             \
  |  |  293|  2.97M|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.96M, False: 8.50k]
  |  |  ------------------
  |  |  294|  2.97M|      pow/=2;                             \
  |  |  295|  2.97M|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 3.44k, False: 2.96M]
  |  |  ------------------
  |  |  296|  2.97M|      pow/=2;                             \
  |  |  297|  2.97M|      }                                   \
  |  |  298|  4.08M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 7.26k, False: 4.07M]
  |  |  ------------------
  |  |  299|  4.08M|    pow/=2;                               \
  |  |  300|  4.08M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 2.97M, False: 1.10M]
  |  |  ------------------
  |  |  301|  4.08M|    }
  ------------------
  |  Branch (3665:14): [True: 4.08M, False: 1.36M]
  ------------------
 3666|  1.36M|      cut=DECDPUN-1;               // next Unit has all digits
  ------------------
  |  |   43|  1.36M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3667|  1.36M|      }
 3668|  6.20k|    *c='\0';                       // terminate the string
 3669|  6.20k|    return;}
 3670|       |
 3671|       |  /* non-0 exponent -- assume plain form */
 3672|  2.82k|  pre=dn->digits+exp;              // digits before '.'
 3673|  2.82k|  e=0;                             // no E
 3674|  2.82k|  if ((exp>0) || (pre<-5)) {       // need exponential form
  ------------------
  |  Branch (3674:7): [True: 955, False: 1.87k]
  |  Branch (3674:18): [True: 1.04k, False: 834]
  ------------------
 3675|  1.99k|    e=exp+dn->digits-1;            // calculate E value
 3676|  1.99k|    pre=1;                         // assume one digit before '.'
 3677|  1.99k|    if (eng && (e!=0)) {           // engineering: may need to adjust
  ------------------
  |  Branch (3677:9): [True: 0, False: 1.99k]
  |  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.99k|    } // need exponent
 3701|       |
 3702|       |  /* lay out the digits of the coefficient, adding 0s and . as needed */
 3703|  2.82k|  u=*up;
 3704|  2.82k|  if (pre>0) {                     // xxx.xxx or xx00 (engineering) form
  ------------------
  |  Branch (3704:7): [True: 2.34k, False: 482]
  ------------------
 3705|  2.34k|    Int n=pre;
  ------------------
  |  |   92|  2.34k|  #define Int    int32_t
  ------------------
 3706|  1.49M|    for (; pre>0; pre--, c++, cut--) {
  ------------------
  |  Branch (3706:12): [True: 1.49M, False: 2.34k]
  ------------------
 3707|  1.49M|      if (cut<0) {                 // need new Unit
  ------------------
  |  Branch (3707:11): [True: 496k, False: 994k]
  ------------------
 3708|   496k|        if (up==dn->lsu) break;    // out of input digits (pre>digits)
  ------------------
  |  Branch (3708:13): [True: 0, False: 496k]
  ------------------
 3709|   496k|        up--;
 3710|   496k|        cut=DECDPUN-1;
  ------------------
  |  |   43|   496k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3711|   496k|        u=*up;
 3712|   496k|        }
 3713|  1.49M|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  1.49M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  1.49M|    *(c)='0';                             \
  |  |  290|  1.49M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  1.49M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 568k, False: 921k]
  |  |  ------------------
  |  |  292|   568k|      pow*=4;                             \
  |  |  293|   568k|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 564k, False: 3.98k]
  |  |  ------------------
  |  |  294|   568k|      pow/=2;                             \
  |  |  295|   568k|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 2.89k, False: 566k]
  |  |  ------------------
  |  |  296|   568k|      pow/=2;                             \
  |  |  297|   568k|      }                                   \
  |  |  298|  1.49M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 2.88k, False: 1.48M]
  |  |  ------------------
  |  |  299|  1.49M|    pow/=2;                               \
  |  |  300|  1.49M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 568k, False: 922k]
  |  |  ------------------
  |  |  301|  1.49M|    }
  ------------------
 3714|  1.49M|      }
 3715|  2.34k|    if (n<dn->digits) {            // more to come, after '.'
  ------------------
  |  Branch (3715:9): [True: 778, False: 1.56k]
  ------------------
 3716|    778|      *c='.'; c++;
 3717|  19.7M|      for (;; c++, cut--) {
 3718|  19.7M|        if (cut<0) {               // need new Unit
  ------------------
  |  Branch (3718:13): [True: 6.59M, False: 13.1M]
  ------------------
 3719|  6.59M|          if (up==dn->lsu) break;  // out of input digits
  ------------------
  |  Branch (3719:15): [True: 778, False: 6.59M]
  ------------------
 3720|  6.59M|          up--;
 3721|  6.59M|          cut=DECDPUN-1;
  ------------------
  |  |   43|  6.59M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3722|  6.59M|          u=*up;
 3723|  6.59M|          }
 3724|  19.7M|        TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  19.7M|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  19.7M|    *(c)='0';                             \
  |  |  290|  19.7M|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  19.7M|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 2.24M, False: 17.5M]
  |  |  ------------------
  |  |  292|  2.24M|      pow*=4;                             \
  |  |  293|  2.24M|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.21M, False: 26.7k]
  |  |  ------------------
  |  |  294|  2.24M|      pow/=2;                             \
  |  |  295|  2.24M|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 6.99k, False: 2.23M]
  |  |  ------------------
  |  |  296|  2.24M|      pow/=2;                             \
  |  |  297|  2.24M|      }                                   \
  |  |  298|  19.7M|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 22.7k, False: 19.7M]
  |  |  ------------------
  |  |  299|  19.7M|    pow/=2;                               \
  |  |  300|  19.7M|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 2.24M, False: 17.5M]
  |  |  ------------------
  |  |  301|  19.7M|    }
  ------------------
 3725|  19.7M|        }
 3726|    778|      }
 3727|  1.56k|     else for (; pre>0; pre--, c++) *c='0'; // 0 padding (for engineering) needed
  ------------------
  |  Branch (3727:18): [True: 0, False: 1.56k]
  ------------------
 3728|  2.34k|    }
 3729|    482|   else {                          // 0.xxx or 0.000xxx form
 3730|    482|    *c='0'; c++;
 3731|    482|    *c='.'; c++;
 3732|    699|    for (; pre<0; pre++, c++) *c='0';   // add any 0's after '.'
  ------------------
  |  Branch (3732:12): [True: 217, False: 482]
  ------------------
 3733|  2.59k|    for (; ; c++, cut--) {
 3734|  2.59k|      if (cut<0) {                 // need new Unit
  ------------------
  |  Branch (3734:11): [True: 998, False: 1.60k]
  ------------------
 3735|    998|        if (up==dn->lsu) break;    // out of input digits
  ------------------
  |  Branch (3735:13): [True: 482, False: 516]
  ------------------
 3736|    516|        up--;
 3737|    516|        cut=DECDPUN-1;
  ------------------
  |  |   43|    516|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 3738|    516|        u=*up;
 3739|    516|        }
 3740|  2.11k|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  2.11k|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  2.11k|    *(c)='0';                             \
  |  |  290|  2.11k|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  2.11k|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 1.11k, False: 999]
  |  |  ------------------
  |  |  292|  1.11k|      pow*=4;                             \
  |  |  293|  1.11k|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 318, False: 800]
  |  |  ------------------
  |  |  294|  1.11k|      pow/=2;                             \
  |  |  295|  1.11k|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 729, False: 389]
  |  |  ------------------
  |  |  296|  1.11k|      pow/=2;                             \
  |  |  297|  1.11k|      }                                   \
  |  |  298|  2.11k|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 435, False: 1.68k]
  |  |  ------------------
  |  |  299|  2.11k|    pow/=2;                               \
  |  |  300|  2.11k|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 745, False: 1.37k]
  |  |  ------------------
  |  |  301|  2.11k|    }
  ------------------
 3741|  2.11k|      }
 3742|    482|    }
 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.82k|  if (e!=0) {
  ------------------
  |  Branch (3747:7): [True: 1.99k, False: 834]
  ------------------
 3748|  1.99k|    Flag had=0;               // 1=had non-zero
  ------------------
  |  |   87|  1.99k|  #define Flag   uint8_t
  ------------------
 3749|  1.99k|    *c='E'; c++;
 3750|  1.99k|    *c='+'; c++;              // assume positive
 3751|  1.99k|    u=e;                      // ..
 3752|  1.99k|    if (e<0) {
  ------------------
  |  Branch (3752:9): [True: 1.04k, False: 955]
  ------------------
 3753|  1.04k|      *(c-1)='-';             // oops, need -
 3754|  1.04k|      u=-e;                   // uInt, please
 3755|  1.04k|      }
 3756|       |    // lay out the exponent [_itoa or equivalent is not ANSI C]
 3757|  21.9k|    for (cut=9; cut>=0; cut--) {
  ------------------
  |  Branch (3757:17): [True: 19.9k, False: 1.99k]
  ------------------
 3758|  19.9k|      TODIGIT(u, cut, c, pow);
  ------------------
  |  |  288|  19.9k|  #define TODIGIT(u, cut, c, pow) {       \
  |  |  289|  19.9k|    *(c)='0';                             \
  |  |  290|  19.9k|    pow=DECPOWERS[cut]*2;                 \
  |  |  291|  19.9k|    if ((u)>pow) {                        \
  |  |  ------------------
  |  |  |  Branch (291:9): [True: 8.78k, False: 11.1k]
  |  |  ------------------
  |  |  292|  8.78k|      pow*=4;                             \
  |  |  293|  8.78k|      if ((u)>=pow) {(u)-=pow; *(c)+=8;}  \
  |  |  ------------------
  |  |  |  Branch (293:11): [True: 2.53k, False: 6.24k]
  |  |  ------------------
  |  |  294|  8.78k|      pow/=2;                             \
  |  |  295|  8.78k|      if ((u)>=pow) {(u)-=pow; *(c)+=4;}  \
  |  |  ------------------
  |  |  |  Branch (295:11): [True: 4.63k, False: 4.15k]
  |  |  ------------------
  |  |  296|  8.78k|      pow/=2;                             \
  |  |  297|  8.78k|      }                                   \
  |  |  298|  19.9k|    if ((u)>=pow) {(u)-=pow; *(c)+=2;}    \
  |  |  ------------------
  |  |  |  Branch (298:9): [True: 3.79k, False: 16.1k]
  |  |  ------------------
  |  |  299|  19.9k|    pow/=2;                               \
  |  |  300|  19.9k|    if ((u)>=pow) {(u)-=pow; *(c)+=1;}    \
  |  |  ------------------
  |  |  |  Branch (300:9): [True: 6.55k, False: 13.3k]
  |  |  ------------------
  |  |  301|  19.9k|    }
  ------------------
 3759|  19.9k|      if (*c=='0' && !had) continue;    // skip leading zeros
  ------------------
  |  Branch (3759:11): [True: 9.24k, False: 10.7k]
  |  Branch (3759:22): [True: 8.63k, False: 612]
  ------------------
 3760|  11.3k|      had=1;                            // had non-0
 3761|  11.3k|      c++;                              // step for next
 3762|  11.3k|      } // cut
 3763|  1.99k|    }
 3764|  2.82k|  *c='\0';          // terminate the string (all paths)
 3765|  2.82k|  return;
 3766|  9.03k|  } // decToString
decNumber.c:decUnitAddSub:
 6339|  3.27k|                         Unit *c, Int m) {
 6340|  3.27k|  const Unit *alsu=a;              // A lsu [need to remember it]
 6341|  3.27k|  Unit *clsu=c;                    // C ditto
  ------------------
  |  |   94|  3.27k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.27k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6342|  3.27k|  Unit *minC;                      // low water mark for C
  ------------------
  |  |   94|  3.27k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.27k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6343|  3.27k|  Unit *maxC;                      // high water mark for C
  ------------------
  |  |   94|  3.27k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  3.27k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6344|  3.27k|  eInt carry=0;                    // carry integer (could be Long)
  ------------------
  |  |  203|  3.27k|  #define eInt  Int           // extended integer
  |  |  ------------------
  |  |  |  |   92|  3.27k|  #define Int    int32_t
  |  |  ------------------
  ------------------
 6345|  3.27k|  Int  add;                        // work
  ------------------
  |  |   92|  3.27k|  #define Int    int32_t
  ------------------
 6346|  3.27k|  #if DECDPUN<=4                   // myriadal, millenary, etc.
 6347|  3.27k|  Int  est;                        // estimated quotient
  ------------------
  |  |   92|  3.27k|  #define Int    int32_t
  ------------------
 6348|  3.27k|  #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.27k|  maxC=c+alength;                  // A is usually the longer
 6356|  3.27k|  minC=c+blength;                  // .. and B the shorter
 6357|  3.27k|  if (bshift!=0) {                 // B is shifted; low As copy across
  ------------------
  |  Branch (6357:7): [True: 0, False: 3.27k]
  ------------------
 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.27k|  if (minC>maxC) { // swap
  ------------------
  |  Branch (6369:7): [True: 0, False: 3.27k]
  ------------------
 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.55k|  for (; c<minC; c++) {
  ------------------
  |  Branch (6379:10): [True: 3.27k, False: 3.27k]
  ------------------
 6380|  3.27k|    carry+=*a;
 6381|  3.27k|    a++;
 6382|  3.27k|    carry+=((eInt)*b)*m;                // [special-casing m=1/-1
 6383|  3.27k|    b++;                                // here is not a win]
 6384|       |    // here carry is new Unit of digits; it could be +ve or -ve
 6385|  3.27k|    if ((ueInt)carry<=DECDPUNMAX) {     // fastpath 0-DECDPUNMAX
  ------------------
  |  |  209|  3.27k|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6385:9): [True: 3.04k, False: 231]
  ------------------
 6386|  3.04k|      *c=(Unit)carry;
 6387|  3.04k|      carry=0;
 6388|  3.04k|      continue;
 6389|  3.04k|      }
 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|  1.99M|  if (c<maxC) for (; c<maxC; c++) {
  ------------------
  |  Branch (6460:7): [True: 1.97k, False: 1.30k]
  |  Branch (6460:22): [True: 1.99M, False: 1.97k]
  ------------------
 6461|  1.99M|    if (a<alsu+alength) {               // still in A
  ------------------
  |  Branch (6461:9): [True: 1.99M, False: 0]
  ------------------
 6462|  1.99M|      carry+=*a;
 6463|  1.99M|      a++;
 6464|  1.99M|      }
 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|  1.99M|    if ((ueInt)carry<=DECDPUNMAX) {     // fastpath 0-DECDPUNMAX
  ------------------
  |  |  209|  1.99M|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6471:9): [True: 1.52M, False: 465k]
  ------------------
 6472|  1.52M|      *c=(Unit)carry;
 6473|  1.52M|      carry=0;
 6474|  1.52M|      continue;
 6475|  1.52M|      }
 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|   465k|      if (carry>=0) {
  ------------------
  |  Branch (6496:11): [True: 465k, False: 0]
  ------------------
 6497|   465k|        est=(((ueInt)carry>>3)*16777)>>21;
 6498|   465k|        *c=(Unit)(carry-est*(DECDPUNMAX+1)); // remainder
  ------------------
  |  |  209|   465k|    #define DECDPUNMAX 999
  ------------------
 6499|   465k|        carry=est;                           // likely quotient [99%]
 6500|   465k|        if (*c<DECDPUNMAX+1) continue;       // estimate was correct
  ------------------
  |  |  209|   465k|    #define DECDPUNMAX 999
  ------------------
  |  Branch (6500:13): [True: 0, False: 465k]
  ------------------
 6501|   465k|        carry++;
 6502|   465k|        *c-=DECDPUNMAX+1;
  ------------------
  |  |  209|   465k|    #define DECDPUNMAX 999
  ------------------
 6503|   465k|        continue;
 6504|   465k|        }
 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.27k|  if (carry==0) return c-clsu;     // no carry, so no more to do
  ------------------
  |  Branch (6546:7): [True: 3.27k, 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.33k|                          uInt *status) {
 7072|  7.33k|  Int  bump;                  // 1 if coefficient needs to be incremented
  ------------------
  |  |   92|  7.33k|  #define Int    int32_t
  ------------------
 7073|       |                              // -1 if coefficient needs to be decremented
 7074|       |
 7075|  7.33k|  if (residue==0) return;     // nothing to apply
  ------------------
  |  Branch (7075:7): [True: 1.24k, False: 6.09k]
  ------------------
 7076|       |
 7077|  6.09k|  bump=0;                     // assume a smooth ride
 7078|       |
 7079|       |  // now decide whether, and how, to round, depending on mode
 7080|  6.09k|  switch (set->round) {
 7081|      0|    case DEC_ROUND_05UP: {    // round zero or five up (for reround)
  ------------------
  |  Branch (7081:5): [True: 0, False: 6.09k]
  ------------------
 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.09k]
  ------------------
 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.09k]
  ------------------
 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.09k]
  ------------------
 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.09k|    case DEC_ROUND_HALF_UP: {
  ------------------
  |  Branch (7110:5): [True: 6.09k, False: 0]
  ------------------
 7111|  6.09k|      if (residue>=5) bump=1;
  ------------------
  |  Branch (7111:11): [True: 4.23k, False: 1.85k]
  ------------------
 7112|  6.09k|      break;} // r-h-u
 7113|       |
 7114|      0|    case DEC_ROUND_UP: {
  ------------------
  |  Branch (7114:5): [True: 0, False: 6.09k]
  ------------------
 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.09k]
  ------------------
 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.09k]
  ------------------
 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.09k]
  ------------------
 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.09k|    } // switch
 7147|       |
 7148|       |  // now bump the number, up or down, if need be
 7149|  6.09k|  if (bump==0) return;                       // no action required
  ------------------
  |  Branch (7149:7): [True: 1.85k, False: 4.23k]
  ------------------
 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.23k|  if (bump>0) {
  ------------------
  |  Branch (7156:7): [True: 4.23k, False: 0]
  ------------------
 7157|  4.23k|    Unit *up;                                // work
  ------------------
  |  |   94|  4.23k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  4.23k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 7158|  4.23k|    uInt count=dn->digits;                   // digits to be checked
  ------------------
  |  |   93|  4.23k|  #define uInt   uint32_t
  ------------------
 7159|  4.98M|    for (up=dn->lsu; ; up++) {
 7160|  4.98M|      if (count<=DECDPUN) {
  ------------------
  |  |   43|  4.98M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (7160:11): [True: 2.46k, False: 4.98M]
  ------------------
 7161|       |        // this is the last Unit (the msu)
 7162|  2.46k|        if (*up!=powers[count]-1) break;     // not still 9s
  ------------------
  |  |  177|  2.46k|#define powers      DECPOWERS      // old internal name
  ------------------
  |  Branch (7162:13): [True: 1.50k, False: 961]
  ------------------
 7163|       |        // here if it, too, is all nines
 7164|    961|        *up=(Unit)powers[count-1];           // here 999 -> 100 etc.
  ------------------
  |  |  177|    961|#define powers      DECPOWERS      // old internal name
  ------------------
 7165|  4.51M|        for (up=up-1; up>=dn->lsu; up--) *up=0; // others all to 0
  ------------------
  |  Branch (7165:23): [True: 4.51M, False: 961]
  ------------------
 7166|    961|        dn->exponent++;                      // and bump exponent
 7167|       |        // [which, very rarely, could cause Overflow...]
 7168|    961|        if ((dn->exponent+dn->digits)>set->emax+1) {
  ------------------
  |  Branch (7168:13): [True: 0, False: 961]
  ------------------
 7169|      0|          decSetOverflow(dn, set, status);
 7170|      0|          }
 7171|    961|        return;                              // done
 7172|  2.46k|        }
 7173|       |      // a full unit to check, with more to come
 7174|  4.98M|      if (*up!=DECDPUNMAX) break;            // not still 9s
  ------------------
  |  |  209|  4.98M|    #define DECDPUNMAX 999
  ------------------
  |  Branch (7174:11): [True: 1.77k, False: 4.98M]
  ------------------
 7175|  4.98M|      count-=DECDPUN;
  ------------------
  |  |   43|  4.98M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7176|  4.98M|      } // up
 7177|  4.23k|    } // 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.27k|  decUnitAddSub(dn->lsu, D2U(dn->digits), uarrone, 1, 0, dn->lsu, bump);
  ------------------
  |  |  264|  3.27k|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|  3.27k|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    244|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    244|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 3.03k, False: 244]
  |  |  ------------------
  ------------------
 7220|  3.27k|  } // decApplyRound
decNumber.c:decSetOverflow:
 7348|    903|static void decSetOverflow(decNumber *dn, decContext *set, uInt *status) {
 7349|    903|  Flag needmax=0;                  // result is maximum finite value
  ------------------
  |  |   87|    903|  #define Flag   uint8_t
  ------------------
 7350|    903|  uByte sign=dn->bits&DECNEG;      // clean and save sign bit
  ------------------
  |  |   89|    903|  #define uByte  uint8_t
  ------------------
                uByte sign=dn->bits&DECNEG;      // clean and save sign bit
  ------------------
  |  |   31|    903|  #define DECNEG    0x80      /* Sign; 1=negative, 0=positive or zero */
  ------------------
 7351|       |
 7352|    903|  if (ISZERO(dn)) {                // zero does not overflow magnitude
  ------------------
  |  |  255|    903|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|    903|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 508, False: 395]
  |  |  |  |  ------------------
  |  |  |  |  178|    903|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 306, False: 202]
  |  |  |  |  ------------------
  |  |  |  |  179|    903|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    306|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|    306|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|    306|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|    306|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 306, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
 7353|    306|    Int emax=set->emax;                      // limit value
  ------------------
  |  |   92|    306|  #define Int    int32_t
  ------------------
 7354|    306|    if (set->clamp) emax-=set->digits-1;     // lower if clamping
  ------------------
  |  Branch (7354:9): [True: 0, False: 306]
  ------------------
 7355|    306|    if (dn->exponent>emax) {                 // clamp required
  ------------------
  |  Branch (7355:9): [True: 306, False: 0]
  ------------------
 7356|    306|      dn->exponent=emax;
 7357|    306|      *status|=DEC_Clamped;
  ------------------
  |  |  140|    306|    #define DEC_Clamped              0x00000400
  ------------------
 7358|    306|      }
 7359|    306|    return;
 7360|    306|    }
 7361|       |
 7362|    597|  decNumberZero(dn);
 7363|    597|  switch (set->round) {
 7364|      0|    case DEC_ROUND_DOWN: {
  ------------------
  |  Branch (7364:5): [True: 0, False: 597]
  ------------------
 7365|      0|      needmax=1;                   // never Infinity
 7366|      0|      break;} // r-d
 7367|      0|    case DEC_ROUND_05UP: {
  ------------------
  |  Branch (7367:5): [True: 0, False: 597]
  ------------------
 7368|      0|      needmax=1;                   // never Infinity
 7369|      0|      break;} // r-05
 7370|      0|    case DEC_ROUND_CEILING: {
  ------------------
  |  Branch (7370:5): [True: 0, False: 597]
  ------------------
 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: 597]
  ------------------
 7374|      0|      if (!sign) needmax=1;        // Infinity if negative
  ------------------
  |  Branch (7374:11): [True: 0, False: 0]
  ------------------
 7375|      0|      break;} // r-f
 7376|    597|    default: break;                // Infinity in all other cases
  ------------------
  |  Branch (7376:5): [True: 597, False: 0]
  ------------------
 7377|    597|    }
 7378|    597|  if (needmax) {
  ------------------
  |  Branch (7378:7): [True: 0, False: 597]
  ------------------
 7379|      0|    decSetMaxValue(dn, set);
 7380|      0|    dn->bits=sign;                 // set sign
 7381|      0|    }
 7382|    597|   else dn->bits=sign|DECINF;      // Value is +/-Infinity
  ------------------
  |  |   32|    597|  #define DECINF    0x40      /* 1=Infinity                           */
  ------------------
 7383|    597|  *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  139|    597|    #define DEC_Overflow             0x00000200
  ------------------
                *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  133|    597|    #define DEC_Inexact              0x00000020
  ------------------
                *status|=DEC_Overflow | DEC_Inexact | DEC_Rounded;
  ------------------
  |  |  141|    597|    #define DEC_Rounded              0x00000800
  ------------------
 7384|    597|  } // decSetOverflow
decNumber.c:decTrim:
 6592|  5.15k|                           Flag noclamp, Int *dropped) {
 6593|  5.15k|  Int   d, exp;                    // work
  ------------------
  |  |   92|  5.15k|  #define Int    int32_t
  ------------------
 6594|  5.15k|  uInt  cut;                       // ..
  ------------------
  |  |   93|  5.15k|  #define uInt   uint32_t
  ------------------
 6595|  5.15k|  Unit  *up;                       // -> current Unit
  ------------------
  |  |   94|  5.15k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  5.15k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6596|       |
 6597|       |  #if DECCHECK
 6598|       |  if (decCheckOperands(dn, DECUNUSED, DECUNUSED, DECUNCONT)) return dn;
 6599|       |  #endif
 6600|       |
 6601|  5.15k|  *dropped=0;                           // assume no zeros dropped
 6602|  5.15k|  if ((dn->bits & DECSPECIAL)           // fast exit if special ..
  ------------------
  |  |   36|  5.15k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   32|  5.15k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   33|  5.15k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  ------------------
  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  ------------------
  |  |  |  |   34|  5.15k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  ------------------
  ------------------
  |  Branch (6602:7): [True: 5.15k, False: 0]
  ------------------
 6603|  5.15k|    || (*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|    961|static Int decShiftToMost(Unit *uar, Int digits, Int shift) {
 6686|    961|  Unit  *target, *source, *first;  // work
  ------------------
  |  |   94|    961|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|    961|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6687|    961|  Int   cut;                       // odd 0's to add
  ------------------
  |  |   92|    961|  #define Int    int32_t
  ------------------
 6688|    961|  uInt  next;                      // work
  ------------------
  |  |   93|    961|  #define uInt   uint32_t
  ------------------
 6689|       |
 6690|    961|  if (shift==0) return digits;     // [fastpath] nothing to do
  ------------------
  |  Branch (6690:7): [True: 0, False: 961]
  ------------------
 6691|    961|  if ((digits+shift)<=DECDPUN) {   // [fastpath] single-unit case
  ------------------
  |  |   43|    961|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6691:7): [True: 357, False: 604]
  ------------------
 6692|    357|    *uar=(Unit)(*uar*powers[shift]);
  ------------------
  |  |  177|    357|#define powers      DECPOWERS      // old internal name
  ------------------
 6693|    357|    return digits+shift;
 6694|    357|    }
 6695|       |
 6696|    604|  next=0;                          // all paths
 6697|    604|  source=uar+D2U(digits)-1;        // where msu comes from
  ------------------
  |  |  264|    604|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    604|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    299|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    299|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 305, False: 299]
  |  |  ------------------
  ------------------
 6698|    604|  target=source+D2U(shift);        // where upper part of first cut goes
  ------------------
  |  |  264|    604|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    604|  #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: 604, False: 0]
  |  |  ------------------
  ------------------
 6699|    604|  cut=DECDPUN-MSUDIGITS(shift);    // where to slice
  ------------------
  |  |   43|    604|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
                cut=DECDPUN-MSUDIGITS(shift);    // where to slice
  ------------------
  |  |  271|    604|  #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |  264|    604|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  |  |  ------------------
  |  |  |  |  |  |  249|    604|  #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: 604, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  |  |                 #define MSUDIGITS(d) ((d)-(D2U(d)-1)*DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    604|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  ------------------
 6700|    604|  if (cut==0) {                    // unit-boundary case
  ------------------
  |  Branch (6700:7): [True: 0, False: 604]
  ------------------
 6701|      0|    for (; source>=uar; source--, target--) *target=*source;
  ------------------
  |  Branch (6701:12): [True: 0, False: 0]
  ------------------
 6702|      0|    }
 6703|    604|   else {
 6704|    604|    first=uar+D2U(digits+shift)-1; // where msu of source will end up
  ------------------
  |  |  264|    604|    #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |  249|    604|  #define DECMAXD2U 49
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    333|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |                   #define D2U(d) ((d)<=DECMAXD2U?d2utable[d]:((d)+DECDPUN-1)/DECDPUN)
  |  |  ------------------
  |  |  |  |   43|    333|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  |  |  ------------------
  |  |  |  Branch (264:21): [True: 271, False: 333]
  |  |  ------------------
  ------------------
 6705|  4.51M|    for (; source>=uar; source--, target--) {
  ------------------
  |  Branch (6705:12): [True: 4.51M, False: 604]
  ------------------
 6706|       |      // split the source Unit and accumulate remainder for next
 6707|  4.51M|      #if DECDPUN<=4
 6708|  4.51M|        uInt quot=QUOT10(*source, cut);
  ------------------
  |  |   93|  4.51M|  #define uInt   uint32_t
  ------------------
                      uInt quot=QUOT10(*source, cut);
  ------------------
  |  |  210|  4.51M|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 6709|  4.51M|        uInt rem=*source-quot*powers[cut];
  ------------------
  |  |   93|  4.51M|  #define uInt   uint32_t
  ------------------
                      uInt rem=*source-quot*powers[cut];
  ------------------
  |  |  177|  4.51M|#define powers      DECPOWERS      // old internal name
  ------------------
 6710|  4.51M|        next+=quot;
 6711|       |      #else
 6712|       |        uInt rem=*source%powers[cut];
 6713|       |        next+=*source/powers[cut];
 6714|       |      #endif
 6715|  4.51M|      if (target<=first) *target=(Unit)next;   // write to target iff valid
  ------------------
  |  Branch (6715:11): [True: 4.51M, False: 517]
  ------------------
 6716|  4.51M|      next=rem*powers[DECDPUN-cut];            // save remainder for next Unit
  ------------------
  |  |  177|  4.51M|#define powers      DECPOWERS      // old internal name
  ------------------
                    next=rem*powers[DECDPUN-cut];            // save remainder for next Unit
  ------------------
  |  |   43|  4.51M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6717|  4.51M|      }
 6718|    604|    } // shift-move
 6719|       |
 6720|       |  // propagate any partial unit to one below and clear the rest
 6721|  1.20k|  for (; target>=uar; target--) {
  ------------------
  |  Branch (6721:10): [True: 604, False: 604]
  ------------------
 6722|    604|    *target=(Unit)next;
 6723|    604|    next=0;
 6724|    604|    }
 6725|    604|  return digits+shift;
 6726|    961|  } // decShiftToMost
decNumber.c:decCopyFit:
 6844|  5.15k|                       decContext *set, Int *residue, uInt *status) {
 6845|  5.15k|  dest->bits=src->bits;
 6846|  5.15k|  dest->exponent=src->exponent;
 6847|  5.15k|  decSetCoeff(dest, set, src->lsu, src->digits, residue, status);
 6848|  5.15k|  } // decCopyFit
decNumber.c:decSetCoeff:
 6890|  12.4k|                        Int len, Int *residue, uInt *status) {
 6891|  12.4k|  Int   discard;              // number of digits to discard
  ------------------
  |  |   92|  12.4k|  #define Int    int32_t
  ------------------
 6892|  12.4k|  uInt  cut;                  // cut point in Unit
  ------------------
  |  |   93|  12.4k|  #define uInt   uint32_t
  ------------------
 6893|  12.4k|  const Unit *up;             // work
 6894|  12.4k|  Unit  *target;              // ..
  ------------------
  |  |   94|  12.4k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  12.4k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
 6895|  12.4k|  Int   count;                // ..
  ------------------
  |  |   92|  12.4k|  #define Int    int32_t
  ------------------
 6896|  12.4k|  #if DECDPUN<=4
 6897|  12.4k|  uInt  temp;                 // ..
  ------------------
  |  |   93|  12.4k|  #define uInt   uint32_t
  ------------------
 6898|  12.4k|  #endif
 6899|       |
 6900|  12.4k|  discard=len-set->digits;    // digits to discard
 6901|  12.4k|  if (discard<=0) {           // no digits are being discarded
  ------------------
  |  Branch (6901:7): [True: 5.15k, False: 7.33k]
  ------------------
 6902|  5.15k|    if (dn->lsu!=lsu) {       // copy needed
  ------------------
  |  Branch (6902:9): [True: 5.15k, False: 0]
  ------------------
 6903|       |      // copy the coefficient array to the result number; no shift needed
 6904|  5.15k|      count=len;              // avoids D2U
 6905|  5.15k|      up=lsu;
 6906|  10.3k|      for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
  ------------------
  |  |   43|  5.15k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6906:28): [True: 5.15k, False: 5.15k]
  ------------------
 6907|  5.15k|        *target=*up;
 6908|  5.15k|      dn->digits=len;         // set the new length
 6909|  5.15k|      }
 6910|       |    // dn->exponent and residue are unchanged, record any inexactitude
 6911|  5.15k|    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.15k]
  ------------------
 6912|  5.15k|    return;
 6913|  5.15k|    }
 6914|       |
 6915|       |  // some digits must be discarded ...
 6916|  7.33k|  dn->exponent+=discard;      // maintain numerical value
 6917|  7.33k|  *status|=DEC_Rounded;       // accumulate Rounded status
  ------------------
  |  |  141|  7.33k|    #define DEC_Rounded              0x00000800
  ------------------
 6918|  7.33k|  if (*residue>1) *residue=1; // previous residue now to right, so reduce
  ------------------
  |  Branch (6918:7): [True: 0, False: 7.33k]
  ------------------
 6919|       |
 6920|  7.33k|  if (discard>len) {          // everything, +1, is being discarded
  ------------------
  |  Branch (6920:7): [True: 288, False: 7.05k]
  ------------------
 6921|       |    // guard digit is 0
 6922|       |    // residue is all the number [NB could be all 0s]
 6923|    288|    if (*residue<=0) {        // not already positive
  ------------------
  |  Branch (6923:9): [True: 288, False: 0]
  ------------------
 6924|    288|      count=len;              // avoids D2U
 6925|  69.9k|      for (up=lsu; count>0; up++, count-=DECDPUN) if (*up!=0) { // found non-0
  ------------------
  |  |   43|  69.6k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6925:20): [True: 69.9k, False: 0]
  |  Branch (6925:55): [True: 288, False: 69.6k]
  ------------------
 6926|    288|        *residue=1;
 6927|    288|        break;                // no need to check any others
 6928|    288|        }
 6929|    288|      }
 6930|    288|    if (*residue!=0) *status|=DEC_Inexact; // record inexactitude
  ------------------
  |  |  133|    288|    #define DEC_Inexact              0x00000020
  ------------------
  |  Branch (6930:9): [True: 288, False: 0]
  ------------------
 6931|    288|    *dn->lsu=0;               // coefficient will now be 0
 6932|    288|    dn->digits=1;             // ..
 6933|    288|    return;
 6934|    288|    } // 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.05k|  count=0;
 6943|  81.0k|  for (up=lsu;; up++) {
 6944|  81.0k|    count+=DECDPUN;
  ------------------
  |  |   43|  81.0k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6945|  81.0k|    if (count>=discard) break; // full ones all checked
  ------------------
  |  Branch (6945:9): [True: 7.05k, False: 73.9k]
  ------------------
 6946|  73.9k|    if (*up!=0) *residue=1;
  ------------------
  |  Branch (6946:9): [True: 60.7k, False: 13.2k]
  ------------------
 6947|  73.9k|    } // up
 6948|       |
 6949|       |  // here up -> Unit with first discarded digit
 6950|  7.05k|  cut=discard-(count-DECDPUN)-1;
  ------------------
  |  |   43|  7.05k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6951|  7.05k|  if (cut==DECDPUN-1) {       // unit-boundary case (fast)
  ------------------
  |  |   43|  7.05k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6951:7): [True: 2.22k, False: 4.83k]
  ------------------
 6952|  2.22k|    Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |   94|  2.22k|  #define Unit   decNumberUnit
  |  |  ------------------
  |  |  |  |   59|  2.22k|    #define decNumberUnit uint16_t
  |  |  ------------------
  ------------------
                  Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |  177|  2.22k|#define powers      DECPOWERS      // old internal name
  ------------------
                  Unit half=(Unit)powers[DECDPUN]>>1;
  ------------------
  |  |   43|  2.22k|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 6953|       |    // set residue directly
 6954|  2.22k|    if (*up>=half) {
  ------------------
  |  Branch (6954:9): [True: 675, False: 1.54k]
  ------------------
 6955|    675|      if (*up>half) *residue=7;
  ------------------
  |  Branch (6955:11): [True: 224, False: 451]
  ------------------
 6956|    451|      else *residue+=5;       // add sticky bit
 6957|    675|      }
 6958|  1.54k|     else { // <half
 6959|  1.54k|      if (*up!=0) *residue=3; // [else is 0, leave as sticky bit]
  ------------------
  |  Branch (6959:11): [True: 1.35k, False: 195]
  ------------------
 6960|  1.54k|      }
 6961|  2.22k|    if (set->digits<=0) {     // special for Quantize/Subnormal :-(
  ------------------
  |  Branch (6961:9): [True: 796, False: 1.42k]
  ------------------
 6962|    796|      *dn->lsu=0;             // .. result is 0
 6963|    796|      dn->digits=1;           // ..
 6964|    796|      }
 6965|  1.42k|     else {                   // shift to least
 6966|  1.42k|      count=set->digits;      // now digits to end up with
 6967|  1.42k|      dn->digits=count;       // set the new length
 6968|  1.42k|      up++;                   // move to next
 6969|       |      // on unit boundary, so shift-down copy loop is simple
 6970|  1.06M|      for (target=dn->lsu; count>0; target++, up++, count-=DECDPUN)
  ------------------
  |  |   43|  1.06M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
  |  Branch (6970:28): [True: 1.06M, False: 1.42k]
  ------------------
 6971|  1.06M|        *target=*up;
 6972|  1.42k|      }
 6973|  2.22k|    } // unit-boundary case
 6974|       |
 6975|  4.83k|   else { // discard digit is in low digit(s), and not top digit
 6976|  4.83k|    uInt  discard1;                // first discarded digit
  ------------------
  |  |   93|  4.83k|  #define uInt   uint32_t
  ------------------
 6977|  4.83k|    uInt  quot, rem;               // for divisions
  ------------------
  |  |   93|  4.83k|  #define uInt   uint32_t
  ------------------
 6978|  4.83k|    if (cut==0) quot=*up;          // is at bottom of unit
  ------------------
  |  Branch (6978:9): [True: 3.12k, False: 1.70k]
  ------------------
 6979|  1.70k|     else /* cut>0 */ {            // it's not at bottom of unit
 6980|  1.70k|      #if DECDPUN<=4
 6981|  1.70k|        quot=QUOT10(*up, cut);
  ------------------
  |  |  210|  1.70k|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 6982|  1.70k|        rem=*up-quot*powers[cut];
  ------------------
  |  |  177|  1.70k|#define powers      DECPOWERS      // old internal name
  ------------------
 6983|       |      #else
 6984|       |        rem=*up%powers[cut];
 6985|       |        quot=*up/powers[cut];
 6986|       |      #endif
 6987|  1.70k|      if (rem!=0) *residue=1;
  ------------------
  |  Branch (6987:11): [True: 435, False: 1.27k]
  ------------------
 6988|  1.70k|      }
 6989|       |    // discard digit is now at bottom of quot
 6990|  4.83k|    #if DECDPUN<=4
 6991|  4.83k|      temp=(quot*6554)>>16;        // fast /10
 6992|       |      // Vowels algorithm here not a win (9 instructions)
 6993|  4.83k|      discard1=quot-X10(temp);
  ------------------
  |  |  163|  4.83k|  #define X10(i)  (((i)<<1)+((i)<<3))
  ------------------
 6994|  4.83k|      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|  4.83k|    *residue+=resmap[discard1];
 7002|  4.83k|    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|  4.83k|    if (set->digits<=0) {          // special for Quantize/Subnormal :-(
  ------------------
  |  Branch (7006:9): [True: 788, False: 4.04k]
  ------------------
 7007|    788|      *dn->lsu=0;                  // .. result is 0
 7008|    788|      dn->digits=1;                // ..
 7009|    788|      }
 7010|  4.04k|     else {                        // shift to least needed
 7011|  4.04k|      count=set->digits;           // now digits to end up with
 7012|  4.04k|      dn->digits=count;            // set the new length
 7013|       |      // shift-copy the coefficient array to the result number
 7014|  7.11M|      for (target=dn->lsu; ; target++) {
 7015|  7.11M|        *target=(Unit)quot;
 7016|  7.11M|        count-=(DECDPUN-cut);
  ------------------
  |  |   43|  7.11M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7017|  7.11M|        if (count<=0) break;
  ------------------
  |  Branch (7017:13): [True: 2.72k, False: 7.11M]
  ------------------
 7018|  7.11M|        up++;
 7019|  7.11M|        quot=*up;
 7020|  7.11M|        #if DECDPUN<=4
 7021|  7.11M|          quot=QUOT10(quot, cut);
  ------------------
  |  |  210|  7.11M|  #define QUOT10(u, n) ((((uInt)(u)>>(n))*multies[n])>>17)
  ------------------
 7022|  7.11M|          rem=*up-quot*powers[cut];
  ------------------
  |  |  177|  7.11M|#define powers      DECPOWERS      // old internal name
  ------------------
 7023|       |        #else
 7024|       |          rem=quot%powers[cut];
 7025|       |          quot=quot/powers[cut];
 7026|       |        #endif
 7027|  7.11M|        *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
  ------------------
  |  |  177|  7.11M|#define powers      DECPOWERS      // old internal name
  ------------------
                      *target=(Unit)(*target+rem*powers[DECDPUN-cut]);
  ------------------
  |  |   43|  7.11M|  #define DECDPUN 3           /* DECimal Digits Per UNit [must be >0  */
  ------------------
 7028|  7.11M|        count-=cut;
 7029|  7.11M|        if (count<=0) break;
  ------------------
  |  Branch (7029:13): [True: 1.31k, False: 7.11M]
  ------------------
 7030|  7.11M|        } // shift-copy loop
 7031|  4.04k|      } // shift to least
 7032|  4.83k|    } // not unit boundary
 7033|       |
 7034|  7.05k|  if (*residue!=0) *status|=DEC_Inexact; // record inexactitude
  ------------------
  |  |  133|  5.80k|    #define DEC_Inexact              0x00000020
  ------------------
  |  Branch (7034:7): [True: 5.80k, False: 1.24k]
  ------------------
 7035|  7.05k|  return;
 7036|  7.33k|  } // decSetCoeff
decNumber.c:decFinalize:
 7275|  27.0k|                        uInt *status) {
 7276|  27.0k|  Int shift;                            // shift needed if clamping
  ------------------
  |  |   92|  27.0k|  #define Int    int32_t
  ------------------
 7277|  27.0k|  Int tinyexp=set->emin-dn->digits+1;   // precalculate subnormal boundary
  ------------------
  |  |   92|  27.0k|  #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.0k|  if (dn->exponent<=tinyexp) {          // prefilter
  ------------------
  |  Branch (7285:7): [True: 20.6k, False: 6.38k]
  ------------------
 7286|  20.6k|    Int comp;
  ------------------
  |  |   92|  20.6k|  #define Int    int32_t
  ------------------
 7287|  20.6k|    decNumber nmin;
 7288|       |    // A very nasty case here is dn == Nmin and residue<0
 7289|  20.6k|    if (dn->exponent<tinyexp) {
  ------------------
  |  Branch (7289:9): [True: 20.6k, False: 0]
  ------------------
 7290|       |      // Go handle subnormals; this will apply round if needed.
 7291|  20.6k|      decSetSubnormal(dn, set, residue, status);
 7292|  20.6k|      return;
 7293|  20.6k|      }
 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.38k|  if (*residue!=0) decApplyRound(dn, set, *residue, status);
  ------------------
  |  Branch (7311:7): [True: 0, False: 6.38k]
  ------------------
 7312|       |
 7313|       |  // Check for overflow [redundant in the 'rare' case] or clamp
 7314|  6.38k|  if (dn->exponent<=set->emax-set->digits+1) return;   // neither needed
  ------------------
  |  Branch (7314:7): [True: 5.15k, False: 1.22k]
  ------------------
 7315|       |
 7316|       |
 7317|       |  // here when might have an overflow or clamp to do
 7318|  1.22k|  if (dn->exponent>set->emax-dn->digits+1) {           // too big
  ------------------
  |  Branch (7318:7): [True: 903, False: 324]
  ------------------
 7319|    903|    decSetOverflow(dn, set, status);
 7320|    903|    return;
 7321|    903|    }
 7322|       |  // here when the result is normal but in clamp range
 7323|    324|  if (!set->clamp) return;
  ------------------
  |  Branch (7323:7): [True: 324, 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|    324|  } // decFinalize
decNumber.c:decSetSubnormal:
 7429|  20.6k|                            uInt *status) {
 7430|  20.6k|  decContext workset;         // work
 7431|  20.6k|  Int        etiny, adjust;   // ..
  ------------------
  |  |   92|  20.6k|  #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|  20.6k|  etiny=set->emin-(set->digits-1);      // smallest allowed exponent
 7446|       |
 7447|  20.6k|  if ISZERO(dn) {                       // value is zero
  ------------------
  |  |  255|  20.6k|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|  20.6k|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 14.4k, False: 6.19k]
  |  |  |  |  ------------------
  |  |  |  |  178|  20.6k|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 13.1k, False: 1.37k]
  |  |  |  |  ------------------
  |  |  |  |  179|  20.6k|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|  13.1k|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|  13.1k|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|  13.1k|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|  13.1k|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 13.1k, 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.1k|    if (dn->exponent<etiny) {           // clamp required
  ------------------
  |  Branch (7455:9): [True: 8.88k, False: 4.22k]
  ------------------
 7456|  8.88k|      dn->exponent=etiny;
 7457|  8.88k|      *status|=DEC_Clamped;
  ------------------
  |  |  140|  8.88k|    #define DEC_Clamped              0x00000400
  ------------------
 7458|  8.88k|      }
 7459|  13.1k|    return;
 7460|  13.1k|    }
 7461|       |
 7462|  7.57k|  *status|=DEC_Subnormal;               // have a non-zero subnormal
  ------------------
  |  |  142|  7.57k|    #define DEC_Subnormal            0x00001000
  ------------------
 7463|  7.57k|  adjust=etiny-dn->exponent;            // calculate digits to remove
 7464|  7.57k|  if (adjust<=0) {                      // not out of range; unrounded
  ------------------
  |  Branch (7464:7): [True: 232, False: 7.33k]
  ------------------
 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|    232|    if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  133|    232|    #define DEC_Inexact              0x00000020
  ------------------
                  if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  143|      0|    #define DEC_Underflow            0x00002000
  ------------------
  |  Branch (7468:9): [True: 0, False: 232]
  ------------------
 7469|    232|    return;
 7470|    232|    }
 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.33k|  workset=*set;                         // clone rounding, etc.
 7475|  7.33k|  workset.digits=dn->digits-adjust;     // set requested length
 7476|  7.33k|  workset.emin-=adjust;                 // and adjust emin to match
 7477|       |  // [note that the latter can be <1, here, similar to Rescale case]
 7478|  7.33k|  decSetCoeff(dn, &workset, dn->lsu, dn->digits, residue, status);
 7479|  7.33k|  decApplyRound(dn, &workset, *residue, status);
 7480|       |
 7481|       |  // Use 754 default rule: Underflow is set iff Inexact
 7482|       |  // [independent of whether trapped]
 7483|  7.33k|  if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  133|  7.33k|    #define DEC_Inexact              0x00000020
  ------------------
                if (*status&DEC_Inexact) *status|=DEC_Underflow;
  ------------------
  |  |  143|  6.09k|    #define DEC_Underflow            0x00002000
  ------------------
  |  Branch (7483:7): [True: 6.09k, False: 1.24k]
  ------------------
 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.33k|  if (dn->exponent>etiny) {
  ------------------
  |  Branch (7487:7): [True: 961, False: 6.37k]
  ------------------
 7488|    961|    dn->digits=decShiftToMost(dn->lsu, dn->digits, 1);
 7489|    961|    dn->exponent--;                     // (re)adjust the exponent.
 7490|    961|    }
 7491|       |
 7492|       |  // if rounded to zero, it is by definition clamped...
 7493|  7.33k|  if (ISZERO(dn)) *status|=DEC_Clamped;
  ------------------
  |  |  255|  7.33k|  #define ISZERO(dn) decNumberIsZero(dn)     /* now just a local name */
  |  |  ------------------
  |  |  |  |  177|  7.33k|  #define decNumberIsZero(dn)      (*(dn)->lsu==0 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (177:37): [True: 2.47k, False: 4.86k]
  |  |  |  |  ------------------
  |  |  |  |  178|  7.33k|                                    && (dn)->digits==1 \
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (178:40): [True: 655, False: 1.81k]
  |  |  |  |  ------------------
  |  |  |  |  179|  7.33k|                                    && (((dn)->bits&DECSPECIAL)==0))
  |  |  |  |  ------------------
  |  |  |  |  |  |   36|    655|  #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   32|    655|  #define DECINF    0x40      /* 1=Infinity                           */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   33|    655|  #define DECNAN    0x20      /* 1=NaN                                */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |                 #define DECSPECIAL (DECINF|DECNAN|DECSNAN) /* any special value     */
  |  |  |  |  |  |  ------------------
  |  |  |  |  |  |  |  |   34|    655|  #define DECSNAN   0x10      /* 1=sNaN                               */
  |  |  |  |  |  |  ------------------
  |  |  |  |  ------------------
  |  |  |  |  |  Branch (179:40): [True: 655, False: 0]
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
                if (ISZERO(dn)) *status|=DEC_Clamped;
  ------------------
  |  |  140|    655|    #define DEC_Clamped              0x00000400
  ------------------
 7494|  7.33k|  } // 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.1k, False: 13.0k]
  |  Branch (7669:25): [True: 8.19k, False: 24.9k]
  ------------------
 7670|       |    // *targ has a match in one (or both, if terminator)
 7671|  37.9k|    if (*targ=='\0') break;
  ------------------
  |  Branch (7671:9): [True: 5.36k, False: 32.6k]
  ------------------
 7672|  37.9k|    } // forever
 7673|  5.36k|  return 1;
 7674|  13.5k|  } // decBiStr
decNumber.c:decStatus:
 7741|  17.8k|static void decStatus(decNumber *dn, uInt status, decContext *set) {
 7742|  17.8k|  if (status & DEC_NaNs) {              // error status -> NaN
  ------------------
  |  |  187|  17.8k|  #define DEC_NaNs    DEC_IEEE_754_Invalid_operation
  |  |  ------------------
  |  |  |  |  173|  17.8k|  #define DEC_IEEE_754_Invalid_operation (DEC_Conversion_syntax |     \
  |  |  |  |  ------------------
  |  |  |  |  |  |  128|  17.8k|    #define DEC_Conversion_syntax    0x00000001
  |  |  |  |  ------------------
  |  |  |  |  174|  17.8k|                                          DEC_Division_impossible |   \
  |  |  |  |  ------------------
  |  |  |  |  |  |  130|  17.8k|    #define DEC_Division_impossible  0x00000004
  |  |  |  |  ------------------
  |  |  |  |  175|  17.8k|                                          DEC_Division_undefined |    \
  |  |  |  |  ------------------
  |  |  |  |  |  |  131|  17.8k|    #define DEC_Division_undefined   0x00000008
  |  |  |  |  ------------------
  |  |  |  |  176|  17.8k|                                          DEC_Insufficient_storage |  \
  |  |  |  |  ------------------
  |  |  |  |  |  |  132|  17.8k|    #define DEC_Insufficient_storage 0x00000010 /* [when malloc fails]  */
  |  |  |  |  ------------------
  |  |  |  |  177|  17.8k|                                          DEC_Invalid_context |       \
  |  |  |  |  ------------------
  |  |  |  |  |  |  134|  17.8k|    #define DEC_Invalid_context      0x00000040
  |  |  |  |  ------------------
  |  |  |  |  178|  17.8k|                                          DEC_Invalid_operation)
  |  |  |  |  ------------------
  |  |  |  |  |  |  135|  17.8k|    #define DEC_Invalid_operation    0x00000080
  |  |  |  |  ------------------
  |  |  ------------------
  ------------------
  |  Branch (7742:7): [True: 473, False: 17.3k]
  ------------------
 7743|       |    // if cause was an sNaN, clear and propagate [NaN is already set up]
 7744|    473|    if (status & DEC_sNaN) status&=~DEC_sNaN;
  ------------------
  |  |  193|    473|#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: 473]
  ------------------
 7745|    473|     else {
 7746|    473|      decNumberZero(dn);                // other error: clean throughout
 7747|    473|      dn->bits=DECNAN;                  // and make a quiet NaN
  ------------------
  |  |   33|    473|  #define DECNAN    0x20      /* 1=NaN                                */
  ------------------
 7748|    473|      }
 7749|    473|    }
 7750|  17.8k|  decContextSetStatus(set, status);     // [may not return]
 7751|  17.8k|  return;
 7752|  17.8k|  } // decStatus

