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

_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2Ellllll:
  359|  19.6k|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZN4cctz6detail4impl5n_secEllllll:
  213|   684k|                         diff_t ss) noexcept {
  214|       |  // Optimization for when (non-constexpr) fields are already normalized.
  215|   684k|  if (0 <= ss && ss < 60) {
  ------------------
  |  Branch (215:7): [True: 555k, False: 128k]
  |  Branch (215:18): [True: 548k, False: 6.67k]
  ------------------
  216|   548k|    const second_t nss = static_cast<second_t>(ss);
  217|   548k|    if (0 <= mm && mm < 60) {
  ------------------
  |  Branch (217:9): [True: 539k, False: 8.98k]
  |  Branch (217:20): [True: 99.7k, False: 439k]
  ------------------
  218|  99.7k|      const minute_t nmm = static_cast<minute_t>(mm);
  219|  99.7k|      if (0 <= hh && hh < 24) {
  ------------------
  |  Branch (219:11): [True: 99.7k, False: 0]
  |  Branch (219:22): [True: 99.6k, False: 126]
  ------------------
  220|  99.6k|        const hour_t nhh = static_cast<hour_t>(hh);
  221|  99.6k|        if (1 <= d && d <= 28 && 1 <= m && m <= 12) {
  ------------------
  |  Branch (221:13): [True: 93.3k, False: 6.34k]
  |  Branch (221:23): [True: 61.0k, False: 32.2k]
  |  Branch (221:34): [True: 61.0k, False: 6]
  |  Branch (221:44): [True: 60.9k, False: 126]
  ------------------
  222|  60.9k|          const day_t nd = static_cast<day_t>(d);
  223|  60.9k|          const month_t nm = static_cast<month_t>(m);
  224|  60.9k|          return fields(y, nm, nd, nhh, nmm, nss);
  225|  60.9k|        }
  226|  38.7k|        return n_mon(y, m, d, 0, nhh, nmm, nss);
  227|  99.6k|      }
  228|    126|      return n_hour(y, m, d, hh / 24, hh % 24, nmm, nss);
  229|  99.7k|    }
  230|   448k|    return n_min(y, m, d, hh, mm / 60, mm % 60, nss);
  231|   548k|  }
  232|   135k|  diff_t cm = ss / 60;
  233|   135k|  ss %= 60;
  234|   135k|  if (ss < 0) {
  ------------------
  |  Branch (234:7): [True: 128k, False: 6.67k]
  ------------------
  235|   128k|    cm -= 1;
  236|   128k|    ss += 60;
  237|   128k|  }
  238|   135k|  return n_min(y, m, d, hh, mm / 60 + cm / 60, mm % 60 + cm % 60,
  239|   135k|               static_cast<second_t>(ss));
  240|   684k|}
_ZN4cctz6detail6fieldsC2Elaaaaa:
   56|  1.04M|      : y(year), m(month), d(day), hh(hour), mm(minute), ss(second) {}
_ZN4cctz6detail4impl5n_monEllllaaa:
  180|   623k|                         hour_t hh, minute_t mm, second_t ss) noexcept {
  181|   623k|  if (m != 12) {
  ------------------
  |  Branch (181:7): [True: 619k, False: 4.00k]
  ------------------
  182|   619k|    y += m / 12;
  183|   619k|    m %= 12;
  184|   619k|    if (m <= 0) {
  ------------------
  |  Branch (184:9): [True: 6.67k, False: 612k]
  ------------------
  185|  6.67k|      y -= 1;
  186|  6.67k|      m += 12;
  187|  6.67k|    }
  188|   619k|  }
  189|   623k|  return n_day(y, static_cast<month_t>(m), d, cd, hh, mm, ss);
  190|   623k|}
_ZN4cctz6detail4impl5n_dayElallaaa:
  114|   631k|                         hour_t hh, minute_t mm, second_t ss) noexcept {
  115|   631k|  year_t ey = y % 400;
  116|   631k|  const year_t oey = ey;
  117|   631k|  ey += (cd / 146097) * 400;
  118|   631k|  cd %= 146097;
  119|   631k|  if (cd < 0) {
  ------------------
  |  Branch (119:7): [True: 14.3k, False: 617k]
  ------------------
  120|  14.3k|    ey -= 400;
  121|  14.3k|    cd += 146097;
  122|  14.3k|  }
  123|   631k|  ey += (d / 146097) * 400;
  124|   631k|  d = d % 146097 + cd;
  125|   631k|  if (d > 0) {
  ------------------
  |  Branch (125:7): [True: 625k, False: 6.37k]
  ------------------
  126|   625k|    if (d > 146097) {
  ------------------
  |  Branch (126:9): [True: 1.41k, False: 623k]
  ------------------
  127|  1.41k|      ey += 400;
  128|  1.41k|      d -= 146097;
  129|  1.41k|    }
  130|   625k|  } else {
  131|  6.37k|    if (d > -365) {
  ------------------
  |  Branch (131:9): [True: 6.37k, 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.37k|      ey -= 1;
  135|  6.37k|      d += days_per_year(ey, m);
  136|  6.37k|    } else {
  137|      0|      ey -= 400;
  138|      0|      d += 146097;
  139|      0|    }
  140|  6.37k|  }
  141|   631k|  if (d > 365) {
  ------------------
  |  Branch (141:7): [True: 273k, False: 357k]
  ------------------
  142|   273k|    int yi = year_index(ey, m);  // Index into Gregorian 400 year cycle.
  143|   639k|    for (;;) {
  144|   639k|      int n = days_per_century(yi);
  145|   639k|      if (d <= n) break;
  ------------------
  |  Branch (145:11): [True: 273k, False: 365k]
  ------------------
  146|   365k|      d -= n;
  147|   365k|      ey += 100;
  148|   365k|      yi += 100;
  149|   365k|      if (yi >= 400) yi -= 400;
  ------------------
  |  Branch (149:11): [True: 172k, False: 193k]
  ------------------
  150|   365k|    }
  151|  3.60M|    for (;;) {
  152|  3.60M|      int n = days_per_4years(yi);
  153|  3.60M|      if (d <= n) break;
  ------------------
  |  Branch (153:11): [True: 273k, False: 3.32M]
  ------------------
  154|  3.32M|      d -= n;
  155|  3.32M|      ey += 4;
  156|  3.32M|      yi += 4;
  157|  3.32M|      if (yi >= 400) yi -= 400;
  ------------------
  |  Branch (157:11): [True: 63.4k, False: 3.26M]
  ------------------
  158|  3.32M|    }
  159|   697k|    for (;;) {
  160|   697k|      int n = days_per_year(ey, m);
  161|   697k|      if (d <= n) break;
  ------------------
  |  Branch (161:11): [True: 273k, False: 423k]
  ------------------
  162|   423k|      d -= n;
  163|   423k|      ++ey;
  164|   423k|    }
  165|   273k|  }
  166|   631k|  if (d > 28) {
  ------------------
  |  Branch (166:7): [True: 438k, False: 193k]
  ------------------
  167|  2.04M|    for (;;) {
  168|  2.04M|      int n = days_per_month(ey, m);
  169|  2.04M|      if (d <= n) break;
  ------------------
  |  Branch (169:11): [True: 438k, False: 1.60M]
  ------------------
  170|  1.60M|      d -= n;
  171|  1.60M|      if (++m > 12) {
  ------------------
  |  Branch (171:11): [True: 8.09k, False: 1.59M]
  ------------------
  172|  8.09k|        ++ey;
  173|  8.09k|        m = 1;
  174|  8.09k|      }
  175|  1.60M|    }
  176|   438k|  }
  177|   631k|  return fields(y + (ey - oey), m, static_cast<day_t>(d), hh, mm, ss);
  178|   631k|}
_ZN4cctz6detail4impl13days_per_yearEla:
   91|   703k|CONSTEXPR_F int days_per_year(year_t y, month_t m) noexcept {
   92|   703k|  return is_leap_year(y + (m > 2)) ? 366 : 365;
  ------------------
  |  Branch (92:10): [True: 140k, False: 563k]
  ------------------
   93|   703k|}
_ZN4cctz6detail4impl12is_leap_yearEl:
   78|   982k|CONSTEXPR_F bool is_leap_year(year_t y) noexcept {
   79|   982k|  return y % 4 == 0 && (y % 100 != 0 || y % 400 == 0);
  ------------------
  |  Branch (79:10): [True: 210k, False: 772k]
  |  Branch (79:25): [True: 196k, False: 13.4k]
  |  Branch (79:41): [True: 8.07k, False: 5.35k]
  ------------------
   80|   982k|}
_ZN4cctz6detail4impl10year_indexEla:
   81|   273k|CONSTEXPR_F int year_index(year_t y, month_t m) noexcept {
   82|   273k|  const int yi = static_cast<int>((y + (m > 2)) % 400);
   83|   273k|  return yi < 0 ? yi + 400 : yi;
  ------------------
  |  Branch (83:10): [True: 13.5k, False: 260k]
  ------------------
   84|   273k|}
_ZN4cctz6detail4impl16days_per_centuryEi:
   85|   639k|CONSTEXPR_F int days_per_century(int yi) noexcept {
   86|   639k|  return 36524 + (yi == 0 || yi > 300);
  ------------------
  |  Branch (86:19): [True: 496, False: 638k]
  |  Branch (86:30): [True: 271k, False: 367k]
  ------------------
   87|   639k|}
_ZN4cctz6detail4impl15days_per_4yearsEi:
   88|  3.60M|CONSTEXPR_F int days_per_4years(int yi) noexcept {
   89|  3.60M|  return 1460 + (yi == 0 || yi > 300 || (yi - 1) % 100 < 96);
  ------------------
  |  Branch (89:18): [True: 1.12k, False: 3.60M]
  |  Branch (89:29): [True: 1.18M, False: 2.41M]
  |  Branch (89:41): [True: 2.28M, False: 126k]
  ------------------
   90|  3.60M|}
_ZN4cctz6detail4impl14days_per_monthEla:
  106|  2.04M|CONSTEXPR_F int days_per_month(year_t y, month_t m) noexcept {
  107|  2.04M|  CONSTEXPR_D int k_days_per_month[1 + 12] = {
  ------------------
  |  |   25|  2.04M|#define CONSTEXPR_D constexpr  // data
  ------------------
  108|  2.04M|      -1, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31  // non leap year
  109|  2.04M|  };
  110|  2.04M|  return k_days_per_month[m] + (m == 2 && is_leap_year(y));
  ------------------
  |  Branch (110:33): [True: 270k, False: 1.77M]
  |  Branch (110:43): [True: 63.7k, False: 207k]
  ------------------
  111|  2.04M|}
_ZN4cctz6detail4impl6n_hourElllllaa:
  192|   584k|                          diff_t hh, minute_t mm, second_t ss) noexcept {
  193|   584k|  cd += hh / 24;
  194|   584k|  hh %= 24;
  195|   584k|  if (hh < 0) {
  ------------------
  |  Branch (195:7): [True: 6.47k, False: 578k]
  ------------------
  196|  6.47k|    cd -= 1;
  197|  6.47k|    hh += 24;
  198|  6.47k|  }
  199|   584k|  return n_mon(y, m, d, cd, static_cast<hour_t>(hh), mm, ss);
  200|   584k|}
_ZN4cctz6detail4impl5n_minElllllla:
  202|   584k|                         diff_t mm, second_t ss) noexcept {
  203|   584k|  ch += mm / 60;
  204|   584k|  mm %= 60;
  205|   584k|  if (mm < 0) {
  ------------------
  |  Branch (205:7): [True: 129k, False: 455k]
  ------------------
  206|   129k|    ch -= 1;
  207|   129k|    mm += 60;
  208|   129k|  }
  209|   584k|  return n_hour(y, m, d, hh / 24 + ch / 24, hh % 24 + ch % 24,
  210|   584k|                static_cast<minute_t>(mm), ss);
  211|   584k|}
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2ENS0_6fieldsE:
  446|   684k|  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
_ZN4cctz6detail5alignENS0_10second_tagENS0_6fieldsE:
  332|   684k|CONSTEXPR_F fields align(second_tag, fields f) noexcept {
  333|   684k|  return f;
  334|   684k|}
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE4yearEv:
  392|   771k|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE5monthEv:
  393|   214k|  CONSTEXPR_M int month() const noexcept { return f_.m; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE3dayEv:
  394|  49.7k|  CONSTEXPR_M int day() const noexcept { return f_.d; }
_ZN4cctz6detailplENS0_10civil_timeINS0_7day_tagEEEl:
  424|    584|  friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
  425|    584|    return civil_time(step(T{}, a.f_, n));
  426|    584|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_7day_tagEEEl:
  430|  7.72k|  friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
  431|  7.72k|    return n != (std::numeric_limits<diff_t>::min)()
  ------------------
  |  Branch (431:12): [True: 7.72k, False: 0]
  ------------------
  432|  7.72k|               ? civil_time(step(T{}, a.f_, -n))
  433|  7.72k|               : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
  434|  7.72k|  }
_ZN4cctz6detail4stepENS0_10second_tagENS0_6fieldsEl:
  247|   657k|CONSTEXPR_F fields step(second_tag, fields f, diff_t n) noexcept {
  248|   657k|  return impl::n_sec(f.y, f.m, f.d, f.hh, f.mm + n / 60, f.ss + n % 60);
  249|   657k|}
_ZN4cctz6detail4stepENS0_7day_tagENS0_6fieldsEl:
  256|  8.31k|CONSTEXPR_F fields step(day_tag, fields f, diff_t n) noexcept {
  257|  8.31k|  return impl::n_day(f.y, f.m, f.d, n, f.hh, f.mm, f.ss);
  258|  8.31k|}
_ZN4cctz6detail4impl9scale_addElll:
  271|  41.4k|CONSTEXPR_F diff_t scale_add(diff_t v, diff_t f, diff_t a) noexcept {
  272|  41.4k|  return (v < 0) ? ((v + 1) * f + a) - f : ((v - 1) * f + a) + f;
  ------------------
  |  Branch (272:10): [True: 6.19k, False: 35.2k]
  ------------------
  273|  41.4k|}
_ZN4cctz6detail4impl7ymd_ordElaa:
  277|  41.9k|CONSTEXPR_F diff_t ymd_ord(year_t y, month_t m, day_t d) noexcept {
  278|  41.9k|  const diff_t eyear = (m <= 2) ? y - 1 : y;
  ------------------
  |  Branch (278:24): [True: 10.1k, False: 31.7k]
  ------------------
  279|  41.9k|  const diff_t era = (eyear >= 0 ? eyear : eyear - 399) / 400;
  ------------------
  |  Branch (279:23): [True: 28.4k, False: 13.4k]
  ------------------
  280|  41.9k|  const diff_t yoe = eyear - era * 400;
  281|  41.9k|  const diff_t doy = (153 * (m + (m > 2 ? -3 : 9)) + 2) / 5 + d - 1;
  ------------------
  |  Branch (281:35): [True: 31.7k, False: 10.1k]
  ------------------
  282|  41.9k|  const diff_t doe = yoe * 365 + yoe / 4 - yoe / 100 + doy;
  283|  41.9k|  return era * 146097 + doe - 719468;
  284|  41.9k|}
_ZN4cctz6detail4impl14day_differenceElaalaa:
  292|  20.9k|                                  year_t y2, month_t m2, day_t d2) noexcept {
  293|  20.9k|  const diff_t a_c4_off = y1 % 400;
  294|  20.9k|  const diff_t b_c4_off = y2 % 400;
  295|  20.9k|  diff_t c4_diff = (y1 - a_c4_off) - (y2 - b_c4_off);
  296|  20.9k|  diff_t delta = ymd_ord(a_c4_off, m1, d1) - ymd_ord(b_c4_off, m2, d2);
  297|  20.9k|  if (c4_diff > 0 && delta < 0) {
  ------------------
  |  Branch (297:7): [True: 8.49k, False: 12.4k]
  |  Branch (297:22): [True: 618, False: 7.88k]
  ------------------
  298|    618|    delta += 2 * 146097;
  299|    618|    c4_diff -= 2 * 400;
  300|  20.3k|  } else if (c4_diff < 0 && delta > 0) {
  ------------------
  |  Branch (300:14): [True: 2.01k, False: 18.3k]
  |  Branch (300:29): [True: 10, False: 2.00k]
  ------------------
  301|     10|    delta -= 2 * 146097;
  302|     10|    c4_diff += 2 * 400;
  303|     10|  }
  304|  20.9k|  return (c4_diff / 400 * 146097) + delta;
  305|  20.9k|}
_ZN4cctz6detail10differenceENS0_7day_tagENS0_6fieldsES2_:
  316|  20.9k|CONSTEXPR_F diff_t difference(day_tag, fields f1, fields f2) noexcept {
  317|  20.9k|  return impl::day_difference(f1.y, f1.m, f1.d, f2.y, f2.m, f2.d);
  318|  20.9k|}
_ZN4cctz6detail10differenceENS0_8hour_tagENS0_6fieldsES2_:
  319|  13.8k|CONSTEXPR_F diff_t difference(hour_tag, fields f1, fields f2) noexcept {
  320|  13.8k|  return impl::scale_add(difference(day_tag{}, f1, f2), 24, (f1.hh - f2.hh));
  321|  13.8k|}
_ZN4cctz6detail10differenceENS0_10minute_tagENS0_6fieldsES2_:
  322|  13.8k|CONSTEXPR_F diff_t difference(minute_tag, fields f1, fields f2) noexcept {
  323|  13.8k|  return impl::scale_add(difference(hour_tag{}, f1, f2), 60, (f1.mm - f2.mm));
  324|  13.8k|}
_ZN4cctz6detail10differenceENS0_10second_tagENS0_6fieldsES2_:
  325|  13.8k|CONSTEXPR_F diff_t difference(second_tag, fields f1, fields f2) noexcept {
  326|  13.8k|  return impl::scale_add(difference(minute_tag{}, f1, f2), 60, f1.ss - f2.ss);
  327|  13.8k|}
_ZN4cctz6detail5alignENS0_7day_tagENS0_6fieldsE:
  341|  30.0k|CONSTEXPR_F fields align(day_tag, fields f) noexcept {
  342|  30.0k|  return fields{f.y, f.m, f.d, 0, 0, 0};
  343|  30.0k|}
_ZN4cctz6detail5alignENS0_8year_tagENS0_6fieldsE:
  347|  7.43k|CONSTEXPR_F fields align(year_tag, fields f) noexcept {
  348|  7.43k|  return fields{f.y, 1, 1, 0, 0, 0};
  349|  7.43k|}
_ZN4cctz6detail11get_weekdayERKNS0_10civil_timeINS0_10second_tagEEE:
  522|  16.7k|CONSTEXPR_F weekday get_weekday(const civil_second& cs) noexcept {
  523|  16.7k|  CONSTEXPR_D weekday k_weekday_by_mon_off[13] = {
  ------------------
  |  |   25|  16.7k|#define CONSTEXPR_D constexpr  // data
  ------------------
  524|  16.7k|      weekday::monday,    weekday::tuesday,  weekday::wednesday,
  525|  16.7k|      weekday::thursday,  weekday::friday,   weekday::saturday,
  526|  16.7k|      weekday::sunday,    weekday::monday,   weekday::tuesday,
  527|  16.7k|      weekday::wednesday, weekday::thursday, weekday::friday,
  528|  16.7k|      weekday::saturday,
  529|  16.7k|  };
  530|  16.7k|  CONSTEXPR_D int k_weekday_offsets[1 + 12] = {
  ------------------
  |  |   25|  16.7k|#define CONSTEXPR_D constexpr  // data
  ------------------
  531|  16.7k|      -1, 0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4,
  532|  16.7k|  };
  533|  16.7k|  year_t wd = 2400 + (cs.year() % 400) - (cs.month() < 3);
  534|  16.7k|  wd += wd / 4 - wd / 100 + wd / 400;
  535|  16.7k|  wd += k_weekday_offsets[cs.month()] + cs.day();
  536|  16.7k|  return k_weekday_by_mon_off[wd % 7 + 6];
  537|  16.7k|}
_ZN4cctz6detail12next_weekdayENS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  541|    292|CONSTEXPR_F civil_day next_weekday(civil_day cd, weekday wd) noexcept {
  542|    292|  CONSTEXPR_D weekday k_weekdays_forw[14] = {
  ------------------
  |  |   25|    292|#define CONSTEXPR_D constexpr  // data
  ------------------
  543|    292|      weekday::monday,    weekday::tuesday,  weekday::wednesday,
  544|    292|      weekday::thursday,  weekday::friday,   weekday::saturday,
  545|    292|      weekday::sunday,    weekday::monday,   weekday::tuesday,
  546|    292|      weekday::wednesday, weekday::thursday, weekday::friday,
  547|    292|      weekday::saturday,  weekday::sunday,
  548|    292|  };
  549|    292|  weekday base = get_weekday(cd);
  550|  1.85k|  for (int i = 0;; ++i) {
  551|  1.85k|    if (base == k_weekdays_forw[i]) {
  ------------------
  |  Branch (551:9): [True: 292, False: 1.56k]
  ------------------
  552|  1.30k|      for (int j = i + 1;; ++j) {
  553|  1.30k|        if (wd == k_weekdays_forw[j]) {
  ------------------
  |  Branch (553:13): [True: 292, False: 1.01k]
  ------------------
  554|    292|          return cd + (j - i);
  555|    292|        }
  556|  1.30k|      }
  557|    292|    }
  558|  1.85k|  }
  559|    292|}
_ZN4cctz6detail12prev_weekdayENS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  561|  7.43k|CONSTEXPR_F civil_day prev_weekday(civil_day cd, weekday wd) noexcept {
  562|  7.43k|  CONSTEXPR_D weekday k_weekdays_back[14] = {
  ------------------
  |  |   25|  7.43k|#define CONSTEXPR_D constexpr  // data
  ------------------
  563|  7.43k|      weekday::sunday,   weekday::saturday,  weekday::friday,
  564|  7.43k|      weekday::thursday, weekday::wednesday, weekday::tuesday,
  565|  7.43k|      weekday::monday,   weekday::sunday,    weekday::saturday,
  566|  7.43k|      weekday::friday,   weekday::thursday,  weekday::wednesday,
  567|  7.43k|      weekday::tuesday,  weekday::monday,
  568|  7.43k|  };
  569|  7.43k|  weekday base = get_weekday(cd);
  570|  26.4k|  for (int i = 0;; ++i) {
  571|  26.4k|    if (base == k_weekdays_back[i]) {
  ------------------
  |  Branch (571:9): [True: 7.43k, False: 19.0k]
  ------------------
  572|  31.9k|      for (int j = i + 1;; ++j) {
  573|  31.9k|        if (wd == k_weekdays_back[j]) {
  ------------------
  |  Branch (573:13): [True: 7.43k, False: 24.5k]
  ------------------
  574|  7.43k|          return cd - (j - i);
  575|  7.43k|        }
  576|  31.9k|      }
  577|  7.43k|    }
  578|  26.4k|  }
  579|  7.43k|}
_ZN4cctz6detail11get_yeardayERKNS0_10civil_timeINS0_10second_tagEEE:
  581|  8.87k|CONSTEXPR_F int get_yearday(const civil_second& cs) noexcept {
  582|  8.87k|  CONSTEXPR_D int k_month_offsets[1 + 12] = {
  ------------------
  |  |   25|  8.87k|#define CONSTEXPR_D constexpr  // data
  ------------------
  583|  8.87k|      -1, 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334,
  584|  8.87k|  };
  585|  8.87k|  const int feb29 = (cs.month() > 2 && impl::is_leap_year(cs.year()));
  ------------------
  |  Branch (585:22): [True: 8.37k, False: 500]
  |  Branch (585:40): [True: 693, False: 7.67k]
  ------------------
  586|  8.87k|  return k_month_offsets[cs.month()] + feb29 + cs.day();
  587|  8.87k|}
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE4yearEv:
  392|  7.43k|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE5monthEv:
  393|  7.43k|  CONSTEXPR_M int month() const noexcept { return f_.m; }
_ZNK4cctz6detail10civil_timeINS0_7day_tagEE3dayEv:
  394|  7.43k|  CONSTEXPR_M int day() const noexcept { return f_.d; }
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2Ellllll:
  359|  7.14k|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2ENS0_6fieldsE:
  446|  30.0k|  explicit CONSTEXPR_M civil_time(fields f) noexcept : f_(align(T{}, f)) {}
_ZN4cctz6detailmiENS0_10civil_timeINS0_7day_tagEEES3_:
  435|  7.14k|  friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
  436|  7.14k|    return difference(T{}, lhs.f_, rhs.f_);
  437|  7.14k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2INS0_7day_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS2_S6_EE5valueEvE4typeE:
  375|  7.72k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2INS0_7day_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS6_S2_EE5valueEvE4typeE:
  379|  7.14k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2ENS0_6fieldsE:
  446|  7.43k|  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.43k|      : civil_time(ct.f_) {}
_ZN4cctz6detail10civil_timeINS0_7day_tagEEC2INS0_10second_tagEEERKNS1_IT_EEPNSt3__19enable_ifIXsr3std10is_base_ofIS6_S2_EE5valueEvE4typeE:
  379|  7.14k|      : civil_time(ct.f_) {}
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE4hourEv:
  395|  15.7k|  CONSTEXPR_M int hour() const noexcept { return f_.hh; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE6minuteEv:
  396|  15.1k|  CONSTEXPR_M int minute() const noexcept { return f_.mm; }
_ZNK4cctz6detail10civil_timeINS0_10second_tagEE6secondEv:
  397|  40.1k|  CONSTEXPR_M int second() const noexcept { return f_.ss; }
_ZN4cctz6detail10civil_timeINS0_8year_tagEEC2Ellllll:
  359|    292|      : civil_time(impl::n_sec(y, m, d, hh, mm, ss)) {}
_ZNK4cctz6detail10civil_timeINS0_8year_tagEE4yearEv:
  392|    292|  CONSTEXPR_M year_t year() const noexcept { return f_.y; }
_ZN4cctz6detailgtINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  494|  6.34k|                           const civil_time<T2>& rhs) noexcept {
  495|  6.34k|  return rhs < lhs;
  496|  6.34k|}
_ZN4cctz6detailplENS0_10civil_timeINS0_10second_tagEEEl:
  424|   522k|  friend CONSTEXPR_F civil_time operator+(civil_time a, diff_t n) noexcept {
  425|   522k|    return civil_time(step(T{}, a.f_, n));
  426|   522k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEE3maxEv:
  382|    327|  static CONSTEXPR_F auto (max)() -> civil_time {
  383|    327|    const auto max_year = (std::numeric_limits<std::int_least64_t>::max)();
  384|    327|    return civil_time(max_year, 12, 31, 23, 59, 59);
  385|    327|  }
_ZN4cctz6detailltINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  469|   232k|                           const civil_time<T2>& rhs) noexcept {
  470|   232k|  return (lhs.year() < rhs.year() ||
  ------------------
  |  Branch (470:11): [True: 113k, False: 119k]
  ------------------
  471|   119k|          (lhs.year() == rhs.year() &&
  ------------------
  |  Branch (471:12): [True: 68.2k, False: 51.0k]
  ------------------
  472|  68.2k|           (lhs.month() < rhs.month() ||
  ------------------
  |  Branch (472:13): [True: 64.8k, False: 3.47k]
  ------------------
  473|  3.47k|            (lhs.month() == rhs.month() &&
  ------------------
  |  Branch (473:14): [True: 1.07k, False: 2.39k]
  ------------------
  474|  1.07k|             (lhs.day() < rhs.day() ||
  ------------------
  |  Branch (474:15): [True: 234, False: 843]
  ------------------
  475|    843|              (lhs.day() == rhs.day() &&
  ------------------
  |  Branch (475:16): [True: 563, False: 280]
  ------------------
  476|    563|               (lhs.hour() < rhs.hour() ||
  ------------------
  |  Branch (476:17): [True: 89, False: 474]
  ------------------
  477|    474|                (lhs.hour() == rhs.hour() &&
  ------------------
  |  Branch (477:18): [True: 346, False: 128]
  ------------------
  478|    346|                 (lhs.minute() < rhs.minute() ||
  ------------------
  |  Branch (478:19): [True: 34, False: 312]
  ------------------
  479|    312|                  (lhs.minute() == rhs.minute() &&
  ------------------
  |  Branch (479:20): [True: 144, False: 168]
  ------------------
  480|    144|                   (lhs.second() < rhs.second())))))))))));
  ------------------
  |  Branch (480:20): [True: 32, False: 112]
  ------------------
  481|   232k|}
_ZN4cctz6detail10civil_timeINS0_10second_tagEE3minEv:
  386|    289|  static CONSTEXPR_F auto (min)() -> civil_time {
  387|    289|    const auto min_year = (std::numeric_limits<std::int_least64_t>::min)();
  388|    289|    return civil_time(min_year, 1, 1, 0, 0, 0);
  389|    289|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEmIEl:
  403|  5.86k|  CONSTEXPR_M civil_time& operator-=(diff_t n) noexcept {
  404|  5.86k|    return *this = *this - n;
  405|  5.86k|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_10second_tagEEEl:
  430|   134k|  friend CONSTEXPR_F civil_time operator-(civil_time a, diff_t n) noexcept {
  431|   134k|    return n != (std::numeric_limits<diff_t>::min)()
  ------------------
  |  Branch (431:12): [True: 134k, False: 0]
  ------------------
  432|   134k|               ? civil_time(step(T{}, a.f_, -n))
  433|   134k|               : civil_time(step(T{}, step(T{}, a.f_, -(n + 1)), 1));
  434|   134k|  }
_ZN4cctz6detailmiENS0_10civil_timeINS0_10second_tagEEES3_:
  435|  13.8k|  friend CONSTEXPR_F diff_t operator-(civil_time lhs, civil_time rhs) noexcept {
  436|  13.8k|    return difference(T{}, lhs.f_, rhs.f_);
  437|  13.8k|  }
_ZN4cctz6detail10civil_timeINS0_10second_tagEEC2Ev:
  361|   314k|  CONSTEXPR_M civil_time() noexcept : f_{1970, 1, 1, 0, 0, 0} {}
_ZN4cctz6detailgeINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  489|  14.2k|                            const civil_time<T2>& rhs) noexcept {
  490|  14.2k|  return !(lhs < rhs);
  491|  14.2k|}
_ZN4cctz6detailleINS0_10second_tagES2_EEbRKNS0_10civil_timeIT_EERKNS3_IT0_EE:
  484|  18.9k|                            const civil_time<T2>& rhs) noexcept {
  485|  18.9k|  return !(rhs < lhs);
  486|  18.9k|}

_ZN4cctz9time_zoneC2Ev:
   67|  9.51k|  time_zone() : time_zone(nullptr) {}  // Equivalent to UTC
_ZN4cctz9time_zoneC2EPKNS0_4ImplE:
  219|  19.2k|  explicit time_zone(const Impl* impl) : impl_(impl) {}
_ZN4cctz7convertERKNS_6detail10civil_timeINS0_10second_tagEEERKNS_9time_zoneE:
  256|  8.87k|                                   const time_zone& tz) {
  257|  8.87k|  const time_zone::civil_lookup cl = tz.lookup(cs);
  258|  8.87k|  if (cl.kind == time_zone::civil_lookup::SKIPPED) return cl.trans;
  ------------------
  |  Branch (258:7): [True: 10, False: 8.86k]
  ------------------
  259|  8.86k|  return cl.pre;
  260|  8.87k|}
_ZN4cctz5parseINSt3__16chrono8durationIxNS1_5ratioILl1ELl1000000EEEEEEEbRKNS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEESE_RKNS_9time_zoneEPNS2_10time_pointINS2_12system_clockET_EE:
  369|  8.87k|                  const time_zone& tz, time_point<D>* tpp) {
  370|  8.87k|  time_point<seconds> sec;
  371|  8.87k|  detail::femtoseconds fs;
  372|  8.87k|  return detail::parse(fmt, input, tz, &sec, &fs) &&
  ------------------
  |  Branch (372:10): [True: 5.74k, False: 3.12k]
  ------------------
  373|  5.74k|         detail::join_seconds(sec, fs, tpp);
  ------------------
  |  Branch (373:10): [True: 5.74k, False: 0]
  ------------------
  374|  8.87k|}
_ZN4cctz6detail12join_secondsIxLl1000000EEEbRKNSt3__16chrono10time_pointINS3_12system_clockENS3_8durationIlNS2_5ratioILl1ELl1EEEEEEERKNS6_IlNS7_ILl1ELl1000000000000000EEEEEPNS4_IS5_NS6_IT_NS7_ILl1EXT0_EEEEEEE:
  405|  5.74k|    time_point<std::chrono::duration<Rep, std::ratio<1, Denom>>>* tpp) {
  406|  5.74k|  using D = std::chrono::duration<Rep, std::ratio<1, Denom>>;
  407|       |  // TODO(#199): Return false if result unrepresentable as a time_point<D>.
  408|  5.74k|  *tpp = std::chrono::time_point_cast<D>(sec);
  409|  5.74k|  *tpp += std::chrono::duration_cast<D>(fs);
  410|  5.74k|  return true;
  411|  5.74k|}
_ZN4cctz6formatINSt3__16chrono8durationIlNS1_5ratioILl1ELl1EEEEEEENS1_12basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKSC_RKNS2_10time_pointINS2_12system_clockET_EERKNS_9time_zoneE:
  315|  8.87k|                          const time_zone& tz) {
  316|  8.87k|  const auto p = detail::split_seconds(tp);
  317|  8.87k|  const auto n = std::chrono::duration_cast<detail::femtoseconds>(p.second);
  318|  8.87k|  return detail::format(fmt, p.first, n, tz);
  319|  8.87k|}
_ZN4cctz6detail13split_secondsERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  395|  8.87k|    const time_point<seconds>& tp) {
  396|  8.87k|  return {tp, seconds::zero()};
  397|  8.87k|}

_ZN4cctz19FixedOffsetFromNameERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS0_6chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
   57|  10.7k|bool FixedOffsetFromName(const std::string& name, seconds* offset) {
   58|  10.7k|  if (name == "UTC" || name == "UTC0") {
  ------------------
  |  Branch (58:7): [True: 1.57k, False: 9.14k]
  |  Branch (58:24): [True: 1, False: 9.14k]
  ------------------
   59|  1.57k|    *offset = seconds::zero();
   60|  1.57k|    return true;
   61|  1.57k|  }
   62|       |
   63|  9.14k|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
   64|  9.14k|  const char* const ep = kFixedZonePrefix + prefix_len;
   65|  9.14k|  if (name.size() != prefix_len + 9)  // <prefix>+99:99:99
  ------------------
  |  Branch (65:7): [True: 8.29k, False: 851]
  ------------------
   66|  8.29k|    return false;
   67|    851|  if (!std::equal(kFixedZonePrefix, ep, name.begin()))
  ------------------
  |  Branch (67:7): [True: 38, False: 813]
  ------------------
   68|     38|    return false;
   69|    813|  const char* np = name.data() + prefix_len;
   70|    813|  if (np[0] != '+' && np[0] != '-')
  ------------------
  |  Branch (70:7): [True: 481, False: 332]
  |  Branch (70:23): [True: 32, False: 449]
  ------------------
   71|     32|    return false;
   72|    781|  if (np[3] != ':' || np[6] != ':')  // see note below about large offsets
  ------------------
  |  Branch (72:7): [True: 8, False: 773]
  |  Branch (72:23): [True: 16, False: 757]
  ------------------
   73|     24|    return false;
   74|       |
   75|    757|  int hours = Parse02d(np + 1);
   76|    757|  if (hours == -1) return false;
  ------------------
  |  Branch (76:7): [True: 8, False: 749]
  ------------------
   77|    749|  int mins = Parse02d(np + 4);
   78|    749|  if (mins == -1) return false;
  ------------------
  |  Branch (78:7): [True: 4, False: 745]
  ------------------
   79|    745|  int secs = Parse02d(np + 7);
   80|    745|  if (secs == -1) return false;
  ------------------
  |  Branch (80:7): [True: 4, False: 741]
  ------------------
   81|       |
   82|    741|  secs += ((hours * 60) + mins) * 60;
   83|    741|  if (secs > 24 * 60 * 60) return false;  // outside supported offset range
  ------------------
  |  Branch (83:7): [True: 8, False: 733]
  ------------------
   84|    733|  *offset = seconds(secs * (np[0] == '-' ? -1 : 1));  // "-" means west
  ------------------
  |  Branch (84:29): [True: 421, False: 312]
  ------------------
   85|    733|  return true;
   86|    741|}
_ZN4cctz17FixedOffsetToNameERKNSt3__16chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
   88|    329|std::string FixedOffsetToName(const seconds& offset) {
   89|    329|  if (offset == seconds::zero()) return "UTC";
  ------------------
  |  Branch (89:7): [True: 1, False: 328]
  ------------------
   90|    328|  if (offset < std::chrono::hours(-24) || offset > std::chrono::hours(24)) {
  ------------------
  |  Branch (90:7): [True: 0, False: 328]
  |  Branch (90:7): [True: 0, False: 328]
  |  Branch (90:43): [True: 0, False: 328]
  ------------------
   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|    328|  int offset_seconds = static_cast<int>(offset.count());
   97|    328|  const char sign = (offset_seconds < 0 ? '-' : '+');
  ------------------
  |  Branch (97:22): [True: 189, False: 139]
  ------------------
   98|    328|  int offset_minutes = offset_seconds / 60;
   99|    328|  offset_seconds %= 60;
  100|    328|  if (sign == '-') {
  ------------------
  |  Branch (100:7): [True: 189, False: 139]
  ------------------
  101|    189|    if (offset_seconds > 0) {
  ------------------
  |  Branch (101:9): [True: 0, False: 189]
  ------------------
  102|      0|      offset_seconds -= 60;
  103|      0|      offset_minutes += 1;
  104|      0|    }
  105|    189|    offset_seconds = -offset_seconds;
  106|    189|    offset_minutes = -offset_minutes;
  107|    189|  }
  108|    328|  int offset_hours = offset_minutes / 60;
  109|    328|  offset_minutes %= 60;
  110|    328|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
  111|    328|  char buf[prefix_len + sizeof("-24:00:00")];
  112|    328|  char* ep = std::copy_n(kFixedZonePrefix, prefix_len, buf);
  113|    328|  *ep++ = sign;
  114|    328|  ep = Format02d(ep, offset_hours);
  115|    328|  *ep++ = ':';
  116|    328|  ep = Format02d(ep, offset_minutes);
  117|    328|  *ep++ = ':';
  118|    328|  ep = Format02d(ep, offset_seconds);
  119|    328|  *ep++ = '\0';
  120|    328|  assert(ep == buf + sizeof(buf));
  ------------------
  |  Branch (120:3): [True: 328, False: 0]
  ------------------
  121|    328|  return buf;
  122|    328|}
_ZN4cctz17FixedOffsetToAbbrERKNSt3__16chrono8durationIlNS0_5ratioILl1ELl1EEEEE:
  124|    329|std::string FixedOffsetToAbbr(const seconds& offset) {
  125|    329|  std::string abbr = FixedOffsetToName(offset);
  126|    329|  const std::size_t prefix_len = sizeof(kFixedZonePrefix) - 1;
  127|    329|  if (abbr.size() == prefix_len + 9) {         // <prefix>+99:99:99
  ------------------
  |  Branch (127:7): [True: 328, False: 1]
  ------------------
  128|    328|    abbr.erase(0, prefix_len);                 // +99:99:99
  129|    328|    abbr.erase(6, 1);                          // +99:9999
  130|    328|    abbr.erase(3, 1);                          // +999999
  131|    328|    if (abbr[5] == '0' && abbr[6] == '0') {    // +999900
  ------------------
  |  Branch (131:9): [True: 107, False: 221]
  |  Branch (131:27): [True: 41, False: 66]
  ------------------
  132|     41|      abbr.erase(5, 2);                        // +9999
  133|     41|      if (abbr[3] == '0' && abbr[4] == '0') {  // +9900
  ------------------
  |  Branch (133:11): [True: 22, False: 19]
  |  Branch (133:29): [True: 3, False: 19]
  ------------------
  134|      3|        abbr.erase(3, 2);                      // +99
  135|      3|      }
  136|     41|    }
  137|    328|  }
  138|    329|  return abbr;
  139|    329|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_18Parse02dEPKc:
   46|  2.25k|int Parse02d(const char* p) {
   47|  2.25k|  const int hi = ParseDigit(p[0]);
   48|  2.25k|  if (hi >= 0) {
  ------------------
  |  Branch (48:7): [True: 2.24k, False: 8]
  ------------------
   49|  2.24k|    const int lo = ParseDigit(p[1]);
   50|  2.24k|    if (lo >= 0) return (hi * 10) + lo;
  ------------------
  |  Branch (50:9): [True: 2.23k, False: 8]
  ------------------
   51|  2.24k|  }
   52|     16|  return -1;
   53|  2.25k|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_110ParseDigitEc:
   41|  4.49k|int ParseDigit(char ch) {
   42|  4.49k|  const char* const dp = std::strchr(kDigits, ch);
   43|  4.49k|  return (dp == nullptr || *dp == '\0') ? -1 : static_cast<int>(dp - kDigits);
  ------------------
  |  Branch (43:11): [True: 12, False: 4.48k]
  |  Branch (43:28): [True: 4, False: 4.47k]
  ------------------
   44|  4.49k|}
time_zone_fixed.cc:_ZN4cctz12_GLOBAL__N_19Format02dEPci:
   32|    984|char* Format02d(char* p, int v) {
   33|    984|  *p++ = kDigits[(v / 10) % 10];
   34|    984|  *p++ = kDigits[v % 10];
   35|    984|  return p;
   36|    984|}

_ZN4cctz6detail6formatERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEERKNS1_6chrono10time_pointINSA_12system_clockENSA_8durationIlNS1_5ratioILl1ELl1EEEEEEERKNSD_IlNSE_ILl1ELl1000000000000000EEEEERKNS_9time_zoneE:
  338|  8.87k|                   const detail::femtoseconds& fs, const time_zone& tz) {
  339|  8.87k|  std::string result;
  340|  8.87k|  result.reserve(2 * format.size());  // A guess for the result size.
  341|  8.87k|  const time_zone::absolute_lookup al = tz.lookup(tp);
  342|  8.87k|  const std::tm tm = ToTM(al);
  343|       |
  344|       |  // Scratch buffer for internal conversions.
  345|  8.87k|  char buf[6 + (kDigits10_64 + 2)];  // enough for longest conversion (%F)
  346|  8.87k|  char* const ep = buf + sizeof(buf);
  347|  8.87k|  char* bp;  // works back from ep
  348|       |
  349|       |  // Maintain three, disjoint subsequences that span format.
  350|       |  //   [format.begin() ... pending) : already formatted into result
  351|       |  //   [pending ... cur) : formatting pending, but no special cases
  352|       |  //   [cur ... format.end()) : unexamined
  353|       |  // Initially, everything is in the unexamined part.
  354|  8.87k|  const char* pending = format.data();
  355|  8.87k|  const char* cur = pending;
  356|  8.87k|  const char* const end = pending + format.size();
  357|       |
  358|   145k|  while (cur != end) {  // while something is unexamined
  ------------------
  |  Branch (358:10): [True: 136k, False: 8.87k]
  ------------------
  359|       |    // Moves cur to the next percent sign.
  360|   136k|    const char* start = cur;
  361|  31.6M|    while (cur != end && *cur != '%') {
  ------------------
  |  Branch (361:12): [True: 31.6M, False: 695]
  |  Branch (361:26): [True: 31.5M, False: 136k]
  ------------------
  362|  31.5M|      if (*cur == '\0' && pending != start) {
  ------------------
  |  Branch (362:11): [True: 998k, False: 30.5M]
  |  Branch (362:27): [True: 10.2k, False: 987k]
  ------------------
  363|  10.2k|        FormatTM(&result, std::string(pending, cur), tm);
  364|  10.2k|        pending = start = cur;
  365|  10.2k|      }
  366|  31.5M|      ++cur;
  367|  31.5M|    }
  368|       |
  369|       |    // If the new pending text is all ordinary, copy it out.
  370|   136k|    if (cur != start && pending == start) {
  ------------------
  |  Branch (370:9): [True: 79.3k, False: 57.4k]
  |  Branch (370:25): [True: 25.9k, False: 53.3k]
  ------------------
  371|  25.9k|      result.append(pending, cur);
  372|  25.9k|      pending = start = cur;
  373|  25.9k|    }
  374|       |
  375|       |    // Span the sequential percent signs.
  376|   136k|    const char* const percent = cur;
  377|   310k|    while (cur != end && *cur == '%') ++cur;
  ------------------
  |  Branch (377:12): [True: 310k, False: 792]
  |  Branch (377:26): [True: 174k, False: 135k]
  ------------------
  378|       |
  379|       |    // If the new pending text is all percents, copy out one
  380|       |    // percent for every matched pair, then skip those pairs.
  381|   136k|    if (cur != start && pending == start) {
  ------------------
  |  Branch (381:9): [True: 136k, False: 306]
  |  Branch (381:25): [True: 81.4k, False: 54.9k]
  ------------------
  382|  81.4k|      std::size_t escaped = static_cast<std::size_t>(cur - pending) / 2;
  383|  81.4k|      result.append(pending, escaped);
  384|  81.4k|      pending += escaped * 2;
  385|       |      // Also copy out a single trailing percent.
  386|  81.4k|      if (pending != cur && cur == end) {
  ------------------
  |  Branch (386:11): [True: 78.9k, False: 2.53k]
  |  Branch (386:29): [True: 34, False: 78.8k]
  ------------------
  387|     34|        result.push_back(*pending++);
  388|     34|      }
  389|  81.4k|    }
  390|       |
  391|       |    // Loop unless we have an unescaped percent.
  392|   136k|    if (cur == end || (cur - percent) % 2 == 0) continue;
  ------------------
  |  Branch (392:9): [True: 792, False: 135k]
  |  Branch (392:23): [True: 4.41k, False: 131k]
  ------------------
  393|       |
  394|       |    // Simple specifiers that we handle ourselves.
  395|   131k|    if (*cur == '\0' || strchr("YmdeFUuWwHMSTzZs%", *cur)) {
  ------------------
  |  Branch (395:9): [True: 2.74k, False: 128k]
  |  Branch (395:25): [True: 19.9k, False: 108k]
  ------------------
  396|  22.6k|      FormatTM(&result, std::string(pending, cur - 1), tm);
  397|  22.6k|      switch (*cur) {
  ------------------
  |  Branch (397:15): [True: 22.6k, False: 0]
  ------------------
  398|  2.74k|        case '\0':
  ------------------
  |  Branch (398:9): [True: 2.74k, False: 19.9k]
  ------------------
  399|       |          // Because we allow NULs in the format string, we must give
  400|       |          // some meaning to the "%\0" specifier.  We choose the common
  401|       |          // (but undefined) strftime() behavior of echoing unknown
  402|       |          // specifiers.
  403|  2.74k|          result.push_back('%');
  404|  2.74k|          result.push_back('\0');
  405|  2.74k|          break;
  406|    639|        case 'Y':
  ------------------
  |  Branch (406:9): [True: 639, False: 22.0k]
  ------------------
  407|       |          // This avoids the tm.tm_year overflow problem for %Y, however
  408|       |          // tm.tm_year will still be used by other specifiers like %D.
  409|    639|          bp = Format64(ep, 0, al.cs.year());
  410|    639|          result.append(bp, ep);
  411|    639|          break;
  412|    226|        case 'm':
  ------------------
  |  Branch (412:9): [True: 226, False: 22.4k]
  ------------------
  413|    226|          bp = Format02d(ep, al.cs.month());
  414|    226|          result.append(bp, ep);
  415|    226|          break;
  416|    293|        case 'd':
  ------------------
  |  Branch (416:9): [True: 293, False: 22.3k]
  ------------------
  417|    780|        case 'e':
  ------------------
  |  Branch (417:9): [True: 487, False: 22.1k]
  ------------------
  418|    780|          bp = Format02d(ep, al.cs.day());
  419|    780|          if (*cur == 'e' && *bp == '0') *bp = ' ';  // for Windows
  ------------------
  |  Branch (419:15): [True: 487, False: 293]
  |  Branch (419:30): [True: 221, False: 266]
  ------------------
  420|    780|          result.append(bp, ep);
  421|    780|          break;
  422|    728|        case 'F':
  ------------------
  |  Branch (422:9): [True: 728, False: 21.9k]
  ------------------
  423|    728|          bp = Format02d(ep, al.cs.day());
  424|    728|          *--bp = '-';
  425|    728|          bp = Format02d(bp, al.cs.month());
  426|    728|          *--bp = '-';
  427|    728|          bp = Format64(bp, 0, al.cs.year());
  428|    728|          result.append(bp, ep);
  429|    728|          break;
  430|  4.39k|        case 'U':
  ------------------
  |  Branch (430:9): [True: 4.39k, False: 18.2k]
  ------------------
  431|  4.39k|          bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::sunday));
  432|  4.39k|          result.append(bp, ep);
  433|  4.39k|          break;
  434|    755|        case 'u':
  ------------------
  |  Branch (434:9): [True: 755, False: 21.8k]
  ------------------
  435|    755|          bp = Format64(ep, 0, tm.tm_wday ? tm.tm_wday : 7);
  ------------------
  |  Branch (435:32): [True: 532, False: 223]
  ------------------
  436|    755|          result.append(bp, ep);
  437|    755|          break;
  438|  2.74k|        case 'W':
  ------------------
  |  Branch (438:9): [True: 2.74k, False: 19.8k]
  ------------------
  439|  2.74k|          bp = Format02d(ep, ToWeek(civil_day(al.cs), weekday::monday));
  440|  2.74k|          result.append(bp, ep);
  441|  2.74k|          break;
  442|    195|        case 'w':
  ------------------
  |  Branch (442:9): [True: 195, False: 22.4k]
  ------------------
  443|    195|          bp = Format64(ep, 0, tm.tm_wday);
  444|    195|          result.append(bp, ep);
  445|    195|          break;
  446|    211|        case 'H':
  ------------------
  |  Branch (446:9): [True: 211, False: 22.4k]
  ------------------
  447|    211|          bp = Format02d(ep, al.cs.hour());
  448|    211|          result.append(bp, ep);
  449|    211|          break;
  450|    411|        case 'M':
  ------------------
  |  Branch (450:9): [True: 411, False: 22.2k]
  ------------------
  451|    411|          bp = Format02d(ep, al.cs.minute());
  452|    411|          result.append(bp, ep);
  453|    411|          break;
  454|    787|        case 'S':
  ------------------
  |  Branch (454:9): [True: 787, False: 21.8k]
  ------------------
  455|    787|          bp = Format02d(ep, al.cs.second());
  456|    787|          result.append(bp, ep);
  457|    787|          break;
  458|    478|        case 'T':
  ------------------
  |  Branch (458:9): [True: 478, False: 22.1k]
  ------------------
  459|    478|          bp = Format02d(ep, al.cs.second());
  460|    478|          *--bp = ':';
  461|    478|          bp = Format02d(bp, al.cs.minute());
  462|    478|          *--bp = ':';
  463|    478|          bp = Format02d(bp, al.cs.hour());
  464|    478|          result.append(bp, ep);
  465|    478|          break;
  466|  4.85k|        case 'z':
  ------------------
  |  Branch (466:9): [True: 4.85k, False: 17.7k]
  ------------------
  467|  4.85k|          bp = FormatOffset(ep, al.offset, "");
  468|  4.85k|          result.append(bp, ep);
  469|  4.85k|          break;
  470|    234|        case 'Z':
  ------------------
  |  Branch (470:9): [True: 234, False: 22.4k]
  ------------------
  471|    234|          result.append(al.abbr);
  472|    234|          break;
  473|  2.45k|        case 's':
  ------------------
  |  Branch (473:9): [True: 2.45k, False: 20.1k]
  ------------------
  474|  2.45k|          bp = Format64(ep, 0, ToUnixSeconds(tp));
  475|  2.45k|          result.append(bp, ep);
  476|  2.45k|          break;
  477|      0|        case '%':
  ------------------
  |  Branch (477:9): [True: 0, False: 22.6k]
  ------------------
  478|      0|          result.push_back('%');
  479|      0|          break;
  480|  22.6k|      }
  481|  22.6k|      pending = ++cur;
  482|  22.6k|      continue;
  483|  22.6k|    }
  484|       |
  485|       |    // More complex specifiers that we handle ourselves.
  486|   108k|    if (*cur == ':' && cur + 1 != end) {
  ------------------
  |  Branch (486:9): [True: 16.2k, False: 92.6k]
  |  Branch (486:24): [True: 16.2k, False: 6]
  ------------------
  487|  16.2k|      if (*(cur + 1) == 'z') {
  ------------------
  |  Branch (487:11): [True: 2.26k, False: 13.9k]
  ------------------
  488|       |        // Formats %:z.
  489|  2.26k|        FormatTM(&result, std::string(pending, cur - 1), tm);
  490|  2.26k|        bp = FormatOffset(ep, al.offset, ":");
  491|  2.26k|        result.append(bp, ep);
  492|  2.26k|        pending = cur += 2;
  493|  2.26k|        continue;
  494|  2.26k|      }
  495|  13.9k|      if (*(cur + 1) == ':' && cur + 2 != end) {
  ------------------
  |  Branch (495:11): [True: 4.77k, False: 9.18k]
  |  Branch (495:32): [True: 4.77k, False: 1]
  ------------------
  496|  4.77k|        if (*(cur + 2) == 'z') {
  ------------------
  |  Branch (496:13): [True: 1.43k, False: 3.34k]
  ------------------
  497|       |          // Formats %::z.
  498|  1.43k|          FormatTM(&result, std::string(pending, cur - 1), tm);
  499|  1.43k|          bp = FormatOffset(ep, al.offset, ":*");
  500|  1.43k|          result.append(bp, ep);
  501|  1.43k|          pending = cur += 3;
  502|  1.43k|          continue;
  503|  1.43k|        }
  504|  3.34k|        if (*(cur + 2) == ':' && cur + 3 != end) {
  ------------------
  |  Branch (504:13): [True: 1.73k, False: 1.60k]
  |  Branch (504:34): [True: 1.73k, False: 1]
  ------------------
  505|  1.73k|          if (*(cur + 3) == 'z') {
  ------------------
  |  Branch (505:15): [True: 1.33k, False: 400]
  ------------------
  506|       |            // Formats %:::z.
  507|  1.33k|            FormatTM(&result, std::string(pending, cur - 1), tm);
  508|  1.33k|            bp = FormatOffset(ep, al.offset, ":*:");
  509|  1.33k|            result.append(bp, ep);
  510|  1.33k|            pending = cur += 4;
  511|  1.33k|            continue;
  512|  1.33k|          }
  513|  1.73k|        }
  514|  3.34k|      }
  515|  13.9k|    }
  516|       |
  517|       |    // Loop if there is no E modifier.
  518|   103k|    if (*cur != 'E' || ++cur == end) continue;
  ------------------
  |  Branch (518:9): [True: 40.7k, False: 63.1k]
  |  Branch (518:24): [True: 12, False: 63.1k]
  ------------------
  519|       |
  520|       |    // Format our extensions.
  521|  63.1k|    if (*cur == 'T') {
  ------------------
  |  Branch (521:9): [True: 1.84k, False: 61.2k]
  ------------------
  522|       |      // Formats %ET.
  523|  1.84k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  524|  1.84k|      result.append("T");
  525|  1.84k|      pending = ++cur;
  526|  61.2k|    } else if (*cur == 'z') {
  ------------------
  |  Branch (526:16): [True: 2.69k, False: 58.5k]
  ------------------
  527|       |      // Formats %Ez.
  528|  2.69k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  529|  2.69k|      bp = FormatOffset(ep, al.offset, ":");
  530|  2.69k|      result.append(bp, ep);
  531|  2.69k|      pending = ++cur;
  532|  58.5k|    } else if (*cur == '*' && cur + 1 != end && *(cur + 1) == 'z') {
  ------------------
  |  Branch (532:16): [True: 26.9k, False: 31.6k]
  |  Branch (532:31): [True: 26.8k, False: 10]
  |  Branch (532:49): [True: 4.90k, False: 21.9k]
  ------------------
  533|       |      // Formats %E*z.
  534|  4.90k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  535|  4.90k|      bp = FormatOffset(ep, al.offset, ":*");
  536|  4.90k|      result.append(bp, ep);
  537|  4.90k|      pending = cur += 2;
  538|  53.6k|    } else if (*cur == '*' && cur + 1 != end &&
  ------------------
  |  Branch (538:16): [True: 22.0k, False: 31.6k]
  |  Branch (538:31): [True: 21.9k, False: 10]
  ------------------
  539|  21.9k|               (*(cur + 1) == 'S' || *(cur + 1) == 'f')) {
  ------------------
  |  Branch (539:17): [True: 19.6k, False: 2.38k]
  |  Branch (539:38): [True: 1.42k, False: 952]
  ------------------
  540|       |      // Formats %E*S or %E*F.
  541|  21.0k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  542|  21.0k|      char* cp = ep;
  543|  21.0k|      bp = Format64(cp, 15, fs.count());
  544|   336k|      while (cp != bp && cp[-1] == '0') --cp;
  ------------------
  |  Branch (544:14): [True: 315k, False: 21.0k]
  |  Branch (544:26): [True: 315k, False: 0]
  ------------------
  545|  21.0k|      switch (*(cur + 1)) {
  ------------------
  |  Branch (545:15): [True: 21.0k, False: 0]
  ------------------
  546|  19.6k|        case 'S':
  ------------------
  |  Branch (546:9): [True: 19.6k, False: 1.42k]
  ------------------
  547|  19.6k|          if (cp != bp) *--bp = '.';
  ------------------
  |  Branch (547:15): [True: 0, False: 19.6k]
  ------------------
  548|  19.6k|          bp = Format02d(bp, al.cs.second());
  549|  19.6k|          break;
  550|  1.42k|        case 'f':
  ------------------
  |  Branch (550:9): [True: 1.42k, False: 19.6k]
  ------------------
  551|  1.42k|          if (cp == bp) *--bp = '0';
  ------------------
  |  Branch (551:15): [True: 1.42k, False: 0]
  ------------------
  552|  1.42k|          break;
  553|  21.0k|      }
  554|  21.0k|      result.append(bp, cp);
  555|  21.0k|      pending = cur += 2;
  556|  32.6k|    } else if (*cur == '4' && cur + 1 != end && *(cur + 1) == 'Y') {
  ------------------
  |  Branch (556:16): [True: 3.29k, False: 29.3k]
  |  Branch (556:31): [True: 3.29k, False: 4]
  |  Branch (556:49): [True: 2.15k, False: 1.14k]
  ------------------
  557|       |      // Formats %E4Y.
  558|  2.15k|      FormatTM(&result, std::string(pending, cur - 2), tm);
  559|  2.15k|      bp = Format64(ep, 4, al.cs.year());
  560|  2.15k|      result.append(bp, ep);
  561|  2.15k|      pending = cur += 2;
  562|  30.4k|    } else if (isdigit(*cur)) {
  ------------------
  |  Branch (562:16): [True: 20.8k, False: 9.65k]
  ------------------
  563|       |      // Possibly found %E#S or %E#f.
  564|  20.8k|      int n = 0;
  565|  20.8k|      if (const char* np = ParseInt(cur, 0, 0, 1024, &n)) {
  ------------------
  |  Branch (565:23): [True: 12.0k, False: 8.80k]
  ------------------
  566|  12.0k|        if (*np == 'S' || *np == 'f') {
  ------------------
  |  Branch (566:13): [True: 6.04k, False: 5.98k]
  |  Branch (566:27): [True: 1.81k, False: 4.17k]
  ------------------
  567|       |          // Formats %E#S or %E#f.
  568|  7.85k|          FormatTM(&result, std::string(pending, cur - 2), tm);
  569|  7.85k|          bp = ep;
  570|  7.85k|          if (n > 0) {
  ------------------
  |  Branch (570:15): [True: 5.48k, False: 2.36k]
  ------------------
  571|  5.48k|            if (n > kDigits10_64) n = kDigits10_64;
  ------------------
  |  Branch (571:17): [True: 747, False: 4.73k]
  ------------------
  572|  5.48k|            bp = Format64(bp, n, (n > 15) ? fs.count() * kExp10[n - 15]
  ------------------
  |  Branch (572:34): [True: 749, False: 4.73k]
  ------------------
  573|  5.48k|                                          : fs.count() / kExp10[15 - n]);
  574|  5.48k|            if (*np == 'S') *--bp = '.';
  ------------------
  |  Branch (574:17): [True: 3.90k, False: 1.57k]
  ------------------
  575|  5.48k|          }
  576|  7.85k|          if (*np == 'S') bp = Format02d(bp, al.cs.second());
  ------------------
  |  Branch (576:15): [True: 6.04k, False: 1.81k]
  ------------------
  577|  7.85k|          result.append(bp, ep);
  578|  7.85k|          pending = cur = ++np;
  579|  7.85k|        }
  580|  12.0k|      }
  581|  20.8k|    }
  582|  63.1k|  }
  583|       |
  584|       |  // Formats any remaining data.
  585|  8.87k|  FormatTM(&result, std::string(pending, end), tm);
  586|       |
  587|  8.87k|  return result;
  588|  8.87k|}
_ZN4cctz6detail5parseERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEES9_RKNS_9time_zoneEPNS1_6chrono10time_pointINSD_12system_clockENSD_8durationIlNS1_5ratioILl1ELl1EEEEEEEPNSG_IlNSH_ILl1ELl1000000000000000EEEEEPS7_:
  705|  8.87k|           detail::femtoseconds* fs, std::string* err) {
  706|       |  // The unparsed input.  Even though we allow NULs in input, and
  707|       |  // match them against corresponding NULs in format, we depend on
  708|       |  // *edata being a NUL so that we can call strptime().  This also
  709|       |  // makes our handling of input easier.
  710|  8.87k|  const char* data = input.c_str();  // NUL terminated
  711|  8.87k|  const char* const edata = data + input.size();
  712|       |
  713|       |  // Skips leading whitespace.
  714|  9.24k|  while (isspace(*data)) ++data;
  ------------------
  |  Branch (714:10): [True: 379, False: 8.87k]
  ------------------
  715|       |
  716|  8.87k|  const year_t kyearmax = std::numeric_limits<year_t>::max();
  717|  8.87k|  const year_t kyearmin = std::numeric_limits<year_t>::min();
  718|       |
  719|       |  // Sets default values for unspecified fields.
  720|  8.87k|  bool saw_year = false;
  721|  8.87k|  year_t year = 1970;
  722|  8.87k|  std::tm tm{};
  723|  8.87k|  tm.tm_year = 1970 - 1900;
  724|  8.87k|  tm.tm_mon = 1 - 1;  // Jan
  725|  8.87k|  tm.tm_mday = 1;
  726|  8.87k|  tm.tm_hour = 0;
  727|  8.87k|  tm.tm_min = 0;
  728|  8.87k|  tm.tm_sec = 0;
  729|  8.87k|  tm.tm_wday = 4;  // Thu
  730|  8.87k|  tm.tm_yday = 0;
  731|  8.87k|  tm.tm_isdst = 0;
  732|  8.87k|  auto subseconds = detail::femtoseconds::zero();
  733|  8.87k|  bool saw_offset = false;
  734|  8.87k|  int offset = 0;  // No offset from passed tz.
  735|  8.87k|  std::string zone = "UTC";
  736|       |
  737|       |  // Even though we allow NULs in format, and match them against
  738|       |  // corresponding NULs in input, we simplify its handling by also
  739|       |  // ensuring that *efmt is a NUL.
  740|  8.87k|  const char* fmt = format.c_str();  // NUL terminated
  741|  8.87k|  const char* const efmt = fmt + format.size();
  742|  8.87k|  bool twelve_hour = false;
  743|  8.87k|  bool afternoon = false;
  744|  8.87k|  int week_num = -1;
  745|  8.87k|  weekday week_start = weekday::sunday;
  746|       |
  747|  8.87k|  bool saw_percent_s = false;
  748|  8.87k|  std::int_fast64_t percent_s = 0;
  749|       |
  750|       |  // Steps through format, one specifier at a time.
  751|  34.7k|  while (data != nullptr && fmt != efmt) {
  ------------------
  |  Branch (751:10): [True: 32.3k, False: 2.45k]
  |  Branch (751:29): [True: 25.9k, False: 6.41k]
  ------------------
  752|  25.9k|    if (isspace(*fmt)) {
  ------------------
  |  Branch (752:9): [True: 1.51k, False: 24.4k]
  ------------------
  753|  2.91k|      while (isspace(*data)) ++data;
  ------------------
  |  Branch (753:14): [True: 1.40k, False: 1.51k]
  ------------------
  754|  1.70k|      while (isspace(*++fmt)) continue;
  ------------------
  |  Branch (754:14): [True: 197, False: 1.51k]
  ------------------
  755|  1.51k|      continue;
  756|  1.51k|    }
  757|       |
  758|  24.4k|    if (*fmt != '%') {
  ------------------
  |  Branch (758:9): [True: 2.96k, False: 21.4k]
  ------------------
  759|  2.96k|      if (data != edata && *data == *fmt) {
  ------------------
  |  Branch (759:11): [True: 2.85k, False: 105]
  |  Branch (759:28): [True: 2.78k, False: 71]
  ------------------
  760|  2.78k|        ++data;
  761|  2.78k|        ++fmt;
  762|  2.78k|      } else {
  763|    176|        data = nullptr;
  764|    176|      }
  765|  2.96k|      continue;
  766|  2.96k|    }
  767|       |
  768|  21.4k|    const char* const percent = fmt;
  769|  21.4k|    if (++fmt == efmt) {
  ------------------
  |  Branch (769:9): [True: 10, False: 21.4k]
  ------------------
  770|     10|      data = nullptr;
  771|     10|      continue;
  772|     10|    }
  773|  21.4k|    switch (*fmt++) {
  ------------------
  |  Branch (773:13): [True: 20.5k, False: 868]
  ------------------
  774|      2|      case '\0':
  ------------------
  |  Branch (774:7): [True: 2, False: 21.4k]
  ------------------
  775|       |        // Because we allow NULs in the format string, we must give
  776|       |        // some meaning to the "%\0" specifier.  We choose the common
  777|       |        // (but undefined) strptime() behavior of failing on unknown
  778|       |        // specifiers.
  779|      2|        data = nullptr;
  780|      2|        continue;
  781|  2.04k|      case 'Y':
  ------------------
  |  Branch (781:7): [True: 2.04k, False: 19.3k]
  ------------------
  782|       |        // Symmetrically with format(), directly handing %Y avoids the
  783|       |        // tm.tm_year overflow problem.  However, tm.tm_year will still be
  784|       |        // used by other specifiers like %D.
  785|  2.04k|        data = ParseInt(data, 0, kyearmin, kyearmax, &year);
  786|  2.04k|        if (data != nullptr) saw_year = true;
  ------------------
  |  Branch (786:13): [True: 1.95k, False: 92]
  ------------------
  787|  2.04k|        continue;
  788|    616|      case 'm':
  ------------------
  |  Branch (788:7): [True: 616, False: 20.8k]
  ------------------
  789|    616|        data = ParseInt(data, 2, 1, 12, &tm.tm_mon);
  790|    616|        if (data != nullptr) tm.tm_mon -= 1;
  ------------------
  |  Branch (790:13): [True: 581, False: 35]
  ------------------
  791|    616|        week_num = -1;
  792|    616|        continue;
  793|    138|      case 'd':
  ------------------
  |  Branch (793:7): [True: 138, False: 21.3k]
  ------------------
  794|    532|      case 'e':
  ------------------
  |  Branch (794:7): [True: 394, False: 21.0k]
  ------------------
  795|    532|        data = ParseInt(data, 2, 1, 31, &tm.tm_mday);
  796|    532|        week_num = -1;
  797|    532|        continue;
  798|    732|      case 'F':
  ------------------
  |  Branch (798:7): [True: 732, False: 20.7k]
  ------------------
  799|    732|        data = ParseInt(data, 0, kyearmin, kyearmax, &year);
  800|    732|        if (data != nullptr) {
  ------------------
  |  Branch (800:13): [True: 684, False: 48]
  ------------------
  801|    684|          saw_year = true;
  802|    684|          data = (*data == '-' ? data + 1 : nullptr);
  ------------------
  |  Branch (802:19): [True: 411, False: 273]
  ------------------
  803|    684|        }
  804|    732|        data = ParseInt(data, 2, 1, 12, &tm.tm_mon);
  805|    732|        if (data != nullptr) {
  ------------------
  |  Branch (805:13): [True: 372, False: 360]
  ------------------
  806|    372|          tm.tm_mon -= 1;
  807|    372|          data = (*data == '-' ? data + 1 : nullptr);
  ------------------
  |  Branch (807:19): [True: 353, False: 19]
  ------------------
  808|    372|        }
  809|    732|        data = ParseInt(data, 2, 1, 31, &tm.tm_mday);
  810|    732|        week_num = -1;
  811|    732|        continue;
  812|    498|      case 'U':
  ------------------
  |  Branch (812:7): [True: 498, False: 20.9k]
  ------------------
  813|    498|        data = ParseInt(data, 0, 0, 53, &week_num);
  814|    498|        week_start = weekday::sunday;
  815|    498|        continue;
  816|    377|      case 'W':
  ------------------
  |  Branch (816:7): [True: 377, False: 21.0k]
  ------------------
  817|    377|        data = ParseInt(data, 0, 0, 53, &week_num);
  818|    377|        week_start = weekday::monday;
  819|    377|        continue;
  820|    283|      case 'u':
  ------------------
  |  Branch (820:7): [True: 283, False: 21.1k]
  ------------------
  821|    283|        data = ParseInt(data, 0, 1, 7, &tm.tm_wday);
  822|    283|        if (data != nullptr) tm.tm_wday %= 7;
  ------------------
  |  Branch (822:13): [True: 80, False: 203]
  ------------------
  823|    283|        continue;
  824|    300|      case 'w':
  ------------------
  |  Branch (824:7): [True: 300, False: 21.1k]
  ------------------
  825|    300|        data = ParseInt(data, 0, 0, 6, &tm.tm_wday);
  826|    300|        continue;
  827|    455|      case 'H':
  ------------------
  |  Branch (827:7): [True: 455, False: 20.9k]
  ------------------
  828|    455|        data = ParseInt(data, 2, 0, 23, &tm.tm_hour);
  829|    455|        twelve_hour = false;
  830|    455|        continue;
  831|    491|      case 'M':
  ------------------
  |  Branch (831:7): [True: 491, False: 20.9k]
  ------------------
  832|    491|        data = ParseInt(data, 2, 0, 59, &tm.tm_min);
  833|    491|        continue;
  834|    518|      case 'S':
  ------------------
  |  Branch (834:7): [True: 518, False: 20.9k]
  ------------------
  835|    518|        data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  836|    518|        continue;
  837|    432|      case 'T':
  ------------------
  |  Branch (837:7): [True: 432, False: 21.0k]
  ------------------
  838|    432|        data = ParseInt(data, 2, 0, 23, &tm.tm_hour);
  839|    432|        twelve_hour = false;
  840|    432|        data = (data != nullptr && *data == ':' ? data + 1 : nullptr);
  ------------------
  |  Branch (840:17): [True: 400, False: 32]
  |  Branch (840:36): [True: 382, False: 18]
  ------------------
  841|    432|        data = ParseInt(data, 2, 0, 59, &tm.tm_min);
  842|    432|        data = (data != nullptr && *data == ':' ? data + 1 : nullptr);
  ------------------
  |  Branch (842:17): [True: 348, False: 84]
  |  Branch (842:36): [True: 318, False: 30]
  ------------------
  843|    432|        data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  844|    432|        continue;
  845|     77|      case 'I':
  ------------------
  |  Branch (845:7): [True: 77, False: 21.3k]
  ------------------
  846|    149|      case 'l':
  ------------------
  |  Branch (846:7): [True: 72, False: 21.3k]
  ------------------
  847|    159|      case 'r':  // probably uses %I
  ------------------
  |  Branch (847:7): [True: 10, False: 21.4k]
  ------------------
  848|    159|        twelve_hour = true;
  849|    159|        break;
  850|     34|      case 'R':  // uses %H
  ------------------
  |  Branch (850:7): [True: 34, False: 21.4k]
  ------------------
  851|     35|      case 'c':  // probably uses %H
  ------------------
  |  Branch (851:7): [True: 1, False: 21.4k]
  ------------------
  852|     55|      case 'X':  // probably uses %H
  ------------------
  |  Branch (852:7): [True: 20, False: 21.4k]
  ------------------
  853|     55|        twelve_hour = false;
  854|     55|        break;
  855|  2.88k|      case 'z':
  ------------------
  |  Branch (855:7): [True: 2.88k, False: 18.5k]
  ------------------
  856|  2.88k|        data = ParseOffset(data, "", &offset);
  857|  2.88k|        if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (857:13): [True: 2.82k, False: 63]
  ------------------
  858|  2.88k|        continue;
  859|    912|      case 'Z':  // ignored; zone abbreviations are ambiguous
  ------------------
  |  Branch (859:7): [True: 912, False: 20.5k]
  ------------------
  860|    912|        data = ParseZone(data, &zone);
  861|    912|        continue;
  862|    637|      case 's':
  ------------------
  |  Branch (862:7): [True: 637, False: 20.8k]
  ------------------
  863|    637|        data = ParseInt(data, 0,
  864|    637|                        std::numeric_limits<std::int_fast64_t>::min(),
  865|    637|                        std::numeric_limits<std::int_fast64_t>::max(),
  866|    637|                        &percent_s);
  867|    637|        if (data != nullptr) saw_percent_s = true;
  ------------------
  |  Branch (867:13): [True: 542, False: 95]
  ------------------
  868|    637|        continue;
  869|    903|      case ':':
  ------------------
  |  Branch (869:7): [True: 903, False: 20.5k]
  ------------------
  870|    903|        if (fmt[0] == 'z' ||
  ------------------
  |  Branch (870:13): [True: 447, False: 456]
  ------------------
  871|    456|            (fmt[0] == ':' &&
  ------------------
  |  Branch (871:14): [True: 444, False: 12]
  ------------------
  872|    877|             (fmt[1] == 'z' || (fmt[1] == ':' && fmt[2] == 'z')))) {
  ------------------
  |  Branch (872:15): [True: 234, False: 210]
  |  Branch (872:33): [True: 204, False: 6]
  |  Branch (872:50): [True: 196, False: 8]
  ------------------
  873|    877|          data = ParseOffset(data, ":", &offset);
  874|    877|          if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (874:15): [True: 857, False: 20]
  ------------------
  875|    877|          fmt += (fmt[0] == 'z') ? 1 : (fmt[1] == 'z') ? 2 : 3;
  ------------------
  |  Branch (875:18): [True: 447, False: 430]
  |  Branch (875:40): [True: 234, False: 196]
  ------------------
  876|    877|          continue;
  877|    877|        }
  878|     26|        break;
  879|    203|      case '%':
  ------------------
  |  Branch (879:7): [True: 203, False: 21.2k]
  ------------------
  880|    203|        data = (*data == '%' ? data + 1 : nullptr);
  ------------------
  |  Branch (880:17): [True: 194, False: 9]
  ------------------
  881|    203|        continue;
  882|  7.44k|      case 'E':
  ------------------
  |  Branch (882:7): [True: 7.44k, False: 13.9k]
  ------------------
  883|  7.44k|        if (fmt[0] == 'T') {
  ------------------
  |  Branch (883:13): [True: 398, False: 7.04k]
  ------------------
  884|    398|          if (*data == 'T' || *data == 't') {
  ------------------
  |  Branch (884:15): [True: 195, False: 203]
  |  Branch (884:31): [True: 194, False: 9]
  ------------------
  885|    389|            ++data;
  886|    389|            ++fmt;
  887|    389|          } else {
  888|      9|            data = nullptr;
  889|      9|          }
  890|    398|          continue;
  891|    398|        }
  892|  7.04k|        if (fmt[0] == 'z' || (fmt[0] == '*' && fmt[1] == 'z')) {
  ------------------
  |  Branch (892:13): [True: 1.78k, False: 5.26k]
  |  Branch (892:31): [True: 3.41k, False: 1.84k]
  |  Branch (892:48): [True: 590, False: 2.82k]
  ------------------
  893|  2.37k|          data = ParseOffset(data, ":", &offset);
  894|  2.37k|          if (data != nullptr) saw_offset = true;
  ------------------
  |  Branch (894:15): [True: 2.35k, False: 15]
  ------------------
  895|  2.37k|          fmt += (fmt[0] == 'z') ? 1 : 2;
  ------------------
  |  Branch (895:18): [True: 1.78k, False: 590]
  ------------------
  896|  2.37k|          continue;
  897|  2.37k|        }
  898|  4.67k|        if (fmt[0] == '*' && fmt[1] == 'S') {
  ------------------
  |  Branch (898:13): [True: 2.82k, False: 1.84k]
  |  Branch (898:30): [True: 484, False: 2.34k]
  ------------------
  899|    484|          data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  900|    484|          if (data != nullptr && *data == '.') {
  ------------------
  |  Branch (900:15): [True: 474, False: 10]
  |  Branch (900:34): [True: 10, False: 464]
  ------------------
  901|     10|            data = ParseSubSeconds(data + 1, &subseconds);
  902|     10|          }
  903|    484|          fmt += 2;
  904|    484|          continue;
  905|    484|        }
  906|  4.18k|        if (fmt[0] == '*' && fmt[1] == 'f') {
  ------------------
  |  Branch (906:13): [True: 2.34k, False: 1.84k]
  |  Branch (906:30): [True: 2.31k, False: 25]
  ------------------
  907|  2.31k|          if (data != nullptr && isdigit(*data)) {
  ------------------
  |  Branch (907:15): [True: 2.31k, False: 0]
  |  Branch (907:34): [True: 909, False: 1.40k]
  ------------------
  908|    909|            data = ParseSubSeconds(data, &subseconds);
  909|    909|          }
  910|  2.31k|          fmt += 2;
  911|  2.31k|          continue;
  912|  2.31k|        }
  913|  1.87k|        if (fmt[0] == '4' && fmt[1] == 'Y') {
  ------------------
  |  Branch (913:13): [True: 632, False: 1.23k]
  |  Branch (913:30): [True: 301, False: 331]
  ------------------
  914|    301|          const char* bp = data;
  915|    301|          data = ParseInt(data, 4, year_t{-999}, year_t{9999}, &year);
  916|    301|          if (data != nullptr) {
  ------------------
  |  Branch (916:15): [True: 282, False: 19]
  ------------------
  917|    282|            if (data - bp == 4) {
  ------------------
  |  Branch (917:17): [True: 233, False: 49]
  ------------------
  918|    233|              saw_year = true;
  919|    233|            } else {
  920|     49|              data = nullptr;  // stopped too soon
  921|     49|            }
  922|    282|          }
  923|    301|          fmt += 2;
  924|    301|          continue;
  925|    301|        }
  926|  1.56k|        if (isdigit(*fmt)) {
  ------------------
  |  Branch (926:13): [True: 1.45k, False: 111]
  ------------------
  927|  1.45k|          int n = 0;  // value ignored
  928|  1.45k|          if (const char* np = ParseInt(fmt, 0, 0, 1024, &n)) {
  ------------------
  |  Branch (928:27): [True: 1.33k, False: 120]
  ------------------
  929|  1.33k|            if (*np == 'S') {
  ------------------
  |  Branch (929:17): [True: 265, False: 1.07k]
  ------------------
  930|    265|              data = ParseInt(data, 2, 0, 60, &tm.tm_sec);
  931|    265|              if (data != nullptr && *data == '.') {
  ------------------
  |  Branch (931:19): [True: 246, False: 19]
  |  Branch (931:38): [True: 10, False: 236]
  ------------------
  932|     10|                data = ParseSubSeconds(data + 1, &subseconds);
  933|     10|              }
  934|    265|              fmt = ++np;
  935|    265|              continue;
  936|    265|            }
  937|  1.07k|            if (*np == 'f') {
  ------------------
  |  Branch (937:17): [True: 1.01k, False: 54]
  ------------------
  938|  1.01k|              if (data != nullptr && isdigit(*data)) {
  ------------------
  |  Branch (938:19): [True: 1.01k, False: 0]
  |  Branch (938:38): [True: 398, False: 621]
  ------------------
  939|    398|                data = ParseSubSeconds(data, &subseconds);
  940|    398|              }
  941|  1.01k|              fmt = ++np;
  942|  1.01k|              continue;
  943|  1.01k|            }
  944|  1.07k|          }
  945|  1.45k|        }
  946|    285|        if (*fmt == 'c') twelve_hour = false;  // probably uses %H
  ------------------
  |  Branch (946:13): [True: 1, False: 284]
  ------------------
  947|    285|        if (*fmt == 'X') twelve_hour = false;  // probably uses %H
  ------------------
  |  Branch (947:13): [True: 10, False: 275]
  ------------------
  948|    285|        if (*fmt != '\0') ++fmt;
  ------------------
  |  Branch (948:13): [True: 274, False: 11]
  ------------------
  949|    285|        break;
  950|     97|      case 'O':
  ------------------
  |  Branch (950:7): [True: 97, False: 21.3k]
  ------------------
  951|     97|        if (*fmt == 'H') twelve_hour = false;
  ------------------
  |  Branch (951:13): [True: 36, False: 61]
  ------------------
  952|     97|        if (*fmt == 'I') twelve_hour = true;
  ------------------
  |  Branch (952:13): [True: 40, False: 57]
  ------------------
  953|     97|        if (*fmt != '\0') ++fmt;
  ------------------
  |  Branch (953:13): [True: 92, False: 5]
  ------------------
  954|     97|        break;
  955|  21.4k|    }
  956|       |
  957|       |    // Parses the current specifier.
  958|  1.49k|    const char* const orig_data = data;
  959|  1.49k|    std::string spec(percent, fmt);
  960|  1.49k|    data = ParseTM(data, spec.c_str(), &tm);
  961|       |
  962|       |    // If we successfully parsed %p we need to remember whether the result
  963|       |    // was AM or PM so that we can adjust tm_hour before time_zone::lookup().
  964|       |    // So reparse the input with a known AM hour, and check if it is shifted
  965|       |    // to a PM hour.
  966|  1.49k|    if (spec == "%p" && data != nullptr) {
  ------------------
  |  Branch (966:9): [True: 240, False: 1.25k]
  |  Branch (966:25): [True: 234, False: 6]
  ------------------
  967|    234|      std::string test_input = "1";
  968|    234|      test_input.append(orig_data, data);
  969|    234|      std::tm tmp{};
  970|    234|      ParseTM(test_input.c_str(), "%I%p", &tmp);
  971|    234|      afternoon = (tmp.tm_hour == 13);
  972|    234|    }
  973|  1.49k|  }
  974|       |
  975|       |  // Adjust a 12-hour tm_hour value if it should be in the afternoon.
  976|  8.87k|  if (twelve_hour && afternoon && tm.tm_hour < 12) {
  ------------------
  |  Branch (976:7): [True: 45, False: 8.82k]
  |  Branch (976:22): [True: 6, False: 39]
  |  Branch (976:35): [True: 4, False: 2]
  ------------------
  977|      4|    tm.tm_hour += 12;
  978|      4|  }
  979|       |
  980|  8.87k|  if (data == nullptr) {
  ------------------
  |  Branch (980:7): [True: 2.45k, False: 6.41k]
  ------------------
  981|  2.45k|    if (err != nullptr) *err = "Failed to parse input";
  ------------------
  |  Branch (981:9): [True: 0, False: 2.45k]
  ------------------
  982|  2.45k|    return false;
  983|  2.45k|  }
  984|       |
  985|       |  // Skip any remaining whitespace.
  986|  6.61k|  while (isspace(*data)) ++data;
  ------------------
  |  Branch (986:10): [True: 200, False: 6.41k]
  ------------------
  987|       |
  988|       |  // parse() must consume the entire input string.
  989|  6.41k|  if (data != edata) {
  ------------------
  |  Branch (989:7): [True: 269, False: 6.14k]
  ------------------
  990|    269|    if (err != nullptr) *err = "Illegal trailing data in input string";
  ------------------
  |  Branch (990:9): [True: 0, False: 269]
  ------------------
  991|    269|    return false;
  992|    269|  }
  993|       |
  994|       |  // If we saw %s then we ignore anything else and return that time.
  995|  6.14k|  if (saw_percent_s) {
  ------------------
  |  Branch (995:7): [True: 282, False: 5.86k]
  ------------------
  996|    282|    *sec = FromUnixSeconds(percent_s);
  997|    282|    *fs = detail::femtoseconds::zero();
  998|    282|    return true;
  999|    282|  }
 1000|       |
 1001|       |  // If we saw %z, %Ez, or %E*z then we want to interpret the parsed fields
 1002|       |  // in UTC and then shift by that offset.  Otherwise we want to interpret
 1003|       |  // the fields directly in the passed time_zone.
 1004|  5.86k|  time_zone ptz = saw_offset ? utc_time_zone() : tz;
  ------------------
  |  Branch (1004:19): [True: 190, False: 5.67k]
  ------------------
 1005|       |
 1006|       |  // Allows a leap second of 60 to normalize forward to the following ":00".
 1007|  5.86k|  if (tm.tm_sec == 60) {
  ------------------
  |  Branch (1007:7): [True: 39, False: 5.82k]
  ------------------
 1008|     39|    tm.tm_sec -= 1;
 1009|     39|    offset -= 1;
 1010|     39|    subseconds = detail::femtoseconds::zero();
 1011|     39|  }
 1012|       |
 1013|  5.86k|  if (!saw_year) {
  ------------------
  |  Branch (1013:7): [True: 4.10k, False: 1.76k]
  ------------------
 1014|  4.10k|    year = year_t{tm.tm_year};
 1015|  4.10k|    if (year > kyearmax - 1900) {
  ------------------
  |  Branch (1015:9): [True: 0, False: 4.10k]
  ------------------
 1016|       |      // Platform-dependent, maybe unreachable.
 1017|      0|      if (err != nullptr) *err = "Out-of-range year";
  ------------------
  |  Branch (1017:11): [True: 0, False: 0]
  ------------------
 1018|      0|      return false;
 1019|      0|    }
 1020|  4.10k|    year += 1900;
 1021|  4.10k|  }
 1022|       |
 1023|       |  // Compute year, tm.tm_mon and tm.tm_mday if we parsed a week number.
 1024|  5.86k|  if (week_num != -1) {
  ------------------
  |  Branch (1024:7): [True: 292, False: 5.57k]
  ------------------
 1025|    292|    if (!FromWeek(week_num, week_start, &year, &tm)) {
  ------------------
  |  Branch (1025:9): [True: 2, False: 290]
  ------------------
 1026|      2|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1026:11): [True: 0, False: 2]
  ------------------
 1027|      2|      return false;
 1028|      2|    }
 1029|    292|  }
 1030|       |
 1031|  5.86k|  const int month = tm.tm_mon + 1;
 1032|  5.86k|  civil_second cs(year, month, tm.tm_mday, tm.tm_hour, tm.tm_min, tm.tm_sec);
 1033|       |
 1034|       |  // parse() should not allow normalization. Due to the restricted field
 1035|       |  // ranges above (see ParseInt()), the only possibility is for days to roll
 1036|       |  // into months. That is, parsing "Sep 31" should not produce "Oct 1".
 1037|  5.86k|  if (cs.month() != month || cs.day() != tm.tm_mday) {
  ------------------
  |  Branch (1037:7): [True: 2, False: 5.86k]
  |  Branch (1037:30): [True: 0, False: 5.86k]
  ------------------
 1038|      2|    if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1038:9): [True: 0, False: 2]
  ------------------
 1039|      2|    return false;
 1040|      2|  }
 1041|       |
 1042|       |  // Accounts for the offset adjustment before converting to absolute time.
 1043|  5.86k|  if ((offset < 0 && cs > civil_second::max() + offset) ||
  ------------------
  |  Branch (1043:7): [True: 1, False: 5.86k]
  |  Branch (1043:8): [True: 112, False: 5.74k]
  |  Branch (1043:22): [True: 0, False: 112]
  ------------------
 1044|  5.86k|      (offset > 0 && cs < civil_second::min() + offset)) {
  ------------------
  |  Branch (1044:8): [True: 85, False: 5.77k]
  |  Branch (1044:22): [True: 1, False: 84]
  ------------------
 1045|      1|    if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1045:9): [True: 0, False: 1]
  ------------------
 1046|      1|    return false;
 1047|      1|  }
 1048|  5.86k|  cs -= offset;
 1049|       |
 1050|  5.86k|  const auto tp = ptz.lookup(cs).pre;
 1051|       |  // Checks for overflow/underflow and returns an error as necessary.
 1052|  5.86k|  if (tp == time_point<seconds>::max()) {
  ------------------
  |  Branch (1052:7): [True: 391, False: 5.46k]
  ------------------
 1053|    391|    const auto al = ptz.lookup(time_point<seconds>::max());
 1054|    391|    if (cs > al.cs) {
  ------------------
  |  Branch (1054:9): [True: 243, False: 148]
  ------------------
 1055|    243|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1055:11): [True: 0, False: 243]
  ------------------
 1056|    243|      return false;
 1057|    243|    }
 1058|    391|  }
 1059|  5.61k|  if (tp == time_point<seconds>::min()) {
  ------------------
  |  Branch (1059:7): [True: 362, False: 5.25k]
  ------------------
 1060|    362|    const auto al = ptz.lookup(time_point<seconds>::min());
 1061|    362|    if (cs < al.cs) {
  ------------------
  |  Branch (1061:9): [True: 158, False: 204]
  ------------------
 1062|    158|      if (err != nullptr) *err = "Out-of-range field";
  ------------------
  |  Branch (1062:11): [True: 0, False: 158]
  ------------------
 1063|    158|      return false;
 1064|    158|    }
 1065|    362|  }
 1066|       |
 1067|  5.45k|  *sec = tp;
 1068|  5.45k|  *fs = subseconds;
 1069|  5.45k|  return true;
 1070|  5.61k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_14ToTMERKNS_9time_zone15absolute_lookupE:
  120|  8.87k|std::tm ToTM(const time_zone::absolute_lookup& al) {
  121|  8.87k|  std::tm tm{};
  122|  8.87k|  tm.tm_sec = al.cs.second();
  123|  8.87k|  tm.tm_min = al.cs.minute();
  124|  8.87k|  tm.tm_hour = al.cs.hour();
  125|  8.87k|  tm.tm_mday = al.cs.day();
  126|  8.87k|  tm.tm_mon = al.cs.month() - 1;
  127|       |
  128|       |  // Saturate tm.tm_year in cases of over/underflow.
  129|  8.87k|  if (al.cs.year() < std::numeric_limits<int>::min() + 1900) {
  ------------------
  |  Branch (129:7): [True: 0, False: 8.87k]
  ------------------
  130|      0|    tm.tm_year = std::numeric_limits<int>::min();
  131|  8.87k|  } else if (al.cs.year() - 1900 > std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (131:14): [True: 662, False: 8.20k]
  ------------------
  132|    662|    tm.tm_year = std::numeric_limits<int>::max();
  133|  8.20k|  } else {
  134|  8.20k|    tm.tm_year = static_cast<int>(al.cs.year() - 1900);
  135|  8.20k|  }
  136|       |
  137|  8.87k|  tm.tm_wday = ToTmWday(get_weekday(al.cs));
  138|  8.87k|  tm.tm_yday = get_yearday(al.cs) - 1;
  139|  8.87k|  tm.tm_isdst = al.is_dst ? 1 : 0;
  ------------------
  |  Branch (139:17): [True: 708, False: 8.16k]
  ------------------
  140|  8.87k|  return tm;
  141|  8.87k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ToTmWdayENS0_7weekdayE:
   79|  8.87k|int ToTmWday(weekday wd) {
   80|  8.87k|  switch (wd) {
  ------------------
  |  Branch (80:11): [True: 8.87k, False: 0]
  ------------------
   81|    538|    case weekday::sunday:
  ------------------
  |  Branch (81:5): [True: 538, False: 8.33k]
  ------------------
   82|    538|      return 0;
   83|    467|    case weekday::monday:
  ------------------
  |  Branch (83:5): [True: 467, False: 8.40k]
  ------------------
   84|    467|      return 1;
   85|  6.04k|    case weekday::tuesday:
  ------------------
  |  Branch (85:5): [True: 6.04k, False: 2.82k]
  ------------------
   86|  6.04k|      return 2;
   87|    477|    case weekday::wednesday:
  ------------------
  |  Branch (87:5): [True: 477, False: 8.39k]
  ------------------
   88|    477|      return 3;
   89|    500|    case weekday::thursday:
  ------------------
  |  Branch (89:5): [True: 500, False: 8.37k]
  ------------------
   90|    500|      return 4;
   91|    432|    case weekday::friday:
  ------------------
  |  Branch (91:5): [True: 432, False: 8.43k]
  ------------------
   92|    432|      return 5;
   93|    410|    case weekday::saturday:
  ------------------
  |  Branch (93:5): [True: 410, False: 8.46k]
  ------------------
   94|    410|      return 6;
   95|  8.87k|  }
   96|      0|  return 0; /*NOTREACHED*/
   97|  8.87k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18FormatTMEPNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEERKS8_RK2tm:
  223|  87.3k|void FormatTM(std::string* out, const std::string& fmt, const std::tm& tm) {
  224|       |  // We assume that 16 times the length of the format string will
  225|       |  // be sufficient to store the result.  The extreme case appears
  226|       |  // to be "%c" (2 chars), which, in the POSIX locale, produces
  227|       |  // "Thu Jan 1 00:00:00 1970" (24 chars).
  228|  87.3k|  auto out_size = out->size();
  229|  87.3k|  auto buf_size = (16 * fmt.size()) + 1;
  230|  87.3k|  out->resize(out_size + buf_size);
  231|  87.3k|  auto len = strftime(&(*out)[out_size], buf_size, fmt.c_str(), &tm);
  232|  87.3k|  out->resize(out_size + len);
  233|  87.3k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18Format64EPcil:
  155|  33.4k|char* Format64(char* ep, int width, std::int_fast64_t v) {
  156|  33.4k|  bool neg = false;
  157|  33.4k|  if (v < 0) {
  ------------------
  |  Branch (157:7): [True: 825, False: 32.6k]
  ------------------
  158|    825|    --width;
  159|    825|    neg = true;
  160|    825|    if (v == std::numeric_limits<std::int_fast64_t>::min()) {
  ------------------
  |  Branch (160:9): [True: 0, False: 825]
  ------------------
  161|       |      // Avoid negating minimum value.
  162|      0|      std::int_fast64_t last_digit = -(v % 10);
  163|      0|      v /= 10;
  164|      0|      if (last_digit < 0) {
  ------------------
  |  Branch (164:11): [True: 0, False: 0]
  ------------------
  165|      0|        ++v;
  166|      0|        last_digit += 10;
  167|      0|      }
  168|      0|      --width;
  169|      0|      *--ep = kDigits[last_digit];
  170|      0|    }
  171|    825|    v = -v;
  172|    825|  }
  173|  91.8k|  do {
  174|  91.8k|    --width;
  175|  91.8k|    *--ep = kDigits[v % 10];
  176|  91.8k|  } while (v /= 10);
  ------------------
  |  Branch (176:12): [True: 58.4k, False: 33.4k]
  ------------------
  177|   357k|  while (--width >= 0) *--ep = '0';  // zero pad
  ------------------
  |  Branch (177:10): [True: 324k, False: 33.4k]
  ------------------
  178|  33.4k|  if (neg) *--ep = '-';
  ------------------
  |  Branch (178:7): [True: 825, False: 32.6k]
  ------------------
  179|  33.4k|  return ep;
  180|  33.4k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_19Format02dEPci:
  183|  78.8k|char* Format02d(char* ep, int v) {
  184|  78.8k|  *--ep = kDigits[v % 10];
  185|  78.8k|  *--ep = kDigits[(v / 10) % 10];
  186|  78.8k|  return ep;
  187|  78.8k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_16ToWeekERKNS0_10civil_timeINS0_7day_tagEEENS0_7weekdayE:
  145|  7.14k|int ToWeek(const civil_day& cd, weekday week_start) {
  146|  7.14k|  const civil_day d(cd.year() % 400, cd.month(), cd.day());
  147|  7.14k|  return static_cast<int>((d - prev_weekday(civil_year(d), week_start)) / 7);
  148|  7.14k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_112FormatOffsetEPciPKc:
  190|  17.4k|char* FormatOffset(char* ep, int offset, const char* mode) {
  191|       |  // TODO: Follow the RFC3339 "Unknown Local Offset Convention" and
  192|       |  // generate a "negative zero" when we're formatting a zero offset
  193|       |  // as the result of a failed load_time_zone().
  194|  17.4k|  char sign = '+';
  195|  17.4k|  if (offset < 0) {
  ------------------
  |  Branch (195:7): [True: 3.50k, False: 13.9k]
  ------------------
  196|  3.50k|    offset = -offset;  // bounded by 24h so no overflow
  197|  3.50k|    sign = '-';
  198|  3.50k|  }
  199|  17.4k|  const int seconds = offset % 60;
  200|  17.4k|  const int minutes = (offset /= 60) % 60;
  201|  17.4k|  const int hours = offset /= 60;
  202|  17.4k|  const char sep = mode[0];
  203|  17.4k|  const bool ext = (sep != '\0' && mode[1] == '*');
  ------------------
  |  Branch (203:21): [True: 12.6k, False: 4.85k]
  |  Branch (203:36): [True: 7.67k, False: 4.96k]
  ------------------
  204|  17.4k|  const bool ccc = (ext && mode[2] == ':');
  ------------------
  |  Branch (204:21): [True: 7.67k, False: 9.81k]
  |  Branch (204:28): [True: 1.33k, False: 6.34k]
  ------------------
  205|  17.4k|  if (ext && (!ccc || seconds != 0)) {
  ------------------
  |  Branch (205:7): [True: 7.67k, False: 9.81k]
  |  Branch (205:15): [True: 6.34k, False: 1.33k]
  |  Branch (205:23): [True: 307, False: 1.02k]
  ------------------
  206|  6.64k|    ep = Format02d(ep, seconds);
  207|  6.64k|    *--ep = sep;
  208|  10.8k|  } else {
  209|       |    // If we're not rendering seconds, sub-minute negative offsets
  210|       |    // should get a positive sign (e.g., offset=-10s => "+00:00").
  211|  10.8k|    if (hours == 0 && minutes == 0) sign = '+';
  ------------------
  |  Branch (211:9): [True: 4.85k, False: 5.98k]
  |  Branch (211:23): [True: 3.99k, False: 868]
  ------------------
  212|  10.8k|  }
  213|  17.4k|  if (!ccc || minutes != 0 || seconds != 0) {
  ------------------
  |  Branch (213:7): [True: 16.1k, False: 1.33k]
  |  Branch (213:15): [True: 303, False: 1.02k]
  |  Branch (213:31): [True: 202, False: 827]
  ------------------
  214|  16.6k|    ep = Format02d(ep, minutes);
  215|  16.6k|    if (sep != '\0') *--ep = sep;
  ------------------
  |  Branch (215:9): [True: 11.8k, False: 4.85k]
  ------------------
  216|  16.6k|  }
  217|  17.4k|  ep = Format02d(ep, hours);
  218|  17.4k|  *--ep = sign;
  219|  17.4k|  return ep;
  220|  17.4k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17isdigitEc:
   59|  35.3k|bool isdigit(char ch) {
   60|  35.3k|  return std::isdigit(static_cast<unsigned char>(ch)) != 0;
   61|  35.3k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17isspaceEc:
   63|  48.7k|bool isspace(char ch) {
   64|  48.7k|  return std::isspace(static_cast<unsigned char>(ch)) != 0;
   65|  48.7k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_111ParseOffsetEPKcS3_Pi:
  592|  6.13k|const char* ParseOffset(const char* dp, const char* mode, int* offset) {
  593|  6.13k|  if (dp != nullptr) {
  ------------------
  |  Branch (593:7): [True: 6.13k, False: 0]
  ------------------
  594|  6.13k|    const char first = *dp++;
  595|  6.13k|    if (first == '+' || first == '-') {
  ------------------
  |  Branch (595:9): [True: 1.08k, False: 5.05k]
  |  Branch (595:25): [True: 3.47k, False: 1.57k]
  ------------------
  596|  4.56k|      char sep = mode[0];
  597|  4.56k|      int hours = 0;
  598|  4.56k|      int minutes = 0;
  599|  4.56k|      int seconds = 0;
  600|  4.56k|      const char* ap = ParseInt(dp, 2, 0, 23, &hours);
  601|  4.56k|      if (ap != nullptr && ap - dp == 2) {
  ------------------
  |  Branch (601:11): [True: 4.52k, False: 33]
  |  Branch (601:28): [True: 4.51k, False: 10]
  ------------------
  602|  4.51k|        dp = ap;
  603|  4.51k|        if (sep != '\0' && *ap == sep) ++ap;
  ------------------
  |  Branch (603:13): [True: 2.09k, False: 2.42k]
  |  Branch (603:28): [True: 19, False: 2.07k]
  ------------------
  604|  4.51k|        const char* bp = ParseInt(ap, 2, 0, 59, &minutes);
  605|  4.51k|        if (bp != nullptr && bp - ap == 2) {
  ------------------
  |  Branch (605:13): [True: 2.74k, False: 1.77k]
  |  Branch (605:30): [True: 2.04k, False: 700]
  ------------------
  606|  2.04k|          dp = bp;
  607|  2.04k|          if (sep != '\0' && *bp == sep) ++bp;
  ------------------
  |  Branch (607:15): [True: 1.04k, False: 1.00k]
  |  Branch (607:30): [True: 10, False: 1.03k]
  ------------------
  608|  2.04k|          const char* cp = ParseInt(bp, 2, 0, 59, &seconds);
  609|  2.04k|          if (cp != nullptr && cp - bp == 2) dp = cp;
  ------------------
  |  Branch (609:15): [True: 816, False: 1.22k]
  |  Branch (609:32): [True: 495, False: 321]
  ------------------
  610|  2.04k|        }
  611|  4.51k|        *offset = ((hours * 60 + minutes) * 60) + seconds;
  612|  4.51k|        if (first == '-') *offset = -*offset;
  ------------------
  |  Branch (612:13): [True: 3.44k, False: 1.07k]
  ------------------
  613|  4.51k|      } else {
  614|     43|        dp = nullptr;
  615|     43|      }
  616|  4.56k|    } else if (first == 'Z' || first == 'z') {  // Zulu
  ------------------
  |  Branch (616:16): [True: 683, False: 890]
  |  Branch (616:32): [True: 835, False: 55]
  ------------------
  617|  1.51k|      *offset = 0;
  618|  1.51k|    } else {
  619|     55|      dp = nullptr;
  620|     55|    }
  621|  6.13k|  }
  622|  6.13k|  return dp;
  623|  6.13k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_19ParseZoneEPKcPNSt3__112basic_stringIcNS4_11char_traitsIcEENS4_9allocatorIcEEEE:
  625|    912|const char* ParseZone(const char* dp, std::string* zone) {
  626|    912|  zone->clear();
  627|    912|  if (dp != nullptr) {
  ------------------
  |  Branch (627:7): [True: 912, False: 0]
  ------------------
  628|  2.65k|    while (*dp != '\0' && !isspace(*dp)) zone->push_back(*dp++);
  ------------------
  |  Branch (628:12): [True: 2.35k, False: 302]
  |  Branch (628:27): [True: 1.74k, False: 610]
  ------------------
  629|    912|    if (zone->empty()) dp = nullptr;
  ------------------
  |  Branch (629:9): [True: 20, False: 892]
  ------------------
  630|    912|  }
  631|    912|  return dp;
  632|    912|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_115ParseSubSecondsEPKcPNSt3__16chrono8durationIlNS4_5ratioILl1ELl1000000000000000EEEEE:
  634|  1.32k|const char* ParseSubSeconds(const char* dp, detail::femtoseconds* subseconds) {
  635|  1.32k|  if (dp != nullptr) {
  ------------------
  |  Branch (635:7): [True: 1.32k, False: 0]
  ------------------
  636|  1.32k|    std::int_fast64_t v = 0;
  637|  1.32k|    std::int_fast64_t exp = 0;
  638|  1.32k|    const char* const bp = dp;
  639|  3.67k|    while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (639:24): [True: 2.39k, False: 1.27k]
  ------------------
  640|  2.39k|      int d = static_cast<int>(cp - kDigits);
  641|  2.39k|      if (d >= 10) break;
  ------------------
  |  Branch (641:11): [True: 48, False: 2.34k]
  ------------------
  642|  2.34k|      if (exp < 15) {
  ------------------
  |  Branch (642:11): [True: 2.01k, False: 324]
  ------------------
  643|  2.01k|        exp += 1;
  644|  2.01k|        v *= 10;
  645|  2.01k|        v += d;
  646|  2.01k|      }
  647|  2.34k|      ++dp;
  648|  2.34k|    }
  649|  1.32k|    if (dp != bp) {
  ------------------
  |  Branch (649:9): [True: 1.31k, False: 8]
  ------------------
  650|  1.31k|      v *= kExp10[15 - exp];
  651|  1.31k|      *subseconds = detail::femtoseconds(v);
  652|  1.31k|    } else {
  653|      8|      dp = nullptr;
  654|      8|    }
  655|  1.32k|  }
  656|  1.32k|  return dp;
  657|  1.32k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_17ParseTMEPKcS3_P2tm:
  660|  1.72k|const char* ParseTM(const char* dp, const char* fmt, std::tm* tm) {
  661|  1.72k|  if (dp != nullptr) {
  ------------------
  |  Branch (661:7): [True: 1.72k, False: 0]
  ------------------
  662|  1.72k|    dp = strptime(dp, fmt, tm);
  663|  1.72k|  }
  664|  1.72k|  return dp;
  665|  1.72k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18FromWeekEiNS0_7weekdayEPlP2tm:
  670|    292|bool FromWeek(int week_num, weekday week_start, year_t* year, std::tm* tm) {
  671|    292|  const civil_year y(*year % 400);
  672|    292|  civil_day cd = prev_weekday(y, week_start);  // week 0
  673|    292|  cd = next_weekday(cd - 1, FromTmWday(tm->tm_wday)) + (week_num * 7);
  674|    292|  if (const year_t shift = cd.year() - y.year()) {
  ------------------
  |  Branch (674:20): [True: 173, False: 119]
  ------------------
  675|    173|    if (shift > 0) {
  ------------------
  |  Branch (675:9): [True: 35, False: 138]
  ------------------
  676|     35|      if (*year > std::numeric_limits<year_t>::max() - shift) return false;
  ------------------
  |  Branch (676:11): [True: 1, False: 34]
  ------------------
  677|    138|    } else {
  678|    138|      if (*year < std::numeric_limits<year_t>::min() - shift) return false;
  ------------------
  |  Branch (678:11): [True: 1, False: 137]
  ------------------
  679|    138|    }
  680|    171|    *year += shift;
  681|    171|  }
  682|    290|  tm->tm_mon = cd.month() - 1;
  683|    290|  tm->tm_mday = cd.day();
  684|    290|  return true;
  685|    292|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_110FromTmWdayEi:
  100|    292|weekday FromTmWday(int tm_wday) {
  101|    292|  switch (tm_wday) {
  ------------------
  |  Branch (101:11): [True: 292, False: 0]
  ------------------
  102|     12|    case 0:
  ------------------
  |  Branch (102:5): [True: 12, False: 280]
  ------------------
  103|     12|      return weekday::sunday;
  104|      8|    case 1:
  ------------------
  |  Branch (104:5): [True: 8, False: 284]
  ------------------
  105|      8|      return weekday::monday;
  106|      3|    case 2:
  ------------------
  |  Branch (106:5): [True: 3, False: 289]
  ------------------
  107|      3|      return weekday::tuesday;
  108|      8|    case 3:
  ------------------
  |  Branch (108:5): [True: 8, False: 284]
  ------------------
  109|      8|      return weekday::wednesday;
  110|    254|    case 4:
  ------------------
  |  Branch (110:5): [True: 254, False: 38]
  ------------------
  111|    254|      return weekday::thursday;
  112|      4|    case 5:
  ------------------
  |  Branch (112:5): [True: 4, False: 288]
  ------------------
  113|      4|      return weekday::friday;
  114|      3|    case 6:
  ------------------
  |  Branch (114:5): [True: 3, False: 289]
  ------------------
  115|      3|      return weekday::saturday;
  116|    292|  }
  117|      0|  return weekday::sunday; /*NOTREACHED*/
  118|    292|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ParseIntIiEEPKcS4_iT_S5_PS5_:
  237|  40.9k|const char* ParseInt(const char* dp, int width, T min, T max, T* vp) {
  238|  40.9k|  if (dp != nullptr) {
  ------------------
  |  Branch (238:7): [True: 40.1k, False: 864]
  ------------------
  239|  40.1k|    const T kmin = std::numeric_limits<T>::min();
  240|  40.1k|    bool erange = false;
  241|  40.1k|    bool neg = false;
  242|  40.1k|    T value = 0;
  243|  40.1k|    if (*dp == '-') {
  ------------------
  |  Branch (243:9): [True: 2.23k, False: 37.8k]
  ------------------
  244|  2.23k|      neg = true;
  245|  2.23k|      if (width <= 0 || --width != 0) {
  ------------------
  |  Branch (245:11): [True: 214, False: 2.01k]
  |  Branch (245:25): [True: 2.01k, False: 0]
  ------------------
  246|  2.23k|        ++dp;
  247|  2.23k|      } else {
  248|      0|        dp = nullptr;  // width was 1
  249|      0|      }
  250|  2.23k|    }
  251|  40.1k|    if (const char* const bp = dp) {
  ------------------
  |  Branch (251:27): [True: 40.1k, False: 0]
  ------------------
  252|   175k|      while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (252:26): [True: 155k, False: 19.4k]
  ------------------
  253|   155k|        int d = static_cast<int>(cp - kDigits);
  254|   155k|        if (d >= 10) break;
  ------------------
  |  Branch (254:13): [True: 1.79k, False: 153k]
  ------------------
  255|   153k|        if (value < kmin / 10) {
  ------------------
  |  Branch (255:13): [True: 5.47k, False: 148k]
  ------------------
  256|  5.47k|          erange = true;
  257|  5.47k|          break;
  258|  5.47k|        }
  259|   148k|        value *= 10;
  260|   148k|        if (value < kmin + d) {
  ------------------
  |  Branch (260:13): [True: 578, False: 147k]
  ------------------
  261|    578|          erange = true;
  262|    578|          break;
  263|    578|        }
  264|   147k|        value -= d;
  265|   147k|        dp += 1;
  266|   147k|        if (width > 0 && --width == 0) break;
  ------------------
  |  Branch (266:13): [True: 26.1k, False: 121k]
  |  Branch (266:26): [True: 12.8k, False: 13.3k]
  ------------------
  267|   147k|      }
  268|  40.1k|      if (dp != bp && !erange && (neg || value != kmin)) {
  ------------------
  |  Branch (268:11): [True: 39.0k, False: 1.09k]
  |  Branch (268:23): [True: 32.9k, False: 6.05k]
  |  Branch (268:35): [True: 2.20k, False: 30.7k]
  |  Branch (268:42): [True: 30.5k, False: 218]
  ------------------
  269|  32.7k|        if (!neg || value != 0) {
  ------------------
  |  Branch (269:13): [True: 30.5k, False: 2.20k]
  |  Branch (269:21): [True: 1.11k, False: 1.08k]
  ------------------
  270|  31.6k|          if (!neg) value = -value;  // make positive
  ------------------
  |  Branch (270:15): [True: 30.5k, False: 1.11k]
  ------------------
  271|  31.6k|          if (min <= value && value <= max) {
  ------------------
  |  Branch (271:15): [True: 30.5k, False: 1.12k]
  |  Branch (271:31): [True: 27.0k, False: 3.49k]
  ------------------
  272|  27.0k|            *vp = value;
  273|  27.0k|          } else {
  274|  4.61k|            dp = nullptr;
  275|  4.61k|          }
  276|  31.6k|        } else {
  277|  1.08k|          dp = nullptr;
  278|  1.08k|        }
  279|  32.7k|      } else {
  280|  7.36k|        dp = nullptr;
  281|  7.36k|      }
  282|  40.1k|    }
  283|  40.1k|  }
  284|  40.9k|  return dp;
  285|  40.9k|}
time_zone_format.cc:_ZN4cctz6detail12_GLOBAL__N_18ParseIntIlEEPKcS4_iT_S5_PS5_:
  237|  3.71k|const char* ParseInt(const char* dp, int width, T min, T max, T* vp) {
  238|  3.71k|  if (dp != nullptr) {
  ------------------
  |  Branch (238:7): [True: 3.71k, False: 0]
  ------------------
  239|  3.71k|    const T kmin = std::numeric_limits<T>::min();
  240|  3.71k|    bool erange = false;
  241|  3.71k|    bool neg = false;
  242|  3.71k|    T value = 0;
  243|  3.71k|    if (*dp == '-') {
  ------------------
  |  Branch (243:9): [True: 1.73k, False: 1.97k]
  ------------------
  244|  1.73k|      neg = true;
  245|  1.73k|      if (width <= 0 || --width != 0) {
  ------------------
  |  Branch (245:11): [True: 1.68k, False: 59]
  |  Branch (245:25): [True: 59, False: 0]
  ------------------
  246|  1.73k|        ++dp;
  247|  1.73k|      } else {
  248|      0|        dp = nullptr;  // width was 1
  249|      0|      }
  250|  1.73k|    }
  251|  3.71k|    if (const char* const bp = dp) {
  ------------------
  |  Branch (251:27): [True: 3.71k, False: 0]
  ------------------
  252|  34.6k|      while (const char* cp = strchr(kDigits, *dp)) {
  ------------------
  |  Branch (252:26): [True: 33.7k, False: 938]
  ------------------
  253|  33.7k|        int d = static_cast<int>(cp - kDigits);
  254|  33.7k|        if (d >= 10) break;
  ------------------
  |  Branch (254:13): [True: 2.38k, False: 31.3k]
  ------------------
  255|  31.3k|        if (value < kmin / 10) {
  ------------------
  |  Branch (255:13): [True: 155, False: 31.1k]
  ------------------
  256|    155|          erange = true;
  257|    155|          break;
  258|    155|        }
  259|  31.1k|        value *= 10;
  260|  31.1k|        if (value < kmin + d) {
  ------------------
  |  Branch (260:13): [True: 3, False: 31.1k]
  ------------------
  261|      3|          erange = true;
  262|      3|          break;
  263|      3|        }
  264|  31.1k|        value -= d;
  265|  31.1k|        dp += 1;
  266|  31.1k|        if (width > 0 && --width == 0) break;
  ------------------
  |  Branch (266:13): [True: 975, False: 30.2k]
  |  Branch (266:26): [True: 233, False: 742]
  ------------------
  267|  31.1k|      }
  268|  3.71k|      if (dp != bp && !erange && (neg || value != kmin)) {
  ------------------
  |  Branch (268:11): [True: 3.62k, False: 88]
  |  Branch (268:23): [True: 3.46k, False: 158]
  |  Branch (268:35): [True: 1.72k, False: 1.74k]
  |  Branch (268:42): [True: 1.74k, False: 3]
  ------------------
  269|  3.46k|        if (!neg || value != 0) {
  ------------------
  |  Branch (269:13): [True: 1.74k, False: 1.72k]
  |  Branch (269:21): [True: 1.71k, False: 5]
  ------------------
  270|  3.45k|          if (!neg) value = -value;  // make positive
  ------------------
  |  Branch (270:15): [True: 1.74k, False: 1.71k]
  ------------------
  271|  3.45k|          if (min <= value && value <= max) {
  ------------------
  |  Branch (271:15): [True: 3.45k, False: 0]
  |  Branch (271:31): [True: 3.45k, False: 0]
  ------------------
  272|  3.45k|            *vp = value;
  273|  3.45k|          } else {
  274|      0|            dp = nullptr;
  275|      0|          }
  276|  3.45k|        } else {
  277|      5|          dp = nullptr;
  278|      5|        }
  279|  3.46k|      } else {
  280|    249|        dp = nullptr;
  281|    249|      }
  282|  3.71k|    }
  283|  3.71k|  }
  284|  3.71k|  return dp;
  285|  3.71k|}

_ZN4cctz10TimeZoneIf3UTCEv:
   21|      1|std::unique_ptr<TimeZoneIf> TimeZoneIf::UTC() {
   22|      1|  return TimeZoneInfo::UTC();
   23|      1|}
_ZN4cctz10TimeZoneIf4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   25|  1.42k|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.42k|  if (name.compare(0, 5, "libc:") == 0) {
  ------------------
  |  Branch (30:7): [True: 215, False: 1.21k]
  ------------------
   31|    215|    return TimeZoneLibC::Make(name.substr(5));
   32|    215|  }
   33|       |
   34|       |  // Otherwise use the "zoneinfo" implementation.
   35|  1.21k|  return TimeZoneInfo::Make(name);
   36|  1.42k|}
_ZN4cctz10TimeZoneIfD2Ev:
   39|    644|TimeZoneIf::~TimeZoneIf() {}

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

_ZN4cctz9time_zone4Impl3UTCEv:
   45|    190|time_zone time_zone::Impl::UTC() {
   46|    190|  return time_zone(UTCImpl());
   47|    190|}
_ZN4cctz9time_zone4Impl12LoadTimeZoneERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEEPS0_:
   49|  9.51k|bool time_zone::Impl::LoadTimeZone(const std::string& name, time_zone* tz) {
   50|  9.51k|  const Impl* const utc_impl = UTCImpl();
   51|       |
   52|       |  // Check for UTC (which is never a key in time_zone_map).
   53|  9.51k|  auto offset = seconds::zero();
   54|  9.51k|  if (FixedOffsetFromName(name, &offset) && offset == seconds::zero()) {
  ------------------
  |  Branch (54:7): [True: 1.98k, False: 7.53k]
  |  Branch (54:7): [True: 1.57k, False: 7.93k]
  |  Branch (54:45): [True: 1.57k, False: 403]
  ------------------
   55|  1.57k|    *tz = time_zone(utc_impl);
   56|  1.57k|    return true;
   57|  1.57k|  }
   58|       |
   59|       |  // Check whether the time zone has already been loaded.
   60|  7.93k|  {
   61|  7.93k|    std::lock_guard<std::mutex> lock(TimeZoneMutex());
   62|  7.93k|    if (time_zone_map != nullptr) {
  ------------------
  |  Branch (62:9): [True: 7.93k, False: 1]
  ------------------
   63|  7.93k|      TimeZoneImplByName::const_iterator itr = time_zone_map->find(name);
   64|  7.93k|      if (itr != time_zone_map->end()) {
  ------------------
  |  Branch (64:11): [True: 6.51k, False: 1.42k]
  ------------------
   65|  6.51k|        *tz = time_zone(itr->second);
   66|  6.51k|        return itr->second != utc_impl;
   67|  6.51k|      }
   68|  7.93k|    }
   69|  7.93k|  }
   70|       |
   71|       |  // Load the new time zone (outside the lock).
   72|  1.42k|  std::unique_ptr<const Impl> new_impl(new Impl(name));
   73|       |
   74|       |  // Add the new time zone to the map.
   75|  1.42k|  std::lock_guard<std::mutex> lock(TimeZoneMutex());
   76|  1.42k|  if (time_zone_map == nullptr) time_zone_map = new TimeZoneImplByName;
  ------------------
  |  Branch (76:7): [True: 1, False: 1.42k]
  ------------------
   77|  1.42k|  if (!new_impl->zone_) {
  ------------------
  |  Branch (77:7): [True: 644, False: 781]
  ------------------
   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|    644|    auto itr = time_zone_map->find(name);
   82|    644|    const Impl* impl = (itr != time_zone_map->end()) ? itr->second : utc_impl;
  ------------------
  |  Branch (82:24): [True: 0, False: 644]
  ------------------
   83|    644|    *tz = time_zone(impl);
   84|    644|    return impl != utc_impl;
   85|    644|  }
   86|    781|  const Impl*& impl = (*time_zone_map)[name];
   87|    781|  if (impl == nullptr) {  // this thread won any load race
  ------------------
  |  Branch (87:7): [True: 781, False: 0]
  ------------------
   88|    781|    impl = new_impl.release();
   89|    781|  }
   90|    781|  *tz = time_zone(impl);
   91|    781|  return impl != utc_impl;
   92|  1.42k|}
_ZN4cctz9time_zone4ImplC2Ev:
  109|      1|time_zone::Impl::Impl() : name_("UTC"), zone_(TimeZoneIf::UTC()) {}
_ZN4cctz9time_zone4ImplC2ERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  112|  1.42k|    : name_(name), zone_(TimeZoneIf::Make(name_)) {}
_ZN4cctz9time_zone4Impl7UTCImplEv:
  114|  9.70k|const time_zone::Impl* time_zone::Impl::UTCImpl() {
  115|  9.70k|  static const Impl* utc_impl = new Impl;
  116|  9.70k|  return utc_impl;
  117|  9.70k|}
time_zone_impl.cc:_ZN4cctz12_GLOBAL__N_113TimeZoneMutexEv:
   36|  9.36k|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.36k|  static std::mutex* time_zone_mutex = new std::mutex;
   40|  9.36k|  return *time_zone_mutex;
   41|  9.36k|}

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

_ZN4cctz12TimeZoneInfo17GetTransitionTypeElbRKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEPh:
  273|    372|                                     std::uint_least8_t* index) {
  274|    372|  std::size_t type_index = 0;
  275|    372|  std::size_t abbr_index = abbreviations_.size();
  276|    530|  for (; type_index != transition_types_.size(); ++type_index) {
  ------------------
  |  Branch (276:10): [True: 530, False: 0]
  ------------------
  277|    530|    const TransitionType& tt(transition_types_[type_index]);
  278|    530|    const char* tt_abbr = &abbreviations_[tt.abbr_index];
  279|    530|    if (tt_abbr == abbr) abbr_index = tt.abbr_index;
  ------------------
  |  Branch (279:9): [True: 372, False: 158]
  ------------------
  280|    530|    if (tt.utc_offset == utc_offset && tt.is_dst == is_dst) {
  ------------------
  |  Branch (280:9): [True: 378, False: 152]
  |  Branch (280:40): [True: 376, False: 2]
  ------------------
  281|    376|      if (abbr_index == tt.abbr_index) break;  // reuse
  ------------------
  |  Branch (281:11): [True: 372, False: 4]
  ------------------
  282|    376|    }
  283|    530|  }
  284|    372|  if (type_index > 255 || abbr_index > 255) {
  ------------------
  |  Branch (284:7): [True: 0, False: 372]
  |  Branch (284:27): [True: 0, False: 372]
  ------------------
  285|       |    // No index space (8 bits) available for a new type or abbreviation.
  286|      0|    return false;
  287|      0|  }
  288|    372|  if (type_index == transition_types_.size()) {
  ------------------
  |  Branch (288:7): [True: 0, False: 372]
  ------------------
  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|    372|  *index = static_cast<std::uint_least8_t>(type_index);
  299|    372|  return true;
  300|    372|}
_ZNK4cctz12TimeZoneInfo16EquivTransitionsEhh:
  306|    104|                                    std::uint_fast8_t tt2_index) const {
  307|    104|  if (tt1_index == tt2_index) return true;
  ------------------
  |  Branch (307:7): [True: 104, 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|    238|bool TimeZoneInfo::ExtendTransitions() {
  319|    238|  extended_ = false;
  320|    238|  if (future_spec_.empty()) return true;  // last transition prevails
  ------------------
  |  Branch (320:7): [True: 0, False: 238]
  ------------------
  321|       |
  322|    238|  PosixTimeZone posix;
  323|    238|  if (!ParsePosixSpec(future_spec_, &posix)) return false;
  ------------------
  |  Branch (323:7): [True: 0, False: 238]
  ------------------
  324|       |
  325|       |  // Find transition type for the future std specification.
  326|    238|  std::uint_least8_t std_ti;
  327|    238|  if (!GetTransitionType(posix.std_offset, false, posix.std_abbr, &std_ti))
  ------------------
  |  Branch (327:7): [True: 0, False: 238]
  ------------------
  328|      0|    return false;
  329|       |
  330|    238|  if (posix.dst_abbr.empty()) {  // std only
  ------------------
  |  Branch (330:7): [True: 104, False: 134]
  ------------------
  331|       |    // The future specification should match the last transition, and
  332|       |    // that means that handling the future will fall out naturally.
  333|    104|    return EquivTransitions(transitions_.back().type_index, std_ti);
  334|    104|  }
  335|       |
  336|       |  // Find transition type for the future dst specification.
  337|    134|  std::uint_least8_t dst_ti;
  338|    134|  if (!GetTransitionType(posix.dst_offset, true, posix.dst_abbr, &dst_ti))
  ------------------
  |  Branch (338:7): [True: 0, False: 134]
  ------------------
  339|      0|    return false;
  340|       |
  341|    134|  if (AllYearDST(posix)) {  // dst only
  ------------------
  |  Branch (341:7): [True: 0, False: 134]
  ------------------
  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|    134|  if (transitions_.back().unix_time < 0) return false;
  ------------------
  |  Branch (353:7): [True: 0, False: 134]
  ------------------
  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|    134|  transitions_.reserve(transitions_.size() + 2 + 401 * 2);
  362|    134|  extended_ = true;
  363|       |
  364|    134|  const Transition& last(transitions_.back());
  365|    134|  const std::int_fast64_t last_time = last.unix_time;
  366|    134|  const TransitionType& last_tt(transition_types_[last.type_index]);
  367|    134|  last_year_ = LocalTime(last_time, last_tt).cs.year();
  368|    134|  bool leap_year = IsLeap(last_year_);
  369|    134|  const civil_second jan1(last_year_);
  370|    134|  std::int_fast64_t jan1_time = jan1 - civil_second();
  371|    134|  int jan1_weekday = ToPosixWeekday(get_weekday(jan1));
  372|       |
  373|    134|  Transition dst = {0, dst_ti, civil_second(), civil_second()};
  374|    134|  Transition std = {0, std_ti, civil_second(), civil_second()};
  375|  53.8k|  for (const year_t limit = last_year_ + 401;; ++last_year_) {
  376|  53.8k|    auto dst_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_start);
  377|  53.8k|    auto std_trans_off = TransOffset(leap_year, jan1_weekday, posix.dst_end);
  378|  53.8k|    dst.unix_time = jan1_time + dst_trans_off - posix.std_offset;
  379|  53.8k|    std.unix_time = jan1_time + std_trans_off - posix.dst_offset;
  380|  53.8k|    const auto* ta = dst.unix_time < std.unix_time ? &dst : &std;
  ------------------
  |  Branch (380:22): [True: 53.8k, False: 0]
  ------------------
  381|  53.8k|    const auto* tb = dst.unix_time < std.unix_time ? &std : &dst;
  ------------------
  |  Branch (381:22): [True: 53.8k, False: 0]
  ------------------
  382|  53.8k|    if (last_time < tb->unix_time) {
  ------------------
  |  Branch (382:9): [True: 53.7k, False: 134]
  ------------------
  383|  53.7k|      if (last_time < ta->unix_time) transitions_.push_back(*ta);
  ------------------
  |  Branch (383:11): [True: 53.7k, False: 0]
  ------------------
  384|  53.7k|      transitions_.push_back(*tb);
  385|  53.7k|    }
  386|  53.8k|    if (last_year_ == limit) break;
  ------------------
  |  Branch (386:9): [True: 134, False: 53.7k]
  ------------------
  387|  53.7k|    jan1_time += kSecsPerYear[leap_year];
  388|  53.7k|    jan1_weekday = (jan1_weekday + kDaysPerYear[leap_year]) % 7;
  389|  53.7k|    leap_year = !leap_year && IsLeap(last_year_ + 1);
  ------------------
  |  Branch (389:17): [True: 40.7k, False: 12.9k]
  |  Branch (389:31): [True: 12.9k, False: 27.7k]
  ------------------
  390|  53.7k|  }
  391|       |
  392|    134|  return true;
  393|    134|}
_ZN4cctz12TimeZoneInfo17ResetToBuiltinUTCERKNSt3__16chrono8durationIlNS1_5ratioILl1ELl1EEEEE:
  670|    329|bool TimeZoneInfo::ResetToBuiltinUTC(const seconds& offset) {
  671|    329|  transition_types_.resize(1);
  672|    329|  TransitionType& tt(transition_types_.back());
  673|    329|  tt.utc_offset = static_cast<std::int_least32_t>(offset.count());
  674|    329|  tt.is_dst = false;
  675|    329|  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|    329|  transitions_.clear();
  681|    329|  transitions_.reserve(12);
  682|    329|  for (const std::int_fast64_t unix_time : {
  ------------------
  |  Branch (682:42): [True: 3.94k, False: 329]
  ------------------
  683|    329|           -(1LL << 59),  // a "first half" transition
  684|    329|           1420070400LL,  // 2015-01-01T00:00:00+00:00
  685|    329|           1451606400LL,  // 2016-01-01T00:00:00+00:00
  686|    329|           1483228800LL,  // 2017-01-01T00:00:00+00:00
  687|    329|           1514764800LL,  // 2018-01-01T00:00:00+00:00
  688|    329|           1546300800LL,  // 2019-01-01T00:00:00+00:00
  689|    329|           1577836800LL,  // 2020-01-01T00:00:00+00:00
  690|    329|           1609459200LL,  // 2021-01-01T00:00:00+00:00
  691|    329|           1640995200LL,  // 2022-01-01T00:00:00+00:00
  692|    329|           1672531200LL,  // 2023-01-01T00:00:00+00:00
  693|    329|           1704067200LL,  // 2024-01-01T00:00:00+00:00
  694|    329|           1735689600LL,  // 2025-01-01T00:00:00+00:00
  695|  3.94k|       }) {
  696|  3.94k|    Transition& tr(*transitions_.emplace(transitions_.end()));
  697|  3.94k|    tr.unix_time = unix_time;
  698|  3.94k|    tr.type_index = 0;
  699|  3.94k|    tr.civil_sec = LocalTime(tr.unix_time, tt).cs;
  700|  3.94k|    tr.prev_civil_sec = tr.civil_sec - 1;
  701|  3.94k|  }
  702|       |
  703|    329|  default_transition_type_ = 0;
  704|    329|  abbreviations_ = FixedOffsetToAbbr(offset);
  705|    329|  abbreviations_.append(1, '\0');
  706|    329|  future_spec_.clear();  // never needed for a fixed-offset zone
  707|    329|  extended_ = false;
  708|       |
  709|    329|  tt.civil_max = LocalTime(seconds::max().count(), tt).cs;
  710|    329|  tt.civil_min = LocalTime(seconds::min().count(), tt).cs;
  711|       |
  712|    329|  transitions_.shrink_to_fit();
  713|    329|  return true;
  714|    329|}
_ZN4cctz12TimeZoneInfo4LoadEPNS_14ZoneInfoSourceE:
  716|    239|bool TimeZoneInfo::Load(ZoneInfoSource* zip) {
  717|       |  // Read and validate the header.
  718|    239|  tzhead tzh;
  719|    239|  if (zip->Read(&tzh, sizeof(tzh)) != sizeof(tzh))
  ------------------
  |  Branch (719:7): [True: 0, False: 239]
  ------------------
  720|      0|    return false;
  721|    239|  if (strncmp(tzh.tzh_magic, TZ_MAGIC, sizeof(tzh.tzh_magic)) != 0)
  ------------------
  |  |   27|    239|#define TZ_MAGIC "TZif"
  ------------------
  |  Branch (721:7): [True: 1, False: 238]
  ------------------
  722|      1|    return false;
  723|    238|  Header hdr;
  724|    238|  if (!hdr.Build(tzh))
  ------------------
  |  Branch (724:7): [True: 0, False: 238]
  ------------------
  725|      0|    return false;
  726|    238|  std::size_t time_len = 4;
  727|    238|  if (tzh.tzh_version[0] != '\0') {
  ------------------
  |  Branch (727:7): [True: 238, False: 0]
  ------------------
  728|       |    // Skip the 4-byte data.
  729|    238|    if (zip->Skip(hdr.DataLength(time_len)) != 0)
  ------------------
  |  Branch (729:9): [True: 0, False: 238]
  ------------------
  730|      0|      return false;
  731|       |    // Read and validate the header for the 8-byte data.
  732|    238|    if (zip->Read(&tzh, sizeof(tzh)) != sizeof(tzh))
  ------------------
  |  Branch (732:9): [True: 0, False: 238]
  ------------------
  733|      0|      return false;
  734|    238|    if (strncmp(tzh.tzh_magic, TZ_MAGIC, sizeof(tzh.tzh_magic)) != 0)
  ------------------
  |  |   27|    238|#define TZ_MAGIC "TZif"
  ------------------
  |  Branch (734:9): [True: 0, False: 238]
  ------------------
  735|      0|      return false;
  736|    238|    if (tzh.tzh_version[0] == '\0')
  ------------------
  |  Branch (736:9): [True: 0, False: 238]
  ------------------
  737|      0|      return false;
  738|    238|    if (!hdr.Build(tzh))
  ------------------
  |  Branch (738:9): [True: 0, False: 238]
  ------------------
  739|      0|      return false;
  740|    238|    time_len = 8;
  741|    238|  }
  742|    238|  if (hdr.typecnt == 0)
  ------------------
  |  Branch (742:7): [True: 0, False: 238]
  ------------------
  743|      0|    return false;
  744|    238|  if (hdr.leapcnt != 0) {
  ------------------
  |  Branch (744:7): [True: 0, False: 238]
  ------------------
  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|    238|  if (hdr.ttisstdcnt != 0 && hdr.ttisstdcnt != hdr.typecnt)
  ------------------
  |  Branch (751:7): [True: 136, False: 102]
  |  Branch (751:30): [True: 0, False: 136]
  ------------------
  752|      0|    return false;
  753|    238|  if (hdr.ttisutcnt != 0 && hdr.ttisutcnt != hdr.typecnt)
  ------------------
  |  Branch (753:7): [True: 94, False: 144]
  |  Branch (753:29): [True: 0, False: 94]
  ------------------
  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|    238|  if (hdr.timecnt > TZ_MAX_TIMES)
  ------------------
  |  |   94|    238|# define TZ_MAX_TIMES 2000
  ------------------
  |  Branch (758:7): [True: 0, False: 238]
  ------------------
  759|      0|    return false;
  760|    238|  if (hdr.typecnt > TZ_MAX_TYPES)
  ------------------
  |  |   99|    238|# define TZ_MAX_TYPES 256 /* Limited to 256 by Internet RFC 9636.  */
  ------------------
  |  Branch (760:7): [True: 0, False: 238]
  ------------------
  761|      0|    return false;
  762|    238|  if (hdr.charcnt > TZ_MAX_CHARS)
  ------------------
  |  |  104|    238|# define TZ_MAX_CHARS 256	/* Maximum number of abbreviation characters */
  ------------------
  |  Branch (762:7): [True: 0, False: 238]
  ------------------
  763|      0|    return false;
  764|       |
  765|       |  // Read the data into a local buffer.
  766|    238|  std::size_t len = hdr.DataLength(time_len);
  767|    238|  std::vector<char> tbuf(len);
  768|    238|  if (zip->Read(tbuf.data(), len) != len)
  ------------------
  |  Branch (768:7): [True: 0, False: 238]
  ------------------
  769|      0|    return false;
  770|    238|  const char* bp = tbuf.data();
  771|       |
  772|       |  // Decode and validate the transitions.
  773|    238|  transitions_.reserve(hdr.timecnt + 2);
  774|    238|  transitions_.resize(hdr.timecnt);
  775|  17.3k|  for (std::size_t i = 0; i != hdr.timecnt; ++i) {
  ------------------
  |  Branch (775:27): [True: 17.1k, False: 238]
  ------------------
  776|  17.1k|    transitions_[i].unix_time = (time_len == 4) ? Decode32(bp) : Decode64(bp);
  ------------------
  |  Branch (776:33): [True: 0, False: 17.1k]
  ------------------
  777|  17.1k|    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|  17.1k|    if (transitions_[i].unix_time < -(1LL << 59) ||
  ------------------
  |  Branch (783:9): [True: 0, False: 17.1k]
  ------------------
  784|  17.1k|        transitions_[i].unix_time > (1LL << 59))
  ------------------
  |  Branch (784:9): [True: 0, False: 17.1k]
  ------------------
  785|      0|      return false;  // out of range
  786|  17.1k|  }
  787|    238|  bool seen_type_0 = false;
  788|  17.3k|  for (std::size_t i = 0; i != hdr.timecnt; ++i) {
  ------------------
  |  Branch (788:27): [True: 17.1k, False: 238]
  ------------------
  789|  17.1k|    transitions_[i].type_index = Decode8(bp++);
  790|  17.1k|    if (transitions_[i].type_index >= hdr.typecnt)
  ------------------
  |  Branch (790:9): [True: 0, False: 17.1k]
  ------------------
  791|      0|      return false;
  792|  17.1k|    if (transitions_[i].type_index == 0)
  ------------------
  |  Branch (792:9): [True: 5.81k, False: 11.3k]
  ------------------
  793|  5.81k|      seen_type_0 = true;
  794|  17.1k|  }
  795|       |
  796|       |  // Decode and validate the transition types.
  797|    238|  transition_types_.reserve(hdr.typecnt + 2);
  798|    238|  transition_types_.resize(hdr.typecnt);
  799|    905|  for (std::size_t i = 0; i != hdr.typecnt; ++i) {
  ------------------
  |  Branch (799:27): [True: 667, False: 238]
  ------------------
  800|    667|    transition_types_[i].utc_offset =
  801|    667|        static_cast<std::int_least32_t>(Decode32(bp));
  802|    667|    if (transition_types_[i].utc_offset >= kSecsPerDay ||
  ------------------
  |  Branch (802:9): [True: 0, False: 667]
  ------------------
  803|    667|        transition_types_[i].utc_offset <= -kSecsPerDay)
  ------------------
  |  Branch (803:9): [True: 0, False: 667]
  ------------------
  804|      0|      return false;
  805|    667|    bp += 4;
  806|    667|    transition_types_[i].is_dst = (Decode8(bp++) != 0);
  807|    667|    transition_types_[i].abbr_index = Decode8(bp++);
  808|    667|    if (transition_types_[i].abbr_index >= hdr.charcnt)
  ------------------
  |  Branch (808:9): [True: 0, False: 667]
  ------------------
  809|      0|      return false;
  810|    667|  }
  811|       |
  812|       |  // Determine the before-first-transition type.
  813|    238|  default_transition_type_ = 0;
  814|    238|  if (seen_type_0 && hdr.timecnt != 0) {
  ------------------
  |  Branch (814:7): [True: 134, False: 104]
  |  Branch (814:22): [True: 134, False: 0]
  ------------------
  815|    134|    std::size_t index = 0;
  816|    134|    if (transition_types_[0].is_dst) {
  ------------------
  |  Branch (816:9): [True: 0, False: 134]
  ------------------
  817|      0|      index = transitions_[0].type_index;
  818|      0|      while (index != 0 && transition_types_[index].is_dst)
  ------------------
  |  Branch (818:14): [True: 0, False: 0]
  |  Branch (818:28): [True: 0, False: 0]
  ------------------
  819|      0|        --index;
  820|      0|    }
  821|    134|    while (index != hdr.typecnt && transition_types_[index].is_dst)
  ------------------
  |  Branch (821:12): [True: 134, False: 0]
  |  Branch (821:36): [True: 0, False: 134]
  ------------------
  822|      0|      ++index;
  823|    134|    if (index != hdr.typecnt)
  ------------------
  |  Branch (823:9): [True: 134, False: 0]
  ------------------
  824|    134|      default_transition_type_ = static_cast<std::uint_fast8_t>(index);
  825|    134|  }
  826|       |
  827|       |  // Copy all the abbreviations. The area holds NUL-terminated strings, and
  828|       |  // LocalTime() hands out a pointer into it, so the final abbreviation has
  829|       |  // to be terminated within the area itself. Otherwise an abbreviation runs
  830|       |  // on into whatever ExtendTransitions() later appends. (hdr.charcnt != 0
  831|       |  // because every abbr_index was validated to be less than it.)
  832|    238|  if (bp[hdr.charcnt - 1] != '\0')
  ------------------
  |  Branch (832:7): [True: 0, False: 238]
  ------------------
  833|      0|    return false;
  834|    238|  abbreviations_.reserve(hdr.charcnt + 10);
  835|    238|  abbreviations_.assign(bp, hdr.charcnt);
  836|    238|  bp += hdr.charcnt;
  837|       |
  838|       |  // Skip the unused portions. We've already dispensed with leap-second
  839|       |  // encoded zoneinfo. The ttisstd/ttisgmt indicators only apply when
  840|       |  // interpreting a POSIX spec that does not include start/end rules, and
  841|       |  // that isn't the case here (see "zic -p").
  842|    238|  bp += (time_len + 4) * hdr.leapcnt;  // leap-time + TAI-UTC
  843|    238|  bp += 1 * hdr.ttisstdcnt;            // UTC/local indicators
  844|    238|  bp += 1 * hdr.ttisutcnt;             // standard/wall indicators
  845|    238|  assert(bp == tbuf.data() + tbuf.size());
  ------------------
  |  Branch (845:3): [True: 238, False: 0]
  ------------------
  846|       |
  847|    238|  future_spec_.clear();
  848|    238|  if (tzh.tzh_version[0] != '\0') {
  ------------------
  |  Branch (848:7): [True: 238, False: 0]
  ------------------
  849|       |    // Snarf up the NL-enclosed future POSIX spec. Note
  850|       |    // that version '3' files utilize an extended format.
  851|    238|    auto get_char = [](ZoneInfoSource* azip) -> int {
  852|    238|      unsigned char ch;  // all non-EOF results are positive
  853|    238|      return (azip->Read(&ch, 1) == 1) ? ch : EOF;
  854|    238|    };
  855|    238|    if (get_char(zip) != '\n')
  ------------------
  |  Branch (855:9): [True: 0, False: 238]
  ------------------
  856|      0|      return false;
  857|  4.12k|    for (int c = get_char(zip); c != '\n'; c = get_char(zip)) {
  ------------------
  |  Branch (857:33): [True: 3.88k, False: 238]
  ------------------
  858|  3.88k|      if (c == EOF)
  ------------------
  |  Branch (858:11): [True: 0, False: 3.88k]
  ------------------
  859|      0|        return false;
  860|  3.88k|      future_spec_.push_back(static_cast<char>(c));
  861|  3.88k|    }
  862|    238|  }
  863|       |
  864|       |  // We don't check for EOF so that we're forwards compatible.
  865|       |
  866|       |  // If we did not find version information during the standard loading
  867|       |  // process (as of tzh_version '3' that is unsupported), then ask the
  868|       |  // ZoneInfoSource for any out-of-bound version string it may be privy to.
  869|    238|  if (version_.empty()) {
  ------------------
  |  Branch (869:7): [True: 238, False: 0]
  ------------------
  870|    238|    version_ = zip->Version();
  871|    238|  }
  872|       |
  873|       |  // Ensure that there is always a transition in the first half of the
  874|       |  // time line (the second half is handled below) so that the signed
  875|       |  // difference between a civil_second and the civil_second of its
  876|       |  // previous transition is always representable, without overflow.
  877|    238|  if (transitions_.empty() || transitions_.front().unix_time >= 0) {
  ------------------
  |  Branch (877:7): [True: 102, False: 136]
  |  Branch (877:31): [True: 91, False: 45]
  ------------------
  878|    193|    Transition& tr(*transitions_.emplace(transitions_.begin()));
  879|    193|    tr.unix_time = -(1LL << 59);  // -18267312070-10-26T17:01:52+00:00
  880|    193|    tr.type_index = default_transition_type_;
  881|    193|  }
  882|       |
  883|       |  // Extend the transitions using the future specification.
  884|    238|  if (!ExtendTransitions()) return false;
  ------------------
  |  Branch (884:7): [True: 0, False: 238]
  ------------------
  885|       |
  886|       |  // Ensure that there is always a transition in the second half of the
  887|       |  // time line (the first half is handled above) so that the signed
  888|       |  // difference between a civil_second and the civil_second of its
  889|       |  // previous transition is always representable, without overflow.
  890|    238|  const Transition& last(transitions_.back());
  891|    238|  if (last.unix_time < 0) {
  ------------------
  |  Branch (891:7): [True: 102, False: 136]
  ------------------
  892|    102|    assert(!extended_);
  ------------------
  |  Branch (892:5): [True: 102, False: 0]
  ------------------
  893|    102|    const std::uint_fast8_t type_index = last.type_index;
  894|    102|    Transition& tr(*transitions_.emplace(transitions_.end()));
  895|    102|    tr.unix_time = 2147483647;  // 2038-01-19T03:14:07+00:00
  896|    102|    tr.type_index = type_index;
  897|    102|  }
  898|       |
  899|       |  // Compute the local civil time for each transition and the preceding
  900|       |  // second. These will be used for reverse conversions in MakeTime().
  901|    238|  const TransitionType* ttp = &transition_types_[default_transition_type_];
  902|   125k|  for (std::size_t i = 0; i != transitions_.size(); ++i) {
  ------------------
  |  Branch (902:27): [True: 124k, False: 238]
  ------------------
  903|   124k|    Transition& tr(transitions_[i]);
  904|   124k|    tr.prev_civil_sec = LocalTime(tr.unix_time, *ttp).cs - 1;
  905|   124k|    ttp = &transition_types_[tr.type_index];
  906|   124k|    tr.civil_sec = LocalTime(tr.unix_time, *ttp).cs;
  907|   124k|    if (i != 0) {
  ------------------
  |  Branch (907:9): [True: 124k, False: 238]
  ------------------
  908|       |      // Check that offset changes don't cross each other. No one
  909|       |      // does this in practice, and we depend on increasing absolute
  910|       |      // and civil times in BreakTime() and MakeTime() respectively.
  911|   124k|      if (!Transition::ByUnixTime()(transitions_[i - 1], tr) ||
  ------------------
  |  Branch (911:11): [True: 0, False: 124k]
  |  Branch (911:11): [True: 0, False: 124k]
  ------------------
  912|   124k|          !Transition::ByCivilTime()(transitions_[i - 1], tr)) {
  ------------------
  |  Branch (912:11): [True: 0, False: 124k]
  ------------------
  913|      0|        return false;  // out of order
  914|      0|      }
  915|   124k|    }
  916|   124k|  }
  917|       |
  918|       |  // Compute the maximum/minimum civil times that can be converted to a
  919|       |  // time_point<seconds> for each of the zone's transition types.
  920|    667|  for (auto& tt : transition_types_) {
  ------------------
  |  Branch (920:17): [True: 667, False: 238]
  ------------------
  921|    667|    tt.civil_max = LocalTime(seconds::max().count(), tt).cs;
  922|    667|    tt.civil_min = LocalTime(seconds::min().count(), tt).cs;
  923|    667|  }
  924|       |
  925|    238|  transitions_.shrink_to_fit();
  926|    238|  return true;
  927|    238|}
_ZN4cctz12TimeZoneInfo4LoadERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  929|  1.21k|bool TimeZoneInfo::Load(const std::string& name) {
  930|       |  // We can ensure that the loading of UTC or any other fixed-offset
  931|       |  // zone never fails because the simple, fixed-offset state can be
  932|       |  // internally generated. Note that this depends on our choice to not
  933|       |  // accept leap-second encoded ("right") zoneinfo.
  934|  1.21k|  auto offset = seconds::zero();
  935|  1.21k|  if (FixedOffsetFromName(name, &offset)) {
  ------------------
  |  Branch (935:7): [True: 328, False: 882]
  ------------------
  936|    328|    return ResetToBuiltinUTC(offset);
  937|    328|  }
  938|       |
  939|       |  // Find and use a ZoneInfoSource to load the named zone.
  940|    882|  auto zip = cctz_extension::zone_info_source_factory(
  941|    882|      name, [](const std::string& n) -> std::unique_ptr<ZoneInfoSource> {
  942|    882|        if (auto z = FileZoneInfoSource::Open(n)) return z;
  943|    882|        if (auto z = AndroidZoneInfoSource::Open(n)) return z;
  944|    882|        if (auto z = FuchsiaZoneInfoSource::Open(n)) return z;
  945|    882|        return nullptr;
  946|    882|      });
  947|    882|  return zip != nullptr && Load(zip.get());
  ------------------
  |  Branch (947:10): [True: 239, False: 643]
  |  Branch (947:28): [True: 238, False: 1]
  ------------------
  948|  1.21k|}
_ZN4cctz12TimeZoneInfo3UTCEv:
  950|      1|std::unique_ptr<TimeZoneInfo> TimeZoneInfo::UTC() {
  951|      1|  auto tz = std::unique_ptr<TimeZoneInfo>(new TimeZoneInfo);
  952|      1|  tz->ResetToBuiltinUTC(seconds::zero());
  953|      1|  return tz;
  954|      1|}
_ZN4cctz12TimeZoneInfo4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  956|  1.21k|std::unique_ptr<TimeZoneInfo> TimeZoneInfo::Make(const std::string& name) {
  957|  1.21k|  auto tz = std::unique_ptr<TimeZoneInfo>(new TimeZoneInfo);
  958|  1.21k|  if (!tz->Load(name)) tz.reset();  // fallback to UTC
  ------------------
  |  Branch (958:7): [True: 644, False: 566]
  ------------------
  959|  1.21k|  return tz;
  960|  1.21k|}
_ZNK4cctz12TimeZoneInfo9LocalTimeElRKNS_14TransitionTypeE:
  964|   257k|    std::int_fast64_t unix_time, const TransitionType& tt) const {
  965|       |  // A civil time in "+offset" looks like (time+offset) in UTC.
  966|       |  // Note: We perform two additions in the civil_second domain to
  967|       |  // sidestep the chance of overflow in (unix_time + tt.utc_offset).
  968|   257k|  return {(civil_second() + unix_time) + tt.utc_offset,
  969|   257k|          tt.utc_offset, tt.is_dst, &abbreviations_[tt.abbr_index]};
  970|   257k|}
_ZNK4cctz12TimeZoneInfo9LocalTimeElRKNS_10TransitionE:
  974|  6.95k|    std::int_fast64_t unix_time, const Transition& tr) const {
  975|  6.95k|  const TransitionType& tt = transition_types_[tr.type_index];
  976|       |  // Note: (unix_time - tr.unix_time) will never overflow as we
  977|       |  // have ensured that there is always a "nearby" transition.
  978|  6.95k|  return {tr.civil_sec + (unix_time - tr.unix_time),  // TODO: Optimize.
  979|  6.95k|          tt.utc_offset, tt.is_dst, &abbreviations_[tt.abbr_index]};
  980|  6.95k|}
_ZNK4cctz12TimeZoneInfo9TimeLocalERKNS_6detail10civil_timeINS1_10second_tagEEEl:
  984|  1.62k|                                                year_t c4_shift) const {
  985|  1.62k|  assert(last_year_ - 400 < cs.year() && cs.year() <= last_year_);
  ------------------
  |  Branch (985:3): [True: 1.62k, False: 0]
  |  Branch (985:3): [True: 1.62k, False: 0]
  |  Branch (985:3): [True: 1.62k, False: 0]
  ------------------
  986|  1.62k|  time_zone::civil_lookup cl = MakeTime(cs);
  987|  1.62k|  if (c4_shift > seconds::max().count() / kSecsPer400Years) {
  ------------------
  |  Branch (987:7): [True: 169, False: 1.45k]
  ------------------
  988|    169|    cl.pre = cl.trans = cl.post = time_point<seconds>::max();
  989|  1.45k|  } else {
  990|  1.45k|    const auto offset = seconds(c4_shift * kSecsPer400Years);
  991|  1.45k|    const auto limit = time_point<seconds>::max() - offset;
  992|  4.36k|    for (auto* tp : {&cl.pre, &cl.trans, &cl.post}) {
  ------------------
  |  Branch (992:19): [True: 4.36k, False: 1.45k]
  ------------------
  993|  4.36k|      if (*tp > limit) {
  ------------------
  |  Branch (993:11): [True: 30, False: 4.33k]
  ------------------
  994|     30|        *tp = time_point<seconds>::max();
  995|  4.33k|      } else {
  996|  4.33k|        *tp += offset;
  997|  4.33k|      }
  998|  4.36k|    }
  999|  1.45k|  }
 1000|  1.62k|  return cl;
 1001|  1.62k|}
_ZNK4cctz12TimeZoneInfo9BreakTimeERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
 1004|  9.61k|    const time_point<seconds>& tp) const {
 1005|  9.61k|  std::int_fast64_t unix_time = ToUnixSeconds(tp);
 1006|  9.61k|  const std::size_t timecnt = transitions_.size();
 1007|  9.61k|  assert(timecnt != 0);  // We always add a transition.
  ------------------
  |  Branch (1007:3): [True: 9.61k, False: 0]
  ------------------
 1008|       |
 1009|  9.61k|  if (unix_time < transitions_[0].unix_time) {
  ------------------
  |  Branch (1009:7): [True: 1.18k, False: 8.42k]
  ------------------
 1010|  1.18k|    return LocalTime(unix_time, transition_types_[default_transition_type_]);
 1011|  1.18k|  }
 1012|  8.42k|  if (unix_time >= transitions_[timecnt - 1].unix_time) {
  ------------------
  |  Branch (1012:7): [True: 2.76k, False: 5.65k]
  ------------------
 1013|       |    // After the last transition. If we extended the transitions using
 1014|       |    // future_spec_, shift back to a supported year using the 400-year
 1015|       |    // cycle of calendaric equivalence and then compensate accordingly.
 1016|  2.76k|    if (extended_) {
  ------------------
  |  Branch (1016:9): [True: 1.47k, False: 1.29k]
  ------------------
 1017|  1.47k|      const std::int_fast64_t diff =
 1018|  1.47k|          unix_time - transitions_[timecnt - 1].unix_time;
 1019|  1.47k|      const year_t shift = diff / kSecsPer400Years + 1;
 1020|  1.47k|      const auto d = seconds(shift * kSecsPer400Years);
 1021|  1.47k|      time_zone::absolute_lookup al = BreakTime(tp - d);
 1022|  1.47k|      al.cs = YearShift(al.cs, shift * 400);
 1023|  1.47k|      return al;
 1024|  1.47k|    }
 1025|  1.29k|    return LocalTime(unix_time, transitions_[timecnt - 1]);
 1026|  2.76k|  }
 1027|       |
 1028|  5.65k|  const std::size_t hint = local_time_hint_.load(std::memory_order_relaxed);
 1029|  5.65k|  if (0 < hint && hint < timecnt) {
  ------------------
  |  Branch (1029:7): [True: 5.34k, False: 312]
  |  Branch (1029:19): [True: 5.34k, False: 0]
  ------------------
 1030|  5.34k|    if (transitions_[hint - 1].unix_time <= unix_time) {
  ------------------
  |  Branch (1030:9): [True: 4.41k, False: 934]
  ------------------
 1031|  4.41k|      if (unix_time < transitions_[hint].unix_time) {
  ------------------
  |  Branch (1031:11): [True: 3.49k, False: 922]
  ------------------
 1032|  3.49k|        return LocalTime(unix_time, transitions_[hint - 1]);
 1033|  3.49k|      }
 1034|  4.41k|    }
 1035|  5.34k|  }
 1036|       |
 1037|  2.16k|  const Transition target = {unix_time, 0, civil_second(), civil_second()};
 1038|  2.16k|  const Transition* begin = &transitions_[0];
 1039|  2.16k|  const Transition* tr = std::upper_bound(begin, begin + timecnt, target,
 1040|  2.16k|                                          Transition::ByUnixTime());
 1041|  2.16k|  local_time_hint_.store(static_cast<std::size_t>(tr - begin),
 1042|  2.16k|                         std::memory_order_relaxed);
 1043|  2.16k|  return LocalTime(unix_time, *--tr);
 1044|  5.65k|}
_ZNK4cctz12TimeZoneInfo8MakeTimeERKNS_6detail10civil_timeINS1_10second_tagEEE:
 1046|  14.2k|time_zone::civil_lookup TimeZoneInfo::MakeTime(const civil_second& cs) const {
 1047|  14.2k|  const std::size_t timecnt = transitions_.size();
 1048|  14.2k|  assert(timecnt != 0);  // We always add a transition.
  ------------------
  |  Branch (1048:3): [True: 14.2k, False: 0]
  ------------------
 1049|       |
 1050|       |  // Find the first transition after our target civil time.
 1051|  14.2k|  const Transition* tr = nullptr;
 1052|  14.2k|  const Transition* begin = &transitions_[0];
 1053|  14.2k|  const Transition* end = begin + timecnt;
 1054|  14.2k|  if (cs < begin->civil_sec) {
  ------------------
  |  Branch (1054:7): [True: 1.44k, False: 12.7k]
  ------------------
 1055|  1.44k|    tr = begin;
 1056|  12.7k|  } else if (cs >= transitions_[timecnt - 1].civil_sec) {
  ------------------
  |  Branch (1056:14): [True: 3.05k, False: 9.74k]
  ------------------
 1057|  3.05k|    tr = end;
 1058|  9.74k|  } else {
 1059|  9.74k|    const std::size_t hint = time_local_hint_.load(std::memory_order_relaxed);
 1060|  9.74k|    if (0 < hint && hint < timecnt) {
  ------------------
  |  Branch (1060:9): [True: 9.19k, False: 548]
  |  Branch (1060:21): [True: 9.19k, False: 0]
  ------------------
 1061|  9.19k|      if (transitions_[hint - 1].civil_sec <= cs) {
  ------------------
  |  Branch (1061:11): [True: 7.53k, False: 1.65k]
  ------------------
 1062|  7.53k|        if (cs < transitions_[hint].civil_sec) {
  ------------------
  |  Branch (1062:13): [True: 5.87k, False: 1.65k]
  ------------------
 1063|  5.87k|          tr = begin + hint;
 1064|  5.87k|        }
 1065|  7.53k|      }
 1066|  9.19k|    }
 1067|  9.74k|    if (tr == nullptr) {
  ------------------
  |  Branch (1067:9): [True: 3.86k, False: 5.87k]
  ------------------
 1068|  3.86k|      const Transition target = {0, 0, cs, civil_second()};
 1069|  3.86k|      tr = std::upper_bound(begin, end, target, Transition::ByCivilTime());
 1070|  3.86k|      time_local_hint_.store(static_cast<std::size_t>(tr - begin),
 1071|  3.86k|                             std::memory_order_relaxed);
 1072|  3.86k|    }
 1073|  9.74k|  }
 1074|       |
 1075|  14.2k|  if (tr == begin) {
  ------------------
  |  Branch (1075:7): [True: 1.44k, False: 12.7k]
  ------------------
 1076|  1.44k|    if (tr->prev_civil_sec >= cs) {
  ------------------
  |  Branch (1076:9): [True: 1.44k, False: 1]
  ------------------
 1077|       |      // Before first transition, so use the default offset.
 1078|  1.44k|      const TransitionType& tt(transition_types_[default_transition_type_]);
 1079|  1.44k|      if (cs < tt.civil_min) return MakeUnique(time_point<seconds>::min());
  ------------------
  |  Branch (1079:11): [True: 158, False: 1.29k]
  ------------------
 1080|  1.29k|      return MakeUnique(cs - (civil_second() + tt.utc_offset));
 1081|  1.44k|    }
 1082|       |    // tr->prev_civil_sec < cs < tr->civil_sec
 1083|      1|    return MakeSkipped(*tr, cs);
 1084|  1.44k|  }
 1085|       |
 1086|  12.7k|  if (tr == end) {
  ------------------
  |  Branch (1086:7): [True: 3.05k, False: 9.74k]
  ------------------
 1087|  3.05k|    if (cs > (--tr)->prev_civil_sec) {
  ------------------
  |  Branch (1087:9): [True: 3.04k, False: 12]
  ------------------
 1088|       |      // After the last transition. If we extended the transitions using
 1089|       |      // future_spec_, shift back to a supported year using the 400-year
 1090|       |      // cycle of calendaric equivalence and then compensate accordingly.
 1091|  3.04k|      if (extended_ && cs.year() > last_year_) {
  ------------------
  |  Branch (1091:11): [True: 1.64k, False: 1.40k]
  |  Branch (1091:24): [True: 1.62k, False: 15]
  ------------------
 1092|  1.62k|        const year_t shift = (cs.year() - last_year_ - 1) / 400 + 1;
 1093|  1.62k|        return TimeLocal(YearShift(cs, shift * -400), shift);
 1094|  1.62k|      }
 1095|  1.41k|      const TransitionType& tt(transition_types_[tr->type_index]);
 1096|  1.41k|      if (cs > tt.civil_max) return MakeUnique(time_point<seconds>::max());
  ------------------
  |  Branch (1096:11): [True: 64, False: 1.35k]
  ------------------
 1097|  1.35k|      return MakeUnique(tr->unix_time + (cs - tr->civil_sec));
 1098|  1.41k|    }
 1099|       |    // tr->civil_sec <= cs <= tr->prev_civil_sec
 1100|     12|    return MakeRepeated(*tr, cs);
 1101|  3.05k|  }
 1102|       |
 1103|  9.74k|  if (tr->prev_civil_sec < cs) {
  ------------------
  |  Branch (1103:7): [True: 9, False: 9.73k]
  ------------------
 1104|       |    // tr->prev_civil_sec < cs < tr->civil_sec
 1105|      9|    return MakeSkipped(*tr, cs);
 1106|      9|  }
 1107|       |
 1108|  9.73k|  if (cs <= (--tr)->prev_civil_sec) {
  ------------------
  |  Branch (1108:7): [True: 19, False: 9.71k]
  ------------------
 1109|       |    // tr->civil_sec <= cs <= tr->prev_civil_sec
 1110|     19|    return MakeRepeated(*tr, cs);
 1111|     19|  }
 1112|       |
 1113|       |  // In between transitions.
 1114|  9.71k|  return MakeUnique(tr->unix_time + (cs - tr->civil_sec));
 1115|  9.73k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110AllYearDSTERKNS_13PosixTimeZoneE:
  189|    134|bool AllYearDST(const PosixTimeZone& posix) {
  190|    134|  if (posix.dst_start.date.fmt != PosixTransition::N) return false;
  ------------------
  |  Branch (190:7): [True: 134, 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|  40.8k|inline bool IsLeap(year_t year) {
   69|  40.8k|  return (year % 4) == 0 && ((year % 100) != 0 || (year % 400) == 0);
  ------------------
  |  Branch (69:10): [True: 13.4k, False: 27.4k]
  |  Branch (69:30): [True: 12.8k, False: 536]
  |  Branch (69:51): [True: 134, False: 402]
  ------------------
   70|  40.8k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_114ToPosixWeekdayENS_6detail7weekdayE:
   95|    134|inline int ToPosixWeekday(weekday wd) {
   96|    134|  switch (wd) {
  ------------------
  |  Branch (96:11): [True: 134, False: 0]
  ------------------
   97|      0|    case weekday::sunday:
  ------------------
  |  Branch (97:5): [True: 0, False: 134]
  ------------------
   98|      0|      return 0;
   99|      0|    case weekday::monday:
  ------------------
  |  Branch (99:5): [True: 0, False: 134]
  ------------------
  100|      0|      return 1;
  101|      0|    case weekday::tuesday:
  ------------------
  |  Branch (101:5): [True: 0, False: 134]
  ------------------
  102|      0|      return 2;
  103|      0|    case weekday::wednesday:
  ------------------
  |  Branch (103:5): [True: 0, False: 134]
  ------------------
  104|      0|      return 3;
  105|    134|    case weekday::thursday:
  ------------------
  |  Branch (105:5): [True: 134, False: 0]
  ------------------
  106|    134|      return 4;
  107|      0|    case weekday::friday:
  ------------------
  |  Branch (107:5): [True: 0, False: 134]
  ------------------
  108|      0|      return 5;
  109|      0|    case weekday::saturday:
  ------------------
  |  Branch (109:5): [True: 0, False: 134]
  ------------------
  110|      0|      return 6;
  111|    134|  }
  112|      0|  return 0; /*NOTREACHED*/
  113|    134|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_111TransOffsetEbiRKNS_15PosixTransitionE:
  204|   107k|                              const PosixTransition& pt) {
  205|   107k|  std::int_fast64_t days = 0;
  206|   107k|  switch (pt.date.fmt) {
  ------------------
  |  Branch (206:11): [True: 107k, False: 0]
  ------------------
  207|      0|    case PosixTransition::J: {
  ------------------
  |  Branch (207:5): [True: 0, False: 107k]
  ------------------
  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: 107k]
  ------------------
  213|      0|      days = pt.date.n.day;
  214|      0|      break;
  215|      0|    }
  216|   107k|    case PosixTransition::M: {
  ------------------
  |  Branch (216:5): [True: 107k, False: 0]
  ------------------
  217|   107k|      const bool last_week = (pt.date.m.week == 5);
  218|   107k|      days = kMonthOffsets[leap_year][pt.date.m.month + last_week];
  219|   107k|      const std::int_fast64_t weekday = (jan1_weekday + days) % 7;
  220|   107k|      if (last_week) {
  ------------------
  |  Branch (220:11): [True: 105k, False: 2.41k]
  ------------------
  221|   105k|        days -= (weekday + 7 - 1 - pt.date.m.weekday) % 7 + 1;
  222|   105k|      } else {
  223|  2.41k|        days += (pt.date.m.weekday + 7 - weekday) % 7;
  224|  2.41k|        days += (pt.date.m.week - 1) * 7;
  225|  2.41k|      }
  226|   107k|      break;
  227|      0|    }
  228|   107k|  }
  229|   107k|  return (days * kSecsPerDay) + pt.time.offset;
  230|   107k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_16Header5BuildERK6tzhead:
  157|    476|bool Header::Build(const tzhead& tzh) {
  158|    476|  std::int_fast32_t v;
  159|    476|  if ((v = Decode32(tzh.tzh_timecnt)) < 0) return false;
  ------------------
  |  Branch (159:7): [True: 0, False: 476]
  ------------------
  160|    476|  timecnt = static_cast<std::size_t>(v);
  161|    476|  if ((v = Decode32(tzh.tzh_typecnt)) < 0) return false;
  ------------------
  |  Branch (161:7): [True: 0, False: 476]
  ------------------
  162|    476|  typecnt = static_cast<std::size_t>(v);
  163|    476|  if ((v = Decode32(tzh.tzh_charcnt)) < 0) return false;
  ------------------
  |  Branch (163:7): [True: 0, False: 476]
  ------------------
  164|    476|  charcnt = static_cast<std::size_t>(v);
  165|    476|  if ((v = Decode32(tzh.tzh_leapcnt)) < 0) return false;
  ------------------
  |  Branch (165:7): [True: 0, False: 476]
  ------------------
  166|    476|  leapcnt = static_cast<std::size_t>(v);
  167|    476|  if ((v = Decode32(tzh.tzh_ttisstdcnt)) < 0) return false;
  ------------------
  |  Branch (167:7): [True: 0, False: 476]
  ------------------
  168|    476|  ttisstdcnt = static_cast<std::size_t>(v);
  169|    476|  if ((v = Decode32(tzh.tzh_ttisutcnt)) < 0) return false;
  ------------------
  |  Branch (169:7): [True: 0, False: 476]
  ------------------
  170|    476|  ttisutcnt = static_cast<std::size_t>(v);
  171|    476|  return true;
  172|    476|}
time_zone_info.cc:_ZNK4cctz12_GLOBAL__N_16Header10DataLengthEm:
  176|    476|std::size_t Header::DataLength(std::size_t time_len) const {
  177|    476|  std::size_t len = 0;
  178|    476|  len += (time_len + 1) * timecnt;  // unix_time + type_index
  179|    476|  len += (4 + 1 + 1) * typecnt;     // utc_offset + is_dst + abbr_index
  180|    476|  len += 1 * charcnt;               // abbreviations
  181|    476|  len += (time_len + 4) * leapcnt;  // leap-time + TAI-UTC
  182|    476|  len += 1 * ttisstdcnt;            // UTC/local indicators
  183|    476|  len += 1 * ttisutcnt;             // standard/wall indicators
  184|    476|  return len;
  185|    476|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_18Decode32EPKc:
  126|  3.52k|std::int_fast32_t Decode32(const char* cp) {
  127|  3.52k|  std::uint_fast32_t v = 0;
  128|  17.6k|  for (int i = 0; i != (32 / 8); ++i) v = (v << 8) | Decode8(cp++);
  ------------------
  |  Branch (128:19): [True: 14.0k, False: 3.52k]
  ------------------
  129|  3.52k|  const std::int_fast32_t s32max = 0x7fffffff;
  130|  3.52k|  const auto s32maxU = static_cast<std::uint_fast32_t>(s32max);
  131|  3.52k|  if (v <= s32maxU) return static_cast<std::int_fast32_t>(v);
  ------------------
  |  Branch (131:7): [True: 3.46k, False: 61]
  ------------------
  132|     61|  return static_cast<std::int_fast32_t>(v - s32maxU - 1) - s32max - 1;
  133|  3.52k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_18Decode64EPKc:
  135|  17.1k|std::int_fast64_t Decode64(const char* cp) {
  136|  17.1k|  std::uint_fast64_t v = 0;
  137|   154k|  for (int i = 0; i != (64 / 8); ++i) v = (v << 8) | Decode8(cp++);
  ------------------
  |  Branch (137:19): [True: 137k, False: 17.1k]
  ------------------
  138|  17.1k|  const std::int_fast64_t s64max = 0x7fffffffffffffff;
  139|  17.1k|  const auto s64maxU = static_cast<std::uint_fast64_t>(s64max);
  140|  17.1k|  if (v <= s64maxU) return static_cast<std::int_fast64_t>(v);
  ------------------
  |  Branch (140:7): [True: 16.5k, False: 617]
  ------------------
  141|    617|  return static_cast<std::int_fast64_t>(v - s64maxU - 1) - s64max - 1;
  142|  17.1k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_17Decode8EPKc:
  116|   169k|inline std::uint_fast8_t Decode8(const char* cp) {
  117|   169k|  return static_cast<std::uint_fast8_t>(*cp) & 0xff;
  118|   169k|}
time_zone_info.cc:_ZZN4cctz12TimeZoneInfo4LoadEPNS_14ZoneInfoSourceEENK3$_0clES2_:
  851|  4.36k|    auto get_char = [](ZoneInfoSource* azip) -> int {
  852|  4.36k|      unsigned char ch;  // all non-EOF results are positive
  853|  4.36k|      return (azip->Read(&ch, 1) == 1) ? ch : EOF;
  ------------------
  |  Branch (853:14): [True: 4.36k, False: 0]
  ------------------
  854|  4.36k|    };
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_19YearShiftERKNS_6detail10civil_timeINS1_10second_tagEEEl:
  263|  3.09k|inline civil_second YearShift(const civil_second& cs, year_t shift) {
  264|  3.09k|  return civil_second(cs.year() + shift, cs.month(), cs.day(),
  265|  3.09k|                      cs.hour(), cs.minute(), cs.second());
  266|  3.09k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110MakeUniqueERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  232|  12.5k|inline time_zone::civil_lookup MakeUnique(const time_point<seconds>& tp) {
  233|  12.5k|  time_zone::civil_lookup cl;
  234|  12.5k|  cl.kind = time_zone::civil_lookup::UNIQUE;
  235|  12.5k|  cl.pre = cl.trans = cl.post = tp;
  236|  12.5k|  return cl;
  237|  12.5k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110MakeUniqueEl:
  239|  12.3k|inline time_zone::civil_lookup MakeUnique(std::int_fast64_t unix_time) {
  240|  12.3k|  return MakeUnique(FromUnixSeconds(unix_time));
  241|  12.3k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_111MakeSkippedERKNS_10TransitionERKNS_6detail10civil_timeINS4_10second_tagEEE:
  244|     10|                                           const civil_second& cs) {
  245|     10|  time_zone::civil_lookup cl;
  246|     10|  cl.kind = time_zone::civil_lookup::SKIPPED;
  247|     10|  cl.pre = FromUnixSeconds(tr.unix_time - 1 + (cs - tr.prev_civil_sec));
  248|     10|  cl.trans = FromUnixSeconds(tr.unix_time);
  249|     10|  cl.post = FromUnixSeconds(tr.unix_time - (tr.civil_sec - cs));
  250|     10|  return cl;
  251|     10|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_112MakeRepeatedERKNS_10TransitionERKNS_6detail10civil_timeINS4_10second_tagEEE:
  254|     31|                                            const civil_second& cs) {
  255|     31|  time_zone::civil_lookup cl;
  256|     31|  cl.kind = time_zone::civil_lookup::REPEATED;
  257|     31|  cl.pre = FromUnixSeconds(tr.unix_time - 1 - (tr.prev_civil_sec - cs));
  258|     31|  cl.trans = FromUnixSeconds(tr.unix_time);
  259|     31|  cl.post = FromUnixSeconds(tr.unix_time + (cs - tr.civil_sec));
  260|     31|  return cl;
  261|     31|}
time_zone_info.cc:_ZZN4cctz12TimeZoneInfo4LoadERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEENK3$_0clES9_:
  941|    882|      name, [](const std::string& n) -> std::unique_ptr<ZoneInfoSource> {
  942|    882|        if (auto z = FileZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (942:18): [True: 239, False: 643]
  ------------------
  943|    643|        if (auto z = AndroidZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (943:18): [True: 0, False: 643]
  ------------------
  944|    643|        if (auto z = FuchsiaZoneInfoSource::Open(n)) return z;
  ------------------
  |  Branch (944:18): [True: 0, False: 643]
  ------------------
  945|    643|        return nullptr;
  946|    643|      });
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  500|    882|    const std::string& name) {
  501|       |  // Use of the "file:" prefix is intended for testing purposes only.
  502|    882|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (502:27): [True: 17, False: 865]
  ------------------
  503|       |
  504|       |  // Reject unsafe paths (e.g., "../../etc/passwd").
  505|    882|  if (UnsafePath(name, pos)) {
  ------------------
  |  Branch (505:7): [True: 17, False: 865]
  ------------------
  506|     17|    return nullptr;
  507|     17|  }
  508|       |
  509|       |  // Map the time-zone name to a path name.
  510|    865|  std::string path;
  511|    865|  if (pos == name.size() || name[pos] != '/') {
  ------------------
  |  Branch (511:7): [True: 12, False: 853]
  |  Branch (511:29): [True: 829, False: 24]
  ------------------
  512|    841|    const char* tzdir = "/usr/share/zoneinfo";
  513|    841|    char* tzdir_env = nullptr;
  514|       |#if defined(_MSC_VER)
  515|       |    _dupenv_s(&tzdir_env, nullptr, "TZDIR");
  516|       |#else
  517|    841|    tzdir_env = std::getenv("TZDIR");
  518|    841|#endif
  519|    841|    if (tzdir_env && *tzdir_env) tzdir = tzdir_env;
  ------------------
  |  Branch (519:9): [True: 0, False: 841]
  |  Branch (519:22): [True: 0, False: 0]
  ------------------
  520|    841|    path += tzdir;
  521|    841|    path += '/';
  522|       |#if defined(_MSC_VER)
  523|       |    free(tzdir_env);
  524|       |#endif
  525|    841|  }
  526|    865|  path.append(name, pos, std::string::npos);
  527|       |
  528|       |  // Open the zoneinfo file.
  529|    865|  auto fp = FOpen(path.c_str());
  530|    865|  if (fp == nullptr) return nullptr;
  ------------------
  |  Branch (530:7): [True: 626, False: 239]
  ------------------
  531|    239|  return std::unique_ptr<ZoneInfoSource>(new FileZoneInfoSource(std::move(fp)));
  532|    865|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_110UnsafePathERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEEm:
  455|  1.52k|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|  89.3k|  for (auto i = pos; (i = name.find("..", i)) != std::string::npos; i += 2) {
  ------------------
  |  Branch (458:22): [True: 87.8k, False: 1.49k]
  ------------------
  459|  87.8k|    if ((i == pos || IsPathSeparator(name[i - 1])) &&
  ------------------
  |  Branch (459:10): [True: 134, False: 87.7k]
  |  Branch (459:22): [True: 57.3k, False: 30.3k]
  ------------------
  460|  57.5k|        (i == name.size() - 2 || IsPathSeparator(name[i + 2]))) {
  ------------------
  |  Branch (460:10): [True: 26, False: 57.4k]
  |  Branch (460:34): [True: 8, False: 57.4k]
  ------------------
  461|     34|      return true;
  462|     34|    }
  463|  87.8k|  }
  464|  1.49k|  return false;
  465|  1.52k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_115IsPathSeparatorEc:
  446|   145k|inline bool IsPathSeparator(char c) {
  447|       |#if defined(_WIN32)
  448|       |  return c == '/' || c == '\\';
  449|       |#else
  450|   145k|  return c == '/';
  451|   145k|#endif
  452|   145k|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_15FOpenEPKc:
  400|  5.22k|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.22k|  const int fd = open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC);
  417|  5.22k|  if (fd >= 0) {
  ------------------
  |  Branch (417:7): [True: 289, False: 4.93k]
  ------------------
  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|    289|    auto is_regular = [](int stat_fd) {
  430|    289|      struct stat st;
  431|    289|      return fstat(stat_fd, &st) == 0 && S_ISREG(st.st_mode);
  432|    289|    };
  433|    289|#endif
  434|    289|    if (is_regular(fd)) {
  ------------------
  |  Branch (434:9): [True: 239, False: 50]
  ------------------
  435|    239|      FILE* fp = fdopen(fd, "rb");
  436|    239|      if (fp != nullptr) return FilePtr(fp, fclose);
  ------------------
  |  Branch (436:11): [True: 239, False: 0]
  ------------------
  437|    239|    }
  438|     50|    close(fd);
  439|     50|  }
  440|  4.98k|  return FilePtr(nullptr, fclose);
  441|  5.22k|#endif
  442|  5.22k|}
time_zone_info.cc:_ZZN4cctz12_GLOBAL__N_15FOpenEPKcENKUliE_clEi:
  429|    289|    auto is_regular = [](int stat_fd) {
  430|    289|      struct stat st;
  431|    289|      return fstat(stat_fd, &st) == 0 && S_ISREG(st.st_mode);
  ------------------
  |  Branch (431:14): [True: 289, False: 0]
  |  Branch (431:42): [True: 239, False: 50]
  ------------------
  432|    289|    };
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSourceC2ENSt3__110unique_ptrI8_IO_FILEPFiPS4_EEEm:
  492|    239|      : fp_(std::move(fp)), len_(len) {}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4ReadEPvm:
  472|  5.07k|  std::size_t Read(void* ptr, std::size_t size) override {
  473|  5.07k|    size = std::min(size, len_);
  474|  5.07k|    std::size_t nread = fread(ptr, 1, size, fp_.get());
  475|  5.07k|    len_ -= nread;
  476|  5.07k|    return nread;
  477|  5.07k|  }
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_118FileZoneInfoSource4SkipEm:
  478|    238|  int Skip(std::size_t offset) override {
  479|    238|    offset = std::min(offset, len_);
  480|    238|    int rc = fseek(fp_.get(), static_cast<long>(offset), SEEK_CUR);
  481|    238|    if (rc == 0) len_ -= offset;
  ------------------
  |  Branch (481:9): [True: 238, False: 0]
  ------------------
  482|    238|    return rc;
  483|    238|  }
time_zone_info.cc:_ZNK4cctz12_GLOBAL__N_118FileZoneInfoSource7VersionEv:
  484|    238|  std::string Version() const override {
  485|       |    // TODO: It would nice if the zoneinfo data included the tzdb version.
  486|    238|    return std::string();
  487|    238|  }
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_121AndroidZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  547|    643|    const std::string& name) {
  548|       |  // Use of the "file:" prefix is intended for testing purposes only.
  549|    643|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (549:27): [True: 17, False: 626]
  ------------------
  550|       |
  551|       |  // See Android's libc/tzcode/bionic.cpp for additional information.
  552|    643|  for (const char* tzdata : {"/apex/com.android.tzdata/etc/tz/tzdata",
  ------------------
  |  Branch (552:27): [True: 1.92k, False: 643]
  ------------------
  553|    643|                             "/data/misc/zoneinfo/current/tzdata",
  554|  1.92k|                             "/system/usr/share/zoneinfo/tzdata"}) {
  555|  1.92k|    auto fp = FOpen(tzdata);
  556|  1.92k|    if (fp == nullptr) continue;
  ------------------
  |  Branch (556:9): [True: 1.92k, 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|    643|  return nullptr;
  591|    643|}
time_zone_info.cc:_ZN4cctz12_GLOBAL__N_121FuchsiaZoneInfoSource4OpenERKNSt3__112basic_stringIcNS2_11char_traitsIcEENS2_9allocatorIcEEEE:
  613|    643|    const std::string& name) {
  614|       |  // Use of the "file:" prefix is intended for testing purposes only.
  615|    643|  const std::size_t pos = (name.compare(0, 5, "file:") == 0) ? 5 : 0;
  ------------------
  |  Branch (615:27): [True: 17, False: 626]
  ------------------
  616|       |
  617|       |  // Reject unsafe paths (e.g., "../../etc/passwd").
  618|    643|  if (UnsafePath(name, pos)) {
  ------------------
  |  Branch (618:7): [True: 17, False: 626]
  ------------------
  619|     17|    return nullptr;
  620|     17|  }
  621|       |
  622|       |  // Prefixes where a Fuchsia component might find zoneinfo files,
  623|       |  // in descending order of preference.
  624|    626|  const auto kTzdataPrefixes = {
  625|       |      // The tzdata from `config-data`.
  626|    626|      "/config/data/tzdata/",
  627|       |      // The tzdata bundled in the component's package.
  628|    626|      "/pkg/data/tzdata/",
  629|       |      // General data storage.
  630|    626|      "/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|    626|      "/config/tzdata/",
  635|    626|  };
  636|    626|  const auto kEmptyPrefix = {""};
  637|    626|  const bool name_absolute = (pos != name.size() && name[pos] == '/');
  ------------------
  |  Branch (637:31): [True: 614, False: 12]
  |  Branch (637:53): [True: 24, False: 590]
  ------------------
  638|    626|  const auto prefixes = name_absolute ? kEmptyPrefix : kTzdataPrefixes;
  ------------------
  |  Branch (638:25): [True: 24, False: 602]
  ------------------
  639|       |
  640|       |  // Fuchsia builds place zoneinfo files at "<prefix><format><name>".
  641|  2.43k|  for (const std::string prefix : prefixes) {
  ------------------
  |  Branch (641:33): [True: 2.43k, False: 626]
  ------------------
  642|  2.43k|    std::string path = prefix;
  643|  2.43k|    if (!prefix.empty()) path += "zoneinfo/tzif2/";  // format
  ------------------
  |  Branch (643:9): [True: 2.40k, False: 24]
  ------------------
  644|  2.43k|    path.append(name, pos, std::string::npos);
  645|       |
  646|  2.43k|    auto fp = FOpen(path.c_str());
  647|  2.43k|    if (fp == nullptr) continue;
  ------------------
  |  Branch (647:9): [True: 2.43k, 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.43k|  }
  663|       |
  664|    626|  return nullptr;
  665|    626|}

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

_ZN4cctz12TimeZoneLibC4MakeERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  194|    215|std::unique_ptr<TimeZoneLibC> TimeZoneLibC::Make(const std::string& name) {
  195|    215|  return std::unique_ptr<TimeZoneLibC>(new TimeZoneLibC(name));
  196|    215|}
_ZNK4cctz12TimeZoneLibC9BreakTimeERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
  199|  1.48k|    const time_point<seconds>& tp) const {
  200|  1.48k|  time_zone::absolute_lookup al;
  201|  1.48k|  al.offset = 0;
  202|  1.48k|  al.is_dst = false;
  203|  1.48k|  al.abbr = "-00";
  204|       |
  205|  1.48k|  const std::int_fast64_t s = ToUnixSeconds(tp);
  206|       |
  207|       |  // If std::time_t cannot hold the input we saturate the output.
  208|  1.48k|  if (s < std::numeric_limits<std::time_t>::min()) {
  ------------------
  |  Branch (208:7): [True: 0, False: 1.48k]
  ------------------
  209|      0|    al.cs = civil_second::min();
  210|      0|    return al;
  211|      0|  }
  212|  1.48k|  if (s > std::numeric_limits<std::time_t>::max()) {
  ------------------
  |  Branch (212:7): [True: 0, False: 1.48k]
  ------------------
  213|      0|    al.cs = civil_second::max();
  214|      0|    return al;
  215|      0|  }
  216|       |
  217|  1.48k|  const std::time_t t = static_cast<std::time_t>(s);
  218|  1.48k|  std::tm tm;
  219|  1.48k|  std::tm* tmp = local_ ? local_time(&t, &tm) : gm_time(&t, &tm);
  ------------------
  |  Branch (219:18): [True: 439, False: 1.04k]
  ------------------
  220|       |
  221|       |  // If std::tm cannot hold the result we saturate the output.
  222|  1.48k|  if (tmp == nullptr) {
  ------------------
  |  Branch (222:7): [True: 419, False: 1.06k]
  ------------------
  223|    419|    al.cs = (s < 0) ? civil_second::min() : civil_second::max();
  ------------------
  |  Branch (223:13): [True: 204, False: 215]
  ------------------
  224|    419|    return al;
  225|    419|  }
  226|       |
  227|  1.06k|  const year_t year = tmp->tm_year + year_t{1900};
  228|  1.06k|  al.cs = civil_second(year, tmp->tm_mon + 1, tmp->tm_mday,
  229|  1.06k|                       tmp->tm_hour, tmp->tm_min, tmp->tm_sec);
  230|  1.06k|  al.offset = static_cast<int>(tm_gmtoff(*tmp));
  231|  1.06k|  al.abbr = local_ ? tm_zone(*tmp) : "UTC";  // as expected by cctz
  ------------------
  |  Branch (231:13): [True: 308, False: 757]
  ------------------
  232|  1.06k|  al.is_dst = tmp->tm_isdst > 0;
  233|  1.06k|  return al;
  234|  1.48k|}
_ZNK4cctz12TimeZoneLibC8MakeTimeERKNS_6detail10civil_timeINS1_10second_tagEEE:
  236|  2.11k|time_zone::civil_lookup TimeZoneLibC::MakeTime(const civil_second& cs) const {
  237|  2.11k|  if (!local_) {
  ------------------
  |  Branch (237:7): [True: 1.48k, False: 625]
  ------------------
  238|       |    // If time_point<seconds> cannot hold the result we saturate.
  239|  1.48k|    static const civil_second min_tp_cs =
  240|  1.48k|        civil_second() + ToUnixSeconds(time_point<seconds>::min());
  241|  1.48k|    static const civil_second max_tp_cs =
  242|  1.48k|        civil_second() + ToUnixSeconds(time_point<seconds>::max());
  243|  1.48k|    const time_point<seconds> tp =
  244|  1.48k|        (cs < min_tp_cs)
  ------------------
  |  Branch (244:9): [True: 115, False: 1.37k]
  ------------------
  245|  1.48k|            ? time_point<seconds>::min()
  246|  1.48k|            : (cs > max_tp_cs) ? time_point<seconds>::max()
  ------------------
  |  Branch (246:15): [True: 113, False: 1.25k]
  ------------------
  247|  1.37k|                               : FromUnixSeconds(cs - civil_second());
  248|  1.48k|    return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  249|  1.48k|  }
  250|       |
  251|       |  // If tm_year cannot hold the requested year we saturate the result.
  252|    625|  if (cs.year() < 0) {
  ------------------
  |  Branch (252:7): [True: 386, False: 239]
  ------------------
  253|    386|    if (cs.year() < std::numeric_limits<int>::min() + year_t{1900}) {
  ------------------
  |  Branch (253:9): [True: 88, False: 298]
  ------------------
  254|     88|      const time_point<seconds> tp = time_point<seconds>::min();
  255|     88|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  256|     88|    }
  257|    386|  } else {
  258|    239|    if (cs.year() - year_t{1900} > std::numeric_limits<int>::max()) {
  ------------------
  |  Branch (258:9): [True: 42, False: 197]
  ------------------
  259|     42|      const time_point<seconds> tp = time_point<seconds>::max();
  260|     42|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  261|     42|    }
  262|    239|  }
  263|       |
  264|       |  // We probe with "is_dst" values of 0 and 1 to try to distinguish unique
  265|       |  // civil seconds from skipped or repeated ones.  This is not always possible
  266|       |  // however, as the "dst" flag does not change over some offset transitions.
  267|       |  // We are also subject to the vagaries of mktime() implementations. For
  268|       |  // example, some implementations treat "tm_isdst" as a demand (useless),
  269|       |  // and some as a disambiguator (useful).
  270|    495|  std::time_t t0, t1;
  271|    495|  std::tm tm0, tm1;
  272|    495|  if (make_time(cs, 0, &t0, &tm0) && make_time(cs, 1, &t1, &tm1)) {
  ------------------
  |  Branch (272:7): [True: 495, False: 0]
  |  Branch (272:38): [True: 494, False: 1]
  ------------------
  273|    494|    if (tm0.tm_isdst == tm1.tm_isdst) {
  ------------------
  |  Branch (273:9): [True: 494, False: 0]
  ------------------
  274|       |      // The civil time was singular (pre == trans == post).
  275|    494|      const time_point<seconds> tp = FromUnixSeconds(tm0.tm_isdst ? t1 : t0);
  ------------------
  |  Branch (275:54): [True: 0, False: 494]
  ------------------
  276|    494|      return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  277|    494|    }
  278|       |
  279|      0|    tm_gmtoff_t offset = tm_gmtoff(tm0);
  280|      0|    if (t0 < t1) {  // negative DST
  ------------------
  |  Branch (280:9): [True: 0, False: 0]
  ------------------
  281|      0|      std::swap(t0, t1);
  282|      0|      offset = tm_gmtoff(tm1);
  283|      0|    }
  284|       |
  285|      0|    const std::time_t tt = find_trans(t1, t0, offset);
  286|      0|    const time_point<seconds> trans = FromUnixSeconds(tt);
  287|       |
  288|      0|    if (tm0.tm_isdst) {
  ------------------
  |  Branch (288:9): [True: 0, False: 0]
  ------------------
  289|       |      // The civil time did not exist (pre >= trans > post).
  290|      0|      const time_point<seconds> pre = FromUnixSeconds(t0);
  291|      0|      const time_point<seconds> post = FromUnixSeconds(t1);
  292|      0|      return {time_zone::civil_lookup::SKIPPED, pre, trans, post};
  293|      0|    }
  294|       |
  295|       |    // The civil time was ambiguous (pre < trans <= post).
  296|      0|    const time_point<seconds> pre = FromUnixSeconds(t1);
  297|      0|    const time_point<seconds> post = FromUnixSeconds(t0);
  298|      0|    return {time_zone::civil_lookup::REPEATED, pre, trans, post};
  299|      0|  }
  300|       |
  301|       |  // make_time() failed somehow so we saturate the result.
  302|      1|  const time_point<seconds> tp = (cs < civil_second())
  ------------------
  |  Branch (302:34): [True: 1, False: 0]
  ------------------
  303|      1|                                     ? time_point<seconds>::min()
  304|      1|                                     : time_point<seconds>::max();
  305|      1|  return {time_zone::civil_lookup::UNIQUE, tp, tp, tp};
  306|    495|}
_ZN4cctz12TimeZoneLibCC2ERKNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
  327|    215|    : local_(name == "localtime") {}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_110local_timeEPKlP2tm:
  129|    442|inline std::tm* local_time(const std::time_t *timep, std::tm *result) {
  130|       |#if defined(_WIN32) || defined(_WIN64)
  131|       |    return localtime_s(result, timep) ? nullptr : result;
  132|       |#else
  133|    442|    return localtime_r(timep, result);
  134|    442|#endif
  135|    442|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_17gm_timeEPKlP2tm:
  121|  1.04k|inline std::tm* gm_time(const std::time_t *timep, std::tm *result) {
  122|       |#if defined(_WIN32) || defined(_WIN64)
  123|       |    return gmtime_s(result, timep) ? nullptr : result;
  124|       |#else
  125|  1.04k|    return gmtime_r(timep, result);
  126|  1.04k|#endif
  127|  1.04k|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_19make_timeERKNS_6detail10civil_timeINS1_10second_tagEEEiPlP2tm:
  141|    990|               std::tm* tm) {
  142|    990|  tm->tm_year = static_cast<int>(cs.year() - year_t{1900});
  143|    990|  tm->tm_mon = cs.month() - 1;
  144|    990|  tm->tm_mday = cs.day();
  145|    990|  tm->tm_hour = cs.hour();
  146|    990|  tm->tm_min = cs.minute();
  147|    990|  tm->tm_sec = cs.second();
  148|    990|  tm->tm_isdst = is_dst;
  149|    990|  *t = std::mktime(tm);
  150|    990|  if (*t == std::time_t{-1}) {
  ------------------
  |  Branch (150:7): [True: 3, False: 987]
  ------------------
  151|      3|    std::tm tm2;
  152|      3|    const std::tm* tmp = local_time(t, &tm2);
  153|      3|    if (tmp == nullptr || tmp->tm_year != tm->tm_year ||
  ------------------
  |  Branch (153:9): [True: 0, False: 3]
  |  Branch (153:27): [True: 1, False: 2]
  ------------------
  154|      2|        tmp->tm_mon != tm->tm_mon || tmp->tm_mday != tm->tm_mday ||
  ------------------
  |  Branch (154:9): [True: 0, False: 2]
  |  Branch (154:38): [True: 0, False: 2]
  ------------------
  155|      2|        tmp->tm_hour != tm->tm_hour || tmp->tm_min != tm->tm_min ||
  ------------------
  |  Branch (155:9): [True: 0, False: 2]
  |  Branch (155:40): [True: 0, False: 2]
  ------------------
  156|      2|        tmp->tm_sec != tm->tm_sec) {
  ------------------
  |  Branch (156:9): [True: 0, False: 2]
  ------------------
  157|       |      // A true error (not just one second before the epoch).
  158|      1|      return false;
  159|      1|    }
  160|      3|  }
  161|    989|  return true;
  162|    990|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_19tm_gmtoffI2tmEEDtdtfp_9tm_gmtoffERKT_:
   92|  1.06k|auto tm_gmtoff(const T& tm) -> decltype(tm.tm_gmtoff) {
   93|  1.06k|  return tm.tm_gmtoff;
   94|  1.06k|}
time_zone_libc.cc:_ZN4cctz12_GLOBAL__N_17tm_zoneI2tmEEDtdtfp_7tm_zoneERKT_:
  110|    308|auto tm_zone(const T& tm) -> decltype(tm.tm_zone) {
  111|    308|  return tm.tm_zone;
  112|    308|}

_ZNK4cctz9time_zone6lookupERKNSt3__16chrono10time_pointINS2_12system_clockENS2_8durationIlNS1_5ratioILl1ELl1EEEEEEE:
   53|  9.62k|    const time_point<seconds>& tp) const {
   54|  9.62k|  return effective_impl().BreakTime(tp);
   55|  9.62k|}
_ZNK4cctz9time_zone6lookupERKNS_6detail10civil_timeINS1_10second_tagEEE:
   57|  14.7k|time_zone::civil_lookup time_zone::lookup(const civil_second& cs) const {
   58|  14.7k|  return effective_impl().MakeTime(cs);
   59|  14.7k|}
_ZNK4cctz9time_zone14effective_implEv:
   79|  24.3k|const time_zone::Impl& time_zone::effective_impl() const {
   80|  24.3k|  if (impl_ == nullptr) {
  ------------------
  |  Branch (80:7): [True: 0, False: 24.3k]
  ------------------
   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|  24.3k|  return *impl_;
   86|  24.3k|}
_ZN4cctz14load_time_zoneERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_9time_zoneE:
   88|  9.51k|bool load_time_zone(const std::string& name, time_zone* tz) {
   89|  9.51k|  return time_zone::Impl::LoadTimeZone(name, tz);
   90|  9.51k|}
_ZN4cctz13utc_time_zoneEv:
   92|    190|time_zone utc_time_zone() {
   93|    190|  return time_zone::Impl::UTC();  // avoid name lookup
   94|    190|}

_ZN4cctz14ParsePosixSpecERKNSt3__112basic_stringIcNS0_11char_traitsIcEENS0_9allocatorIcEEEEPNS_13PosixTimeZoneE:
  135|    238|bool ParsePosixSpec(const std::string& spec, PosixTimeZone* res) {
  136|    238|  const char* p = spec.c_str();
  137|    238|  if (*p == ':') return false;
  ------------------
  |  Branch (137:7): [True: 0, False: 238]
  ------------------
  138|       |
  139|    238|  p = ParseAbbr(p, &res->std_abbr);
  140|    238|  p = ParseOffset(p, 0, 24, -1, &res->std_offset);
  141|    238|  if (p == nullptr) return false;
  ------------------
  |  Branch (141:7): [True: 0, False: 238]
  ------------------
  142|    238|  if (*p == '\0') return true;
  ------------------
  |  Branch (142:7): [True: 104, False: 134]
  ------------------
  143|       |
  144|    134|  p = ParseAbbr(p, &res->dst_abbr);
  145|    134|  if (p == nullptr) return false;
  ------------------
  |  Branch (145:7): [True: 0, False: 134]
  ------------------
  146|    134|  res->dst_offset = res->std_offset + (60 * 60);  // default
  147|    134|  if (*p != ',') p = ParseOffset(p, 0, 24, -1, &res->dst_offset);
  ------------------
  |  Branch (147:7): [True: 0, False: 134]
  ------------------
  148|       |
  149|    134|  p = ParseDateTime(p, &res->dst_start);
  150|    134|  p = ParseDateTime(p, &res->dst_end);
  151|       |
  152|    134|  return p != nullptr && *p == '\0';
  ------------------
  |  Branch (152:10): [True: 134, False: 0]
  |  Branch (152:26): [True: 134, False: 0]
  ------------------
  153|    134|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_19ParseAbbrEPKcPNSt3__112basic_stringIcNS3_11char_traitsIcEENS3_9allocatorIcEEEE:
   46|    372|const char* ParseAbbr(const char* p, std::string* abbr) {
   47|    372|  const char* op = p;
   48|    372|  if (*p == '<') {  // special zoneinfo <...> form
  ------------------
  |  Branch (48:7): [True: 2, False: 370]
  ------------------
   49|      2|    if (*++p == '>' || *p == '\0') return nullptr;  // no "<>"
  ------------------
  |  Branch (49:9): [True: 0, False: 2]
  |  Branch (49:24): [True: 0, False: 2]
  ------------------
   50|      6|    while (*++p != '>') {
  ------------------
  |  Branch (50:12): [True: 4, False: 2]
  ------------------
   51|      4|      if (*p == '\0') return nullptr;
  ------------------
  |  Branch (51:11): [True: 0, False: 4]
  ------------------
   52|      4|    }
   53|      2|    abbr->assign(op + 1, static_cast<std::size_t>(p - op) - 1);
   54|      2|    return ++p;
   55|      2|  }
   56|  1.61k|  while (*p != '\0') {
  ------------------
  |  Branch (56:10): [True: 1.61k, False: 0]
  ------------------
   57|  1.61k|    if (strchr("-+,", *p)) break;
  ------------------
  |  Branch (57:9): [True: 196, False: 1.41k]
  ------------------
   58|  1.41k|    if (strchr(kDigits, *p)) break;
  ------------------
  |  Branch (58:9): [True: 174, False: 1.24k]
  ------------------
   59|  1.24k|    ++p;
   60|  1.24k|  }
   61|    370|  if (p - op < 3) return nullptr;
  ------------------
  |  Branch (61:7): [True: 0, False: 370]
  ------------------
   62|    370|  abbr->assign(op, static_cast<std::size_t>(p - op));
   63|    370|  return p;
   64|    370|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_111ParseOffsetEPKciiiPl:
   68|    391|                        std::int_fast32_t* offset) {
   69|    391|  if (p == nullptr) return nullptr;
  ------------------
  |  Branch (69:7): [True: 0, False: 391]
  ------------------
   70|    391|  if (*p == '+' || *p == '-') {
  ------------------
  |  Branch (70:7): [True: 0, False: 391]
  |  Branch (70:20): [True: 64, False: 327]
  ------------------
   71|     64|    if (*p++ == '-') sign = -sign;
  ------------------
  |  Branch (71:9): [True: 64, False: 0]
  ------------------
   72|     64|  }
   73|    391|  int hours = 0;
   74|    391|  int minutes = 0;
   75|    391|  int seconds = 0;
   76|       |
   77|    391|  p = ParseInt(p, min_hour, max_hour, &hours);
   78|    391|  if (p == nullptr) return nullptr;
  ------------------
  |  Branch (78:7): [True: 0, False: 391]
  ------------------
   79|    391|  if (*p == ':') {
  ------------------
  |  Branch (79:7): [True: 0, False: 391]
  ------------------
   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|    391|  *offset = sign * ((((hours * 60) + minutes) * 60) + seconds);
   88|    391|  return p;
   89|    391|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_18ParseIntEPKciiPi:
   28|  1.19k|const char* ParseInt(const char* p, int min, int max, int* vp) {
   29|  1.19k|  int value = 0;
   30|  1.19k|  const char* op = p;
   31|  1.19k|  const int kMaxInt = std::numeric_limits<int>::max();
   32|  2.54k|  for (; const char* dp = strchr(kDigits, *p); ++p) {
  ------------------
  |  Branch (32:22): [True: 1.58k, False: 957]
  ------------------
   33|  1.58k|    int d = static_cast<int>(dp - kDigits);
   34|  1.58k|    if (d >= 10) break;  // '\0'
  ------------------
  |  Branch (34:9): [True: 238, False: 1.34k]
  ------------------
   35|  1.34k|    if (value > kMaxInt / 10) return nullptr;
  ------------------
  |  Branch (35:9): [True: 0, False: 1.34k]
  ------------------
   36|  1.34k|    value *= 10;
   37|  1.34k|    if (value > kMaxInt - d) return nullptr;
  ------------------
  |  Branch (37:9): [True: 0, False: 1.34k]
  ------------------
   38|  1.34k|    value += d;
   39|  1.34k|  }
   40|  1.19k|  if (p == op || value < min || value > max) return nullptr;
  ------------------
  |  Branch (40:7): [True: 0, False: 1.19k]
  |  Branch (40:18): [True: 0, False: 1.19k]
  |  Branch (40:33): [True: 0, False: 1.19k]
  ------------------
   41|  1.19k|  *vp = value;
   42|  1.19k|  return p;
   43|  1.19k|}
time_zone_posix.cc:_ZN4cctz12_GLOBAL__N_113ParseDateTimeEPKcPNS_15PosixTransitionE:
   92|    268|const char* ParseDateTime(const char* p, PosixTransition* res) {
   93|    268|  if (p != nullptr) {
  ------------------
  |  Branch (93:7): [True: 268, False: 0]
  ------------------
   94|    268|    if (*p != ',') return nullptr;
  ------------------
  |  Branch (94:9): [True: 0, False: 268]
  ------------------
   95|    268|    if (*++p == 'M') {
  ------------------
  |  Branch (95:9): [True: 268, False: 0]
  ------------------
   96|    268|      int month = 0;
   97|    268|      if ((p = ParseInt(p + 1, 1, 12, &month)) != nullptr) {
  ------------------
  |  Branch (97:11): [True: 268, False: 0]
  ------------------
   98|    268|        if (*p != '.') return nullptr;
  ------------------
  |  Branch (98:13): [True: 0, False: 268]
  ------------------
   99|    268|        int week = 0;
  100|    268|        if ((p = ParseInt(p + 1, 1, 5, &week)) != nullptr) {
  ------------------
  |  Branch (100:13): [True: 268, False: 0]
  ------------------
  101|    268|          if (*p != '.') return nullptr;
  ------------------
  |  Branch (101:15): [True: 0, False: 268]
  ------------------
  102|    268|          int weekday = 0;
  103|    268|          if ((p = ParseInt(p + 1, 0, 6, &weekday)) != nullptr) {
  ------------------
  |  Branch (103:15): [True: 268, False: 0]
  ------------------
  104|    268|            res->date.fmt = PosixTransition::M;
  105|    268|            res->date.m.month = static_cast<std::int_fast8_t>(month);
  106|    268|            res->date.m.week = static_cast<std::int_fast8_t>(week);
  107|    268|            res->date.m.weekday = static_cast<std::int_fast8_t>(weekday);
  108|    268|          }
  109|    268|        }
  110|    268|      }
  111|    268|    } 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|    268|    if (p != nullptr) {
  ------------------
  |  Branch (124:9): [True: 268, False: 0]
  ------------------
  125|    268|      res->time.offset = 2 * 60 * 60;  // default offset is 02:00:00
  126|    268|      if (*p == '/') p = ParseOffset(p + 1, -167, 167, 1, &res->time.offset);
  ------------------
  |  Branch (126:11): [True: 153, False: 115]
  ------------------
  127|    268|    }
  128|    268|  }
  129|    268|  return p;
  130|    268|}

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

