LLVMFuzzerTestOneInput:
   24|  9.83k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t *data, size_t size) {
   25|  9.83k|	FuzzedDataProvider fuzzed_data(data, size);
   26|       |
   27|  9.83k|	cctz::time_zone lax;
   28|  9.83k|	std::string tz = fuzzed_data.ConsumeRandomLengthString();
   29|  9.83k|	if (load_time_zone(tz, &lax)) {
  ------------------
  |  Branch (29:6): [True: 9.09k, False: 740]
  ------------------
   30|  9.09k|		std::chrono::system_clock::time_point tp;
   31|  9.09k|		std::string date_format = fuzzed_data.ConsumeRandomLengthString();
   32|  9.09k|		std::string parse_format = fuzzed_data.ConsumeRandomLengthString();
   33|  9.09k|		cctz::parse(parse_format, date_format, lax, &tp);
   34|       |
   35|  9.09k|		const auto t1 = cctz::convert(cctz::civil_second(
   36|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>(),
   37|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>(),
   38|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>(),
   39|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>(),
   40|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>(),
   41|  9.09k|				fuzzed_data.ConsumeIntegral<uint32_t>()), lax);
   42|  9.09k|		std::string format = fuzzed_data.ConsumeRandomLengthString();
   43|  9.09k|		cctz::format(format, t1, lax);
   44|  9.09k|	}
   45|       |
   46|  9.83k|	return 0;
   47|  9.83k|}

_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2Ellllll:
  359|  20.1k|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZN4cctz6detail4impl5n_secEllllll:
  213|   702k|                         diff_t ss) noexcept {
  214|       |  // Optimization for when (non-constexpr) fields are already normalized.
  215|   702k|  if (0 <= ss && ss < 60) {
  ------------------
  |  Branch (215:7): [True: 570k, False: 132k]
  |  Branch (215:18): [True: 563k, False: 6.60k]
  ------------------
  216|   563k|    const second_t nss = static_cast<second_t>(ss);
  217|   563k|    if (0 <= mm && mm < 60) {
  ------------------
  |  Branch (217:9): [True: 552k, False: 11.6k]
  |  Branch (217:20): [True: 83.4k, False: 468k]
  ------------------
  218|  83.4k|      const minute_t nmm = static_cast<minute_t>(mm);
  219|  83.4k|      if (0 <= hh && hh < 24) {
  ------------------
  |  Branch (219:11): [True: 83.4k, False: 0]
  |  Branch (219:22): [True: 83.3k, False: 84]
  ------------------
  220|  83.3k|        const hour_t nhh = static_cast<hour_t>(hh);
  221|  83.3k|        if (1 <= d && d <= 28 && 1 <= m && m <= 12) {
  ------------------
  |  Branch (221:13): [True: 76.7k, False: 6.65k]
  |  Branch (221:23): [True: 51.3k, False: 25.3k]
  |  Branch (221:34): [True: 51.3k, False: 9]
  |  Branch (221:44): [True: 51.2k, False: 124]
  ------------------
  222|  51.2k|          const day_t nd = static_cast<day_t>(d);
  223|  51.2k|          const month_t nm = static_cast<month_t>(m);
  224|  51.2k|          return fields(y, nm, nd, nhh, nmm, nss);
  225|  51.2k|        }
  226|  32.1k|        return n_mon(y, m, d, 0, nhh, nmm, nss);
  227|  83.3k|      }
  228|     84|      return n_hour(y, m, d, hh / 24, hh % 24, nmm, nss);
  229|  83.4k|    }
  230|   480k|    return n_min(y, m, d, hh, mm / 60, mm % 60, nss);
  231|   563k|  }
  232|   138k|  diff_t cm = ss / 60;
  233|   138k|  ss %= 60;
  234|   138k|  if (ss < 0) {
  ------------------
  |  Branch (234:7): [True: 132k, False: 6.60k]
  ------------------
  235|   132k|    cm -= 1;
  236|   132k|    ss += 60;
  237|   132k|  }
  238|   138k|  return n_min(y, m, d, hh, mm / 60 + cm / 60, mm % 60 + cm % 60,
  239|   138k|               static_cast<second_t>(ss));
  240|   702k|}
_ZN4cctz6detail6fieldsC2Elaaaaa:
   56|  1.07M|      : y(year), m(month), d(day), hh(hour), mm(minute), ss(second) {}
_ZN4cctz6detail4impl5n_monEllllaaa:
  180|   651k|                         hour_t hh, minute_t mm, second_t ss) noexcept {
  181|   651k|  if (m != 12) {
  ------------------
  |  Branch (181:7): [True: 647k, False: 4.11k]
  ------------------
  182|   647k|    y += m / 12;
  183|   647k|    m %= 12;
  184|   647k|    if (m <= 0) {
  ------------------
  |  Branch (184:9): [True: 6.95k, False: 640k]
  ------------------
  185|  6.95k|      y -= 1;
  186|  6.95k|      m += 12;
  187|  6.95k|    }
  188|   647k|  }
  189|   651k|  return n_day(y, static_cast<month_t>(m), d, cd, hh, mm, ss);
  190|   651k|}
_ZN4cctz6detail4impl5n_dayElallaaa:
  114|   660k|                         hour_t hh, minute_t mm, second_t ss) noexcept {
  115|   660k|  year_t ey = y % 400;
  116|   660k|  const year_t oey = ey;
  117|   660k|  ey += (cd / 146097) * 400;
  118|   660k|  cd %= 146097;
  119|   660k|  if (cd < 0) {
  ------------------
  |  Branch (119:7): [True: 15.7k, False: 644k]
  ------------------
  120|  15.7k|    ey -= 400;
  121|  15.7k|    cd += 146097;
  122|  15.7k|  }
  123|   660k|  ey += (d / 146097) * 400;
  124|   660k|  d = d % 146097 + cd;
  125|   660k|  if (d > 0) {
  ------------------
  |  Branch (125:7): [True: 653k, False: 6.68k]
  ------------------
  126|   653k|    if (d > 146097) {
  ------------------
  |  Branch (126:9): [True: 1.44k, False: 652k]
  ------------------
  127|  1.44k|      ey += 400;
  128|  1.44k|      d -= 146097;
  129|  1.44k|    }
  130|   653k|  } else {
  131|  6.68k|    if (d > -365) {
  ------------------
  |  Branch (131:9): [True: 6.68k, False: 0]
  ------------------
  132|       |      // We often hit the previous year when stepping a civil time backwards,
  133|       |      // so special case it to avoid counting up by 100/4/1-year chunks.
  134|  6.68k|      ey -= 1;
  135|  6.68k|      d += days_per_year(ey, m);
  136|  6.68k|    } else {
  137|      0|      ey -= 400;
  138|      0|      d += 146097;
  139|      0|    }
  140|  6.68k|  }
  141|   660k|  if (d > 365) {
  ------------------
  |  Branch (141:7): [True: 281k, False: 379k]
  ------------------
  142|   281k|    int yi = year_index(ey, m);  // Index into Gregorian 400 year cycle.
  143|   657k|    for (;;) {
  144|   657k|      int n = days_per_century(yi);
  145|   657k|      if (d <= n) break;
  ------------------
  |  Branch (145:11): [True: 281k, False: 375k]
  ------------------
  146|   375k|      d -= n;
  147|   375k|      ey += 100;
  148|   375k|      yi += 100;
  149|   375k|      if (yi >= 400) yi -= 400;
  ------------------
  |  Branch (149:11): [True: 172k, False: 202k]
  ------------------
  150|   375k|    }
  151|  3.69M|    for (;;) {
  152|  3.69M|      int n = days_per_4years(yi);
  153|  3.69M|      if (d <= n) break;
  ------------------
  |  Branch (153:11): [True: 281k, False: 3.41M]
  ------------------
  154|  3.41M|      d -= n;
  155|  3.41M|      ey += 4;
  156|  3.41M|      yi += 4;
  157|  3.41M|      if (yi >= 400) yi -= 400;
  ------------------
  |  Branch (157:11): [True: 69.0k, False: 3.34M]
  ------------------
  158|  3.41M|    }
  159|   716k|    for (;;) {
  160|   716k|      int n = days_per_year(ey, m);
  161|   716k|      if (d <= n) break;
  ------------------
  |  Branch (161:11): [True: 281k, False: 435k]
  ------------------
  162|   435k|      d -= n;
  163|   435k|      ++ey;
  164|   435k|    }
  165|   281k|  }
  166|   660k|  if (d > 28) {
  ------------------
  |  Branch (166:7): [True: 449k, False: 211k]
  ------------------
  167|  2.10M|    for (;;) {
  168|  2.10M|      int n = days_per_month(ey, m);
  169|  2.10M|      if (d <= n) break;
  ------------------
  |  Branch (169:11): [True: 449k, False: 1.65M]
  ------------------
  170|  1.65M|      d -= n;
  171|  1.65M|      if (++m > 12) {
  ------------------
  |  Branch (171:11): [True: 8.47k, False: 1.64M]
  ------------------
  172|  8.47k|        ++ey;
  173|  8.47k|        m = 1;
  174|  8.47k|      }
  175|  1.65M|    }
  176|   449k|  }
  177|   660k|  return fields(y + (ey - oey), m, static_cast<day_t>(d), hh, mm, ss);
  178|   660k|}
_ZN4cctz6detail4impl13days_per_yearEla:
   91|   723k|CONSTEXPR_F int days_per_year(year_t y, month_t m) noexcept {
   92|   723k|  return is_leap_year(y + (m > 2)) ? 366 : 365;
  ------------------
  |  Branch (92:10): [True: 144k, False: 578k]
  ------------------
   93|   723k|}
_ZN4cctz6detail4impl12is_leap_yearEl:
   78|  1.01M|CONSTEXPR_F bool is_leap_year(year_t y) noexcept {
   79|  1.01M|  return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
  ------------------
  |  Branch (79:10): [True: 218k, False: 791k]
  |  Branch (79:25): [True: 205k, False: 13.3k]
  |  Branch (79:41): [True: 7.71k, False: 5.59k]
  ------------------
   80|  1.01M|}
_ZN4cctz6detail4impl10year_indexEla:
   81|   281k|CONSTEXPR_F int year_index(year_t y, month_t m) noexcept {
   82|   281k|  const int yi = static_cast<int>((y + (m > 2)) % 400);
   83|   281k|  return yi < 0 ? yi + 400 : yi;
  ------------------
  |  Branch (83:10): [True: 14.8k, False: 266k]
  ------------------
   84|   281k|}
_ZN4cctz6detail4impl16days_per_centuryEi:
   85|   657k|CONSTEXPR_F int days_per_century(int yi) noexcept {
   86|   657k|  return 36524 + (yi == 0 || yi > 300);
  ------------------
  |  Branch (86:19): [True: 681, False: 656k]
  |  Branch (86:30): [True: 278k, False: 377k]
  ------------------
   87|   657k|}
_ZN4cctz6detail4impl15days_per_4yearsEi:
   88|  3.69M|CONSTEXPR_F int days_per_4years(int yi) noexcept {
   89|  3.69M|  return 1460 + (yi == 0 || yi > 300 || (yi - 1) % 100 < 96);
  ------------------
  |  Branch (89:18): [True: 1.06k, False: 3.69M]
  |  Branch (89:29): [True: 1.18M, False: 2.51M]
  |  Branch (89:41): [True: 2.38M, False: 126k]
  ------------------
   90|  3.69M|}
_ZN4cctz6detail4impl14days_per_monthEla:
  106|  2.10M|CONSTEXPR_F int days_per_month(year_t y, month_t m) noexcept {
  107|  2.10M|  CONSTEXPR_D int k_days_per_month[1 + 12] = {
  ------------------
  |  |   25|  2.10M|#define CONSTEXPR_D constexpr  // data
  ------------------
  108|  2.10M|      -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31  // non leap year
  109|  2.10M|  };
  110|  2.10M|  return k_days_per_month[m] + (m == 2 && is_leap_year(y));
  ------------------
  |  Branch (110:33): [True: 278k, False: 1.82M]
  |  Branch (110:43): [True: 67.5k, False: 210k]
  ------------------
  111|  2.10M|}
_ZN4cctz6detail4impl6n_hourElllllaa:
  192|   619k|                          diff_t hh, minute_t mm, second_t ss) noexcept {
  193|   619k|  cd += hh / 24;
  194|   619k|  hh %= 24;
  195|   619k|  if (hh < 0) {
  ------------------
  |  Branch (195:7): [True: 7.33k, False: 611k]
  ------------------
  196|  7.33k|    cd -= 1;
  197|  7.33k|    hh += 24;
  198|  7.33k|  }
  199|   619k|  return n_mon(y, m, d, cd, static_cast<hour_t>(hh), mm, ss);
  200|   619k|}
_ZN4cctz6detail4impl5n_minElllllla:
  202|   619k|                         diff_t mm, second_t ss) noexcept {
  203|   619k|  ch += mm / 60;
  204|   619k|  mm %= 60;
  205|   619k|  if (mm < 0) {
  ------------------
  |  Branch (205:7): [True: 132k, False: 486k]
  ------------------
  206|   132k|    ch -= 1;
  207|   132k|    mm += 60;
  208|   132k|  }
  209|   619k|  return n_hour(y, m, d, hh / 24 + ch / 24, hh % 24 + ch % 24,
  210|   619k|                static_cast<minute_t>(mm), ss);
  211|   619k|}
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2ENS0_6fieldsE:
  446|   702k|  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
_ZN4cctz6detail5alignENS0_10second_tagENS0_6fieldsE:
  332|   702k|CONSTEXPR_F fields align(second_tag, fields f) noexcept {
  333|   702k|  return f;
  334|   702k|}
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE4yearEv:
  392|   787k|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE5monthEv:
  393|   219k|  CONSTEXPR_M int month() const noexcept { return f_.m; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE3dayEv:
  394|  51.2k|  CONSTEXPR_M int day() const noexcept { return f_.d; }
_ZN4cctz6detailplENS0_10civil_timeINS0_7day_tagEEEl:
  424|    654|  friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
  425|    654|    return civil_time(step(T{}, a.f_, n));
  426|    654|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_7day_tagEEEl:
  430|  8.27k|  friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
  431|  8.27k|    return n != (std::numeric_limits<diff_t>::min)()
  ------------------
  |  Branch (431:12): [True: 8.27k, False: 0]
  ------------------
  432|  8.27k|               ? civil_time(step(T{}, a.f_, -n))
  433|  8.27k|               : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
  434|  8.27k|  }
_ZN4cctz6detail4stepENS0_10second_tagENS0_6fieldsEl:
  247|   674k|CONSTEXPR_F fields step(second_tag, fields f, diff_t n) noexcept {
  248|   674k|  return impl::n_sec(f.y, f.m, f.d, f.hh, f.mm + n / 60, f.ss + n % 60);
  249|   674k|}
_ZN4cctz6detail4stepENS0_7day_tagENS0_6fieldsEl:
  256|  8.92k|CONSTEXPR_F fields step(day_tag, fields f, diff_t n) noexcept {
  257|  8.92k|  return impl::n_day(f.y, f.m, f.d, n, f.hh, f.mm, f.ss);
  258|  8.92k|}
_ZN4cctz6detail4impl9scale_addElll:
  271|  42.8k|CONSTEXPR_F diff_t scale_add(diff_t v, diff_t f, diff_t a) noexcept {
  272|  42.8k|  return (v < 0) ? ((v + 1) * f + a) - f : ((v - 1) * f + a) + f;
  ------------------
  |  Branch (272:10): [True: 6.78k, False: 36.0k]
  ------------------
  273|  42.8k|}
_ZN4cctz6detail4impl7ymd_ordElaa:
  277|  43.8k|CONSTEXPR_F diff_t ymd_ord(year_t y, month_t m, day_t d) noexcept {
  278|  43.8k|  const diff_t eyear = (m <= 2) ? y - 1 : y;
  ------------------
  |  Branch (278:24): [True: 11.1k, False: 32.6k]
  ------------------
  279|  43.8k|  const diff_t era = (eyear >= 0 ? eyear : eyear - 399) / 400;
  ------------------
  |  Branch (279:23): [True: 29.9k, False: 13.8k]
  ------------------
  280|  43.8k|  const diff_t yoe = eyear - era * 400;
  281|  43.8k|  const diff_t doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1;
  ------------------
  |  Branch (281:35): [True: 32.6k, False: 11.1k]
  ------------------
  282|  43.8k|  const diff_t doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
  283|  43.8k|  return era * 146097 + doe - 719468;
  284|  43.8k|}
_ZN4cctz6detail4impl14day_differenceElaalaa:
  292|  21.9k|                                  year_t y2, month_t m2, day_t d2) noexcept {
  293|  21.9k|  const diff_t a_c4_off = y1 % 400;
  294|  21.9k|  const diff_t b_c4_off = y2 % 400;
  295|  21.9k|  diff_t c4_diff = (y1 - a_c4_off) - (y2 - b_c4_off);
  296|  21.9k|  diff_t delta = ymd_ord(a_c4_off, m1, d1) - ymd_ord(b_c4_off, m2, d2);
  297|  21.9k|  if (c4_diff > 0 && delta < 0) {
  ------------------
  |  Branch (297:7): [True: 8.65k, False: 13.2k]
  |  Branch (297:22): [True: 645, False: 8.00k]
  ------------------
  298|    645|    delta += 2 * 146097;
  299|    645|    c4_diff -= 2 * 400;
  300|  21.2k|  } else if (c4_diff < 0 && delta > 0) {
  ------------------
  |  Branch (300:14): [True: 2.19k, False: 19.0k]
  |  Branch (300:29): [True: 12, False: 2.18k]
  ------------------
  301|     12|    delta -= 2 * 146097;
  302|     12|    c4_diff += 2 * 400;
  303|     12|  }
  304|  21.9k|  return (c4_diff / 400 * 146097) + delta;
  305|  21.9k|}
_ZN4cctz6detail10differenceENS0_7day_tagENS0_6fieldsES2_:
  316|  21.9k|CONSTEXPR_F diff_t difference(day_tag, fields f1, fields f2) noexcept {
  317|  21.9k|  return impl::day_difference(f1.y, f1.m, f1.d, f2.y, f2.m, f2.d);
  318|  21.9k|}
_ZN4cctz6detail10differenceENS0_8hour_tagENS0_6fieldsES2_:
  319|  14.2k|CONSTEXPR_F diff_t difference(hour_tag, fields f1, fields f2) noexcept {
  320|  14.2k|  return impl::scale_add(difference(day_tag{}, f1, f2), 24, (f1.hh - f2.hh));
  321|  14.2k|}
_ZN4cctz6detail10differenceENS0_10minute_tagENS0_6fieldsES2_:
  322|  14.2k|CONSTEXPR_F diff_t difference(minute_tag, fields f1, fields f2) noexcept {
  323|  14.2k|  return impl::scale_add(difference(hour_tag{}, f1, f2), 60, (f1.mm - f2.mm));
  324|  14.2k|}
_ZN4cctz6detail10differenceENS0_10second_tagENS0_6fieldsES2_:
  325|  14.2k|CONSTEXPR_F diff_t difference(second_tag, fields f1, fields f2) noexcept {
  326|  14.2k|  return impl::scale_add(difference(minute_tag{}, f1, f2), 60, f1.ss - f2.ss);
  327|  14.2k|}
_ZN4cctz6detail5alignENS0_7day_tagENS0_6fieldsE:
  341|  32.1k|CONSTEXPR_F fields align(day_tag, fields f) noexcept {
  342|  32.1k|  return fields{f.y, f.m, f.d, 0, 0, 0};
  343|  32.1k|}
_ZN4cctz6detail5alignENS0_8year_tagENS0_6fieldsE:
  347|  7.94k|CONSTEXPR_F fields align(year_tag, fields f) noexcept {
  348|  7.94k|  return fields{f.y, 1, 1, 0, 0, 0};
  349|  7.94k|}
_ZN4cctz6detail11get_weekdayERKNS0_10civil_timeINS0_10second_tagEEE:
  522|  17.5k|CONSTEXPR_F weekday get_weekday(const civil_second& cs) noexcept {
  523|  17.5k|  CONSTEXPR_D weekday k_weekday_by_mon_off[13] = {
  ------------------
  |  |   25|  17.5k|#define CONSTEXPR_D constexpr  // data
  ------------------
  524|  17.5k|      weekday::monday,    weekday::tuesday,  weekday::wednesday,
  525|  17.5k|      weekday::thursday,  weekday::friday,   weekday::saturday,
  526|  17.5k|      weekday::sunday,    weekday::monday,   weekday::tuesday,
  527|  17.5k|      weekday::wednesday, weekday::thursday, weekday::friday,
  528|  17.5k|      weekday::saturday,
  529|  17.5k|  };
  530|  17.5k|  CONSTEXPR_D int k_weekday_offsets[1 + 12] = {
  ------------------
  |  |   25|  17.5k|#define CONSTEXPR_D constexpr  // data
  ------------------
  531|  17.5k|      -1, 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4,
  532|  17.5k|  };
  533|  17.5k|  year_t wd = 2400 + (cs.year() % 400) - (cs.month() < 3);
  534|  17.5k|  wd += wd / 4 - wd / 100 + wd / 400;
  535|  17.5k|  wd += k_weekday_offsets[cs.month()] + cs.day();
  536|  17.5k|  return k_weekday_by_mon_off[wd % 7 + 6];
  537|  17.5k|}
_ZN4cctz6detail12next_weekdayENS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  541|    327|CONSTEXPR_F civil_day next_weekday(civil_day cd, weekday wd) noexcept {
  542|    327|  CONSTEXPR_D weekday k_weekdays_forw[14] = {
  ------------------
  |  |   25|    327|#define CONSTEXPR_D constexpr  // data
  ------------------
  543|    327|      weekday::monday,    weekday::tuesday,  weekday::wednesday,
  544|    327|      weekday::thursday,  weekday::friday,   weekday::saturday,
  545|    327|      weekday::sunday,    weekday::monday,   weekday::tuesday,
  546|    327|      weekday::wednesday, weekday::thursday, weekday::friday,
  547|    327|      weekday::saturday,  weekday::sunday,
  548|    327|  };
  549|    327|  weekday base = get_weekday(cd);
  550|  2.09k|  for (int i = 0;; ++i) {
  551|  2.09k|    if (base == k_weekdays_forw[i]) {
  ------------------
  |  Branch (551:9): [True: 327, False: 1.77k]
  ------------------
  552|  1.44k|      for (int j = i + 1;; ++j) {
  553|  1.44k|        if (wd == k_weekdays_forw[j]) {
  ------------------
  |  Branch (553:13): [True: 327, False: 1.11k]
  ------------------
  554|    327|          return cd + (j - i);
  555|    327|        }
  556|  1.44k|      }
  557|    327|    }
  558|  2.09k|  }
  559|    327|}
_ZN4cctz6detail12prev_weekdayENS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  561|  7.94k|CONSTEXPR_F civil_day prev_weekday(civil_day cd, weekday wd) noexcept {
  562|  7.94k|  CONSTEXPR_D weekday k_weekdays_back[14] = {
  ------------------
  |  |   25|  7.94k|#define CONSTEXPR_D constexpr  // data
  ------------------
  563|  7.94k|      weekday::sunday,   weekday::saturday,  weekday::friday,
  564|  7.94k|      weekday::thursday, weekday::wednesday, weekday::tuesday,
  565|  7.94k|      weekday::monday,   weekday::sunday,    weekday::saturday,
  566|  7.94k|      weekday::friday,   weekday::thursday,  weekday::wednesday,
  567|  7.94k|      weekday::tuesday,  weekday::monday,
  568|  7.94k|  };
  569|  7.94k|  weekday base = get_weekday(cd);
  570|  39.4k|  for (int i = 0;; ++i) {
  571|  39.4k|    if (base == k_weekdays_back[i]) {
  ------------------
  |  Branch (571:9): [True: 7.94k, False: 31.4k]
  ------------------
  572|  23.0k|      for (int j = i + 1;; ++j) {
  573|  23.0k|        if (wd == k_weekdays_back[j]) {
  ------------------
  |  Branch (573:13): [True: 7.94k, False: 15.1k]
  ------------------
  574|  7.94k|          return cd - (j - i);
  575|  7.94k|        }
  576|  23.0k|      }
  577|  7.94k|    }
  578|  39.4k|  }
  579|  7.94k|}
_ZN4cctz6detail11get_yeardayERKNS0_10civil_timeINS0_10second_tagEEE:
  581|  9.09k|CONSTEXPR_F int get_yearday(const civil_second& cs) noexcept {
  582|  9.09k|  CONSTEXPR_D int k_month_offsets[1 + 12] = {
  ------------------
  |  |   25|  9.09k|#define CONSTEXPR_D constexpr  // data
  ------------------
  583|  9.09k|      -1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
  584|  9.09k|  };
  585|  9.09k|  const int feb29 = (cs.month() > 2 && impl::is_leap_year(cs.year()));
  ------------------
  |  Branch (585:22): [True: 8.60k, False: 496]
  |  Branch (585:40): [True: 734, False: 7.86k]
  ------------------
  586|  9.09k|  return k_month_offsets[cs.month()] + feb29 + cs.day();
  587|  9.09k|}
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE4yearEv:
  392|  7.94k|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE5monthEv:
  393|  7.94k|  CONSTEXPR_M int month() const noexcept { return f_.m; }
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE3dayEv:
  394|  7.94k|  CONSTEXPR_M int day() const noexcept { return f_.d; }
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2Ellllll:
  359|  7.62k|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2ENS0_6fieldsE:
  446|  32.1k|  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
_ZN4cctz6detailmiENS0_10civil_timeINS0_7day_tagEEES3_:
  435|  7.62k|  friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
  436|  7.62k|    return difference(T{}, lhs.f_, rhs.f_);
  437|  7.62k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2INS0_7day_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS2_S6_EE5valueEvE4typeE:
  375|  8.27k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2INS0_7day_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS6_S2_EE5valueEvE4typeE:
  379|  7.62k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2ENS0_6fieldsE:
  446|  7.94k|  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2INS0_8year_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS2_S6_EE5valueEvE4typeE:
  375|  7.94k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2INS0_10second_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS6_S2_EE5valueEvE4typeE:
  379|  7.62k|      : civil_time(ct.f_) {}
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE4hourEv:
  395|  16.2k|  CONSTEXPR_M int hour() const noexcept { return f_.hh; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE6minuteEv:
  396|  15.3k|  CONSTEXPR_M int minute() const noexcept { return f_.mm; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE6secondEv:
  397|  25.6k|  CONSTEXPR_M int second() const noexcept { return f_.ss; }
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2Ellllll:
  359|    327|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZNK4cctz6detail10civil_timeINS0_8year_tagEE4yearEv:
  392|    327|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZN4cctz6detailgtINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  494|  6.45k|                           const civil_time<T2>& rhs) noexcept {
  495|  6.45k|  return rhs < lhs;
  496|  6.45k|}
_ZN4cctz6detailplENS0_10civil_timeINS0_10second_tagEEEl:
  424|   536k|  friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
  425|   536k|    return civil_time(step(T{}, a.f_, n));
  426|   536k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEE3maxEv:
  382|    329|  static CONSTEXPR_F auto (max)() -> civil_time {
  383|    329|    const auto max_year = (std::numeric_limits<std::int_least64_t>::max)();
  384|    329|    return civil_time(max_year, 12, 31, 23, 59, 59);
  385|    329|  }
_ZN4cctz6detailltINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  469|   237k|                           const civil_time<T2>& rhs) noexcept {
  470|   237k|  return (lhs.year() < rhs.year() ||
  ------------------
  |  Branch (470:11): [True: 115k, False: 121k]
  ------------------
  471|   121k|          (lhs.year() == rhs.year() &&
  ------------------
  |  Branch (471:12): [True: 69.7k, False: 52.0k]
  ------------------
  472|  69.7k|           (lhs.month() < rhs.month() ||
  ------------------
  |  Branch (472:13): [True: 66.3k, False: 3.47k]
  ------------------
  473|  3.47k|            (lhs.month() == rhs.month() &&
  ------------------
  |  Branch (473:14): [True: 1.15k, False: 2.31k]
  ------------------
  474|  1.15k|             (lhs.day() < rhs.day() ||
  ------------------
  |  Branch (474:15): [True: 244, False: 913]
  ------------------
  475|    913|              (lhs.day() == rhs.day() &&
  ------------------
  |  Branch (475:16): [True: 625, False: 288]
  ------------------
  476|    625|               (lhs.hour() < rhs.hour() ||
  ------------------
  |  Branch (476:17): [True: 105, False: 520]
  ------------------
  477|    520|                (lhs.hour() == rhs.hour() &&
  ------------------
  |  Branch (477:18): [True: 388, False: 132]
  ------------------
  478|    388|                 (lhs.minute() < rhs.minute() ||
  ------------------
  |  Branch (478:19): [True: 56, False: 332]
  ------------------
  479|    332|                  (lhs.minute() == rhs.minute() &&
  ------------------
  |  Branch (479:20): [True: 146, False: 186]
  ------------------
  480|    146|                   (lhs.second() < rhs.second())))))))))));
  ------------------
  |  Branch (480:20): [True: 32, False: 114]
  ------------------
  481|   237k|}
_ZN4cctz6detail10civil_timeINS0_10second_tagEE3minEv:
  386|    310|  static CONSTEXPR_F auto (min)() -> civil_time {
  387|    310|    const auto min_year = (std::numeric_limits<std::int_least64_t>::min)();
  388|    310|    return civil_time(min_year, 1, 1, 0, 0, 0);
  389|    310|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEmIEl:
  403|  6.11k|  CONSTEXPR_M civil_time& operator-=(diff_t n) noexcept {
  404|  6.11k|    return *this = *this - n;
  405|  6.11k|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_10second_tagEEEl:
  430|   138k|  friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
  431|   138k|    return n != (std::numeric_limits<diff_t>::min)()
  ------------------
  |  Branch (431:12): [True: 138k, False: 0]
  ------------------
  432|   138k|               ? civil_time(step(T{}, a.f_, -n))
  433|   138k|               : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
  434|   138k|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_10second_tagEEES3_:
  435|  14.2k|  friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
  436|  14.2k|    return difference(T{}, lhs.f_, rhs.f_);
  437|  14.2k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2Ev:
  361|   323k|  CONSTEXPR_M civil_time() noexcept : f_{1970, 1, 1, 0, 0, 0} {}
_ZN4cctz6detailgeINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  489|  14.5k|                            const civil_time<T2>& rhs) noexcept {
  490|  14.5k|  return !(lhs < rhs);
  491|  14.5k|}
_ZN4cctz6detailleINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  484|  19.1k|                            const civil_time<T2>& rhs) noexcept {
  485|  19.1k|  return !(rhs < lhs);
  486|  19.1k|}

_ZN4cctz9time_zoneC2Ev:
   68|  9.83k|  time_zone() : time_zone(nullptr) {}  // Equivalent to UTC
_ZN4cctz9time_zoneC2EPKNS0_4ImplE:
  220|  19.8k|  explicit time_zone(const Impl* impl) : impl_(impl) {}
_ZN4cctz7convertERKNS_6detail10civil_timeINS0_10second_tagEEERKNS_9time_zoneE:
  257|  9.09k|                                   const time_zone& tz) {
  258|  9.09k|  const time_zone::civil_lookup cl = tz.lookup(cs);
  259|  9.09k|  if (cl.kind == time_zone::civil_lookup::SKIPPED) return cl.trans;
  ------------------
  |  Branch (259:7): [True: 13, False: 9.08k]
  ------------------
  260|  9.08k|  return cl.pre;
  261|  9.09k|}
_ZN4cctz5parseIxNSt3__15ratioILl1ELl1000000EEEEEbRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEESB_RKNS_9time_zoneEPNS1_6chrono10time_pointINSF_12system_clockENSF_8durationIT_T0_EEEE:
  379|  9.09k|           time_point<std::chrono::duration<Rep, Period>>* tpp) {
  380|  9.09k|  time_point<seconds> sec;
  381|  9.09k|  detail::femtoseconds fs;
  382|  9.09k|  if (!detail::parse(fmt, input, tz, &sec, &fs)) return false;
  ------------------
  |  Branch (382:7): [True: 3.08k, False: 6.00k]
  ------------------
  383|       |
  384|  6.00k|  time_point<std::chrono::duration<Rep, typename Period::type>> tp;
  385|  6.00k|  if (!detail::join_seconds(sec, fs, &tp)) return false;
  ------------------
  |  Branch (385:7): [True: 1.06k, False: 4.93k]
  ------------------
  386|       |
  387|  4.93k|  *tpp = tp;
  388|  4.93k|  return true;
  389|  6.00k|}
_ZN4cctz6detail12join_secondsIxLl1000000EEENSt3__19enable_ifIXsr3std11is_integralIT_EE5valueEbE4typeERKNS2_6chrono10time_pointINS7_12system_clockENS7_8durationIlNS2_5ratioILl1ELl1EEEEEEERKNSA_IlNSB_ILl1ELl1000000000000000EEEEEPNS8_IS9_NSA_IS4_NSB_ILl1EXT0_EEEEEEE:
  427|  6.00k|    time_point<std::chrono::duration<Rep, std::ratio<1, Denom>>>* tpp) {
  428|  6.00k|  using D = std::chrono::duration<Rep, std::ratio<1, Denom>>;
  429|  6.00k|  using D_check = std::chrono::duration<std::intmax_t, std::ratio<1, Denom>>;
  430|  6.00k|  const std::intmax_t count = sec.time_since_epoch().count();
  431|  6.00k|  const auto sub =
  432|  6.00k|      std::chrono::duration_cast<D_check>(fs).count();  // [0, Denom)
  433|       |
  434|       |  // Check for overflow.
  435|  6.00k|  if (sub > (std::numeric_limits<Rep>::max)()) {
  ------------------
  |  Branch (435:7): [True: 0, False: 6.00k]
  ------------------
  436|       |    // If subseconds alone exceed the max representable value, any non-negative
  437|       |    // seconds count will cause overflow. Negative seconds might bring it back
  438|       |    // into range, which is handled by the underflow check below.
  439|      0|    if (count >= 0) return false;
  ------------------
  |  Branch (439:9): [True: 0, False: 0]
  ------------------
  440|  6.00k|  } else {
  441|       |    // Equivalent to: count * Denom + sub > max, but safe from overflow.
  442|  6.00k|    if (count > ((std::numeric_limits<Rep>::max)() - sub) / Denom) return false;
  ------------------
  |  Branch (442:9): [True: 442, False: 5.56k]
  ------------------
  443|  6.00k|  }
  444|       |
  445|       |  // Check for underflow.
  446|       |  // Equivalent to: count * Denom + sub < lowest, but safe from underflow.
  447|       |  // We cannot use "lowest - sub" directly as it would underflow.
  448|  5.56k|  const auto min_div = (std::numeric_limits<Rep>::lowest)() / Denom;
  449|  5.56k|  if (count < min_div) {
  ------------------
  |  Branch (449:7): [True: 626, False: 4.93k]
  ------------------
  450|       |    // If count is less than min_div - 1, it's definitely underflow.
  451|    626|    if (count < min_div - 1) return false;
  ------------------
  |  Branch (451:9): [True: 626, False: 0]
  ------------------
  452|       |    // If count is exactly min_div - 1, we must check if subseconds are
  453|       |    // sufficient to bring the total value back above lowest.
  454|      0|    const auto min_mod = (std::numeric_limits<Rep>::lowest)() % Denom;
  455|      0|    if (sub < Denom + min_mod) return false;
  ------------------
  |  Branch (455:9): [True: 0, False: 0]
  ------------------
  456|      0|    *tpp =
  457|      0|        time_point<D>() + D{static_cast<Rep>(min_div * Denom + (sub - Denom))};
  458|      0|    return true;
  459|      0|  }
  460|  4.93k|  *tpp = time_point<D>() + D{static_cast<Rep>(count * Denom + sub)};
  461|  4.93k|  return true;
  462|  5.56k|}
_ZN4cctz6formatINSt3__16chrono8durationIlNS1_5ratioILl1ELl1EEEEEEENS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKSC_RKNS2_10time_pointINS2_12system_clockET_EERKNS_9time_zoneE:
  324|  9.09k|                          const time_zone& tz) {
  325|  9.09k|  const auto p = detail::split_seconds(tp);
  326|  9.09k|  const auto n = std::chrono::duration_cast<detail::femtoseconds>(p.second);
  327|  9.09k|  return detail::format(fmt, p.first, n, tz);
  328|  9.09k|}
_ZN4cctz6detail13split_secondsERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  416|  9.09k|    const time_point<seconds>& tp) {
  417|  9.09k|  return {tp, seconds::zero()};
  418|  9.09k|}

_ZN4cctz19FixedOffsetFromNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS0_6chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
   57|  11.1k|bool FixedOffsetFromName(const std::string& name, seconds* offset) {
   58|  11.1k|  if (name == "UTC" || name == "UTC0") {
  ------------------
  |  Branch (58:7): [True: 1.61k, False: 9.53k]
  |  Branch (58:24): [True: 1, False: 9.52k]
  ------------------
   59|  1.61k|    *offset = seconds::zero();
   60|  1.61k|    return true;
   61|  1.61k|  }
   62|       |
   63|  9.52k|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
   64|  9.52k|  const char* const ep = kFixedZonePrefix + prefix_len;
   65|  9.52k|  if (name.size() != prefix_len + 9)  // <prefix>+99:99:99
  ------------------
  |  Branch (65:7): [True: 8.70k, False: 827]
  ------------------
   66|  8.70k|    return false;
   67|    827|  if (!std::equal(kFixedZonePrefix, ep, name.begin()))
  ------------------
  |  Branch (67:7): [True: 51, False: 776]
  ------------------
   68|     51|    return false;
   69|    776|  const char* np = name.data() + prefix_len;
   70|    776|  if (np[0] != '+' && np[0] != '-')
  ------------------
  |  Branch (70:7): [True: 446, False: 330]
  |  Branch (70:23): [True: 26, False: 420]
  ------------------
   71|     26|    return false;
   72|    750|  if (np[3] != ':' || np[6] != ':')  // see note below about large offsets
  ------------------
  |  Branch (72:7): [True: 2, False: 748]
  |  Branch (72:23): [True: 8, False: 740]
  ------------------
   73|     10|    return false;
   74|       |
   75|    740|  int hours = Parse02d(np + 1);
   76|    740|  if (hours == -1) return false;
  ------------------
  |  Branch (76:7): [True: 4, False: 736]
  ------------------
   77|    736|  int mins = Parse02d(np + 4);
   78|    736|  if (mins == -1) return false;
  ------------------
  |  Branch (78:7): [True: 6, False: 730]
  ------------------
   79|    730|  int secs = Parse02d(np + 7);
   80|    730|  if (secs == -1) return false;
  ------------------
  |  Branch (80:7): [True: 6, False: 724]
  ------------------
   81|       |
   82|    724|  secs += ((hours * 60) + mins) * 60;
   83|    724|  if (secs > 24 * 60 * 60) return false;  // outside supported offset range
  ------------------
  |  Branch (83:7): [True: 8, False: 716]
  ------------------
   84|    716|  *offset = seconds(secs * (np[0] == '-' ? -1 : 1));  // "-" means west
  ------------------
  |  Branch (84:29): [True: 400, False: 316]
  ------------------
   85|    716|  return true;
   86|    724|}
_ZN4cctz17FixedOffsetToNameERKNSt3__16chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
   88|    327|std::string FixedOffsetToName(const seconds& offset) {
   89|    327|  if (offset == seconds::zero()) return "UTC";
  ------------------
  |  Branch (89:7): [True: 1, False: 326]
  ------------------
   90|    326|  if (offset < std::chrono::hours(-24) || offset > std::chrono::hours(24)) {
  ------------------
  |  Branch (90:7): [True: 0, False: 326]
  |  Branch (90:7): [True: 0, False: 326]
  |  Branch (90:43): [True: 0, False: 326]
  ------------------
   91|       |    // We don't support fixed-offset zones more than 24 hours
   92|       |    // away from UTC to avoid complications in rendering such
   93|       |    // offsets and to (somewhat) limit the total number of zones.
   94|      0|    return "UTC";
   95|      0|  }
   96|    326|  int offset_seconds = static_cast<int>(offset.count());
   97|    326|  const char sign = (offset_seconds < 0 ? '-' : '+');
  ------------------
  |  Branch (97:22): [True: 184, False: 142]
  ------------------
   98|    326|  int offset_minutes = offset_seconds / 60;
   99|    326|  offset_seconds %= 60;
  100|    326|  if (sign == '-') {
  ------------------
  |  Branch (100:7): [True: 184, False: 142]
  ------------------
  101|    184|    if (offset_seconds > 0) {
  ------------------
  |  Branch (101:9): [True: 0, False: 184]
  ------------------
  102|      0|      offset_seconds -= 60;
  103|      0|      offset_minutes += 1;
  104|      0|    }
  105|    184|    offset_seconds = -offset_seconds;
  106|    184|    offset_minutes = -offset_minutes;
  107|    184|  }
  108|    326|  int offset_hours = offset_minutes / 60;
  109|    326|  offset_minutes %= 60;
  110|    326|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
  111|    326|  char buf[prefix_len + sizeof("-24:00:00")];
  112|    326|  char* ep = std::copy_n(kFixedZonePrefix, prefix_len, buf);
  113|    326|  *ep++ = sign;
  114|    326|  ep = Format02d(ep, offset_hours);
  115|    326|  *ep++ = ':';
  116|    326|  ep = Format02d(ep, offset_minutes);
  117|    326|  *ep++ = ':';
  118|    326|  ep = Format02d(ep, offset_seconds);
  119|    326|  *ep++ = '\0';
  120|    326|  assert(ep == buf + sizeof(buf));
  ------------------
  |  Branch (120:3): [True: 326, False: 0]
  ------------------
  121|    326|  return buf;
  122|    326|}
_ZN4cctz17FixedOffsetToAbbrERKNSt3__16chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
  124|    327|std::string FixedOffsetToAbbr(const seconds& offset) {
  125|    327|  std::string abbr = FixedOffsetToName(offset);
  126|    327|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
  127|    327|  if (abbr.size() == prefix_len + 9) {         // <prefix>+99:99:99
  ------------------
  |  Branch (127:7): [True: 326, False: 1]
  ------------------
  128|    326|    abbr.erase(0, prefix_len);                 // +99:99:99
  129|    326|    abbr.erase(6, 1);                          // +99:9999
  130|    326|    abbr.erase(3, 1);                          // +999999
  131|    326|    if (abbr[5] == '0' && abbr[6] == '0') {    // +999900
  ------------------
  |  Branch (131:9): [True: 118, False: 208]
  |  Branch (131:27): [True: 38, False: 80]
  ------------------
  132|     38|      abbr.erase(5, 2);                        // +9999
  133|     38|      if (abbr[3] == '0' && abbr[4] == '0') {  // +9900
  ------------------
  |  Branch (133:11): [True: 17, False: 21]
  |  Branch (133:29): [True: 2, False: 15]
  ------------------
  134|      2|        abbr.erase(3, 2);                      // +99
  135|      2|      }
  136|     38|    }
  137|    326|  }
  138|    327|  return abbr;
  139|    327|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_18Parse02dEPKc:
   46|  2.20k|int Parse02d(const char* p) {
   47|  2.20k|  const int hi = ParseDigit(p[0]);
   48|  2.20k|  if (hi >= 0) {
  ------------------
  |  Branch (48:7): [True: 2.19k, False: 12]
  ------------------
   49|  2.19k|    const int lo = ParseDigit(p[1]);
   50|  2.19k|    if (lo >= 0) return (hi * 10) + lo;
  ------------------
  |  Branch (50:9): [True: 2.19k, False: 4]
  ------------------
   51|  2.19k|  }
   52|     16|  return -1;
   53|  2.20k|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_110ParseDigitEc:
   41|  4.40k|int ParseDigit(char ch) {
   42|  4.40k|  const char* const dp = std::strchr(kDigits, ch);
   43|  4.40k|  return (dp == nullptr || *dp == '\0') ? -1 : static_cast<int>(dp - kDigits);
  ------------------
  |  Branch (43:11): [True: 8, False: 4.39k]
  |  Branch (43:28): [True: 8, False: 4.38k]
  ------------------
   44|  4.40k|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_19Format02dEPci:
   32|    978|char* Format02d(char* p, int v) {
   33|    978|  *p++ = kDigits[(v / 10) % 10];
   34|    978|  *p++ = kDigits[v % 10];
   35|    978|  return p;
   36|    978|}

_ZN4cctz6detail6formatERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS1_6chrono10time_pointINSA_12system_clockENSA_8durationIlNS1_5ratioILl1ELl1EEEEEEERKNSD_IlNSE_ILl1ELl1000000000000000EEEEERKNS_9time_zoneE:
  339|  9.09k|                   const detail::femtoseconds& fs, const time_zone& tz) {
  340|  9.09k|  std::string result;
  341|  9.09k|  result.reserve(2 * format.size());  // A guess for the result size.
  342|  9.09k|  const time_zone::absolute_lookup al = tz.lookup(tp);
  343|  9.09k|  const std::tm tm = ToTM(al);
  344|       |
  345|       |  // Scratch buffer for internal conversions.
  346|  9.09k|  char buf[6 + (kDigits10_64 + 2)];  // enough for longest conversion (%F)
  347|  9.09k|  char* const ep = buf + sizeof(buf);
  348|  9.09k|  char* bp;  // works back from ep
  349|       |
  350|       |  // Maintain three, disjoint subsequences that span format.
  351|       |  //   [format.begin() ... pending) : already formatted into result
  352|       |  //   [pending ... cur) : formatting pending, but no special cases
  353|       |  //   [cur ... format.end()) : unexamined
  354|       |  // Initially, everything is in the unexamined part.
  355|  9.09k|  const char* pending = format.data();
  356|  9.09k|  const char* cur = pending;
  357|  9.09k|  const char* const end = pending + format.size();
  358|       |
  359|   172k|  while (cur != end) {  // while something is unexamined
  ------------------
  |  Branch (359:10): [True: 163k, False: 9.09k]
  ------------------
  360|       |    // Moves cur to the next percent sign.
  361|   163k|    const char* start = cur;
  362|  30.0M|    while (cur != end && *cur != '%') {
  ------------------
  |  Branch (362:12): [True: 30.0M, False: 676]
  |  Branch (362:26): [True: 29.8M, False: 163k]
  ------------------
  363|  29.8M|      if (*cur == '\0' && pending != start) {
  ------------------
  |  Branch (363:11): [True: 699k, False: 29.1M]
  |  Branch (363:27): [True: 10.8k, False: 688k]
  ------------------
  364|  10.8k|        FormatTM(&result, std::string(pending, cur), tm);
  365|  10.8k|        pending = start = cur;
  366|  10.8k|      }
  367|  29.8M|      ++cur;
  368|  29.8M|    }
  369|       |
  370|       |    // If the new pending text is all ordinary, copy it out.
  371|   163k|    if (cur != start && pending == start) {
  ------------------
  |  Branch (371:9): [True: 88.2k, False: 75.5k]
  |  Branch (371:25): [True: 28.4k, False: 59.7k]
  ------------------
  372|  28.4k|      result.append(pending, cur);
  373|  28.4k|      pending = start = cur;
  374|  28.4k|    }
  375|       |
  376|       |    // Span the sequential percent signs.
  377|   163k|    const char* const percent = cur;
  378|   732k|    while (cur != end && *cur == '%') ++cur;
  ------------------
  |  Branch (378:12): [True: 731k, False: 757]
  |  Branch (378:26): [True: 568k, False: 162k]
  ------------------
  379|       |
  380|       |    // If the new pending text is all percents, copy out one
  381|       |    // percent for every matched pair, then skip those pairs.
  382|   163k|    if (cur != start && pending == start) {
  ------------------
  |  Branch (382:9): [True: 163k, False: 238]
  |  Branch (382:25): [True: 101k, False: 61.5k]
  ------------------
  383|   101k|      std::size_t escaped = static_cast<std::size_t>(cur - pending) / 2;
  384|   101k|      result.append(pending, escaped);
  385|   101k|      pending += escaped * 2;
  386|       |      // Also copy out a single trailing percent.
  387|   101k|      if (pending != cur && cur == end) {
  ------------------
  |  Branch (387:11): [True: 98.9k, False: 2.93k]
  |  Branch (387:29): [True: 32, False: 98.9k]
  ------------------
  388|     32|        result.push_back(*pending++);
  389|     32|      }
  390|   101k|    }
  391|       |
  392|       |    // Loop unless we have an unescaped percent.
  393|   163k|    if (cur == end || (cur - percent) % 2 == 0) continue;
  ------------------
  |  Branch (393:9): [True: 757, False: 162k]
  |  Branch (393:23): [True: 5.38k, False: 157k]
  ------------------
  394|       |
  395|       |    // Simple specifiers that we handle ourselves.
  396|   157k|    if (*cur == '\0' || strchr("YmdeFUuWwHMSTzZs%", *cur)) {
  ------------------
  |  Branch (396:9): [True: 3.25k, False: 154k]
  |  Branch (396:25): [True: 20.0k, False: 134k]
  ------------------
  397|  23.3k|      FormatTM(&result, std::string(pending, cur - 1), tm);
  398|  23.3k|      switch (*cur) {
  ------------------
  |  Branch (398:15): [True: 23.3k, False: 0]
  ------------------
  399|  3.25k|        case '\0':
  ------------------
  |  Branch (399:9): [True: 3.25k, False: 20.0k]
  ------------------
  400|       |          // Because we allow NULs in the format string, we must give
  401|       |          // some meaning to the "%\0" specifier.  We choose the common
  402|       |          // (but undefined) strftime() behavior of echoing unknown
  403|       |          // specifiers.
  404|  3.25k|          result.push_back('%');
  405|  3.25k|          result.push_back('\0');
  406|  3.25k|          break;
  407|    894|        case 'Y':
  ------------------
  |  Branch (407:9): [True: 894, False: 22.4k]
  ------------------
  408|       |          // This avoids the tm.tm_year overflow problem for %Y, however
  409|       |          // tm.tm_year will still be used by other specifiers like %D.
  410|    894|          bp = Format64(ep, 0, al.cs.year());
  411|    894|          result.append(bp, ep);
  412|    894|          break;
  413|    217|        case 'm':
  ------------------
  |  Branch (413:9): [True: 217, False: 23.1k]
  ------------------
  414|    217|          bp = Format02d(ep, al.cs.month());
  415|    217|          result.append(bp, ep);
  416|    217|          break;
  417|    218|        case 'd':
  ------------------
  |  Branch (417:9): [True: 218, False: 23.1k]
  ------------------
  418|    693|        case 'e':
  ------------------
  |  Branch (418:9): [True: 475, False: 22.8k]
  ------------------
  419|    693|          bp = Format02d(ep, al.cs.day());
  420|    693|          if (*cur == 'e' && *bp == '0') *bp = ' ';  // for Windows
  ------------------
  |  Branch (420:15): [True: 475, False: 218]
  |  Branch (420:30): [True: 245, False: 230]
  ------------------
  421|    693|          result.append(bp, ep);
  422|    693|          break;
  423|    512|        case 'F':
  ------------------
  |  Branch (423:9): [True: 512, False: 22.8k]
  ------------------
  424|    512|          bp = Format02d(ep, al.cs.day());
  425|    512|          *--bp = '-';
  426|    512|          bp = Format02d(bp, al.cs.month());
  427|    512|          *--bp = '-';
  428|    512|          bp = Format64(bp, 0, al.cs.year());
  429|    512|          result.append(bp, ep);
  430|    512|          break;
  431|  4.64k|        case 'U':
  ------------------
  |  Branch (431:9): [True: 4.64k, False: 18.6k]
  ------------------
  432|  4.64k|          bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::sunday));
  433|  4.64k|          result.append(bp, ep);
  434|  4.64k|          break;
  435|    785|        case 'u':
  ------------------
  |  Branch (435:9): [True: 785, False: 22.5k]
  ------------------
  436|    785|          bp = Format64(ep, 0, tm.tm_wday ? tm.tm_wday : 7);
  ------------------
  |  Branch (436:32): [True: 576, False: 209]
  ------------------
  437|    785|          result.append(bp, ep);
  438|    785|          break;
  439|  2.97k|        case 'W':
  ------------------
  |  Branch (439:9): [True: 2.97k, False: 20.3k]
  ------------------
  440|  2.97k|          bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::monday));
  441|  2.97k|          result.append(bp, ep);
  442|  2.97k|          break;
  443|    215|        case 'w':
  ------------------
  |  Branch (443:9): [True: 215, False: 23.1k]
  ------------------
  444|    215|          bp = Format64(ep, 0, tm.tm_wday);
  445|    215|          result.append(bp, ep);
  446|    215|          break;
  447|    351|        case 'H':
  ------------------
  |  Branch (447:9): [True: 351, False: 22.9k]
  ------------------
  448|    351|          bp = Format02d(ep, al.cs.hour());
  449|    351|          result.append(bp, ep);
  450|    351|          break;
  451|    294|        case 'M':
  ------------------
  |  Branch (451:9): [True: 294, False: 23.0k]
  ------------------
  452|    294|          bp = Format02d(ep, al.cs.minute());
  453|    294|          result.append(bp, ep);
  454|    294|          break;
  455|    560|        case 'S':
  ------------------
  |  Branch (455:9): [True: 560, False: 22.7k]
  ------------------
  456|    560|          bp = Format02d(ep, al.cs.second());
  457|    560|          result.append(bp, ep);
  458|    560|          break;
  459|    446|        case 'T':
  ------------------
  |  Branch (459:9): [True: 446, False: 22.8k]
  ------------------
  460|    446|          bp = Format02d(ep, al.cs.second());
  461|    446|          *--bp = ':';
  462|    446|          bp = Format02d(bp, al.cs.minute());
  463|    446|          *--bp = ':';
  464|    446|          bp = Format02d(bp, al.cs.hour());
  465|    446|          result.append(bp, ep);
  466|    446|          break;
  467|  4.51k|        case 'z':
  ------------------
  |  Branch (467:9): [True: 4.51k, False: 18.8k]
  ------------------
  468|  4.51k|          bp = FormatOffset(ep, al.offset, "");
  469|  4.51k|          result.append(bp, ep);
  470|  4.51k|          break;
  471|    249|        case 'Z':
  ------------------
  |  Branch (471:9): [True: 249, False: 23.0k]
  ------------------
  472|    249|          result.append(al.abbr);
  473|    249|          break;
  474|  2.71k|        case 's':
  ------------------
  |  Branch (474:9): [True: 2.71k, False: 20.6k]
  ------------------
  475|  2.71k|          bp = Format64(ep, 0, ToUnixSeconds(tp));
  476|  2.71k|          result.append(bp, ep);
  477|  2.71k|          break;
  478|      0|        case '%':
  ------------------
  |  Branch (478:9): [True: 0, False: 23.3k]
  ------------------
  479|      0|          result.push_back('%');
  480|      0|          break;
  481|  23.3k|      }
  482|  23.3k|      pending = ++cur;
  483|  23.3k|      continue;
  484|  23.3k|    }
  485|       |
  486|       |    // More complex specifiers that we handle ourselves.
  487|   134k|    if (*cur == ':' && cur + 1 != end) {
  ------------------
  |  Branch (487:9): [True: 10.7k, False: 123k]
  |  Branch (487:24): [True: 10.7k, False: 7]
  ------------------
  488|  10.7k|      if (*(cur + 1) == 'z') {
  ------------------
  |  Branch (488:11): [True: 3.01k, False: 7.75k]
  ------------------
  489|       |        // Formats %:z.
  490|  3.01k|        FormatTM(&result, std::string(pending, cur - 1), tm);
  491|  3.01k|        bp = FormatOffset(ep, al.offset, ":");
  492|  3.01k|        result.append(bp, ep);
  493|  3.01k|        pending = cur += 2;
  494|  3.01k|        continue;
  495|  3.01k|      }
  496|  7.75k|      if (*(cur + 1) == ':' && cur + 2 != end) {
  ------------------
  |  Branch (496:11): [True: 5.36k, False: 2.39k]
  |  Branch (496:32): [True: 5.36k, False: 1]
  ------------------
  497|  5.36k|        if (*(cur + 2) == 'z') {
  ------------------
  |  Branch (497:13): [True: 1.25k, False: 4.10k]
  ------------------
  498|       |          // Formats %::z.
  499|  1.25k|          FormatTM(&result, std::string(pending, cur - 1), tm);
  500|  1.25k|          bp = FormatOffset(ep, al.offset, ":*");
  501|  1.25k|          result.append(bp, ep);
  502|  1.25k|          pending = cur += 3;
  503|  1.25k|          continue;
  504|  1.25k|        }
  505|  4.10k|        if (*(cur + 2) == ':' && cur + 3 != end) {
  ------------------
  |  Branch (505:13): [True: 2.43k, False: 1.67k]
  |  Branch (505:34): [True: 2.42k, False: 2]
  ------------------
  506|  2.42k|          if (*(cur + 3) == 'z') {
  ------------------
  |  Branch (506:15): [True: 1.98k, False: 448]
  ------------------
  507|       |            // Formats %:::z.
  508|  1.98k|            FormatTM(&result, std::string(pending, cur - 1), tm);
  509|  1.98k|            bp = FormatOffset(ep, al.offset, ":*:");
  510|  1.98k|            result.append(bp, ep);
  511|  1.98k|            pending = cur += 4;
  512|  1.98k|            continue;
  513|  1.98k|          }
  514|  2.42k|        }
  515|  4.10k|      }
  516|  7.75k|    }
  517|       |
  518|       |    // Loop if there is no E modifier.
  519|   127k|    if (*cur != 'E' || ++cur == end) continue;
  ------------------
  |  Branch (519:9): [True: 40.9k, False: 87.0k]
  |  Branch (519:24): [True: 4, False: 87.0k]
  ------------------
  520|       |
  521|       |    // Format our extensions.
  522|  87.0k|    if (*cur == 'T') {
  ------------------
  |  Branch (522:9): [True: 1.70k, False: 85.3k]
  ------------------
  523|       |      // Formats %ET.
  524|  1.70k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  525|  1.70k|      result.append("T");
  526|  1.70k|      pending = ++cur;
  527|  85.3k|    } else if (*cur == 'z') {
  ------------------
  |  Branch (527:16): [True: 7.43k, False: 77.9k]
  ------------------
  528|       |      // Formats %Ez.
  529|  7.43k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  530|  7.43k|      bp = FormatOffset(ep, al.offset, ":");
  531|  7.43k|      result.append(bp, ep);
  532|  7.43k|      pending = ++cur;
  533|  77.9k|    } else if (*cur == '*' && cur + 1 != end && *(cur + 1) == 'z') {
  ------------------
  |  Branch (533:16): [True: 39.5k, False: 38.3k]
  |  Branch (533:31): [True: 39.5k, False: 16]
  |  Branch (533:49): [True: 31.6k, False: 7.94k]
  ------------------
  534|       |      // Formats %E*z.
  535|  31.6k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  536|  31.6k|      bp = FormatOffset(ep, al.offset, ":*");
  537|  31.6k|      result.append(bp, ep);
  538|  31.6k|      pending = cur += 2;
  539|  46.3k|    } else if (*cur == '*' && cur + 1 != end &&
  ------------------
  |  Branch (539:16): [True: 7.96k, False: 38.3k]
  |  Branch (539:31): [True: 7.94k, False: 16]
  ------------------
  540|  7.94k|               (*(cur + 1) == 'S' || *(cur + 1) == 'f')) {
  ------------------
  |  Branch (540:17): [True: 4.65k, False: 3.29k]
  |  Branch (540:38): [True: 1.03k, False: 2.26k]
  ------------------
  541|       |      // Formats %E*S or %E*F.
  542|  5.68k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  543|  5.68k|      char* cp = ep;
  544|  5.68k|      bp = Format64(cp, 15, fs.count());
  545|  90.9k|      while (cp != bp && cp[-1] == '0') --cp;
  ------------------
  |  Branch (545:14): [True: 85.2k, False: 5.68k]
  |  Branch (545:26): [True: 85.2k, False: 0]
  ------------------
  546|  5.68k|      switch (*(cur + 1)) {
  ------------------
  |  Branch (546:15): [True: 5.68k, False: 0]
  ------------------
  547|  4.65k|        case 'S':
  ------------------
  |  Branch (547:9): [True: 4.65k, False: 1.03k]
  ------------------
  548|  4.65k|          if (cp != bp) *--bp = '.';
  ------------------
  |  Branch (548:15): [True: 0, False: 4.65k]
  ------------------
  549|  4.65k|          bp = Format02d(bp, al.cs.second());
  550|  4.65k|          break;
  551|  1.03k|        case 'f':
  ------------------
  |  Branch (551:9): [True: 1.03k, False: 4.65k]
  ------------------
  552|  1.03k|          if (cp == bp) *--bp = '0';
  ------------------
  |  Branch (552:15): [True: 1.03k, False: 0]
  ------------------
  553|  1.03k|          break;
  554|  5.68k|      }
  555|  5.68k|      result.append(bp, cp);
  556|  5.68k|      pending = cur += 2;
  557|  40.6k|    } else if (*cur == '4' && cur + 1 != end && *(cur + 1) == 'Y') {
  ------------------
  |  Branch (557:16): [True: 4.04k, False: 36.5k]
  |  Branch (557:31): [True: 4.04k, False: 3]
  |  Branch (557:49): [True: 2.89k, False: 1.14k]
  ------------------
  558|       |      // Formats %E4Y.
  559|  2.89k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  560|  2.89k|      bp = Format64(ep, 4, al.cs.year());
  561|  2.89k|      result.append(bp, ep);
  562|  2.89k|      pending = cur += 2;
  563|  37.7k|    } else if (isdigit(*cur)) {
  ------------------
  |  Branch (563:16): [True: 26.1k, False: 11.5k]
  ------------------
  564|       |      // Possibly found %E#S or %E#f.
  565|  26.1k|      int n = 0;
  566|  26.1k|      if (const char* np = ParseInt(cur, 0, 0, 1024, &n)) {
  ------------------
  |  Branch (566:23): [True: 13.7k, False: 12.4k]
  ------------------
  567|  13.7k|        if (*np == 'S' || *np == 'f') {
  ------------------
  |  Branch (567:13): [True: 6.46k, False: 7.24k]
  |  Branch (567:27): [True: 2.27k, False: 4.96k]
  ------------------
  568|       |          // Formats %E#S or %E#f.
  569|  8.73k|          FormatTM(&result, std::string(pending, cur - 2), tm);
  570|  8.73k|          bp = ep;
  571|  8.73k|          if (n > 0) {
  ------------------
  |  Branch (571:15): [True: 6.02k, False: 2.71k]
  ------------------
  572|  6.02k|            if (n > kDigits10_64) n = kDigits10_64;
  ------------------
  |  Branch (572:17): [True: 528, False: 5.49k]
  ------------------
  573|  6.02k|            bp = Format64(bp, n, (n > 15) ? fs.count() * kExp10[n - 15]
  ------------------
  |  Branch (573:34): [True: 530, False: 5.49k]
  ------------------
  574|  6.02k|                                          : fs.count() / kExp10[15 - n]);
  575|  6.02k|            if (*np == 'S') *--bp = '.';
  ------------------
  |  Branch (575:17): [True: 4.19k, False: 1.82k]
  ------------------
  576|  6.02k|          }
  577|  8.73k|          if (*np == 'S') bp = Format02d(bp, al.cs.second());
  ------------------
  |  Branch (577:15): [True: 6.46k, False: 2.27k]
  ------------------
  578|  8.73k|          result.append(bp, ep);
  579|  8.73k|          pending = cur = ++np;
  580|  8.73k|        }
  581|  13.7k|      }
  582|  26.1k|    }
  583|  87.0k|  }
  584|       |
  585|       |  // Formats any remaining data.
  586|  9.09k|  FormatTM(&result, std::string(pending, end), tm);
  587|       |
  588|  9.09k|  return result;
  589|  9.09k|}
_ZN4cctz6detail5parseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS_9time_zoneEPNS1_6chrono10time_pointINSD_12system_clockENSD_8durationIlNS1_5ratioILl1ELl1EEEEEEEPNSG_IlNSH_ILl1ELl1000000000000000EEEEEPS7_:
  706|  9.09k|           detail::femtoseconds* fs, std::string* err) {
  707|  9.09k|#if __cplusplus < 202002L
  708|       |  // Assert that the std::chrono::system_clock epoch is the Unix epoch.
  709|       |  // This is required by C++20, but was also ubiquitous before that.
  710|       |  // We use this in join_seconds() to simplify overflow detection.
  711|  9.09k|  assert(std::chrono::system_clock::from_time_t(0).time_since_epoch() ==
  ------------------
  |  Branch (711:3): [True: 9.09k, False: 0]
  ------------------
  712|  9.09k|         std::chrono::system_clock::duration::zero());
  713|  9.09k|#endif
  714|       |
  715|       |  // The unparsed input.  Even though we allow NULs in input, and
  716|       |  // match them against corresponding NULs in format, we depend on
  717|       |  // *edata being a NUL so that we can call strptime().  This also
  718|       |  // makes our handling of input easier.
  719|  9.09k|  const char* data = input.c_str();  // NUL terminated
  720|  9.09k|  const char* const edata = data + input.size();
  721|       |
  722|       |  // Skips leading whitespace.
  723|  9.30k|  while (isspace(*data)) ++data;
  ------------------
  |  Branch (723:10): [True: 212, False: 9.09k]
  ------------------
  724|       |
  725|  9.09k|  const year_t kyearmax = std::numeric_limits<year_t>::max();
  726|  9.09k|  const year_t kyearmin = std::numeric_limits<year_t>::min();
  727|       |
  728|       |  // Sets default values for unspecified fields.
  729|  9.09k|  bool saw_year = false;
  730|  9.09k|  year_t year = 1970;
  731|  9.09k|  std::tm tm{};
  732|  9.09k|  tm.tm_year = 1970 - 1900;
  733|  9.09k|  tm.tm_mon = 1 - 1;  // Jan
  734|  9.09k|  tm.tm_mday = 1;
  735|  9.09k|  tm.tm_hour = 0;
  736|  9.09k|  tm.tm_min = 0;
  737|  9.09k|  tm.tm_sec = 0;
  738|  9.09k|  tm.tm_wday = 4;  // Thu
  739|  9.09k|  tm.tm_yday = 0;
  740|  9.09k|  tm.tm_isdst = 0;
  741|  9.09k|  auto subseconds = detail::femtoseconds::zero();
  742|  9.09k|  bool saw_offset = false;
  743|  9.09k|  int offset = 0;  // No offset from passed tz.
  744|  9.09k|  std::string zone = "UTC";
  745|       |
  746|       |  // Even though we allow NULs in format, and match them against
  747|       |  // corresponding NULs in input, we simplify its handling by also
  748|       |  // ensuring that *efmt is a NUL.
  749|  9.09k|  const char* fmt = format.c_str();  // NUL terminated
  750|  9.09k|  const char* const efmt = fmt + format.size();
  751|  9.09k|  bool twelve_hour = false;
  752|  9.09k|  bool afternoon = false;
  753|  9.09k|  int week_num = -1;
  754|  9.09k|  weekday week_start = weekday::sunday;
  755|       |
  756|  9.09k|  bool saw_percent_s = false;
  757|  9.09k|  std::int_fast64_t percent_s = 0;
  758|       |
  759|       |  // Steps through format, one specifier at a time.
  760|  36.1k|  while (data != nullptr && fmt != efmt) {
  ------------------
  |  Branch (760:10): [True: 33.7k, False: 2.42k]
  |  Branch (760:29): [True: 27.0k, False: 6.67k]
  ------------------
  761|  27.0k|    if (isspace(*fmt)) {
  ------------------
  |  Branch (761:9): [True: 1.67k, False: 25.3k]
  ------------------
  762|  3.26k|      while (isspace(*data)) ++data;
  ------------------
  |  Branch (762:14): [True: 1.58k, False: 1.67k]
  ------------------
  763|  1.87k|      while (isspace(*++fmt)) continue;
  ------------------
  |  Branch (763:14): [True: 195, False: 1.67k]
  ------------------
  764|  1.67k|      continue;
  765|  1.67k|    }
  766|       |
  767|  25.3k|    if (*fmt != '%') {
  ------------------
  |  Branch (767:9): [True: 1.01k, False: 24.3k]
  ------------------
  768|  1.01k|      if (data != edata && *data == *fmt) {
  ------------------
  |  Branch (768:11): [True: 952, False: 64]
  |  Branch (768:28): [True: 905, False: 47]
  ------------------
  769|    905|        ++data;
  770|    905|        ++fmt;
  771|    905|      } else {
  772|    111|        data = nullptr;
  773|    111|      }
  774|  1.01k|      continue;
  775|  1.01k|    }
  776|       |
  777|  24.3k|    const char* const percent = fmt;
  778|  24.3k|    if (++fmt == efmt) {
  ------------------
  |  Branch (778:9): [True: 9, False: 24.3k]
  ------------------
  779|      9|      data = nullptr;
  780|      9|      continue;
  781|      9|    }
  782|  24.3k|    switch (*fmt++) {
  ------------------
  |  Branch (782:13): [True: 23.4k, False: 889]
  ------------------
  783|      2|      case '\0':
  ------------------
  |  Branch (783:7): [True: 2, False: 24.3k]
  ------------------
  784|       |        // Because we allow NULs in the format string, we must give
  785|       |        // some meaning to the "%\0" specifier.  We choose the common
  786|       |        // (but undefined) strptime() behavior of failing on unknown
  787|       |        // specifiers.
  788|      2|        data = nullptr;
  789|      2|        continue;
  790|  2.08k|      case 'Y':
  ------------------
  |  Branch (790:7): [True: 2.08k, False: 22.2k]
  ------------------
  791|       |        // Symmetrically with format(), directly handing %Y avoids the
  792|       |        // tm.tm_year overflow problem.  However, tm.tm_year will still be
  793|       |        // used by other specifiers like %D.
  794|  2.08k|        data = ParseInt(data, 0, kyearmin, kyearmax, &year);
  795|  2.08k|        if (data != nullptr) saw_year = true;
  ------------------
  |  Branch (795:13): [True: 2.00k, False: 78]
  ------------------
  796|  2.08k|        continue;
  797|    634|      case 'm':
  ------------------
  |  Branch (797:7): [True: 634, False: 23.7k]
  ------------------
  798|    634|        data = ParseInt(data, 2, 1, 12, &tm.tm_mon);
  799|    634|        if (data != nullptr) tm.tm_mon -= 1;
  ------------------
  |  Branch (799:13): [True: 598, False: 36]
  ------------------
  800|    634|        week_num = -1;
  801|    634|        continue;
  802|    277|      case 'd':
  ------------------
  |  Branch (802:7): [True: 277, False: 24.0k]
  ------------------
  803|    867|      case 'e':
  ------------------
  |  Branch (803:7): [True: 590, False: 23.7k]
  ------------------
  804|    867|        data = ParseInt(data, 2, 1, 31, &tm.tm_mday);
  805|    867|        week_num = -1;
  806|    867|        continue;
  807|    942|      case 'F':
  ------------------
  |  Branch (807:7): [True: 942, False: 23.4k]
  ------------------
  808|    942|        data = ParseInt(data, 0, kyearmin, kyearmax, &year);
  809|    942|        if (data != nullptr) {
  ------------------
  |  Branch (809:13): [True: 851, False: 91]
  ------------------
  810|    851|          saw_year = true;
  811|    851|          data = (*data == '-' ? data + 1 : nullptr);
  ------------------
  |  Branch (811:19): [True: 583, False: 268]
  ------------------
  812|    851|        }
  813|    942|        data = ParseInt(data, 2, 1, 12, &tm.tm_mon);
  814|    942|        if (data != nullptr) {
  ------------------
  |  Branch (814:13): [True: 535, False: 407]
  ------------------
  815|    535|          tm.tm_mon -= 1;
  816|    535|          data = (*data == '-' ? data + 1 : nullptr);
  ------------------
  |  Branch (816:19): [True: 520, False: 15]
  ------------------
  817|    535|        }
  818|    942|        data = ParseInt(data, 2, 1, 31, &tm.tm_mday);
  819|    942|        week_num = -1;
  820|    942|        continue;
  821|    508|      case 'U':
  ------------------
  |  Branch (821:7): [True: 508, False: 23.8k]
  ------------------
  822|    508|        data = ParseInt(data, 0, 0, 53, &week_num);
  823|    508|        week_start = weekday::sunday;
  824|    508|        continue;
  825|    488|      case 'W':
  ------------------
  |  Branch (825:7): [True: 488, False: 23.8k]
  ------------------
  826|    488|        data = ParseInt(data, 0, 0, 53, &week_num);
  827|    488|        week_start = weekday::monday;
  828|    488|        continue;
  829|    356|      case 'u':
  ------------------
  |  Branch (829:7): [True: 356, False: 23.9k]
  ------------------
  830|    356|        data = ParseInt(data, 0, 1, 7, &tm.tm_wday);
  831|    356|        if (data != nullptr) tm.tm_wday %= 7;
  ------------------
  |  Branch (831:13): [True: 146, False: 210]
  ------------------
  832|    356|        continue;
  833|    354|      case 'w':
  ------------------
  |  Branch (833:7): [True: 354, False: 24.0k]
  ------------------
  834|    354|        data = ParseInt(data, 0, 0, 6, &tm.tm_wday);
  835|    354|        continue;
  836|    484|      case 'H':
  ------------------
  |  Branch (836:7): [True: 484, False: 23.8k]
  ------------------
  837|    484|        data = ParseInt(data, 2, 0, 23, &tm.tm_hour);
  838|    484|        twelve_hour = false;
  839|    484|        continue;
  840|    555|      case 'M':
  ------------------
  |  Branch (840:7): [True: 555, False: 23.7k]
  ------------------
  841|    555|        data = ParseInt(data, 2, 0, 59, &tm.tm_min);
  842|    555|        continue;
  843|    669|      case 'S':
  ------------------
  |  Branch (843:7): [True: 669, False: 23.6k]
  ------------------
  844|    669|        data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  845|    669|        continue;
  846|    534|      case 'T':
  ------------------
  |  Branch (846:7): [True: 534, False: 23.8k]
  ------------------
  847|    534|        data = ParseInt(data, 2, 0, 23, &tm.tm_hour);
  848|    534|        twelve_hour = false;
  849|    534|        data = (data != nullptr && *data == ':' ? data + 1 : nullptr);
  ------------------
  |  Branch (849:17): [True: 495, False: 39]
  |  Branch (849:36): [True: 475, False: 20]
  ------------------
  850|    534|        data = ParseInt(data, 2, 0, 59, &tm.tm_min);
  851|    534|        data = (data != nullptr && *data == ':' ? data + 1 : nullptr);
  ------------------
  |  Branch (851:17): [True: 445, False: 89]
  |  Branch (851:36): [True: 410, False: 35]
  ------------------
  852|    534|        data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  853|    534|        continue;
  854|     79|      case 'I':
  ------------------
  |  Branch (854:7): [True: 79, False: 24.2k]
  ------------------
  855|    152|      case 'l':
  ------------------
  |  Branch (855:7): [True: 73, False: 24.2k]
  ------------------
  856|    164|      case 'r':  // probably uses %I
  ------------------
  |  Branch (856:7): [True: 12, False: 24.3k]
  ------------------
  857|    164|        twelve_hour = true;
  858|    164|        break;
  859|     24|      case 'R':  // uses %H
  ------------------
  |  Branch (859:7): [True: 24, False: 24.3k]
  ------------------
  860|     25|      case 'c':  // probably uses %H
  ------------------
  |  Branch (860:7): [True: 1, False: 24.3k]
  ------------------
  861|     48|      case 'X':  // probably uses %H
  ------------------
  |  Branch (861:7): [True: 23, False: 24.3k]
  ------------------
  862|     48|        twelve_hour = false;
  863|     48|        break;
  864|  3.18k|      case 'z':
  ------------------
  |  Branch (864:7): [True: 3.18k, False: 21.1k]
  ------------------
  865|  3.18k|        data = ParseOffset(data, "", &offset);
  866|  3.18k|        if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (866:13): [True: 3.11k, False: 75]
  ------------------
  867|  3.18k|        continue;
  868|    854|      case 'Z':  // ignored; zone abbreviations are ambiguous
  ------------------
  |  Branch (868:7): [True: 854, False: 23.5k]
  ------------------
  869|    854|        data = ParseZone(data, &zone);
  870|    854|        continue;
  871|    681|      case 's':
  ------------------
  |  Branch (871:7): [True: 681, False: 23.6k]
  ------------------
  872|    681|        data = ParseInt(data, 0,
  873|    681|                        std::numeric_limits<std::int_fast64_t>::min(),
  874|    681|                        std::numeric_limits<std::int_fast64_t>::max(),
  875|    681|                        &percent_s);
  876|    681|        if (data != nullptr) saw_percent_s = true;
  ------------------
  |  Branch (876:13): [True: 587, False: 94]
  ------------------
  877|    681|        continue;
  878|    849|      case ':':
  ------------------
  |  Branch (878:7): [True: 849, False: 23.5k]
  ------------------
  879|    849|        if (fmt[0] == 'z' ||
  ------------------
  |  Branch (879:13): [True: 517, False: 332]
  ------------------
  880|    332|            (fmt[0] == ':' &&
  ------------------
  |  Branch (880:14): [True: 320, False: 12]
  ------------------
  881|    809|             (fmt[1] == 'z' || (fmt[1] == ':' && fmt[2] == 'z')))) {
  ------------------
  |  Branch (881:15): [True: 97, False: 223]
  |  Branch (881:33): [True: 207, False: 16]
  |  Branch (881:50): [True: 195, False: 12]
  ------------------
  882|    809|          data = ParseOffset(data, ":", &offset);
  883|    809|          if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (883:15): [True: 790, False: 19]
  ------------------
  884|    809|          fmt += (fmt[0] == 'z') ? 1 : (fmt[1] == 'z') ? 2 : 3;
  ------------------
  |  Branch (884:18): [True: 517, False: 292]
  |  Branch (884:40): [True: 97, False: 195]
  ------------------
  885|    809|          continue;
  886|    809|        }
  887|     40|        break;
  888|    197|      case '%':
  ------------------
  |  Branch (888:7): [True: 197, False: 24.1k]
  ------------------
  889|    197|        data = (*data == '%' ? data + 1 : nullptr);
  ------------------
  |  Branch (889:17): [True: 194, False: 3]
  ------------------
  890|    197|        continue;
  891|  8.91k|      case 'E':
  ------------------
  |  Branch (891:7): [True: 8.91k, False: 15.4k]
  ------------------
  892|  8.91k|        if (fmt[0] == 'T') {
  ------------------
  |  Branch (892:13): [True: 397, False: 8.51k]
  ------------------
  893|    397|          if (*data == 'T' || *data == 't') {
  ------------------
  |  Branch (893:15): [True: 195, False: 202]
  |  Branch (893:31): [True: 194, False: 8]
  ------------------
  894|    389|            ++data;
  895|    389|            ++fmt;
  896|    389|          } else {
  897|      8|            data = nullptr;
  898|      8|          }
  899|    397|          continue;
  900|    397|        }
  901|  8.51k|        if (fmt[0] == 'z' || (fmt[0] == '*' && fmt[1] == 'z')) {
  ------------------
  |  Branch (901:13): [True: 2.19k, False: 6.31k]
  |  Branch (901:31): [True: 4.37k, False: 1.94k]
  |  Branch (901:48): [True: 656, False: 3.71k]
  ------------------
  902|  2.85k|          data = ParseOffset(data, ":", &offset);
  903|  2.85k|          if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (903:15): [True: 2.84k, False: 13]
  ------------------
  904|  2.85k|          fmt += (fmt[0] == 'z') ? 1 : 2;
  ------------------
  |  Branch (904:18): [True: 2.19k, False: 656]
  ------------------
  905|  2.85k|          continue;
  906|  2.85k|        }
  907|  5.66k|        if (fmt[0] == '*' && fmt[1] == 'S') {
  ------------------
  |  Branch (907:13): [True: 3.71k, False: 1.94k]
  |  Branch (907:30): [True: 476, False: 3.23k]
  ------------------
  908|    476|          data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  909|    476|          if (data != nullptr && *data == '.') {
  ------------------
  |  Branch (909:15): [True: 468, False: 8]
  |  Branch (909:34): [True: 10, False: 458]
  ------------------
  910|     10|            data = ParseSubSeconds(data + 1, &subseconds);
  911|     10|          }
  912|    476|          fmt += 2;
  913|    476|          continue;
  914|    476|        }
  915|  5.18k|        if (fmt[0] == '*' && fmt[1] == 'f') {
  ------------------
  |  Branch (915:13): [True: 3.23k, False: 1.94k]
  |  Branch (915:30): [True: 3.20k, False: 31]
  ------------------
  916|  3.20k|          if (data != nullptr && isdigit(*data)) {
  ------------------
  |  Branch (916:15): [True: 3.20k, False: 0]
  |  Branch (916:34): [True: 1.04k, False: 2.16k]
  ------------------
  917|  1.04k|            data = ParseSubSeconds(data, &subseconds);
  918|  1.04k|          }
  919|  3.20k|          fmt += 2;
  920|  3.20k|          continue;
  921|  3.20k|        }
  922|  1.98k|        if (fmt[0] == '4' && fmt[1] == 'Y') {
  ------------------
  |  Branch (922:13): [True: 713, False: 1.26k]
  |  Branch (922:30): [True: 366, False: 347]
  ------------------
  923|    366|          const char* bp = data;
  924|    366|          data = ParseInt(data, 4, year_t{-999}, year_t{9999}, &year);
  925|    366|          if (data != nullptr) {
  ------------------
  |  Branch (925:15): [True: 345, False: 21]
  ------------------
  926|    345|            if (data - bp == 4) {
  ------------------
  |  Branch (926:17): [True: 294, False: 51]
  ------------------
  927|    294|              saw_year = true;
  928|    294|            } else {
  929|     51|              data = nullptr;  // stopped too soon
  930|     51|            }
  931|    345|          }
  932|    366|          fmt += 2;
  933|    366|          continue;
  934|    366|        }
  935|  1.61k|        if (isdigit(*fmt)) {
  ------------------
  |  Branch (935:13): [True: 1.49k, False: 120]
  ------------------
  936|  1.49k|          int n = 0;  // value ignored
  937|  1.49k|          if (const char* np = ParseInt(fmt, 0, 0, 1024, &n)) {
  ------------------
  |  Branch (937:27): [True: 1.36k, False: 133]
  ------------------
  938|  1.36k|            if (*np == 'S') {
  ------------------
  |  Branch (938:17): [True: 405, False: 956]
  ------------------
  939|    405|              data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  940|    405|              if (data != nullptr && *data == '.') {
  ------------------
  |  Branch (940:19): [True: 387, False: 18]
  |  Branch (940:38): [True: 10, False: 377]
  ------------------
  941|     10|                data = ParseSubSeconds(data + 1, &subseconds);
  942|     10|              }
  943|    405|              fmt = ++np;
  944|    405|              continue;
  945|    405|            }
  946|    956|            if (*np == 'f') {
  ------------------
  |  Branch (946:17): [True: 898, False: 58]
  ------------------
  947|    898|              if (data != nullptr && isdigit(*data)) {
  ------------------
  |  Branch (947:19): [True: 898, False: 0]
  |  Branch (947:38): [True: 373, False: 525]
  ------------------
  948|    373|                data = ParseSubSeconds(data, &subseconds);
  949|    373|              }
  950|    898|              fmt = ++np;
  951|    898|              continue;
  952|    898|            }
  953|    956|          }
  954|  1.49k|        }
  955|    311|        if (*fmt == 'c') twelve_hour = false;  // probably uses %H
  ------------------
  |  Branch (955:13): [True: 1, False: 310]
  ------------------
  956|    311|        if (*fmt == 'X') twelve_hour = false;  // probably uses %H
  ------------------
  |  Branch (956:13): [True: 10, False: 301]
  ------------------
  957|    311|        if (*fmt != '\0') ++fmt;
  ------------------
  |  Branch (957:13): [True: 298, False: 13]
  ------------------
  958|    311|        break;
  959|     94|      case 'O':
  ------------------
  |  Branch (959:7): [True: 94, False: 24.2k]
  ------------------
  960|     94|        if (*fmt == 'H') twelve_hour = false;
  ------------------
  |  Branch (960:13): [True: 36, False: 58]
  ------------------
  961|     94|        if (*fmt == 'I') twelve_hour = true;
  ------------------
  |  Branch (961:13): [True: 34, False: 60]
  ------------------
  962|     94|        if (*fmt != '\0') ++fmt;
  ------------------
  |  Branch (962:13): [True: 88, False: 6]
  ------------------
  963|     94|        break;
  964|  24.3k|    }
  965|       |
  966|       |    // Parses the current specifier.
  967|  1.54k|    const char* const orig_data = data;
  968|  1.54k|    std::string spec(percent, fmt);
  969|  1.54k|    data = ParseTM(data, spec.c_str(), &tm);
  970|       |
  971|       |    // If we successfully parsed %p we need to remember whether the result
  972|       |    // was AM or PM so that we can adjust tm_hour before time_zone::lookup().
  973|       |    // So reparse the input with a known AM hour, and check if it is shifted
  974|       |    // to a PM hour.
  975|  1.54k|    if (spec == "%p" && data != nullptr) {
  ------------------
  |  Branch (975:9): [True: 237, False: 1.30k]
  |  Branch (975:25): [True: 232, False: 5]
  ------------------
  976|    232|      std::string test_input = "1";
  977|    232|      test_input.append(orig_data, data);
  978|    232|      std::tm tmp{};
  979|    232|      ParseTM(test_input.c_str(), "%I%p", &tmp);
  980|    232|      afternoon = (tmp.tm_hour == 13);
  981|    232|    }
  982|  1.54k|  }
  983|       |
  984|       |  // Adjust a 12-hour tm_hour value if it should be in the afternoon.
  985|  9.09k|  if (twelve_hour && afternoon && tm.tm_hour < 12) {
  ------------------
  |  Branch (985:7): [True: 46, False: 9.05k]
  |  Branch (985:22): [True: 6, False: 40]
  |  Branch (985:35): [True: 5, False: 1]
  ------------------
  986|      5|    tm.tm_hour += 12;
  987|      5|  }
  988|       |
  989|  9.09k|  if (data == nullptr) {
  ------------------
  |  Branch (989:7): [True: 2.42k, False: 6.67k]
  ------------------
  990|  2.42k|    if (err != nullptr) *err = "Failed to parse input";
  ------------------
  |  Branch (990:9): [True: 0, False: 2.42k]
  ------------------
  991|  2.42k|    return false;
  992|  2.42k|  }
  993|       |
  994|       |  // Skip any remaining whitespace.
  995|  6.86k|  while (isspace(*data)) ++data;
  ------------------
  |  Branch (995:10): [True: 195, False: 6.67k]
  ------------------
  996|       |
  997|       |  // parse() must consume the entire input string.
  998|  6.67k|  if (data != edata) {
  ------------------
  |  Branch (998:7): [True: 270, False: 6.40k]
  ------------------
  999|    270|    if (err != nullptr) *err = "Illegal trailing data in input string";
  ------------------
  |  Branch (999:9): [True: 0, False: 270]
  ------------------
 1000|    270|    return false;
 1001|    270|  }
 1002|       |
 1003|       |  // If we saw %s then we ignore anything else and return that time.
 1004|  6.40k|  if (saw_percent_s) {
  ------------------
  |  Branch (1004:7): [True: 286, False: 6.11k]
  ------------------
 1005|    286|    *sec = FromUnixSeconds(percent_s);
 1006|    286|    *fs = detail::femtoseconds::zero();
 1007|    286|    return true;
 1008|    286|  }
 1009|       |
 1010|       |  // If we saw %z, %Ez, or %E*z then we want to interpret the parsed fields
 1011|       |  // in UTC and then shift by that offset.  Otherwise we want to interpret
 1012|       |  // the fields directly in the passed time_zone.
 1013|  6.11k|  time_zone ptz = saw_offset ? utc_time_zone() : tz;
  ------------------
  |  Branch (1013:19): [True: 210, False: 5.90k]
  ------------------
 1014|       |
 1015|       |  // Allows a leap second of 60 to normalize forward to the following ":00".
 1016|  6.11k|  if (tm.tm_sec == 60) {
  ------------------
  |  Branch (1016:7): [True: 31, False: 6.08k]
  ------------------
 1017|     31|    tm.tm_sec -= 1;
 1018|     31|    offset -= 1;
 1019|     31|    subseconds = detail::femtoseconds::zero();
 1020|     31|  }
 1021|       |
 1022|  6.11k|  if (!saw_year) {
  ------------------
  |  Branch (1022:7): [True: 4.34k, False: 1.77k]
  ------------------
 1023|  4.34k|    year = year_t{tm.tm_year};
 1024|  4.34k|    if (year > kyearmax - 1900) {
  ------------------
  |  Branch (1024:9): [True: 0, False: 4.34k]
  ------------------
 1025|       |      // Platform-dependent, maybe unreachable.
 1026|      0|      if (err != nullptr) *err = "Out-of-range year";
  ------------------
  |  Branch (1026:11): [True: 0, False: 0]
  ------------------
 1027|      0|      return false;
 1028|      0|    }
 1029|  4.34k|    year += 1900;
 1030|  4.34k|  }
 1031|       |
 1032|       |  // Compute year, tm.tm_mon and tm.tm_mday if we parsed a week number.
 1033|  6.11k|  if (week_num != -1) {
  ------------------
  |  Branch (1033:7): [True: 327, False: 5.79k]
  ------------------
 1034|    327|    if (!FromWeek(week_num, week_start, &year, &tm)) {
  ------------------
  |  Branch (1034:9): [True: 2, False: 325]
  ------------------
 1035|      2|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1035:11): [True: 0, False: 2]
  ------------------
 1036|      2|      return false;
 1037|      2|    }
 1038|    327|  }
 1039|       |
 1040|  6.11k|  const int month = tm.tm_mon + 1;
 1041|  6.11k|  civil_second cs(year, month, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 1042|       |
 1043|       |  // parse() should not allow normalization. Due to the restricted field
 1044|       |  // ranges above (see ParseInt()), the only possibility is for days to roll
 1045|       |  // into months. That is, parsing "Sep 31" should not produce "Oct 1".
 1046|  6.11k|  if (cs.month() != month || cs.day() != tm.tm_mday) {
  ------------------
  |  Branch (1046:7): [True: 2, False: 6.11k]
  |  Branch (1046:30): [True: 0, False: 6.11k]
  ------------------
 1047|      2|    if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1047:9): [True: 0, False: 2]
  ------------------
 1048|      2|    return false;
 1049|      2|  }
 1050|       |
 1051|       |  // Accounts for the offset adjustment before converting to absolute time.
 1052|  6.11k|  if ((offset < 0 && cs > civil_second::max() + offset) ||
  ------------------
  |  Branch (1052:7): [True: 1, False: 6.11k]
  |  Branch (1052:8): [True: 98, False: 6.01k]
  |  Branch (1052:22): [True: 0, False: 98]
  ------------------
 1053|  6.11k|      (offset > 0 && cs < civil_second::min() + offset)) {
  ------------------
  |  Branch (1053:8): [True: 110, False: 6.00k]
  |  Branch (1053:22): [True: 1, False: 109]
  ------------------
 1054|      1|    if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1054:9): [True: 0, False: 1]
  ------------------
 1055|      1|    return false;
 1056|      1|  }
 1057|  6.11k|  cs -= offset;
 1058|       |
 1059|  6.11k|  const auto tp = ptz.lookup(cs).pre;
 1060|       |  // Checks for overflow/underflow and returns an error as necessary.
 1061|  6.11k|  if (tp == time_point<seconds>::max()) {
  ------------------
  |  Branch (1061:7): [True: 372, False: 5.74k]
  ------------------
 1062|    372|    const auto al = ptz.lookup(time_point<seconds>::max());
 1063|    372|    if (cs > al.cs) {
  ------------------
  |  Branch (1063:9): [True: 236, False: 136]
  ------------------
 1064|    236|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1064:11): [True: 0, False: 236]
  ------------------
 1065|    236|      return false;
 1066|    236|    }
 1067|    372|  }
 1068|  5.87k|  if (tp == time_point<seconds>::min()) {
  ------------------
  |  Branch (1068:7): [True: 356, False: 5.52k]
  ------------------
 1069|    356|    const auto al = ptz.lookup(time_point<seconds>::min());
 1070|    356|    if (cs < al.cs) {
  ------------------
  |  Branch (1070:9): [True: 156, False: 200]
  ------------------
 1071|    156|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1071:11): [True: 0, False: 156]
  ------------------
 1072|    156|      return false;
 1073|    156|    }
 1074|    356|  }
 1075|       |
 1076|  5.72k|  *sec = tp;
 1077|  5.72k|  *fs = subseconds;
 1078|  5.72k|  return true;
 1079|  5.87k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_14ToTMERKNS_9time_zone15absolute_lookupE:
  121|  9.09k|std::tm ToTM(const time_zone::absolute_lookup& al) {
  122|  9.09k|  std::tm tm{};
  123|  9.09k|  tm.tm_sec = al.cs.second();
  124|  9.09k|  tm.tm_min = al.cs.minute();
  125|  9.09k|  tm.tm_hour = al.cs.hour();
  126|  9.09k|  tm.tm_mday = al.cs.day();
  127|  9.09k|  tm.tm_mon = al.cs.month() - 1;
  128|       |
  129|       |  // Saturate tm.tm_year in cases of over/underflow.
  130|  9.09k|  if (al.cs.year() < std::numeric_limits<int>::min() + 1900) {
  ------------------
  |  Branch (130:7): [True: 0, False: 9.09k]
  ------------------
  131|      0|    tm.tm_year = std::numeric_limits<int>::min();
  132|  9.09k|  } else if (al.cs.year() - 1900 > std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (132:14): [True: 624, False: 8.47k]
  ------------------
  133|    624|    tm.tm_year = std::numeric_limits<int>::max();
  134|  8.47k|  } else {
  135|  8.47k|    tm.tm_year = static_cast<int>(al.cs.year() - 1900);
  136|  8.47k|  }
  137|       |
  138|  9.09k|  tm.tm_wday = ToTmWday(get_weekday(al.cs));
  139|  9.09k|  tm.tm_yday = get_yearday(al.cs) - 1;
  140|  9.09k|  tm.tm_isdst = al.is_dst ? 1 : 0;
  ------------------
  |  Branch (140:17): [True: 648, False: 8.44k]
  ------------------
  141|  9.09k|  return tm;
  142|  9.09k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ToTmWdayENS0_7weekdayE:
   80|  9.09k|int ToTmWday(weekday wd) {
   81|  9.09k|  switch (wd) {
  ------------------
  |  Branch (81:11): [True: 9.09k, False: 0]
  ------------------
   82|    524|    case weekday::sunday:
  ------------------
  |  Branch (82:5): [True: 524, False: 8.57k]
  ------------------
   83|    524|      return 0;
   84|    424|    case weekday::monday:
  ------------------
  |  Branch (84:5): [True: 424, False: 8.67k]
  ------------------
   85|    424|      return 1;
   86|  6.30k|    case weekday::tuesday:
  ------------------
  |  Branch (86:5): [True: 6.30k, False: 2.79k]
  ------------------
   87|  6.30k|      return 2;
   88|    440|    case weekday::wednesday:
  ------------------
  |  Branch (88:5): [True: 440, False: 8.65k]
  ------------------
   89|    440|      return 3;
   90|    545|    case weekday::thursday:
  ------------------
  |  Branch (90:5): [True: 545, False: 8.55k]
  ------------------
   91|    545|      return 4;
   92|    398|    case weekday::friday:
  ------------------
  |  Branch (92:5): [True: 398, False: 8.69k]
  ------------------
   93|    398|      return 5;
   94|    459|    case weekday::saturday:
  ------------------
  |  Branch (94:5): [True: 459, False: 8.63k]
  ------------------
   95|    459|      return 6;
   96|  9.09k|  }
   97|      0|  return 0; /*NOTREACHED*/
   98|  9.09k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18FormatTMEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_RK2tm:
  224|   107k|void FormatTM(std::string* out, const std::string& fmt, const std::tm& tm) {
  225|       |  // We assume that 16 times the length of the format string will
  226|       |  // be sufficient to store the result.  The extreme case appears
  227|       |  // to be "%c" (2 chars), which, in the POSIX locale, produces
  228|       |  // "Thu Jan 1 00:00:00 1970" (24 chars).
  229|   107k|  auto out_size = out->size();
  230|   107k|  auto buf_size = (16 * fmt.size()) + 1;
  231|   107k|  out->resize(out_size + buf_size);
  232|   107k|  auto len = strftime(&(*out)[out_size], buf_size, fmt.c_str(), &tm);
  233|   107k|  out->resize(out_size + len);
  234|   107k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18Format64EPcil:
  156|  19.7k|char* Format64(char* ep, int width, std::int_fast64_t v) {
  157|  19.7k|  bool neg = false;
  158|  19.7k|  if (v < 0) {
  ------------------
  |  Branch (158:7): [True: 843, False: 18.8k]
  ------------------
  159|    843|    --width;
  160|    843|    neg = true;
  161|    843|    if (v == std::numeric_limits<std::int_fast64_t>::min()) {
  ------------------
  |  Branch (161:9): [True: 0, False: 843]
  ------------------
  162|       |      // Avoid negating minimum value.
  163|      0|      std::int_fast64_t last_digit = -(v % 10);
  164|      0|      v /= 10;
  165|      0|      if (last_digit < 0) {
  ------------------
  |  Branch (165:11): [True: 0, False: 0]
  ------------------
  166|      0|        ++v;
  167|      0|        last_digit += 10;
  168|      0|      }
  169|      0|      --width;
  170|      0|      *--ep = kDigits[last_digit];
  171|      0|    }
  172|    843|    v = -v;
  173|    843|  }
  174|  87.0k|  do {
  175|  87.0k|    --width;
  176|  87.0k|    *--ep = kDigits[v % 10];
  177|  87.0k|  } while (v /= 10);
  ------------------
  |  Branch (177:12): [True: 67.3k, False: 19.7k]
  ------------------
  178|   127k|  while (--width >= 0) *--ep = '0';  // zero pad
  ------------------
  |  Branch (178:10): [True: 107k, False: 19.7k]
  ------------------
  179|  19.7k|  if (neg) *--ep = '-';
  ------------------
  |  Branch (179:7): [True: 843, False: 18.8k]
  ------------------
  180|  19.7k|  return ep;
  181|  19.7k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_19Format02dEPci:
  184|   155k|char* Format02d(char* ep, int v) {
  185|   155k|  *--ep = kDigits[v % 10];
  186|   155k|  *--ep = kDigits[(v / 10) % 10];
  187|   155k|  return ep;
  188|   155k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_16ToWeekERKNS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  146|  7.62k|int ToWeek(const civil_day& cd, weekday week_start) {
  147|  7.62k|  const civil_day d(cd.year() % 400, cd.month(), cd.day());
  148|  7.62k|  return static_cast<int>((d - prev_weekday(civil_year(d), week_start)) / 7);
  149|  7.62k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_112FormatOffsetEPciPKc:
  191|  49.8k|char* FormatOffset(char* ep, int offset, const char* mode) {
  192|       |  // TODO: Follow the RFC3339 "Unknown Local Offset Convention" and
  193|       |  // generate a "negative zero" when we're formatting a zero offset
  194|       |  // as the result of a failed load_time_zone().
  195|  49.8k|  char sign = '+';
  196|  49.8k|  if (offset < 0) {
  ------------------
  |  Branch (196:7): [True: 38.1k, False: 11.6k]
  ------------------
  197|  38.1k|    offset = -offset;  // bounded by 24h so no overflow
  198|  38.1k|    sign = '-';
  199|  38.1k|  }
  200|  49.8k|  const int seconds = offset % 60;
  201|  49.8k|  const int minutes = (offset /= 60) % 60;
  202|  49.8k|  const int hours = offset /= 60;
  203|  49.8k|  const char sep = mode[0];
  204|  49.8k|  const bool ext = (sep != '\0' && mode[1] == '*');
  ------------------
  |  Branch (204:21): [True: 45.2k, False: 4.51k]
  |  Branch (204:36): [True: 34.8k, False: 10.4k]
  ------------------
  205|  49.8k|  const bool ccc = (ext && mode[2] == ':');
  ------------------
  |  Branch (205:21): [True: 34.8k, False: 14.9k]
  |  Branch (205:28): [True: 1.98k, False: 32.8k]
  ------------------
  206|  49.8k|  if (ext && (!ccc || seconds != 0)) {
  ------------------
  |  Branch (206:7): [True: 34.8k, False: 14.9k]
  |  Branch (206:15): [True: 32.8k, False: 1.98k]
  |  Branch (206:23): [True: 615, False: 1.36k]
  ------------------
  207|  33.4k|    ep = Format02d(ep, seconds);
  208|  33.4k|    *--ep = sep;
  209|  33.4k|  } else {
  210|       |    // If we're not rendering seconds, sub-minute negative offsets
  211|       |    // should get a positive sign (e.g., offset=-10s => "+00:00").
  212|  16.3k|    if (hours == 0 && minutes == 0) sign = '+';
  ------------------
  |  Branch (212:9): [True: 5.33k, False: 10.9k]
  |  Branch (212:23): [True: 4.46k, False: 867]
  ------------------
  213|  16.3k|  }
  214|  49.8k|  if (!ccc || minutes != 0 || seconds != 0) {
  ------------------
  |  Branch (214:7): [True: 47.8k, False: 1.98k]
  |  Branch (214:15): [True: 621, False: 1.35k]
  |  Branch (214:31): [True: 204, False: 1.15k]
  ------------------
  215|  48.6k|    ep = Format02d(ep, minutes);
  216|  48.6k|    if (sep != '\0') *--ep = sep;
  ------------------
  |  Branch (216:9): [True: 44.1k, False: 4.51k]
  ------------------
  217|  48.6k|  }
  218|  49.8k|  ep = Format02d(ep, hours);
  219|  49.8k|  *--ep = sign;
  220|  49.8k|  return ep;
  221|  49.8k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17isdigitEc:
   60|  43.4k|bool isdigit(char ch) {
   61|  43.4k|  return std::isdigit(static_cast<unsigned char>(ch)) != 0;
   62|  43.4k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17isspaceEc:
   64|   348k|bool isspace(char ch) {
   65|   348k|  return std::isspace(static_cast<unsigned char>(ch)) != 0;
   66|   348k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_111ParseOffsetEPKcS3_Pi:
  593|  6.84k|const char* ParseOffset(const char* dp, const char* mode, int* offset) {
  594|  6.84k|  if (dp != nullptr) {
  ------------------
  |  Branch (594:7): [True: 6.84k, False: 0]
  ------------------
  595|  6.84k|    const char first = *dp++;
  596|  6.84k|    if (first == '+' || first == '-') {
  ------------------
  |  Branch (596:9): [True: 1.32k, False: 5.52k]
  |  Branch (596:25): [True: 3.70k, False: 1.82k]
  ------------------
  597|  5.02k|      char sep = mode[0];
  598|  5.02k|      int hours = 0;
  599|  5.02k|      int minutes = 0;
  600|  5.02k|      int seconds = 0;
  601|  5.02k|      const char* ap = ParseInt(dp, 2, 0, 23, &hours);
  602|  5.02k|      if (ap != nullptr && ap - dp == 2) {
  ------------------
  |  Branch (602:11): [True: 4.99k, False: 30]
  |  Branch (602:28): [True: 4.98k, False: 14]
  ------------------
  603|  4.98k|        dp = ap;
  604|  4.98k|        if (sep != '\0' && *ap == sep) ++ap;
  ------------------
  |  Branch (604:13): [True: 2.32k, False: 2.65k]
  |  Branch (604:28): [True: 20, False: 2.30k]
  ------------------
  605|  4.98k|        const char* bp = ParseInt(ap, 2, 0, 59, &minutes);
  606|  4.98k|        if (bp != nullptr && bp - ap == 2) {
  ------------------
  |  Branch (606:13): [True: 2.94k, False: 2.03k]
  |  Branch (606:30): [True: 2.13k, False: 803]
  ------------------
  607|  2.13k|          dp = bp;
  608|  2.13k|          if (sep != '\0' && *bp == sep) ++bp;
  ------------------
  |  Branch (608:15): [True: 1.05k, False: 1.08k]
  |  Branch (608:30): [True: 10, False: 1.04k]
  ------------------
  609|  2.13k|          const char* cp = ParseInt(bp, 2, 0, 59, &seconds);
  610|  2.13k|          if (cp != nullptr && cp - bp == 2) dp = cp;
  ------------------
  |  Branch (610:15): [True: 909, False: 1.23k]
  |  Branch (610:32): [True: 565, False: 344]
  ------------------
  611|  2.13k|        }
  612|  4.98k|        *offset = ((hours * 60 + minutes) * 60) + seconds;
  613|  4.98k|        if (first == '-') *offset = -*offset;
  ------------------
  |  Branch (613:13): [True: 3.66k, False: 1.31k]
  ------------------
  614|  4.98k|      } else {
  615|     44|        dp = nullptr;
  616|     44|      }
  617|  5.02k|    } else if (first == 'Z' || first == 'z') {  // Zulu
  ------------------
  |  Branch (617:16): [True: 717, False: 1.10k]
  |  Branch (617:32): [True: 1.04k, False: 63]
  ------------------
  618|  1.76k|      *offset = 0;
  619|  1.76k|    } else {
  620|     63|      dp = nullptr;
  621|     63|    }
  622|  6.84k|  }
  623|  6.84k|  return dp;
  624|  6.84k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_19ParseZoneEPKcPNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  626|    854|const char* ParseZone(const char* dp, std::string* zone) {
  627|    854|  zone->clear();
  628|    854|  if (dp != nullptr) {
  ------------------
  |  Branch (628:7): [True: 854, False: 0]
  ------------------
  629|   300k|    while (*dp != '\0' && !isspace(*dp)) zone->push_back(*dp++);
  ------------------
  |  Branch (629:12): [True: 300k, False: 277]
  |  Branch (629:27): [True: 299k, False: 577]
  ------------------
  630|    854|    if (zone->empty()) dp = nullptr;
  ------------------
  |  Branch (630:9): [True: 22, False: 832]
  ------------------
  631|    854|  }
  632|    854|  return dp;
  633|    854|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_115ParseSubSecondsEPKcPNSt3__16chrono8durationIlNS4_5ratioILl1ELl1000000000000000EEEEE:
  635|  1.43k|const char* ParseSubSeconds(const char* dp, detail::femtoseconds* subseconds) {
  636|  1.43k|  if (dp != nullptr) {
  ------------------
  |  Branch (636:7): [True: 1.43k, False: 0]
  ------------------
  637|  1.43k|    std::int_fast64_t v = 0;
  638|  1.43k|    std::int_fast64_t exp = 0;
  639|  1.43k|    const char* const bp = dp;
  640|  3.90k|    while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (640:24): [True: 2.51k, False: 1.38k]
  ------------------
  641|  2.51k|      int d = static_cast<int>(cp - kDigits);
  642|  2.51k|      if (d >= 10) break;
  ------------------
  |  Branch (642:11): [True: 52, False: 2.46k]
  ------------------
  643|  2.46k|      if (exp < 15) {
  ------------------
  |  Branch (643:11): [True: 2.14k, False: 324]
  ------------------
  644|  2.14k|        exp += 1;
  645|  2.14k|        v *= 10;
  646|  2.14k|        v += d;
  647|  2.14k|      }
  648|  2.46k|      ++dp;
  649|  2.46k|    }
  650|  1.43k|    if (dp != bp) {
  ------------------
  |  Branch (650:9): [True: 1.42k, False: 8]
  ------------------
  651|  1.42k|      v *= kExp10[15 - exp];
  652|  1.42k|      *subseconds = detail::femtoseconds(v);
  653|  1.42k|    } else {
  654|      8|      dp = nullptr;
  655|      8|    }
  656|  1.43k|  }
  657|  1.43k|  return dp;
  658|  1.43k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17ParseTMEPKcS3_P2tm:
  661|  1.77k|const char* ParseTM(const char* dp, const char* fmt, std::tm* tm) {
  662|  1.77k|  if (dp != nullptr) {
  ------------------
  |  Branch (662:7): [True: 1.77k, False: 0]
  ------------------
  663|  1.77k|    dp = strptime(dp, fmt, tm);
  664|  1.77k|  }
  665|  1.77k|  return dp;
  666|  1.77k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18FromWeekEiNS0_7weekdayEPlP2tm:
  671|    327|bool FromWeek(int week_num, weekday week_start, year_t* year, std::tm* tm) {
  672|    327|  const civil_year y(*year % 400);
  673|    327|  civil_day cd = prev_weekday(y, week_start);  // week 0
  674|    327|  cd = next_weekday(cd - 1, FromTmWday(tm->tm_wday)) + (week_num * 7);
  675|    327|  if (const year_t shift = cd.year() - y.year()) {
  ------------------
  |  Branch (675:20): [True: 206, False: 121]
  ------------------
  676|    206|    if (shift > 0) {
  ------------------
  |  Branch (676:9): [True: 70, False: 136]
  ------------------
  677|     70|      if (*year > std::numeric_limits<year_t>::max() - shift) return false;
  ------------------
  |  Branch (677:11): [True: 1, False: 69]
  ------------------
  678|    136|    } else {
  679|    136|      if (*year < std::numeric_limits<year_t>::min() - shift) return false;
  ------------------
  |  Branch (679:11): [True: 1, False: 135]
  ------------------
  680|    136|    }
  681|    204|    *year += shift;
  682|    204|  }
  683|    325|  tm->tm_mon = cd.month() - 1;
  684|    325|  tm->tm_mday = cd.day();
  685|    325|  return true;
  686|    327|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_110FromTmWdayEi:
  101|    327|weekday FromTmWday(int tm_wday) {
  102|    327|  switch (tm_wday) {
  ------------------
  |  Branch (102:11): [True: 327, False: 0]
  ------------------
  103|     10|    case 0:
  ------------------
  |  Branch (103:5): [True: 10, False: 317]
  ------------------
  104|     10|      return weekday::sunday;
  105|     13|    case 1:
  ------------------
  |  Branch (105:5): [True: 13, False: 314]
  ------------------
  106|     13|      return weekday::monday;
  107|      2|    case 2:
  ------------------
  |  Branch (107:5): [True: 2, False: 325]
  ------------------
  108|      2|      return weekday::tuesday;
  109|      7|    case 3:
  ------------------
  |  Branch (109:5): [True: 7, False: 320]
  ------------------
  110|      7|      return weekday::wednesday;
  111|    284|    case 4:
  ------------------
  |  Branch (111:5): [True: 284, False: 43]
  ------------------
  112|    284|      return weekday::thursday;
  113|      8|    case 5:
  ------------------
  |  Branch (113:5): [True: 8, False: 319]
  ------------------
  114|      8|      return weekday::friday;
  115|      3|    case 6:
  ------------------
  |  Branch (115:5): [True: 3, False: 324]
  ------------------
  116|      3|      return weekday::saturday;
  117|    327|  }
  118|      0|  return weekday::sunday; /*NOTREACHED*/
  119|    327|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ParseIntIiEEPKcS4_iT_S5_PS5_:
  238|  49.1k|const char* ParseInt(const char* dp, int width, T min, T max, T* vp) {
  239|  49.1k|  if (dp != nullptr) {
  ------------------
  |  Branch (239:7): [True: 48.1k, False: 964]
  ------------------
  240|  48.1k|    const T kmin = std::numeric_limits<T>::min();
  241|  48.1k|    bool erange = false;
  242|  48.1k|    bool neg = false;
  243|  48.1k|    T value = 0;
  244|  48.1k|    if (*dp == '-') {
  ------------------
  |  Branch (244:9): [True: 2.33k, False: 45.8k]
  ------------------
  245|  2.33k|      neg = true;
  246|  2.33k|      if (width <= 0 || --width != 0) {
  ------------------
  |  Branch (246:11): [True: 197, False: 2.13k]
  |  Branch (246:25): [True: 2.13k, False: 0]
  ------------------
  247|  2.33k|        ++dp;
  248|  2.33k|      } else {
  249|      0|        dp = nullptr;  // width was 1
  250|      0|      }
  251|  2.33k|    }
  252|  48.1k|    if (const char* const bp = dp) {
  ------------------
  |  Branch (252:27): [True: 48.1k, False: 0]
  ------------------
  253|   234k|      while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (253:26): [True: 212k, False: 22.0k]
  ------------------
  254|   212k|        int d = static_cast<int>(cp - kDigits);
  255|   212k|        if (d >= 10) break;
  ------------------
  |  Branch (255:13): [True: 1.88k, False: 210k]
  ------------------
  256|   210k|        if (value < kmin / 10) {
  ------------------
  |  Branch (256:13): [True: 9.45k, False: 200k]
  ------------------
  257|  9.45k|          erange = true;
  258|  9.45k|          break;
  259|  9.45k|        }
  260|   200k|        value *= 10;
  261|   200k|        if (value < kmin + d) {
  ------------------
  |  Branch (261:13): [True: 389, False: 200k]
  ------------------
  262|    389|          erange = true;
  263|    389|          break;
  264|    389|        }
  265|   200k|        value -= d;
  266|   200k|        dp += 1;
  267|   200k|        if (width > 0 && --width == 0) break;
  ------------------
  |  Branch (267:13): [True: 29.7k, False: 170k]
  |  Branch (267:26): [True: 14.3k, False: 15.4k]
  ------------------
  268|   200k|      }
  269|  48.1k|      if (dp != bp && !erange && (neg || value != kmin)) {
  ------------------
  |  Branch (269:11): [True: 46.8k, False: 1.29k]
  |  Branch (269:23): [True: 37.0k, False: 9.84k]
  |  Branch (269:35): [True: 2.30k, False: 34.7k]
  |  Branch (269:42): [True: 34.4k, False: 252]
  ------------------
  270|  36.7k|        if (!neg || value != 0) {
  ------------------
  |  Branch (270:13): [True: 34.4k, False: 2.30k]
  |  Branch (270:21): [True: 1.17k, False: 1.13k]
  ------------------
  271|  35.6k|          if (!neg) value = -value;  // make positive
  ------------------
  |  Branch (271:15): [True: 34.4k, False: 1.17k]
  ------------------
  272|  35.6k|          if (min <= value && value <= max) {
  ------------------
  |  Branch (272:15): [True: 34.4k, False: 1.17k]
  |  Branch (272:31): [True: 31.1k, False: 3.30k]
  ------------------
  273|  31.1k|            *vp = value;
  274|  31.1k|          } else {
  275|  4.48k|            dp = nullptr;
  276|  4.48k|          }
  277|  35.6k|        } else {
  278|  1.13k|          dp = nullptr;
  279|  1.13k|        }
  280|  36.7k|      } else {
  281|  11.3k|        dp = nullptr;
  282|  11.3k|      }
  283|  48.1k|    }
  284|  48.1k|  }
  285|  49.1k|  return dp;
  286|  49.1k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ParseIntIlEEPKcS4_iT_S5_PS5_:
  238|  4.07k|const char* ParseInt(const char* dp, int width, T min, T max, T* vp) {
  239|  4.07k|  if (dp != nullptr) {
  ------------------
  |  Branch (239:7): [True: 4.07k, False: 0]
  ------------------
  240|  4.07k|    const T kmin = std::numeric_limits<T>::min();
  241|  4.07k|    bool erange = false;
  242|  4.07k|    bool neg = false;
  243|  4.07k|    T value = 0;
  244|  4.07k|    if (*dp == '-') {
  ------------------
  |  Branch (244:9): [True: 1.98k, False: 2.09k]
  ------------------
  245|  1.98k|      neg = true;
  246|  1.98k|      if (width <= 0 || --width != 0) {
  ------------------
  |  Branch (246:11): [True: 1.91k, False: 65]
  |  Branch (246:25): [True: 65, False: 0]
  ------------------
  247|  1.98k|        ++dp;
  248|  1.98k|      } else {
  249|      0|        dp = nullptr;  // width was 1
  250|      0|      }
  251|  1.98k|    }
  252|  4.07k|    if (const char* const bp = dp) {
  ------------------
  |  Branch (252:27): [True: 4.07k, False: 0]
  ------------------
  253|  35.3k|      while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (253:26): [True: 34.1k, False: 1.20k]
  ------------------
  254|  34.1k|        int d = static_cast<int>(cp - kDigits);
  255|  34.1k|        if (d >= 10) break;
  ------------------
  |  Branch (255:13): [True: 2.40k, False: 31.7k]
  ------------------
  256|  31.7k|        if (value < kmin / 10) {
  ------------------
  |  Branch (256:13): [True: 176, False: 31.5k]
  ------------------
  257|    176|          erange = true;
  258|    176|          break;
  259|    176|        }
  260|  31.5k|        value *= 10;
  261|  31.5k|        if (value < kmin + d) {
  ------------------
  |  Branch (261:13): [True: 3, False: 31.5k]
  ------------------
  262|      3|          erange = true;
  263|      3|          break;
  264|      3|        }
  265|  31.5k|        value -= d;
  266|  31.5k|        dp += 1;
  267|  31.5k|        if (width > 0 && --width == 0) break;
  ------------------
  |  Branch (267:13): [True: 1.21k, False: 30.3k]
  |  Branch (267:26): [True: 294, False: 924]
  ------------------
  268|  31.5k|      }
  269|  4.07k|      if (dp != bp && !erange && (neg || value != kmin)) {
  ------------------
  |  Branch (269:11): [True: 3.97k, False: 96]
  |  Branch (269:23): [True: 3.80k, False: 179]
  |  Branch (269:35): [True: 1.96k, False: 1.83k]
  |  Branch (269:42): [True: 1.83k, False: 3]
  ------------------
  270|  3.79k|        if (!neg || value != 0) {
  ------------------
  |  Branch (270:13): [True: 1.83k, False: 1.96k]
  |  Branch (270:21): [True: 1.96k, False: 6]
  ------------------
  271|  3.79k|          if (!neg) value = -value;  // make positive
  ------------------
  |  Branch (271:15): [True: 1.83k, False: 1.96k]
  ------------------
  272|  3.79k|          if (min <= value && value <= max) {
  ------------------
  |  Branch (272:15): [True: 3.79k, False: 0]
  |  Branch (272:31): [True: 3.79k, False: 0]
  ------------------
  273|  3.79k|            *vp = value;
  274|  3.79k|          } else {
  275|      0|            dp = nullptr;
  276|      0|          }
  277|  3.79k|        } else {
  278|      6|          dp = nullptr;
  279|      6|        }
  280|  3.79k|      } else {
  281|    278|        dp = nullptr;
  282|    278|      }
  283|  4.07k|    }
  284|  4.07k|  }
  285|  4.07k|  return dp;
  286|  4.07k|}

_ZN4cctz10TimeZoneIf3UTCEv:
   21|      1|std::unique_ptr<TimeZoneIf> TimeZoneIf::UTC() {
   22|      1|  return TimeZoneInfo::UTC();
   23|      1|}
_ZN4cctz10TimeZoneIf4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   25|  1.57k|std::unique_ptr<TimeZoneIf> TimeZoneIf::Make(const std::string& name) {
   26|       |  // Support "libc:localtime" and "libc:*" to access the legacy
   27|       |  // localtime and UTC support respectively from the C library.
   28|       |  // NOTE: The "libc:*" zones are internal, test-only interfaces, and
   29|       |  // are subject to change/removal without notice. Do not use them.
   30|  1.57k|  if (name.compare(0, 5, "libc:") == 0) {
  ------------------
  |  Branch (30:7): [True: 262, False: 1.31k]
  ------------------
   31|    262|    return TimeZoneLibC::Make(name.substr(5));
   32|    262|  }
   33|       |
   34|       |  // Otherwise use the "zoneinfo" implementation.
   35|  1.31k|  return TimeZoneInfo::Make(name);
   36|  1.57k|}
_ZN4cctz10TimeZoneIfD2Ev:
   39|    740|TimeZoneIf::~TimeZoneIf() {}

_ZN4cctz13ToUnixSecondsERKNSt3__16chrono10time_pointINS1_12system_clockENS1_8durationIlNS0_5ratioILl1ELl1EEEEEEE:
   61|  13.9k|inline std::int_fast64_t ToUnixSeconds(const time_point<seconds>& tp) {
   62|  13.9k|  return (tp - std::chrono::time_point_cast<seconds>(
   63|  13.9k|                   std::chrono::system_clock::from_time_t(0))).count();
   64|  13.9k|}
_ZN4cctz15FromUnixSecondsEl:
   65|  15.0k|inline time_point<seconds> FromUnixSeconds(std::int_fast64_t t) {
   66|  15.0k|  return std::chrono::time_point_cast<seconds>(
   67|  15.0k|             std::chrono::system_clock::from_time_t(0)) + seconds(t);
   68|  15.0k|}
_ZN4cctz10TimeZoneIfC2Ev:
   52|  1.57k|  TimeZoneIf() = default;

_ZN4cctz9time_zone4Impl3UTCEv:
   45|    210|time_zone time_zone::Impl::UTC() {
   46|    210|  return time_zone(UTCImpl());
   47|    210|}
_ZN4cctz9time_zone4Impl12LoadTimeZoneERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPS0_:
   49|  9.83k|bool time_zone::Impl::LoadTimeZone(const std::string& name, time_zone* tz) {
   50|  9.83k|  const Impl* const utc_impl = UTCImpl();
   51|       |
   52|       |  // Check for UTC (which is never a key in time_zone_map).
   53|  9.83k|  auto offset = seconds::zero();
   54|  9.83k|  if (FixedOffsetFromName(name, &offset) && offset == seconds::zero()) {
  ------------------
  |  Branch (54:7): [True: 2.00k, False: 7.82k]
  |  Branch (54:7): [True: 1.62k, False: 8.21k]
  |  Branch (54:45): [True: 1.62k, False: 388]
  ------------------
   55|  1.62k|    *tz = time_zone(utc_impl);
   56|  1.62k|    return true;
   57|  1.62k|  }
   58|       |
   59|       |  // Check whether the time zone has already been loaded.
   60|  8.21k|  {
   61|  8.21k|    std::lock_guard<std::mutex> lock(TimeZoneMutex());
   62|  8.21k|    if (time_zone_map != nullptr) {
  ------------------
  |  Branch (62:9): [True: 8.21k, False: 1]
  ------------------
   63|  8.21k|      TimeZoneImplByName::const_iterator itr = time_zone_map->find(name);
   64|  8.21k|      if (itr != time_zone_map->end()) {
  ------------------
  |  Branch (64:11): [True: 6.64k, False: 1.57k]
  ------------------
   65|  6.64k|        *tz = time_zone(itr->second);
   66|  6.64k|        return itr->second != utc_impl;
   67|  6.64k|      }
   68|  8.21k|    }
   69|  8.21k|  }
   70|       |
   71|       |  // Load the new time zone (outside the lock).
   72|  1.57k|  std::unique_ptr<const Impl> new_impl(new Impl(name));
   73|       |
   74|       |  // Add the new time zone to the map.
   75|  1.57k|  std::lock_guard<std::mutex> lock(TimeZoneMutex());
   76|  1.57k|  if (time_zone_map == nullptr) time_zone_map = new TimeZoneImplByName;
  ------------------
  |  Branch (76:7): [True: 1, False: 1.57k]
  ------------------
   77|  1.57k|  if (!new_impl->zone_) {
  ------------------
  |  Branch (77:7): [True: 740, False: 834]
  ------------------
   78|       |    // Load failed, but a successful insertion may have happened concurrently.
   79|       |    // Check it now that we have the lock. Otherwise, avoid caching negative
   80|       |    // entries to avoid unbounded growth and DoS attacks.
   81|    740|    auto itr = time_zone_map->find(name);
   82|    740|    const Impl* impl = (itr != time_zone_map->end()) ? itr->second : utc_impl;
  ------------------
  |  Branch (82:24): [True: 0, False: 740]
  ------------------
   83|    740|    *tz = time_zone(impl);
   84|    740|    return impl != utc_impl;
   85|    740|  }
   86|    834|  const Impl*& impl = (*time_zone_map)[name];
   87|    834|  if (impl == nullptr) {  // this thread won any load race
  ------------------
  |  Branch (87:7): [True: 834, False: 0]
  ------------------
   88|    834|    impl = new_impl.release();
   89|    834|  }
   90|    834|  *tz = time_zone(impl);
   91|    834|  return impl != utc_impl;
   92|  1.57k|}
_ZN4cctz9time_zone4ImplC2Ev:
  109|      1|time_zone::Impl::Impl() : name_("UTC"), zone_(TimeZoneIf::UTC()) {}
_ZN4cctz9time_zone4ImplC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  112|  1.57k|    : name_(name), zone_(TimeZoneIf::Make(name_)) {}
_ZN4cctz9time_zone4Impl7UTCImplEv:
  114|  10.0k|const time_zone::Impl* time_zone::Impl::UTCImpl() {
  115|  10.0k|  static const Impl* utc_impl = new Impl;
  116|  10.0k|  return utc_impl;
  117|  10.0k|}
time_zone_impl.cc:_ZN4cctz12_GLOBAL__N_113TimeZoneMutexEv:
   36|  9.78k|std::mutex& TimeZoneMutex() {
   37|       |  // This mutex is intentionally "leaked" to avoid the static deinitialization
   38|       |  // order fiasco (std::mutex's destructor is not trivial on many platforms).
   39|  9.78k|  static std::mutex* time_zone_mutex = new std::mutex;
   40|  9.78k|  return *time_zone_mutex;
   41|  9.78k|}

_ZNK4cctz9time_zone4Impl9BreakTimeERKNSt3__16chrono10time_pointINS3_12system_clockENS3_8durationIlNS2_5ratioILl1ELl1EEEEEEE:
   49|  9.82k|  time_zone::absolute_lookup BreakTime(const time_point<seconds>& tp) const {
   50|  9.82k|    return zone_->BreakTime(tp);
   51|  9.82k|  }
_ZNK4cctz9time_zone4Impl8MakeTimeERKNS_6detail10civil_timeINS2_10second_tagEEE:
   56|  15.2k|  time_zone::civil_lookup MakeTime(const civil_second& cs) const {
   57|  15.2k|    return zone_->MakeTime(cs);
   58|  15.2k|  }

_ZN4cctz12TimeZoneInfo17GetTransitionTypeElbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPh:
  273|    383|                                     std::uint_least8_t* index) {
  274|    383|  std::size_t type_index = 0;
  275|    383|  std::size_t abbr_index = abbreviations_.size();
  276|    580|  for (; type_index != transition_types_.size(); ++type_index) {
  ------------------
  |  Branch (276:10): [True: 580, False: 0]
  ------------------
  277|    580|    const TransitionType& tt(transition_types_[type_index]);
  278|    580|    const char* tt_abbr = &abbreviations_[tt.abbr_index];
  279|    580|    if (tt_abbr == abbr) abbr_index = tt.abbr_index;
  ------------------
  |  Branch (279:9): [True: 383, False: 197]
  ------------------
  280|    580|    if (tt.utc_offset == utc_offset && tt.is_dst == is_dst) {
  ------------------
  |  Branch (280:9): [True: 398, False: 182]
  |  Branch (280:40): [True: 393, False: 5]
  ------------------
  281|    393|      if (abbr_index == tt.abbr_index) break;  // reuse
  ------------------
  |  Branch (281:11): [True: 383, False: 10]
  ------------------
  282|    393|    }
  283|    580|  }
  284|    383|  if (type_index > 255 || abbr_index > 255) {
  ------------------
  |  Branch (284:7): [True: 0, False: 383]
  |  Branch (284:27): [True: 0, False: 383]
  ------------------
  285|       |    // No index space (8 bits) available for a new type or abbreviation.
  286|      0|    return false;
  287|      0|  }
  288|    383|  if (type_index == transition_types_.size()) {
  ------------------
  |  Branch (288:7): [True: 0, False: 383]
  ------------------
  289|      0|    TransitionType& tt(*transition_types_.emplace(transition_types_.end()));
  290|      0|    tt.utc_offset = static_cast<std::int_least32_t>(utc_offset);
  291|      0|    tt.is_dst = is_dst;
  292|      0|    if (abbr_index == abbreviations_.size()) {
  ------------------
  |  Branch (292:9): [True: 0, False: 0]
  ------------------
  293|      0|      abbreviations_.append(abbr);
  294|      0|      abbreviations_.append(1, '\0');
  295|      0|    }
  296|      0|    tt.abbr_index = static_cast<std::uint_least8_t>(abbr_index);
  297|      0|  }
  298|    383|  *index = static_cast<std::uint_least8_t>(type_index);
  299|    383|  return true;
  300|    383|}
_ZNK4cctz12TimeZoneInfo16EquivTransitionsEhh:
  306|    109|                                    std::uint_fast8_t tt2_index) const {
  307|    109|  if (tt1_index == tt2_index) return true;
  ------------------
  |  Branch (307:7): [True: 109, False: 0]
  ------------------
  308|      0|  const TransitionType& tt1(transition_types_[tt1_index]);
  309|      0|  const TransitionType& tt2(transition_types_[tt2_index]);
  310|      0|  if (tt1.utc_offset != tt2.utc_offset) return false;
  ------------------
  |  Branch (310:7): [True: 0, False: 0]
  ------------------
  311|      0|  if (tt1.is_dst != tt2.is_dst) return false;
  ------------------
  |  Branch (311:7): [True: 0, False: 0]
  ------------------
  312|      0|  if (tt1.abbr_index != tt2.abbr_index) return false;
  ------------------
  |  Branch (312:7): [True: 0, False: 0]
  ------------------
  313|      0|  return true;
  314|      0|}
_ZN4cctz12TimeZoneInfo17ExtendTransitionsEv:
  318|    246|bool TimeZoneInfo::ExtendTransitions() {
  319|    246|  extended_ = false;
  320|    246|  if (future_spec_.empty()) return true;  // last transition prevails
  ------------------
  |  Branch (320:7): [True: 0, False: 246]
  ------------------
  321|       |
  322|    246|  PosixTimeZone posix;
  323|    246|  if (!ParsePosixSpec(future_spec_, &posix)) return false;
  ------------------
  |  Branch (323:7): [True: 0, False: 246]
  ------------------
  324|       |
  325|       |  // Find transition type for the future std specification.
  326|    246|  std::uint_least8_t std_ti;
  327|    246|  if (!GetTransitionType(posix.std_offset, false, posix.std_abbr, &std_ti))
  ------------------
  |  Branch (327:7): [True: 0, False: 246]
  ------------------
  328|      0|    return false;
  329|       |
  330|    246|  if (posix.dst_abbr.empty()) {  // std only
  ------------------
  |  Branch (330:7): [True: 109, False: 137]
  ------------------
  331|       |    // The future specification should match the last transition, and
  332|       |    // that means that handling the future will fall out naturally.
  333|    109|    return EquivTransitions(transitions_.back().type_index, std_ti);
  334|    109|  }
  335|       |
  336|       |  // Find transition type for the future dst specification.
  337|    137|  std::uint_least8_t dst_ti;
  338|    137|  if (!GetTransitionType(posix.dst_offset, true, posix.dst_abbr, &dst_ti))
  ------------------
  |  Branch (338:7): [True: 0, False: 137]
  ------------------
  339|      0|    return false;
  340|       |
  341|    137|  if (AllYearDST(posix)) {  // dst only
  ------------------
  |  Branch (341:7): [True: 0, False: 137]
  ------------------
  342|       |    // The future specification should match the last transition, and
  343|       |    // that means that handling the future will fall out naturally.
  344|      0|    return EquivTransitions(transitions_.back().type_index, dst_ti);
  345|      0|  }
  346|       |
  347|       |  // We require that zoneinfo data with a rule for future transitions
  348|       |  // ends with a non-negative transition.  This removes the need to add
  349|       |  // any "second-half" transition to ensure differences between adjacent
  350|       |  // transitions are always representable, while also guaranteeing that
  351|       |  // the arithmetic used to shift between 400-year cycles never overflows.
  352|       |  // All valid zones easily meet this requirement.
  353|    137|  if (transitions_.back().unix_time < 0) return false;
  ------------------
  |  Branch (353:7): [True: 0, False: 137]
  ------------------
  354|       |
  355|       |  // Extend the transitions for an additional 401 years using the future
  356|       |  // specification. Years beyond those can be handled by mapping back to
  357|       |  // a cycle-equivalent year within that range. Note that we need 401
  358|       |  // (well, at least the first transition in the 401st year) so that the
  359|       |  // end of the 400th year is mapped back to an extended year. And first
  360|       |  // we may also need two additional transitions for the current year.
  361|    137|  transitions_.reserve(transitions_.size() + 2 + 401 * 2);
  362|    137|  extended_ = true;
  363|       |
  364|    137|  const Transition& last(transitions_.back());
  365|    137|  const std::int_fast64_t last_time = last.unix_time;
  366|    137|  const TransitionType& last_tt(transition_types_[last.type_index]);
  367|    137|  last_year_ = LocalTime(last_time, last_tt).cs.year();
  368|    137|  bool leap_year = IsLeap(last_year_);
  369|    137|  const civil_second jan1(last_year_);
  370|    137|  std::int_fast64_t jan1_time = jan1 - civil_second();
  371|    137|  int jan1_weekday = ToPosixWeekday(get_weekday(jan1));
  372|       |
  373|    137|  Transition dst = {0, dst_ti, civil_second(), civil_second()};
  374|    137|  Transition std = {0, std_ti, civil_second(), civil_second()};
  375|  55.0k|  for (const year_t limit = last_year_ + 401;; ++last_year_) {
  376|  55.0k|    auto dst_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_start);
  377|  55.0k|    auto std_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_end);
  378|  55.0k|    dst.unix_time = jan1_time + dst_trans_off - posix.std_offset;
  379|  55.0k|    std.unix_time = jan1_time + std_trans_off - posix.dst_offset;
  380|  55.0k|    const auto* ta = dst.unix_time < std.unix_time ? &dst : &std;
  ------------------
  |  Branch (380:22): [True: 55.0k, False: 0]
  ------------------
  381|  55.0k|    const auto* tb = dst.unix_time < std.unix_time ? &std : &dst;
  ------------------
  |  Branch (381:22): [True: 55.0k, False: 0]
  ------------------
  382|  55.0k|    if (last_time < tb->unix_time) {
  ------------------
  |  Branch (382:9): [True: 54.9k, False: 137]
  ------------------
  383|  54.9k|      if (last_time < ta->unix_time) transitions_.push_back(*ta);
  ------------------
  |  Branch (383:11): [True: 54.9k, False: 0]
  ------------------
  384|  54.9k|      transitions_.push_back(*tb);
  385|  54.9k|    }
  386|  55.0k|    if (last_year_ == limit) break;
  ------------------
  |  Branch (386:9): [True: 137, False: 54.9k]
  ------------------
  387|  54.9k|    jan1_time += kSecsPerYear[leap_year];
  388|  54.9k|    jan1_weekday = (jan1_weekday + kDaysPerYear[leap_year]) % 7;
  389|  54.9k|    leap_year = !leap_year && IsLeap(last_year_ + 1);
  ------------------
  |  Branch (389:17): [True: 41.6k, False: 13.2k]
  |  Branch (389:31): [True: 13.2k, False: 28.3k]
  ------------------
  390|  54.9k|  }
  391|       |
  392|    137|  return true;
  393|    137|}
_ZN4cctz12TimeZoneInfo17ResetToBuiltinUTCERKNSt3__16chrono8durationIlNS1_5ratioILl1ELl1EEEEE:
  670|    327|bool TimeZoneInfo::ResetToBuiltinUTC(const seconds& offset) {
  671|    327|  transition_types_.resize(1);
  672|    327|  TransitionType& tt(transition_types_.back());
  673|    327|  tt.utc_offset = static_cast<std::int_least32_t>(offset.count());
  674|    327|  tt.is_dst = false;
  675|    327|  tt.abbr_index = 0;
  676|       |
  677|       |  // We temporarily add some redundant, contemporary (2015 through 2025)
  678|       |  // transitions for performance reasons.  See TimeZoneInfo::LocalTime().
  679|       |  // TODO: Fix the performance issue and remove the extra transitions.
  680|    327|  transitions_.clear();
  681|    327|  transitions_.reserve(12);
  682|    327|  for (const std::int_fast64_t unix_time : {
  ------------------
  |  Branch (682:42): [True: 3.92k, False: 327]
  ------------------
  683|    327|           -(1LL << 59),  // a "first half" transition
  684|    327|           1420070400LL,  // 2015-01-01T00:00:00+00:00
  685|    327|           1451606400LL,  // 2016-01-01T00:00:00+00:00
  686|    327|           1483228800LL,  // 2017-01-01T00:00:00+00:00
  687|    327|           1514764800LL,  // 2018-01-01T00:00:00+00:00
  688|    327|           1546300800LL,  // 2019-01-01T00:00:00+00:00
  689|    327|           1577836800LL,  // 2020-01-01T00:00:00+00:00
  690|    327|           1609459200LL,  // 2021-01-01T00:00:00+00:00
  691|    327|           1640995200LL,  // 2022-01-01T00:00:00+00:00
  692|    327|           1672531200LL,  // 2023-01-01T00:00:00+00:00
  693|    327|           1704067200LL,  // 2024-01-01T00:00:00+00:00
  694|    327|           1735689600LL,  // 2025-01-01T00:00:00+00:00
  695|  3.92k|       }) {
  696|  3.92k|    Transition& tr(*transitions_.emplace(transitions_.end()));
  697|  3.92k|    tr.unix_time = unix_time;
  698|  3.92k|    tr.type_index = 0;
  699|  3.92k|    tr.civil_sec = LocalTime(tr.unix_time, tt).cs;
  700|  3.92k|    tr.prev_civil_sec = tr.civil_sec - 1;
  701|  3.92k|  }
  702|       |
  703|    327|  default_transition_type_ = 0;
  704|    327|  abbreviations_ = FixedOffsetToAbbr(offset);
  705|    327|  abbreviations_.append(1, '\0');
  706|    327|  future_spec_.clear();  // never needed for a fixed-offset zone
  707|    327|  extended_ = false;
  708|       |
  709|    327|  tt.civil_max = LocalTime(seconds::max().count(), tt).cs;
  710|    327|  tt.civil_min = LocalTime(seconds::min().count(), tt).cs;
  711|       |
  712|    327|  transitions_.shrink_to_fit();
  713|    327|  return true;
  714|    327|}
_ZN4cctz12TimeZoneInfo4LoadEPNS_14ZoneInfoSourceE:
  716|    247|bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
  717|       |  // Read and validate the header.
  718|    247|  tzhead tzh;
  719|    247|  if (zip->Read(&tzh, sizeof(tzh)) != sizeof(tzh))
  ------------------
  |  Branch (719:7): [True: 0, False: 247]
  ------------------
  720|      0|    return false;
  721|    247|  if (strncmp(tzh.tzh_magic, TZ_MAGIC, sizeof(tzh.tzh_magic)) != 0)
  ------------------
  |  |   27|    247|#define TZ_MAGIC "TZif"
  ------------------
  |  Branch (721:7): [True: 1, False: 246]
  ------------------
  722|      1|    return false;
  723|    246|  Header hdr;
  724|    246|  if (!hdr.Build(tzh))
  ------------------
  |  Branch (724:7): [True: 0, False: 246]
  ------------------
  725|      0|    return false;
  726|    246|  std::size_t time_len = 4;
  727|    246|  if (tzh.tzh_version[0] != '\0') {
  ------------------
  |  Branch (727:7): [True: 246, False: 0]
  ------------------
  728|       |    // Skip the 4-byte data.
  729|    246|    if (zip->Skip(hdr.DataLength(time_len)) != 0)
  ------------------
  |  Branch (729:9): [True: 0, False: 246]
  ------------------
  730|      0|      return false;
  731|       |    // Read and validate the header for the 8-byte data.
  732|    246|    if (zip->Read(&tzh, sizeof(tzh)) != sizeof(tzh))
  ------------------
  |  Branch (732:9): [True: 0, False: 246]
  ------------------
  733|      0|      return false;
  734|    246|    if (strncmp(tzh.tzh_magic, TZ_MAGIC, sizeof(tzh.tzh_magic)) != 0)
  ------------------
  |  |   27|    246|#define TZ_MAGIC "TZif"
  ------------------
  |  Branch (734:9): [True: 0, False: 246]
  ------------------
  735|      0|      return false;
  736|    246|    if (tzh.tzh_version[0] == '\0')
  ------------------
  |  Branch (736:9): [True: 0, False: 246]
  ------------------
  737|      0|      return false;
  738|    246|    if (!hdr.Build(tzh))
  ------------------
  |  Branch (738:9): [True: 0, False: 246]
  ------------------
  739|      0|      return false;
  740|    246|    time_len = 8;
  741|    246|  }
  742|    246|  if (hdr.typecnt == 0)
  ------------------
  |  Branch (742:7): [True: 0, False: 246]
  ------------------
  743|      0|    return false;
  744|    246|  if (hdr.leapcnt != 0) {
  ------------------
  |  Branch (744:7): [True: 0, False: 246]
  ------------------
  745|       |    // This code assumes 60-second minutes so we do not want
  746|       |    // the leap-second encoded zoneinfo. We could reverse the
  747|       |    // compensation, but the "right" encoding is rarely used
  748|       |    // so currently we simply reject such data.
  749|      0|    return false;
  750|      0|  }
  751|    246|  if (hdr.ttisstdcnt != 0 && hdr.ttisstdcnt != hdr.typecnt)
  ------------------
  |  Branch (751:7): [True: 142, False: 104]
  |  Branch (751:30): [True: 0, False: 142]
  ------------------
  752|      0|    return false;
  753|    246|  if (hdr.ttisutcnt != 0 && hdr.ttisutcnt != hdr.typecnt)
  ------------------
  |  Branch (753:7): [True: 76, False: 170]
  |  Branch (753:29): [True: 0, False: 76]
  ------------------
  754|      0|    return false;
  755|       |
  756|       |  // Bound the header counts before sizing tbuf so that a hostile TZif blob
  757|       |  // cannot force a very large zero-filled allocation from a tiny input.
  758|    246|  if (hdr.timecnt > TZ_MAX_TIMES)
  ------------------
  |  |   94|    246|# define TZ_MAX_TIMES 2000
  ------------------
  |  Branch (758:7): [True: 0, False: 246]
  ------------------
  759|      0|    return false;
  760|    246|  if (hdr.typecnt > TZ_MAX_TYPES)
  ------------------
  |  |   99|    246|# define TZ_MAX_TYPES 256 /* Limited to 256 by Internet RFC 9636.  */
  ------------------
  |  Branch (760:7): [True: 0, False: 246]
  ------------------
  761|      0|    return false;
  762|    246|  if (hdr.charcnt > TZ_MAX_CHARS)
  ------------------
  |  |  104|    246|# define TZ_MAX_CHARS 256	/* Maximum number of abbreviation characters */
  ------------------
  |  Branch (762:7): [True: 0, False: 246]
  ------------------
  763|      0|    return false;
  764|       |
  765|       |  // Read the data into a local buffer.
  766|    246|  std::size_t len = hdr.DataLength(time_len);
  767|    246|  std::vector<char> tbuf(len);
  768|    246|  if (zip->Read(tbuf.data(), len) != len)
  ------------------
  |  Branch (768:7): [True: 0, False: 246]
  ------------------
  769|      0|    return false;
  770|    246|  const char* bp = tbuf.data();
  771|       |
  772|       |  // Decode and validate the transitions.
  773|    246|  transitions_.reserve(hdr.timecnt + 2);
  774|    246|  transitions_.resize(hdr.timecnt);
  775|  18.2k|  for (std::size_t i = 0; i != hdr.timecnt; ++i) {
  ------------------
  |  Branch (775:27): [True: 18.0k, False: 246]
  ------------------
  776|  18.0k|    transitions_[i].unix_time = (time_len == 4) ? Decode32(bp) : Decode64(bp);
  ------------------
  |  Branch (776:33): [True: 0, False: 18.0k]
  ------------------
  777|  18.0k|    bp += time_len;
  778|       |    // A valid zoneinfo file keeps transition times far from the int64 limits.
  779|       |    // A hostile one can place them at the extremes, where the reverse-conversion
  780|       |    // arithmetic in MakeTime() (tr.unix_time +/- a sub-day civil delta, see
  781|       |    // MakeSkipped()/MakeRepeated()) overflows. Bound them to +/-(1<<59), the
  782|       |    // times used by the no-op transitions added below.
  783|  18.0k|    if (transitions_[i].unix_time < -(1LL << 59) ||
  ------------------
  |  Branch (783:9): [True: 0, False: 18.0k]
  ------------------
  784|  18.0k|        transitions_[i].unix_time > (1LL << 59))
  ------------------
  |  Branch (784:9): [True: 0, False: 18.0k]
  ------------------
  785|      0|      return false;  // out of range
  786|  18.0k|  }
  787|    246|  bool seen_type_0 = false;
  788|  18.2k|  for (std::size_t i = 0; i != hdr.timecnt; ++i) {
  ------------------
  |  Branch (788:27): [True: 18.0k, False: 246]
  ------------------
  789|  18.0k|    transitions_[i].type_index = Decode8(bp++);
  790|  18.0k|    if (transitions_[i].type_index >= hdr.typecnt)
  ------------------
  |  Branch (790:9): [True: 0, False: 18.0k]
  ------------------
  791|      0|      return false;
  792|  18.0k|    if (transitions_[i].type_index == 0)
  ------------------
  |  Branch (792:9): [True: 4.74k, False: 13.2k]
  ------------------
  793|  4.74k|      seen_type_0 = true;
  794|  18.0k|  }
  795|       |
  796|       |  // Decode and validate the transition types.
  797|    246|  transition_types_.reserve(hdr.typecnt + 2);
  798|    246|  transition_types_.resize(hdr.typecnt);
  799|    967|  for (std::size_t i = 0; i != hdr.typecnt; ++i) {
  ------------------
  |  Branch (799:27): [True: 721, False: 246]
  ------------------
  800|    721|    transition_types_[i].utc_offset =
  801|    721|        static_cast<std::int_least32_t>(Decode32(bp));
  802|    721|    bp += 4;
  803|    721|    transition_types_[i].is_dst = (Decode8(bp++) != 0);
  804|    721|    transition_types_[i].abbr_index = Decode8(bp++);
  805|    721|    if (transition_types_[i].abbr_index >= hdr.charcnt)
  ------------------
  |  Branch (805:9): [True: 0, False: 721]
  ------------------
  806|      0|      return false;
  807|    721|  }
  808|       |
  809|       |  // Determine the before-first-transition type.
  810|    246|  default_transition_type_ = 0;
  811|    246|  if (seen_type_0 && hdr.timecnt != 0) {
  ------------------
  |  Branch (811:7): [True: 137, False: 109]
  |  Branch (811:22): [True: 137, False: 0]
  ------------------
  812|    137|    std::size_t index = 0;
  813|    137|    if (transition_types_[0].is_dst) {
  ------------------
  |  Branch (813:9): [True: 0, False: 137]
  ------------------
  814|      0|      index = transitions_[0].type_index;
  815|      0|      while (index != 0 && transition_types_[index].is_dst)
  ------------------
  |  Branch (815:14): [True: 0, False: 0]
  |  Branch (815:28): [True: 0, False: 0]
  ------------------
  816|      0|        --index;
  817|      0|    }
  818|    137|    while (index != hdr.typecnt && transition_types_[index].is_dst)
  ------------------
  |  Branch (818:12): [True: 137, False: 0]
  |  Branch (818:36): [True: 0, False: 137]
  ------------------
  819|      0|      ++index;
  820|    137|    if (index != hdr.typecnt)
  ------------------
  |  Branch (820:9): [True: 137, False: 0]
  ------------------
  821|    137|      default_transition_type_ = static_cast<std::uint_fast8_t>(index);
  822|    137|  }
  823|       |
  824|       |  // Copy all the abbreviations. The area holds NUL-terminated strings, and
  825|       |  // LocalTime() hands out a pointer into it, so the final abbreviation has
  826|       |  // to be terminated within the area itself. Otherwise an abbreviation runs
  827|       |  // on into whatever ExtendTransitions() later appends. (hdr.charcnt != 0
  828|       |  // because every abbr_index was validated to be less than it.)
  829|    246|  if (bp[hdr.charcnt - 1] != '\0')
  ------------------
  |  Branch (829:7): [True: 0, False: 246]
  ------------------
  830|      0|    return false;
  831|    246|  abbreviations_.reserve(hdr.charcnt + 10);
  832|    246|  abbreviations_.assign(bp, hdr.charcnt);
  833|    246|  bp += hdr.charcnt;
  834|       |
  835|       |  // Skip the unused portions. We've already dispensed with leap-second
  836|       |  // encoded zoneinfo. The ttisstd/ttisgmt indicators only apply when
  837|       |  // interpreting a POSIX spec that does not include start/end rules, and
  838|       |  // that isn't the case here (see "zic -p").
  839|    246|  bp += (time_len + 4) * hdr.leapcnt;  // leap-time + TAI-UTC
  840|    246|  bp += 1 * hdr.ttisstdcnt;            // UTC/local indicators
  841|    246|  bp += 1 * hdr.ttisutcnt;             // standard/wall indicators
  842|    246|  assert(bp == tbuf.data() + tbuf.size());
  ------------------
  |  Branch (842:3): [True: 246, False: 0]
  ------------------
  843|       |
  844|    246|  future_spec_.clear();
  845|    246|  if (tzh.tzh_version[0] != '\0') {
  ------------------
  |  Branch (845:7): [True: 246, False: 0]
  ------------------
  846|       |    // Snarf up the NL-enclosed future POSIX spec. Note
  847|       |    // that version '3' files utilize an extended format.
  848|    246|    auto get_char = [](ZoneInfoSource* azip) -> int {
  849|    246|      unsigned char ch;  // all non-EOF results are positive
  850|    246|      return (azip->Read(&ch, 1) == 1) ? ch : EOF;
  851|    246|    };
  852|    246|    if (get_char(zip) != '\n')
  ------------------
  |  Branch (852:9): [True: 0, False: 246]
  ------------------
  853|      0|      return false;
  854|  4.25k|    for (int c = get_char(zip); c != '\n'; c = get_char(zip)) {
  ------------------
  |  Branch (854:33): [True: 4.01k, False: 246]
  ------------------
  855|  4.01k|      if (c == EOF)
  ------------------
  |  Branch (855:11): [True: 0, False: 4.01k]
  ------------------
  856|      0|        return false;
  857|  4.01k|      future_spec_.push_back(static_cast<char>(c));
  858|  4.01k|    }
  859|    246|  }
  860|       |
  861|       |  // We don't check for EOF so that we're forwards compatible.
  862|       |
  863|       |  // If we did not find version information during the standard loading
  864|       |  // process (as of tzh_version '3' that is unsupported), then ask the
  865|       |  // ZoneInfoSource for any out-of-bound version string it may be privy to.
  866|    246|  if (version_.empty()) {
  ------------------
  |  Branch (866:7): [True: 246, False: 0]
  ------------------
  867|    246|    version_ = zip->Version();
  868|    246|  }
  869|       |
  870|       |  // Ensure that there is always a transition in the first half of the
  871|       |  // time line (the second half is handled below) so that the signed
  872|       |  // difference between a civil_second and the civil_second of its
  873|       |  // previous transition is always representable, without overflow.
  874|    246|  if (transitions_.empty() || transitions_.front().unix_time >= 0) {
  ------------------
  |  Branch (874:7): [True: 104, False: 142]
  |  Branch (874:31): [True: 72, False: 70]
  ------------------
  875|    176|    Transition& tr(*transitions_.emplace(transitions_.begin()));
  876|    176|    tr.unix_time = -(1LL << 59);  // -18267312070-10-26T17:01:52+00:00
  877|    176|    tr.type_index = default_transition_type_;
  878|    176|  }
  879|       |
  880|       |  // Extend the transitions using the future specification.
  881|    246|  if (!ExtendTransitions()) return false;
  ------------------
  |  Branch (881:7): [True: 0, False: 246]
  ------------------
  882|       |
  883|       |  // Ensure that there is always a transition in the second half of the
  884|       |  // time line (the first half is handled above) so that the signed
  885|       |  // difference between a civil_second and the civil_second of its
  886|       |  // previous transition is always representable, without overflow.
  887|    246|  const Transition& last(transitions_.back());
  888|    246|  if (last.unix_time < 0) {
  ------------------
  |  Branch (888:7): [True: 104, False: 142]
  ------------------
  889|    104|    assert(!extended_);
  ------------------
  |  Branch (889:5): [True: 104, False: 0]
  ------------------
  890|    104|    const std::uint_fast8_t type_index = last.type_index;
  891|    104|    Transition& tr(*transitions_.emplace(transitions_.end()));
  892|    104|    tr.unix_time = 2147483647;  // 2038-01-19T03:14:07+00:00
  893|    104|    tr.type_index = type_index;
  894|    104|  }
  895|       |
  896|       |  // Compute the local civil time for each transition and the preceding
  897|       |  // second. These will be used for reverse conversions in MakeTime().
  898|    246|  const TransitionType* ttp = &transition_types_[default_transition_type_];
  899|   128k|  for (std::size_t i = 0; i != transitions_.size(); ++i) {
  ------------------
  |  Branch (899:27): [True: 128k, False: 246]
  ------------------
  900|   128k|    Transition& tr(transitions_[i]);
  901|   128k|    tr.prev_civil_sec = LocalTime(tr.unix_time, *ttp).cs - 1;
  902|   128k|    ttp = &transition_types_[tr.type_index];
  903|   128k|    tr.civil_sec = LocalTime(tr.unix_time, *ttp).cs;
  904|   128k|    if (i != 0) {
  ------------------
  |  Branch (904:9): [True: 127k, False: 246]
  ------------------
  905|       |      // Check that offset changes don't cross each other. No one
  906|       |      // does this in practice, and we depend on increasing absolute
  907|       |      // and civil times in BreakTime() and MakeTime() respectively.
  908|   127k|      if (!Transition::ByUnixTime()(transitions_[i - 1], tr) ||
  ------------------
  |  Branch (908:11): [True: 0, False: 127k]
  |  Branch (908:11): [True: 0, False: 127k]
  ------------------
  909|   127k|          !Transition::ByCivilTime()(transitions_[i - 1], tr)) {
  ------------------
  |  Branch (909:11): [True: 0, False: 127k]
  ------------------
  910|      0|        return false;  // out of order
  911|      0|      }
  912|   127k|    }
  913|   128k|  }
  914|       |
  915|       |  // Compute the maximum/minimum civil times that can be converted to a
  916|       |  // time_point<seconds> for each of the zone's transition types.
  917|    721|  for (auto& tt : transition_types_) {
  ------------------
  |  Branch (917:17): [True: 721, False: 246]
  ------------------
  918|    721|    tt.civil_max = LocalTime(seconds::max().count(), tt).cs;
  919|    721|    tt.civil_min = LocalTime(seconds::min().count(), tt).cs;
  920|    721|  }
  921|       |
  922|    246|  transitions_.shrink_to_fit();
  923|    246|  return true;
  924|    246|}
_ZN4cctz12TimeZoneInfo4LoadERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  926|  1.31k|bool TimeZoneInfo::Load(const std::string& name) {
  927|       |  // We can ensure that the loading of UTC or any other fixed-offset
  928|       |  // zone never fails because the simple, fixed-offset state can be
  929|       |  // internally generated. Note that this depends on our choice to not
  930|       |  // accept leap-second encoded ("right") zoneinfo.
  931|  1.31k|  auto offset = seconds::zero();
  932|  1.31k|  if (FixedOffsetFromName(name, &offset)) {
  ------------------
  |  Branch (932:7): [True: 326, False: 986]
  ------------------
  933|    326|    return ResetToBuiltinUTC(offset);
  934|    326|  }
  935|       |
  936|       |  // Find and use a ZoneInfoSource to load the named zone.
  937|    986|  auto zip = cctz_extension::zone_info_source_factory(
  938|    986|      name, [](const std::string& n) -> std::unique_ptr<ZoneInfoSource> {
  939|    986|        if (auto z = FileZoneInfoSource::Open(n)) return z;
  940|    986|        if (auto z = AndroidZoneInfoSource::Open(n)) return z;
  941|    986|        if (auto z = FuchsiaZoneInfoSource::Open(n)) return z;
  942|    986|        return nullptr;
  943|    986|      });
  944|    986|  return zip != nullptr && Load(zip.get());
  ------------------
  |  Branch (944:10): [True: 247, False: 739]
  |  Branch (944:28): [True: 246, False: 1]
  ------------------
  945|  1.31k|}
_ZN4cctz12TimeZoneInfo3UTCEv:
  947|      1|std::unique_ptr<TimeZoneInfo> TimeZoneInfo::UTC() {
  948|      1|  auto tz = std::unique_ptr<TimeZoneInfo>(new TimeZoneInfo);
  949|      1|  tz->ResetToBuiltinUTC(seconds::zero());
  950|      1|  return tz;
  951|      1|}
_ZN4cctz12TimeZoneInfo4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  953|  1.31k|std::unique_ptr<TimeZoneInfo> TimeZoneInfo::Make(const std::string& name) {
  954|  1.31k|  auto tz = std::unique_ptr<TimeZoneInfo>(new TimeZoneInfo);
  955|  1.31k|  if (!tz->Load(name)) tz.reset();  // fallback to UTC
  ------------------
  |  Branch (955:7): [True: 740, False: 572]
  ------------------
  956|  1.31k|  return tz;
  957|  1.31k|}
_ZNK4cctz12TimeZoneInfo9LocalTimeElRKNS_14TransitionTypeE:
  961|   263k|    std::int_fast64_t unix_time, const TransitionType& tt) const {
  962|       |  // A civil time in "+offset" looks like (time+offset) in UTC.
  963|       |  // Note: We perform two additions in the civil_second domain to
  964|       |  // sidestep the chance of overflow in (unix_time + tt.utc_offset).
  965|   263k|  return {(civil_second() + unix_time) + tt.utc_offset,
  966|   263k|          tt.utc_offset, tt.is_dst, &abbreviations_[tt.abbr_index]};
  967|   263k|}
_ZNK4cctz12TimeZoneInfo9LocalTimeElRKNS_10TransitionE:
  971|  6.90k|    std::int_fast64_t unix_time, const Transition& tr) const {
  972|  6.90k|  const TransitionType& tt = transition_types_[tr.type_index];
  973|       |  // Note: (unix_time - tr.unix_time) will never overflow as we
  974|       |  // have ensured that there is always a "nearby" transition.
  975|  6.90k|  return {tr.civil_sec + (unix_time - tr.unix_time),  // TODO: Optimize.
  976|  6.90k|          tt.utc_offset, tt.is_dst, &abbreviations_[tt.abbr_index]};
  977|  6.90k|}
_ZNK4cctz12TimeZoneInfo9TimeLocalERKNS_6detail10civil_timeINS1_10second_tagEEEl:
  981|  1.59k|                                                year_t c4_shift) const {
  982|  1.59k|  assert(last_year_ - 400 < cs.year() && cs.year() <= last_year_);
  ------------------
  |  Branch (982:3): [True: 1.59k, False: 0]
  |  Branch (982:3): [True: 1.59k, False: 0]
  |  Branch (982:3): [True: 1.59k, False: 0]
  ------------------
  983|  1.59k|  time_zone::civil_lookup cl = MakeTime(cs);
  984|  1.59k|  if (c4_shift > seconds::max().count() / kSecsPer400Years) {
  ------------------
  |  Branch (984:7): [True: 153, False: 1.44k]
  ------------------
  985|    153|    cl.pre = cl.trans = cl.post = time_point<seconds>::max();
  986|  1.44k|  } else {
  987|  1.44k|    const auto offset = seconds(c4_shift * kSecsPer400Years);
  988|  1.44k|    const auto limit = time_point<seconds>::max() - offset;
  989|  4.33k|    for (auto* tp : {&cl.pre, &cl.trans, &cl.post}) {
  ------------------
  |  Branch (989:19): [True: 4.33k, False: 1.44k]
  ------------------
  990|  4.33k|      if (*tp > limit) {
  ------------------
  |  Branch (990:11): [True: 36, False: 4.30k]
  ------------------
  991|     36|        *tp = time_point<seconds>::max();
  992|  4.30k|      } else {
  993|  4.30k|        *tp += offset;
  994|  4.30k|      }
  995|  4.33k|    }
  996|  1.44k|  }
  997|  1.59k|  return cl;
  998|  1.59k|}
_ZNK4cctz12TimeZoneInfo9BreakTimeERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
 1001|  9.69k|    const time_point<seconds>& tp) const {
 1002|  9.69k|  std::int_fast64_t unix_time = ToUnixSeconds(tp);
 1003|  9.69k|  const std::size_t timecnt = transitions_.size();
 1004|  9.69k|  assert(timecnt != 0);  // We always add a transition.
  ------------------
  |  Branch (1004:3): [True: 9.69k, False: 0]
  ------------------
 1005|       |
 1006|  9.69k|  if (unix_time < transitions_[0].unix_time) {
  ------------------
  |  Branch (1006:7): [True: 1.36k, False: 8.33k]
  ------------------
 1007|  1.36k|    return LocalTime(unix_time, transition_types_[default_transition_type_]);
 1008|  1.36k|  }
 1009|  8.33k|  if (unix_time >= transitions_[timecnt - 1].unix_time) {
  ------------------
  |  Branch (1009:7): [True: 2.72k, False: 5.60k]
  ------------------
 1010|       |    // After the last transition. If we extended the transitions using
 1011|       |    // future_spec_, shift back to a supported year using the 400-year
 1012|       |    // cycle of calendaric equivalence and then compensate accordingly.
 1013|  2.72k|    if (extended_) {
  ------------------
  |  Branch (1013:9): [True: 1.42k, False: 1.30k]
  ------------------
 1014|  1.42k|      const std::int_fast64_t diff =
 1015|  1.42k|          unix_time - transitions_[timecnt - 1].unix_time;
 1016|  1.42k|      const year_t shift = diff / kSecsPer400Years + 1;
 1017|  1.42k|      const auto d = seconds(shift * kSecsPer400Years);
 1018|  1.42k|      time_zone::absolute_lookup al = BreakTime(tp - d);
 1019|  1.42k|      al.cs = YearShift(al.cs, shift * 400);
 1020|  1.42k|      return al;
 1021|  1.42k|    }
 1022|  1.30k|    return LocalTime(unix_time, transitions_[timecnt - 1]);
 1023|  2.72k|  }
 1024|       |
 1025|  5.60k|  const std::size_t hint = local_time_hint_.load(std::memory_order_relaxed);
 1026|  5.60k|  if (0 < hint && hint < timecnt) {
  ------------------
  |  Branch (1026:7): [True: 5.30k, False: 303]
  |  Branch (1026:19): [True: 5.30k, False: 0]
  ------------------
 1027|  5.30k|    if (transitions_[hint - 1].unix_time <= unix_time) {
  ------------------
  |  Branch (1027:9): [True: 4.39k, False: 911]
  ------------------
 1028|  4.39k|      if (unix_time < transitions_[hint].unix_time) {
  ------------------
  |  Branch (1028:11): [True: 3.51k, False: 878]
  ------------------
 1029|  3.51k|        return LocalTime(unix_time, transitions_[hint - 1]);
 1030|  3.51k|      }
 1031|  4.39k|    }
 1032|  5.30k|  }
 1033|       |
 1034|  2.09k|  const Transition target = {unix_time, 0, civil_second(), civil_second()};
 1035|  2.09k|  const Transition* begin = &transitions_[0];
 1036|  2.09k|  const Transition* tr = std::upper_bound(begin, begin + timecnt, target,
 1037|  2.09k|                                          Transition::ByUnixTime());
 1038|  2.09k|  local_time_hint_.store(static_cast<std::size_t>(tr - begin),
 1039|  2.09k|                         std::memory_order_relaxed);
 1040|  2.09k|  return LocalTime(unix_time, *--tr);
 1041|  5.60k|}
_ZNK4cctz12TimeZoneInfo8MakeTimeERKNS_6detail10civil_timeINS1_10second_tagEEE:
 1043|  14.5k|time_zone::civil_lookup TimeZoneInfo::MakeTime(const civil_second& cs) const {
 1044|  14.5k|  const std::size_t timecnt = transitions_.size();
 1045|  14.5k|  assert(timecnt != 0);  // We always add a transition.
  ------------------
  |  Branch (1045:3): [True: 14.5k, False: 0]
  ------------------
 1046|       |
 1047|       |  // Find the first transition after our target civil time.
 1048|  14.5k|  const Transition* tr = nullptr;
 1049|  14.5k|  const Transition* begin = &transitions_[0];
 1050|  14.5k|  const Transition* end = begin + timecnt;
 1051|  14.5k|  if (cs < begin->civil_sec) {
  ------------------
  |  Branch (1051:7): [True: 1.60k, False: 12.9k]
  ------------------
 1052|  1.60k|    tr = begin;
 1053|  12.9k|  } else if (cs >= transitions_[timecnt - 1].civil_sec) {
  ------------------
  |  Branch (1053:14): [True: 3.04k, False: 9.87k]
  ------------------
 1054|  3.04k|    tr = end;
 1055|  9.87k|  } else {
 1056|  9.87k|    const std::size_t hint = time_local_hint_.load(std::memory_order_relaxed);
 1057|  9.87k|    if (0 < hint && hint < timecnt) {
  ------------------
  |  Branch (1057:9): [True: 9.31k, False: 558]
  |  Branch (1057:21): [True: 9.31k, False: 0]
  ------------------
 1058|  9.31k|      if (transitions_[hint - 1].civil_sec <= cs) {
  ------------------
  |  Branch (1058:11): [True: 7.68k, False: 1.63k]
  ------------------
 1059|  7.68k|        if (cs < transitions_[hint].civil_sec) {
  ------------------
  |  Branch (1059:13): [True: 6.05k, False: 1.63k]
  ------------------
 1060|  6.05k|          tr = begin + hint;
 1061|  6.05k|        }
 1062|  7.68k|      }
 1063|  9.31k|    }
 1064|  9.87k|    if (tr == nullptr) {
  ------------------
  |  Branch (1064:9): [True: 3.82k, False: 6.05k]
  ------------------
 1065|  3.82k|      const Transition target = {0, 0, cs, civil_second()};
 1066|  3.82k|      tr = std::upper_bound(begin, end, target, Transition::ByCivilTime());
 1067|  3.82k|      time_local_hint_.store(static_cast<std::size_t>(tr - begin),
 1068|  3.82k|                             std::memory_order_relaxed);
 1069|  3.82k|    }
 1070|  9.87k|  }
 1071|       |
 1072|  14.5k|  if (tr == begin) {
  ------------------
  |  Branch (1072:7): [True: 1.60k, False: 12.9k]
  ------------------
 1073|  1.60k|    if (tr->prev_civil_sec >= cs) {
  ------------------
  |  Branch (1073:9): [True: 1.60k, False: 1]
  ------------------
 1074|       |      // Before first transition, so use the default offset.
 1075|  1.60k|      const TransitionType& tt(transition_types_[default_transition_type_]);
 1076|  1.60k|      if (cs < tt.civil_min) return MakeUnique(time_point<seconds>::min());
  ------------------
  |  Branch (1076:11): [True: 156, False: 1.44k]
  ------------------
 1077|  1.44k|      return MakeUnique(cs - (civil_second() + tt.utc_offset));
 1078|  1.60k|    }
 1079|       |    // tr->prev_civil_sec < cs < tr->civil_sec
 1080|      1|    return MakeSkipped(*tr, cs);
 1081|  1.60k|  }
 1082|       |
 1083|  12.9k|  if (tr == end) {
  ------------------
  |  Branch (1083:7): [True: 3.04k, False: 9.87k]
  ------------------
 1084|  3.04k|    if (cs > (--tr)->prev_civil_sec) {
  ------------------
  |  Branch (1084:9): [True: 3.03k, False: 11]
  ------------------
 1085|       |      // After the last transition. If we extended the transitions using
 1086|       |      // future_spec_, shift back to a supported year using the 400-year
 1087|       |      // cycle of calendaric equivalence and then compensate accordingly.
 1088|  3.03k|      if (extended_ && cs.year() > last_year_) {
  ------------------
  |  Branch (1088:11): [True: 1.61k, False: 1.42k]
  |  Branch (1088:24): [True: 1.59k, False: 13]
  ------------------
 1089|  1.59k|        const year_t shift = (cs.year() - last_year_ - 1) / 400 + 1;
 1090|  1.59k|        return TimeLocal(YearShift(cs, shift * -400), shift);
 1091|  1.59k|      }
 1092|  1.43k|      const TransitionType& tt(transition_types_[tr->type_index]);
 1093|  1.43k|      if (cs > tt.civil_max) return MakeUnique(time_point<seconds>::max());
  ------------------
  |  Branch (1093:11): [True: 71, False: 1.36k]
  ------------------
 1094|  1.36k|      return MakeUnique(tr->unix_time + (cs - tr->civil_sec));
 1095|  1.43k|    }
 1096|       |    // tr->civil_sec <= cs <= tr->prev_civil_sec
 1097|     11|    return MakeRepeated(*tr, cs);
 1098|  3.04k|  }
 1099|       |
 1100|  9.87k|  if (tr->prev_civil_sec < cs) {
  ------------------
  |  Branch (1100:7): [True: 12, False: 9.86k]
  ------------------
 1101|       |    // tr->prev_civil_sec < cs < tr->civil_sec
 1102|     12|    return MakeSkipped(*tr, cs);
 1103|     12|  }
 1104|       |
 1105|  9.86k|  if (cs <= (--tr)->prev_civil_sec) {
  ------------------
  |  Branch (1105:7): [True: 21, False: 9.84k]
  ------------------
 1106|       |    // tr->civil_sec <= cs <= tr->prev_civil_sec
 1107|     21|    return MakeRepeated(*tr, cs);
 1108|     21|  }
 1109|       |
 1110|       |  // In between transitions.
 1111|  9.84k|  return MakeUnique(tr->unix_time + (cs - tr->civil_sec));
 1112|  9.86k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110AllYearDSTERKNS_13PosixTimeZoneE:
  189|    137|bool AllYearDST(const PosixTimeZone& posix) {
  190|    137|  if (posix.dst_start.date.fmt != PosixTransition::N) return false;
  ------------------
  |  Branch (190:7): [True: 137, False: 0]
  ------------------
  191|      0|  if (posix.dst_start.date.n.day != 0) return false;
  ------------------
  |  Branch (191:7): [True: 0, False: 0]
  ------------------
  192|      0|  if (posix.dst_start.time.offset != 0) return false;
  ------------------
  |  Branch (192:7): [True: 0, False: 0]
  ------------------
  193|       |
  194|      0|  if (posix.dst_end.date.fmt != PosixTransition::J) return false;
  ------------------
  |  Branch (194:7): [True: 0, False: 0]
  ------------------
  195|      0|  if (posix.dst_end.date.j.day != kDaysPerYear[0]) return false;
  ------------------
  |  Branch (195:7): [True: 0, False: 0]
  ------------------
  196|      0|  const auto offset = posix.std_offset - posix.dst_offset;
  197|      0|  if (posix.dst_end.time.offset + offset != kSecsPerDay) return false;
  ------------------
  |  Branch (197:7): [True: 0, False: 0]
  ------------------
  198|       |
  199|      0|  return true;
  200|      0|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_16IsLeapEl:
   68|  41.7k|inline bool IsLeap(year_t year) {
   69|  41.7k|  return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0);
  ------------------
  |  Branch (69:10): [True: 13.7k, False: 28.0k]
  |  Branch (69:30): [True: 13.1k, False: 548]
  |  Branch (69:51): [True: 137, False: 411]
  ------------------
   70|  41.7k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_114ToPosixWeekdayENS_6detail7weekdayE:
   95|    137|inline int ToPosixWeekday(weekday wd) {
   96|    137|  switch (wd) {
  ------------------
  |  Branch (96:11): [True: 137, False: 0]
  ------------------
   97|      0|    case weekday::sunday:
  ------------------
  |  Branch (97:5): [True: 0, False: 137]
  ------------------
   98|      0|      return 0;
   99|      0|    case weekday::monday:
  ------------------
  |  Branch (99:5): [True: 0, False: 137]
  ------------------
  100|      0|      return 1;
  101|      0|    case weekday::tuesday:
  ------------------
  |  Branch (101:5): [True: 0, False: 137]
  ------------------
  102|      0|      return 2;
  103|      0|    case weekday::wednesday:
  ------------------
  |  Branch (103:5): [True: 0, False: 137]
  ------------------
  104|      0|      return 3;
  105|    137|    case weekday::thursday:
  ------------------
  |  Branch (105:5): [True: 137, False: 0]
  ------------------
  106|    137|      return 4;
  107|      0|    case weekday::friday:
  ------------------
  |  Branch (107:5): [True: 0, False: 137]
  ------------------
  108|      0|      return 5;
  109|      0|    case weekday::saturday:
  ------------------
  |  Branch (109:5): [True: 0, False: 137]
  ------------------
  110|      0|      return 6;
  111|    137|  }
  112|      0|  return 0; /*NOTREACHED*/
  113|    137|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_111TransOffsetEbiRKNS_15PosixTransitionE:
  204|   110k|                              const PosixTransition& pt) {
  205|   110k|  std::int_fast64_t days = 0;
  206|   110k|  switch (pt.date.fmt) {
  ------------------
  |  Branch (206:11): [True: 110k, False: 0]
  ------------------
  207|      0|    case PosixTransition::J: {
  ------------------
  |  Branch (207:5): [True: 0, False: 110k]
  ------------------
  208|      0|      days = pt.date.j.day;
  209|      0|      if (!leap_year || days < kMonthOffsets[1][3]) days -= 1;
  ------------------
  |  Branch (209:11): [True: 0, False: 0]
  |  Branch (209:25): [True: 0, False: 0]
  ------------------
  210|      0|      break;
  211|      0|    }
  212|      0|    case PosixTransition::N: {
  ------------------
  |  Branch (212:5): [True: 0, False: 110k]
  ------------------
  213|      0|      days = pt.date.n.day;
  214|      0|      break;
  215|      0|    }
  216|   110k|    case PosixTransition::M: {
  ------------------
  |  Branch (216:5): [True: 110k, False: 0]
  ------------------
  217|   110k|      const bool last_week = (pt.date.m.week == 5);
  218|   110k|      days = kMonthOffsets[leap_year][pt.date.m.month + last_week];
  219|   110k|      const std::int_fast64_t weekday = (jan1_weekday + days) % 7;
  220|   110k|      if (last_week) {
  ------------------
  |  Branch (220:11): [True: 106k, False: 3.21k]
  ------------------
  221|   106k|        days -= (weekday + 7 - 1 - pt.date.m.weekday) % 7 + 1;
  222|   106k|      } else {
  223|  3.21k|        days += (pt.date.m.weekday + 7 - weekday) % 7;
  224|  3.21k|        days += (pt.date.m.week - 1) * 7;
  225|  3.21k|      }
  226|   110k|      break;
  227|      0|    }
  228|   110k|  }
  229|   110k|  return (days * kSecsPerDay) + pt.time.offset;
  230|   110k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_16Header5BuildERK6tzhead:
  157|    492|bool Header::Build(const tzhead& tzh) {
  158|    492|  std::int_fast32_t v;
  159|    492|  if ((v = Decode32(tzh.tzh_timecnt)) < 0) return false;
  ------------------
  |  Branch (159:7): [True: 0, False: 492]
  ------------------
  160|    492|  timecnt = static_cast<std::size_t>(v);
  161|    492|  if ((v = Decode32(tzh.tzh_typecnt)) < 0) return false;
  ------------------
  |  Branch (161:7): [True: 0, False: 492]
  ------------------
  162|    492|  typecnt = static_cast<std::size_t>(v);
  163|    492|  if ((v = Decode32(tzh.tzh_charcnt)) < 0) return false;
  ------------------
  |  Branch (163:7): [True: 0, False: 492]
  ------------------
  164|    492|  charcnt = static_cast<std::size_t>(v);
  165|    492|  if ((v = Decode32(tzh.tzh_leapcnt)) < 0) return false;
  ------------------
  |  Branch (165:7): [True: 0, False: 492]
  ------------------
  166|    492|  leapcnt = static_cast<std::size_t>(v);
  167|    492|  if ((v = Decode32(tzh.tzh_ttisstdcnt)) < 0) return false;
  ------------------
  |  Branch (167:7): [True: 0, False: 492]
  ------------------
  168|    492|  ttisstdcnt = static_cast<std::size_t>(v);
  169|    492|  if ((v = Decode32(tzh.tzh_ttisutcnt)) < 0) return false;
  ------------------
  |  Branch (169:7): [True: 0, False: 492]
  ------------------
  170|    492|  ttisutcnt = static_cast<std::size_t>(v);
  171|    492|  return true;
  172|    492|}
time_zone_info.cc:_ZNK4cctz12_GLOBAL__N_16Header10DataLengthEm:
  176|    492|std::size_t Header::DataLength(std::size_t time_len) const {
  177|    492|  std::size_t len = 0;
  178|    492|  len += (time_len + 1) * timecnt;  // unix_time + type_index
  179|    492|  len += (4 + 1 + 1) * typecnt;     // utc_offset + is_dst + abbr_index
  180|    492|  len += 1 * charcnt;               // abbreviations
  181|    492|  len += (time_len + 4) * leapcnt;  // leap-time + TAI-UTC
  182|    492|  len += 1 * ttisstdcnt;            // UTC/local indicators
  183|    492|  len += 1 * ttisutcnt;             // standard/wall indicators
  184|    492|  return len;
  185|    492|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_18Decode32EPKc:
  126|  3.67k|std::int_fast32_t Decode32(const char* cp) {
  127|  3.67k|  std::uint_fast32_t v = 0;
  128|  18.3k|  for (int i = 0; i != (32 / 8); ++i) v = (v << 8) | Decode8(cp++);
  ------------------
  |  Branch (128:19): [True: 14.6k, False: 3.67k]
  ------------------
  129|  3.67k|  const std::int_fast32_t s32max = 0x7fffffff;
  130|  3.67k|  const auto s32maxU = static_cast<std::uint_fast32_t>(s32max);
  131|  3.67k|  if (v <= s32maxU) return static_cast<std::int_fast32_t>(v);
  ------------------
  |  Branch (131:7): [True: 3.61k, False: 63]
  ------------------
  132|     63|  return static_cast<std::int_fast32_t>(v - s32maxU - 1) - s32max - 1;
  133|  3.67k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_18Decode64EPKc:
  135|  18.0k|std::int_fast64_t Decode64(const char* cp) {
  136|  18.0k|  std::uint_fast64_t v = 0;
  137|   162k|  for (int i = 0; i != (64 / 8); ++i) v = (v << 8) | Decode8(cp++);
  ------------------
  |  Branch (137:19): [True: 144k, False: 18.0k]
  ------------------
  138|  18.0k|  const std::int_fast64_t s64max = 0x7fffffffffffffff;
  139|  18.0k|  const auto s64maxU = static_cast<std::uint_fast64_t>(s64max);
  140|  18.0k|  if (v <= s64maxU) return static_cast<std::int_fast64_t>(v);
  ------------------
  |  Branch (140:7): [True: 17.0k, False: 951]
  ------------------
  141|    951|  return static_cast<std::int_fast64_t>(v - s64maxU - 1) - s64max - 1;
  142|  18.0k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_17Decode8EPKc:
  116|   178k|inline std::uint_fast8_t Decode8(const char* cp) {
  117|   178k|  return static_cast<std::uint_fast8_t>(*cp) & 0xff;
  118|   178k|}
time_zone_info.cc:_ZZN4cctz12TimeZoneInfo4LoadEPNS_14ZoneInfoSourceEENK3$_0clES2_:
  848|  4.50k|    auto get_char = [](ZoneInfoSource* azip) -> int {
  849|  4.50k|      unsigned char ch;  // all non-EOF results are positive
  850|  4.50k|      return (azip->Read(&ch, 1) == 1) ? ch : EOF;
  ------------------
  |  Branch (850:14): [True: 4.50k, False: 0]
  ------------------
  851|  4.50k|    };
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_19YearShiftERKNS_6detail10civil_timeINS1_10second_tagEEEl:
  263|  3.02k|inline civil_second YearShift(const civil_second& cs, year_t shift) {
  264|  3.02k|  return civil_second(cs.year() + shift, cs.month(), cs.day(),
  265|  3.02k|                      cs.hour(), cs.minute(), cs.second());
  266|  3.02k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110MakeUniqueERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  232|  12.8k|inline time_zone::civil_lookup MakeUnique(const time_point<seconds>& tp) {
  233|  12.8k|  time_zone::civil_lookup cl;
  234|  12.8k|  cl.kind = time_zone::civil_lookup::UNIQUE;
  235|  12.8k|  cl.pre = cl.trans = cl.post = tp;
  236|  12.8k|  return cl;
  237|  12.8k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110MakeUniqueEl:
  239|  12.6k|inline time_zone::civil_lookup MakeUnique(std::int_fast64_t unix_time) {
  240|  12.6k|  return MakeUnique(FromUnixSeconds(unix_time));
  241|  12.6k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_111MakeSkippedERKNS_10TransitionERKNS_6detail10civil_timeINS4_10second_tagEEE:
  244|     13|                                           const civil_second& cs) {
  245|     13|  time_zone::civil_lookup cl;
  246|     13|  cl.kind = time_zone::civil_lookup::SKIPPED;
  247|     13|  cl.pre = FromUnixSeconds(tr.unix_time - 1 + (cs - tr.prev_civil_sec));
  248|     13|  cl.trans = FromUnixSeconds(tr.unix_time);
  249|     13|  cl.post = FromUnixSeconds(tr.unix_time - (tr.civil_sec - cs));
  250|     13|  return cl;
  251|     13|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_112MakeRepeatedERKNS_10TransitionERKNS_6detail10civil_timeINS4_10second_tagEEE:
  254|     32|                                            const civil_second& cs) {
  255|     32|  time_zone::civil_lookup cl;
  256|     32|  cl.kind = time_zone::civil_lookup::REPEATED;
  257|     32|  cl.pre = FromUnixSeconds(tr.unix_time - 1 - (tr.prev_civil_sec - cs));
  258|     32|  cl.trans = FromUnixSeconds(tr.unix_time);
  259|     32|  cl.post = FromUnixSeconds(tr.unix_time + (cs - tr.civil_sec));
  260|     32|  return cl;
  261|     32|}
time_zone_info.cc:_ZZN4cctz12TimeZoneInfo4LoadERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clES9_:
  938|    986|      name, [](const std::string& n) -> std::unique_ptr<ZoneInfoSource> {
  939|    986|        if (auto z = FileZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (939:18): [True: 247, False: 739]
  ------------------
  940|    739|        if (auto z = AndroidZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (940:18): [True: 0, False: 739]
  ------------------
  941|    739|        if (auto z = FuchsiaZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (941:18): [True: 0, False: 739]
  ------------------
  942|    739|        return nullptr;
  943|    739|      });
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  500|    986|    const std::string& name) {
  501|       |  // Use of the "file:" prefix is intended for testing purposes only.
  502|    986|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (502:27): [True: 33, False: 953]
  ------------------
  503|       |
  504|       |  // Reject unsafe paths (e.g., "../../etc/passwd").
  505|    986|  if (UnsafePath(name, pos)) {
  ------------------
  |  Branch (505:7): [True: 25, False: 961]
  ------------------
  506|     25|    return nullptr;
  507|     25|  }
  508|       |
  509|       |  // Map the time-zone name to a path name.
  510|    961|  std::string path;
  511|    961|  if (pos == name.size() || name[pos] != '/') {
  ------------------
  |  Branch (511:7): [True: 16, False: 945]
  |  Branch (511:29): [True: 928, False: 17]
  ------------------
  512|    944|    const char* tzdir = "/usr/share/zoneinfo";
  513|    944|    char* tzdir_env = nullptr;
  514|       |#if defined(_MSC_VER)
  515|       |    _dupenv_s(&tzdir_env, nullptr, "TZDIR");
  516|       |#else
  517|    944|    tzdir_env = std::getenv("TZDIR");
  518|    944|#endif
  519|    944|    if (tzdir_env && *tzdir_env) tzdir = tzdir_env;
  ------------------
  |  Branch (519:9): [True: 0, False: 944]
  |  Branch (519:22): [True: 0, False: 0]
  ------------------
  520|    944|    path += tzdir;
  521|    944|    path += '/';
  522|       |#if defined(_MSC_VER)
  523|       |    free(tzdir_env);
  524|       |#endif
  525|    944|  }
  526|    961|  path.append(name, pos, std::string::npos);
  527|       |
  528|       |  // Open the zoneinfo file.
  529|    961|  auto fp = FOpen(path.c_str());
  530|    961|  if (fp == nullptr) return nullptr;
  ------------------
  |  Branch (530:7): [True: 714, False: 247]
  ------------------
  531|    247|  return std::unique_ptr<ZoneInfoSource>(new FileZoneInfoSource(std::move(fp)));
  532|    961|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110UnsafePathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEm:
  455|  1.72k|bool UnsafePath(const std::string& name, std::size_t pos) {
  456|       |  // Path traversal: a ".." component that is at the beginning or preceded
  457|       |  // by a separator, and at the end or followed by a separator.
  458|  52.1k|  for (auto i = pos; (i = name.find("..", i)) != std::string::npos; i += 2) {
  ------------------
  |  Branch (458:22): [True: 50.4k, False: 1.67k]
  ------------------
  459|  50.4k|    if ((i == pos || IsPathSeparator(name[i - 1])) &&
  ------------------
  |  Branch (459:10): [True: 152, False: 50.3k]
  |  Branch (459:22): [True: 6.24k, False: 44.0k]
  ------------------
  460|  6.40k|        (i == name.size() - 2 || IsPathSeparator(name[i + 2]))) {
  ------------------
  |  Branch (460:10): [True: 44, False: 6.35k]
  |  Branch (460:34): [True: 6, False: 6.35k]
  ------------------
  461|     50|      return true;
  462|     50|    }
  463|  50.4k|  }
  464|  1.67k|  return false;
  465|  1.72k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_115IsPathSeparatorEc:
  446|  56.6k|inline bool IsPathSeparator(char c) {
  447|       |#if defined(_WIN32)
  448|       |  return c == '/' || c == '\\';
  449|       |#else
  450|  56.6k|  return c == '/';
  451|  56.6k|#endif
  452|  56.6k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_15FOpenEPKc:
  400|  5.98k|inline FilePtr FOpen(const char* path) {
  401|       |#if defined(_MSC_VER)
  402|       |  FILE* fp;
  403|       |  if (fopen_s(&fp, path, "rb") != 0) fp = nullptr;
  404|       |  return FilePtr(fp, fclose);
  405|       |#else
  406|       |  // Open non-blocking and verify the target is a regular file before handing it
  407|       |  // to stdio. Zone names are potentially attacker-controlled, and a plain
  408|       |  // fopen() on a FIFO or device node (reachable via the "file:" prefix or an
  409|       |  // absolute path) would block indefinitely or read unbounded data.
  410|       |#ifndef O_CLOEXEC
  411|       |#define O_CLOEXEC 0
  412|       |#endif
  413|       |#ifndef O_NONBLOCK
  414|       |#define O_NONBLOCK 0
  415|       |#endif
  416|  5.98k|  const int fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
  417|  5.98k|  if (fd >= 0) {
  ------------------
  |  Branch (417:7): [True: 292, False: 5.69k]
  ------------------
  418|       |#if defined(__APPLE__)
  419|       |    // On Apple platforms, avoid fstat() to prevent triggering Apple's Required
  420|       |    // Reason API (NSPrivacyAccessedAPICategoryFileTimestamp) scanner.
  421|       |    // Security implications of skipping this check on Apple platforms:
  422|       |    //   - FIFO hangs are mitigated by O_NONBLOCK
  423|       |    //   - Path traversal is handled by UnsafePath()
  424|       |    //   - /usr/share/zoneinfo is a read-only system volume on iOS
  425|       |    // On general POSIX operating systems, the check remains as
  426|       |    // defense-in-depth.
  427|       |    auto is_regular = [](int) { return true; };
  428|       |#else
  429|    292|    auto is_regular = [](int stat_fd) {
  430|    292|      struct stat st;
  431|    292|      return fstat(stat_fd, &st) == 0 && S_ISREG(st.st_mode);
  432|    292|    };
  433|    292|#endif
  434|    292|    if (is_regular(fd)) {
  ------------------
  |  Branch (434:9): [True: 247, False: 45]
  ------------------
  435|    247|      FILE* fp = fdopen(fd, "rb");
  436|    247|      if (fp != nullptr) return FilePtr(fp, fclose);
  ------------------
  |  Branch (436:11): [True: 247, False: 0]
  ------------------
  437|    247|    }
  438|     45|    close(fd);
  439|     45|  }
  440|  5.73k|  return FilePtr(nullptr, fclose);
  441|  5.98k|#endif
  442|  5.98k|}
time_zone_info.cc:_ZZN4cctz12_GLOBAL__N_15FOpenEPKcENKUliE_clEi:
  429|    292|    auto is_regular = [](int stat_fd) {
  430|    292|      struct stat st;
  431|    292|      return fstat(stat_fd, &st) == 0 && S_ISREG(st.st_mode);
  ------------------
  |  Branch (431:14): [True: 292, False: 0]
  |  Branch (431:42): [True: 247, False: 45]
  ------------------
  432|    292|    };
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSourceC2ENSt3__110unique_ptrI8_IO_FILEPFiPS4_EEEm:
  492|    247|      : fp_(std::move(fp)), len_(len) {}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4ReadEPvm:
  472|  5.24k|  std::size_t Read(void* ptr, std::size_t size) override {
  473|  5.24k|    size = std::min(size, len_);
  474|  5.24k|    std::size_t nread = fread(ptr, 1, size, fp_.get());
  475|  5.24k|    len_ -= nread;
  476|  5.24k|    return nread;
  477|  5.24k|  }
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4SkipEm:
  478|    246|  int Skip(std::size_t offset) override {
  479|    246|    offset = std::min(offset, len_);
  480|    246|    int rc = fseek(fp_.get(), static_cast<long>(offset), SEEK_CUR);
  481|    246|    if (rc == 0) len_ -= offset;
  ------------------
  |  Branch (481:9): [True: 246, False: 0]
  ------------------
  482|    246|    return rc;
  483|    246|  }
time_zone_info.cc:_ZNK4cctz12_GLOBAL__N_118FileZoneInfoSource7VersionEv:
  484|    246|  std::string Version() const override {
  485|       |    // TODO: It would nice if the zoneinfo data included the tzdb version.
  486|    246|    return std::string();
  487|    246|  }
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_121AndroidZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  547|    739|    const std::string& name) {
  548|       |  // Use of the "file:" prefix is intended for testing purposes only.
  549|    739|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (549:27): [True: 32, False: 707]
  ------------------
  550|       |
  551|       |  // See Android's libc/tzcode/bionic.cpp for additional information.
  552|    739|  for (const char* tzdata : {"/apex/com.android.tzdata/etc/tz/tzdata",
  ------------------
  |  Branch (552:27): [True: 2.21k, False: 739]
  ------------------
  553|    739|                             "/data/misc/zoneinfo/current/tzdata",
  554|  2.21k|                             "/system/usr/share/zoneinfo/tzdata"}) {
  555|  2.21k|    auto fp = FOpen(tzdata);
  556|  2.21k|    if (fp == nullptr) continue;
  ------------------
  |  Branch (556:9): [True: 2.21k, False: 0]
  ------------------
  557|       |
  558|      0|    char hbuf[24];  // covers header.zonetab_offset too
  559|      0|    if (fread(hbuf, 1, sizeof(hbuf), fp.get()) != sizeof(hbuf)) continue;
  ------------------
  |  Branch (559:9): [True: 0, False: 0]
  ------------------
  560|      0|    if (strncmp(hbuf, "tzdata", 6) != 0) continue;
  ------------------
  |  Branch (560:9): [True: 0, False: 0]
  ------------------
  561|      0|    const char* vers = (hbuf[11] == '\0') ? hbuf + 6 : "";
  ------------------
  |  Branch (561:24): [True: 0, False: 0]
  ------------------
  562|      0|    const std::int_fast32_t index_offset = Decode32(hbuf + 12);
  563|      0|    const std::int_fast32_t data_offset = Decode32(hbuf + 16);
  564|      0|    if (index_offset < 0 || data_offset < index_offset) continue;
  ------------------
  |  Branch (564:9): [True: 0, False: 0]
  |  Branch (564:29): [True: 0, False: 0]
  ------------------
  565|      0|    if (fseek(fp.get(), static_cast<long>(index_offset), SEEK_SET) != 0)
  ------------------
  |  Branch (565:9): [True: 0, False: 0]
  ------------------
  566|      0|      continue;
  567|       |
  568|      0|    char ebuf[52];  // covers entry.unused too
  569|      0|    const std::size_t index_size =
  570|      0|        static_cast<std::size_t>(data_offset - index_offset);
  571|      0|    const std::size_t zonecnt = index_size / sizeof(ebuf);
  572|      0|    if (zonecnt * sizeof(ebuf) != index_size) continue;
  ------------------
  |  Branch (572:9): [True: 0, False: 0]
  ------------------
  573|      0|    for (std::size_t i = 0; i != zonecnt; ++i) {
  ------------------
  |  Branch (573:29): [True: 0, False: 0]
  ------------------
  574|      0|      if (fread(ebuf, 1, sizeof(ebuf), fp.get()) != sizeof(ebuf)) break;
  ------------------
  |  Branch (574:11): [True: 0, False: 0]
  ------------------
  575|      0|      const std::int_fast64_t start =
  576|      0|          std::int_fast64_t{data_offset} + Decode32(ebuf + 40);
  577|      0|      const std::int_fast32_t length = Decode32(ebuf + 44);
  578|      0|      if (start < 0 || length < 0) break;
  ------------------
  |  Branch (578:11): [True: 0, False: 0]
  |  Branch (578:24): [True: 0, False: 0]
  ------------------
  579|       |      // fseek() takes a long
  580|      0|      if (start > std::numeric_limits<long>::max()) break;
  ------------------
  |  Branch (580:11): [True: 0, False: 0]
  ------------------
  581|      0|      ebuf[40] = '\0';  // ensure zone name is NUL terminated
  582|      0|      if (strcmp(name.c_str() + pos, ebuf) == 0) {
  ------------------
  |  Branch (582:11): [True: 0, False: 0]
  ------------------
  583|      0|        if (fseek(fp.get(), static_cast<long>(start), SEEK_SET) != 0) break;
  ------------------
  |  Branch (583:13): [True: 0, False: 0]
  ------------------
  584|      0|        return std::unique_ptr<ZoneInfoSource>(new AndroidZoneInfoSource(
  585|      0|            std::move(fp), static_cast<std::size_t>(length), vers));
  586|      0|      }
  587|      0|    }
  588|      0|  }
  589|       |
  590|    739|  return nullptr;
  591|    739|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_121FuchsiaZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  613|    739|    const std::string& name) {
  614|       |  // Use of the "file:" prefix is intended for testing purposes only.
  615|    739|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (615:27): [True: 32, False: 707]
  ------------------
  616|       |
  617|       |  // Reject unsafe paths (e.g., "../../etc/passwd").
  618|    739|  if (UnsafePath(name, pos)) {
  ------------------
  |  Branch (618:7): [True: 25, False: 714]
  ------------------
  619|     25|    return nullptr;
  620|     25|  }
  621|       |
  622|       |  // Prefixes where a Fuchsia component might find zoneinfo files,
  623|       |  // in descending order of preference.
  624|    714|  const auto kTzdataPrefixes = {
  625|       |      // The tzdata from `config-data`.
  626|    714|      "/config/data/tzdata/",
  627|       |      // The tzdata bundled in the component's package.
  628|    714|      "/pkg/data/tzdata/",
  629|       |      // General data storage.
  630|    714|      "/data/tzdata/",
  631|       |      // The recommended path for routed-in tzdata files.
  632|       |      // See for details:
  633|       |      // https://fuchsia.dev/fuchsia-src/concepts/process/namespaces?hl=en#typical_directory_structure
  634|    714|      "/config/tzdata/",
  635|    714|  };
  636|    714|  const auto kEmptyPrefix = {""};
  637|    714|  const bool name_absolute = (pos != name.size() && name[pos] == '/');
  ------------------
  |  Branch (637:31): [True: 698, False: 16]
  |  Branch (637:53): [True: 17, False: 681]
  ------------------
  638|    714|  const auto prefixes = name_absolute ? kEmptyPrefix : kTzdataPrefixes;
  ------------------
  |  Branch (638:25): [True: 17, False: 697]
  ------------------
  639|       |
  640|       |  // Fuchsia builds place zoneinfo files at "<prefix><format><name>".
  641|  2.80k|  for (const std::string prefix : prefixes) {
  ------------------
  |  Branch (641:33): [True: 2.80k, False: 714]
  ------------------
  642|  2.80k|    std::string path = prefix;
  643|  2.80k|    if (!prefix.empty()) path += "zoneinfo/tzif2/";  // format
  ------------------
  |  Branch (643:9): [True: 2.78k, False: 17]
  ------------------
  644|  2.80k|    path.append(name, pos, std::string::npos);
  645|       |
  646|  2.80k|    auto fp = FOpen(path.c_str());
  647|  2.80k|    if (fp == nullptr) continue;
  ------------------
  |  Branch (647:9): [True: 2.80k, False: 0]
  ------------------
  648|       |
  649|      0|    std::string version;
  650|      0|    if (!prefix.empty()) {
  ------------------
  |  Branch (650:9): [True: 0, False: 0]
  ------------------
  651|       |      // Fuchsia builds place the version in "<prefix>revision.txt".
  652|      0|      std::ifstream version_stream(prefix + "revision.txt");
  653|      0|      if (version_stream.is_open()) {
  ------------------
  |  Branch (653:11): [True: 0, False: 0]
  ------------------
  654|       |        // revision.txt should contain no newlines, but to be
  655|       |        // defensive we read just the first line.
  656|      0|        std::getline(version_stream, version);
  657|      0|      }
  658|      0|    }
  659|       |
  660|      0|    return std::unique_ptr<ZoneInfoSource>(
  661|      0|        new FuchsiaZoneInfoSource(std::move(fp), std::move(version)));
  662|  2.80k|  }
  663|       |
  664|    714|  return nullptr;
  665|    714|}

_ZNK4cctz10Transition10ByUnixTimeclERKS0_S3_:
   41|   146k|    inline bool operator()(const Transition& lhs, const Transition& rhs) const {
   42|   146k|      return lhs.unix_time < rhs.unix_time;
   43|   146k|    }
_ZNK4cctz10Transition11ByCivilTimeclERKS0_S3_:
   46|   161k|    inline bool operator()(const Transition& lhs, const Transition& rhs) const {
   47|   161k|      return lhs.civil_sec < rhs.civil_sec;
   48|   161k|    }
_ZN4cctz12TimeZoneInfoC2Ev:
   81|  1.31k|  TimeZoneInfo() = default;

_ZN4cctz12TimeZoneLibC4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  218|    262|std::unique_ptr<TimeZoneLibC> TimeZoneLibC::Make(const std::string& name) {
  219|    262|  return std::unique_ptr<TimeZoneLibC>(new TimeZoneLibC(name));
  220|    262|}
_ZNK4cctz12TimeZoneLibC9BreakTimeERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  223|  1.55k|    const time_point<seconds>& tp) const {
  224|  1.55k|  time_zone::absolute_lookup al;
  225|  1.55k|  al.offset = 0;
  226|  1.55k|  al.is_dst = false;
  227|  1.55k|  al.abbr = "-00";
  228|       |
  229|  1.55k|  const std::int_fast64_t s = ToUnixSeconds(tp);
  230|       |
  231|       |  // If std::time_t cannot hold the input we saturate the output.
  232|  1.55k|  if (s < std::numeric_limits<std::time_t>::min()) {
  ------------------
  |  Branch (232:7): [True: 0, False: 1.55k]
  ------------------
  233|      0|    al.cs = civil_second::min();
  234|      0|    return al;
  235|      0|  }
  236|  1.55k|  if (s > std::numeric_limits<std::time_t>::max()) {
  ------------------
  |  Branch (236:7): [True: 0, False: 1.55k]
  ------------------
  237|      0|    al.cs = civil_second::max();
  238|      0|    return al;
  239|      0|  }
  240|       |
  241|  1.55k|  const std::time_t t = static_cast<std::time_t>(s);
  242|  1.55k|  std::tm tm;
  243|  1.55k|  std::tm* tmp = local_ ? local_time(&t, &tm) : gm_time(&t, &tm);
  ------------------
  |  Branch (243:18): [True: 464, False: 1.08k]
  ------------------
  244|       |
  245|       |  // If std::tm cannot hold the result we saturate the output.
  246|  1.55k|  if (tmp == nullptr) {
  ------------------
  |  Branch (246:7): [True: 431, False: 1.12k]
  ------------------
  247|    431|    al.cs = (s < 0) ? civil_second::min() : civil_second::max();
  ------------------
  |  Branch (247:13): [True: 200, False: 231]
  ------------------
  248|    431|    return al;
  249|    431|  }
  250|       |
  251|  1.12k|  const year_t year = tmp->tm_year + year_t{1900};
  252|  1.12k|  al.cs = civil_second(year, tmp->tm_mon + 1, tmp->tm_mday,
  253|  1.12k|                       tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
  254|  1.12k|  al.offset = static_cast<int>(tm_gmtoff(*tmp));
  255|  1.12k|  al.abbr = local_ ? tm_zone(*tmp) : "UTC";  // as expected by cctz
  ------------------
  |  Branch (255:13): [True: 329, False: 791]
  ------------------
  256|  1.12k|  al.is_dst = tmp->tm_isdst > 0;
  257|  1.12k|  return al;
  258|  1.55k|}
_ZNK4cctz12TimeZoneLibC8MakeTimeERKNS_6detail10civil_timeINS1_10second_tagEEE:
  260|  2.28k|time_zone::civil_lookup TimeZoneLibC::MakeTime(const civil_second& cs) const {
  261|  2.28k|  if (!local_) {
  ------------------
  |  Branch (261:7): [True: 1.61k, False: 671]
  ------------------
  262|       |    // If time_point<seconds> cannot hold the result we saturate.
  263|  1.61k|    static const civil_second min_tp_cs =
  264|  1.61k|        civil_second() + ToUnixSeconds(time_point<seconds>::min());
  265|  1.61k|    static const civil_second max_tp_cs =
  266|  1.61k|        civil_second() + ToUnixSeconds(time_point<seconds>::max());
  267|  1.61k|    const time_point<seconds> tp =
  268|  1.61k|        (cs < min_tp_cs)
  ------------------
  |  Branch (268:9): [True: 106, False: 1.50k]
  ------------------
  269|  1.61k|            ? time_point<seconds>::min()
  270|  1.61k|            : (cs > max_tp_cs) ? time_point<seconds>::max()
  ------------------
  |  Branch (270:15): [True: 103, False: 1.40k]
  ------------------
  271|  1.50k|                               : FromUnixSeconds(cs - civil_second());
  272|  1.61k|    return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  273|  1.61k|  }
  274|       |
  275|       |  // If tm_year cannot hold the requested year we saturate the result.
  276|    671|  if (cs.year() < 0) {
  ------------------
  |  Branch (276:7): [True: 417, False: 254]
  ------------------
  277|    417|    if (cs.year() < std::numeric_limits<int>::min() + year_t{1900}) {
  ------------------
  |  Branch (277:9): [True: 93, False: 324]
  ------------------
  278|     93|      const time_point<seconds> tp = time_point<seconds>::min();
  279|     93|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  280|     93|    }
  281|    417|  } else {
  282|    254|    if (cs.year() - year_t{1900} > std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (282:9): [True: 41, False: 213]
  ------------------
  283|     41|      const time_point<seconds> tp = time_point<seconds>::max();
  284|     41|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  285|     41|    }
  286|    254|  }
  287|       |
  288|       |  // We probe with "is_dst" values of 0 and 1 to try to distinguish unique
  289|       |  // civil seconds from skipped or repeated ones.  This is not always possible
  290|       |  // however, as the "dst" flag does not change over some offset transitions.
  291|       |  // We are also subject to the vagaries of mktime() implementations. For
  292|       |  // example, some implementations treat "tm_isdst" as a demand (useless),
  293|       |  // and some as a disambiguator (useful).
  294|    537|  std::time_t t0, t1;
  295|    537|  std::tm tm0, tm1;
  296|    537|  if (make_time(cs, 0, &t0, &tm0) && make_time(cs, 1, &t1, &tm1)) {
  ------------------
  |  Branch (296:7): [True: 537, False: 0]
  |  Branch (296:38): [True: 536, False: 1]
  ------------------
  297|    536|    if (tm0.tm_isdst == tm1.tm_isdst) {
  ------------------
  |  Branch (297:9): [True: 536, False: 0]
  ------------------
  298|       |      // The civil time was singular (pre == trans == post).
  299|    536|      const time_point<seconds> tp = FromUnixSeconds(tm0.tm_isdst ? t1 : t0);
  ------------------
  |  Branch (299:54): [True: 0, False: 536]
  ------------------
  300|    536|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  301|    536|    }
  302|       |
  303|      0|    tm_gmtoff_t offset = tm_gmtoff(tm0);
  304|      0|    if (t0 < t1) {  // negative DST
  ------------------
  |  Branch (304:9): [True: 0, False: 0]
  ------------------
  305|      0|      std::swap(t0, t1);
  306|      0|      offset = tm_gmtoff(tm1);
  307|      0|    }
  308|       |
  309|      0|    const std::time_t tt = find_trans(t1, t0, offset);
  310|      0|    const time_point<seconds> trans = FromUnixSeconds(tt);
  311|       |
  312|      0|    if (tm0.tm_isdst) {
  ------------------
  |  Branch (312:9): [True: 0, False: 0]
  ------------------
  313|       |      // The civil time did not exist (pre >= trans > post).
  314|      0|      const time_point<seconds> pre = FromUnixSeconds(t0);
  315|      0|      const time_point<seconds> post = FromUnixSeconds(t1);
  316|      0|      return {time_zone::civil_lookup::SKIPPED, pre, trans, post};
  317|      0|    }
  318|       |
  319|       |    // The civil time was ambiguous (pre < trans <= post).
  320|      0|    const time_point<seconds> pre = FromUnixSeconds(t1);
  321|      0|    const time_point<seconds> post = FromUnixSeconds(t0);
  322|      0|    return {time_zone::civil_lookup::REPEATED, pre, trans, post};
  323|      0|  }
  324|       |
  325|       |  // make_time() failed somehow so we saturate the result.
  326|      1|  const time_point<seconds> tp = (cs < civil_second())
  ------------------
  |  Branch (326:34): [True: 1, False: 0]
  ------------------
  327|      1|                                     ? time_point<seconds>::min()
  328|      1|                                     : time_point<seconds>::max();
  329|      1|  return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  330|    537|}
_ZN4cctz12TimeZoneLibCC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  351|    262|    : local_(name == "localtime") {}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_110local_timeEPKlP2tm:
  153|    467|inline std::tm* local_time(const std::time_t *timep, std::tm *result) {
  154|       |#if defined(_WIN32)
  155|       |    return localtime_s(result, timep) ? nullptr : result;
  156|       |#else
  157|    467|    return localtime_r(timep, result);
  158|    467|#endif
  159|    467|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_17gm_timeEPKlP2tm:
  145|  1.08k|inline std::tm* gm_time(const std::time_t *timep, std::tm *result) {
  146|       |#if defined(_WIN32)
  147|       |    return gmtime_s(result, timep) ? nullptr : result;
  148|       |#else
  149|  1.08k|    return gmtime_r(timep, result);
  150|  1.08k|#endif
  151|  1.08k|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_19make_timeERKNS_6detail10civil_timeINS1_10second_tagEEEiPlP2tm:
  165|  1.07k|               std::tm* tm) {
  166|  1.07k|  tm->tm_year = static_cast<int>(cs.year() - year_t{1900});
  167|  1.07k|  tm->tm_mon = cs.month() - 1;
  168|  1.07k|  tm->tm_mday = cs.day();
  169|  1.07k|  tm->tm_hour = cs.hour();
  170|  1.07k|  tm->tm_min = cs.minute();
  171|  1.07k|  tm->tm_sec = cs.second();
  172|  1.07k|  tm->tm_isdst = is_dst;
  173|  1.07k|  *t = std::mktime(tm);
  174|  1.07k|  if (*t == std::time_t{-1}) {
  ------------------
  |  Branch (174:7): [True: 3, False: 1.07k]
  ------------------
  175|      3|    std::tm tm2;
  176|      3|    const std::tm* tmp = local_time(t, &tm2);
  177|      3|    if (tmp == nullptr || tmp->tm_year != tm->tm_year ||
  ------------------
  |  Branch (177:9): [True: 0, False: 3]
  |  Branch (177:27): [True: 1, False: 2]
  ------------------
  178|      2|        tmp->tm_mon != tm->tm_mon || tmp->tm_mday != tm->tm_mday ||
  ------------------
  |  Branch (178:9): [True: 0, False: 2]
  |  Branch (178:38): [True: 0, False: 2]
  ------------------
  179|      2|        tmp->tm_hour != tm->tm_hour || tmp->tm_min != tm->tm_min ||
  ------------------
  |  Branch (179:9): [True: 0, False: 2]
  |  Branch (179:40): [True: 0, False: 2]
  ------------------
  180|      2|        tmp->tm_sec != tm->tm_sec) {
  ------------------
  |  Branch (180:9): [True: 0, False: 2]
  ------------------
  181|       |      // A true error (not just one second before the epoch).
  182|      1|      return false;
  183|      1|    }
  184|      3|  }
  185|  1.07k|  return true;
  186|  1.07k|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_19tm_gmtoffI2tmEEDtdtfp_9tm_gmtoffERKT_:
  116|  1.12k|auto tm_gmtoff(const T& tm) -> decltype(tm.tm_gmtoff) {
  117|  1.12k|  return tm.tm_gmtoff;
  118|  1.12k|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_17tm_zoneI2tmEEDtdtfp_7tm_zoneERKT_:
  134|    329|auto tm_zone(const T& tm) -> decltype(tm.tm_zone) {
  135|    329|  return tm.tm_zone;
  136|    329|}

_ZNK4cctz9time_zone6lookupERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
   53|  9.82k|    const time_point<seconds>& tp) const {
   54|  9.82k|  return effective_impl().BreakTime(tp);
   55|  9.82k|}
_ZNK4cctz9time_zone6lookupERKNS_6detail10civil_timeINS1_10second_tagEEE:
   57|  15.2k|time_zone::civil_lookup time_zone::lookup(const civil_second& cs) const {
   58|  15.2k|  return effective_impl().MakeTime(cs);
   59|  15.2k|}
_ZNK4cctz9time_zone14effective_implEv:
   79|  25.0k|const time_zone::Impl& time_zone::effective_impl() const {
   80|  25.0k|  if (impl_ == nullptr) {
  ------------------
  |  Branch (80:7): [True: 0, False: 25.0k]
  ------------------
   81|       |    // Dereferencing an implicit-UTC time_zone is expected to be
   82|       |    // rare, so we don't mind paying a small synchronization cost.
   83|      0|    return *time_zone::Impl::UTC().impl_;
   84|      0|  }
   85|  25.0k|  return *impl_;
   86|  25.0k|}
_ZN4cctz14load_time_zoneERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_9time_zoneE:
   88|  9.83k|bool load_time_zone(const std::string& name, time_zone* tz) {
   89|  9.83k|  return time_zone::Impl::LoadTimeZone(name, tz);
   90|  9.83k|}
_ZN4cctz13utc_time_zoneEv:
   92|    210|time_zone utc_time_zone() {
   93|    210|  return time_zone::Impl::UTC();  // avoid name lookup
   94|    210|}

_ZN4cctz14ParsePosixSpecERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_13PosixTimeZoneE:
  135|    246|bool ParsePosixSpec(const std::string& spec, PosixTimeZone* res) {
  136|    246|  const char* p = spec.c_str();
  137|    246|  if (*p == ':') return false;
  ------------------
  |  Branch (137:7): [True: 0, False: 246]
  ------------------
  138|       |
  139|    246|  p = ParseAbbr(p, &res->std_abbr);
  140|    246|  p = ParseOffset(p, 0, 24, -1, &res->std_offset);
  141|    246|  if (p == nullptr) return false;
  ------------------
  |  Branch (141:7): [True: 0, False: 246]
  ------------------
  142|    246|  if (*p == '\0') return true;
  ------------------
  |  Branch (142:7): [True: 109, False: 137]
  ------------------
  143|       |
  144|    137|  p = ParseAbbr(p, &res->dst_abbr);
  145|    137|  if (p == nullptr) return false;
  ------------------
  |  Branch (145:7): [True: 0, False: 137]
  ------------------
  146|    137|  res->dst_offset = res->std_offset + (60 * 60);  // default
  147|    137|  if (*p != ',') p = ParseOffset(p, 0, 24, -1, &res->dst_offset);
  ------------------
  |  Branch (147:7): [True: 0, False: 137]
  ------------------
  148|       |
  149|    137|  p = ParseDateTime(p, &res->dst_start);
  150|    137|  p = ParseDateTime(p, &res->dst_end);
  151|       |
  152|    137|  return p != nullptr && *p == '\0';
  ------------------
  |  Branch (152:10): [True: 137, False: 0]
  |  Branch (152:26): [True: 137, False: 0]
  ------------------
  153|    137|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_19ParseAbbrEPKcPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   46|    383|const char* ParseAbbr(const char* p, std::string* abbr) {
   47|    383|  const char* op = p;
   48|    383|  if (*p == '<') {  // special zoneinfo <...> form
  ------------------
  |  Branch (48:7): [True: 5, False: 378]
  ------------------
   49|      5|    if (*++p == '>' || *p == '\0') return nullptr;  // no "<>"
  ------------------
  |  Branch (49:9): [True: 0, False: 5]
  |  Branch (49:24): [True: 0, False: 5]
  ------------------
   50|     15|    while (*++p != '>') {
  ------------------
  |  Branch (50:12): [True: 10, False: 5]
  ------------------
   51|     10|      if (*p == '\0') return nullptr;
  ------------------
  |  Branch (51:11): [True: 0, False: 10]
  ------------------
   52|     10|    }
   53|      5|    abbr->assign(op + 1, static_cast<std::size_t>(p - op) - 1);
   54|      5|    return ++p;
   55|      5|  }
   56|  1.64k|  while (*p != '\0') {
  ------------------
  |  Branch (56:10): [True: 1.64k, False: 0]
  ------------------
   57|  1.64k|    if (strchr("-+,", *p)) break;
  ------------------
  |  Branch (57:9): [True: 220, False: 1.42k]
  ------------------
   58|  1.42k|    if (strchr(kDigits, *p)) break;
  ------------------
  |  Branch (58:9): [True: 158, False: 1.26k]
  ------------------
   59|  1.26k|    ++p;
   60|  1.26k|  }
   61|    378|  if (p - op < 3) return nullptr;
  ------------------
  |  Branch (61:7): [True: 0, False: 378]
  ------------------
   62|    378|  abbr->assign(op, static_cast<std::size_t>(p - op));
   63|    378|  return p;
   64|    378|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_111ParseOffsetEPKciiiPl:
   68|    401|                        std::int_fast32_t* offset) {
   69|    401|  if (p == nullptr) return nullptr;
  ------------------
  |  Branch (69:7): [True: 0, False: 401]
  ------------------
   70|    401|  if (*p == '+' || *p == '-') {
  ------------------
  |  Branch (70:7): [True: 0, False: 401]
  |  Branch (70:20): [True: 88, False: 313]
  ------------------
   71|     88|    if (*p++ == '-') sign = -sign;
  ------------------
  |  Branch (71:9): [True: 88, False: 0]
  ------------------
   72|     88|  }
   73|    401|  int hours = 0;
   74|    401|  int minutes = 0;
   75|    401|  int seconds = 0;
   76|       |
   77|    401|  p = ParseInt(p, min_hour, max_hour, &hours);
   78|    401|  if (p == nullptr) return nullptr;
  ------------------
  |  Branch (78:7): [True: 0, False: 401]
  ------------------
   79|    401|  if (*p == ':') {
  ------------------
  |  Branch (79:7): [True: 0, False: 401]
  ------------------
   80|      0|    p = ParseInt(p + 1, 0, 59, &minutes);
   81|      0|    if (p == nullptr) return nullptr;
  ------------------
  |  Branch (81:9): [True: 0, False: 0]
  ------------------
   82|      0|    if (*p == ':') {
  ------------------
  |  Branch (82:9): [True: 0, False: 0]
  ------------------
   83|      0|      p = ParseInt(p + 1, 0, 59, &seconds);
   84|      0|      if (p == nullptr) return nullptr;
  ------------------
  |  Branch (84:11): [True: 0, False: 0]
  ------------------
   85|      0|    }
   86|      0|  }
   87|    401|  *offset = sign * ((((hours * 60) + minutes) * 60) + seconds);
   88|    401|  return p;
   89|    401|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_18ParseIntEPKciiPi:
   28|  1.22k|const char* ParseInt(const char* p, int min, int max, int* vp) {
   29|  1.22k|  int value = 0;
   30|  1.22k|  const char* op = p;
   31|  1.22k|  const int kMaxInt = std::numeric_limits<int>::max();
   32|  2.60k|  for (; const char* dp = strchr(kDigits, *p); ++p) {
  ------------------
  |  Branch (32:22): [True: 1.62k, False: 977]
  ------------------
   33|  1.62k|    int d = static_cast<int>(dp - kDigits);
   34|  1.62k|    if (d >= 10) break;  // '\0'
  ------------------
  |  Branch (34:9): [True: 246, False: 1.38k]
  ------------------
   35|  1.38k|    if (value > kMaxInt / 10) return nullptr;
  ------------------
  |  Branch (35:9): [True: 0, False: 1.38k]
  ------------------
   36|  1.38k|    value *= 10;
   37|  1.38k|    if (value > kMaxInt - d) return nullptr;
  ------------------
  |  Branch (37:9): [True: 0, False: 1.38k]
  ------------------
   38|  1.38k|    value += d;
   39|  1.38k|  }
   40|  1.22k|  if (p == op || value < min || value > max) return nullptr;
  ------------------
  |  Branch (40:7): [True: 0, False: 1.22k]
  |  Branch (40:18): [True: 0, False: 1.22k]
  |  Branch (40:33): [True: 0, False: 1.22k]
  ------------------
   41|  1.22k|  *vp = value;
   42|  1.22k|  return p;
   43|  1.22k|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_113ParseDateTimeEPKcPNS_15PosixTransitionE:
   92|    274|const char* ParseDateTime(const char* p, PosixTransition* res) {
   93|    274|  if (p != nullptr) {
  ------------------
  |  Branch (93:7): [True: 274, False: 0]
  ------------------
   94|    274|    if (*p != ',') return nullptr;
  ------------------
  |  Branch (94:9): [True: 0, False: 274]
  ------------------
   95|    274|    if (*++p == 'M') {
  ------------------
  |  Branch (95:9): [True: 274, False: 0]
  ------------------
   96|    274|      int month = 0;
   97|    274|      if ((p = ParseInt(p + 1, 1, 12, &month)) != nullptr) {
  ------------------
  |  Branch (97:11): [True: 274, False: 0]
  ------------------
   98|    274|        if (*p != '.') return nullptr;
  ------------------
  |  Branch (98:13): [True: 0, False: 274]
  ------------------
   99|    274|        int week = 0;
  100|    274|        if ((p = ParseInt(p + 1, 1, 5, &week)) != nullptr) {
  ------------------
  |  Branch (100:13): [True: 274, False: 0]
  ------------------
  101|    274|          if (*p != '.') return nullptr;
  ------------------
  |  Branch (101:15): [True: 0, False: 274]
  ------------------
  102|    274|          int weekday = 0;
  103|    274|          if ((p = ParseInt(p + 1, 0, 6, &weekday)) != nullptr) {
  ------------------
  |  Branch (103:15): [True: 274, False: 0]
  ------------------
  104|    274|            res->date.fmt = PosixTransition::M;
  105|    274|            res->date.m.month = static_cast<std::int_fast8_t>(month);
  106|    274|            res->date.m.week = static_cast<std::int_fast8_t>(week);
  107|    274|            res->date.m.weekday = static_cast<std::int_fast8_t>(weekday);
  108|    274|          }
  109|    274|        }
  110|    274|      }
  111|    274|    } else if (*p == 'J') {
  ------------------
  |  Branch (111:16): [True: 0, False: 0]
  ------------------
  112|      0|      int day = 0;
  113|      0|      if ((p = ParseInt(p + 1, 1, 365, &day)) != nullptr) {
  ------------------
  |  Branch (113:11): [True: 0, False: 0]
  ------------------
  114|      0|        res->date.fmt = PosixTransition::J;
  115|      0|        res->date.j.day = static_cast<std::int_fast16_t>(day);
  116|      0|      }
  117|      0|    } else {
  118|      0|      int day = 0;
  119|      0|      if ((p = ParseInt(p, 0, 365, &day)) != nullptr) {
  ------------------
  |  Branch (119:11): [True: 0, False: 0]
  ------------------
  120|      0|        res->date.fmt = PosixTransition::N;
  121|      0|        res->date.n.day = static_cast<std::int_fast16_t>(day);
  122|      0|      }
  123|      0|    }
  124|    274|    if (p != nullptr) {
  ------------------
  |  Branch (124:9): [True: 274, False: 0]
  ------------------
  125|    274|      res->time.offset = 2 * 60 * 60;  // default offset is 02:00:00
  126|    274|      if (*p == '/') p = ParseOffset(p + 1, -167, 167, 1, &res->time.offset);
  ------------------
  |  Branch (126:11): [True: 155, False: 119]
  ------------------
  127|    274|    }
  128|    274|  }
  129|    274|  return p;
  130|    274|}

_ZN4cctz14ZoneInfoSourceD2Ev:
   20|    247|ZoneInfoSource::~ZoneInfoSource() {}
zone_info_source.cc:_ZN14cctz_extension12_GLOBAL__N_114DefaultFactoryERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS1_8functionIFNS1_10unique_ptrIN4cctz14ZoneInfoSourceENS1_14default_deleteISD_EEEES9_EEE:
   34|    986|        const std::string& name)>& fallback_factory) {
   35|    986|  return fallback_factory(name);
   36|    986|}

