BrotliGetDictionary:
 5893|  6.68k|const BrotliDictionary* BrotliGetDictionary() {
 5894|  6.68k|  return &kBrotliDictionary;
 5895|  6.68k|}

decode.c:BrotliUnalignedRead64:
  216|   842k|static BROTLI_INLINE uint64_t BrotliUnalignedRead64(const void* p) {
  217|   842k|  return *(const uint64_t*)p;
  218|   842k|}
decode.c:BrotliUnalignedRead32:
  213|  4.59M|static BROTLI_INLINE uint32_t BrotliUnalignedRead32(const void* p) {
  214|  4.59M|  return *(const uint32_t*)p;
  215|  4.59M|}
state.c:BrotliDefaultAllocFunc:
  395|   100k|static void* BrotliDefaultAllocFunc(void* opaque, size_t size) {
  396|   100k|  BROTLI_UNUSED(opaque);
  ------------------
  |  |  377|   100k|#define BROTLI_UNUSED(X) (void)(X)
  ------------------
  397|   100k|  return malloc(size);
  398|   100k|}
state.c:BrotliDefaultFreeFunc:
  401|   981k|static void BrotliDefaultFreeFunc(void* opaque, void* address) {
  402|   981k|  BROTLI_UNUSED(opaque);
  ------------------
  |  |  377|   981k|#define BROTLI_UNUSED(X) (void)(X)
  ------------------
  403|   981k|  free(address);
  404|   981k|}

BrotliGetTransforms:
  173|  6.68k|const BrotliTransforms* BrotliGetTransforms(void) {
  174|  6.68k|  return &kBrotliTransforms;
  175|  6.68k|}
BrotliTransformDictionaryWord:
  195|  14.8k|    const BrotliTransforms* BROTLI_RESTRICT transforms, int transfom_idx) {
  196|  14.8k|  int idx = 0;
  197|  14.8k|  const uint8_t* prefix = BROTLI_TRANSFORM_PREFIX(transforms, transfom_idx);
  ------------------
  |  |   65|  14.8k|#define BROTLI_TRANSFORM_PREFIX(T, I) (&(T)->prefix_suffix[ \
  |  |   66|  14.8k|    (T)->prefix_suffix_map[BROTLI_TRANSFORM_PREFIX_ID(T, I)]])
  |  |  ------------------
  |  |  |  |   60|  14.8k|#define BROTLI_TRANSFORM_PREFIX_ID(T, I) ((T)->transforms[((I) * 3) + 0])
  |  |  ------------------
  ------------------
  198|  14.8k|  uint8_t type = BROTLI_TRANSFORM_TYPE(transforms, transfom_idx);
  ------------------
  |  |   61|  14.8k|#define BROTLI_TRANSFORM_TYPE(T, I)      ((T)->transforms[((I) * 3) + 1])
  ------------------
  199|  14.8k|  const uint8_t* suffix = BROTLI_TRANSFORM_SUFFIX(transforms, transfom_idx);
  ------------------
  |  |   67|  14.8k|#define BROTLI_TRANSFORM_SUFFIX(T, I) (&(T)->prefix_suffix[ \
  |  |   68|  14.8k|    (T)->prefix_suffix_map[BROTLI_TRANSFORM_SUFFIX_ID(T, I)]])
  |  |  ------------------
  |  |  |  |   62|  14.8k|#define BROTLI_TRANSFORM_SUFFIX_ID(T, I) ((T)->transforms[((I) * 3) + 2])
  |  |  ------------------
  ------------------
  200|  14.8k|  {
  201|  14.8k|    int prefix_len = *prefix++;
  202|  22.4k|    while (prefix_len--) { dst[idx++] = *prefix++; }
  ------------------
  |  Branch (202:12): [True: 7.58k, False: 14.8k]
  ------------------
  203|  14.8k|  }
  204|  14.8k|  {
  205|  14.8k|    const int t = type;
  206|  14.8k|    int i = 0;
  207|  14.8k|    if (t <= BROTLI_TRANSFORM_OMIT_LAST_9) {
  ------------------
  |  Branch (207:9): [True: 9.62k, False: 5.24k]
  ------------------
  208|  9.62k|      len -= t;
  209|  9.62k|    } else if (t >= BROTLI_TRANSFORM_OMIT_FIRST_1
  ------------------
  |  Branch (209:16): [True: 1.73k, False: 3.50k]
  ------------------
  210|  1.73k|        && t <= BROTLI_TRANSFORM_OMIT_FIRST_9) {
  ------------------
  |  Branch (210:12): [True: 1.73k, False: 0]
  ------------------
  211|  1.73k|      int skip = t - (BROTLI_TRANSFORM_OMIT_FIRST_1 - 1);
  212|  1.73k|      word += skip;
  213|  1.73k|      len -= skip;
  214|  1.73k|    }
  215|   101k|    while (i < len) { dst[idx++] = word[i++]; }
  ------------------
  |  Branch (215:12): [True: 87.1k, False: 14.8k]
  ------------------
  216|  14.8k|    if (t == BROTLI_TRANSFORM_UPPERCASE_FIRST) {
  ------------------
  |  Branch (216:9): [True: 2.81k, False: 12.0k]
  ------------------
  217|  2.81k|      ToUpperCase(&dst[idx - len]);
  218|  12.0k|    } else if (t == BROTLI_TRANSFORM_UPPERCASE_ALL) {
  ------------------
  |  Branch (218:16): [True: 685, False: 11.3k]
  ------------------
  219|    685|      uint8_t* uppercase = &dst[idx - len];
  220|  6.55k|      while (len > 0) {
  ------------------
  |  Branch (220:14): [True: 5.86k, False: 685]
  ------------------
  221|  5.86k|        int step = ToUpperCase(uppercase);
  222|  5.86k|        uppercase += step;
  223|  5.86k|        len -= step;
  224|  5.86k|      }
  225|    685|    }
  226|  14.8k|  }
  227|  14.8k|  {
  228|  14.8k|    int suffix_len = *suffix++;
  229|  37.2k|    while (suffix_len--) { dst[idx++] = *suffix++; }
  ------------------
  |  Branch (229:12): [True: 22.3k, False: 14.8k]
  ------------------
  230|  14.8k|    return idx;
  231|  14.8k|  }
  232|  14.8k|}
transform.c:ToUpperCase:
  177|  8.68k|static int ToUpperCase(uint8_t* p) {
  178|  8.68k|  if (p[0] < 0xC0) {
  ------------------
  |  Branch (178:7): [True: 7.03k, False: 1.64k]
  ------------------
  179|  7.03k|    if (p[0] >= 'a' && p[0] <= 'z') {
  ------------------
  |  Branch (179:9): [True: 4.52k, False: 2.51k]
  |  Branch (179:24): [True: 4.06k, False: 462]
  ------------------
  180|  4.06k|      p[0] ^= 32;
  181|  4.06k|    }
  182|  7.03k|    return 1;
  183|  7.03k|  }
  184|       |  /* An overly simplified uppercasing model for UTF-8. */
  185|  1.64k|  if (p[0] < 0xE0) {
  ------------------
  |  Branch (185:7): [True: 643, False: 1.00k]
  ------------------
  186|    643|    p[1] ^= 32;
  187|    643|    return 2;
  188|    643|  }
  189|       |  /* An arbitrary transform for three byte characters. */
  190|  1.00k|  p[2] ^= 5;
  191|  1.00k|  return 3;
  192|  1.64k|}

BrotliInitBitReader:
   18|  6.68k|void BrotliInitBitReader(BrotliBitReader* const br) {
   19|  6.68k|  br->val_ = 0;
   20|  6.68k|  br->bit_pos_ = sizeof(br->val_) << 3;
   21|  6.68k|}
BrotliWarmupBitReader:
   23|  50.8k|BROTLI_BOOL BrotliWarmupBitReader(BrotliBitReader* const br) {
   24|  50.8k|  size_t aligned_read_mask = (sizeof(br->val_) >> 1) - 1;
   25|       |  /* Fixing alignment after unaligned BrotliFillWindow would result accumulator
   26|       |     overflow. If unalignment is caused by BrotliSafeReadBits, then there is
   27|       |     enough space in accumulator to fix alignment. */
   28|  50.8k|  if (!BROTLI_ALIGNED_READ) {
  ------------------
  |  |  183|  50.8k|#define BROTLI_ALIGNED_READ (!!0)
  ------------------
  |  Branch (28:7): [True: 50.8k, Folded]
  ------------------
   29|  50.8k|    aligned_read_mask = 0;
   30|  50.8k|  }
   31|  50.8k|  if (BrotliGetAvailableBits(br) == 0) {
  ------------------
  |  Branch (31:7): [True: 14.7k, False: 36.1k]
  ------------------
   32|  14.7k|    if (!BrotliPullByte(br)) {
  ------------------
  |  Branch (32:9): [True: 2.05k, False: 12.6k]
  ------------------
   33|  2.05k|      return BROTLI_FALSE;
  ------------------
  |  |   53|  2.05k|#define BROTLI_FALSE 0
  ------------------
   34|  2.05k|    }
   35|  14.7k|  }
   36|       |
   37|  48.8k|  while ((((size_t)br->next_in) & aligned_read_mask) != 0) {
  ------------------
  |  Branch (37:10): [True: 0, False: 48.8k]
  ------------------
   38|      0|    if (!BrotliPullByte(br)) {
  ------------------
  |  Branch (38:9): [True: 0, False: 0]
  ------------------
   39|       |      /* If we consumed all the input, we don't care about the alignment. */
   40|      0|      return BROTLI_TRUE;
  ------------------
  |  |   51|      0|#define BROTLI_TRUE 1
  ------------------
   41|      0|    }
   42|      0|  }
   43|  48.8k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  48.8k|#define BROTLI_TRUE 1
  ------------------
   44|  48.8k|}

decode.c:BrotliBitReaderUnload:
  222|  2.62k|static BROTLI_INLINE void BrotliBitReaderUnload(BrotliBitReader* br) {
  223|  2.62k|  uint32_t unused_bytes = BrotliGetAvailableBits(br) >> 3;
  224|  2.62k|  uint32_t unused_bits = unused_bytes << 3;
  225|  2.62k|  br->avail_in += unused_bytes;
  226|  2.62k|  br->next_in -= unused_bytes;
  227|  2.62k|  if (unused_bits == sizeof(br->val_) << 3) {
  ------------------
  |  Branch (227:7): [True: 13, False: 2.60k]
  ------------------
  228|     13|    br->val_ = 0;
  229|  2.60k|  } else {
  230|  2.60k|    br->val_ <<= unused_bits;
  231|  2.60k|  }
  232|  2.62k|  br->bit_pos_ += unused_bits;
  233|  2.62k|}
decode.c:BrotliTakeBits:
  238|  40.9M|  BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
  239|  40.9M|  *val = (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
  240|  40.9M|  BROTLI_LOG(("[BrotliReadBits]  %d %d %d val: %6x\n",
  241|  40.9M|      (int)br->avail_in, (int)br->bit_pos_, n_bits, (int)*val));
  242|  40.9M|  BrotliDropBits(br, n_bits);
  243|  40.9M|}
decode.c:BrotliGetBitsUnmasked:
  183|  1.51G|    BrotliBitReader* const br) {
  184|  1.51G|  return br->val_ >> br->bit_pos_;
  185|  1.51G|}
decode.c:BrotliDropBits:
  218|  1.50G|    BrotliBitReader* const br, uint32_t n_bits) {
  219|  1.50G|  br->bit_pos_ += n_bits;
  220|  1.50G|}
decode.c:BrotliSafeReadBits:
  268|  2.44M|    BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
  269|  3.91M|  while (BrotliGetAvailableBits(br) < n_bits) {
  ------------------
  |  Branch (269:10): [True: 1.47M, False: 2.44M]
  ------------------
  270|  1.47M|    if (!BrotliPullByte(br)) {
  ------------------
  |  Branch (270:9): [True: 1.31k, False: 1.47M]
  ------------------
  271|  1.31k|      return BROTLI_FALSE;
  ------------------
  |  |   53|  1.31k|#define BROTLI_FALSE 0
  ------------------
  272|  1.31k|    }
  273|  1.47M|  }
  274|  2.44M|  BrotliTakeBits(br, n_bits, val);
  275|  2.44M|  return BROTLI_TRUE;
  ------------------
  |  |   51|  2.44M|#define BROTLI_TRUE 1
  ------------------
  276|  2.44M|}
decode.c:BrotliPullByte:
  164|   341M|static BROTLI_INLINE BROTLI_BOOL BrotliPullByte(BrotliBitReader* const br) {
  165|   341M|  if (br->avail_in == 0) {
  ------------------
  |  Branch (165:7): [True: 339M, False: 1.65M]
  ------------------
  166|   339M|    return BROTLI_FALSE;
  ------------------
  |  |   53|   339M|#define BROTLI_FALSE 0
  ------------------
  167|   339M|  }
  168|  1.65M|  br->val_ >>= 8;
  169|  1.65M|#if (BROTLI_64_BITS)
  170|  1.65M|  br->val_ |= ((uint64_t)*br->next_in) << 56;
  171|       |#else
  172|       |  br->val_ |= ((uint32_t)*br->next_in) << 24;
  173|       |#endif
  174|  1.65M|  br->bit_pos_ -= 8;
  175|  1.65M|  --br->avail_in;
  176|  1.65M|  ++br->next_in;
  177|  1.65M|  return BROTLI_TRUE;
  ------------------
  |  |   51|  1.65M|#define BROTLI_TRUE 1
  ------------------
  178|   341M|}
decode.c:BrotliJumpToByteBoundary:
  280|   142k|static BROTLI_INLINE BROTLI_BOOL BrotliJumpToByteBoundary(BrotliBitReader* br) {
  281|   142k|  uint32_t pad_bits_count = BrotliGetAvailableBits(br) & 0x7;
  282|   142k|  uint32_t pad_bits = 0;
  283|   142k|  if (pad_bits_count != 0) {
  ------------------
  |  Branch (283:7): [True: 142k, False: 495]
  ------------------
  284|   142k|    BrotliTakeBits(br, pad_bits_count, &pad_bits);
  285|   142k|  }
  286|   142k|  return TO_BROTLI_BOOL(pad_bits == 0);
  ------------------
  |  |   55|   142k|#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
  |  |  ------------------
  |  |  |  |   51|   142k|#define BROTLI_TRUE 1
  |  |  ------------------
  |  |               #define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
  |  |  ------------------
  |  |  |  |   53|     77|#define BROTLI_FALSE 0
  |  |  ------------------
  |  |  |  Branch (55:28): [True: 142k, False: 77]
  |  |  ------------------
  ------------------
  287|   142k|}
decode.c:BrotliGetRemainingBytes:
   91|  5.81k|static BROTLI_INLINE size_t BrotliGetRemainingBytes(BrotliBitReader* br) {
   92|  5.81k|  return br->avail_in + (BrotliGetAvailableBits(br) >> 3);
   93|  5.81k|}
decode.c:BrotliCopyBytes:
  293|  5.81k|                                          BrotliBitReader* br, size_t num) {
  294|  11.1k|  while (BrotliGetAvailableBits(br) >= 8 && num > 0) {
  ------------------
  |  Branch (294:10): [True: 5.49k, False: 5.63k]
  |  Branch (294:45): [True: 5.31k, False: 176]
  ------------------
  295|  5.31k|    *dest = (uint8_t)BrotliGetBitsUnmasked(br);
  296|  5.31k|    BrotliDropBits(br, 8);
  297|  5.31k|    ++dest;
  298|  5.31k|    --num;
  299|  5.31k|  }
  300|  5.81k|  memcpy(dest, br->next_in, num);
  301|  5.81k|  br->avail_in -= num;
  302|  5.81k|  br->next_in += num;
  303|  5.81k|}
decode.c:BrotliSafeGetBits:
  206|   965M|    BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
  207|   965M|  while (BrotliGetAvailableBits(br) < n_bits) {
  ------------------
  |  Branch (207:10): [True: 339M, False: 626M]
  ------------------
  208|   339M|    if (!BrotliPullByte(br)) {
  ------------------
  |  Branch (208:9): [True: 339M, False: 184k]
  ------------------
  209|   339M|      return BROTLI_FALSE;
  ------------------
  |  |   53|   339M|#define BROTLI_FALSE 0
  ------------------
  210|   339M|    }
  211|   339M|  }
  212|   626M|  *val = (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
  213|   626M|  return BROTLI_TRUE;
  ------------------
  |  |   51|   626M|#define BROTLI_TRUE 1
  ------------------
  214|   965M|}
decode.c:BrotliCheckInputAmount:
   98|   501M|    BrotliBitReader* const br, size_t num) {
   99|   501M|  return TO_BROTLI_BOOL(br->avail_in >= num);
  ------------------
  |  |   55|   501M|#define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
  |  |  ------------------
  |  |  |  |   51|   501M|#define BROTLI_TRUE 1
  |  |  ------------------
  |  |               #define TO_BROTLI_BOOL(X) (!!(X) ? BROTLI_TRUE : BROTLI_FALSE)
  |  |  ------------------
  |  |  |  |   53|  4.15k|#define BROTLI_FALSE 0
  |  |  ------------------
  |  |  |  Branch (55:28): [True: 501M, False: 4.15k]
  |  |  ------------------
  ------------------
  100|   501M|}
decode.c:BrotliFillBitWindow16:
  158|  1.84M|static BROTLI_INLINE void BrotliFillBitWindow16(BrotliBitReader* const br) {
  159|  1.84M|  BrotliFillBitWindow(br, 17);
  160|  1.84M|}
decode.c:BrotliFillBitWindow:
  107|   558M|    BrotliBitReader* const br, uint32_t n_bits) {
  108|   558M|#if (BROTLI_64_BITS)
  109|   558M|  if (!BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 8)) {
  ------------------
  |  |  183|  1.11G|#define BROTLI_ALIGNED_READ (!!0)
  ------------------
                if (!BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 8)) {
  ------------------
  |  |  326|  1.11G|#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))
  |  |  ------------------
  |  |  |  Branch (326:31): [True: 519M, False: 38.3M]
  |  |  ------------------
  ------------------
  |  Branch (109:7): [True: 558M, Folded]
  |  Branch (109:61): [True: 413M, False: 106M]
  ------------------
  110|   413M|    if (br->bit_pos_ >= 56) {
  ------------------
  |  Branch (110:9): [True: 4.95k, False: 413M]
  ------------------
  111|  4.95k|      br->val_ >>= 56;
  112|  4.95k|      br->bit_pos_ ^= 56;  /* here same as -= 56 because of the if condition */
  113|  4.95k|      br->val_ |= BROTLI_UNALIGNED_LOAD64LE(br->next_in) << 8;
  ------------------
  |  |  228|  4.95k|#define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64
  ------------------
  114|  4.95k|      br->avail_in -= 7;
  115|  4.95k|      br->next_in += 7;
  116|  4.95k|    }
  117|   413M|  } else if (
  118|   145M|      !BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 16)) {
  ------------------
  |  |  183|   290M|#define BROTLI_ALIGNED_READ (!!0)
  ------------------
                    !BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 16)) {
  ------------------
  |  |  326|   290M|#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))
  |  |  ------------------
  |  |  |  Branch (326:31): [True: 106M, False: 38.3M]
  |  |  ------------------
  ------------------
  |  Branch (118:7): [True: 145M, Folded]
  |  Branch (118:61): [True: 104M, False: 1.84M]
  ------------------
  119|   104M|    if (br->bit_pos_ >= 48) {
  ------------------
  |  Branch (119:9): [True: 837k, False: 104M]
  ------------------
  120|   837k|      br->val_ >>= 48;
  121|   837k|      br->bit_pos_ ^= 48;  /* here same as -= 48 because of the if condition */
  122|   837k|      br->val_ |= BROTLI_UNALIGNED_LOAD64LE(br->next_in) << 16;
  ------------------
  |  |  228|   837k|#define BROTLI_UNALIGNED_LOAD64LE BrotliUnalignedRead64
  ------------------
  123|   837k|      br->avail_in -= 6;
  124|   837k|      br->next_in += 6;
  125|   837k|    }
  126|   104M|  } else {
  127|  40.1M|    if (br->bit_pos_ >= 32) {
  ------------------
  |  Branch (127:9): [True: 4.59M, False: 35.5M]
  ------------------
  128|  4.59M|      br->val_ >>= 32;
  129|  4.59M|      br->bit_pos_ ^= 32;  /* here same as -= 32 because of the if condition */
  130|  4.59M|      br->val_ |= ((uint64_t)BROTLI_UNALIGNED_LOAD32LE(br->next_in)) << 32;
  ------------------
  |  |  227|  4.59M|#define BROTLI_UNALIGNED_LOAD32LE BrotliUnalignedRead32
  ------------------
  131|  4.59M|      br->avail_in -= BROTLI_SHORT_FILL_BIT_WINDOW_READ;
  ------------------
  |  |   21|  4.59M|#define BROTLI_SHORT_FILL_BIT_WINDOW_READ (sizeof(brotli_reg_t) >> 1)
  ------------------
  132|  4.59M|      br->next_in += BROTLI_SHORT_FILL_BIT_WINDOW_READ;
  ------------------
  |  |   21|  4.59M|#define BROTLI_SHORT_FILL_BIT_WINDOW_READ (sizeof(brotli_reg_t) >> 1)
  ------------------
  133|  4.59M|    }
  134|  40.1M|  }
  135|       |#else
  136|       |  if (!BROTLI_ALIGNED_READ && BROTLI_IS_CONSTANT(n_bits) && (n_bits <= 8)) {
  137|       |    if (br->bit_pos_ >= 24) {
  138|       |      br->val_ >>= 24;
  139|       |      br->bit_pos_ ^= 24;  /* here same as -= 24 because of the if condition */
  140|       |      br->val_ |= BROTLI_UNALIGNED_LOAD32LE(br->next_in) << 8;
  141|       |      br->avail_in -= 3;
  142|       |      br->next_in += 3;
  143|       |    }
  144|       |  } else {
  145|       |    if (br->bit_pos_ >= 16) {
  146|       |      br->val_ >>= 16;
  147|       |      br->bit_pos_ ^= 16;  /* here same as -= 16 because of the if condition */
  148|       |      br->val_ |= ((uint32_t)BROTLI_UNALIGNED_LOAD16LE(br->next_in)) << 16;
  149|       |      br->avail_in -= BROTLI_SHORT_FILL_BIT_WINDOW_READ;
  150|       |      br->next_in += BROTLI_SHORT_FILL_BIT_WINDOW_READ;
  151|       |    }
  152|       |  }
  153|       |#endif
  154|   558M|}
decode.c:BitMask:
   34|  1.08G|static BROTLI_INLINE uint32_t BitMask(uint32_t n) {
   35|  1.08G|  if (BROTLI_IS_CONSTANT(n) || BROTLI_HAS_UBFX) {
  ------------------
  |  |  326|  2.16G|#define BROTLI_IS_CONSTANT(x) (!!__builtin_constant_p(x))
  |  |  ------------------
  |  |  |  Branch (326:31): [True: 1.04G, False: 39.8M]
  |  |  ------------------
  ------------------
                if (BROTLI_IS_CONSTANT(n) || BROTLI_HAS_UBFX) {
  ------------------
  |  |  334|  39.8M|#define BROTLI_HAS_UBFX (!!0)
  |  |  ------------------
  |  |  |  Branch (334:25): [Folded, False: 0]
  |  |  ------------------
  ------------------
   36|       |    /* Masking with this expression turns to a single
   37|       |       "Unsigned Bit Field Extract" UBFX instruction on ARM. */
   38|  1.04G|    return ~((0xFFFFFFFFu) << n);
   39|  1.04G|  } else {
   40|  39.8M|    return kBitMask[n];
   41|  39.8M|  }
   42|  1.08G|}
decode.c:BrotliReadBits:
  248|  38.3M|    BrotliBitReader* const br, uint32_t n_bits) {
  249|  38.3M|  if (BROTLI_64_BITS || (n_bits <= 16)) {
  ------------------
  |  |  132|  76.6M|#define BROTLI_64_BITS 1
  |  |  ------------------
  |  |  |  Branch (132:24): [True: 38.3M, Folded]
  |  |  ------------------
  ------------------
  |  Branch (249:25): [True: 0, False: 0]
  ------------------
  250|  38.3M|    uint32_t val;
  251|  38.3M|    BrotliFillBitWindow(br, n_bits);
  252|  38.3M|    BrotliTakeBits(br, n_bits, &val);
  253|  38.3M|    return val;
  254|  38.3M|  } else {
  255|      0|    uint32_t low_val;
  256|      0|    uint32_t high_val;
  257|      0|    BrotliFillBitWindow(br, 16);
  258|      0|    BrotliTakeBits(br, 16, &low_val);
  259|      0|    BrotliFillBitWindow(br, 8);
  260|      0|    BrotliTakeBits(br, n_bits - 16, &high_val);
  261|      0|    return low_val | (high_val << 16);
  262|      0|  }
  263|  38.3M|}
decode.c:BrotliBitReaderSaveState:
   69|   133M|    BrotliBitReader* const from, BrotliBitReaderState* to) {
   70|   133M|  to->val_ = from->val_;
   71|   133M|  to->bit_pos_ = from->bit_pos_;
   72|   133M|  to->next_in = from->next_in;
   73|   133M|  to->avail_in = from->avail_in;
   74|   133M|}
decode.c:BrotliBitReaderRestoreState:
   77|    657|    BrotliBitReader* const to, BrotliBitReaderState* from) {
   78|    657|  to->val_ = from->val_;
   79|    657|  to->bit_pos_ = from->bit_pos_;
   80|    657|  to->next_in = from->next_in;
   81|    657|  to->avail_in = from->avail_in;
   82|    657|}
decode.c:BrotliGetBits:
  198|   413M|    BrotliBitReader* const br, uint32_t n_bits) {
  199|   413M|  BrotliFillBitWindow(br, n_bits);
  200|   413M|  return (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(n_bits);
  201|   413M|}
decode.c:BrotliGet16BitsUnmasked:
  190|   104M|    BrotliBitReader* const br) {
  191|   104M|  BrotliFillBitWindow(br, 16);
  192|   104M|  return (uint32_t)BrotliGetBitsUnmasked(br);
  193|   104M|}
decode.c:BrotliGetAvailableBits:
   85|  1.30G|    const BrotliBitReader* br) {
   86|  1.30G|  return (BROTLI_64_BITS ? 64 : 32) - br->bit_pos_;
  ------------------
  |  |  132|  1.30G|#define BROTLI_64_BITS 1
  |  |  ------------------
  |  |  |  Branch (132:24): [True: 1.30G, Folded]
  |  |  ------------------
  ------------------
   87|  1.30G|}
bit_reader.c:BrotliGetAvailableBits:
   85|  50.8k|    const BrotliBitReader* br) {
   86|  50.8k|  return (BROTLI_64_BITS ? 64 : 32) - br->bit_pos_;
  ------------------
  |  |  132|  50.8k|#define BROTLI_64_BITS 1
  |  |  ------------------
  |  |  |  Branch (132:24): [True: 50.8k, Folded]
  |  |  ------------------
  ------------------
   87|  50.8k|}
bit_reader.c:BrotliPullByte:
  164|  14.7k|static BROTLI_INLINE BROTLI_BOOL BrotliPullByte(BrotliBitReader* const br) {
  165|  14.7k|  if (br->avail_in == 0) {
  ------------------
  |  Branch (165:7): [True: 2.05k, False: 12.6k]
  ------------------
  166|  2.05k|    return BROTLI_FALSE;
  ------------------
  |  |   53|  2.05k|#define BROTLI_FALSE 0
  ------------------
  167|  2.05k|  }
  168|  12.6k|  br->val_ >>= 8;
  169|  12.6k|#if (BROTLI_64_BITS)
  170|  12.6k|  br->val_ |= ((uint64_t)*br->next_in) << 56;
  171|       |#else
  172|       |  br->val_ |= ((uint32_t)*br->next_in) << 24;
  173|       |#endif
  174|  12.6k|  br->bit_pos_ -= 8;
  175|  12.6k|  --br->avail_in;
  176|  12.6k|  ++br->next_in;
  177|  12.6k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  12.6k|#define BROTLI_TRUE 1
  ------------------
  178|  14.7k|}

BrotliDecoderDecompress:
 1945|  6.68k|    uint8_t* decoded_buffer) {
 1946|  6.68k|  BrotliDecoderState s;
  ------------------
  |  |  235|  6.68k|#define BrotliDecoderState BrotliDecoderStateInternal
  ------------------
 1947|  6.68k|  BrotliDecoderResult result;
 1948|  6.68k|  size_t total_out = 0;
 1949|  6.68k|  size_t available_in = encoded_size;
 1950|  6.68k|  const uint8_t* next_in = encoded_buffer;
 1951|  6.68k|  size_t available_out = *decoded_size;
 1952|  6.68k|  uint8_t* next_out = decoded_buffer;
 1953|  6.68k|  if (!BrotliDecoderStateInit(&s, 0, 0, 0)) {
  ------------------
  |  Branch (1953:7): [True: 0, False: 6.68k]
  ------------------
 1954|      0|    return BROTLI_DECODER_RESULT_ERROR;
 1955|      0|  }
 1956|  6.68k|  result = BrotliDecoderDecompressStream(
 1957|  6.68k|      &s, &available_in, &next_in, &available_out, &next_out, &total_out);
 1958|  6.68k|  *decoded_size = total_out;
 1959|  6.68k|  BrotliDecoderStateCleanup(&s);
 1960|  6.68k|  if (result != BROTLI_DECODER_RESULT_SUCCESS) {
  ------------------
  |  Branch (1960:7): [True: 5.24k, False: 1.43k]
  ------------------
 1961|  5.24k|    result = BROTLI_DECODER_RESULT_ERROR;
 1962|  5.24k|  }
 1963|  6.68k|  return result;
 1964|  6.68k|}
BrotliDecoderDecompressStream:
 1979|  6.68k|    size_t* available_out, uint8_t** next_out, size_t* total_out) {
 1980|  6.68k|  BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
 1981|  6.68k|  BrotliBitReader* br = &s->br;
 1982|       |  /* Ensure that |total_out| is set, even if no data will ever be pushed out. */
 1983|  6.68k|  if (total_out) {
  ------------------
  |  Branch (1983:7): [True: 6.68k, False: 0]
  ------------------
 1984|  6.68k|    *total_out = s->partial_pos_out;
 1985|  6.68k|  }
 1986|       |  /* Do not try to process further in a case of unrecoverable error. */
 1987|  6.68k|  if ((int)s->error_code < 0) {
  ------------------
  |  Branch (1987:7): [True: 0, False: 6.68k]
  ------------------
 1988|      0|    return BROTLI_DECODER_RESULT_ERROR;
 1989|      0|  }
 1990|  6.68k|  if (*available_out && (!next_out || !*next_out)) {
  ------------------
  |  Branch (1990:7): [True: 6.68k, False: 0]
  |  Branch (1990:26): [True: 0, False: 6.68k]
  |  Branch (1990:39): [True: 0, False: 6.68k]
  ------------------
 1991|      0|    return SaveErrorCode(
 1992|      0|        s, BROTLI_FAILURE(BROTLI_DECODER_ERROR_INVALID_ARGUMENTS));
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1993|      0|  }
 1994|  6.68k|  if (!*available_out) next_out = 0;
  ------------------
  |  Branch (1994:7): [True: 0, False: 6.68k]
  ------------------
 1995|  6.68k|  if (s->buffer_length == 0) {  /* Just connect bit reader to input stream. */
  ------------------
  |  Branch (1995:7): [True: 6.68k, False: 0]
  ------------------
 1996|  6.68k|    br->avail_in = *available_in;
 1997|  6.68k|    br->next_in = *next_in;
 1998|  6.68k|  } else {
 1999|       |    /* At least one byte of input is required. More than one byte of input may
 2000|       |       be required to complete the transaction -> reading more data must be
 2001|       |       done in a loop -> do it in a main loop. */
 2002|      0|    result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2003|      0|    br->next_in = &s->buffer.u8[0];
 2004|      0|  }
 2005|       |  /* State machine */
 2006|   598k|  for (;;) {
 2007|   598k|    if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2007:9): [True: 5.24k, False: 593k]
  ------------------
 2008|       |      /* Error, needs more input/output. */
 2009|  5.24k|      if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
  ------------------
  |  Branch (2009:11): [True: 4.06k, False: 1.18k]
  ------------------
 2010|  4.06k|        if (s->ringbuffer != 0) {  /* Pro-actively push output. */
  ------------------
  |  Branch (2010:13): [True: 1.12k, False: 2.94k]
  ------------------
 2011|  1.12k|          BrotliDecoderErrorCode intermediate_result = WriteRingBuffer(s,
 2012|  1.12k|              available_out, next_out, total_out, BROTLI_TRUE);
  ------------------
  |  |   51|  1.12k|#define BROTLI_TRUE 1
  ------------------
 2013|       |          /* WriteRingBuffer checks s->meta_block_remaining_len validity. */
 2014|  1.12k|          if ((int)intermediate_result < 0) {
  ------------------
  |  Branch (2014:15): [True: 22, False: 1.10k]
  ------------------
 2015|     22|            result = intermediate_result;
 2016|     22|            break;
 2017|     22|          }
 2018|  1.12k|        }
 2019|  4.04k|        if (s->buffer_length != 0) {  /* Used with internal buffer. */
  ------------------
  |  Branch (2019:13): [True: 0, False: 4.04k]
  ------------------
 2020|      0|          if (br->avail_in == 0) {
  ------------------
  |  Branch (2020:15): [True: 0, False: 0]
  ------------------
 2021|       |            /* Successfully finished read transaction.
 2022|       |               Accumulator contains less than 8 bits, because internal buffer
 2023|       |               is expanded byte-by-byte until it is enough to complete read. */
 2024|      0|            s->buffer_length = 0;
 2025|       |            /* Switch to input stream and restart. */
 2026|      0|            result = BROTLI_DECODER_SUCCESS;
 2027|      0|            br->avail_in = *available_in;
 2028|      0|            br->next_in = *next_in;
 2029|      0|            continue;
 2030|      0|          } else if (*available_in != 0) {
  ------------------
  |  Branch (2030:22): [True: 0, False: 0]
  ------------------
 2031|       |            /* Not enough data in buffer, but can take one more byte from
 2032|       |               input stream. */
 2033|      0|            result = BROTLI_DECODER_SUCCESS;
 2034|      0|            s->buffer.u8[s->buffer_length] = **next_in;
 2035|      0|            s->buffer_length++;
 2036|      0|            br->avail_in = s->buffer_length;
 2037|      0|            (*next_in)++;
 2038|      0|            (*available_in)--;
 2039|       |            /* Retry with more data in buffer. */
 2040|      0|            continue;
 2041|      0|          }
 2042|       |          /* Can't finish reading and no more input. */
 2043|      0|          break;
 2044|  4.04k|        } else {  /* Input stream doesn't contain enough input. */
 2045|       |          /* Copy tail to internal buffer and return. */
 2046|  4.04k|          *next_in = br->next_in;
 2047|  4.04k|          *available_in = br->avail_in;
 2048|  4.07k|          while (*available_in) {
  ------------------
  |  Branch (2048:18): [True: 27, False: 4.04k]
  ------------------
 2049|     27|            s->buffer.u8[s->buffer_length] = **next_in;
 2050|     27|            s->buffer_length++;
 2051|     27|            (*next_in)++;
 2052|     27|            (*available_in)--;
 2053|     27|          }
 2054|  4.04k|          break;
 2055|  4.04k|        }
 2056|       |        /* Unreachable. */
 2057|  4.04k|      }
 2058|       |
 2059|       |      /* Fail or needs more output. */
 2060|       |
 2061|  1.18k|      if (s->buffer_length != 0) {
  ------------------
  |  Branch (2061:11): [True: 0, False: 1.18k]
  ------------------
 2062|       |        /* Just consumed the buffered input and produced some output. Otherwise
 2063|       |           it would result in "needs more input". Reset internal buffer. */
 2064|      0|        s->buffer_length = 0;
 2065|  1.18k|      } else {
 2066|       |        /* Using input stream in last iteration. When decoder switches to input
 2067|       |           stream it has less than 8 bits in accumulator, so it is safe to
 2068|       |           return unused accumulator bits there. */
 2069|  1.18k|        BrotliBitReaderUnload(br);
 2070|  1.18k|        *available_in = br->avail_in;
 2071|  1.18k|        *next_in = br->next_in;
 2072|  1.18k|      }
 2073|  1.18k|      break;
 2074|  5.24k|    }
 2075|   593k|    switch (s->state) {
  ------------------
  |  Branch (2075:13): [True: 593k, False: 0]
  ------------------
 2076|  6.68k|      case BROTLI_STATE_UNINITED:
  ------------------
  |  Branch (2076:7): [True: 6.68k, False: 586k]
  ------------------
 2077|       |        /* Prepare to the first read. */
 2078|  6.68k|        if (!BrotliWarmupBitReader(br)) {
  ------------------
  |  Branch (2078:13): [True: 2.03k, False: 4.65k]
  ------------------
 2079|  2.03k|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2080|  2.03k|          break;
 2081|  2.03k|        }
 2082|       |        /* Decode window size. */
 2083|  4.65k|        result = DecodeWindowBits(s, br);  /* Reads 1..8 bits. */
 2084|  4.65k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2084:13): [True: 5, False: 4.64k]
  ------------------
 2085|      5|          break;
 2086|      5|        }
 2087|  4.64k|        if (s->large_window) {
  ------------------
  |  Branch (2087:13): [True: 0, False: 4.64k]
  ------------------
 2088|      0|          s->state = BROTLI_STATE_LARGE_WINDOW_BITS;
 2089|      0|          break;
 2090|      0|        }
 2091|  4.64k|        s->state = BROTLI_STATE_INITIALIZE;
 2092|  4.64k|        break;
 2093|       |
 2094|      0|      case BROTLI_STATE_LARGE_WINDOW_BITS:
  ------------------
  |  Branch (2094:7): [True: 0, False: 593k]
  ------------------
 2095|      0|        if (!BrotliSafeReadBits(br, 6, &s->window_bits)) {
  ------------------
  |  Branch (2095:13): [True: 0, False: 0]
  ------------------
 2096|      0|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2097|      0|          break;
 2098|      0|        }
 2099|      0|        if (s->window_bits < BROTLI_LARGE_MIN_WBITS ||
  ------------------
  |  |   33|      0|#define BROTLI_LARGE_MIN_WBITS 10
  ------------------
  |  Branch (2099:13): [True: 0, False: 0]
  ------------------
 2100|      0|            s->window_bits > BROTLI_LARGE_MAX_WBITS) {
  ------------------
  |  |   34|      0|#define BROTLI_LARGE_MAX_WBITS 30
  ------------------
  |  Branch (2100:13): [True: 0, False: 0]
  ------------------
 2101|      0|          result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2102|      0|          break;
 2103|      0|        }
 2104|      0|        s->state = BROTLI_STATE_INITIALIZE;
 2105|       |        /* No break, continue to next state */
 2106|       |
 2107|  4.64k|      case BROTLI_STATE_INITIALIZE:
  ------------------
  |  Branch (2107:7): [True: 4.64k, False: 588k]
  ------------------
 2108|  4.64k|        BROTLI_LOG_UINT(s->window_bits);
 2109|       |        /* Maximum distance, see section 9.1. of the spec. */
 2110|  4.64k|        s->max_backward_distance = (1 << s->window_bits) - BROTLI_WINDOW_GAP;
  ------------------
  |  |   61|  4.64k|#define BROTLI_WINDOW_GAP 16
  ------------------
 2111|       |
 2112|       |        /* Allocate memory for both block_type_trees and block_len_trees. */
 2113|  4.64k|        s->block_type_trees = (HuffmanCode*)BROTLI_DECODER_ALLOC(s,
  ------------------
  |  |  247|  4.64k|#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
  ------------------
 2114|  4.64k|            sizeof(HuffmanCode) * 3 *
 2115|  4.64k|                (BROTLI_HUFFMAN_MAX_SIZE_258 + BROTLI_HUFFMAN_MAX_SIZE_26));
 2116|  4.64k|        if (s->block_type_trees == 0) {
  ------------------
  |  Branch (2116:13): [True: 0, False: 4.64k]
  ------------------
 2117|      0|          result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_BLOCK_TYPE_TREES);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2118|      0|          break;
 2119|      0|        }
 2120|  4.64k|        s->block_len_trees =
 2121|  4.64k|            s->block_type_trees + 3 * BROTLI_HUFFMAN_MAX_SIZE_258;
  ------------------
  |  |   30|  4.64k|#define BROTLI_HUFFMAN_MAX_SIZE_258 632
  ------------------
 2122|       |
 2123|  4.64k|        s->state = BROTLI_STATE_METABLOCK_BEGIN;
 2124|       |        /* No break, continue to next state. */
 2125|       |
 2126|   157k|      case BROTLI_STATE_METABLOCK_BEGIN:
  ------------------
  |  Branch (2126:7): [True: 153k, False: 440k]
  ------------------
 2127|   157k|        BrotliDecoderStateMetablockBegin(s);
 2128|   157k|        BROTLI_LOG_UINT(s->pos);
 2129|   157k|        s->state = BROTLI_STATE_METABLOCK_HEADER;
 2130|       |        /* No break, continue to next state. */
 2131|       |
 2132|   157k|      case BROTLI_STATE_METABLOCK_HEADER:
  ------------------
  |  Branch (2132:7): [True: 0, False: 593k]
  ------------------
 2133|   157k|        result = DecodeMetaBlockLength(s, br);  /* Reads 2 - 31 bits. */
 2134|   157k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2134:13): [True: 409, False: 157k]
  ------------------
 2135|    409|          break;
 2136|    409|        }
 2137|   157k|        BROTLI_LOG_UINT(s->is_last_metablock);
 2138|   157k|        BROTLI_LOG_UINT(s->meta_block_remaining_len);
 2139|   157k|        BROTLI_LOG_UINT(s->is_metadata);
 2140|   157k|        BROTLI_LOG_UINT(s->is_uncompressed);
 2141|   157k|        if (s->is_metadata || s->is_uncompressed) {
  ------------------
  |  Branch (2141:13): [True: 135k, False: 21.7k]
  |  Branch (2141:31): [True: 5.47k, False: 16.3k]
  ------------------
 2142|   141k|          if (!BrotliJumpToByteBoundary(br)) {
  ------------------
  |  Branch (2142:15): [True: 35, False: 140k]
  ------------------
 2143|     35|            result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_PADDING_1);
  ------------------
  |  |   31|     35|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     35|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2144|     35|            break;
 2145|     35|          }
 2146|   141k|        }
 2147|   157k|        if (s->is_metadata) {
  ------------------
  |  Branch (2147:13): [True: 135k, False: 21.7k]
  ------------------
 2148|   135k|          s->state = BROTLI_STATE_METADATA;
 2149|   135k|          break;
 2150|   135k|        }
 2151|  21.7k|        if (s->meta_block_remaining_len == 0) {
  ------------------
  |  Branch (2151:13): [True: 473, False: 21.3k]
  ------------------
 2152|    473|          s->state = BROTLI_STATE_METABLOCK_DONE;
 2153|    473|          break;
 2154|    473|        }
 2155|  21.3k|        BrotliCalculateRingBufferSize(s);
 2156|  21.3k|        if (s->is_uncompressed) {
  ------------------
  |  Branch (2156:13): [True: 5.45k, False: 15.8k]
  ------------------
 2157|  5.45k|          s->state = BROTLI_STATE_UNCOMPRESSED;
 2158|  5.45k|          break;
 2159|  5.45k|        }
 2160|  15.8k|        s->loop_counter = 0;
 2161|  15.8k|        s->state = BROTLI_STATE_HUFFMAN_CODE_0;
 2162|  15.8k|        break;
 2163|       |
 2164|  5.45k|      case BROTLI_STATE_UNCOMPRESSED: {
  ------------------
  |  Branch (2164:7): [True: 5.45k, False: 587k]
  ------------------
 2165|  5.45k|        result = CopyUncompressedBlockToOutput(
 2166|  5.45k|            available_out, next_out, total_out, s);
 2167|  5.45k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2167:13): [True: 134, False: 5.31k]
  ------------------
 2168|    134|          break;
 2169|    134|        }
 2170|  5.31k|        s->state = BROTLI_STATE_METABLOCK_DONE;
 2171|  5.31k|        break;
 2172|  5.45k|      }
 2173|       |
 2174|   135k|      case BROTLI_STATE_METADATA:
  ------------------
  |  Branch (2174:7): [True: 135k, False: 457k]
  ------------------
 2175|  1.35M|        for (; s->meta_block_remaining_len > 0; --s->meta_block_remaining_len) {
  ------------------
  |  Branch (2175:16): [True: 1.22M, False: 135k]
  ------------------
 2176|  1.22M|          uint32_t bits;
 2177|       |          /* Read one byte and ignore it. */
 2178|  1.22M|          if (!BrotliSafeReadBits(br, 8, &bits)) {
  ------------------
  |  Branch (2178:15): [True: 46, False: 1.22M]
  ------------------
 2179|     46|            result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2180|     46|            break;
 2181|     46|          }
 2182|  1.22M|        }
 2183|   135k|        if (result == BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2183:13): [True: 135k, False: 46]
  ------------------
 2184|   135k|          s->state = BROTLI_STATE_METABLOCK_DONE;
 2185|   135k|        }
 2186|   135k|        break;
 2187|       |
 2188|  62.6k|      case BROTLI_STATE_HUFFMAN_CODE_0:
  ------------------
  |  Branch (2188:7): [True: 62.6k, False: 530k]
  ------------------
 2189|  62.6k|        if (s->loop_counter >= 3) {
  ------------------
  |  Branch (2189:13): [True: 15.5k, False: 47.1k]
  ------------------
 2190|  15.5k|          s->state = BROTLI_STATE_METABLOCK_HEADER_2;
 2191|  15.5k|          break;
 2192|  15.5k|        }
 2193|       |        /* Reads 1..11 bits. */
 2194|  47.1k|        result = DecodeVarLenUint8(s, br, &s->num_block_types[s->loop_counter]);
 2195|  47.1k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2195:13): [True: 15, False: 47.1k]
  ------------------
 2196|     15|          break;
 2197|     15|        }
 2198|  47.1k|        s->num_block_types[s->loop_counter]++;
 2199|  47.1k|        BROTLI_LOG_UINT(s->num_block_types[s->loop_counter]);
 2200|  47.1k|        if (s->num_block_types[s->loop_counter] < 2) {
  ------------------
  |  Branch (2200:13): [True: 37.3k, False: 9.74k]
  ------------------
 2201|  37.3k|          s->loop_counter++;
 2202|  37.3k|          break;
 2203|  37.3k|        }
 2204|  9.74k|        s->state = BROTLI_STATE_HUFFMAN_CODE_1;
 2205|       |        /* No break, continue to next state. */
 2206|       |
 2207|  9.74k|      case BROTLI_STATE_HUFFMAN_CODE_1: {
  ------------------
  |  Branch (2207:7): [True: 0, False: 593k]
  ------------------
 2208|  9.74k|        uint32_t alphabet_size = s->num_block_types[s->loop_counter] + 2;
 2209|  9.74k|        int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_258;
  ------------------
  |  |   30|  9.74k|#define BROTLI_HUFFMAN_MAX_SIZE_258 632
  ------------------
 2210|  9.74k|        result = ReadHuffmanCode(alphabet_size, alphabet_size,
 2211|  9.74k|            &s->block_type_trees[tree_offset], NULL, s);
 2212|  9.74k|        if (result != BROTLI_DECODER_SUCCESS) break;
  ------------------
  |  Branch (2212:13): [True: 177, False: 9.56k]
  ------------------
 2213|  9.56k|        s->state = BROTLI_STATE_HUFFMAN_CODE_2;
 2214|       |        /* No break, continue to next state. */
 2215|  9.56k|      }
 2216|       |
 2217|  9.56k|      case BROTLI_STATE_HUFFMAN_CODE_2: {
  ------------------
  |  Branch (2217:7): [True: 0, False: 593k]
  ------------------
 2218|  9.56k|        uint32_t alphabet_size = BROTLI_NUM_BLOCK_LEN_SYMBOLS;
  ------------------
  |  |   19|  9.56k|#define BROTLI_NUM_BLOCK_LEN_SYMBOLS 26
  ------------------
 2219|  9.56k|        int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_26;
  ------------------
  |  |   28|  9.56k|#define BROTLI_HUFFMAN_MAX_SIZE_26 396
  ------------------
 2220|  9.56k|        result = ReadHuffmanCode(alphabet_size, alphabet_size,
 2221|  9.56k|            &s->block_len_trees[tree_offset], NULL, s);
 2222|  9.56k|        if (result != BROTLI_DECODER_SUCCESS) break;
  ------------------
  |  Branch (2222:13): [True: 76, False: 9.49k]
  ------------------
 2223|  9.49k|        s->state = BROTLI_STATE_HUFFMAN_CODE_3;
 2224|       |        /* No break, continue to next state. */
 2225|  9.49k|      }
 2226|       |
 2227|  9.49k|      case BROTLI_STATE_HUFFMAN_CODE_3: {
  ------------------
  |  Branch (2227:7): [True: 0, False: 593k]
  ------------------
 2228|  9.49k|        int tree_offset = s->loop_counter * BROTLI_HUFFMAN_MAX_SIZE_26;
  ------------------
  |  |   28|  9.49k|#define BROTLI_HUFFMAN_MAX_SIZE_26 396
  ------------------
 2229|  9.49k|        if (!SafeReadBlockLength(s, &s->block_length[s->loop_counter],
  ------------------
  |  Branch (2229:13): [True: 32, False: 9.46k]
  ------------------
 2230|  9.49k|            &s->block_len_trees[tree_offset], br)) {
 2231|     32|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2232|     32|          break;
 2233|     32|        }
 2234|  9.46k|        BROTLI_LOG_UINT(s->block_length[s->loop_counter]);
 2235|  9.46k|        s->loop_counter++;
 2236|  9.46k|        s->state = BROTLI_STATE_HUFFMAN_CODE_0;
 2237|  9.46k|        break;
 2238|  9.49k|      }
 2239|       |
 2240|  15.5k|      case BROTLI_STATE_METABLOCK_HEADER_2: {
  ------------------
  |  Branch (2240:7): [True: 15.5k, False: 577k]
  ------------------
 2241|  15.5k|        uint32_t bits;
 2242|  15.5k|        if (!BrotliSafeReadBits(br, 6, &bits)) {
  ------------------
  |  Branch (2242:13): [True: 13, False: 15.5k]
  ------------------
 2243|     13|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 2244|     13|          break;
 2245|     13|        }
 2246|  15.5k|        s->distance_postfix_bits = bits & BitMask(2);
 2247|  15.5k|        bits >>= 2;
 2248|  15.5k|        s->num_direct_distance_codes = BROTLI_NUM_DISTANCE_SHORT_CODES +
  ------------------
  |  |   37|  15.5k|#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
  ------------------
 2249|  15.5k|            (bits << s->distance_postfix_bits);
 2250|  15.5k|        BROTLI_LOG_UINT(s->num_direct_distance_codes);
 2251|  15.5k|        BROTLI_LOG_UINT(s->distance_postfix_bits);
 2252|  15.5k|        s->distance_postfix_mask = (int)BitMask(s->distance_postfix_bits);
 2253|  15.5k|        s->context_modes =
 2254|  15.5k|            (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)s->num_block_types[0]);
  ------------------
  |  |  247|  15.5k|#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
  ------------------
 2255|  15.5k|        if (s->context_modes == 0) {
  ------------------
  |  Branch (2255:13): [True: 0, False: 15.5k]
  ------------------
 2256|      0|          result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MODES);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2257|      0|          break;
 2258|      0|        }
 2259|  15.5k|        s->loop_counter = 0;
 2260|  15.5k|        s->state = BROTLI_STATE_CONTEXT_MODES;
 2261|       |        /* No break, continue to next state. */
 2262|  15.5k|      }
 2263|       |
 2264|  15.5k|      case BROTLI_STATE_CONTEXT_MODES:
  ------------------
  |  Branch (2264:7): [True: 0, False: 593k]
  ------------------
 2265|  15.5k|        result = ReadContextModes(s);
 2266|  15.5k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2266:13): [True: 21, False: 15.5k]
  ------------------
 2267|     21|          break;
 2268|     21|        }
 2269|  15.5k|        s->state = BROTLI_STATE_CONTEXT_MAP_1;
 2270|       |        /* No break, continue to next state. */
 2271|       |
 2272|  15.5k|      case BROTLI_STATE_CONTEXT_MAP_1:
  ------------------
  |  Branch (2272:7): [True: 0, False: 593k]
  ------------------
 2273|  15.5k|        result = DecodeContextMap(
 2274|  15.5k|            s->num_block_types[0] << BROTLI_LITERAL_CONTEXT_BITS,
  ------------------
  |  |   53|  15.5k|#define BROTLI_LITERAL_CONTEXT_BITS 6
  ------------------
 2275|  15.5k|            &s->num_literal_htrees, &s->context_map, s);
 2276|  15.5k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2276:13): [True: 134, False: 15.3k]
  ------------------
 2277|    134|          break;
 2278|    134|        }
 2279|  15.3k|        DetectTrivialLiteralBlockTypes(s);
 2280|  15.3k|        s->state = BROTLI_STATE_CONTEXT_MAP_2;
 2281|       |        /* No break, continue to next state. */
 2282|       |
 2283|  15.3k|      case BROTLI_STATE_CONTEXT_MAP_2: {
  ------------------
  |  Branch (2283:7): [True: 0, False: 593k]
  ------------------
 2284|  15.3k|        uint32_t num_direct_codes =
 2285|  15.3k|            s->num_direct_distance_codes - BROTLI_NUM_DISTANCE_SHORT_CODES;
  ------------------
  |  |   37|  15.3k|#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
  ------------------
 2286|  15.3k|        uint32_t num_distance_codes = BROTLI_DISTANCE_ALPHABET_SIZE(
  ------------------
  |  |   41|  15.3k|#define BROTLI_DISTANCE_ALPHABET_SIZE(NDIRECT, NPOSTFIX, MAXNBITS) ( \
  |  |   42|  15.3k|    BROTLI_NUM_DISTANCE_SHORT_CODES + (NDIRECT) +                    \
  |  |  ------------------
  |  |  |  |   37|  15.3k|#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
  |  |  ------------------
  |  |   43|  30.7k|    ((MAXNBITS) << ((NPOSTFIX) + 1)))
  |  |  ------------------
  |  |  |  Branch (43:7): [True: 0, False: 15.3k]
  |  |  ------------------
  ------------------
 2287|  15.3k|            num_direct_codes, s->distance_postfix_bits,
 2288|  15.3k|            (s->large_window ? BROTLI_LARGE_MAX_DISTANCE_BITS :
 2289|  15.3k|                               BROTLI_MAX_DISTANCE_BITS));
 2290|  15.3k|        uint32_t max_distance_symbol = (s->large_window ?
  ------------------
  |  Branch (2290:41): [True: 0, False: 15.3k]
  ------------------
 2291|      0|            BrotliMaxDistanceSymbol(
 2292|      0|                num_direct_codes, s->distance_postfix_bits) :
 2293|  15.3k|            num_distance_codes);
 2294|  15.3k|        BROTLI_BOOL allocation_success = BROTLI_TRUE;
  ------------------
  |  |   49|  15.3k|#define BROTLI_BOOL int
  ------------------
                      BROTLI_BOOL allocation_success = BROTLI_TRUE;
  ------------------
  |  |   51|  15.3k|#define BROTLI_TRUE 1
  ------------------
 2295|  15.3k|        result = DecodeContextMap(
 2296|  15.3k|            s->num_block_types[2] << BROTLI_DISTANCE_CONTEXT_BITS,
  ------------------
  |  |   56|  15.3k|#define BROTLI_DISTANCE_CONTEXT_BITS 2
  ------------------
 2297|  15.3k|            &s->num_dist_htrees, &s->dist_context_map, s);
 2298|  15.3k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2298:13): [True: 82, False: 15.2k]
  ------------------
 2299|     82|          break;
 2300|     82|        }
 2301|  15.2k|        allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
 2302|  15.2k|            s, &s->literal_hgroup, BROTLI_NUM_LITERAL_SYMBOLS,
  ------------------
  |  |   17|  15.2k|#define BROTLI_NUM_LITERAL_SYMBOLS 256
  ------------------
 2303|  15.2k|            BROTLI_NUM_LITERAL_SYMBOLS, s->num_literal_htrees);
  ------------------
  |  |   17|  15.2k|#define BROTLI_NUM_LITERAL_SYMBOLS 256
  ------------------
 2304|  15.2k|        allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
 2305|  15.2k|            s, &s->insert_copy_hgroup, BROTLI_NUM_COMMAND_SYMBOLS,
  ------------------
  |  |   18|  15.2k|#define BROTLI_NUM_COMMAND_SYMBOLS 704
  ------------------
 2306|  15.2k|            BROTLI_NUM_COMMAND_SYMBOLS, s->num_block_types[1]);
  ------------------
  |  |   18|  15.2k|#define BROTLI_NUM_COMMAND_SYMBOLS 704
  ------------------
 2307|  15.2k|        allocation_success &= BrotliDecoderHuffmanTreeGroupInit(
 2308|  15.2k|            s, &s->distance_hgroup, num_distance_codes,
 2309|  15.2k|            max_distance_symbol, s->num_dist_htrees);
 2310|  15.2k|        if (!allocation_success) {
  ------------------
  |  Branch (2310:13): [True: 0, False: 15.2k]
  ------------------
 2311|      0|          return SaveErrorCode(s,
 2312|      0|              BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_TREE_GROUPS));
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2313|      0|        }
 2314|  15.2k|        s->loop_counter = 0;
 2315|  15.2k|        s->state = BROTLI_STATE_TREE_GROUP;
 2316|       |        /* No break, continue to next state. */
 2317|  15.2k|      }
 2318|       |
 2319|  45.3k|      case BROTLI_STATE_TREE_GROUP: {
  ------------------
  |  Branch (2319:7): [True: 30.0k, False: 563k]
  ------------------
 2320|  45.3k|        HuffmanTreeGroup* hgroup = NULL;
 2321|  45.3k|        switch (s->loop_counter) {
 2322|  15.2k|          case 0: hgroup = &s->literal_hgroup; break;
  ------------------
  |  Branch (2322:11): [True: 15.2k, False: 30.0k]
  ------------------
 2323|  15.0k|          case 1: hgroup = &s->insert_copy_hgroup; break;
  ------------------
  |  Branch (2323:11): [True: 15.0k, False: 30.2k]
  ------------------
 2324|  14.9k|          case 2: hgroup = &s->distance_hgroup; break;
  ------------------
  |  Branch (2324:11): [True: 14.9k, False: 30.3k]
  ------------------
 2325|      0|          default: return SaveErrorCode(s, BROTLI_FAILURE(
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  |  Branch (2325:11): [True: 0, False: 45.3k]
  ------------------
 2326|      0|              BROTLI_DECODER_ERROR_UNREACHABLE));
 2327|  45.3k|        }
 2328|  45.3k|        result = HuffmanTreeGroupDecode(hgroup, s);
 2329|  45.3k|        if (result != BROTLI_DECODER_SUCCESS) break;
  ------------------
  |  Branch (2329:13): [True: 422, False: 44.9k]
  ------------------
 2330|  44.9k|        s->loop_counter++;
 2331|  44.9k|        if (s->loop_counter >= 3) {
  ------------------
  |  Branch (2331:13): [True: 14.8k, False: 30.0k]
  ------------------
 2332|  14.8k|          PrepareLiteralDecoding(s);
 2333|  14.8k|          s->dist_context_map_slice = s->dist_context_map;
 2334|  14.8k|          s->htree_command = s->insert_copy_hgroup.htrees[0];
 2335|  14.8k|          if (!BrotliEnsureRingBuffer(s)) {
  ------------------
  |  Branch (2335:15): [True: 0, False: 14.8k]
  ------------------
 2336|      0|            result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_2);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2337|      0|            break;
 2338|      0|          }
 2339|  14.8k|          s->state = BROTLI_STATE_COMMAND_BEGIN;
 2340|  14.8k|        }
 2341|  44.9k|        break;
 2342|  44.9k|      }
 2343|       |
 2344|  44.9k|      case BROTLI_STATE_COMMAND_BEGIN:
  ------------------
  |  Branch (2344:7): [True: 15.6k, False: 577k]
  ------------------
 2345|  17.0k|      case BROTLI_STATE_COMMAND_INNER:
  ------------------
  |  Branch (2345:7): [True: 1.39k, False: 591k]
  ------------------
 2346|  17.5k|      case BROTLI_STATE_COMMAND_POST_DECODE_LITERALS:
  ------------------
  |  Branch (2346:7): [True: 566, False: 592k]
  ------------------
 2347|  19.5k|      case BROTLI_STATE_COMMAND_POST_WRAP_COPY:
  ------------------
  |  Branch (2347:7): [True: 2.00k, False: 591k]
  ------------------
 2348|  19.5k|        result = ProcessCommands(s);
 2349|  19.5k|        if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
  ------------------
  |  Branch (2349:13): [True: 3.65k, False: 15.9k]
  ------------------
 2350|  3.65k|          result = SafeProcessCommands(s);
 2351|  3.65k|        }
 2352|  19.5k|        break;
 2353|       |
 2354|  2.07k|      case BROTLI_STATE_COMMAND_INNER_WRITE:
  ------------------
  |  Branch (2354:7): [True: 2.07k, False: 591k]
  ------------------
 2355|  2.85k|      case BROTLI_STATE_COMMAND_POST_WRITE_1:
  ------------------
  |  Branch (2355:7): [True: 783, False: 592k]
  ------------------
 2356|  4.97k|      case BROTLI_STATE_COMMAND_POST_WRITE_2:
  ------------------
  |  Branch (2356:7): [True: 2.11k, False: 590k]
  ------------------
 2357|  4.97k|        result = WriteRingBuffer(
 2358|  4.97k|            s, available_out, next_out, total_out, BROTLI_FALSE);
  ------------------
  |  |   53|  4.97k|#define BROTLI_FALSE 0
  ------------------
 2359|  4.97k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2359:13): [True: 226, False: 4.74k]
  ------------------
 2360|    226|          break;
 2361|    226|        }
 2362|  4.74k|        WrapRingBuffer(s);
 2363|  4.74k|        if (s->ringbuffer_size == 1 << s->window_bits) {
  ------------------
  |  Branch (2363:13): [True: 4.71k, False: 31]
  ------------------
 2364|  4.71k|          s->max_distance = s->max_backward_distance;
 2365|  4.71k|        }
 2366|  4.74k|        if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_1) {
  ------------------
  |  Branch (2366:13): [True: 752, False: 3.99k]
  ------------------
 2367|    752|          if (s->meta_block_remaining_len == 0) {
  ------------------
  |  Branch (2367:15): [True: 2, False: 750]
  ------------------
 2368|       |            /* Next metablock, if any. */
 2369|      2|            s->state = BROTLI_STATE_METABLOCK_DONE;
 2370|    750|          } else {
 2371|    750|            s->state = BROTLI_STATE_COMMAND_BEGIN;
 2372|    750|          }
 2373|    752|          break;
 2374|  3.99k|        } else if (s->state == BROTLI_STATE_COMMAND_POST_WRITE_2) {
  ------------------
  |  Branch (2374:20): [True: 2.00k, False: 1.99k]
  ------------------
 2375|  2.00k|          s->state = BROTLI_STATE_COMMAND_POST_WRAP_COPY;
 2376|  2.00k|        } else {  /* BROTLI_STATE_COMMAND_INNER_WRITE */
 2377|  1.99k|          if (s->loop_counter == 0) {
  ------------------
  |  Branch (2377:15): [True: 605, False: 1.39k]
  ------------------
 2378|    605|            if (s->meta_block_remaining_len == 0) {
  ------------------
  |  Branch (2378:17): [True: 39, False: 566]
  ------------------
 2379|     39|              s->state = BROTLI_STATE_METABLOCK_DONE;
 2380|    566|            } else {
 2381|    566|              s->state = BROTLI_STATE_COMMAND_POST_DECODE_LITERALS;
 2382|    566|            }
 2383|    605|            break;
 2384|    605|          }
 2385|  1.39k|          s->state = BROTLI_STATE_COMMAND_INNER;
 2386|  1.39k|        }
 2387|  3.39k|        break;
 2388|       |
 2389|   154k|      case BROTLI_STATE_METABLOCK_DONE:
  ------------------
  |  Branch (2389:7): [True: 154k, False: 438k]
  ------------------
 2390|   154k|        if (s->meta_block_remaining_len < 0) {
  ------------------
  |  Branch (2390:13): [True: 249, False: 154k]
  ------------------
 2391|    249|          result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_2);
  ------------------
  |  |   31|    249|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|    249|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2392|    249|          break;
 2393|    249|        }
 2394|   154k|        BrotliDecoderStateCleanupAfterMetablock(s);
 2395|   154k|        if (!s->is_last_metablock) {
  ------------------
  |  Branch (2395:13): [True: 153k, False: 1.48k]
  ------------------
 2396|   153k|          s->state = BROTLI_STATE_METABLOCK_BEGIN;
 2397|   153k|          break;
 2398|   153k|        }
 2399|  1.48k|        if (!BrotliJumpToByteBoundary(br)) {
  ------------------
  |  Branch (2399:13): [True: 42, False: 1.44k]
  ------------------
 2400|     42|          result = BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_PADDING_2);
  ------------------
  |  |   31|     42|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     42|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 2401|     42|          break;
 2402|     42|        }
 2403|  1.44k|        if (s->buffer_length == 0) {
  ------------------
  |  Branch (2403:13): [True: 1.44k, False: 0]
  ------------------
 2404|  1.44k|          BrotliBitReaderUnload(br);
 2405|  1.44k|          *available_in = br->avail_in;
 2406|  1.44k|          *next_in = br->next_in;
 2407|  1.44k|        }
 2408|  1.44k|        s->state = BROTLI_STATE_DONE;
 2409|       |        /* No break, continue to next state. */
 2410|       |
 2411|  1.44k|      case BROTLI_STATE_DONE:
  ------------------
  |  Branch (2411:7): [True: 0, False: 593k]
  ------------------
 2412|  1.44k|        if (s->ringbuffer != 0) {
  ------------------
  |  Branch (2412:13): [True: 1.41k, False: 30]
  ------------------
 2413|  1.41k|          result = WriteRingBuffer(
 2414|  1.41k|              s, available_out, next_out, total_out, BROTLI_TRUE);
  ------------------
  |  |   51|  1.41k|#define BROTLI_TRUE 1
  ------------------
 2415|  1.41k|          if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (2415:15): [True: 5, False: 1.40k]
  ------------------
 2416|      5|            break;
 2417|      5|          }
 2418|  1.41k|        }
 2419|  1.43k|        return SaveErrorCode(s, result);
 2420|   593k|    }
 2421|   593k|  }
 2422|  5.24k|  return SaveErrorCode(s, result);
 2423|  6.68k|}
decode.c:SaveErrorCode:
  114|  6.68k|    BrotliDecoderState* s, BrotliDecoderErrorCode e) {
  115|  6.68k|  s->error_code = (int)e;
  116|  6.68k|  switch (e) {
  117|  1.43k|    case BROTLI_DECODER_SUCCESS:
  ------------------
  |  Branch (117:5): [True: 1.43k, False: 5.24k]
  ------------------
  118|  1.43k|      return BROTLI_DECODER_RESULT_SUCCESS;
  119|       |
  120|  4.04k|    case BROTLI_DECODER_NEEDS_MORE_INPUT:
  ------------------
  |  Branch (120:5): [True: 4.04k, False: 2.63k]
  ------------------
  121|  4.04k|      return BROTLI_DECODER_RESULT_NEEDS_MORE_INPUT;
  122|       |
  123|    139|    case BROTLI_DECODER_NEEDS_MORE_OUTPUT:
  ------------------
  |  Branch (123:5): [True: 139, False: 6.54k]
  ------------------
  124|    139|      return BROTLI_DECODER_RESULT_NEEDS_MORE_OUTPUT;
  125|       |
  126|  1.06k|    default:
  ------------------
  |  Branch (126:5): [True: 1.06k, False: 5.62k]
  ------------------
  127|  1.06k|      return BROTLI_DECODER_RESULT_ERROR;
  128|  6.68k|  }
  129|  6.68k|}
decode.c:WriteRingBuffer:
 1249|  7.87k|    size_t* total_out, BROTLI_BOOL force) {
 1250|  7.87k|  uint8_t* start =
 1251|  7.87k|      s->ringbuffer + (s->partial_pos_out & (size_t)s->ringbuffer_mask);
 1252|  7.87k|  size_t to_write = UnwrittenBytes(s, BROTLI_TRUE);
  ------------------
  |  |   51|  7.87k|#define BROTLI_TRUE 1
  ------------------
 1253|  7.87k|  size_t num_written = *available_out;
 1254|  7.87k|  if (num_written > to_write) {
  ------------------
  |  Branch (1254:7): [True: 5.45k, False: 2.41k]
  ------------------
 1255|  5.45k|    num_written = to_write;
 1256|  5.45k|  }
 1257|  7.87k|  if (s->meta_block_remaining_len < 0) {
  ------------------
  |  Branch (1257:7): [True: 118, False: 7.75k]
  ------------------
 1258|    118|    return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_BLOCK_LENGTH_1);
  ------------------
  |  |   31|    118|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|    118|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1259|    118|  }
 1260|  7.75k|  if (next_out && !*next_out) {
  ------------------
  |  Branch (1260:7): [True: 7.75k, False: 0]
  |  Branch (1260:19): [True: 0, False: 7.75k]
  ------------------
 1261|      0|    *next_out = start;
 1262|  7.75k|  } else {
 1263|  7.75k|    if (next_out) {
  ------------------
  |  Branch (1263:9): [True: 7.75k, False: 0]
  ------------------
 1264|  7.75k|      memcpy(*next_out, start, num_written);
 1265|  7.75k|      *next_out += num_written;
 1266|  7.75k|    }
 1267|  7.75k|  }
 1268|  7.75k|  *available_out -= num_written;
 1269|  7.75k|  BROTLI_LOG_UINT(to_write);
 1270|  7.75k|  BROTLI_LOG_UINT(num_written);
 1271|  7.75k|  s->partial_pos_out += num_written;
 1272|  7.75k|  if (total_out) {
  ------------------
  |  Branch (1272:7): [True: 7.75k, False: 0]
  ------------------
 1273|  7.75k|    *total_out = s->partial_pos_out;
 1274|  7.75k|  }
 1275|  7.75k|  if (num_written < to_write) {
  ------------------
  |  Branch (1275:7): [True: 903, False: 6.84k]
  ------------------
 1276|    903|    if (s->ringbuffer_size == (1 << s->window_bits) || force) {
  ------------------
  |  Branch (1276:9): [True: 435, False: 468]
  |  Branch (1276:56): [True: 445, False: 23]
  ------------------
 1277|    880|      return BROTLI_DECODER_NEEDS_MORE_OUTPUT;
 1278|    880|    } else {
 1279|     23|      return BROTLI_DECODER_SUCCESS;
 1280|     23|    }
 1281|    903|  }
 1282|       |  /* Wrap ring buffer only if it has reached its maximal size. */
 1283|  6.84k|  if (s->ringbuffer_size == (1 << s->window_bits) &&
  ------------------
  |  Branch (1283:7): [True: 5.28k, False: 1.56k]
  ------------------
 1284|  5.28k|      s->pos >= s->ringbuffer_size) {
  ------------------
  |  Branch (1284:7): [True: 5.07k, False: 211]
  ------------------
 1285|  5.07k|    s->pos -= s->ringbuffer_size;
 1286|  5.07k|    s->rb_roundtrips++;
 1287|  5.07k|    s->should_wrap_ringbuffer = (size_t)s->pos != 0 ? 1 : 0;
  ------------------
  |  Branch (1287:33): [True: 688, False: 4.38k]
  ------------------
 1288|  5.07k|  }
 1289|  6.84k|  return BROTLI_DECODER_SUCCESS;
 1290|  7.75k|}
decode.c:DecodeWindowBits:
  134|  4.65k|                                               BrotliBitReader* br) {
  135|  4.65k|  uint32_t n;
  136|  4.65k|  BROTLI_BOOL large_window = s->large_window;
  ------------------
  |  |   49|  4.65k|#define BROTLI_BOOL int
  ------------------
  137|  4.65k|  s->large_window = BROTLI_FALSE;
  ------------------
  |  |   53|  4.65k|#define BROTLI_FALSE 0
  ------------------
  138|  4.65k|  BrotliTakeBits(br, 1, &n);
  139|  4.65k|  if (n == 0) {
  ------------------
  |  Branch (139:7): [True: 2.61k, False: 2.03k]
  ------------------
  140|  2.61k|    s->window_bits = 16;
  141|  2.61k|    return BROTLI_DECODER_SUCCESS;
  142|  2.61k|  }
  143|  2.03k|  BrotliTakeBits(br, 3, &n);
  144|  2.03k|  if (n != 0) {
  ------------------
  |  Branch (144:7): [True: 1.56k, False: 469]
  ------------------
  145|  1.56k|    s->window_bits = 17 + n;
  146|  1.56k|    return BROTLI_DECODER_SUCCESS;
  147|  1.56k|  }
  148|    469|  BrotliTakeBits(br, 3, &n);
  149|    469|  if (n == 1) {
  ------------------
  |  Branch (149:7): [True: 5, False: 464]
  ------------------
  150|      5|    if (large_window) {
  ------------------
  |  Branch (150:9): [True: 0, False: 5]
  ------------------
  151|      0|      BrotliTakeBits(br, 1, &n);
  152|      0|      if (n == 1) {
  ------------------
  |  Branch (152:11): [True: 0, False: 0]
  ------------------
  153|      0|        return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  154|      0|      }
  155|      0|      s->large_window = BROTLI_TRUE;
  ------------------
  |  |   51|      0|#define BROTLI_TRUE 1
  ------------------
  156|      0|      return BROTLI_DECODER_SUCCESS;
  157|      5|    } else {
  158|      5|      return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_WINDOW_BITS);
  ------------------
  |  |   31|      5|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      5|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  159|      5|    }
  160|      5|  }
  161|    464|  if (n != 0) {
  ------------------
  |  Branch (161:7): [True: 377, False: 87]
  ------------------
  162|    377|    s->window_bits = 8 + n;
  163|    377|    return BROTLI_DECODER_SUCCESS;
  164|    377|  }
  165|     87|  s->window_bits = 17;
  166|     87|  return BROTLI_DECODER_SUCCESS;
  167|    464|}
decode.c:DecodeMetaBlockLength:
  225|   157k|    BrotliDecoderState* s, BrotliBitReader* br) {
  226|   157k|  uint32_t bits;
  227|   157k|  int i;
  228|   448k|  for (;;) {
  229|   448k|    switch (s->substate_metablock_header) {
  230|   157k|      case BROTLI_STATE_METABLOCK_HEADER_NONE:
  ------------------
  |  Branch (230:7): [True: 157k, False: 291k]
  ------------------
  231|   157k|        if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (231:13): [True: 25, False: 157k]
  ------------------
  232|     25|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  233|     25|        }
  234|   157k|        s->is_last_metablock = bits ? 1 : 0;
  ------------------
  |  Branch (234:32): [True: 2.18k, False: 155k]
  ------------------
  235|   157k|        s->meta_block_remaining_len = 0;
  236|   157k|        s->is_uncompressed = 0;
  237|   157k|        s->is_metadata = 0;
  238|   157k|        if (!s->is_last_metablock) {
  ------------------
  |  Branch (238:13): [True: 155k, False: 2.18k]
  ------------------
  239|   155k|          s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NIBBLES;
  240|   155k|          break;
  241|   155k|        }
  242|  2.18k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_EMPTY;
  243|       |        /* No break, transit to the next state. */
  244|       |
  245|  2.18k|      case BROTLI_STATE_METABLOCK_HEADER_EMPTY:
  ------------------
  |  Branch (245:7): [True: 0, False: 448k]
  ------------------
  246|  2.18k|        if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (246:13): [True: 11, False: 2.17k]
  ------------------
  247|     11|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  248|     11|        }
  249|  2.17k|        if (bits) {
  ------------------
  |  Branch (249:13): [True: 473, False: 1.69k]
  ------------------
  250|    473|          s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
  251|    473|          return BROTLI_DECODER_SUCCESS;
  252|    473|        }
  253|  1.69k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NIBBLES;
  254|       |        /* No break, transit to the next state. */
  255|       |
  256|   157k|      case BROTLI_STATE_METABLOCK_HEADER_NIBBLES:
  ------------------
  |  Branch (256:7): [True: 155k, False: 293k]
  ------------------
  257|   157k|        if (!BrotliSafeReadBits(br, 2, &bits)) {
  ------------------
  |  Branch (257:13): [True: 19, False: 157k]
  ------------------
  258|     19|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  259|     19|        }
  260|   157k|        s->size_nibbles = (uint8_t)(bits + 4);
  261|   157k|        s->loop_counter = 0;
  262|   157k|        if (bits == 3) {
  ------------------
  |  Branch (262:13): [True: 135k, False: 21.6k]
  ------------------
  263|   135k|          s->is_metadata = 1;
  264|   135k|          s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_RESERVED;
  265|   135k|          break;
  266|   135k|        }
  267|  21.6k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_SIZE;
  268|       |        /* No break, transit to the next state. */
  269|       |
  270|  21.6k|      case BROTLI_STATE_METABLOCK_HEADER_SIZE:
  ------------------
  |  Branch (270:7): [True: 0, False: 448k]
  ------------------
  271|  21.6k|        i = s->loop_counter;
  272|   108k|        for (; i < (int)s->size_nibbles; ++i) {
  ------------------
  |  Branch (272:16): [True: 87.3k, False: 21.3k]
  ------------------
  273|  87.3k|          if (!BrotliSafeReadBits(br, 4, &bits)) {
  ------------------
  |  Branch (273:15): [True: 277, False: 87.1k]
  ------------------
  274|    277|            s->loop_counter = i;
  275|    277|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
  276|    277|          }
  277|  87.1k|          if (i + 1 == s->size_nibbles && s->size_nibbles > 4 && bits == 0) {
  ------------------
  |  Branch (277:15): [True: 21.3k, False: 65.7k]
  |  Branch (277:43): [True: 831, False: 20.4k]
  |  Branch (277:66): [True: 10, False: 821]
  ------------------
  278|     10|            return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_NIBBLE);
  ------------------
  |  |   31|     10|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     10|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  279|     10|          }
  280|  87.0k|          s->meta_block_remaining_len |= (int)(bits << (i * 4));
  281|  87.0k|        }
  282|  21.3k|        s->substate_metablock_header =
  283|  21.3k|            BROTLI_STATE_METABLOCK_HEADER_UNCOMPRESSED;
  284|       |        /* No break, transit to the next state. */
  285|       |
  286|  21.3k|      case BROTLI_STATE_METABLOCK_HEADER_UNCOMPRESSED:
  ------------------
  |  Branch (286:7): [True: 0, False: 448k]
  ------------------
  287|  21.3k|        if (!s->is_last_metablock) {
  ------------------
  |  Branch (287:13): [True: 19.8k, False: 1.42k]
  ------------------
  288|  19.8k|          if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (288:15): [True: 3, False: 19.8k]
  ------------------
  289|      3|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
  290|      3|          }
  291|  19.8k|          s->is_uncompressed = bits ? 1 : 0;
  ------------------
  |  Branch (291:32): [True: 5.47k, False: 14.4k]
  ------------------
  292|  19.8k|        }
  293|  21.3k|        ++s->meta_block_remaining_len;
  294|  21.3k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
  295|  21.3k|        return BROTLI_DECODER_SUCCESS;
  296|       |
  297|   135k|      case BROTLI_STATE_METABLOCK_HEADER_RESERVED:
  ------------------
  |  Branch (297:7): [True: 135k, False: 313k]
  ------------------
  298|   135k|        if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (298:13): [True: 10, False: 135k]
  ------------------
  299|     10|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  300|     10|        }
  301|   135k|        if (bits != 0) {
  ------------------
  |  Branch (301:13): [True: 14, False: 135k]
  ------------------
  302|     14|          return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_RESERVED);
  ------------------
  |  |   31|     14|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     14|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  303|     14|        }
  304|   135k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_BYTES;
  305|       |        /* No break, transit to the next state. */
  306|       |
  307|   135k|      case BROTLI_STATE_METABLOCK_HEADER_BYTES:
  ------------------
  |  Branch (307:7): [True: 0, False: 448k]
  ------------------
  308|   135k|        if (!BrotliSafeReadBits(br, 2, &bits)) {
  ------------------
  |  Branch (308:13): [True: 13, False: 135k]
  ------------------
  309|     13|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  310|     13|        }
  311|   135k|        if (bits == 0) {
  ------------------
  |  Branch (311:13): [True: 106k, False: 29.3k]
  ------------------
  312|   106k|          s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
  313|   106k|          return BROTLI_DECODER_SUCCESS;
  314|   106k|        }
  315|  29.3k|        s->size_nibbles = (uint8_t)bits;
  316|  29.3k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_METADATA;
  317|       |        /* No break, transit to the next state. */
  318|       |
  319|  29.3k|      case BROTLI_STATE_METABLOCK_HEADER_METADATA:
  ------------------
  |  Branch (319:7): [True: 0, False: 448k]
  ------------------
  320|  29.3k|        i = s->loop_counter;
  321|  58.8k|        for (; i < (int)s->size_nibbles; ++i) {
  ------------------
  |  Branch (321:16): [True: 29.5k, False: 29.3k]
  ------------------
  322|  29.5k|          if (!BrotliSafeReadBits(br, 8, &bits)) {
  ------------------
  |  Branch (322:15): [True: 22, False: 29.5k]
  ------------------
  323|     22|            s->loop_counter = i;
  324|     22|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
  325|     22|          }
  326|  29.5k|          if (i + 1 == s->size_nibbles && s->size_nibbles > 1 && bits == 0) {
  ------------------
  |  Branch (326:15): [True: 29.3k, False: 225]
  |  Branch (326:43): [True: 186, False: 29.1k]
  |  Branch (326:66): [True: 5, False: 181]
  ------------------
  327|      5|            return BROTLI_FAILURE(
  ------------------
  |  |   31|      5|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      5|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  328|      5|                BROTLI_DECODER_ERROR_FORMAT_EXUBERANT_META_NIBBLE);
  329|      5|          }
  330|  29.5k|          s->meta_block_remaining_len |= (int)(bits << (i * 8));
  331|  29.5k|        }
  332|  29.3k|        ++s->meta_block_remaining_len;
  333|  29.3k|        s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
  334|  29.3k|        return BROTLI_DECODER_SUCCESS;
  335|       |
  336|      0|      default:
  ------------------
  |  Branch (336:7): [True: 0, False: 448k]
  ------------------
  337|      0|        return
  338|      0|            BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  339|   448k|    }
  340|   448k|  }
  341|   157k|}
decode.c:BrotliCalculateRingBufferSize:
 1393|  21.3k|    BrotliDecoderState* s) {
 1394|  21.3k|  int window_size = 1 << s->window_bits;
 1395|  21.3k|  int new_ringbuffer_size = window_size;
 1396|       |  /* We need at least 2 bytes of ring buffer size to get the last two
 1397|       |     bytes for context from there */
 1398|  21.3k|  int min_size = s->ringbuffer_size ? s->ringbuffer_size : 1024;
  ------------------
  |  Branch (1398:18): [True: 17.1k, False: 4.18k]
  ------------------
 1399|  21.3k|  int output_size;
 1400|       |
 1401|       |  /* If maximum is already reached, no further extension is retired. */
 1402|  21.3k|  if (s->ringbuffer_size == window_size) {
  ------------------
  |  Branch (1402:7): [True: 3.85k, False: 17.4k]
  ------------------
 1403|  3.85k|    return;
 1404|  3.85k|  }
 1405|       |
 1406|       |  /* Metadata blocks does not touch ring buffer. */
 1407|  17.4k|  if (s->is_metadata) {
  ------------------
  |  Branch (1407:7): [True: 0, False: 17.4k]
  ------------------
 1408|      0|    return;
 1409|      0|  }
 1410|       |
 1411|  17.4k|  if (!s->ringbuffer) {
  ------------------
  |  Branch (1411:7): [True: 4.18k, False: 13.2k]
  ------------------
 1412|  4.18k|    output_size = 0;
 1413|  13.2k|  } else {
 1414|  13.2k|    output_size = s->pos;
 1415|  13.2k|  }
 1416|  17.4k|  output_size += s->meta_block_remaining_len;
 1417|  17.4k|  min_size = min_size < output_size ? output_size : min_size;
  ------------------
  |  Branch (1417:14): [True: 3.04k, False: 14.4k]
  ------------------
 1418|       |
 1419|  17.4k|  if (!!s->canny_ringbuffer_allocation) {
  ------------------
  |  Branch (1419:7): [True: 17.4k, False: 0]
  ------------------
 1420|       |    /* Reduce ring buffer size to save memory when server is unscrupulous.
 1421|       |       In worst case memory usage might be 1.5x bigger for a short period of
 1422|       |       ring buffer reallocation. */
 1423|  80.4k|    while ((new_ringbuffer_size >> 1) >= min_size) {
  ------------------
  |  Branch (1423:12): [True: 62.9k, False: 17.4k]
  ------------------
 1424|  62.9k|      new_ringbuffer_size >>= 1;
 1425|  62.9k|    }
 1426|  17.4k|  }
 1427|       |
 1428|  17.4k|  s->new_ringbuffer_size = new_ringbuffer_size;
 1429|  17.4k|}
decode.c:CopyUncompressedBlockToOutput:
 1337|  5.45k|    BrotliDecoderState* s) {
 1338|       |  /* TODO: avoid allocation for single uncompressed block. */
 1339|  5.45k|  if (!BrotliEnsureRingBuffer(s)) {
  ------------------
  |  Branch (1339:7): [True: 0, False: 5.45k]
  ------------------
 1340|      0|    return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_RING_BUFFER_1);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1341|      0|  }
 1342|       |
 1343|       |  /* State machine */
 1344|  5.81k|  for (;;) {
 1345|  5.81k|    switch (s->substate_uncompressed) {
  ------------------
  |  Branch (1345:13): [True: 5.81k, False: 0]
  ------------------
 1346|  5.81k|      case BROTLI_STATE_UNCOMPRESSED_NONE: {
  ------------------
  |  Branch (1346:7): [True: 5.81k, False: 0]
  ------------------
 1347|  5.81k|        int nbytes = (int)BrotliGetRemainingBytes(&s->br);
 1348|  5.81k|        if (nbytes > s->meta_block_remaining_len) {
  ------------------
  |  Branch (1348:13): [True: 5.33k, False: 478]
  ------------------
 1349|  5.33k|          nbytes = s->meta_block_remaining_len;
 1350|  5.33k|        }
 1351|  5.81k|        if (s->pos + nbytes > s->ringbuffer_size) {
  ------------------
  |  Branch (1351:13): [True: 354, False: 5.45k]
  ------------------
 1352|    354|          nbytes = s->ringbuffer_size - s->pos;
 1353|    354|        }
 1354|       |        /* Copy remaining bytes from s->br.buf_ to ring-buffer. */
 1355|  5.81k|        BrotliCopyBytes(&s->ringbuffer[s->pos], &s->br, (size_t)nbytes);
 1356|  5.81k|        s->pos += nbytes;
 1357|  5.81k|        s->meta_block_remaining_len -= nbytes;
 1358|  5.81k|        if (s->pos < 1 << s->window_bits) {
  ------------------
  |  Branch (1358:13): [True: 5.44k, False: 363]
  ------------------
 1359|  5.44k|          if (s->meta_block_remaining_len == 0) {
  ------------------
  |  Branch (1359:15): [True: 5.31k, False: 130]
  ------------------
 1360|  5.31k|            return BROTLI_DECODER_SUCCESS;
 1361|  5.31k|          }
 1362|    130|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1363|  5.44k|        }
 1364|    363|        s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_WRITE;
 1365|       |        /* No break, continue to next state. */
 1366|    363|      }
 1367|       |
 1368|    363|      case BROTLI_STATE_UNCOMPRESSED_WRITE: {
  ------------------
  |  Branch (1368:7): [True: 0, False: 5.81k]
  ------------------
 1369|    363|        BrotliDecoderErrorCode result;
 1370|    363|        result = WriteRingBuffer(
 1371|    363|            s, available_out, next_out, total_out, BROTLI_FALSE);
  ------------------
  |  |   53|    363|#define BROTLI_FALSE 0
  ------------------
 1372|    363|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (1372:13): [True: 4, False: 359]
  ------------------
 1373|      4|          return result;
 1374|      4|        }
 1375|    359|        if (s->ringbuffer_size == 1 << s->window_bits) {
  ------------------
  |  Branch (1375:13): [True: 359, False: 0]
  ------------------
 1376|    359|          s->max_distance = s->max_backward_distance;
 1377|    359|        }
 1378|    359|        s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_NONE;
 1379|    359|        break;
 1380|    363|      }
 1381|  5.81k|    }
 1382|  5.81k|  }
 1383|      0|  BROTLI_DCHECK(0);  /* Unreachable */
 1384|      0|}
decode.c:DecodeVarLenUint8:
  181|  78.0k|    BrotliDecoderState* s, BrotliBitReader* br, uint32_t* value) {
  182|  78.0k|  uint32_t bits;
  183|  78.0k|  switch (s->substate_decode_uint8) {
  184|  78.0k|    case BROTLI_STATE_DECODE_UINT8_NONE:
  ------------------
  |  Branch (184:5): [True: 78.0k, False: 0]
  ------------------
  185|  78.0k|      if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 1, &bits))) {
  ------------------
  |  |  318|  78.0k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 13, False: 78.0k]
  |  |  ------------------
  ------------------
  186|     13|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
  187|     13|      }
  188|  78.0k|      if (bits == 0) {
  ------------------
  |  Branch (188:11): [True: 66.8k, False: 11.1k]
  ------------------
  189|  66.8k|        *value = 0;
  190|  66.8k|        return BROTLI_DECODER_SUCCESS;
  191|  66.8k|      }
  192|       |      /* No break, transit to the next state. */
  193|       |
  194|  11.1k|    case BROTLI_STATE_DECODE_UINT8_SHORT:
  ------------------
  |  Branch (194:5): [True: 0, False: 78.0k]
  ------------------
  195|  11.1k|      if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, 3, &bits))) {
  ------------------
  |  |  318|  11.1k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 13, False: 11.1k]
  |  |  ------------------
  ------------------
  196|     13|        s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_SHORT;
  197|     13|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
  198|     13|      }
  199|  11.1k|      if (bits == 0) {
  ------------------
  |  Branch (199:11): [True: 1.00k, False: 10.1k]
  ------------------
  200|  1.00k|        *value = 1;
  201|  1.00k|        s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
  202|  1.00k|        return BROTLI_DECODER_SUCCESS;
  203|  1.00k|      }
  204|       |      /* Use output value as a temporary storage. It MUST be persisted. */
  205|  10.1k|      *value = bits;
  206|       |      /* No break, transit to the next state. */
  207|       |
  208|  10.1k|    case BROTLI_STATE_DECODE_UINT8_LONG:
  ------------------
  |  Branch (208:5): [True: 0, False: 78.0k]
  ------------------
  209|  10.1k|      if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, *value, &bits))) {
  ------------------
  |  |  318|  10.1k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 10, False: 10.1k]
  |  |  ------------------
  ------------------
  210|     10|        s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_LONG;
  211|     10|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
  212|     10|      }
  213|  10.1k|      *value = (1U << *value) + bits;
  214|  10.1k|      s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
  215|  10.1k|      return BROTLI_DECODER_SUCCESS;
  216|       |
  217|      0|    default:
  ------------------
  |  Branch (217:5): [True: 0, False: 78.0k]
  ------------------
  218|      0|      return
  219|      0|          BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  220|  78.0k|  }
  221|  78.0k|}
decode.c:ReadHuffmanCode:
  734|  86.8k|                                              BrotliDecoderState* s) {
  735|  86.8k|  BrotliBitReader* br = &s->br;
  736|       |  /* Unnecessary masking, but might be good for safety. */
  737|  86.8k|  alphabet_size &= 0x7FF;
  738|       |  /* State machine. */
  739|   114k|  for (;;) {
  740|   114k|    switch (s->substate_huffman) {
  741|  86.8k|      case BROTLI_STATE_HUFFMAN_NONE:
  ------------------
  |  Branch (741:7): [True: 86.8k, False: 27.6k]
  ------------------
  742|  86.8k|        if (!BrotliSafeReadBits(br, 2, &s->sub_loop_counter)) {
  ------------------
  |  Branch (742:13): [True: 63, False: 86.7k]
  ------------------
  743|     63|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  744|     63|        }
  745|  86.7k|        BROTLI_LOG_UINT(s->sub_loop_counter);
  746|       |        /* The value is used as follows:
  747|       |           1 for simple code;
  748|       |           0 for no skipping, 2 skips 2 code lengths, 3 skips 3 code lengths */
  749|  86.7k|        if (s->sub_loop_counter != 1) {
  ------------------
  |  Branch (749:13): [True: 27.6k, False: 59.1k]
  ------------------
  750|  27.6k|          s->space = 32;
  751|  27.6k|          s->repeat = 0;  /* num_codes */
  752|  27.6k|          memset(&s->code_length_histo[0], 0, sizeof(s->code_length_histo[0]) *
  753|  27.6k|              (BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH + 1));
  ------------------
  |  |   34|  27.6k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
  ------------------
  754|  27.6k|          memset(&s->code_length_code_lengths[0], 0,
  755|  27.6k|              sizeof(s->code_length_code_lengths));
  756|  27.6k|          s->substate_huffman = BROTLI_STATE_HUFFMAN_COMPLEX;
  757|  27.6k|          continue;
  758|  27.6k|        }
  759|       |        /* No break, transit to the next state. */
  760|       |
  761|  59.1k|      case BROTLI_STATE_HUFFMAN_SIMPLE_SIZE:
  ------------------
  |  Branch (761:7): [True: 0, False: 114k]
  ------------------
  762|       |        /* Read symbols, codes & code lengths directly. */
  763|  59.1k|        if (!BrotliSafeReadBits(br, 2, &s->symbol)) {  /* num_symbols */
  ------------------
  |  Branch (763:13): [True: 36, False: 59.1k]
  ------------------
  764|     36|          s->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_SIZE;
  765|     36|          return BROTLI_DECODER_NEEDS_MORE_INPUT;
  766|     36|        }
  767|  59.1k|        s->sub_loop_counter = 0;
  768|       |        /* No break, transit to the next state. */
  769|       |
  770|  59.1k|      case BROTLI_STATE_HUFFMAN_SIMPLE_READ: {
  ------------------
  |  Branch (770:7): [True: 0, False: 114k]
  ------------------
  771|  59.1k|        BrotliDecoderErrorCode result =
  772|  59.1k|            ReadSimpleHuffmanSymbols(alphabet_size, max_symbol, s);
  773|  59.1k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (773:13): [True: 76, False: 59.0k]
  ------------------
  774|     76|          return result;
  775|     76|        }
  776|       |        /* No break, transit to the next state. */
  777|  59.1k|      }
  778|       |
  779|  59.0k|      case BROTLI_STATE_HUFFMAN_SIMPLE_BUILD: {
  ------------------
  |  Branch (779:7): [True: 0, False: 114k]
  ------------------
  780|  59.0k|        uint32_t table_size;
  781|  59.0k|        if (s->symbol == 3) {
  ------------------
  |  Branch (781:13): [True: 1.80k, False: 57.2k]
  ------------------
  782|  1.80k|          uint32_t bits;
  783|  1.80k|          if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (783:15): [True: 3, False: 1.80k]
  ------------------
  784|      3|            s->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_BUILD;
  785|      3|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
  786|      3|          }
  787|  1.80k|          s->symbol += bits;
  788|  1.80k|        }
  789|  59.0k|        BROTLI_LOG_UINT(s->symbol);
  790|  59.0k|        table_size = BrotliBuildSimpleHuffmanTable(
  791|  59.0k|            table, HUFFMAN_TABLE_BITS, s->symbols_lists_array, s->symbol);
  ------------------
  |  |   39|  59.0k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  792|  59.0k|        if (opt_table_size) {
  ------------------
  |  Branch (792:13): [True: 40.6k, False: 18.3k]
  ------------------
  793|  40.6k|          *opt_table_size = table_size;
  794|  40.6k|        }
  795|  59.0k|        s->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
  796|  59.0k|        return BROTLI_DECODER_SUCCESS;
  797|  59.0k|      }
  798|       |
  799|       |      /* Decode Huffman-coded code lengths. */
  800|  27.6k|      case BROTLI_STATE_HUFFMAN_COMPLEX: {
  ------------------
  |  Branch (800:7): [True: 27.6k, False: 86.8k]
  ------------------
  801|  27.6k|        uint32_t i;
  802|  27.6k|        BrotliDecoderErrorCode result = ReadCodeLengthCodeLengths(s);
  803|  27.6k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (803:13): [True: 277, False: 27.3k]
  ------------------
  804|    277|          return result;
  805|    277|        }
  806|  27.3k|        BrotliBuildCodeLengthsHuffmanTable(s->table,
  807|  27.3k|                                           s->code_length_code_lengths,
  808|  27.3k|                                           s->code_length_histo);
  809|  27.3k|        memset(&s->code_length_histo[0], 0, sizeof(s->code_length_histo));
  810|   465k|        for (i = 0; i <= BROTLI_HUFFMAN_MAX_CODE_LENGTH; ++i) {
  ------------------
  |  |   19|   465k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  |  Branch (810:21): [True: 437k, False: 27.3k]
  ------------------
  811|   437k|          s->next_symbol[i] = (int)i - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
  ------------------
  |  |   19|   437k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  812|   437k|          s->symbol_lists[s->next_symbol[i]] = 0xFFFF;
  813|   437k|        }
  814|       |
  815|  27.3k|        s->symbol = 0;
  816|  27.3k|        s->prev_code_len = BROTLI_INITIAL_REPEATED_CODE_LENGTH;
  ------------------
  |  |   29|  27.3k|#define BROTLI_INITIAL_REPEATED_CODE_LENGTH 8
  ------------------
  817|  27.3k|        s->repeat = 0;
  818|  27.3k|        s->repeat_code_len = 0;
  819|  27.3k|        s->space = 32768;
  820|  27.3k|        s->substate_huffman = BROTLI_STATE_HUFFMAN_LENGTH_SYMBOLS;
  821|       |        /* No break, transit to the next state. */
  822|  27.3k|      }
  823|       |
  824|  27.3k|      case BROTLI_STATE_HUFFMAN_LENGTH_SYMBOLS: {
  ------------------
  |  Branch (824:7): [True: 0, False: 114k]
  ------------------
  825|  27.3k|        uint32_t table_size;
  826|  27.3k|        BrotliDecoderErrorCode result = ReadSymbolCodeLengths(max_symbol, s);
  827|  27.3k|        if (result == BROTLI_DECODER_NEEDS_MORE_INPUT) {
  ------------------
  |  Branch (827:13): [True: 522, False: 26.8k]
  ------------------
  828|    522|          result = SafeReadSymbolCodeLengths(max_symbol, s);
  829|    522|        }
  830|  27.3k|        if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (830:13): [True: 116, False: 27.2k]
  ------------------
  831|    116|          return result;
  832|    116|        }
  833|       |
  834|  27.2k|        if (s->space != 0) {
  ------------------
  |  Branch (834:13): [True: 167, False: 27.0k]
  ------------------
  835|    167|          BROTLI_LOG(("[ReadHuffmanCode] space = %d\n", s->space));
  836|    167|          return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_HUFFMAN_SPACE);
  ------------------
  |  |   31|    167|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|    167|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  837|    167|        }
  838|  27.0k|        table_size = BrotliBuildHuffmanTable(
  839|  27.0k|            table, HUFFMAN_TABLE_BITS, s->symbol_lists, s->code_length_histo);
  ------------------
  |  |   39|  27.0k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  840|  27.0k|        if (opt_table_size) {
  ------------------
  |  Branch (840:13): [True: 25.0k, False: 2.04k]
  ------------------
  841|  25.0k|          *opt_table_size = table_size;
  842|  25.0k|        }
  843|  27.0k|        s->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
  844|  27.0k|        return BROTLI_DECODER_SUCCESS;
  845|  27.2k|      }
  846|       |
  847|      0|      default:
  ------------------
  |  Branch (847:7): [True: 0, False: 114k]
  ------------------
  848|      0|        return
  849|      0|            BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  850|   114k|    }
  851|   114k|  }
  852|  86.8k|}
decode.c:ReadSimpleHuffmanSymbols:
  468|  59.1k|    uint32_t alphabet_size, uint32_t max_symbol, BrotliDecoderState* s) {
  469|       |  /* max_bits == 1..11; symbol == 0..3; 1..44 bits will be read. */
  470|  59.1k|  BrotliBitReader* br = &s->br;
  471|  59.1k|  uint32_t max_bits = Log2Floor(alphabet_size - 1);
  472|  59.1k|  uint32_t i = s->sub_loop_counter;
  473|  59.1k|  uint32_t num_symbols = s->symbol;
  474|   158k|  while (i <= num_symbols) {
  ------------------
  |  Branch (474:10): [True: 99.0k, False: 59.0k]
  ------------------
  475|  99.0k|    uint32_t v;
  476|  99.0k|    if (BROTLI_PREDICT_FALSE(!BrotliSafeReadBits(br, max_bits, &v))) {
  ------------------
  |  |  318|  99.0k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 41, False: 99.0k]
  |  |  ------------------
  ------------------
  477|     41|      s->sub_loop_counter = i;
  478|     41|      s->substate_huffman = BROTLI_STATE_HUFFMAN_SIMPLE_READ;
  479|     41|      return BROTLI_DECODER_NEEDS_MORE_INPUT;
  480|     41|    }
  481|  99.0k|    if (v >= max_symbol) {
  ------------------
  |  Branch (481:9): [True: 24, False: 99.0k]
  ------------------
  482|     24|      return
  483|     24|          BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_ALPHABET);
  ------------------
  |  |   31|     24|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     24|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  484|     24|    }
  485|  99.0k|    s->symbols_lists_array[i] = (uint16_t)v;
  486|  99.0k|    BROTLI_LOG_UINT(s->symbols_lists_array[i]);
  487|  99.0k|    ++i;
  488|  99.0k|  }
  489|       |
  490|  98.9k|  for (i = 0; i < num_symbols; ++i) {
  ------------------
  |  Branch (490:15): [True: 39.9k, False: 59.0k]
  ------------------
  491|  39.9k|    uint32_t k = i + 1;
  492|  97.2k|    for (; k <= num_symbols; ++k) {
  ------------------
  |  Branch (492:12): [True: 57.3k, False: 39.9k]
  ------------------
  493|  57.3k|      if (s->symbols_lists_array[i] == s->symbols_lists_array[k]) {
  ------------------
  |  Branch (493:11): [True: 11, False: 57.3k]
  ------------------
  494|     11|        return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_SIMPLE_HUFFMAN_SAME);
  ------------------
  |  |   31|     11|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     11|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  495|     11|      }
  496|  57.3k|    }
  497|  39.9k|  }
  498|       |
  499|  59.0k|  return BROTLI_DECODER_SUCCESS;
  500|  59.0k|}
decode.c:Log2Floor:
  455|  59.1k|static BROTLI_INLINE uint32_t Log2Floor(uint32_t x) {
  456|  59.1k|  uint32_t result = 0;
  457|   461k|  while (x) {
  ------------------
  |  Branch (457:10): [True: 402k, False: 59.1k]
  ------------------
  458|   402k|    x >>= 1;
  459|   402k|    ++result;
  460|   402k|  }
  461|  59.1k|  return result;
  462|  59.1k|}
decode.c:ReadCodeLengthCodeLengths:
  675|  27.6k|static BrotliDecoderErrorCode ReadCodeLengthCodeLengths(BrotliDecoderState* s) {
  676|  27.6k|  BrotliBitReader* br = &s->br;
  677|  27.6k|  uint32_t num_codes = s->repeat;
  678|  27.6k|  unsigned space = s->space;
  679|  27.6k|  uint32_t i = s->sub_loop_counter;
  680|   238k|  for (; i < BROTLI_CODE_LENGTH_CODES; ++i) {
  ------------------
  |  |   27|   238k|#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
  |  |  ------------------
  |  |  |  |   26|   238k|#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
  |  |  ------------------
  ------------------
  |  Branch (680:10): [True: 238k, False: 448]
  ------------------
  681|   238k|    const uint8_t code_len_idx = kCodeLengthCodeOrder[i];
  682|   238k|    uint32_t ix;
  683|   238k|    uint32_t v;
  684|   238k|    if (BROTLI_PREDICT_FALSE(!BrotliSafeGetBits(br, 4, &ix))) {
  ------------------
  |  |  318|   238k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 288, False: 238k]
  |  |  ------------------
  ------------------
  685|    288|      uint32_t available_bits = BrotliGetAvailableBits(br);
  686|    288|      if (available_bits != 0) {
  ------------------
  |  Branch (686:11): [True: 220, False: 68]
  ------------------
  687|    220|        ix = BrotliGetBitsUnmasked(br) & 0xF;
  688|    220|      } else {
  689|     68|        ix = 0;
  690|     68|      }
  691|    288|      if (kCodeLengthPrefixLength[ix] > available_bits) {
  ------------------
  |  Branch (691:11): [True: 151, False: 137]
  ------------------
  692|    151|        s->sub_loop_counter = i;
  693|    151|        s->repeat = num_codes;
  694|    151|        s->space = space;
  695|    151|        s->substate_huffman = BROTLI_STATE_HUFFMAN_COMPLEX;
  696|    151|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
  697|    151|      }
  698|    288|    }
  699|   238k|    v = kCodeLengthPrefixValue[ix];
  700|   238k|    BrotliDropBits(br, kCodeLengthPrefixLength[ix]);
  701|   238k|    s->code_length_code_lengths[code_len_idx] = (uint8_t)v;
  702|   238k|    BROTLI_LOG_ARRAY_INDEX(s->code_length_code_lengths, code_len_idx);
  703|   238k|    if (v != 0) {
  ------------------
  |  Branch (703:9): [True: 194k, False: 44.2k]
  ------------------
  704|   194k|      space = space - (32U >> v);
  705|   194k|      ++num_codes;
  706|   194k|      ++s->code_length_histo[v];
  707|   194k|      if (space - 1U >= 32U) {
  ------------------
  |  Branch (707:11): [True: 27.0k, False: 167k]
  ------------------
  708|       |        /* space is 0 or wrapped around. */
  709|  27.0k|        break;
  710|  27.0k|      }
  711|   194k|    }
  712|   238k|  }
  713|  27.4k|  if (!(num_codes == 1 || space == 0)) {
  ------------------
  |  Branch (713:9): [True: 368, False: 27.1k]
  |  Branch (713:27): [True: 27.0k, False: 126]
  ------------------
  714|    126|    return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CL_SPACE);
  ------------------
  |  |   31|    126|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|    126|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  715|    126|  }
  716|  27.3k|  return BROTLI_DECODER_SUCCESS;
  717|  27.4k|}
decode.c:ReadSymbolCodeLengths:
  583|  27.3k|    uint32_t alphabet_size, BrotliDecoderState* s) {
  584|  27.3k|  BrotliBitReader* br = &s->br;
  585|  27.3k|  uint32_t symbol = s->symbol;
  586|  27.3k|  uint32_t repeat = s->repeat;
  587|  27.3k|  uint32_t space = s->space;
  588|  27.3k|  uint32_t prev_code_len = s->prev_code_len;
  589|  27.3k|  uint32_t repeat_code_len = s->repeat_code_len;
  590|  27.3k|  uint16_t* symbol_lists = s->symbol_lists;
  591|  27.3k|  uint16_t* code_length_histo = s->code_length_histo;
  592|  27.3k|  int* next_symbol = s->next_symbol;
  593|  27.3k|  if (!BrotliWarmupBitReader(br)) {
  ------------------
  |  Branch (593:7): [True: 21, False: 27.3k]
  ------------------
  594|     21|    return BROTLI_DECODER_NEEDS_MORE_INPUT;
  595|     21|  }
  596|  1.87M|  while (symbol < alphabet_size && space > 0) {
  ------------------
  |  Branch (596:10): [True: 1.86M, False: 4.00k]
  |  Branch (596:36): [True: 1.84M, False: 22.8k]
  ------------------
  597|  1.84M|    const HuffmanCode* p = s->table;
  598|  1.84M|    uint32_t code_len;
  599|  1.84M|    if (!BrotliCheckInputAmount(br, BROTLI_SHORT_FILL_BIT_WINDOW_READ)) {
  ------------------
  |  |   21|  1.84M|#define BROTLI_SHORT_FILL_BIT_WINDOW_READ (sizeof(brotli_reg_t) >> 1)
  ------------------
  |  Branch (599:9): [True: 501, False: 1.84M]
  ------------------
  600|    501|      s->symbol = symbol;
  601|    501|      s->repeat = repeat;
  602|    501|      s->prev_code_len = prev_code_len;
  603|    501|      s->repeat_code_len = repeat_code_len;
  604|    501|      s->space = space;
  605|    501|      return BROTLI_DECODER_NEEDS_MORE_INPUT;
  606|    501|    }
  607|  1.84M|    BrotliFillBitWindow16(br);
  608|  1.84M|    p += BrotliGetBitsUnmasked(br) &
  609|  1.84M|        BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH);
  ------------------
  |  |   34|  1.84M|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
  ------------------
  610|  1.84M|    BrotliDropBits(br, p->bits);  /* Use 1..5 bits. */
  611|  1.84M|    code_len = p->value;  /* code_len == 0..17 */
  612|  1.84M|    if (code_len < BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
  ------------------
  |  |   25|  1.84M|#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
  ------------------
  |  Branch (612:9): [True: 1.56M, False: 284k]
  ------------------
  613|  1.56M|      ProcessSingleCodeLength(code_len, &symbol, &repeat, &space,
  614|  1.56M|          &prev_code_len, symbol_lists, code_length_histo, next_symbol);
  615|  1.56M|    } else {  /* code_len == 16..17, extra_bits == 2..3 */
  616|   284k|      uint32_t extra_bits =
  617|   284k|          (code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) ? 2 : 3;
  ------------------
  |  |   25|   284k|#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
  ------------------
  |  Branch (617:11): [True: 162k, False: 121k]
  ------------------
  618|   284k|      uint32_t repeat_delta =
  619|   284k|          (uint32_t)BrotliGetBitsUnmasked(br) & BitMask(extra_bits);
  620|   284k|      BrotliDropBits(br, extra_bits);
  621|   284k|      ProcessRepeatedCodeLength(code_len, repeat_delta, alphabet_size,
  622|   284k|          &symbol, &repeat, &space, &prev_code_len, &repeat_code_len,
  623|   284k|          symbol_lists, code_length_histo, next_symbol);
  624|   284k|    }
  625|  1.84M|  }
  626|  26.8k|  s->space = space;
  627|  26.8k|  return BROTLI_DECODER_SUCCESS;
  628|  27.3k|}
decode.c:ProcessSingleCodeLength:
  511|  1.57M|    uint16_t* code_length_histo, int* next_symbol) {
  512|  1.57M|  *repeat = 0;
  513|  1.57M|  if (code_len != 0) {  /* code_len == 1..15 */
  ------------------
  |  Branch (513:7): [True: 927k, False: 651k]
  ------------------
  514|   927k|    symbol_lists[next_symbol[code_len]] = (uint16_t)(*symbol);
  515|   927k|    next_symbol[code_len] = (int)(*symbol);
  516|   927k|    *prev_code_len = code_len;
  517|   927k|    *space -= 32768U >> code_len;
  518|   927k|    code_length_histo[code_len]++;
  519|   927k|    BROTLI_LOG(("[ReadHuffmanCode] code_length[%d] = %d\n", *symbol, code_len));
  520|   927k|  }
  521|  1.57M|  (*symbol)++;
  522|  1.57M|}
decode.c:ProcessRepeatedCodeLength:
  538|   285k|    uint16_t* code_length_histo, int* next_symbol) {
  539|   285k|  uint32_t old_repeat;
  540|   285k|  uint32_t extra_bits = 3;  /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */
  541|   285k|  uint32_t new_len = 0;  /* for BROTLI_REPEAT_ZERO_CODE_LENGTH */
  542|   285k|  if (code_len == BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
  ------------------
  |  |   25|   285k|#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
  ------------------
  |  Branch (542:7): [True: 163k, False: 121k]
  ------------------
  543|   163k|    new_len = *prev_code_len;
  544|   163k|    extra_bits = 2;
  545|   163k|  }
  546|   285k|  if (*repeat_code_len != new_len) {
  ------------------
  |  Branch (546:7): [True: 117k, False: 167k]
  ------------------
  547|   117k|    *repeat = 0;
  548|   117k|    *repeat_code_len = new_len;
  549|   117k|  }
  550|   285k|  old_repeat = *repeat;
  551|   285k|  if (*repeat > 0) {
  ------------------
  |  Branch (551:7): [True: 86.9k, False: 198k]
  ------------------
  552|  86.9k|    *repeat -= 2;
  553|  86.9k|    *repeat <<= extra_bits;
  554|  86.9k|  }
  555|   285k|  *repeat += repeat_delta + 3U;
  556|   285k|  repeat_delta = *repeat - old_repeat;
  557|   285k|  if (*symbol + repeat_delta > alphabet_size) {
  ------------------
  |  Branch (557:7): [True: 96, False: 285k]
  ------------------
  558|     96|    BROTLI_DUMP();
  ------------------
  |  |  352|     96|#define BROTLI_DUMP() (void)(0)
  ------------------
  559|     96|    *symbol = alphabet_size;
  560|     96|    *space = 0xFFFFF;
  561|     96|    return;
  562|     96|  }
  563|   285k|  BROTLI_LOG(("[ReadHuffmanCode] code_length[%d..%d] = %d\n",
  564|   285k|              *symbol, *symbol + repeat_delta - 1, *repeat_code_len));
  565|   285k|  if (*repeat_code_len != 0) {
  ------------------
  |  Branch (565:7): [True: 163k, False: 121k]
  ------------------
  566|   163k|    unsigned last = *symbol + repeat_delta;
  567|   163k|    int next = next_symbol[*repeat_code_len];
  568|  1.06M|    do {
  569|  1.06M|      symbol_lists[next] = (uint16_t)*symbol;
  570|  1.06M|      next = (int)*symbol;
  571|  1.06M|    } while (++(*symbol) != last);
  ------------------
  |  Branch (571:14): [True: 903k, False: 163k]
  ------------------
  572|   163k|    next_symbol[*repeat_code_len] = next;
  573|   163k|    *space -= repeat_delta << (15 - *repeat_code_len);
  574|   163k|    code_length_histo[*repeat_code_len] =
  575|   163k|        (uint16_t)(code_length_histo[*repeat_code_len] + repeat_delta);
  576|   163k|  } else {
  577|   121k|    *symbol += repeat_delta;
  578|   121k|  }
  579|   285k|}
decode.c:SafeReadSymbolCodeLengths:
  631|    522|    uint32_t alphabet_size, BrotliDecoderState* s) {
  632|    522|  BrotliBitReader* br = &s->br;
  633|    522|  BROTLI_BOOL get_byte = BROTLI_FALSE;
  ------------------
  |  |   49|    522|#define BROTLI_BOOL int
  ------------------
                BROTLI_BOOL get_byte = BROTLI_FALSE;
  ------------------
  |  |   53|    522|#define BROTLI_FALSE 0
  ------------------
  634|  20.6k|  while (s->symbol < alphabet_size && s->space > 0) {
  ------------------
  |  Branch (634:10): [True: 20.4k, False: 133]
  |  Branch (634:39): [True: 20.2k, False: 273]
  ------------------
  635|  20.2k|    const HuffmanCode* p = s->table;
  636|  20.2k|    uint32_t code_len;
  637|  20.2k|    uint32_t available_bits;
  638|  20.2k|    uint32_t bits = 0;
  639|  20.2k|    if (get_byte && !BrotliPullByte(br)) return BROTLI_DECODER_NEEDS_MORE_INPUT;
  ------------------
  |  Branch (639:9): [True: 364, False: 19.8k]
  |  Branch (639:21): [True: 116, False: 248]
  ------------------
  640|  20.1k|    get_byte = BROTLI_FALSE;
  ------------------
  |  |   53|  20.1k|#define BROTLI_FALSE 0
  ------------------
  641|  20.1k|    available_bits = BrotliGetAvailableBits(br);
  642|  20.1k|    if (available_bits != 0) {
  ------------------
  |  Branch (642:9): [True: 17.1k, False: 2.93k]
  ------------------
  643|  17.1k|      bits = (uint32_t)BrotliGetBitsUnmasked(br);
  644|  17.1k|    }
  645|  20.1k|    p += bits & BitMask(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH);
  ------------------
  |  |   34|  20.1k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
  ------------------
  646|  20.1k|    if (p->bits > available_bits) {
  ------------------
  |  Branch (646:9): [True: 252, False: 19.8k]
  ------------------
  647|    252|      get_byte = BROTLI_TRUE;
  ------------------
  |  |   51|    252|#define BROTLI_TRUE 1
  ------------------
  648|    252|      continue;
  649|    252|    }
  650|  19.8k|    code_len = p->value;  /* code_len == 0..17 */
  651|  19.8k|    if (code_len < BROTLI_REPEAT_PREVIOUS_CODE_LENGTH) {
  ------------------
  |  |   25|  19.8k|#define BROTLI_REPEAT_PREVIOUS_CODE_LENGTH 16
  ------------------
  |  Branch (651:9): [True: 18.8k, False: 1.02k]
  ------------------
  652|  18.8k|      BrotliDropBits(br, p->bits);
  653|  18.8k|      ProcessSingleCodeLength(code_len, &s->symbol, &s->repeat, &s->space,
  654|  18.8k|          &s->prev_code_len, s->symbol_lists, s->code_length_histo,
  655|  18.8k|          s->next_symbol);
  656|  18.8k|    } else {  /* code_len == 16..17, extra_bits == 2..3 */
  657|  1.02k|      uint32_t extra_bits = code_len - 14U;
  658|  1.02k|      uint32_t repeat_delta = (bits >> p->bits) & BitMask(extra_bits);
  659|  1.02k|      if (available_bits < p->bits + extra_bits) {
  ------------------
  |  Branch (659:11): [True: 112, False: 909]
  ------------------
  660|    112|        get_byte = BROTLI_TRUE;
  ------------------
  |  |   51|    112|#define BROTLI_TRUE 1
  ------------------
  661|    112|        continue;
  662|    112|      }
  663|    909|      BrotliDropBits(br, p->bits + extra_bits);
  664|    909|      ProcessRepeatedCodeLength(code_len, repeat_delta, alphabet_size,
  665|    909|          &s->symbol, &s->repeat, &s->space, &s->prev_code_len,
  666|    909|          &s->repeat_code_len, s->symbol_lists, s->code_length_histo,
  667|    909|          s->next_symbol);
  668|    909|    }
  669|  19.8k|  }
  670|    406|  return BROTLI_DECODER_SUCCESS;
  671|    522|}
decode.c:SafeReadBlockLength:
  868|  26.3k|    BrotliBitReader* br) {
  869|  26.3k|  uint32_t index;
  870|  26.3k|  if (s->substate_read_block_length == BROTLI_STATE_READ_BLOCK_LENGTH_NONE) {
  ------------------
  |  Branch (870:7): [True: 26.3k, False: 0]
  ------------------
  871|  26.3k|    if (!SafeReadSymbol(table, br, &index)) {
  ------------------
  |  Branch (871:9): [True: 46, False: 26.3k]
  ------------------
  872|     46|      return BROTLI_FALSE;
  ------------------
  |  |   53|     46|#define BROTLI_FALSE 0
  ------------------
  873|     46|    }
  874|  26.3k|  } else {
  875|      0|    index = s->block_length_index;
  876|      0|  }
  877|  26.3k|  {
  878|  26.3k|    uint32_t bits;
  879|  26.3k|    uint32_t nbits = kBlockLengthPrefixCode[index].nbits;  /* nbits == 2..24 */
  880|  26.3k|    if (!BrotliSafeReadBits(br, nbits, &bits)) {
  ------------------
  |  Branch (880:9): [True: 225, False: 26.1k]
  ------------------
  881|    225|      s->block_length_index = index;
  882|    225|      s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_SUFFIX;
  883|    225|      return BROTLI_FALSE;
  ------------------
  |  |   53|    225|#define BROTLI_FALSE 0
  ------------------
  884|    225|    }
  885|  26.1k|    *result = kBlockLengthPrefixCode[index].offset + bits;
  886|  26.1k|    s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
  887|  26.1k|    return BROTLI_TRUE;
  ------------------
  |  |   51|  26.1k|#define BROTLI_TRUE 1
  ------------------
  888|  26.3k|  }
  889|  26.3k|}
decode.c:SafeReadSymbol:
  410|   965M|    const HuffmanCode* table, BrotliBitReader* br, uint32_t* result) {
  411|   965M|  uint32_t val;
  412|   965M|  if (BROTLI_PREDICT_TRUE(BrotliSafeGetBits(br, 15, &val))) {
  ------------------
  |  |  317|   965M|#define BROTLI_PREDICT_TRUE(x) (__builtin_expect(!!(x), 1))
  |  |  ------------------
  |  |  |  Branch (317:32): [True: 625M, False: 339M]
  |  |  ------------------
  ------------------
  413|   625M|    *result = DecodeSymbol(val, table, br);
  414|   625M|    return BROTLI_TRUE;
  ------------------
  |  |   51|   625M|#define BROTLI_TRUE 1
  ------------------
  415|   625M|  }
  416|   339M|  return SafeDecodeSymbol(table, br, result);
  417|   965M|}
decode.c:DecodeSymbol:
  349|   730M|                                           BrotliBitReader* br) {
  350|   730M|  table += bits & HUFFMAN_TABLE_MASK;
  ------------------
  |  |   40|   730M|#define HUFFMAN_TABLE_MASK 0xFF
  ------------------
  351|   730M|  if (table->bits > HUFFMAN_TABLE_BITS) {
  ------------------
  |  |   39|   730M|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  |  Branch (351:7): [True: 679k, False: 729M]
  ------------------
  352|   679k|    uint32_t nbits = table->bits - HUFFMAN_TABLE_BITS;
  ------------------
  |  |   39|   679k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  353|   679k|    BrotliDropBits(br, HUFFMAN_TABLE_BITS);
  ------------------
  |  |   39|   679k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  354|   679k|    table += table->value;
  355|   679k|    table += (bits >> HUFFMAN_TABLE_BITS) & BitMask(nbits);
  ------------------
  |  |   39|   679k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  356|   679k|  }
  357|   730M|  BrotliDropBits(br, table->bits);
  358|   730M|  return table->value;
  359|   730M|}
decode.c:SafeDecodeSymbol:
  371|   339M|    const HuffmanCode* table, BrotliBitReader* br, uint32_t* result) {
  372|   339M|  uint32_t val;
  373|   339M|  uint32_t available_bits = BrotliGetAvailableBits(br);
  374|   339M|  if (available_bits == 0) {
  ------------------
  |  Branch (374:7): [True: 14.9M, False: 324M]
  ------------------
  375|  14.9M|    if (table->bits == 0) {
  ------------------
  |  Branch (375:9): [True: 14.9M, False: 183]
  ------------------
  376|  14.9M|      *result = table->value;
  377|  14.9M|      return BROTLI_TRUE;
  ------------------
  |  |   51|  14.9M|#define BROTLI_TRUE 1
  ------------------
  378|  14.9M|    }
  379|    183|    return BROTLI_FALSE;  /* No valid bits at all. */
  ------------------
  |  |   53|    183|#define BROTLI_FALSE 0
  ------------------
  380|  14.9M|  }
  381|   324M|  val = (uint32_t)BrotliGetBitsUnmasked(br);
  382|   324M|  table += val & HUFFMAN_TABLE_MASK;
  ------------------
  |  |   40|   324M|#define HUFFMAN_TABLE_MASK 0xFF
  ------------------
  383|   324M|  if (table->bits <= HUFFMAN_TABLE_BITS) {
  ------------------
  |  |   39|   324M|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  |  Branch (383:7): [True: 324M, False: 51]
  ------------------
  384|   324M|    if (table->bits <= available_bits) {
  ------------------
  |  Branch (384:9): [True: 324M, False: 111]
  ------------------
  385|   324M|      BrotliDropBits(br, table->bits);
  386|   324M|      *result = table->value;
  387|   324M|      return BROTLI_TRUE;
  ------------------
  |  |   51|   324M|#define BROTLI_TRUE 1
  ------------------
  388|   324M|    } else {
  389|    111|      return BROTLI_FALSE;  /* Not enough bits for the first level. */
  ------------------
  |  |   53|    111|#define BROTLI_FALSE 0
  ------------------
  390|    111|    }
  391|   324M|  }
  392|     51|  if (available_bits <= HUFFMAN_TABLE_BITS) {
  ------------------
  |  |   39|     51|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  |  Branch (392:7): [True: 14, False: 37]
  ------------------
  393|     14|    return BROTLI_FALSE;  /* Not enough bits to move to the second level. */
  ------------------
  |  |   53|     14|#define BROTLI_FALSE 0
  ------------------
  394|     14|  }
  395|       |
  396|       |  /* Speculatively drop HUFFMAN_TABLE_BITS. */
  397|     37|  val = (val & BitMask(table->bits)) >> HUFFMAN_TABLE_BITS;
  ------------------
  |  |   39|     37|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  398|     37|  available_bits -= HUFFMAN_TABLE_BITS;
  ------------------
  |  |   39|     37|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  399|     37|  table += table->value + val;
  400|     37|  if (available_bits < table->bits) {
  ------------------
  |  Branch (400:7): [True: 3, False: 34]
  ------------------
  401|      3|    return BROTLI_FALSE;  /* Not enough bits for the second level. */
  ------------------
  |  |   53|      3|#define BROTLI_FALSE 0
  ------------------
  402|      3|  }
  403|       |
  404|     34|  BrotliDropBits(br, HUFFMAN_TABLE_BITS + table->bits);
  ------------------
  |  |   39|     34|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  405|     34|  *result = table->value;
  406|     34|  return BROTLI_TRUE;
  ------------------
  |  |   51|     34|#define BROTLI_TRUE 1
  ------------------
  407|     37|}
decode.c:ReadContextModes:
 1432|  15.5k|static BrotliDecoderErrorCode ReadContextModes(BrotliDecoderState* s) {
 1433|  15.5k|  BrotliBitReader* br = &s->br;
 1434|  15.5k|  int i = s->loop_counter;
 1435|       |
 1436|  64.9k|  while (i < (int)s->num_block_types[0]) {
  ------------------
  |  Branch (1436:10): [True: 49.4k, False: 15.5k]
  ------------------
 1437|  49.4k|    uint32_t bits;
 1438|  49.4k|    if (!BrotliSafeReadBits(br, 2, &bits)) {
  ------------------
  |  Branch (1438:9): [True: 21, False: 49.4k]
  ------------------
 1439|     21|      s->loop_counter = i;
 1440|     21|      return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1441|     21|    }
 1442|  49.4k|    s->context_modes[i] = (uint8_t)bits;
 1443|  49.4k|    BROTLI_LOG_ARRAY_INDEX(s->context_modes, i);
 1444|  49.4k|    i++;
 1445|  49.4k|  }
 1446|  15.5k|  return BROTLI_DECODER_SUCCESS;
 1447|  15.5k|}
decode.c:DecodeContextMap:
  975|  30.8k|                                               BrotliDecoderState* s) {
  976|  30.8k|  BrotliBitReader* br = &s->br;
  977|  30.8k|  BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
  978|       |
  979|  30.8k|  switch ((int)s->substate_context_map) {
  980|  30.8k|    case BROTLI_STATE_CONTEXT_MAP_NONE:
  ------------------
  |  Branch (980:5): [True: 30.8k, False: 0]
  ------------------
  981|  30.8k|      result = DecodeVarLenUint8(s, br, num_htrees);
  982|  30.8k|      if (result != BROTLI_DECODER_SUCCESS) {
  ------------------
  |  Branch (982:11): [True: 21, False: 30.8k]
  ------------------
  983|     21|        return result;
  984|     21|      }
  985|  30.8k|      (*num_htrees)++;
  986|  30.8k|      s->context_index = 0;
  987|  30.8k|      BROTLI_LOG_UINT(context_map_size);
  988|  30.8k|      BROTLI_LOG_UINT(*num_htrees);
  989|  30.8k|      *context_map_arg =
  990|  30.8k|          (uint8_t*)BROTLI_DECODER_ALLOC(s, (size_t)context_map_size);
  ------------------
  |  |  247|  30.8k|#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
  ------------------
  991|  30.8k|      if (*context_map_arg == 0) {
  ------------------
  |  Branch (991:11): [True: 0, False: 30.8k]
  ------------------
  992|      0|        return BROTLI_FAILURE(BROTLI_DECODER_ERROR_ALLOC_CONTEXT_MAP);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
  993|      0|      }
  994|  30.8k|      if (*num_htrees <= 1) {
  ------------------
  |  Branch (994:11): [True: 29.4k, False: 1.42k]
  ------------------
  995|  29.4k|        memset(*context_map_arg, 0, (size_t)context_map_size);
  996|  29.4k|        return BROTLI_DECODER_SUCCESS;
  997|  29.4k|      }
  998|  1.42k|      s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_READ_PREFIX;
  999|       |      /* No break, continue to next state. */
 1000|       |
 1001|  1.42k|    case BROTLI_STATE_CONTEXT_MAP_READ_PREFIX: {
  ------------------
  |  Branch (1001:5): [True: 0, False: 30.8k]
  ------------------
 1002|  1.42k|      uint32_t bits;
 1003|       |      /* In next stage ReadHuffmanCode uses at least 4 bits, so it is safe
 1004|       |         to peek 4 bits ahead. */
 1005|  1.42k|      if (!BrotliSafeGetBits(br, 5, &bits)) {
  ------------------
  |  Branch (1005:11): [True: 11, False: 1.41k]
  ------------------
 1006|     11|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1007|     11|      }
 1008|  1.41k|      if ((bits & 1) != 0) { /* Use RLE for zeros. */
  ------------------
  |  Branch (1008:11): [True: 1.08k, False: 326]
  ------------------
 1009|  1.08k|        s->max_run_length_prefix = (bits >> 1) + 1;
 1010|  1.08k|        BrotliDropBits(br, 5);
 1011|  1.08k|      } else {
 1012|    326|        s->max_run_length_prefix = 0;
 1013|    326|        BrotliDropBits(br, 1);
 1014|    326|      }
 1015|  1.41k|      BROTLI_LOG_UINT(s->max_run_length_prefix);
 1016|  1.41k|      s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_HUFFMAN;
 1017|       |      /* No break, continue to next state. */
 1018|  1.41k|    }
 1019|       |
 1020|  1.41k|    case BROTLI_STATE_CONTEXT_MAP_HUFFMAN: {
  ------------------
  |  Branch (1020:5): [True: 0, False: 30.8k]
  ------------------
 1021|  1.41k|      uint32_t alphabet_size = *num_htrees + s->max_run_length_prefix;
 1022|  1.41k|      result = ReadHuffmanCode(alphabet_size, alphabet_size,
 1023|  1.41k|                               s->context_map_table, NULL, s);
 1024|  1.41k|      if (result != BROTLI_DECODER_SUCCESS) return result;
  ------------------
  |  Branch (1024:11): [True: 63, False: 1.34k]
  ------------------
 1025|  1.34k|      s->code = 0xFFFF;
 1026|  1.34k|      s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_DECODE;
 1027|       |      /* No break, continue to next state. */
 1028|  1.34k|    }
 1029|       |
 1030|  1.34k|    case BROTLI_STATE_CONTEXT_MAP_DECODE: {
  ------------------
  |  Branch (1030:5): [True: 0, False: 30.8k]
  ------------------
 1031|  1.34k|      uint32_t context_index = s->context_index;
 1032|  1.34k|      uint32_t max_run_length_prefix = s->max_run_length_prefix;
 1033|  1.34k|      uint8_t* context_map = *context_map_arg;
 1034|  1.34k|      uint32_t code = s->code;
 1035|  1.34k|      BROTLI_BOOL skip_preamble = (code != 0xFFFF);
  ------------------
  |  |   49|  1.34k|#define BROTLI_BOOL int
  ------------------
 1036|   252k|      while (context_index < context_map_size || skip_preamble) {
  ------------------
  |  Branch (1036:14): [True: 250k, False: 1.23k]
  |  Branch (1036:50): [True: 0, False: 1.23k]
  ------------------
 1037|   250k|        if (!skip_preamble) {
  ------------------
  |  Branch (1037:13): [True: 250k, False: 0]
  ------------------
 1038|   250k|          if (!SafeReadSymbol(s->context_map_table, br, &code)) {
  ------------------
  |  Branch (1038:15): [True: 38, False: 250k]
  ------------------
 1039|     38|            s->code = 0xFFFF;
 1040|     38|            s->context_index = context_index;
 1041|     38|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1042|     38|          }
 1043|   250k|          BROTLI_LOG_UINT(code);
 1044|       |
 1045|   250k|          if (code == 0) {
  ------------------
  |  Branch (1045:15): [True: 36.4k, False: 214k]
  ------------------
 1046|  36.4k|            context_map[context_index++] = 0;
 1047|  36.4k|            continue;
 1048|  36.4k|          }
 1049|   214k|          if (code > max_run_length_prefix) {
  ------------------
  |  Branch (1049:15): [True: 178k, False: 35.3k]
  ------------------
 1050|   178k|            context_map[context_index++] =
 1051|   178k|                (uint8_t)(code - max_run_length_prefix);
 1052|   178k|            continue;
 1053|   178k|          }
 1054|   214k|        } else {
 1055|      0|          skip_preamble = BROTLI_FALSE;
  ------------------
  |  |   53|      0|#define BROTLI_FALSE 0
  ------------------
 1056|      0|        }
 1057|       |        /* RLE sub-stage. */
 1058|  35.3k|        {
 1059|  35.3k|          uint32_t reps;
 1060|  35.3k|          if (!BrotliSafeReadBits(br, code, &reps)) {
  ------------------
  |  Branch (1060:15): [True: 29, False: 35.3k]
  ------------------
 1061|     29|            s->code = code;
 1062|     29|            s->context_index = context_index;
 1063|     29|            return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1064|     29|          }
 1065|  35.3k|          reps += 1U << code;
 1066|  35.3k|          BROTLI_LOG_UINT(reps);
 1067|  35.3k|          if (context_index + reps > context_map_size) {
  ------------------
  |  Branch (1067:15): [True: 46, False: 35.3k]
  ------------------
 1068|     46|            return
 1069|     46|                BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_CONTEXT_MAP_REPEAT);
  ------------------
  |  |   31|     46|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     46|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1070|     46|          }
 1071|   424k|          do {
 1072|   424k|            context_map[context_index++] = 0;
 1073|   424k|          } while (--reps);
  ------------------
  |  Branch (1073:20): [True: 389k, False: 35.3k]
  ------------------
 1074|  35.3k|        }
 1075|  35.3k|      }
 1076|       |      /* No break, continue to next state. */
 1077|  1.34k|    }
 1078|       |
 1079|  1.23k|    case BROTLI_STATE_CONTEXT_MAP_TRANSFORM: {
  ------------------
  |  Branch (1079:5): [True: 0, False: 30.8k]
  ------------------
 1080|  1.23k|      uint32_t bits;
 1081|  1.23k|      if (!BrotliSafeReadBits(br, 1, &bits)) {
  ------------------
  |  Branch (1081:11): [True: 8, False: 1.22k]
  ------------------
 1082|      8|        s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_TRANSFORM;
 1083|      8|        return BROTLI_DECODER_NEEDS_MORE_INPUT;
 1084|      8|      }
 1085|  1.22k|      if (bits != 0) {
  ------------------
  |  Branch (1085:11): [True: 1.09k, False: 131]
  ------------------
 1086|  1.09k|        InverseMoveToFrontTransform(*context_map_arg, context_map_size, s);
 1087|  1.09k|      }
 1088|  1.22k|      s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
 1089|  1.22k|      return BROTLI_DECODER_SUCCESS;
 1090|  1.23k|    }
 1091|       |
 1092|      0|    default:
  ------------------
  |  Branch (1092:5): [True: 0, False: 30.8k]
  ------------------
 1093|      0|      return
 1094|      0|          BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1095|  30.8k|  }
 1096|  30.8k|}
decode.c:InverseMoveToFrontTransform:
  906|  1.09k|    uint8_t* v, uint32_t v_len, BrotliDecoderState* state) {
  907|       |  /* Reinitialize elements that could have been changed. */
  908|  1.09k|  uint32_t i = 1;
  909|  1.09k|  uint32_t upper_bound = state->mtf_upper_bound;
  910|  1.09k|  uint32_t* mtf = &state->mtf[1];  /* Make mtf[-1] addressable. */
  911|  1.09k|  uint8_t* mtf_u8 = (uint8_t*)mtf;
  912|       |  /* Load endian-aware constant. */
  913|  1.09k|  const uint8_t b0123[4] = {0, 1, 2, 3};
  914|  1.09k|  uint32_t pattern;
  915|  1.09k|  memcpy(&pattern, &b0123, 4);
  916|       |
  917|       |  /* Initialize list using 4 consequent values pattern. */
  918|  1.09k|  mtf[0] = pattern;
  919|  58.4k|  do {
  920|  58.4k|    pattern += 0x04040404;  /* Advance all 4 values by 4. */
  921|  58.4k|    mtf[i] = pattern;
  922|  58.4k|    i++;
  923|  58.4k|  } while (i <= upper_bound);
  ------------------
  |  Branch (923:12): [True: 57.3k, False: 1.09k]
  ------------------
  924|       |
  925|       |  /* Transform the input. */
  926|  1.09k|  upper_bound = 0;
  927|   511k|  for (i = 0; i < v_len; ++i) {
  ------------------
  |  Branch (927:15): [True: 510k, False: 1.09k]
  ------------------
  928|   510k|    int index = v[i];
  929|   510k|    uint8_t value = mtf_u8[index];
  930|   510k|    upper_bound |= v[i];
  931|   510k|    v[i] = value;
  932|   510k|    mtf_u8[-1] = value;
  933|  4.82M|    do {
  934|  4.82M|      index--;
  935|  4.82M|      mtf_u8[index + 1] = mtf_u8[index];
  936|  4.82M|    } while (index >= 0);
  ------------------
  |  Branch (936:14): [True: 4.31M, False: 510k]
  ------------------
  937|   510k|  }
  938|       |  /* Remember amount of elements to be reinitialized. */
  939|  1.09k|  state->mtf_upper_bound = upper_bound >> 2;
  940|  1.09k|}
decode.c:DetectTrivialLiteralBlockTypes:
 1145|  15.3k|    BrotliDecoderState* s) {
 1146|  15.3k|  size_t i;
 1147|   138k|  for (i = 0; i < 8; ++i) s->trivial_literal_contexts[i] = 0;
  ------------------
  |  Branch (1147:15): [True: 123k, False: 15.3k]
  ------------------
 1148|  61.5k|  for (i = 0; i < s->num_block_types[0]; i++) {
  ------------------
  |  Branch (1148:15): [True: 46.1k, False: 15.3k]
  ------------------
 1149|  46.1k|    size_t offset = i << BROTLI_LITERAL_CONTEXT_BITS;
  ------------------
  |  |   53|  46.1k|#define BROTLI_LITERAL_CONTEXT_BITS 6
  ------------------
 1150|  46.1k|    size_t error = 0;
 1151|  46.1k|    size_t sample = s->context_map[offset];
 1152|  46.1k|    size_t j;
 1153|   784k|    for (j = 0; j < (1u << BROTLI_LITERAL_CONTEXT_BITS);) {
  ------------------
  |  |   53|   784k|#define BROTLI_LITERAL_CONTEXT_BITS 6
  ------------------
  |  Branch (1153:17): [True: 738k, False: 46.1k]
  ------------------
 1154|   738k|      BROTLI_REPEAT(4, error |= s->context_map[offset + j++] ^ sample;)
  ------------------
  |  |  371|   738k|#define BROTLI_REPEAT(N, X) {     \
  |  |  372|   738k|  if ((N & 1) != 0) {X;}          \
  |  |  ------------------
  |  |  |  Branch (372:7): [Folded, False: 738k]
  |  |  ------------------
  |  |  373|   738k|  if ((N & 2) != 0) {X; X;}       \
  |  |  ------------------
  |  |  |  Branch (373:7): [Folded, False: 738k]
  |  |  ------------------
  |  |  374|   738k|  if ((N & 4) != 0) {X; X; X; X;} \
  |  |  ------------------
  |  |  |  Branch (374:7): [True: 738k, Folded]
  |  |  ------------------
  |  |  375|   738k|}
  ------------------
 1155|   738k|    }
 1156|  46.1k|    if (error == 0) {
  ------------------
  |  Branch (1156:9): [True: 38.8k, False: 7.32k]
  ------------------
 1157|  38.8k|      s->trivial_literal_contexts[i >> 5] |= 1u << (i & 31);
 1158|  38.8k|    }
 1159|  46.1k|  }
 1160|  15.3k|}
decode.c:HuffmanTreeGroupDecode:
  944|  45.3k|    HuffmanTreeGroup* group, BrotliDecoderState* s) {
  945|  45.3k|  if (s->substate_tree_group != BROTLI_STATE_TREE_GROUP_LOOP) {
  ------------------
  |  Branch (945:7): [True: 45.3k, False: 0]
  ------------------
  946|  45.3k|    s->next = group->codes;
  947|  45.3k|    s->htree_index = 0;
  948|  45.3k|    s->substate_tree_group = BROTLI_STATE_TREE_GROUP_LOOP;
  949|  45.3k|  }
  950|   111k|  while (s->htree_index < group->num_htrees) {
  ------------------
  |  Branch (950:10): [True: 66.1k, False: 44.9k]
  ------------------
  951|  66.1k|    uint32_t table_size;
  952|  66.1k|    BrotliDecoderErrorCode result =
  953|  66.1k|        ReadHuffmanCode(group->alphabet_size, group->max_symbol,
  954|  66.1k|                        s->next, &table_size, s);
  955|  66.1k|    if (result != BROTLI_DECODER_SUCCESS) return result;
  ------------------
  |  Branch (955:9): [True: 422, False: 65.7k]
  ------------------
  956|  65.7k|    group->htrees[s->htree_index] = s->next;
  957|  65.7k|    s->next += table_size;
  958|  65.7k|    ++s->htree_index;
  959|  65.7k|  }
  960|  44.9k|  s->substate_tree_group = BROTLI_STATE_TREE_GROUP_NONE;
  961|  44.9k|  return BROTLI_DECODER_SUCCESS;
  962|  45.3k|}
decode.c:PrepareLiteralDecoding:
 1162|   104k|static BROTLI_INLINE void PrepareLiteralDecoding(BrotliDecoderState* s) {
 1163|   104k|  uint8_t context_mode;
 1164|   104k|  size_t trivial;
 1165|   104k|  uint32_t block_type = s->block_type_rb[1];
 1166|   104k|  uint32_t context_offset = block_type << BROTLI_LITERAL_CONTEXT_BITS;
  ------------------
  |  |   53|   104k|#define BROTLI_LITERAL_CONTEXT_BITS 6
  ------------------
 1167|   104k|  s->context_map_slice = s->context_map + context_offset;
 1168|   104k|  trivial = s->trivial_literal_contexts[block_type >> 5];
 1169|   104k|  s->trivial_literal_context = (trivial >> (block_type & 31)) & 1;
 1170|   104k|  s->literal_htree = s->literal_hgroup.htrees[s->context_map_slice[0]];
 1171|   104k|  context_mode = s->context_modes[block_type] & 3;
 1172|   104k|  s->context_lookup = BROTLI_CONTEXT_LUT(context_mode);
  ------------------
  |  |  256|   104k|#define BROTLI_CONTEXT_LUT(MODE) (&kContextLookup[(MODE) << 9])
  ------------------
 1173|   104k|}
decode.c:BrotliEnsureRingBuffer:
 1307|  20.3k|    BrotliDecoderState* s) {
 1308|  20.3k|  uint8_t* old_ringbuffer = s->ringbuffer;
 1309|  20.3k|  if (s->ringbuffer_size == s->new_ringbuffer_size) {
  ------------------
  |  Branch (1309:7): [True: 16.6k, False: 3.68k]
  ------------------
 1310|  16.6k|    return BROTLI_TRUE;
  ------------------
  |  |   51|  16.6k|#define BROTLI_TRUE 1
  ------------------
 1311|  16.6k|  }
 1312|       |
 1313|  3.68k|  s->ringbuffer = (uint8_t*)BROTLI_DECODER_ALLOC(s,
  ------------------
  |  |  247|  3.68k|#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
  ------------------
 1314|  3.68k|      (size_t)(s->new_ringbuffer_size) + kRingBufferWriteAheadSlack);
 1315|  3.68k|  if (s->ringbuffer == 0) {
  ------------------
  |  Branch (1315:7): [True: 0, False: 3.68k]
  ------------------
 1316|       |    /* Restore previous value. */
 1317|      0|    s->ringbuffer = old_ringbuffer;
 1318|      0|    return BROTLI_FALSE;
  ------------------
  |  |   53|      0|#define BROTLI_FALSE 0
  ------------------
 1319|      0|  }
 1320|  3.68k|  s->ringbuffer[s->new_ringbuffer_size - 2] = 0;
 1321|  3.68k|  s->ringbuffer[s->new_ringbuffer_size - 1] = 0;
 1322|       |
 1323|  3.68k|  if (!!old_ringbuffer) {
  ------------------
  |  Branch (1323:7): [True: 329, False: 3.35k]
  ------------------
 1324|    329|    memcpy(s->ringbuffer, old_ringbuffer, (size_t)s->pos);
 1325|    329|    BROTLI_DECODER_FREE(s, old_ringbuffer);
  ------------------
  |  |  249|    329|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|    329|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|    329|  X = NULL;                                  \
  |  |  252|    329|}
  ------------------
 1326|    329|  }
 1327|       |
 1328|  3.68k|  s->ringbuffer_size = s->new_ringbuffer_size;
 1329|  3.68k|  s->ringbuffer_mask = s->new_ringbuffer_size - 1;
 1330|  3.68k|  s->ringbuffer_end = s->ringbuffer + s->ringbuffer_size;
 1331|       |
 1332|  3.68k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  3.68k|#define BROTLI_TRUE 1
  ------------------
 1333|  3.68k|}
decode.c:ProcessCommands:
 1919|  19.5k|    BrotliDecoderState* s) {
 1920|  19.5k|  return ProcessCommandsInternal(0, s);
 1921|  19.5k|}
decode.c:ProcessCommandsInternal:
 1628|  23.2k|    int safe, BrotliDecoderState* s) {
 1629|  23.2k|  int pos = s->pos;
 1630|  23.2k|  int i = s->loop_counter;
 1631|  23.2k|  BrotliDecoderErrorCode result = BROTLI_DECODER_SUCCESS;
 1632|  23.2k|  BrotliBitReader* br = &s->br;
 1633|       |
 1634|  23.2k|  if (!CheckInputAmount(safe, br, 28)) {
  ------------------
  |  Branch (1634:7): [True: 2.75k, False: 20.4k]
  ------------------
 1635|  2.75k|    result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1636|  2.75k|    goto saveStateAndReturn;
 1637|  2.75k|  }
 1638|  20.4k|  if (!safe) {
  ------------------
  |  Branch (1638:7): [True: 16.8k, False: 3.65k]
  ------------------
 1639|  16.8k|    BROTLI_UNUSED(BrotliWarmupBitReader(br));
  ------------------
  |  |  377|  16.8k|#define BROTLI_UNUSED(X) (void)(X)
  ------------------
 1640|  16.8k|  }
 1641|       |
 1642|       |  /* Jump into state machine. */
 1643|  20.4k|  if (s->state == BROTLI_STATE_COMMAND_BEGIN) {
  ------------------
  |  Branch (1643:7): [True: 16.0k, False: 4.46k]
  ------------------
 1644|  16.0k|    goto CommandBegin;
 1645|  16.0k|  } else if (s->state == BROTLI_STATE_COMMAND_INNER) {
  ------------------
  |  Branch (1645:14): [True: 1.89k, False: 2.56k]
  ------------------
 1646|  1.89k|    goto CommandInner;
 1647|  2.56k|  } else if (s->state == BROTLI_STATE_COMMAND_POST_DECODE_LITERALS) {
  ------------------
  |  Branch (1647:14): [True: 566, False: 2.00k]
  ------------------
 1648|    566|    goto CommandPostDecodeLiterals;
 1649|  2.00k|  } else if (s->state == BROTLI_STATE_COMMAND_POST_WRAP_COPY) {
  ------------------
  |  Branch (1649:14): [True: 2.00k, False: 0]
  ------------------
 1650|  2.00k|    goto CommandPostWrapCopy;
 1651|  2.00k|  } else {
 1652|      0|    return BROTLI_FAILURE(BROTLI_DECODER_ERROR_UNREACHABLE);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1653|      0|  }
 1654|       |
 1655|   105M|CommandBegin:
 1656|   105M|  if (safe) {
  ------------------
  |  Branch (1656:7): [True: 71.4M, False: 34.4M]
  ------------------
 1657|  71.4M|    s->state = BROTLI_STATE_COMMAND_BEGIN;
 1658|  71.4M|  }
 1659|   105M|  if (!CheckInputAmount(safe, br, 28)) {  /* 156 bits + 7 bytes */
  ------------------
  |  Branch (1659:7): [True: 401, False: 105M]
  ------------------
 1660|    401|    s->state = BROTLI_STATE_COMMAND_BEGIN;
 1661|    401|    result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1662|    401|    goto saveStateAndReturn;
 1663|    401|  }
 1664|   105M|  if (BROTLI_PREDICT_FALSE(s->block_length[1] == 0)) {
  ------------------
  |  |  318|   105M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 704k, False: 105M]
  |  |  ------------------
  ------------------
 1665|   704k|    BROTLI_SAFE(DecodeCommandBlockSwitch(s));
  ------------------
  |  | 1616|   704k|  {                                               \
  |  | 1617|   704k|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 4.79k, False: 699k]
  |  |  ------------------
  |  | 1618|  4.79k|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 74, False: 4.71k]
  |  |  ------------------
  |  | 1619|     74|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|     74|        goto saveStateAndReturn;                  \
  |  | 1621|     74|      }                                           \
  |  | 1622|   699k|    } else {                                      \
  |  | 1623|   699k|      METHOD;                                     \
  |  | 1624|   699k|    }                                             \
  |  | 1625|   704k|  }
  ------------------
 1666|   704k|    goto CommandBegin;
 1667|   704k|  }
 1668|       |  /* Read the insert/copy length in the command. */
 1669|   105M|  BROTLI_SAFE(ReadCommand(s, br, &i));
  ------------------
  |  | 1616|   105M|  {                                               \
  |  | 1617|   105M|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 71.4M, False: 33.7M]
  |  |  ------------------
  |  | 1618|  71.4M|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 248, False: 71.4M]
  |  |  ------------------
  |  | 1619|    248|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|    248|        goto saveStateAndReturn;                  \
  |  | 1621|    248|      }                                           \
  |  | 1622|  71.4M|    } else {                                      \
  |  | 1623|  33.7M|      METHOD;                                     \
  |  | 1624|  33.7M|    }                                             \
  |  | 1625|   105M|  }
  ------------------
 1670|   105M|  BROTLI_LOG(("[ProcessCommandsInternal] pos = %d insert = %d copy = %d\n",
 1671|   105M|              pos, i, s->copy_length));
 1672|   105M|  if (i == 0) {
  ------------------
  |  Branch (1672:7): [True: 43.2M, False: 61.9M]
  ------------------
 1673|  43.2M|    goto CommandPostDecodeLiterals;
 1674|  43.2M|  }
 1675|  61.9M|  s->meta_block_remaining_len -= i;
 1676|       |
 1677|  61.9M|CommandInner:
 1678|  61.9M|  if (safe) {
  ------------------
  |  Branch (1678:7): [True: 48.9M, False: 13.0M]
  ------------------
 1679|  48.9M|    s->state = BROTLI_STATE_COMMAND_INNER;
 1680|  48.9M|  }
 1681|       |  /* Read the literals in the command. */
 1682|  61.9M|  if (s->trivial_literal_context) {
  ------------------
  |  Branch (1682:7): [True: 49.5M, False: 12.4M]
  ------------------
 1683|  49.5M|    uint32_t bits;
 1684|  49.5M|    uint32_t value;
 1685|  49.5M|    PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
 1686|  1.21G|    do {
 1687|  1.21G|      if (!CheckInputAmount(safe, br, 28)) {  /* 162 bits + 7 bytes */
  ------------------
  |  Branch (1687:11): [True: 326, False: 1.21G]
  ------------------
 1688|    326|        s->state = BROTLI_STATE_COMMAND_INNER;
 1689|    326|        result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1690|    326|        goto saveStateAndReturn;
 1691|    326|      }
 1692|  1.21G|      if (BROTLI_PREDICT_FALSE(s->block_length[0] == 0)) {
  ------------------
  |  |  318|  1.21G|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 17.4k, False: 1.21G]
  |  |  ------------------
  ------------------
 1693|  17.4k|        BROTLI_SAFE(DecodeLiteralBlockSwitch(s));
  ------------------
  |  | 1616|  17.4k|  {                                               \
  |  | 1617|  17.4k|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 5.33k, False: 12.1k]
  |  |  ------------------
  |  | 1618|  5.33k|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 90, False: 5.24k]
  |  |  ------------------
  |  | 1619|     90|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|     90|        goto saveStateAndReturn;                  \
  |  | 1621|     90|      }                                           \
  |  | 1622|  12.1k|    } else {                                      \
  |  | 1623|  12.1k|      METHOD;                                     \
  |  | 1624|  12.1k|    }                                             \
  |  | 1625|  17.4k|  }
  ------------------
 1694|  17.3k|        PreloadSymbol(safe, s->literal_htree, br, &bits, &value);
 1695|  17.3k|        if (!s->trivial_literal_context) goto CommandInner;
  ------------------
  |  Branch (1695:13): [True: 4.92k, False: 12.4k]
  ------------------
 1696|  17.3k|      }
 1697|  1.21G|      if (!safe) {
  ------------------
  |  Branch (1697:11): [True: 409M, False: 805M]
  ------------------
 1698|   409M|        s->ringbuffer[pos] =
 1699|   409M|            (uint8_t)ReadPreloadedSymbol(s->literal_htree, br, &bits, &value);
 1700|   805M|      } else {
 1701|   805M|        uint32_t literal;
 1702|   805M|        if (!SafeReadSymbol(s->literal_htree, br, &literal)) {
  ------------------
  |  Branch (1702:13): [True: 80, False: 805M]
  ------------------
 1703|     80|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1704|     80|          goto saveStateAndReturn;
 1705|     80|        }
 1706|   805M|        s->ringbuffer[pos] = (uint8_t)literal;
 1707|   805M|      }
 1708|  1.21G|      --s->block_length[0];
 1709|  1.21G|      BROTLI_LOG_ARRAY_INDEX(s->ringbuffer, pos);
 1710|  1.21G|      ++pos;
 1711|  1.21G|      if (BROTLI_PREDICT_FALSE(pos == s->ringbuffer_size)) {
  ------------------
  |  |  318|  1.21G|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 1.16k, False: 1.21G]
  |  |  ------------------
  ------------------
 1712|  1.16k|        s->state = BROTLI_STATE_COMMAND_INNER_WRITE;
 1713|  1.16k|        --i;
 1714|  1.16k|        goto saveStateAndReturn;
 1715|  1.16k|      }
 1716|  1.21G|    } while (--i != 0);
  ------------------
  |  Branch (1716:14): [True: 1.16G, False: 49.5M]
  ------------------
 1717|  49.5M|  } else {
 1718|  12.4M|    uint8_t p1 = s->ringbuffer[(pos - 1) & s->ringbuffer_mask];
 1719|  12.4M|    uint8_t p2 = s->ringbuffer[(pos - 2) & s->ringbuffer_mask];
 1720|  80.7M|    do {
 1721|  80.7M|      const HuffmanCode* hc;
 1722|  80.7M|      uint8_t context;
 1723|  80.7M|      if (!CheckInputAmount(safe, br, 28)) {  /* 162 bits + 7 bytes */
  ------------------
  |  Branch (1723:11): [True: 178, False: 80.7M]
  ------------------
 1724|    178|        s->state = BROTLI_STATE_COMMAND_INNER;
 1725|    178|        result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1726|    178|        goto saveStateAndReturn;
 1727|    178|      }
 1728|  80.7M|      if (BROTLI_PREDICT_FALSE(s->block_length[0] == 0)) {
  ------------------
  |  |  318|  80.7M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 71.7k, False: 80.6M]
  |  |  ------------------
  ------------------
 1729|  71.7k|        BROTLI_SAFE(DecodeLiteralBlockSwitch(s));
  ------------------
  |  | 1616|  71.7k|  {                                               \
  |  | 1617|  71.7k|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 1.28k, False: 70.5k]
  |  |  ------------------
  |  | 1618|  1.28k|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 16, False: 1.26k]
  |  |  ------------------
  |  | 1619|     16|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|     16|        goto saveStateAndReturn;                  \
  |  | 1621|     16|      }                                           \
  |  | 1622|  70.5k|    } else {                                      \
  |  | 1623|  70.5k|      METHOD;                                     \
  |  | 1624|  70.5k|    }                                             \
  |  | 1625|  71.7k|  }
  ------------------
 1730|  71.7k|        if (s->trivial_literal_context) goto CommandInner;
  ------------------
  |  Branch (1730:13): [True: 4.93k, False: 66.8k]
  ------------------
 1731|  71.7k|      }
 1732|  80.7M|      context = BROTLI_CONTEXT(p1, p2, s->context_lookup);
  ------------------
  |  |  259|  80.7M|#define BROTLI_CONTEXT(P1, P2, LUT) ((LUT)[P1] | ((LUT) + 256)[P2])
  ------------------
 1733|  80.7M|      BROTLI_LOG_UINT(context);
 1734|  80.7M|      hc = s->literal_hgroup.htrees[s->context_map_slice[context]];
 1735|  80.7M|      p2 = p1;
 1736|  80.7M|      if (!safe) {
  ------------------
  |  Branch (1736:11): [True: 55.0M, False: 25.7M]
  ------------------
 1737|  55.0M|        p1 = (uint8_t)ReadSymbol(hc, br);
 1738|  55.0M|      } else {
 1739|  25.7M|        uint32_t literal;
 1740|  25.7M|        if (!SafeReadSymbol(hc, br, &literal)) {
  ------------------
  |  Branch (1740:13): [True: 28, False: 25.7M]
  ------------------
 1741|     28|          result = BROTLI_DECODER_NEEDS_MORE_INPUT;
 1742|     28|          goto saveStateAndReturn;
 1743|     28|        }
 1744|  25.7M|        p1 = (uint8_t)literal;
 1745|  25.7M|      }
 1746|  80.7M|      s->ringbuffer[pos] = p1;
 1747|  80.7M|      --s->block_length[0];
 1748|  80.7M|      BROTLI_LOG_UINT(s->context_map_slice[context]);
 1749|  80.7M|      BROTLI_LOG_ARRAY_INDEX(s->ringbuffer, pos & s->ringbuffer_mask);
 1750|  80.7M|      ++pos;
 1751|  80.7M|      if (BROTLI_PREDICT_FALSE(pos == s->ringbuffer_size)) {
  ------------------
  |  |  318|  80.7M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 907, False: 80.7M]
  |  |  ------------------
  ------------------
 1752|    907|        s->state = BROTLI_STATE_COMMAND_INNER_WRITE;
 1753|    907|        --i;
 1754|    907|        goto saveStateAndReturn;
 1755|    907|      }
 1756|  80.7M|    } while (--i != 0);
  ------------------
  |  Branch (1756:14): [True: 68.3M, False: 12.4M]
  ------------------
 1757|  12.4M|  }
 1758|  61.9M|  BROTLI_LOG_UINT(s->meta_block_remaining_len);
 1759|  61.9M|  if (BROTLI_PREDICT_FALSE(s->meta_block_remaining_len <= 0)) {
  ------------------
  |  |  318|  61.9M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 5.07k, False: 61.9M]
  |  |  ------------------
  ------------------
 1760|  5.07k|    s->state = BROTLI_STATE_METABLOCK_DONE;
 1761|  5.07k|    goto saveStateAndReturn;
 1762|  5.07k|  }
 1763|       |
 1764|   105M|CommandPostDecodeLiterals:
 1765|   105M|  if (safe) {
  ------------------
  |  Branch (1765:7): [True: 71.4M, False: 33.7M]
  ------------------
 1766|  71.4M|    s->state = BROTLI_STATE_COMMAND_POST_DECODE_LITERALS;
 1767|  71.4M|  }
 1768|   105M|  if (s->distance_code >= 0) {
  ------------------
  |  Branch (1768:7): [True: 28.4M, False: 76.7M]
  ------------------
 1769|       |    /* Implicit distance case. */
 1770|  28.4M|    s->distance_context = s->distance_code ? 0 : 1;
  ------------------
  |  Branch (1770:27): [True: 0, False: 28.4M]
  ------------------
 1771|  28.4M|    --s->dist_rb_idx;
 1772|  28.4M|    s->distance_code = s->dist_rb[s->dist_rb_idx & 3];
 1773|  76.7M|  } else {
 1774|       |    /* Read distance code in the command, unless it was implicitly zero. */
 1775|  76.7M|    if (BROTLI_PREDICT_FALSE(s->block_length[2] == 0)) {
  ------------------
  |  |  318|  76.7M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 52.0k, False: 76.7M]
  |  |  ------------------
  ------------------
 1776|  52.0k|      BROTLI_SAFE(DecodeDistanceBlockSwitch(s));
  ------------------
  |  | 1616|  52.0k|  {                                               \
  |  | 1617|  52.0k|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 5.52k, False: 46.5k]
  |  |  ------------------
  |  | 1618|  5.52k|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 109, False: 5.42k]
  |  |  ------------------
  |  | 1619|    109|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|    109|        goto saveStateAndReturn;                  \
  |  | 1621|    109|      }                                           \
  |  | 1622|  46.5k|    } else {                                      \
  |  | 1623|  46.5k|      METHOD;                                     \
  |  | 1624|  46.5k|    }                                             \
  |  | 1625|  52.0k|  }
  ------------------
 1777|  51.9k|    }
 1778|  76.7M|    BROTLI_SAFE(ReadDistance(s, br));
  ------------------
  |  | 1616|  76.7M|  {                                               \
  |  | 1617|  76.7M|    if (safe) {                                   \
  |  |  ------------------
  |  |  |  Branch (1617:9): [True: 62.3M, False: 14.3M]
  |  |  ------------------
  |  | 1618|  62.3M|      if (!Safe##METHOD) {                        \
  |  |  ------------------
  |  |  |  Branch (1618:11): [True: 239, False: 62.3M]
  |  |  ------------------
  |  | 1619|    239|        result = BROTLI_DECODER_NEEDS_MORE_INPUT; \
  |  | 1620|    239|        goto saveStateAndReturn;                  \
  |  | 1621|    239|      }                                           \
  |  | 1622|  62.3M|    } else {                                      \
  |  | 1623|  14.3M|      METHOD;                                     \
  |  | 1624|  14.3M|    }                                             \
  |  | 1625|  76.7M|  }
  ------------------
 1779|  76.7M|  }
 1780|   105M|  BROTLI_LOG(("[ProcessCommandsInternal] pos = %d distance = %d\n",
 1781|   105M|              pos, s->distance_code));
 1782|   105M|  if (s->max_distance != s->max_backward_distance) {
  ------------------
  |  Branch (1782:7): [True: 103M, False: 1.53M]
  ------------------
 1783|   103M|    s->max_distance =
 1784|   103M|        (pos < s->max_backward_distance) ? pos : s->max_backward_distance;
  ------------------
  |  Branch (1784:9): [True: 103M, False: 216]
  ------------------
 1785|   103M|  }
 1786|   105M|  i = s->copy_length;
 1787|       |  /* Apply copy of LZ77 back-reference, or static dictionary reference if
 1788|       |     the distance is larger than the max LZ77 distance */
 1789|   105M|  if (s->distance_code > s->max_distance) {
  ------------------
  |  Branch (1789:7): [True: 169k, False: 105M]
  ------------------
 1790|       |    /* The maximum allowed distance is BROTLI_MAX_ALLOWED_DISTANCE = 0x7FFFFFFC.
 1791|       |       With this choice, no signed overflow can occur after decoding
 1792|       |       a special distance code (e.g., after adding 3 to the last distance). */
 1793|   169k|    if (s->distance_code > BROTLI_MAX_ALLOWED_DISTANCE) {
  ------------------
  |  |   49|   169k|#define BROTLI_MAX_ALLOWED_DISTANCE 0x7FFFFFFC
  ------------------
  |  Branch (1793:9): [True: 32, False: 169k]
  ------------------
 1794|     32|      BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
 1795|     32|          "len: %d bytes left: %d\n",
 1796|     32|          pos, s->distance_code, i, s->meta_block_remaining_len));
 1797|     32|      return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_DISTANCE);
  ------------------
  |  |   31|     32|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     32|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1798|     32|    }
 1799|   169k|    if (i >= BROTLI_MIN_DICTIONARY_WORD_LENGTH &&
  ------------------
  |  |   57|   339k|#define BROTLI_MIN_DICTIONARY_WORD_LENGTH 4
  ------------------
  |  Branch (1799:9): [True: 169k, False: 19]
  ------------------
 1800|   169k|        i <= BROTLI_MAX_DICTIONARY_WORD_LENGTH) {
  ------------------
  |  |   58|   169k|#define BROTLI_MAX_DICTIONARY_WORD_LENGTH 24
  ------------------
  |  Branch (1800:9): [True: 169k, False: 82]
  ------------------
 1801|   169k|      int address = s->distance_code - s->max_distance - 1;
 1802|   169k|      const BrotliDictionary* words = s->dictionary;
 1803|   169k|      const BrotliTransforms* transforms = s->transforms;
 1804|   169k|      int offset = (int)s->dictionary->offsets_by_length[i];
 1805|   169k|      uint32_t shift = s->dictionary->size_bits_by_length[i];
 1806|       |
 1807|   169k|      int mask = (int)BitMask(shift);
 1808|   169k|      int word_idx = address & mask;
 1809|   169k|      int transform_idx = address >> shift;
 1810|       |      /* Compensate double distance-ring-buffer roll. */
 1811|   169k|      s->dist_rb_idx += s->distance_context;
 1812|   169k|      offset += word_idx * i;
 1813|   169k|      if (BROTLI_PREDICT_FALSE(!words->data)) {
  ------------------
  |  |  318|   169k|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 0, False: 169k]
  |  |  ------------------
  ------------------
 1814|      0|        return BROTLI_FAILURE(BROTLI_DECODER_ERROR_DICTIONARY_NOT_SET);
  ------------------
  |  |   31|      0|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|      0|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1815|      0|      }
 1816|   169k|      if (transform_idx < (int)transforms->num_transforms) {
  ------------------
  |  Branch (1816:11): [True: 169k, False: 78]
  ------------------
 1817|   169k|        const uint8_t* word = &words->data[offset];
 1818|   169k|        int len = i;
 1819|   169k|        if (transform_idx == transforms->cutOffTransforms[0]) {
  ------------------
  |  Branch (1819:13): [True: 154k, False: 14.8k]
  ------------------
 1820|   154k|          memcpy(&s->ringbuffer[pos], word, (size_t)len);
 1821|   154k|          BROTLI_LOG(("[ProcessCommandsInternal] dictionary word: [%.*s]\n",
 1822|   154k|                      len, word));
 1823|   154k|        } else {
 1824|  14.8k|          len = BrotliTransformDictionaryWord(&s->ringbuffer[pos], word, len,
 1825|  14.8k|              transforms, transform_idx);
 1826|  14.8k|          BROTLI_LOG(("[ProcessCommandsInternal] dictionary word: [%.*s],"
 1827|  14.8k|                      " transform_idx = %d, transformed: [%.*s]\n",
 1828|  14.8k|                      i, word, transform_idx, len, &s->ringbuffer[pos]));
 1829|  14.8k|        }
 1830|   169k|        pos += len;
 1831|   169k|        s->meta_block_remaining_len -= len;
 1832|   169k|        if (pos >= s->ringbuffer_size) {
  ------------------
  |  Branch (1832:13): [True: 783, False: 168k]
  ------------------
 1833|    783|          s->state = BROTLI_STATE_COMMAND_POST_WRITE_1;
 1834|    783|          goto saveStateAndReturn;
 1835|    783|        }
 1836|   169k|      } else {
 1837|     78|        BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
 1838|     78|            "len: %d bytes left: %d\n",
 1839|     78|            pos, s->distance_code, i, s->meta_block_remaining_len));
 1840|     78|        return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_TRANSFORM);
  ------------------
  |  |   31|     78|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|     78|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1841|     78|      }
 1842|   169k|    } else {
 1843|    101|      BROTLI_LOG(("Invalid backward reference. pos: %d distance: %d "
 1844|    101|          "len: %d bytes left: %d\n",
 1845|    101|          pos, s->distance_code, i, s->meta_block_remaining_len));
 1846|    101|      return BROTLI_FAILURE(BROTLI_DECODER_ERROR_FORMAT_DICTIONARY);
  ------------------
  |  |   31|    101|#define BROTLI_FAILURE(CODE) (BROTLI_DUMP(), CODE)
  |  |  ------------------
  |  |  |  |  352|    101|#define BROTLI_DUMP() (void)(0)
  |  |  ------------------
  ------------------
 1847|    101|    }
 1848|   105M|  } else {
 1849|   105M|    int src_start = (pos - s->distance_code) & s->ringbuffer_mask;
 1850|   105M|    uint8_t* copy_dst = &s->ringbuffer[pos];
 1851|   105M|    uint8_t* copy_src = &s->ringbuffer[src_start];
 1852|   105M|    int dst_end = pos + i;
 1853|   105M|    int src_end = src_start + i;
 1854|       |    /* Update the recent distances cache. */
 1855|   105M|    s->dist_rb[s->dist_rb_idx & 3] = s->distance_code;
 1856|   105M|    ++s->dist_rb_idx;
 1857|   105M|    s->meta_block_remaining_len -= i;
 1858|       |    /* There are 32+ bytes of slack in the ring-buffer allocation.
 1859|       |       Also, we have 16 short codes, that make these 16 bytes irrelevant
 1860|       |       in the ring-buffer. Let's copy over them as a first guess. */
 1861|   105M|    memmove16(copy_dst, copy_src);
 1862|   105M|    if (src_end > pos && dst_end > src_start) {
  ------------------
  |  Branch (1862:9): [True: 32.8M, False: 72.2M]
  |  Branch (1862:26): [True: 32.7M, False: 23.6k]
  ------------------
 1863|       |      /* Regions intersect. */
 1864|  32.7M|      goto CommandPostWrapCopy;
 1865|  32.7M|    }
 1866|  72.2M|    if (dst_end >= s->ringbuffer_size || src_end >= s->ringbuffer_size) {
  ------------------
  |  Branch (1866:9): [True: 1.19k, False: 72.2M]
  |  Branch (1866:42): [True: 1.91k, False: 72.2M]
  ------------------
 1867|       |      /* At least one region wraps. */
 1868|  3.11k|      goto CommandPostWrapCopy;
 1869|  3.11k|    }
 1870|  72.2M|    pos += i;
 1871|  72.2M|    if (i > 16) {
  ------------------
  |  Branch (1871:9): [True: 146k, False: 72.1M]
  ------------------
 1872|   146k|      if (i > 32) {
  ------------------
  |  Branch (1872:11): [True: 97.9k, False: 48.8k]
  ------------------
 1873|  97.9k|        memcpy(copy_dst + 16, copy_src + 16, (size_t)(i - 16));
 1874|  97.9k|      } else {
 1875|       |        /* This branch covers about 45% cases.
 1876|       |           Fixed size short copy allows more compiler optimizations. */
 1877|  48.8k|        memmove16(copy_dst + 16, copy_src + 16);
 1878|  48.8k|      }
 1879|   146k|    }
 1880|  72.2M|  }
 1881|  72.4M|  BROTLI_LOG_UINT(s->meta_block_remaining_len);
 1882|  72.4M|  if (s->meta_block_remaining_len <= 0) {
  ------------------
  |  Branch (1882:7): [True: 6.76k, False: 72.4M]
  ------------------
 1883|       |    /* Next metablock, if any. */
 1884|  6.76k|    s->state = BROTLI_STATE_METABLOCK_DONE;
 1885|  6.76k|    goto saveStateAndReturn;
 1886|  72.4M|  } else {
 1887|  72.4M|    goto CommandBegin;
 1888|  72.4M|  }
 1889|  32.8M|CommandPostWrapCopy:
 1890|  32.8M|  {
 1891|  32.8M|    int wrap_guard = s->ringbuffer_size - pos;
 1892|   552M|    while (--i >= 0) {
  ------------------
  |  Branch (1892:12): [True: 520M, False: 32.8M]
  ------------------
 1893|   520M|      s->ringbuffer[pos] =
 1894|   520M|          s->ringbuffer[(pos - s->distance_code) & s->ringbuffer_mask];
 1895|   520M|      ++pos;
 1896|   520M|      if (BROTLI_PREDICT_FALSE(--wrap_guard == 0)) {
  ------------------
  |  |  318|   520M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 2.11k, False: 520M]
  |  |  ------------------
  ------------------
 1897|  2.11k|        s->state = BROTLI_STATE_COMMAND_POST_WRITE_2;
 1898|  2.11k|        goto saveStateAndReturn;
 1899|  2.11k|      }
 1900|   520M|    }
 1901|  32.8M|  }
 1902|  32.8M|  if (s->meta_block_remaining_len <= 0) {
  ------------------
  |  Branch (1902:7): [True: 1.66k, False: 32.8M]
  ------------------
 1903|       |    /* Next metablock, if any. */
 1904|  1.66k|    s->state = BROTLI_STATE_METABLOCK_DONE;
 1905|  1.66k|    goto saveStateAndReturn;
 1906|  32.8M|  } else {
 1907|  32.8M|    goto CommandBegin;
 1908|  32.8M|  }
 1909|       |
 1910|  23.0k|saveStateAndReturn:
 1911|  23.0k|  s->pos = pos;
 1912|  23.0k|  s->loop_counter = i;
 1913|  23.0k|  return result;
 1914|  32.8M|}
decode.c:CheckInputAmount:
 1608|  1.40G|    int safe, BrotliBitReader* const br, size_t num) {
 1609|  1.40G|  if (safe) {
  ------------------
  |  Branch (1609:7): [True: 902M, False: 499M]
  ------------------
 1610|   902M|    return BROTLI_TRUE;
  ------------------
  |  |   51|   902M|#define BROTLI_TRUE 1
  ------------------
 1611|   902M|  }
 1612|   499M|  return BrotliCheckInputAmount(br, num);
 1613|  1.40G|}
decode.c:SafeDecodeCommandBlockSwitch:
 1211|  4.79k|    BrotliDecoderState* s) {
 1212|  4.79k|  return DecodeCommandBlockSwitchInternal(1, s);
 1213|  4.79k|}
decode.c:DecodeCommandBlockSwitchInternal:
 1198|   704k|    int safe, BrotliDecoderState* s) {
 1199|   704k|  if (!DecodeBlockTypeAndLength(safe, s, 1)) {
  ------------------
  |  Branch (1199:7): [True: 74, False: 704k]
  ------------------
 1200|     74|    return BROTLI_FALSE;
  ------------------
  |  |   53|     74|#define BROTLI_FALSE 0
  ------------------
 1201|     74|  }
 1202|   704k|  s->htree_command = s->insert_copy_hgroup.htrees[s->block_type_rb[3]];
 1203|   704k|  return BROTLI_TRUE;
  ------------------
  |  |   51|   704k|#define BROTLI_TRUE 1
  ------------------
 1204|   704k|}
decode.c:DecodeBlockTypeAndLength:
 1101|   845k|    int safe, BrotliDecoderState* s, int tree_type) {
 1102|   845k|  uint32_t max_block_type = s->num_block_types[tree_type];
 1103|   845k|  const HuffmanCode* type_tree = &s->block_type_trees[
 1104|   845k|      tree_type * BROTLI_HUFFMAN_MAX_SIZE_258];
  ------------------
  |  |   30|   845k|#define BROTLI_HUFFMAN_MAX_SIZE_258 632
  ------------------
 1105|   845k|  const HuffmanCode* len_tree = &s->block_len_trees[
 1106|   845k|      tree_type * BROTLI_HUFFMAN_MAX_SIZE_26];
  ------------------
  |  |   28|   845k|#define BROTLI_HUFFMAN_MAX_SIZE_26 396
  ------------------
 1107|   845k|  BrotliBitReader* br = &s->br;
 1108|   845k|  uint32_t* ringbuffer = &s->block_type_rb[tree_type * 2];
 1109|   845k|  uint32_t block_type;
 1110|   845k|  if (max_block_type <= 1) {
  ------------------
  |  Branch (1110:7): [True: 0, False: 845k]
  ------------------
 1111|      0|    return BROTLI_FALSE;
  ------------------
  |  |   53|      0|#define BROTLI_FALSE 0
  ------------------
 1112|      0|  }
 1113|       |
 1114|       |  /* Read 0..15 + 3..39 bits. */
 1115|   845k|  if (!safe) {
  ------------------
  |  Branch (1115:7): [True: 828k, False: 16.9k]
  ------------------
 1116|   828k|    block_type = ReadSymbol(type_tree, br);
 1117|   828k|    s->block_length[tree_type] = ReadBlockLength(len_tree, br);
 1118|   828k|  } else {
 1119|  16.9k|    BrotliBitReaderState memento;
 1120|  16.9k|    BrotliBitReaderSaveState(br, &memento);
 1121|  16.9k|    if (!SafeReadSymbol(type_tree, br, &block_type)) return BROTLI_FALSE;
  ------------------
  |  |   53|     50|#define BROTLI_FALSE 0
  ------------------
  |  Branch (1121:9): [True: 50, False: 16.8k]
  ------------------
 1122|  16.8k|    if (!SafeReadBlockLength(s, &s->block_length[tree_type], len_tree, br)) {
  ------------------
  |  Branch (1122:9): [True: 239, False: 16.6k]
  ------------------
 1123|    239|      s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
 1124|    239|      BrotliBitReaderRestoreState(br, &memento);
 1125|    239|      return BROTLI_FALSE;
  ------------------
  |  |   53|    239|#define BROTLI_FALSE 0
  ------------------
 1126|    239|    }
 1127|  16.8k|  }
 1128|       |
 1129|   845k|  if (block_type == 1) {
  ------------------
  |  Branch (1129:7): [True: 62.6k, False: 782k]
  ------------------
 1130|  62.6k|    block_type = ringbuffer[1] + 1;
 1131|   782k|  } else if (block_type == 0) {
  ------------------
  |  Branch (1131:14): [True: 746k, False: 35.7k]
  ------------------
 1132|   746k|    block_type = ringbuffer[0];
 1133|   746k|  } else {
 1134|  35.7k|    block_type -= 2;
 1135|  35.7k|  }
 1136|   845k|  if (block_type >= max_block_type) {
  ------------------
  |  Branch (1136:7): [True: 21.9k, False: 823k]
  ------------------
 1137|  21.9k|    block_type -= max_block_type;
 1138|  21.9k|  }
 1139|   845k|  ringbuffer[0] = ringbuffer[1];
 1140|   845k|  ringbuffer[1] = block_type;
 1141|   845k|  return BROTLI_TRUE;
  ------------------
  |  |   51|   845k|#define BROTLI_TRUE 1
  ------------------
 1142|   845k|}
decode.c:ReadBlockLength:
  856|   828k|                                              BrotliBitReader* br) {
  857|   828k|  uint32_t code;
  858|   828k|  uint32_t nbits;
  859|   828k|  code = ReadSymbol(table, br);
  860|   828k|  nbits = kBlockLengthPrefixCode[code].nbits;  /* nbits == 2..24 */
  861|   828k|  return kBlockLengthPrefixCode[code].offset + BrotliReadBits(br, nbits);
  862|   828k|}
decode.c:DecodeCommandBlockSwitch:
 1206|   699k|static void BROTLI_NOINLINE DecodeCommandBlockSwitch(BrotliDecoderState* s) {
 1207|   699k|  DecodeCommandBlockSwitchInternal(0, s);
 1208|   699k|}
decode.c:SafeReadCommand:
 1603|  71.4M|    BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
 1604|  71.4M|  return ReadCommandInternal(1, s, br, insert_length);
 1605|  71.4M|}
decode.c:ReadCommandInternal:
 1560|   105M|    int safe, BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
 1561|   105M|  uint32_t cmd_code;
 1562|   105M|  uint32_t insert_len_extra = 0;
 1563|   105M|  uint32_t copy_length;
 1564|   105M|  CmdLutElement v;
 1565|   105M|  BrotliBitReaderState memento;
 1566|   105M|  if (!safe) {
  ------------------
  |  Branch (1566:7): [True: 33.7M, False: 71.4M]
  ------------------
 1567|  33.7M|    cmd_code = ReadSymbol(s->htree_command, br);
 1568|  71.4M|  } else {
 1569|  71.4M|    BrotliBitReaderSaveState(br, &memento);
 1570|  71.4M|    if (!SafeReadSymbol(s->htree_command, br, &cmd_code)) {
  ------------------
  |  Branch (1570:9): [True: 37, False: 71.4M]
  ------------------
 1571|     37|      return BROTLI_FALSE;
  ------------------
  |  |   53|     37|#define BROTLI_FALSE 0
  ------------------
 1572|     37|    }
 1573|  71.4M|  }
 1574|   105M|  v = kCmdLut[cmd_code];
 1575|   105M|  s->distance_code = v.distance_code;
 1576|   105M|  s->distance_context = v.context;
 1577|   105M|  s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
 1578|   105M|  *insert_length = v.insert_len_offset;
 1579|   105M|  if (!safe) {
  ------------------
  |  Branch (1579:7): [True: 33.7M, False: 71.4M]
  ------------------
 1580|  33.7M|    if (BROTLI_PREDICT_FALSE(v.insert_len_extra_bits != 0)) {
  ------------------
  |  |  318|  33.7M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 486k, False: 33.2M]
  |  |  ------------------
  ------------------
 1581|   486k|      insert_len_extra = BrotliReadBits(br, v.insert_len_extra_bits);
 1582|   486k|    }
 1583|  33.7M|    copy_length = BrotliReadBits(br, v.copy_len_extra_bits);
 1584|  71.4M|  } else {
 1585|  71.4M|    if (!SafeReadBits(br, v.insert_len_extra_bits, &insert_len_extra) ||
  ------------------
  |  Branch (1585:9): [True: 87, False: 71.4M]
  ------------------
 1586|  71.4M|        !SafeReadBits(br, v.copy_len_extra_bits, &copy_length)) {
  ------------------
  |  Branch (1586:9): [True: 124, False: 71.4M]
  ------------------
 1587|    211|      BrotliBitReaderRestoreState(br, &memento);
 1588|    211|      return BROTLI_FALSE;
  ------------------
  |  |   53|    211|#define BROTLI_FALSE 0
  ------------------
 1589|    211|    }
 1590|  71.4M|  }
 1591|   105M|  s->copy_length = (int)copy_length + v.copy_len_offset;
 1592|   105M|  --s->block_length[1];
 1593|   105M|  *insert_length += (int)insert_len_extra;
 1594|   105M|  return BROTLI_TRUE;
  ------------------
  |  |   51|   105M|#define BROTLI_TRUE 1
  ------------------
 1595|   105M|}
decode.c:SafeReadBits:
 1481|   142M|    BrotliBitReader* const br, uint32_t n_bits, uint32_t* val) {
 1482|   142M|  if (n_bits != 0) {
  ------------------
  |  Branch (1482:7): [True: 21.6k, False: 142M]
  ------------------
 1483|  21.6k|    return BrotliSafeReadBits(br, n_bits, val);
 1484|   142M|  } else {
 1485|   142M|    *val = 0;
 1486|   142M|    return BROTLI_TRUE;
  ------------------
  |  |   51|   142M|#define BROTLI_TRUE 1
  ------------------
 1487|   142M|  }
 1488|   142M|}
decode.c:ReadCommand:
 1598|  33.7M|    BrotliDecoderState* s, BrotliBitReader* br, int* insert_length) {
 1599|  33.7M|  ReadCommandInternal(0, s, br, insert_length);
 1600|  33.7M|}
decode.c:PreloadSymbol:
  424|   459M|                                        uint32_t* value) {
  425|   459M|  if (safe) {
  ------------------
  |  Branch (425:7): [True: 46.0M, False: 413M]
  ------------------
  426|  46.0M|    return;
  427|  46.0M|  }
  428|   413M|  table += BrotliGetBits(br, HUFFMAN_TABLE_BITS);
  ------------------
  |  |   39|   413M|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  429|   413M|  *bits = table->bits;
  430|   413M|  *value = table->value;
  431|   413M|}
decode.c:SafeDecodeLiteralBlockSwitch:
 1191|  6.61k|    BrotliDecoderState* s) {
 1192|  6.61k|  return DecodeLiteralBlockSwitchInternal(1, s);
 1193|  6.61k|}
decode.c:DecodeLiteralBlockSwitchInternal:
 1178|  89.2k|    int safe, BrotliDecoderState* s) {
 1179|  89.2k|  if (!DecodeBlockTypeAndLength(safe, s, 0)) {
  ------------------
  |  Branch (1179:7): [True: 106, False: 89.1k]
  ------------------
 1180|    106|    return BROTLI_FALSE;
  ------------------
  |  |   53|    106|#define BROTLI_FALSE 0
  ------------------
 1181|    106|  }
 1182|  89.1k|  PrepareLiteralDecoding(s);
 1183|  89.1k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  89.1k|#define BROTLI_TRUE 1
  ------------------
 1184|  89.2k|}
decode.c:DecodeLiteralBlockSwitch:
 1186|  82.6k|static void BROTLI_NOINLINE DecodeLiteralBlockSwitch(BrotliDecoderState* s) {
 1187|  82.6k|  DecodeLiteralBlockSwitchInternal(0, s);
 1188|  82.6k|}
decode.c:ReadPreloadedSymbol:
  438|   409M|                                                  uint32_t* value) {
  439|   409M|  uint32_t result = *value;
  440|   409M|  if (BROTLI_PREDICT_FALSE(*bits > HUFFMAN_TABLE_BITS)) {
  ------------------
  |  |  318|   409M|#define BROTLI_PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (318:33): [True: 6.86k, False: 409M]
  |  |  ------------------
  ------------------
  441|  6.86k|    uint32_t val = BrotliGet16BitsUnmasked(br);
  442|  6.86k|    const HuffmanCode* ext = table + (val & HUFFMAN_TABLE_MASK) + *value;
  ------------------
  |  |   40|  6.86k|#define HUFFMAN_TABLE_MASK 0xFF
  ------------------
  443|  6.86k|    uint32_t mask = BitMask((*bits - HUFFMAN_TABLE_BITS));
  ------------------
  |  |   39|  6.86k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  444|  6.86k|    BrotliDropBits(br, HUFFMAN_TABLE_BITS);
  ------------------
  |  |   39|  6.86k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  445|  6.86k|    ext += (val >> HUFFMAN_TABLE_BITS) & mask;
  ------------------
  |  |   39|  6.86k|#define HUFFMAN_TABLE_BITS 8U
  ------------------
  446|  6.86k|    BrotliDropBits(br, ext->bits);
  447|  6.86k|    result = ext->value;
  448|   409M|  } else {
  449|   409M|    BrotliDropBits(br, *bits);
  450|   409M|  }
  451|   409M|  PreloadSymbol(0, table, br, bits, value);
  452|   409M|  return result;
  453|   409M|}
decode.c:ReadSymbol:
  364|   104M|                                         BrotliBitReader* br) {
  365|   104M|  return DecodeSymbol(BrotliGet16BitsUnmasked(br), table, br);
  366|   104M|}
decode.c:SafeDecodeDistanceBlockSwitch:
 1233|  5.52k|    BrotliDecoderState* s) {
 1234|  5.52k|  return DecodeDistanceBlockSwitchInternal(1, s);
 1235|  5.52k|}
decode.c:DecodeDistanceBlockSwitchInternal:
 1218|  52.0k|    int safe, BrotliDecoderState* s) {
 1219|  52.0k|  if (!DecodeBlockTypeAndLength(safe, s, 2)) {
  ------------------
  |  Branch (1219:7): [True: 109, False: 51.9k]
  ------------------
 1220|    109|    return BROTLI_FALSE;
  ------------------
  |  |   53|    109|#define BROTLI_FALSE 0
  ------------------
 1221|    109|  }
 1222|  51.9k|  s->dist_context_map_slice = s->dist_context_map +
 1223|  51.9k|      (s->block_type_rb[5] << BROTLI_DISTANCE_CONTEXT_BITS);
  ------------------
  |  |   56|  51.9k|#define BROTLI_DISTANCE_CONTEXT_BITS 2
  ------------------
 1224|  51.9k|  s->dist_htree_index = s->dist_context_map_slice[s->distance_context];
 1225|  51.9k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  51.9k|#define BROTLI_TRUE 1
  ------------------
 1226|  52.0k|}
decode.c:DecodeDistanceBlockSwitch:
 1228|  46.5k|static void BROTLI_NOINLINE DecodeDistanceBlockSwitch(BrotliDecoderState* s) {
 1229|  46.5k|  DecodeDistanceBlockSwitchInternal(0, s);
 1230|  46.5k|}
decode.c:SafeReadDistance:
 1555|  62.3M|    BrotliDecoderState* s, BrotliBitReader* br) {
 1556|  62.3M|  return ReadDistanceInternal(1, s, br);
 1557|  62.3M|}
decode.c:ReadDistanceInternal:
 1492|  76.7M|    int safe, BrotliDecoderState* s, BrotliBitReader* br) {
 1493|  76.7M|  int distval;
 1494|  76.7M|  BrotliBitReaderState memento;
 1495|  76.7M|  HuffmanCode* distance_tree = s->distance_hgroup.htrees[s->dist_htree_index];
 1496|  76.7M|  if (!safe) {
  ------------------
  |  Branch (1496:7): [True: 14.3M, False: 62.3M]
  ------------------
 1497|  14.3M|    s->distance_code = (int)ReadSymbol(distance_tree, br);
 1498|  62.3M|  } else {
 1499|  62.3M|    uint32_t code;
 1500|  62.3M|    BrotliBitReaderSaveState(br, &memento);
 1501|  62.3M|    if (!SafeReadSymbol(distance_tree, br, &code)) {
  ------------------
  |  Branch (1501:9): [True: 32, False: 62.3M]
  ------------------
 1502|     32|      return BROTLI_FALSE;
  ------------------
  |  |   53|     32|#define BROTLI_FALSE 0
  ------------------
 1503|     32|    }
 1504|  62.3M|    s->distance_code = (int)code;
 1505|  62.3M|  }
 1506|       |  /* Convert the distance code to the actual distance by possibly
 1507|       |     looking up past distances from the s->ringbuffer. */
 1508|  76.7M|  s->distance_context = 0;
 1509|  76.7M|  if ((s->distance_code & ~0xF) == 0) {
  ------------------
  |  Branch (1509:7): [True: 69.3M, False: 7.39M]
  ------------------
 1510|  69.3M|    TakeDistanceFromRingBuffer(s);
 1511|  69.3M|    --s->block_length[2];
 1512|  69.3M|    return BROTLI_TRUE;
  ------------------
  |  |   51|  69.3M|#define BROTLI_TRUE 1
  ------------------
 1513|  69.3M|  }
 1514|  7.39M|  distval = s->distance_code - (int)s->num_direct_distance_codes;
 1515|  7.39M|  if (distval >= 0) {
  ------------------
  |  Branch (1515:7): [True: 3.28M, False: 4.10M]
  ------------------
 1516|  3.28M|    uint32_t nbits;
 1517|  3.28M|    int postfix;
 1518|  3.28M|    int offset;
 1519|  3.28M|    if (!safe && (s->distance_postfix_bits == 0)) {
  ------------------
  |  Branch (1519:9): [True: 3.27M, False: 6.89k]
  |  Branch (1519:18): [True: 6.48k, False: 3.27M]
  ------------------
 1520|  6.48k|      nbits = ((uint32_t)distval >> 1) + 1;
 1521|  6.48k|      offset = ((2 + (distval & 1)) << nbits) - 4;
 1522|  6.48k|      s->distance_code = (int)s->num_direct_distance_codes + offset +
 1523|  6.48k|                         (int)BrotliReadBits(br, nbits);
 1524|  3.27M|    } else {
 1525|       |      /* This branch also works well when s->distance_postfix_bits == 0. */
 1526|  3.27M|      uint32_t bits;
 1527|  3.27M|      postfix = distval & s->distance_postfix_mask;
 1528|  3.27M|      distval >>= s->distance_postfix_bits;
 1529|  3.27M|      nbits = ((uint32_t)distval >> 1) + 1;
 1530|  3.27M|      if (safe) {
  ------------------
  |  Branch (1530:11): [True: 6.89k, False: 3.27M]
  ------------------
 1531|  6.89k|        if (!SafeReadBits(br, nbits, &bits)) {
  ------------------
  |  Branch (1531:13): [True: 207, False: 6.69k]
  ------------------
 1532|    207|          s->distance_code = -1;  /* Restore precondition. */
 1533|    207|          BrotliBitReaderRestoreState(br, &memento);
 1534|    207|          return BROTLI_FALSE;
  ------------------
  |  |   53|    207|#define BROTLI_FALSE 0
  ------------------
 1535|    207|        }
 1536|  3.27M|      } else {
 1537|  3.27M|        bits = BrotliReadBits(br, nbits);
 1538|  3.27M|      }
 1539|  3.27M|      offset = ((2 + (distval & 1)) << nbits) - 4;
 1540|  3.27M|      s->distance_code = (int)s->num_direct_distance_codes +
 1541|  3.27M|          ((offset + (int)bits) << s->distance_postfix_bits) + postfix;
 1542|  3.27M|    }
 1543|  3.28M|  }
 1544|  7.39M|  s->distance_code = s->distance_code - BROTLI_NUM_DISTANCE_SHORT_CODES + 1;
  ------------------
  |  |   37|  7.39M|#define BROTLI_NUM_DISTANCE_SHORT_CODES 16
  ------------------
 1545|  7.39M|  --s->block_length[2];
 1546|  7.39M|  return BROTLI_TRUE;
  ------------------
  |  |   51|  7.39M|#define BROTLI_TRUE 1
  ------------------
 1547|  7.39M|}
decode.c:TakeDistanceFromRingBuffer:
 1449|  69.3M|static BROTLI_INLINE void TakeDistanceFromRingBuffer(BrotliDecoderState* s) {
 1450|  69.3M|  if (s->distance_code == 0) {
  ------------------
  |  Branch (1450:7): [True: 22.9M, False: 46.4M]
  ------------------
 1451|  22.9M|    --s->dist_rb_idx;
 1452|  22.9M|    s->distance_code = s->dist_rb[s->dist_rb_idx & 3];
 1453|       |    /* Compensate double distance-ring-buffer roll for dictionary items. */
 1454|  22.9M|    s->distance_context = 1;
 1455|  46.4M|  } else {
 1456|  46.4M|    int distance_code = s->distance_code << 1;
 1457|       |    /* kDistanceShortCodeIndexOffset has 2-bit values from LSB:
 1458|       |        3, 2, 1, 0, 3, 3, 3, 3, 3, 3, 2, 2, 2, 2, 2, 2 */
 1459|  46.4M|    const uint32_t kDistanceShortCodeIndexOffset = 0xAAAFFF1B;
 1460|       |    /* kDistanceShortCodeValueOffset has 2-bit values from LSB:
 1461|       |       -0, 0,-0, 0,-1, 1,-2, 2,-3, 3,-1, 1,-2, 2,-3, 3 */
 1462|  46.4M|    const uint32_t kDistanceShortCodeValueOffset = 0xFA5FA500;
 1463|  46.4M|    int v = (s->dist_rb_idx +
 1464|  46.4M|        (int)(kDistanceShortCodeIndexOffset >> distance_code)) & 0x3;
 1465|  46.4M|    s->distance_code = s->dist_rb[v];
 1466|  46.4M|    v = (int)(kDistanceShortCodeValueOffset >> distance_code) & 0x3;
 1467|  46.4M|    if ((distance_code & 0x3) != 0) {
  ------------------
  |  Branch (1467:9): [True: 5.64M, False: 40.7M]
  ------------------
 1468|  5.64M|      s->distance_code += v;
 1469|  40.7M|    } else {
 1470|  40.7M|      s->distance_code -= v;
 1471|  40.7M|      if (s->distance_code <= 0) {
  ------------------
  |  Branch (1471:11): [True: 32, False: 40.7M]
  ------------------
 1472|       |        /* A huge distance will cause a BROTLI_FAILURE() soon.
 1473|       |           This is a little faster than failing here. */
 1474|     32|        s->distance_code = 0x7FFFFFFF;
 1475|     32|      }
 1476|  40.7M|    }
 1477|  46.4M|  }
 1478|  69.3M|}
decode.c:ReadDistance:
 1550|  14.3M|    BrotliDecoderState* s, BrotliBitReader* br) {
 1551|  14.3M|  ReadDistanceInternal(0, s, br);
 1552|  14.3M|}
decode.c:memmove16:
  169|   105M|static BROTLI_INLINE void memmove16(uint8_t* dst, uint8_t* src) {
  170|       |#if defined(__ARM_NEON__)
  171|       |  vst1q_u8(dst, vld1q_u8(src));
  172|       |#else
  173|   105M|  uint32_t buffer[4];
  174|   105M|  memcpy(buffer, src, 16);
  175|   105M|  memcpy(dst, buffer, 16);
  176|   105M|#endif
  177|   105M|}
decode.c:SafeProcessCommands:
 1924|  3.65k|    BrotliDecoderState* s) {
 1925|  3.65k|  return ProcessCommandsInternal(1, s);
 1926|  3.65k|}
decode.c:WrapRingBuffer:
 1292|  4.74k|static void BROTLI_NOINLINE WrapRingBuffer(BrotliDecoderState* s) {
 1293|  4.74k|  if (s->should_wrap_ringbuffer) {
  ------------------
  |  Branch (1293:7): [True: 688, False: 4.06k]
  ------------------
 1294|    688|    memcpy(s->ringbuffer, s->ringbuffer_end, (size_t)s->pos);
 1295|    688|    s->should_wrap_ringbuffer = 0;
 1296|    688|  }
 1297|  4.74k|}
decode.c:UnwrittenBytes:
 1237|  7.87k|static size_t UnwrittenBytes(const BrotliDecoderState* s, BROTLI_BOOL wrap) {
 1238|  7.87k|  size_t pos = wrap && s->pos > s->ringbuffer_size ?
  ------------------
  |  Branch (1238:16): [True: 7.87k, False: 0]
  |  Branch (1238:24): [True: 715, False: 7.15k]
  ------------------
 1239|  7.15k|      (size_t)s->ringbuffer_size : (size_t)(s->pos);
 1240|  7.87k|  size_t partial_pos_rb = (s->rb_roundtrips * (size_t)s->ringbuffer_size) + pos;
 1241|  7.87k|  return partial_pos_rb - s->partial_pos_out;
 1242|  7.87k|}

BrotliBuildCodeLengthsHuffmanTable:
  106|  27.3k|                                        uint16_t* count) {
  107|  27.3k|  HuffmanCode code;       /* current table entry */
  108|  27.3k|  int symbol;             /* symbol index in original or sorted table */
  109|  27.3k|  brotli_reg_t key;       /* prefix code */
  ------------------
  |  |  138|  27.3k|#define brotli_reg_t uint64_t
  ------------------
  110|  27.3k|  brotli_reg_t key_step;  /* prefix code addend */
  ------------------
  |  |  138|  27.3k|#define brotli_reg_t uint64_t
  ------------------
  111|  27.3k|  int step;               /* step size to replicate values in current table */
  112|  27.3k|  int table_size;         /* size of current table */
  113|  27.3k|  int sorted[BROTLI_CODE_LENGTH_CODES];  /* symbols sorted by code length */
  114|       |  /* offsets in sorted table for each length */
  115|  27.3k|  int offset[BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH + 1];
  116|  27.3k|  int bits;
  117|  27.3k|  int bits_count;
  118|  27.3k|  BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH <=
  119|  27.3k|                BROTLI_REVERSE_BITS_MAX);
  120|       |
  121|       |  /* Generate offsets into sorted symbol table by code length. */
  122|  27.3k|  symbol = -1;
  123|  27.3k|  bits = 1;
  124|  27.3k|  BROTLI_REPEAT(BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH, {
  ------------------
  |  |  371|  27.3k|#define BROTLI_REPEAT(N, X) {     \
  |  |  372|  27.3k|  if ((N & 1) != 0) {X;}          \
  |  |  ------------------
  |  |  |  Branch (372:7): [True: 27.3k, Folded]
  |  |  ------------------
  |  |  373|  27.3k|  if ((N & 2) != 0) {X; X;}       \
  |  |  ------------------
  |  |  |  Branch (373:7): [Folded, False: 27.3k]
  |  |  ------------------
  |  |  374|  27.3k|  if ((N & 4) != 0) {X; X; X; X;} \
  |  |  ------------------
  |  |  |  Branch (374:7): [True: 27.3k, Folded]
  |  |  ------------------
  |  |  375|  27.3k|}
  ------------------
  125|  27.3k|    symbol += count[bits];
  126|  27.3k|    offset[bits] = symbol;
  127|  27.3k|    bits++;
  128|  27.3k|  });
  129|       |  /* Symbols with code length 0 are placed after all other symbols. */
  130|  27.3k|  offset[0] = BROTLI_CODE_LENGTH_CODES - 1;
  ------------------
  |  |   27|  27.3k|#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
  |  |  ------------------
  |  |  |  |   26|  27.3k|#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
  |  |  ------------------
  ------------------
  131|       |
  132|       |  /* Sort symbols by length, by symbol order within each length. */
  133|  27.3k|  symbol = BROTLI_CODE_LENGTH_CODES;
  ------------------
  |  |   27|  27.3k|#define BROTLI_CODE_LENGTH_CODES (BROTLI_REPEAT_ZERO_CODE_LENGTH + 1)
  |  |  ------------------
  |  |  |  |   26|  27.3k|#define BROTLI_REPEAT_ZERO_CODE_LENGTH 17
  |  |  ------------------
  ------------------
  134|  82.1k|  do {
  135|  82.1k|    BROTLI_REPEAT(6, {
  ------------------
  |  |  371|  82.1k|#define BROTLI_REPEAT(N, X) {     \
  |  |  372|  82.1k|  if ((N & 1) != 0) {X;}          \
  |  |  ------------------
  |  |  |  Branch (372:7): [Folded, False: 82.1k]
  |  |  ------------------
  |  |  373|  82.1k|  if ((N & 2) != 0) {X; X;}       \
  |  |  ------------------
  |  |  |  Branch (373:7): [True: 82.1k, Folded]
  |  |  ------------------
  |  |  374|  82.1k|  if ((N & 4) != 0) {X; X; X; X;} \
  |  |  ------------------
  |  |  |  Branch (374:7): [True: 82.1k, Folded]
  |  |  ------------------
  |  |  375|  82.1k|}
  ------------------
  136|  82.1k|      symbol--;
  137|  82.1k|      sorted[offset[code_lengths[symbol]]--] = symbol;
  138|  82.1k|    });
  139|  82.1k|  } while (symbol != 0);
  ------------------
  |  Branch (139:12): [True: 54.7k, False: 27.3k]
  ------------------
  140|       |
  141|  27.3k|  table_size = 1 << BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH;
  ------------------
  |  |   34|  27.3k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
  ------------------
  142|       |
  143|       |  /* Special case: all symbols but one have 0 code length. */
  144|  27.3k|  if (offset[0] == 0) {
  ------------------
  |  Branch (144:7): [True: 368, False: 27.0k]
  ------------------
  145|    368|    code.bits = 0;
  146|    368|    code.value = (uint16_t)sorted[0];
  147|  12.1k|    for (key = 0; key < (brotli_reg_t)table_size; ++key) {
  ------------------
  |  Branch (147:19): [True: 11.7k, False: 368]
  ------------------
  148|  11.7k|      table[key] = code;
  149|  11.7k|    }
  150|    368|    return;
  151|    368|  }
  152|       |
  153|       |  /* Fill in table. */
  154|  27.0k|  key = 0;
  155|  27.0k|  key_step = BROTLI_REVERSE_BITS_LOWEST;
  ------------------
  |  |   65|  27.0k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|  27.0k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|  27.0k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  156|  27.0k|  symbol = 0;
  157|  27.0k|  bits = 1;
  158|  27.0k|  step = 2;
  159|   135k|  do {
  160|   135k|    code.bits = (uint8_t)bits;
  161|   327k|    for (bits_count = count[bits]; bits_count != 0; --bits_count) {
  ------------------
  |  Branch (161:36): [True: 192k, False: 135k]
  ------------------
  162|   192k|      code.value = (uint16_t)sorted[symbol++];
  163|   192k|      ReplicateValue(&table[BrotliReverseBits(key)], step, table_size, code);
  164|   192k|      key += key_step;
  165|   192k|    }
  166|   135k|    step <<= 1;
  167|   135k|    key_step >>= 1;
  168|   135k|  } while (++bits <= BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH);
  ------------------
  |  |   34|   135k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH_CODE_LENGTH 5
  ------------------
  |  Branch (168:12): [True: 108k, False: 27.0k]
  ------------------
  169|  27.0k|}
BrotliBuildHuffmanTable:
  174|  27.0k|                                 uint16_t* count) {
  175|  27.0k|  HuffmanCode code;       /* current table entry */
  176|  27.0k|  HuffmanCode* table;     /* next available space in table */
  177|  27.0k|  int len;                /* current code length */
  178|  27.0k|  int symbol;             /* symbol index in original or sorted table */
  179|  27.0k|  brotli_reg_t key;       /* prefix code */
  ------------------
  |  |  138|  27.0k|#define brotli_reg_t uint64_t
  ------------------
  180|  27.0k|  brotli_reg_t key_step;  /* prefix code addend */
  ------------------
  |  |  138|  27.0k|#define brotli_reg_t uint64_t
  ------------------
  181|  27.0k|  brotli_reg_t sub_key;   /* 2nd level table prefix code */
  ------------------
  |  |  138|  27.0k|#define brotli_reg_t uint64_t
  ------------------
  182|  27.0k|  brotli_reg_t sub_key_step;  /* 2nd level table prefix code addend */
  ------------------
  |  |  138|  27.0k|#define brotli_reg_t uint64_t
  ------------------
  183|  27.0k|  int step;               /* step size to replicate values in current table */
  184|  27.0k|  int table_bits;         /* key length of current table */
  185|  27.0k|  int table_size;         /* size of current table */
  186|  27.0k|  int total_size;         /* sum of root table size and 2nd level table sizes */
  187|  27.0k|  int max_length = -1;
  188|  27.0k|  int bits;
  189|  27.0k|  int bits_count;
  190|       |
  191|  27.0k|  BROTLI_DCHECK(root_bits <= BROTLI_REVERSE_BITS_MAX);
  192|  27.0k|  BROTLI_DCHECK(BROTLI_HUFFMAN_MAX_CODE_LENGTH - root_bits <=
  193|  27.0k|                BROTLI_REVERSE_BITS_MAX);
  194|       |
  195|   238k|  while (symbol_lists[max_length] == 0xFFFF) max_length--;
  ------------------
  |  Branch (195:10): [True: 211k, False: 27.0k]
  ------------------
  196|  27.0k|  max_length += BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1;
  ------------------
  |  |   19|  27.0k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  197|       |
  198|  27.0k|  table = root_table;
  199|  27.0k|  table_bits = root_bits;
  200|  27.0k|  table_size = 1 << table_bits;
  201|  27.0k|  total_size = table_size;
  202|       |
  203|       |  /* Fill in the root table. Reduce the table size to if possible,
  204|       |     and create the repetitions by memcpy. */
  205|  27.0k|  if (table_bits > max_length) {
  ------------------
  |  Branch (205:7): [True: 14.6k, False: 12.4k]
  ------------------
  206|  14.6k|    table_bits = max_length;
  207|  14.6k|    table_size = 1 << table_bits;
  208|  14.6k|  }
  209|  27.0k|  key = 0;
  210|  27.0k|  key_step = BROTLI_REVERSE_BITS_LOWEST;
  ------------------
  |  |   65|  27.0k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|  27.0k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|  27.0k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  211|  27.0k|  bits = 1;
  212|  27.0k|  step = 2;
  213|   169k|  do {
  214|   169k|    code.bits = (uint8_t)bits;
  215|   169k|    symbol = bits - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
  ------------------
  |  |   19|   169k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  216|  1.31M|    for (bits_count = count[bits]; bits_count != 0; --bits_count) {
  ------------------
  |  Branch (216:36): [True: 1.14M, False: 169k]
  ------------------
  217|  1.14M|      symbol = symbol_lists[symbol];
  218|  1.14M|      code.value = (uint16_t)symbol;
  219|  1.14M|      ReplicateValue(&table[BrotliReverseBits(key)], step, table_size, code);
  220|  1.14M|      key += key_step;
  221|  1.14M|    }
  222|   169k|    step <<= 1;
  223|   169k|    key_step >>= 1;
  224|   169k|  } while (++bits <= table_bits);
  ------------------
  |  Branch (224:12): [True: 142k, False: 27.0k]
  ------------------
  225|       |
  226|       |  /* If root_bits != table_bits then replicate to fill the remaining slots. */
  227|  74.3k|  while (total_size != table_size) {
  ------------------
  |  Branch (227:10): [True: 47.2k, False: 27.0k]
  ------------------
  228|  47.2k|    memcpy(&table[table_size], &table[0],
  229|  47.2k|           (size_t)table_size * sizeof(table[0]));
  230|  47.2k|    table_size <<= 1;
  231|  47.2k|  }
  232|       |
  233|       |  /* Fill in 2nd level tables and add pointers to root table. */
  234|  27.0k|  key_step = BROTLI_REVERSE_BITS_LOWEST >> (root_bits - 1);
  ------------------
  |  |   65|  27.0k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|  27.0k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|  27.0k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  235|  27.0k|  sub_key = (BROTLI_REVERSE_BITS_LOWEST << 1);
  ------------------
  |  |   65|  27.0k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|  27.0k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|  27.0k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  236|  27.0k|  sub_key_step = BROTLI_REVERSE_BITS_LOWEST;
  ------------------
  |  |   65|  27.0k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|  27.0k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|  27.0k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  237|  52.7k|  for (len = root_bits + 1, step = 2; len <= max_length; ++len) {
  ------------------
  |  Branch (237:39): [True: 25.6k, False: 27.0k]
  ------------------
  238|  25.6k|    symbol = len - (BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1);
  ------------------
  |  |   19|  25.6k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  239|   848k|    for (; count[len] != 0; --count[len]) {
  ------------------
  |  Branch (239:12): [True: 822k, False: 25.6k]
  ------------------
  240|   822k|      if (sub_key == (BROTLI_REVERSE_BITS_LOWEST << 1U)) {
  ------------------
  |  |   65|   822k|  ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   21|   822k|#define BROTLI_REVERSE_BITS_MAX 8
  |  |  ------------------
  |  |                 ((brotli_reg_t)1 << (BROTLI_REVERSE_BITS_MAX - 1 + BROTLI_REVERSE_BITS_BASE))
  |  |  ------------------
  |  |  |  |   27|   822k|#define BROTLI_REVERSE_BITS_BASE 0
  |  |  ------------------
  ------------------
  |  Branch (240:11): [True: 254k, False: 567k]
  ------------------
  241|   254k|        table += table_size;
  242|   254k|        table_bits = NextTableBitSize(count, len, root_bits);
  243|   254k|        table_size = 1 << table_bits;
  244|   254k|        total_size += table_size;
  245|   254k|        sub_key = BrotliReverseBits(key);
  246|   254k|        key += key_step;
  247|   254k|        root_table[sub_key].bits = (uint8_t)(table_bits + root_bits);
  248|   254k|        root_table[sub_key].value =
  249|   254k|            (uint16_t)(((size_t)(table - root_table)) - sub_key);
  250|   254k|        sub_key = 0;
  251|   254k|      }
  252|   822k|      code.bits = (uint8_t)(len - root_bits);
  253|   822k|      symbol = symbol_lists[symbol];
  254|   822k|      code.value = (uint16_t)symbol;
  255|   822k|      ReplicateValue(
  256|   822k|          &table[BrotliReverseBits(sub_key)], step, table_size, code);
  257|   822k|      sub_key += sub_key_step;
  258|   822k|    }
  259|  25.6k|    step <<= 1;
  260|  25.6k|    sub_key_step >>= 1;
  261|  25.6k|  }
  262|  27.0k|  return (uint32_t)total_size;
  263|  27.0k|}
BrotliBuildSimpleHuffmanTable:
  268|  59.0k|                                       uint32_t num_symbols) {
  269|  59.0k|  uint32_t table_size = 1;
  270|  59.0k|  const uint32_t goal_size = 1U << root_bits;
  271|  59.0k|  switch (num_symbols) {
  ------------------
  |  Branch (271:11): [True: 59.0k, False: 0]
  ------------------
  272|  34.7k|    case 0:
  ------------------
  |  Branch (272:5): [True: 34.7k, False: 24.2k]
  ------------------
  273|  34.7k|      table[0].bits = 0;
  274|  34.7k|      table[0].value = val[0];
  275|  34.7k|      break;
  276|  10.4k|    case 1:
  ------------------
  |  Branch (276:5): [True: 10.4k, False: 48.5k]
  ------------------
  277|  10.4k|      table[0].bits = 1;
  278|  10.4k|      table[1].bits = 1;
  279|  10.4k|      if (val[1] > val[0]) {
  ------------------
  |  Branch (279:11): [True: 9.02k, False: 1.41k]
  ------------------
  280|  9.02k|        table[0].value = val[0];
  281|  9.02k|        table[1].value = val[1];
  282|  9.02k|      } else {
  283|  1.41k|        table[0].value = val[1];
  284|  1.41k|        table[1].value = val[0];
  285|  1.41k|      }
  286|  10.4k|      table_size = 2;
  287|  10.4k|      break;
  288|  12.0k|    case 2:
  ------------------
  |  Branch (288:5): [True: 12.0k, False: 46.9k]
  ------------------
  289|  12.0k|      table[0].bits = 1;
  290|  12.0k|      table[0].value = val[0];
  291|  12.0k|      table[2].bits = 1;
  292|  12.0k|      table[2].value = val[0];
  293|  12.0k|      if (val[2] > val[1]) {
  ------------------
  |  Branch (293:11): [True: 5.38k, False: 6.64k]
  ------------------
  294|  5.38k|        table[1].value = val[1];
  295|  5.38k|        table[3].value = val[2];
  296|  6.64k|      } else {
  297|  6.64k|        table[1].value = val[2];
  298|  6.64k|        table[3].value = val[1];
  299|  6.64k|      }
  300|  12.0k|      table[1].bits = 2;
  301|  12.0k|      table[3].bits = 2;
  302|  12.0k|      table_size = 4;
  303|  12.0k|      break;
  304|    871|    case 3: {
  ------------------
  |  Branch (304:5): [True: 871, False: 58.1k]
  ------------------
  305|    871|      int i, k;
  306|  3.48k|      for (i = 0; i < 3; ++i) {
  ------------------
  |  Branch (306:19): [True: 2.61k, False: 871]
  ------------------
  307|  7.83k|        for (k = i + 1; k < 4; ++k) {
  ------------------
  |  Branch (307:25): [True: 5.22k, False: 2.61k]
  ------------------
  308|  5.22k|          if (val[k] < val[i]) {
  ------------------
  |  Branch (308:15): [True: 2.31k, False: 2.91k]
  ------------------
  309|  2.31k|            uint16_t t = val[k];
  310|  2.31k|            val[k] = val[i];
  311|  2.31k|            val[i] = t;
  312|  2.31k|          }
  313|  5.22k|        }
  314|  2.61k|      }
  315|  4.35k|      for (i = 0; i < 4; ++i) {
  ------------------
  |  Branch (315:19): [True: 3.48k, False: 871]
  ------------------
  316|  3.48k|        table[i].bits = 2;
  317|  3.48k|      }
  318|    871|      table[0].value = val[0];
  319|    871|      table[2].value = val[1];
  320|    871|      table[1].value = val[2];
  321|    871|      table[3].value = val[3];
  322|    871|      table_size = 4;
  323|    871|      break;
  324|      0|    }
  325|    930|    case 4: {
  ------------------
  |  Branch (325:5): [True: 930, False: 58.0k]
  ------------------
  326|    930|      int i;
  327|    930|      if (val[3] < val[2]) {
  ------------------
  |  Branch (327:11): [True: 455, False: 475]
  ------------------
  328|    455|        uint16_t t = val[3];
  329|    455|        val[3] = val[2];
  330|    455|        val[2] = t;
  331|    455|      }
  332|  7.44k|      for (i = 0; i < 7; ++i) {
  ------------------
  |  Branch (332:19): [True: 6.51k, False: 930]
  ------------------
  333|  6.51k|        table[i].value = val[0];
  334|  6.51k|        table[i].bits = (uint8_t)(1 + (i & 1));
  335|  6.51k|      }
  336|    930|      table[1].value = val[1];
  337|    930|      table[3].value = val[2];
  338|    930|      table[5].value = val[1];
  339|    930|      table[7].value = val[3];
  340|    930|      table[3].bits = 3;
  341|    930|      table[7].bits = 3;
  342|    930|      table_size = 8;
  343|    930|      break;
  344|      0|    }
  345|  59.0k|  }
  346|   492k|  while (table_size != goal_size) {
  ------------------
  |  Branch (346:10): [True: 433k, False: 59.0k]
  ------------------
  347|   433k|    memcpy(&table[table_size], &table[0],
  348|   433k|           (size_t)table_size * sizeof(table[0]));
  349|   433k|    table_size <<= 1;
  350|   433k|  }
  351|  59.0k|  return goal_size;
  352|  59.0k|}
huffman.c:ReplicateValue:
   82|  2.15M|                                         HuffmanCode code) {
   83|  5.24M|  do {
   84|  5.24M|    end -= step;
   85|  5.24M|    table[end] = code;
   86|  5.24M|  } while (end > 0);
  ------------------
  |  Branch (86:12): [True: 3.08M, False: 2.15M]
  ------------------
   87|  2.15M|}
huffman.c:BrotliReverseBits:
   70|  2.41M|static BROTLI_INLINE brotli_reg_t BrotliReverseBits(brotli_reg_t num) {
   71|       |#ifdef BROTLI_RBIT
   72|       |  return BROTLI_RBIT(num);
   73|       |#else
   74|  2.41M|  return kReverseBits[num];
   75|  2.41M|#endif
   76|  2.41M|}
huffman.c:NextTableBitSize:
   93|   254k|                                          int len, int root_bits) {
   94|   254k|  int left = 1 << (len - root_bits);
   95|   265k|  while (len < BROTLI_HUFFMAN_MAX_CODE_LENGTH) {
  ------------------
  |  |   19|   265k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
  |  Branch (95:10): [True: 264k, False: 122]
  ------------------
   96|   264k|    left -= count[len];
   97|   264k|    if (left <= 0) break;
  ------------------
  |  Branch (97:9): [True: 254k, False: 10.2k]
  ------------------
   98|  10.2k|    ++len;
   99|  10.2k|    left <<= 1;
  100|  10.2k|  }
  101|   254k|  return len - root_bits;
  102|   254k|}

BrotliDecoderStateInit:
   19|  6.68k|    brotli_alloc_func alloc_func, brotli_free_func free_func, void* opaque) {
   20|  6.68k|  if (!alloc_func) {
  ------------------
  |  Branch (20:7): [True: 6.68k, False: 0]
  ------------------
   21|  6.68k|    s->alloc_func = BrotliDefaultAllocFunc;
   22|  6.68k|    s->free_func = BrotliDefaultFreeFunc;
   23|  6.68k|    s->memory_manager_opaque = 0;
   24|  6.68k|  } else {
   25|      0|    s->alloc_func = alloc_func;
   26|      0|    s->free_func = free_func;
   27|      0|    s->memory_manager_opaque = opaque;
   28|      0|  }
   29|       |
   30|  6.68k|  s->error_code = 0; /* BROTLI_DECODER_NO_ERROR */
   31|       |
   32|  6.68k|  BrotliInitBitReader(&s->br);
   33|  6.68k|  s->state = BROTLI_STATE_UNINITED;
   34|  6.68k|  s->large_window = 0;
   35|  6.68k|  s->substate_metablock_header = BROTLI_STATE_METABLOCK_HEADER_NONE;
   36|  6.68k|  s->substate_tree_group = BROTLI_STATE_TREE_GROUP_NONE;
   37|  6.68k|  s->substate_context_map = BROTLI_STATE_CONTEXT_MAP_NONE;
   38|  6.68k|  s->substate_uncompressed = BROTLI_STATE_UNCOMPRESSED_NONE;
   39|  6.68k|  s->substate_huffman = BROTLI_STATE_HUFFMAN_NONE;
   40|  6.68k|  s->substate_decode_uint8 = BROTLI_STATE_DECODE_UINT8_NONE;
   41|  6.68k|  s->substate_read_block_length = BROTLI_STATE_READ_BLOCK_LENGTH_NONE;
   42|       |
   43|  6.68k|  s->buffer_length = 0;
   44|  6.68k|  s->loop_counter = 0;
   45|  6.68k|  s->pos = 0;
   46|  6.68k|  s->rb_roundtrips = 0;
   47|  6.68k|  s->partial_pos_out = 0;
   48|       |
   49|  6.68k|  s->block_type_trees = NULL;
   50|  6.68k|  s->block_len_trees = NULL;
   51|  6.68k|  s->ringbuffer = NULL;
   52|  6.68k|  s->ringbuffer_size = 0;
   53|  6.68k|  s->new_ringbuffer_size = 0;
   54|  6.68k|  s->ringbuffer_mask = 0;
   55|       |
   56|  6.68k|  s->context_map = NULL;
   57|  6.68k|  s->context_modes = NULL;
   58|  6.68k|  s->dist_context_map = NULL;
   59|  6.68k|  s->context_map_slice = NULL;
   60|  6.68k|  s->dist_context_map_slice = NULL;
   61|       |
   62|  6.68k|  s->sub_loop_counter = 0;
   63|       |
   64|  6.68k|  s->literal_hgroup.codes = NULL;
   65|  6.68k|  s->literal_hgroup.htrees = NULL;
   66|  6.68k|  s->insert_copy_hgroup.codes = NULL;
   67|  6.68k|  s->insert_copy_hgroup.htrees = NULL;
   68|  6.68k|  s->distance_hgroup.codes = NULL;
   69|  6.68k|  s->distance_hgroup.htrees = NULL;
   70|       |
   71|  6.68k|  s->is_last_metablock = 0;
   72|  6.68k|  s->is_uncompressed = 0;
   73|  6.68k|  s->is_metadata = 0;
   74|  6.68k|  s->should_wrap_ringbuffer = 0;
   75|  6.68k|  s->canny_ringbuffer_allocation = 1;
   76|       |
   77|  6.68k|  s->window_bits = 0;
   78|  6.68k|  s->max_distance = 0;
   79|  6.68k|  s->dist_rb[0] = 16;
   80|  6.68k|  s->dist_rb[1] = 15;
   81|  6.68k|  s->dist_rb[2] = 11;
   82|  6.68k|  s->dist_rb[3] = 4;
   83|  6.68k|  s->dist_rb_idx = 0;
   84|  6.68k|  s->block_type_trees = NULL;
   85|  6.68k|  s->block_len_trees = NULL;
   86|       |
   87|       |  /* Make small negative indexes addressable. */
   88|  6.68k|  s->symbol_lists = &s->symbols_lists_array[BROTLI_HUFFMAN_MAX_CODE_LENGTH + 1];
  ------------------
  |  |   19|  6.68k|#define BROTLI_HUFFMAN_MAX_CODE_LENGTH 15
  ------------------
   89|       |
   90|  6.68k|  s->mtf_upper_bound = 63;
   91|       |
   92|  6.68k|  s->dictionary = BrotliGetDictionary();
   93|  6.68k|  s->transforms = BrotliGetTransforms();
   94|       |
   95|  6.68k|  return BROTLI_TRUE;
  ------------------
  |  |   51|  6.68k|#define BROTLI_TRUE 1
  ------------------
   96|  6.68k|}
BrotliDecoderStateMetablockBegin:
   98|   157k|void BrotliDecoderStateMetablockBegin(BrotliDecoderState* s) {
   99|   157k|  s->meta_block_remaining_len = 0;
  100|   157k|  s->block_length[0] = 1U << 24;
  101|   157k|  s->block_length[1] = 1U << 24;
  102|   157k|  s->block_length[2] = 1U << 24;
  103|   157k|  s->num_block_types[0] = 1;
  104|   157k|  s->num_block_types[1] = 1;
  105|   157k|  s->num_block_types[2] = 1;
  106|   157k|  s->block_type_rb[0] = 1;
  107|   157k|  s->block_type_rb[1] = 0;
  108|   157k|  s->block_type_rb[2] = 1;
  109|   157k|  s->block_type_rb[3] = 0;
  110|   157k|  s->block_type_rb[4] = 1;
  111|   157k|  s->block_type_rb[5] = 0;
  112|   157k|  s->context_map = NULL;
  113|   157k|  s->context_modes = NULL;
  114|   157k|  s->dist_context_map = NULL;
  115|   157k|  s->context_map_slice = NULL;
  116|   157k|  s->literal_htree = NULL;
  117|   157k|  s->dist_context_map_slice = NULL;
  118|   157k|  s->dist_htree_index = 0;
  119|   157k|  s->context_lookup = NULL;
  120|   157k|  s->literal_hgroup.codes = NULL;
  121|   157k|  s->literal_hgroup.htrees = NULL;
  122|   157k|  s->insert_copy_hgroup.codes = NULL;
  123|   157k|  s->insert_copy_hgroup.htrees = NULL;
  124|   157k|  s->distance_hgroup.codes = NULL;
  125|       |  s->distance_hgroup.htrees = NULL;
  126|   157k|}
BrotliDecoderStateCleanupAfterMetablock:
  128|   161k|void BrotliDecoderStateCleanupAfterMetablock(BrotliDecoderState* s) {
  129|   161k|  BROTLI_DECODER_FREE(s, s->context_modes);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  130|   161k|  BROTLI_DECODER_FREE(s, s->context_map);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  131|   161k|  BROTLI_DECODER_FREE(s, s->dist_context_map);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  132|   161k|  BROTLI_DECODER_FREE(s, s->literal_hgroup.htrees);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  133|   161k|  BROTLI_DECODER_FREE(s, s->insert_copy_hgroup.htrees);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  134|       |  BROTLI_DECODER_FREE(s, s->distance_hgroup.htrees);
  ------------------
  |  |  249|   161k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|   161k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|   161k|  X = NULL;                                  \
  |  |  252|   161k|}
  ------------------
  135|   161k|}
BrotliDecoderStateCleanup:
  137|  6.68k|void BrotliDecoderStateCleanup(BrotliDecoderState* s) {
  138|  6.68k|  BrotliDecoderStateCleanupAfterMetablock(s);
  139|       |
  140|  6.68k|  BROTLI_DECODER_FREE(s, s->ringbuffer);
  ------------------
  |  |  249|  6.68k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|  6.68k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|  6.68k|  X = NULL;                                  \
  |  |  252|  6.68k|}
  ------------------
  141|       |  BROTLI_DECODER_FREE(s, s->block_type_trees);
  ------------------
  |  |  249|  6.68k|#define BROTLI_DECODER_FREE(S, X) {          \
  |  |  250|  6.68k|  S->free_func(S->memory_manager_opaque, X); \
  |  |  251|  6.68k|  X = NULL;                                  \
  |  |  252|  6.68k|}
  ------------------
  142|  6.68k|}
BrotliDecoderHuffmanTreeGroupInit:
  146|  45.8k|    uint32_t ntrees) {
  147|       |  /* Pack two allocations into one */
  148|  45.8k|  const size_t max_table_size = kMaxHuffmanTableSize[(alphabet_size + 31) >> 5];
  149|  45.8k|  const size_t code_size = sizeof(HuffmanCode) * ntrees * max_table_size;
  150|  45.8k|  const size_t htree_size = sizeof(HuffmanCode*) * ntrees;
  151|       |  /* Pointer alignment is, hopefully, wider than sizeof(HuffmanCode). */
  152|  45.8k|  HuffmanCode** p = (HuffmanCode**)BROTLI_DECODER_ALLOC(s,
  ------------------
  |  |  247|  45.8k|#define BROTLI_DECODER_ALLOC(S, L) S->alloc_func(S->memory_manager_opaque, L)
  ------------------
  153|  45.8k|      code_size + htree_size);
  154|  45.8k|  group->alphabet_size = (uint16_t)alphabet_size;
  155|  45.8k|  group->max_symbol = (uint16_t)max_symbol;
  156|  45.8k|  group->num_htrees = (uint16_t)ntrees;
  157|  45.8k|  group->htrees = p;
  158|  45.8k|  group->codes = (HuffmanCode*)(&p[ntrees]);
  159|  45.8k|  return !!p;
  160|  45.8k|}

_ZN5woff28WOFF2OutD2Ev:
   35|  8.64k|  virtual ~WOFF2Out(void) {}
_ZN5woff214WOFF2StringOut4SizeEv:
   60|   504k|  size_t Size() override { return offset_; }

_ZN5woff26BufferC2EPKhm:
   61|  86.0k|      : buffer_(data),
   62|  86.0k|        length_(len),
   63|  86.0k|        offset_(0) { }
_ZN5woff26Buffer4SkipEm:
   65|   164k|  bool Skip(size_t n_bytes) {
   66|       |    return Read(NULL, n_bytes);
   67|   164k|  }
_ZN5woff26Buffer4ReadEPhm:
   69|   237k|  bool Read(uint8_t *data, size_t n_bytes) {
   70|   237k|    if (n_bytes > 1024 * 1024 * 1024) {
  ------------------
  |  Branch (70:9): [True: 0, False: 237k]
  ------------------
   71|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   72|      0|    }
   73|   237k|    if ((offset_ + n_bytes > length_) ||
  ------------------
  |  Branch (73:9): [True: 213, False: 236k]
  ------------------
   74|   236k|        (offset_ > length_ - n_bytes)) {
  ------------------
  |  Branch (74:9): [True: 0, False: 236k]
  ------------------
   75|    213|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    213|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   76|    213|    }
   77|   236k|    if (data) {
  ------------------
  |  Branch (77:9): [True: 72.3k, False: 164k]
  ------------------
   78|  72.3k|      std::memcpy(data, buffer_ + offset_, n_bytes);
   79|  72.3k|    }
   80|   236k|    offset_ += n_bytes;
   81|   236k|    return true;
   82|   237k|  }
_ZN5woff26Buffer7ReadU32EPj:
  118|   108k|  bool ReadU32(uint32_t *value) {
  119|   108k|    if (length_ < 4 || offset_ > length_ - 4) {
  ------------------
  |  Branch (119:9): [True: 3, False: 108k]
  |  Branch (119:24): [True: 89, False: 108k]
  ------------------
  120|     92|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     92|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  121|     92|    }
  122|   108k|    std::memcpy(value, buffer_ + offset_, sizeof(uint32_t));
  123|       |    *value = ntohl(*value);
  124|   108k|    offset_ += 4;
  125|   108k|    return true;
  126|   108k|  }
_ZN5woff26Buffer7ReadU16EPt:
   93|   173k|  bool ReadU16(uint16_t *value) {
   94|   173k|    if (length_ < 2 || offset_ > length_ - 2) {
  ------------------
  |  Branch (94:9): [True: 29, False: 173k]
  |  Branch (94:24): [True: 61, False: 173k]
  ------------------
   95|     90|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     90|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   96|     90|    }
   97|   173k|    std::memcpy(value, buffer_ + offset_, sizeof(uint16_t));
   98|       |    *value = ntohs(*value);
   99|   173k|    offset_ += 2;
  100|   173k|    return true;
  101|   173k|  }
_ZN5woff26Buffer6ReadU8EPh:
   84|  5.46M|  inline bool ReadU8(uint8_t *value) {
   85|  5.46M|    if (length_ < 1 || offset_ > length_ - 1) {
  ------------------
  |  Branch (85:9): [True: 6, False: 5.46M]
  |  Branch (85:24): [True: 510, False: 5.46M]
  ------------------
   86|    516|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    516|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   87|    516|    }
   88|  5.46M|    *value = buffer_[offset_];
   89|  5.46M|    ++offset_;
   90|  5.46M|    return true;
   91|  5.46M|  }
_ZNK5woff26Buffer6offsetEv:
  151|   292k|  size_t offset() const { return offset_; }
_ZNK5woff26Buffer6bufferEv:
  150|   142k|  const uint8_t *buffer() const { return buffer_; }
_ZNK5woff26Buffer6lengthEv:
  152|   141k|  size_t length() const { return length_; }
_ZN5woff26Buffer7ReadS16EPs:
  103|  71.2k|  bool ReadS16(int16_t *value) {
  104|  71.2k|    return ReadU16(reinterpret_cast<uint16_t*>(value));
  105|  71.2k|  }

LLVMFuzzerTestOneInput:
    7|  8.64k|extern "C" int LLVMFuzzerTestOneInput(const uint8_t* data, size_t size) {
    8|  8.64k|  std::string buf;
    9|  8.64k|  woff2::WOFF2StringOut out(&buf);
   10|  8.64k|  out.SetMaxSize(30 * 1024 * 1024);
   11|  8.64k|  woff2::ConvertWOFF2ToTTF(data, size, &out);
   12|  8.64k|  return 0;
   13|  8.64k|}

_ZN5woff26Round4ImEET_S1_:
   18|   112k|template<typename T> T Round4(T value) {
   19|   112k|  if (std::numeric_limits<T>::max() - value < 3) {
  ------------------
  |  Branch (19:7): [True: 0, False: 112k]
  ------------------
   20|      0|    return value;
   21|      0|  }
   22|   112k|  return (value + 3) & ~3;
   23|   112k|}
_ZN5woff26Round4IjEET_S1_:
   18|     84|template<typename T> T Round4(T value) {
   19|     84|  if (std::numeric_limits<T>::max() - value < 3) {
  ------------------
  |  Branch (19:7): [True: 0, False: 84]
  ------------------
   20|      0|    return value;
   21|      0|  }
   22|     84|  return (value + 3) & ~3;
   23|     84|}

_ZN5woff28StoreU32EPhmj:
   21|  5.37M|inline size_t StoreU32(uint8_t* dst, size_t offset, uint32_t x) {
   22|  5.37M|  dst[offset] = x >> 24;
   23|  5.37M|  dst[offset + 1] = x >> 16;
   24|  5.37M|  dst[offset + 2] = x >> 8;
   25|  5.37M|  dst[offset + 3] = x;
   26|  5.37M|  return offset + 4;
   27|  5.37M|}
_ZN5woff27Store16EPhmi:
   29|  1.82M|inline size_t Store16(uint8_t* dst, size_t offset, int x) {
   30|  1.82M|  dst[offset] = x >> 8;
   31|  1.82M|  dst[offset + 1] = x;
   32|  1.82M|  return offset + 2;
   33|  1.82M|}
_ZN5woff27Store16EiPmPh:
   42|    701|inline void Store16(int val, size_t* offset, uint8_t* dst) {
   43|    701|  dst[(*offset)++] = val >> 8;
   44|    701|  dst[(*offset)++] = val;
   45|    701|}

_ZN5woff213Read255UShortEPNS_6BufferEPj:
   50|   599k|bool Read255UShort(Buffer* buf, unsigned int* value) {
   51|   599k|  static const int kWordCode = 253;
   52|   599k|  static const int kOneMoreByteCode2 = 254;
   53|   599k|  static const int kOneMoreByteCode1 = 255;
   54|   599k|  static const int kLowestUCode = 253;
   55|   599k|  uint8_t code = 0;
   56|   599k|  if (!buf->ReadU8(&code)) {
  ------------------
  |  Branch (56:7): [True: 279, False: 599k]
  ------------------
   57|    279|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    279|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   58|    279|  }
   59|   599k|  if (code == kWordCode) {
  ------------------
  |  Branch (59:7): [True: 924, False: 598k]
  ------------------
   60|    924|    uint16_t result = 0;
   61|    924|    if (!buf->ReadU16(&result)) {
  ------------------
  |  Branch (61:9): [True: 7, False: 917]
  ------------------
   62|      7|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      7|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   63|      7|    }
   64|    917|    *value = result;
   65|    917|    return true;
   66|   598k|  } else if (code == kOneMoreByteCode1) {
  ------------------
  |  Branch (66:14): [True: 4.96k, False: 593k]
  ------------------
   67|  4.96k|    uint8_t result = 0;
   68|  4.96k|    if (!buf->ReadU8(&result)) {
  ------------------
  |  Branch (68:9): [True: 10, False: 4.95k]
  ------------------
   69|     10|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     10|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   70|     10|    }
   71|  4.95k|    *value = result + kLowestUCode;
   72|  4.95k|    return true;
   73|   593k|  } else if (code == kOneMoreByteCode2) {
  ------------------
  |  Branch (73:14): [True: 7.64k, False: 585k]
  ------------------
   74|  7.64k|    uint8_t result = 0;
   75|  7.64k|    if (!buf->ReadU8(&result)) {
  ------------------
  |  Branch (75:9): [True: 10, False: 7.63k]
  ------------------
   76|     10|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     10|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   77|     10|    }
   78|  7.63k|    *value = result + kLowestUCode * 2;
   79|  7.63k|    return true;
   80|   585k|  } else {
   81|   585k|    *value = code;
   82|   585k|    return true;
   83|   585k|  }
   84|   599k|}
_ZN5woff211ReadBase128EPNS_6BufferEPj:
   86|  2.46M|bool ReadBase128(Buffer* buf, uint32_t* value) {
   87|  2.46M|  uint32_t result = 0;
   88|  2.55M|  for (size_t i = 0; i < 5; ++i) {
  ------------------
  |  Branch (88:22): [True: 2.55M, False: 2]
  ------------------
   89|  2.55M|    uint8_t code = 0;
   90|  2.55M|    if (!buf->ReadU8(&code)) {
  ------------------
  |  Branch (90:9): [True: 125, False: 2.55M]
  ------------------
   91|    125|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    125|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   92|    125|    }
   93|       |    // Leading zeros are invalid.
   94|  2.55M|    if (i == 0 && code == 0x80) {
  ------------------
  |  Branch (94:9): [True: 2.46M, False: 88.6k]
  |  Branch (94:19): [True: 6, False: 2.46M]
  ------------------
   95|      6|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      6|#define FONT_COMPRESSION_FAILURE() false
  ------------------
   96|      6|    }
   97|       |    // If any of the top seven bits are set then we're about to overflow.
   98|  2.55M|    if (result & 0xfe000000) {
  ------------------
  |  Branch (98:9): [True: 16, False: 2.55M]
  ------------------
   99|     16|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     16|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  100|     16|    }
  101|  2.55M|    result = (result << 7) | (code & 0x7f);
  102|  2.55M|    if ((code & 0x80) == 0) {
  ------------------
  |  Branch (102:9): [True: 2.46M, False: 88.6k]
  ------------------
  103|  2.46M|      *value = result;
  104|  2.46M|      return true;
  105|  2.46M|    }
  106|  2.55M|  }
  107|       |  // Make sure not to exceed the size bound
  108|      2|  return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  109|  2.46M|}

_ZN5woff215ComputeULongSumEPKhm:
   18|   118k|uint32_t ComputeULongSum(const uint8_t* buf, size_t size) {
   19|   118k|  uint32_t checksum = 0;
   20|   118k|  size_t aligned_size = size & ~3;
   21|  10.9M|  for (size_t i = 0; i < aligned_size; i += 4) {
  ------------------
  |  Branch (21:22): [True: 10.7M, False: 118k]
  ------------------
   22|  10.7M|    checksum +=
   23|  10.7M|        (buf[i] << 24) | (buf[i + 1] << 16) | (buf[i + 2] << 8) | buf[i + 3];
   24|  10.7M|  }
   25|       |
   26|       |  // treat size not aligned on 4 as if it were padded to 4 with 0's
   27|   118k|  if (size != aligned_size) {
  ------------------
  |  Branch (27:7): [True: 53.3k, False: 65.6k]
  ------------------
   28|  53.3k|    uint32_t v = 0;
   29|   158k|    for (size_t i = aligned_size; i < size; ++i) {
  ------------------
  |  Branch (29:35): [True: 105k, False: 53.3k]
  ------------------
   30|   105k|      v |= buf[i] << (24 - 8 * (i & 3));
   31|   105k|    }
   32|  53.3k|    checksum += v;
   33|  53.3k|  }
   34|       |
   35|   118k|  return checksum;
   36|   118k|}
_ZN5woff220CollectionHeaderSizeEjj:
   38|    496|size_t CollectionHeaderSize(uint32_t header_version, uint32_t num_fonts) {
   39|    496|  size_t size = 0;
   40|    496|  if (header_version == 0x00020000) {
  ------------------
  |  Branch (40:7): [True: 196, False: 300]
  ------------------
   41|    196|    size += 12;  // ulDsig{Tag,Length,Offset}
   42|    196|  }
   43|    496|  if (header_version == 0x00010000 || header_version == 0x00020000) {
  ------------------
  |  Branch (43:7): [True: 300, False: 196]
  |  Branch (43:39): [True: 196, False: 0]
  ------------------
   44|    496|    size += 12   // TTCTag, Version, numFonts
   45|    496|      + 4 * num_fonts;  // OffsetTable[numFonts]
   46|    496|  }
   47|    496|  return size;
   48|    496|}

_ZNK5woff25TableltERKS0_:
   48|  7.37M|  bool operator<(const Table& other) const {
   49|  7.37M|    return tag < other.tag;
   50|  7.37M|  }

_ZN5woff217ConvertWOFF2ToTTFEPKhmPNS_8WOFF2OutE:
 1357|  8.64k|                       WOFF2Out* out) {
 1358|  8.64k|  RebuildMetadata metadata;
 1359|  8.64k|  WOFF2Header hdr;
 1360|  8.64k|  if (!ReadWOFF2Header(data, length, &hdr)) {
  ------------------
  |  Branch (1360:7): [True: 1.28k, False: 7.35k]
  ------------------
 1361|  1.28k|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|  1.28k|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1362|  1.28k|  }
 1363|       |
 1364|  7.35k|  if (!WriteHeaders(data, length, &metadata, &hdr, out)) {
  ------------------
  |  Branch (1364:7): [True: 0, False: 7.35k]
  ------------------
 1365|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1366|      0|  }
 1367|       |
 1368|  7.35k|  const float compression_ratio = (float) hdr.uncompressed_size / length;
 1369|  7.35k|  if (compression_ratio > kMaxPlausibleCompressionRatio) {
  ------------------
  |  Branch (1369:7): [True: 592, False: 6.76k]
  ------------------
 1370|       |#ifdef FONT_COMPRESSION_BIN
 1371|       |    fprintf(stderr, "Implausible compression ratio %.01f\n", compression_ratio);
 1372|       |#endif
 1373|    592|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    592|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1374|    592|  }
 1375|       |
 1376|  6.76k|  const uint8_t* src_buf = data + hdr.compressed_offset;
 1377|  6.76k|  std::vector<uint8_t> uncompressed_buf(hdr.uncompressed_size);
 1378|  6.76k|  if (PREDICT_FALSE(hdr.uncompressed_size < 1)) {
  ------------------
  |  |   48|  6.76k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 82, False: 6.68k]
  |  |  ------------------
  ------------------
 1379|     82|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     82|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1380|     82|  }
 1381|  6.68k|  if (PREDICT_FALSE(!Woff2Uncompress(&uncompressed_buf[0],
  ------------------
  |  |   48|  6.68k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 5.28k, False: 1.40k]
  |  |  ------------------
  ------------------
 1382|  6.68k|                                     hdr.uncompressed_size, src_buf,
 1383|  6.68k|                                     hdr.compressed_length))) {
 1384|  5.28k|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|  5.28k|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1385|  5.28k|  }
 1386|       |
 1387|  2.34k|  for (size_t i = 0; i < metadata.font_infos.size(); i++) {
  ------------------
  |  Branch (1387:22): [True: 2.00k, False: 341]
  ------------------
 1388|  2.00k|    if (PREDICT_FALSE(!ReconstructFont(&uncompressed_buf[0],
  ------------------
  |  |   48|  2.00k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 1.06k, False: 942]
  |  |  ------------------
  ------------------
 1389|  2.00k|                                       hdr.uncompressed_size,
 1390|  2.00k|                                       &metadata, &hdr, i, out))) {
 1391|  1.06k|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|  1.06k|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1392|  1.06k|    }
 1393|  2.00k|  }
 1394|       |
 1395|    341|  return true;
 1396|  1.40k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115ReadWOFF2HeaderEPKhmPNS0_11WOFF2HeaderE:
 1073|  8.64k|bool ReadWOFF2Header(const uint8_t* data, size_t length, WOFF2Header* hdr) {
 1074|  8.64k|  Buffer file(data, length);
 1075|       |
 1076|  8.64k|  uint32_t signature;
 1077|  8.64k|  if (PREDICT_FALSE(!file.ReadU32(&signature) || signature != kWoff2Signature ||
  ------------------
  |  |   48|  34.5k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 60, False: 8.58k]
  |  |  |  Branch (48:44): [True: 3, False: 8.64k]
  |  |  |  Branch (48:44): [True: 54, False: 8.58k]
  |  |  |  Branch (48:44): [True: 3, False: 8.58k]
  |  |  ------------------
  ------------------
 1078|  8.64k|      !file.ReadU32(&hdr->flavor))) {
 1079|     60|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     60|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1080|     60|  }
 1081|       |
 1082|       |  // TODO(user): Should call IsValidVersionTag() here.
 1083|       |
 1084|  8.58k|  uint32_t reported_length;
 1085|  8.58k|  if (PREDICT_FALSE(
  ------------------
  |  |   48|  17.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 66, False: 8.51k]
  |  |  |  Branch (48:44): [True: 3, False: 8.58k]
  |  |  |  Branch (48:44): [True: 63, False: 8.51k]
  |  |  ------------------
  ------------------
 1086|  8.58k|      !file.ReadU32(&reported_length) || length != reported_length)) {
 1087|     66|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     66|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1088|     66|  }
 1089|  8.51k|  if (PREDICT_FALSE(!file.ReadU16(&hdr->num_tables) || !hdr->num_tables)) {
  ------------------
  |  |   48|  17.0k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 3, False: 8.51k]
  |  |  |  Branch (48:44): [True: 2, False: 8.51k]
  |  |  |  Branch (48:44): [True: 1, False: 8.51k]
  |  |  ------------------
  ------------------
 1090|      3|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      3|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1091|      3|  }
 1092|       |
 1093|       |  // We don't care about these fields of the header:
 1094|       |  //   uint16_t reserved
 1095|       |  //   uint32_t total_sfnt_size, we don't believe this, will compute later
 1096|  8.51k|  if (PREDICT_FALSE(!file.Skip(6))) {
  ------------------
  |  |   48|  8.51k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 21, False: 8.49k]
  |  |  ------------------
  ------------------
 1097|     21|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     21|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1098|     21|  }
 1099|  8.49k|  if (PREDICT_FALSE(!file.ReadU32(&hdr->compressed_length))) {
  ------------------
  |  |   48|  8.49k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 4, False: 8.48k]
  |  |  ------------------
  ------------------
 1100|      4|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      4|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1101|      4|  }
 1102|       |  // We don't care about these fields of the header:
 1103|       |  //   uint16_t major_version, minor_version
 1104|  8.48k|  if (PREDICT_FALSE(!file.Skip(2 * 2))) {
  ------------------
  |  |   48|  8.48k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 3, False: 8.48k]
  |  |  ------------------
  ------------------
 1105|      3|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      3|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1106|      3|  }
 1107|  8.48k|  uint32_t meta_offset;
 1108|  8.48k|  uint32_t meta_length;
 1109|  8.48k|  uint32_t meta_length_orig;
 1110|  8.48k|  if (PREDICT_FALSE(!file.ReadU32(&meta_offset) ||
  ------------------
  |  |   48|  33.9k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 9, False: 8.47k]
  |  |  |  Branch (48:44): [True: 3, False: 8.48k]
  |  |  |  Branch (48:44): [True: 3, False: 8.48k]
  |  |  |  Branch (48:44): [True: 3, False: 8.47k]
  |  |  ------------------
  ------------------
 1111|  8.48k|      !file.ReadU32(&meta_length) ||
 1112|  8.48k|      !file.ReadU32(&meta_length_orig))) {
 1113|      9|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      9|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1114|      9|  }
 1115|  8.47k|  if (meta_offset) {
  ------------------
  |  Branch (1115:7): [True: 298, False: 8.17k]
  ------------------
 1116|    298|    if (PREDICT_FALSE(
  ------------------
  |  |   48|    542|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 88, False: 210]
  |  |  |  Branch (48:44): [True: 54, False: 244]
  |  |  |  Branch (48:44): [True: 34, False: 210]
  |  |  ------------------
  ------------------
 1117|    298|        meta_offset >= length || length - meta_offset < meta_length)) {
 1118|     88|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     88|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1119|     88|    }
 1120|    298|  }
 1121|  8.38k|  uint32_t priv_offset;
 1122|  8.38k|  uint32_t priv_length;
 1123|  8.38k|  if (PREDICT_FALSE(!file.ReadU32(&priv_offset) ||
  ------------------
  |  |   48|  16.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 12, False: 8.37k]
  |  |  |  Branch (48:44): [True: 9, False: 8.38k]
  |  |  |  Branch (48:44): [True: 3, False: 8.37k]
  |  |  ------------------
  ------------------
 1124|  8.38k|      !file.ReadU32(&priv_length))) {
 1125|     12|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     12|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1126|     12|  }
 1127|  8.37k|  if (priv_offset) {
  ------------------
  |  Branch (1127:7): [True: 294, False: 8.08k]
  ------------------
 1128|    294|    if (PREDICT_FALSE(
  ------------------
  |  |   48|    539|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 77, False: 217]
  |  |  |  Branch (48:44): [True: 49, False: 245]
  |  |  |  Branch (48:44): [True: 28, False: 217]
  |  |  ------------------
  ------------------
 1129|    294|        priv_offset >= length || length - priv_offset < priv_length)) {
 1130|     77|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     77|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1131|     77|    }
 1132|    294|  }
 1133|  8.30k|  hdr->tables.resize(hdr->num_tables);
 1134|  8.30k|  if (PREDICT_FALSE(!ReadTableDirectory(
  ------------------
  |  |   48|  8.30k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 316, False: 7.98k]
  |  |  ------------------
  ------------------
 1135|  8.30k|          &file, &hdr->tables, hdr->num_tables))) {
 1136|    316|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    316|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1137|    316|  }
 1138|       |
 1139|       |  // Before we sort for output the last table end is the uncompressed size.
 1140|  7.98k|  Table& last_table = hdr->tables.back();
 1141|  7.98k|  hdr->uncompressed_size = last_table.src_offset + last_table.src_length;
 1142|  7.98k|  if (PREDICT_FALSE(hdr->uncompressed_size < last_table.src_offset)) {
  ------------------
  |  |   48|  7.98k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 7.98k]
  |  |  ------------------
  ------------------
 1143|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1144|      0|  }
 1145|       |
 1146|  7.98k|  hdr->header_version = 0;
 1147|       |
 1148|  7.98k|  if (hdr->flavor == kTtcFontFlavor) {
  ------------------
  |  Branch (1148:7): [True: 622, False: 7.36k]
  ------------------
 1149|    622|    if (PREDICT_FALSE(!file.ReadU32(&hdr->header_version))) {
  ------------------
  |  |   48|    622|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 14, False: 608]
  |  |  ------------------
  ------------------
 1150|     14|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     14|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1151|     14|    }
 1152|    608|    if (PREDICT_FALSE(hdr->header_version != 0x00010000
  ------------------
  |  |   48|    846|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 82, False: 526]
  |  |  |  Branch (48:44): [True: 238, False: 370]
  |  |  |  Branch (48:44): [True: 82, False: 156]
  |  |  ------------------
  ------------------
 1153|    608|                   && hdr->header_version != 0x00020000)) {
 1154|     82|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     82|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1155|     82|    }
 1156|    526|    uint32_t num_fonts;
 1157|    526|    if (PREDICT_FALSE(!Read255UShort(&file, &num_fonts) || !num_fonts)) {
  ------------------
  |  |   48|  1.04k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 8, False: 518]
  |  |  |  Branch (48:44): [True: 6, False: 520]
  |  |  |  Branch (48:44): [True: 2, False: 518]
  |  |  ------------------
  ------------------
 1158|      8|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      8|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1159|      8|    }
 1160|    518|    hdr->ttc_fonts.resize(num_fonts);
 1161|       |
 1162|  5.92k|    for (uint32_t i = 0; i < num_fonts; i++) {
  ------------------
  |  Branch (1162:26): [True: 5.67k, False: 252]
  ------------------
 1163|  5.67k|      TtcFont& ttc_font = hdr->ttc_fonts[i];
 1164|  5.67k|      uint32_t num_tables;
 1165|  5.67k|      if (PREDICT_FALSE(!Read255UShort(&file, &num_tables) || !num_tables)) {
  ------------------
  |  |   48|  11.2k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 57, False: 5.61k]
  |  |  |  Branch (48:44): [True: 51, False: 5.62k]
  |  |  |  Branch (48:44): [True: 6, False: 5.61k]
  |  |  ------------------
  ------------------
 1166|     57|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     57|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1167|     57|      }
 1168|  5.61k|      if (PREDICT_FALSE(!file.ReadU32(&ttc_font.flavor))) {
  ------------------
  |  |   48|  5.61k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 34, False: 5.58k]
  |  |  ------------------
  ------------------
 1169|     34|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     34|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1170|     34|      }
 1171|       |
 1172|  5.58k|      ttc_font.table_indices.resize(num_tables);
 1173|       |
 1174|       |
 1175|  5.58k|      unsigned int glyf_idx = 0;
 1176|  5.58k|      unsigned int loca_idx = 0;
 1177|       |
 1178|   164k|      for (uint32_t j = 0; j < num_tables; j++) {
  ------------------
  |  Branch (1178:28): [True: 159k, False: 5.42k]
  ------------------
 1179|   159k|        unsigned int table_idx;
 1180|   159k|        if (PREDICT_FALSE(!Read255UShort(&file, &table_idx)) ||
  ------------------
  |  |   48|   318k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 117, False: 159k]
  |  |  ------------------
  ------------------
 1181|   159k|            table_idx >= hdr->tables.size()) {
  ------------------
  |  Branch (1181:13): [True: 44, False: 159k]
  ------------------
 1182|    161|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    161|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1183|    161|        }
 1184|   159k|        ttc_font.table_indices[j] = table_idx;
 1185|       |
 1186|   159k|        const Table& table = hdr->tables[table_idx];
 1187|   159k|        if (table.tag == kLocaTableTag) {
  ------------------
  |  Branch (1187:13): [True: 1.27k, False: 157k]
  ------------------
 1188|  1.27k|          loca_idx = table_idx;
 1189|  1.27k|        }
 1190|   159k|        if (table.tag == kGlyfTableTag) {
  ------------------
  |  Branch (1190:13): [True: 870, False: 158k]
  ------------------
 1191|    870|          glyf_idx = table_idx;
 1192|    870|        }
 1193|       |
 1194|   159k|      }
 1195|       |
 1196|       |      // if we have both glyf and loca make sure they are consecutive
 1197|       |      // if we have just one we'll reject the font elsewhere
 1198|  5.42k|      if (glyf_idx > 0 || loca_idx > 0) {
  ------------------
  |  Branch (1198:11): [True: 30, False: 5.39k]
  |  Branch (1198:27): [True: 343, False: 5.04k]
  ------------------
 1199|    373|        if (PREDICT_FALSE(glyf_idx > loca_idx || loca_idx - glyf_idx != 1)) {
  ------------------
  |  |   48|    741|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 14, False: 359]
  |  |  |  Branch (48:44): [True: 5, False: 368]
  |  |  |  Branch (48:44): [True: 9, False: 359]
  |  |  ------------------
  ------------------
 1200|       |#ifdef FONT_COMPRESSION_BIN
 1201|       |        fprintf(stderr, "TTC font %d has non-consecutive glyf/loca\n", i);
 1202|       |#endif
 1203|     14|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     14|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1204|     14|        }
 1205|    373|      }
 1206|  5.42k|    }
 1207|    518|  }
 1208|       |
 1209|  7.61k|  const uint64_t first_table_offset = ComputeOffsetToFirstTable(*hdr);
 1210|       |
 1211|  7.61k|  hdr->compressed_offset = file.offset();
 1212|  7.61k|  if (PREDICT_FALSE(hdr->compressed_offset >
  ------------------
  |  |   48|  7.61k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 7.61k]
  |  |  ------------------
  ------------------
 1213|  7.61k|                    std::numeric_limits<uint32_t>::max())) {
 1214|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1215|      0|  }
 1216|  7.61k|  uint64_t src_offset = Round4(hdr->compressed_offset + hdr->compressed_length);
 1217|  7.61k|  uint64_t dst_offset = first_table_offset;
 1218|       |
 1219|       |
 1220|  7.61k|  if (PREDICT_FALSE(src_offset > length)) {
  ------------------
  |  |   48|  7.61k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 137, False: 7.47k]
  |  |  ------------------
  ------------------
 1221|       |#ifdef FONT_COMPRESSION_BIN
 1222|       |    fprintf(stderr, "offset fail; src_offset %" PRIu64 " length %lu "
 1223|       |      "dst_offset %" PRIu64 "\n",
 1224|       |      src_offset, length, dst_offset);
 1225|       |#endif
 1226|    137|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    137|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1227|    137|  }
 1228|  7.47k|  if (meta_offset) {
  ------------------
  |  Branch (1228:7): [True: 60, False: 7.41k]
  ------------------
 1229|     60|    if (PREDICT_FALSE(src_offset != meta_offset)) {
  ------------------
  |  |   48|     60|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 35, False: 25]
  |  |  ------------------
  ------------------
 1230|     35|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     35|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1231|     35|    }
 1232|     25|    src_offset = Round4(meta_offset + meta_length);
 1233|     25|    if (PREDICT_FALSE(src_offset > std::numeric_limits<uint32_t>::max())) {
  ------------------
  |  |   48|     25|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 25]
  |  |  ------------------
  ------------------
 1234|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1235|      0|    }
 1236|     25|  }
 1237|       |
 1238|  7.44k|  if (priv_offset) {
  ------------------
  |  Branch (1238:7): [True: 96, False: 7.34k]
  ------------------
 1239|     96|    if (PREDICT_FALSE(src_offset != priv_offset)) {
  ------------------
  |  |   48|     96|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 37, False: 59]
  |  |  ------------------
  ------------------
 1240|     37|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     37|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1241|     37|    }
 1242|     59|    src_offset = Round4(priv_offset + priv_length);
 1243|     59|    if (PREDICT_FALSE(src_offset > std::numeric_limits<uint32_t>::max())) {
  ------------------
  |  |   48|     59|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 59]
  |  |  ------------------
  ------------------
 1244|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1245|      0|    }
 1246|     59|  }
 1247|       |
 1248|  7.40k|  if (PREDICT_FALSE(src_offset != Round4(length))) {
  ------------------
  |  |   48|  7.40k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 47, False: 7.35k]
  |  |  ------------------
  ------------------
 1249|     47|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     47|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1250|     47|  }
 1251|       |
 1252|  7.35k|  return true;
 1253|  7.40k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_118ReadTableDirectoryEPNS_6BufferEPNSt3__16vectorINS_5TableENS3_9allocatorIS5_EEEEm:
  811|  8.30k|    size_t num_tables) {
  812|  8.30k|  uint32_t src_offset = 0;
  813|  2.30M|  for (size_t i = 0; i < num_tables; ++i) {
  ------------------
  |  Branch (813:22): [True: 2.29M, False: 7.98k]
  ------------------
  814|  2.29M|    Table* table = &(*tables)[i];
  815|  2.29M|    uint8_t flag_byte;
  816|  2.29M|    if (PREDICT_FALSE(!file->ReadU8(&flag_byte))) {
  ------------------
  |  |   48|  2.29M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 90, False: 2.29M]
  |  |  ------------------
  ------------------
  817|     90|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     90|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  818|     90|    }
  819|  2.29M|    uint32_t tag;
  820|  2.29M|    if ((flag_byte & 0x3f) == 0x3f) {
  ------------------
  |  Branch (820:9): [True: 21.1k, False: 2.27M]
  ------------------
  821|  21.1k|      if (PREDICT_FALSE(!file->ReadU32(&tag))) {
  ------------------
  |  |   48|  21.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 10, False: 21.1k]
  |  |  ------------------
  ------------------
  822|     10|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     10|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  823|     10|      }
  824|  2.27M|    } else {
  825|  2.27M|      tag = kKnownTags[flag_byte & 0x3f];
  826|  2.27M|    }
  827|  2.29M|    uint32_t flags = 0;
  828|  2.29M|    uint8_t xform_version = (flag_byte >> 6) & 0x03;
  829|       |
  830|       |    // 0 means xform for glyph/loca, non-0 for others
  831|  2.29M|    if (tag == kGlyfTableTag || tag == kLocaTableTag) {
  ------------------
  |  Branch (831:9): [True: 10.5k, False: 2.28M]
  |  Branch (831:33): [True: 16.5k, False: 2.27M]
  ------------------
  832|  27.1k|      if (xform_version == 0) {
  ------------------
  |  Branch (832:11): [True: 8.40k, False: 18.7k]
  ------------------
  833|  8.40k|        flags |= kWoff2FlagsTransform;
  834|  8.40k|      }
  835|  2.27M|    } else if (xform_version != 0) {
  ------------------
  |  Branch (835:16): [True: 159k, False: 2.11M]
  ------------------
  836|   159k|      flags |= kWoff2FlagsTransform;
  837|   159k|    }
  838|  2.29M|    flags |= xform_version;
  839|       |
  840|  2.29M|    uint32_t dst_length;
  841|  2.29M|    if (PREDICT_FALSE(!ReadBase128(file, &dst_length))) {
  ------------------
  |  |   48|  2.29M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 132, False: 2.29M]
  |  |  ------------------
  ------------------
  842|    132|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    132|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  843|    132|    }
  844|  2.29M|    uint32_t transform_length = dst_length;
  845|  2.29M|    if ((flags & kWoff2FlagsTransform) != 0) {
  ------------------
  |  Branch (845:9): [True: 167k, False: 2.13M]
  ------------------
  846|   167k|      if (PREDICT_FALSE(!ReadBase128(file, &transform_length))) {
  ------------------
  |  |   48|   167k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 17, False: 167k]
  |  |  ------------------
  ------------------
  847|     17|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     17|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  848|     17|      }
  849|   167k|      if (PREDICT_FALSE(tag == kLocaTableTag && transform_length)) {
  ------------------
  |  |   48|   169k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 65, False: 167k]
  |  |  |  Branch (48:44): [True: 2.09k, False: 165k]
  |  |  |  Branch (48:44): [True: 65, False: 2.02k]
  |  |  ------------------
  ------------------
  850|     65|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     65|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  851|     65|      }
  852|   167k|    }
  853|  2.29M|    if (PREDICT_FALSE(src_offset + transform_length < src_offset)) {
  ------------------
  |  |   48|  2.29M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 2, False: 2.29M]
  |  |  ------------------
  ------------------
  854|      2|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  855|      2|    }
  856|  2.29M|    table->src_offset = src_offset;
  857|  2.29M|    table->src_length = transform_length;
  858|  2.29M|    src_offset += transform_length;
  859|       |
  860|  2.29M|    table->tag = tag;
  861|  2.29M|    table->flags = flags;
  862|  2.29M|    table->transform_length = transform_length;
  863|  2.29M|    table->dst_length = dst_length;
  864|  2.29M|  }
  865|  7.98k|  return true;
  866|  8.30k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_125ComputeOffsetToFirstTableERKNS0_11WOFF2HeaderE:
  894|  14.9k|uint64_t ComputeOffsetToFirstTable(const WOFF2Header& hdr) {
  895|  14.9k|  uint64_t offset = kSfntHeaderSize +
  896|  14.9k|    kSfntEntrySize * static_cast<uint64_t>(hdr.num_tables);
  897|  14.9k|  if (hdr.header_version) {
  ------------------
  |  Branch (897:7): [True: 496, False: 14.4k]
  ------------------
  898|    496|    offset = CollectionHeaderSize(hdr.header_version, hdr.ttc_fonts.size())
  899|    496|      + kSfntHeaderSize * hdr.ttc_fonts.size();
  900|  8.50k|    for (const auto& ttc_font : hdr.ttc_fonts) {
  ------------------
  |  Branch (900:31): [True: 8.50k, False: 496]
  ------------------
  901|  8.50k|      offset += kSfntEntrySize * ttc_font.table_indices.size();
  902|  8.50k|    }
  903|    496|  }
  904|  14.9k|  return offset;
  905|  14.9k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_112WriteHeadersEPKhmPNS0_15RebuildMetadataEPNS0_11WOFF2HeaderEPNS_8WOFF2OutE:
 1257|  7.35k|                  WOFF2Header* hdr, WOFF2Out* out) {
 1258|  7.35k|  std::vector<uint8_t> output(ComputeOffsetToFirstTable(*hdr), 0);
 1259|       |
 1260|       |  // Re-order tables in output (OTSpec) order
 1261|  7.35k|  std::vector<Table> sorted_tables(hdr->tables);
 1262|  7.35k|  if (hdr->header_version) {
  ------------------
  |  Branch (1262:7): [True: 244, False: 7.11k]
  ------------------
 1263|       |    // collection; we have to sort the table offset vector in each font
 1264|  3.97k|    for (auto& ttc_font : hdr->ttc_fonts) {
  ------------------
  |  Branch (1264:25): [True: 3.97k, False: 244]
  ------------------
 1265|  3.97k|      std::map<uint32_t, uint16_t> sorted_index_by_tag;
 1266|   109k|      for (auto table_index : ttc_font.table_indices) {
  ------------------
  |  Branch (1266:29): [True: 109k, False: 3.97k]
  ------------------
 1267|   109k|        sorted_index_by_tag[hdr->tables[table_index].tag] = table_index;
 1268|   109k|      }
 1269|  3.97k|      uint16_t index = 0;
 1270|  30.9k|      for (auto& i : sorted_index_by_tag) {
  ------------------
  |  Branch (1270:20): [True: 30.9k, False: 3.97k]
  ------------------
 1271|  30.9k|        ttc_font.table_indices[index++] = i.second;
 1272|  30.9k|      }
 1273|  3.97k|    }
 1274|  7.11k|  } else {
 1275|       |    // non-collection; we can just sort the tables
 1276|  7.11k|    std::sort(sorted_tables.begin(), sorted_tables.end());
 1277|  7.11k|  }
 1278|       |
 1279|       |  // Start building the font
 1280|  7.35k|  uint8_t* result = &output[0];
 1281|  7.35k|  size_t offset = 0;
 1282|  7.35k|  if (hdr->header_version) {
  ------------------
  |  Branch (1282:7): [True: 244, False: 7.11k]
  ------------------
 1283|       |    // TTC header
 1284|    244|    offset = StoreU32(result, offset, hdr->flavor);  // TAG TTCTag
 1285|    244|    offset = StoreU32(result, offset, hdr->header_version);  // FIXED Version
 1286|    244|    offset = StoreU32(result, offset, hdr->ttc_fonts.size());  // ULONG numFonts
 1287|       |    // Space for ULONG OffsetTable[numFonts] (zeroed initially)
 1288|    244|    size_t offset_table = offset;  // keep start of offset table for later
 1289|  4.21k|    for (size_t i = 0; i < hdr->ttc_fonts.size(); i++) {
  ------------------
  |  Branch (1289:24): [True: 3.97k, False: 244]
  ------------------
 1290|  3.97k|      offset = StoreU32(result, offset, 0);  // will fill real values in later
 1291|  3.97k|    }
 1292|       |    // space for DSIG fields for header v2
 1293|    244|    if (hdr->header_version == 0x00020000) {
  ------------------
  |  Branch (1293:9): [True: 97, False: 147]
  ------------------
 1294|     97|      offset = StoreU32(result, offset, 0);  // ULONG ulDsigTag
 1295|     97|      offset = StoreU32(result, offset, 0);  // ULONG ulDsigLength
 1296|     97|      offset = StoreU32(result, offset, 0);  // ULONG ulDsigOffset
 1297|     97|    }
 1298|       |
 1299|       |    // write Offset Tables and store the location of each in TTC Header
 1300|    244|    metadata->font_infos.resize(hdr->ttc_fonts.size());
 1301|  4.21k|    for (size_t i = 0; i < hdr->ttc_fonts.size(); i++) {
  ------------------
  |  Branch (1301:24): [True: 3.97k, False: 244]
  ------------------
 1302|  3.97k|      TtcFont& ttc_font = hdr->ttc_fonts[i];
 1303|       |
 1304|       |      // write Offset Table location into TTC Header
 1305|  3.97k|      offset_table = StoreU32(result, offset_table, offset);
 1306|       |
 1307|       |      // write the actual offset table so our header doesn't lie
 1308|  3.97k|      ttc_font.dst_offset = offset;
 1309|  3.97k|      offset = StoreOffsetTable(result, offset, ttc_font.flavor,
 1310|  3.97k|                                ttc_font.table_indices.size());
 1311|       |
 1312|   109k|      for (const auto table_index : ttc_font.table_indices) {
  ------------------
  |  Branch (1312:35): [True: 109k, False: 3.97k]
  ------------------
 1313|   109k|        uint32_t tag = hdr->tables[table_index].tag;
 1314|   109k|        metadata->font_infos[i].table_entry_by_tag[tag] = offset;
 1315|   109k|        offset = StoreTableEntry(result, offset, tag);
 1316|   109k|      }
 1317|       |
 1318|  3.97k|      ttc_font.header_checksum = ComputeULongSum(&output[ttc_font.dst_offset],
 1319|  3.97k|                                                 offset - ttc_font.dst_offset);
 1320|  3.97k|    }
 1321|  7.11k|  } else {
 1322|  7.11k|    metadata->font_infos.resize(1);
 1323|  7.11k|    offset = StoreOffsetTable(result, offset, hdr->flavor, hdr->num_tables);
 1324|  1.21M|    for (uint16_t i = 0; i < hdr->num_tables; ++i) {
  ------------------
  |  Branch (1324:26): [True: 1.20M, False: 7.11k]
  ------------------
 1325|  1.20M|      metadata->font_infos[0].table_entry_by_tag[sorted_tables[i].tag] = offset;
 1326|  1.20M|      offset = StoreTableEntry(result, offset, sorted_tables[i].tag);
 1327|  1.20M|    }
 1328|  7.11k|  }
 1329|       |
 1330|  7.35k|  if (PREDICT_FALSE(!out->Write(&output[0], output.size()))) {
  ------------------
  |  |   48|  7.35k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 7.35k]
  |  |  ------------------
  ------------------
 1331|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1332|      0|  }
 1333|  7.35k|  metadata->header_checksum = ComputeULongSum(&output[0], output.size());
 1334|  7.35k|  return true;
 1335|  7.35k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_116StoreOffsetTableEPhmjt:
  870|  11.0k|                        uint16_t num_tables) {
  871|  11.0k|  offset = StoreU32(result, offset, flavor);  // sfnt version
  872|  11.0k|  offset = Store16(result, offset, num_tables);  // num_tables
  873|  11.0k|  unsigned max_pow2 = 0;
  874|  40.3k|  while (1u << (max_pow2 + 1) <= num_tables) {
  ------------------
  |  Branch (874:10): [True: 29.2k, False: 11.0k]
  ------------------
  875|  29.2k|    max_pow2++;
  876|  29.2k|  }
  877|  11.0k|  const uint16_t output_search_range = (1u << max_pow2) << 4;
  878|  11.0k|  offset = Store16(result, offset, output_search_range);  // searchRange
  879|  11.0k|  offset = Store16(result, offset, max_pow2);  // entrySelector
  880|       |  // rangeShift
  881|  11.0k|  offset = Store16(result, offset, (num_tables << 4) - output_search_range);
  882|  11.0k|  return offset;
  883|  11.0k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115StoreTableEntryEPhjj:
  885|  1.31M|size_t StoreTableEntry(uint8_t* result, uint32_t offset, uint32_t tag) {
  886|  1.31M|  offset = StoreU32(result, offset, tag);
  887|  1.31M|  offset = StoreU32(result, offset, 0);
  888|  1.31M|  offset = StoreU32(result, offset, 0);
  889|  1.31M|  offset = StoreU32(result, offset, 0);
  890|  1.31M|  return offset;
  891|  1.31M|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115Woff2UncompressEPhmPKhm:
  799|  6.68k|  const uint8_t* src_buf, size_t src_size) {
  800|  6.68k|  size_t uncompressed_size = dst_size;
  801|  6.68k|  BrotliDecoderResult result = BrotliDecoderDecompress(
  802|  6.68k|      src_size, src_buf, &uncompressed_size, dst_buf);
  803|  6.68k|  if (PREDICT_FALSE(result != BROTLI_DECODER_RESULT_SUCCESS ||
  ------------------
  |  |   48|  8.11k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 5.28k, False: 1.40k]
  |  |  |  Branch (48:44): [True: 5.24k, False: 1.43k]
  |  |  |  Branch (48:44): [True: 33, False: 1.40k]
  |  |  ------------------
  ------------------
  804|  6.68k|                    uncompressed_size != dst_size)) {
  805|  5.28k|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|  5.28k|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  806|  5.28k|  }
  807|  1.40k|  return true;
  808|  6.68k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115ReconstructFontEPhjPNS0_15RebuildMetadataEPNS0_11WOFF2HeaderEmPNS_8WOFF2OutE:
  928|  2.00k|                     WOFF2Out* out) {
  929|  2.00k|  size_t dest_offset = out->Size();
  930|  2.00k|  uint8_t table_entry[12];
  931|  2.00k|  WOFF2FontInfo* info = &metadata->font_infos[font_index];
  932|  2.00k|  std::vector<Table*> tables = Tables(hdr, font_index);
  933|       |
  934|       |  // 'glyf' without 'loca' doesn't make sense
  935|  2.00k|  const Table* glyf_table = FindTable(&tables, kGlyfTableTag);
  936|  2.00k|  const Table* loca_table = FindTable(&tables, kLocaTableTag);
  937|  2.00k|  if (PREDICT_FALSE(static_cast<bool>(glyf_table) !=
  ------------------
  |  |   48|  2.00k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 4, False: 1.99k]
  |  |  ------------------
  ------------------
  938|  2.00k|                    static_cast<bool>(loca_table))) {
  939|       |#ifdef FONT_COMPRESSION_BIN
  940|       |      fprintf(stderr, "Cannot have just one of glyf/loca\n");
  941|       |#endif
  942|      4|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      4|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  943|      4|  }
  944|       |
  945|  1.99k|  if (glyf_table != NULL) {
  ------------------
  |  Branch (945:7): [True: 832, False: 1.16k]
  ------------------
  946|    832|    if (PREDICT_FALSE((glyf_table->flags & kWoff2FlagsTransform)
  ------------------
  |  |   48|    832|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 2, False: 830]
  |  |  ------------------
  ------------------
  947|    832|                      != (loca_table->flags & kWoff2FlagsTransform))) {
  948|       |#ifdef FONT_COMPRESSION_BIN
  949|       |      fprintf(stderr, "Cannot transform just one of glyf/loca\n");
  950|       |#endif
  951|      2|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  952|      2|    }
  953|    832|  }
  954|       |
  955|  1.99k|  uint32_t font_checksum = metadata->header_checksum;
  956|  1.99k|  if (hdr->header_version) {
  ------------------
  |  Branch (956:7): [True: 694, False: 1.30k]
  ------------------
  957|    694|    font_checksum = hdr->ttc_fonts[font_index].header_checksum;
  958|    694|  }
  959|       |
  960|  1.99k|  uint32_t loca_checksum = 0;
  961|  16.0k|  for (size_t i = 0; i < tables.size(); i++) {
  ------------------
  |  Branch (961:22): [True: 15.1k, False: 943]
  ------------------
  962|  15.1k|    Table& table = *tables[i];
  963|       |
  964|  15.1k|    std::pair<uint32_t, uint32_t> checksum_key = {table.tag, table.src_offset};
  965|  15.1k|    bool reused = metadata->checksums.find(checksum_key)
  966|  15.1k|               != metadata->checksums.end();
  967|  15.1k|    if (PREDICT_FALSE(font_index == 0 && reused)) {
  ------------------
  |  |   48|  26.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 31, False: 15.1k]
  |  |  |  Branch (48:44): [True: 11.0k, False: 4.09k]
  |  |  |  Branch (48:44): [True: 31, False: 11.0k]
  |  |  ------------------
  ------------------
  968|     31|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     31|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  969|     31|    }
  970|       |
  971|       |    // TODO(user) a collection with optimized hmtx that reused glyf/loca
  972|       |    // would fail. We don't optimize hmtx for collections yet.
  973|  15.1k|    if (PREDICT_FALSE(static_cast<uint64_t>(table.src_offset) + table.src_length
  ------------------
  |  |   48|  15.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 15.1k]
  |  |  ------------------
  ------------------
  974|  15.1k|        > transformed_buf_size)) {
  975|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  976|      0|    }
  977|       |
  978|  15.1k|    if (table.tag == kHheaTableTag) {
  ------------------
  |  Branch (978:9): [True: 790, False: 14.3k]
  ------------------
  979|    790|      if (!ReadNumHMetrics(transformed_buf + table.src_offset,
  ------------------
  |  Branch (979:11): [True: 12, False: 778]
  ------------------
  980|    790|          table.src_length, &info->num_hmetrics)) {
  981|     12|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     12|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  982|     12|      }
  983|    790|    }
  984|       |
  985|  15.1k|    uint32_t checksum = 0;
  986|  15.1k|    if (!reused) {
  ------------------
  |  Branch (986:9): [True: 11.3k, False: 3.75k]
  ------------------
  987|  11.3k|      if ((table.flags & kWoff2FlagsTransform) != kWoff2FlagsTransform) {
  ------------------
  |  Branch (987:11): [True: 10.1k, False: 1.23k]
  ------------------
  988|  10.1k|        if (table.tag == kHeadTableTag) {
  ------------------
  |  Branch (988:13): [True: 327, False: 9.78k]
  ------------------
  989|    327|          if (PREDICT_FALSE(table.src_length < 12)) {
  ------------------
  |  |   48|    327|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 12, False: 315]
  |  |  ------------------
  ------------------
  990|     12|            return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     12|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  991|     12|          }
  992|       |          // checkSumAdjustment = 0
  993|    315|          StoreU32(transformed_buf + table.src_offset, 8, 0);
  994|    315|        }
  995|  10.0k|        table.dst_offset = dest_offset;
  996|  10.0k|        checksum = ComputeULongSum(transformed_buf + table.src_offset,
  997|  10.0k|                                   table.src_length);
  998|  10.0k|        if (PREDICT_FALSE(!out->Write(transformed_buf + table.src_offset,
  ------------------
  |  |   48|  10.0k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 10.0k]
  |  |  ------------------
  ------------------
  999|  10.0k|            table.src_length))) {
 1000|      0|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1001|      0|        }
 1002|  10.0k|      } else {
 1003|  1.23k|        if (table.tag == kGlyfTableTag) {
  ------------------
  |  Branch (1003:13): [True: 805, False: 431]
  ------------------
 1004|    805|          table.dst_offset = dest_offset;
 1005|       |
 1006|    805|          Table* loca_table = FindTable(&tables, kLocaTableTag);
 1007|    805|          if (PREDICT_FALSE(!ReconstructGlyf(transformed_buf + table.src_offset,
  ------------------
  |  |   48|    805|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 699, False: 106]
  |  |  ------------------
  ------------------
 1008|    805|              &table, &checksum, loca_table, &loca_checksum, info, out))) {
 1009|    699|            return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    699|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1010|    699|          }
 1011|    805|        } else if (table.tag == kLocaTableTag) {
  ------------------
  |  Branch (1011:20): [True: 116, False: 315]
  ------------------
 1012|       |          // All the work was done by ReconstructGlyf. We already know checksum.
 1013|    116|          checksum = loca_checksum;
 1014|    315|        } else if (table.tag == kHmtxTableTag) {
  ------------------
  |  Branch (1014:20): [True: 114, False: 201]
  ------------------
 1015|    114|          table.dst_offset = dest_offset;
 1016|       |          // Tables are sorted so all the info we need has been gathered.
 1017|    114|          if (PREDICT_FALSE(!ReconstructTransformedHmtx(
  ------------------
  |  |   48|    114|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 67, False: 47]
  |  |  ------------------
  ------------------
 1018|    114|              transformed_buf + table.src_offset, table.src_length,
 1019|    114|              info->num_glyphs, info->num_hmetrics, info->x_mins, &checksum,
 1020|    114|              out))) {
 1021|     67|            return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     67|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1022|     67|          }
 1023|    201|        } else {
 1024|    201|          return FONT_COMPRESSION_FAILURE();  // transform unknown
  ------------------
  |  |   40|    201|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1025|    201|        }
 1026|  1.23k|      }
 1027|  10.3k|      metadata->checksums[checksum_key] = checksum;
 1028|  10.3k|    } else {
 1029|  3.75k|      checksum = metadata->checksums[checksum_key];
 1030|  3.75k|    }
 1031|  14.1k|    font_checksum += checksum;
 1032|       |
 1033|       |    // update the table entry with real values.
 1034|  14.1k|    StoreU32(table_entry, 0, checksum);
 1035|  14.1k|    StoreU32(table_entry, 4, table.dst_offset);
 1036|  14.1k|    StoreU32(table_entry, 8, table.dst_length);
 1037|  14.1k|    if (PREDICT_FALSE(!out->Write(table_entry,
  ------------------
  |  |   48|  14.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 14.1k]
  |  |  ------------------
  ------------------
 1038|  14.1k|        info->table_entry_by_tag[table.tag] + 4, 12))) {
 1039|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1040|      0|    }
 1041|       |
 1042|       |    // We replaced 0's. Update overall checksum.
 1043|  14.1k|    font_checksum += ComputeULongSum(table_entry, 12);
 1044|       |
 1045|  14.1k|    if (PREDICT_FALSE(!Pad4(out))) {
  ------------------
  |  |   48|  14.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 14.1k]
  |  |  ------------------
  ------------------
 1046|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1047|      0|    }
 1048|       |
 1049|  14.1k|    if (PREDICT_FALSE(static_cast<uint64_t>(table.dst_offset + table.dst_length)
  ------------------
  |  |   48|  14.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 32, False: 14.0k]
  |  |  ------------------
  ------------------
 1050|  14.1k|        > out->Size())) {
 1051|     32|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     32|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1052|     32|    }
 1053|  14.0k|    dest_offset = out->Size();
 1054|  14.0k|  }
 1055|       |
 1056|       |  // Update 'head' checkSumAdjustment. We already set it to 0 and summed font.
 1057|    943|  Table* head_table = FindTable(&tables, kHeadTableTag);
 1058|    943|  if (head_table) {
  ------------------
  |  Branch (1058:7): [True: 270, False: 673]
  ------------------
 1059|    270|    if (PREDICT_FALSE(head_table->dst_length < 12)) {
  ------------------
  |  |   48|    270|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 1, False: 269]
  |  |  ------------------
  ------------------
 1060|      1|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      1|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1061|      1|    }
 1062|    269|    uint8_t checksum_adjustment[4];
 1063|    269|    StoreU32(checksum_adjustment, 0, 0xB1B0AFBA - font_checksum);
 1064|    269|    if (PREDICT_FALSE(!out->Write(checksum_adjustment,
  ------------------
  |  |   48|    269|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 269]
  |  |  ------------------
  ------------------
 1065|    269|                                  head_table->dst_offset + 8, 4))) {
 1066|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
 1067|      0|    }
 1068|    269|  }
 1069|       |
 1070|    942|  return true;
 1071|    943|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_16TablesEPNS0_11WOFF2HeaderEm:
  907|  2.00k|std::vector<Table*> Tables(WOFF2Header* hdr, size_t font_index) {
  908|  2.00k|  std::vector<Table*> tables;
  909|  2.00k|  if (PREDICT_FALSE(hdr->header_version)) {
  ------------------
  |  |   48|  2.00k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 695, False: 1.30k]
  |  |  ------------------
  ------------------
  910|  4.71k|    for (auto index : hdr->ttc_fonts[font_index].table_indices) {
  ------------------
  |  Branch (910:21): [True: 4.71k, False: 695]
  ------------------
  911|  4.71k|      tables.push_back(&hdr->tables[index]);
  912|  4.71k|    }
  913|  1.30k|  } else {
  914|  16.3k|    for (auto& table : hdr->tables) {
  ------------------
  |  Branch (914:22): [True: 16.3k, False: 1.30k]
  ------------------
  915|  16.3k|      tables.push_back(&table);
  916|  16.3k|    }
  917|  1.30k|  }
  918|  2.00k|  return tables;
  919|  2.00k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_19FindTableEPNSt3__16vectorIPNS_5TableENS1_9allocatorIS4_EEEEj:
  680|  5.75k|Table* FindTable(std::vector<Table*>* tables, uint32_t tag) {
  681|  43.6k|  for (Table* table : *tables) {
  ------------------
  |  Branch (681:21): [True: 43.6k, False: 3.01k]
  ------------------
  682|  43.6k|    if (table->tag == tag) {
  ------------------
  |  Branch (682:9): [True: 2.74k, False: 40.9k]
  ------------------
  683|  2.74k|      return table;
  684|  2.74k|    }
  685|  43.6k|  }
  686|  3.01k|  return NULL;
  687|  5.75k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115ReadNumHMetricsEPKhmPt:
  691|    790|                     uint16_t* num_hmetrics) {
  692|       |  // Skip 34 to reach 'hhea' numberOfHMetrics
  693|    790|  Buffer buffer(data, data_size);
  694|    790|  if (PREDICT_FALSE(!buffer.Skip(34) || !buffer.ReadU16(num_hmetrics))) {
  ------------------
  |  |   48|  1.57k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 12, False: 778]
  |  |  |  Branch (48:44): [True: 10, False: 780]
  |  |  |  Branch (48:44): [True: 2, False: 778]
  |  |  ------------------
  ------------------
  695|     12|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     12|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  696|     12|  }
  697|    778|  return true;
  698|    790|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115ReconstructGlyfEPKhPNS_5TableEPjS4_S5_PNS0_13WOFF2FontInfoEPNS_8WOFF2OutE:
  409|    805|                     WOFF2Out* out) {
  410|    805|  static const int kNumSubStreams = 7;
  411|    805|  Buffer file(data, glyf_table->transform_length);
  412|    805|  uint16_t version;
  413|    805|  std::vector<std::pair<const uint8_t*, size_t> > substreams(kNumSubStreams);
  414|    805|  const size_t glyf_start = out->Size();
  415|       |
  416|    805|  if (PREDICT_FALSE(!file.ReadU16(&version))) {
  ------------------
  |  |   48|    805|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 26, False: 779]
  |  |  ------------------
  ------------------
  417|     26|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     26|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  418|     26|  }
  419|       |
  420|    779|  uint16_t flags;
  421|    779|  if (PREDICT_FALSE(!file.ReadU16(&flags))) {
  ------------------
  |  |   48|    779|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 2, False: 777]
  |  |  ------------------
  ------------------
  422|      2|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  423|      2|  }
  424|    777|  bool has_overlap_bitmap = (flags & FLAG_OVERLAP_SIMPLE_BITMAP);
  425|       |
  426|    777|  if (PREDICT_FALSE(!file.ReadU16(&info->num_glyphs) ||
  ------------------
  |  |   48|  1.54k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 24, False: 753]
  |  |  |  Branch (48:44): [True: 7, False: 770]
  |  |  |  Branch (48:44): [True: 17, False: 753]
  |  |  ------------------
  ------------------
  427|    777|      !file.ReadU16(&info->index_format))) {
  428|     24|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     24|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  429|     24|  }
  430|       |
  431|       |  // https://dev.w3.org/webfonts/WOFF2/spec/#conform-mustRejectLoca
  432|       |  // dst_length here is origLength in the spec
  433|    753|  uint32_t expected_loca_dst_length = (info->index_format ? 4 : 2)
  ------------------
  |  Branch (433:40): [True: 435, False: 318]
  ------------------
  434|    753|    * (static_cast<uint32_t>(info->num_glyphs) + 1);
  435|    753|  if (PREDICT_FALSE(loca_table->dst_length != expected_loca_dst_length)) {
  ------------------
  |  |   48|    753|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 46, False: 707]
  |  |  ------------------
  ------------------
  436|     46|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     46|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  437|     46|  }
  438|       |
  439|    707|  unsigned int offset = (2 + kNumSubStreams) * 4;
  440|    707|  if (PREDICT_FALSE(offset > glyf_table->transform_length)) {
  ------------------
  |  |   48|    707|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 4, False: 703]
  |  |  ------------------
  ------------------
  441|      4|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      4|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  442|      4|  }
  443|       |  // Invariant from here on: data_size >= offset
  444|  5.29k|  for (int i = 0; i < kNumSubStreams; ++i) {
  ------------------
  |  Branch (444:19): [True: 4.64k, False: 654]
  ------------------
  445|  4.64k|    uint32_t substream_size;
  446|  4.64k|    if (PREDICT_FALSE(!file.ReadU32(&substream_size))) {
  ------------------
  |  |   48|  4.64k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 4.64k]
  |  |  ------------------
  ------------------
  447|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  448|      0|    }
  449|  4.64k|    if (PREDICT_FALSE(substream_size > glyf_table->transform_length - offset)) {
  ------------------
  |  |   48|  4.64k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 49, False: 4.59k]
  |  |  ------------------
  ------------------
  450|     49|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     49|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  451|     49|    }
  452|  4.59k|    substreams[i] = std::make_pair(data + offset, substream_size);
  453|  4.59k|    offset += substream_size;
  454|  4.59k|  }
  455|    654|  Buffer n_contour_stream(substreams[0].first, substreams[0].second);
  456|    654|  Buffer n_points_stream(substreams[1].first, substreams[1].second);
  457|    654|  Buffer flag_stream(substreams[2].first, substreams[2].second);
  458|    654|  Buffer glyph_stream(substreams[3].first, substreams[3].second);
  459|    654|  Buffer composite_stream(substreams[4].first, substreams[4].second);
  460|    654|  Buffer bbox_stream(substreams[5].first, substreams[5].second);
  461|    654|  Buffer instruction_stream(substreams[6].first, substreams[6].second);
  462|       |
  463|    654|  const uint8_t* overlap_bitmap = nullptr;
  464|    654|  unsigned int overlap_bitmap_length = 0;
  465|    654|  if (has_overlap_bitmap) {
  ------------------
  |  Branch (465:7): [True: 172, False: 482]
  ------------------
  466|    172|    overlap_bitmap_length = (info->num_glyphs + 7) >> 3;
  467|    172|    overlap_bitmap = data + offset;
  468|    172|    if (PREDICT_FALSE(overlap_bitmap_length >
  ------------------
  |  |   48|    172|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 4, False: 168]
  |  |  ------------------
  ------------------
  469|    172|                           glyf_table->transform_length - offset)) {
  470|      4|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      4|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  471|      4|    }
  472|    172|  }
  473|       |
  474|    650|  std::vector<uint32_t> loca_values(info->num_glyphs + 1);
  475|    650|  std::vector<unsigned int> n_points_vec;
  476|    650|  std::unique_ptr<Point[]> points;
  477|    650|  size_t points_size = 0;
  478|    650|  const uint8_t* bbox_bitmap = bbox_stream.buffer();
  479|       |  // Safe because num_glyphs is bounded
  480|    650|  unsigned int bitmap_length = ((info->num_glyphs + 31) >> 5) << 2;
  481|    650|  if (!bbox_stream.Skip(bitmap_length)) {
  ------------------
  |  Branch (481:7): [True: 13, False: 637]
  ------------------
  482|     13|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     13|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  483|     13|  }
  484|       |
  485|       |  // Temp buffer for glyph's.
  486|    637|  size_t glyph_buf_size = kDefaultGlyphBuf;
  487|    637|  std::unique_ptr<uint8_t[]> glyph_buf(new uint8_t[glyph_buf_size]);
  488|       |
  489|    637|  info->x_mins.resize(info->num_glyphs);
  490|  83.9k|  for (unsigned int i = 0; i < info->num_glyphs; ++i) {
  ------------------
  |  Branch (490:28): [True: 83.7k, False: 106]
  ------------------
  491|  83.7k|    size_t glyph_size = 0;
  492|  83.7k|    uint16_t n_contours = 0;
  493|  83.7k|    bool have_bbox = false;
  494|  83.7k|    if (bbox_bitmap[i >> 3] & (0x80 >> (i & 7))) {
  ------------------
  |  Branch (494:9): [True: 1.15k, False: 82.6k]
  ------------------
  495|  1.15k|      have_bbox = true;
  496|  1.15k|    }
  497|  83.7k|    if (PREDICT_FALSE(!n_contour_stream.ReadU16(&n_contours))) {
  ------------------
  |  |   48|  83.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 16, False: 83.7k]
  |  |  ------------------
  ------------------
  498|     16|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     16|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  499|     16|    }
  500|       |
  501|  83.7k|    if (n_contours == 0xffff) {
  ------------------
  |  Branch (501:9): [True: 582, False: 83.1k]
  ------------------
  502|       |      // composite glyph
  503|    582|      bool have_instructions = false;
  504|    582|      unsigned int instruction_size = 0;
  505|    582|      if (PREDICT_FALSE(!have_bbox)) {
  ------------------
  |  |   48|    582|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 25, False: 557]
  |  |  ------------------
  ------------------
  506|       |        // composite glyphs must have an explicit bbox
  507|     25|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     25|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  508|     25|      }
  509|       |
  510|    557|      size_t composite_size;
  511|    557|      if (PREDICT_FALSE(!SizeOfComposite(composite_stream, &composite_size,
  ------------------
  |  |   48|    557|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 27, False: 530]
  |  |  ------------------
  ------------------
  512|    557|                                         &have_instructions))) {
  513|     27|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     27|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  514|     27|      }
  515|    530|      if (have_instructions) {
  ------------------
  |  Branch (515:11): [True: 217, False: 313]
  ------------------
  516|    217|        if (PREDICT_FALSE(!Read255UShort(&glyph_stream, &instruction_size))) {
  ------------------
  |  |   48|    217|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 2, False: 215]
  |  |  ------------------
  ------------------
  517|      2|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  518|      2|        }
  519|    217|      }
  520|       |
  521|    528|      size_t size_needed = 12 + composite_size + instruction_size;
  522|    528|      if (PREDICT_FALSE(glyph_buf_size < size_needed)) {
  ------------------
  |  |   48|    528|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 6, False: 522]
  |  |  ------------------
  ------------------
  523|      6|        glyph_buf.reset(new uint8_t[size_needed]);
  524|      6|        glyph_buf_size = size_needed;
  525|      6|      }
  526|       |
  527|    528|      glyph_size = Store16(glyph_buf.get(), glyph_size, n_contours);
  528|    528|      if (PREDICT_FALSE(!bbox_stream.Read(glyph_buf.get() + glyph_size, 8))) {
  ------------------
  |  |   48|    528|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 8, False: 520]
  |  |  ------------------
  ------------------
  529|      8|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      8|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  530|      8|      }
  531|    520|      glyph_size += 8;
  532|       |
  533|    520|      if (PREDICT_FALSE(!composite_stream.Read(glyph_buf.get() + glyph_size,
  ------------------
  |  |   48|    520|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 520]
  |  |  ------------------
  ------------------
  534|    520|            composite_size))) {
  535|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  536|      0|      }
  537|    520|      glyph_size += composite_size;
  538|    520|      if (have_instructions) {
  ------------------
  |  Branch (538:11): [True: 210, False: 310]
  ------------------
  539|    210|        glyph_size = Store16(glyph_buf.get(), glyph_size, instruction_size);
  540|    210|        if (PREDICT_FALSE(!instruction_stream.Read(glyph_buf.get() + glyph_size,
  ------------------
  |  |   48|    210|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 27, False: 183]
  |  |  ------------------
  ------------------
  541|    210|              instruction_size))) {
  542|     27|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     27|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  543|     27|        }
  544|    183|        glyph_size += instruction_size;
  545|    183|      }
  546|  83.1k|    } else if (n_contours > 0) {
  ------------------
  |  Branch (546:16): [True: 71.0k, False: 12.1k]
  ------------------
  547|       |      // simple glyph
  548|  71.0k|      n_points_vec.clear();
  549|  71.0k|      unsigned int total_n_points = 0;
  550|  71.0k|      unsigned int n_points_contour;
  551|   434k|      for (unsigned int j = 0; j < n_contours; ++j) {
  ------------------
  |  Branch (551:32): [True: 363k, False: 70.9k]
  ------------------
  552|   363k|        if (PREDICT_FALSE(
  ------------------
  |  |   48|   363k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 113, False: 363k]
  |  |  ------------------
  ------------------
  553|   363k|            !Read255UShort(&n_points_stream, &n_points_contour))) {
  554|    113|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    113|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  555|    113|        }
  556|   363k|        n_points_vec.push_back(n_points_contour);
  557|   363k|        if (PREDICT_FALSE(total_n_points + n_points_contour < total_n_points)) {
  ------------------
  |  |   48|   363k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 363k]
  |  |  ------------------
  ------------------
  558|      0|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  559|      0|        }
  560|   363k|        total_n_points += n_points_contour;
  561|   363k|      }
  562|  70.9k|      unsigned int flag_size = total_n_points;
  563|  70.9k|      if (PREDICT_FALSE(
  ------------------
  |  |   48|  70.9k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 65, False: 70.8k]
  |  |  ------------------
  ------------------
  564|  70.9k|          flag_size > flag_stream.length() - flag_stream.offset())) {
  565|     65|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     65|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  566|     65|      }
  567|  70.8k|      const uint8_t* flags_buf = flag_stream.buffer() + flag_stream.offset();
  568|  70.8k|      const uint8_t* triplet_buf = glyph_stream.buffer() +
  569|  70.8k|        glyph_stream.offset();
  570|  70.8k|      size_t triplet_size = glyph_stream.length() - glyph_stream.offset();
  571|  70.8k|      size_t triplet_bytes_consumed = 0;
  572|  70.8k|      if (points_size < total_n_points) {
  ------------------
  |  Branch (572:11): [True: 1.19k, False: 69.6k]
  ------------------
  573|  1.19k|        points_size = total_n_points;
  574|  1.19k|        points.reset(new Point[points_size]);
  575|  1.19k|      }
  576|  70.8k|      if (PREDICT_FALSE(!TripletDecode(flags_buf, triplet_buf, triplet_size,
  ------------------
  |  |   48|  70.8k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 100, False: 70.7k]
  |  |  ------------------
  ------------------
  577|  70.8k|          total_n_points, points.get(), &triplet_bytes_consumed))) {
  578|    100|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|    100|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  579|    100|      }
  580|  70.7k|      if (PREDICT_FALSE(!flag_stream.Skip(flag_size))) {
  ------------------
  |  |   48|  70.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 70.7k]
  |  |  ------------------
  ------------------
  581|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  582|      0|      }
  583|  70.7k|      if (PREDICT_FALSE(!glyph_stream.Skip(triplet_bytes_consumed))) {
  ------------------
  |  |   48|  70.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 70.7k]
  |  |  ------------------
  ------------------
  584|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  585|      0|      }
  586|  70.7k|      unsigned int instruction_size;
  587|  70.7k|      if (PREDICT_FALSE(!Read255UShort(&glyph_stream, &instruction_size))) {
  ------------------
  |  |   48|  70.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 17, False: 70.7k]
  |  |  ------------------
  ------------------
  588|     17|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     17|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  589|     17|      }
  590|       |
  591|  70.7k|      if (PREDICT_FALSE(total_n_points >= (1 << 27)
  ------------------
  |  |   48|   141k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 70.7k]
  |  |  |  Branch (48:44): [True: 0, False: 70.7k]
  |  |  |  Branch (48:44): [True: 0, False: 70.7k]
  |  |  ------------------
  ------------------
  592|  70.7k|                        || instruction_size >= (1 << 30))) {
  593|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  594|      0|      }
  595|  70.7k|      size_t size_needed = 12 + 2 * n_contours + 5 * total_n_points
  596|  70.7k|                           + instruction_size;
  597|  70.7k|      if (PREDICT_FALSE(glyph_buf_size < size_needed)) {
  ------------------
  |  |   48|  70.7k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 176, False: 70.5k]
  |  |  ------------------
  ------------------
  598|    176|        glyph_buf.reset(new uint8_t[size_needed]);
  599|    176|        glyph_buf_size = size_needed;
  600|    176|      }
  601|       |
  602|  70.7k|      glyph_size = Store16(glyph_buf.get(), glyph_size, n_contours);
  603|  70.7k|      if (have_bbox) {
  ------------------
  |  Branch (603:11): [True: 526, False: 70.2k]
  ------------------
  604|    526|        if (PREDICT_FALSE(!bbox_stream.Read(glyph_buf.get() + glyph_size, 8))) {
  ------------------
  |  |   48|    526|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 20, False: 506]
  |  |  ------------------
  ------------------
  605|     20|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     20|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  606|     20|        }
  607|  70.2k|      } else {
  608|  70.2k|        ComputeBbox(total_n_points, points.get(), glyph_buf.get());
  609|  70.2k|      }
  610|  70.7k|      glyph_size = kEndPtsOfContoursOffset;
  611|  70.7k|      int end_point = -1;
  612|   281k|      for (unsigned int contour_ix = 0; contour_ix < n_contours; ++contour_ix) {
  ------------------
  |  Branch (612:41): [True: 210k, False: 70.6k]
  ------------------
  613|   210k|        end_point += n_points_vec[contour_ix];
  614|   210k|        if (PREDICT_FALSE(end_point >= 65536)) {
  ------------------
  |  |   48|   210k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 8, False: 210k]
  |  |  ------------------
  ------------------
  615|      8|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      8|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  616|      8|        }
  617|   210k|        glyph_size = Store16(glyph_buf.get(), glyph_size, end_point);
  618|   210k|      }
  619|       |
  620|  70.6k|      glyph_size = Store16(glyph_buf.get(), glyph_size, instruction_size);
  621|  70.6k|      if (PREDICT_FALSE(!instruction_stream.Read(glyph_buf.get() + glyph_size,
  ------------------
  |  |   48|  70.6k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 92, False: 70.6k]
  |  |  ------------------
  ------------------
  622|  70.6k|                                                 instruction_size))) {
  623|     92|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     92|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  624|     92|      }
  625|  70.6k|      glyph_size += instruction_size;
  626|       |
  627|  70.6k|      bool has_overlap_bit =
  628|  70.6k|          has_overlap_bitmap && overlap_bitmap[i >> 3] & (0x80 >> (i & 7));
  ------------------
  |  Branch (628:11): [True: 1.63k, False: 68.9k]
  |  Branch (628:33): [True: 429, False: 1.20k]
  ------------------
  629|       |
  630|  70.6k|      if (PREDICT_FALSE(!StorePoints(
  ------------------
  |  |   48|  70.6k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 70.6k]
  |  |  ------------------
  ------------------
  631|  70.6k|              total_n_points, points.get(), n_contours, instruction_size,
  632|  70.6k|              has_overlap_bit, glyph_buf.get(), glyph_buf_size, &glyph_size))) {
  633|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  634|      0|      }
  635|  70.6k|    } else {
  636|       |      // n_contours == 0; empty glyph. Must NOT have a bbox.
  637|  12.1k|      if (PREDICT_FALSE(have_bbox)) {
  ------------------
  |  |   48|  12.1k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 11, False: 12.1k]
  |  |  ------------------
  ------------------
  638|       |#ifdef FONT_COMPRESSION_BIN
  639|       |        fprintf(stderr, "Empty glyph has a bbox\n");
  640|       |#endif
  641|     11|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     11|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  642|     11|      }
  643|  12.1k|    }
  644|       |
  645|  83.2k|    loca_values[i] = out->Size() - glyf_start;
  646|  83.2k|    if (PREDICT_FALSE(!out->Write(glyph_buf.get(), glyph_size))) {
  ------------------
  |  |   48|  83.2k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 83.2k]
  |  |  ------------------
  ------------------
  647|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  648|      0|    }
  649|       |
  650|       |    // TODO(user) Old code aligned glyphs ... but do we actually need to?
  651|  83.2k|    if (PREDICT_FALSE(!Pad4(out))) {
  ------------------
  |  |   48|  83.2k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 83.2k]
  |  |  ------------------
  ------------------
  652|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  653|      0|    }
  654|       |
  655|  83.2k|    *glyf_checksum += ComputeULongSum(glyph_buf.get(), glyph_size);
  656|       |
  657|       |    // We may need x_min to reconstruct 'hmtx'
  658|  83.2k|    if (n_contours > 0) {
  ------------------
  |  Branch (658:9): [True: 71.0k, False: 12.1k]
  ------------------
  659|  71.0k|      Buffer x_min_buf(glyph_buf.get() + 2, 2);
  660|  71.0k|      if (PREDICT_FALSE(!x_min_buf.ReadS16(&info->x_mins[i]))) {
  ------------------
  |  |   48|  71.0k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 71.0k]
  |  |  ------------------
  ------------------
  661|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  662|      0|      }
  663|  71.0k|    }
  664|  83.2k|  }
  665|       |
  666|       |  // glyf_table dst_offset was set by ReconstructFont
  667|    106|  glyf_table->dst_length = out->Size() - glyf_table->dst_offset;
  668|    106|  loca_table->dst_offset = out->Size();
  669|       |  // loca[n] will be equal the length of the glyph data ('glyf') table
  670|    106|  loca_values[info->num_glyphs] = glyf_table->dst_length;
  671|    106|  if (PREDICT_FALSE(!StoreLoca(loca_values, info->index_format, loca_checksum,
  ------------------
  |  |   48|    106|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 106]
  |  |  ------------------
  ------------------
  672|    106|      out))) {
  673|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  674|      0|  }
  675|    106|  loca_table->dst_length = out->Size() - loca_table->dst_offset;
  676|       |
  677|    106|  return true;
  678|    106|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_115SizeOfCompositeENS_6BufferEPmPb:
  329|    557|                     bool* have_instructions) {
  330|    557|  size_t start_offset = composite_stream.offset();
  331|    557|  bool we_have_instructions = false;
  332|       |
  333|    557|  uint16_t flags = FLAG_MORE_COMPONENTS;
  334|  5.30k|  while (flags & FLAG_MORE_COMPONENTS) {
  ------------------
  |  Branch (334:10): [True: 4.77k, False: 530]
  ------------------
  335|  4.77k|    if (PREDICT_FALSE(!composite_stream.ReadU16(&flags))) {
  ------------------
  |  |   48|  4.77k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 8, False: 4.77k]
  |  |  ------------------
  ------------------
  336|      8|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      8|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  337|      8|    }
  338|  4.77k|    we_have_instructions |= (flags & FLAG_WE_HAVE_INSTRUCTIONS) != 0;
  339|  4.77k|    size_t arg_size = 2;  // glyph index
  340|  4.77k|    if (flags & FLAG_ARG_1_AND_2_ARE_WORDS) {
  ------------------
  |  Branch (340:9): [True: 2.00k, False: 2.76k]
  ------------------
  341|  2.00k|      arg_size += 4;
  342|  2.76k|    } else {
  343|  2.76k|      arg_size += 2;
  344|  2.76k|    }
  345|  4.77k|    if (flags & FLAG_WE_HAVE_A_SCALE) {
  ------------------
  |  Branch (345:9): [True: 1.67k, False: 3.09k]
  ------------------
  346|  1.67k|      arg_size += 2;
  347|  3.09k|    } else if (flags & FLAG_WE_HAVE_AN_X_AND_Y_SCALE) {
  ------------------
  |  Branch (347:16): [True: 648, False: 2.44k]
  ------------------
  348|    648|      arg_size += 4;
  349|  2.44k|    } else if (flags & FLAG_WE_HAVE_A_TWO_BY_TWO) {
  ------------------
  |  Branch (349:16): [True: 621, False: 1.82k]
  ------------------
  350|    621|      arg_size += 8;
  351|    621|    }
  352|  4.77k|    if (PREDICT_FALSE(!composite_stream.Skip(arg_size))) {
  ------------------
  |  |   48|  4.77k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 19, False: 4.75k]
  |  |  ------------------
  ------------------
  353|     19|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     19|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  354|     19|    }
  355|  4.77k|  }
  356|       |
  357|    530|  *size = composite_stream.offset() - start_offset;
  358|    530|  *have_instructions = we_have_instructions;
  359|       |
  360|    530|  return true;
  361|    557|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_113TripletDecodeEPKhS2_mjPNS_5PointEPm:
  125|  70.8k|    unsigned int n_points, Point* result, size_t* in_bytes_consumed) {
  126|  70.8k|  int x = 0;
  127|  70.8k|  int y = 0;
  128|       |
  129|  70.8k|  if (PREDICT_FALSE(n_points > in_size)) {
  ------------------
  |  |   48|  70.8k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 22, False: 70.8k]
  |  |  ------------------
  ------------------
  130|     22|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     22|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  131|     22|  }
  132|  70.8k|  unsigned int triplet_index = 0;
  133|       |
  134|  10.3M|  for (unsigned int i = 0; i < n_points; ++i) {
  ------------------
  |  Branch (134:28): [True: 10.2M, False: 70.7k]
  ------------------
  135|  10.2M|    uint8_t flag = flags_in[i];
  136|  10.2M|    bool on_curve = !(flag >> 7);
  137|  10.2M|    flag &= 0x7f;
  138|  10.2M|    unsigned int n_data_bytes;
  139|  10.2M|    if (flag < 84) {
  ------------------
  |  Branch (139:9): [True: 6.96M, False: 3.27M]
  ------------------
  140|  6.96M|      n_data_bytes = 1;
  141|  6.96M|    } else if (flag < 120) {
  ------------------
  |  Branch (141:16): [True: 701k, False: 2.57M]
  ------------------
  142|   701k|      n_data_bytes = 2;
  143|  2.57M|    } else if (flag < 124) {
  ------------------
  |  Branch (143:16): [True: 41.1k, False: 2.53M]
  ------------------
  144|  41.1k|      n_data_bytes = 3;
  145|  2.53M|    } else {
  146|  2.53M|      n_data_bytes = 4;
  147|  2.53M|    }
  148|  10.2M|    if (PREDICT_FALSE(triplet_index + n_data_bytes > in_size ||
  ------------------
  |  |   48|  20.4M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 34, False: 10.2M]
  |  |  |  Branch (48:44): [True: 34, False: 10.2M]
  |  |  |  Branch (48:44): [True: 0, False: 10.2M]
  |  |  ------------------
  ------------------
  149|  10.2M|        triplet_index + n_data_bytes < triplet_index)) {
  150|     34|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     34|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  151|     34|    }
  152|  10.2M|    int dx, dy;
  153|  10.2M|    if (flag < 10) {
  ------------------
  |  Branch (153:9): [True: 4.58M, False: 5.65M]
  ------------------
  154|  4.58M|      dx = 0;
  155|  4.58M|      dy = WithSign(flag, ((flag & 14) << 7) + in[triplet_index]);
  156|  5.65M|    } else if (flag < 20) {
  ------------------
  |  Branch (156:16): [True: 582k, False: 5.07M]
  ------------------
  157|   582k|      dx = WithSign(flag, (((flag - 10) & 14) << 7) + in[triplet_index]);
  158|   582k|      dy = 0;
  159|  5.07M|    } else if (flag < 84) {
  ------------------
  |  Branch (159:16): [True: 1.79M, False: 3.27M]
  ------------------
  160|  1.79M|      int b0 = flag - 20;
  161|  1.79M|      int b1 = in[triplet_index];
  162|  1.79M|      dx = WithSign(flag, 1 + (b0 & 0x30) + (b1 >> 4));
  163|  1.79M|      dy = WithSign(flag >> 1, 1 + ((b0 & 0x0c) << 2) + (b1 & 0x0f));
  164|  3.27M|    } else if (flag < 120) {
  ------------------
  |  Branch (164:16): [True: 701k, False: 2.57M]
  ------------------
  165|   701k|      int b0 = flag - 84;
  166|   701k|      dx = WithSign(flag, 1 + ((b0 / 12) << 8) + in[triplet_index]);
  167|   701k|      dy = WithSign(flag >> 1,
  168|   701k|                    1 + (((b0 % 12) >> 2) << 8) + in[triplet_index + 1]);
  169|  2.57M|    } else if (flag < 124) {
  ------------------
  |  Branch (169:16): [True: 41.1k, False: 2.53M]
  ------------------
  170|  41.1k|      int b2 = in[triplet_index + 1];
  171|  41.1k|      dx = WithSign(flag, (in[triplet_index] << 4) + (b2 >> 4));
  172|  41.1k|      dy = WithSign(flag >> 1, ((b2 & 0x0f) << 8) + in[triplet_index + 2]);
  173|  2.53M|    } else {
  174|  2.53M|      dx = WithSign(flag, (in[triplet_index] << 8) + in[triplet_index + 1]);
  175|  2.53M|      dy = WithSign(flag >> 1,
  176|  2.53M|          (in[triplet_index + 2] << 8) + in[triplet_index + 3]);
  177|  2.53M|    }
  178|  10.2M|    triplet_index += n_data_bytes;
  179|  10.2M|    if (!_SafeIntAddition(x, dx, &x)) {
  ------------------
  |  Branch (179:9): [True: 19, False: 10.2M]
  ------------------
  180|     19|      return false;
  181|     19|    }
  182|  10.2M|    if (!_SafeIntAddition(y, dy, &y)) {
  ------------------
  |  Branch (182:9): [True: 25, False: 10.2M]
  ------------------
  183|     25|      return false;
  184|     25|    }
  185|  10.2M|    *result++ = {x, y, on_curve};
  186|  10.2M|  }
  187|  70.7k|  *in_bytes_consumed = triplet_index;
  188|  70.7k|  return true;
  189|  70.8k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_18WithSignEii:
  109|  15.3M|int WithSign(int flag, int baseval) {
  110|       |  // Precondition: 0 <= baseval < 65536 (to avoid integer overflow)
  111|  15.3M|  return (flag & 1) ? baseval : -baseval;
  ------------------
  |  Branch (111:10): [True: 6.78M, False: 8.52M]
  ------------------
  112|  15.3M|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_116_SafeIntAdditionEiiPi:
  114|  20.4M|bool _SafeIntAddition(int a, int b, int* result) {
  115|  20.4M|  if (PREDICT_FALSE(
  ------------------
  |  |   48|   100M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 44, False: 20.4M]
  |  |  |  Branch (48:44): [True: 8.70M, False: 11.7M]
  |  |  |  Branch (48:44): [True: 30, False: 8.70M]
  |  |  |  Branch (48:44): [True: 9.64M, False: 10.8M]
  |  |  |  Branch (48:44): [True: 14, False: 9.64M]
  |  |  ------------------
  ------------------
  116|  20.4M|          ((a > 0) && (b > std::numeric_limits<int>::max() - a)) ||
  117|  20.4M|          ((a < 0) && (b < std::numeric_limits<int>::min() - a)))) {
  118|     44|    return false;
  119|     44|  }
  120|  20.4M|  *result = a + b;
  121|  20.4M|  return true;
  122|  20.4M|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_111ComputeBboxEjPKNS_5PointEPh:
  300|  70.2k|void ComputeBbox(unsigned int n_points, const Point* points, uint8_t* dst) {
  301|  70.2k|  int x_min = 0;
  302|  70.2k|  int y_min = 0;
  303|  70.2k|  int x_max = 0;
  304|  70.2k|  int y_max = 0;
  305|       |
  306|  70.2k|  if (n_points > 0) {
  ------------------
  |  Branch (306:7): [True: 68.0k, False: 2.16k]
  ------------------
  307|  68.0k|    x_min = points[0].x;
  308|  68.0k|    x_max = points[0].x;
  309|  68.0k|    y_min = points[0].y;
  310|  68.0k|    y_max = points[0].y;
  311|  68.0k|  }
  312|  6.27M|  for (unsigned int i = 1; i < n_points; ++i) {
  ------------------
  |  Branch (312:28): [True: 6.20M, False: 70.2k]
  ------------------
  313|  6.20M|    int x = points[i].x;
  314|  6.20M|    int y = points[i].y;
  315|  6.20M|    x_min = std::min(x, x_min);
  316|  6.20M|    x_max = std::max(x, x_max);
  317|  6.20M|    y_min = std::min(y, y_min);
  318|  6.20M|    y_max = std::max(y, y_max);
  319|  6.20M|  }
  320|  70.2k|  size_t offset = 2;
  321|  70.2k|  offset = Store16(dst, offset, x_min);
  322|  70.2k|  offset = Store16(dst, offset, y_min);
  323|  70.2k|  offset = Store16(dst, offset, x_max);
  324|  70.2k|  offset = Store16(dst, offset, y_max);
  325|  70.2k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_111StorePointsEjPKNS_5PointEjjbPhmPm:
  196|  70.6k|                 size_t* glyph_size) {
  197|       |  // I believe that n_contours < 65536, in which case this is safe. However, a
  198|       |  // comment and/or an assert would be good.
  199|  70.6k|  unsigned int flag_offset = kEndPtsOfContoursOffset + 2 * n_contours + 2 +
  200|  70.6k|    instruction_length;
  201|  70.6k|  int last_flag = -1;
  202|  70.6k|  int repeat_count = 0;
  203|  70.6k|  int last_x = 0;
  204|  70.6k|  int last_y = 0;
  205|  70.6k|  unsigned int x_bytes = 0;
  206|  70.6k|  unsigned int y_bytes = 0;
  207|       |
  208|  5.42M|  for (unsigned int i = 0; i < n_points; ++i) {
  ------------------
  |  Branch (208:28): [True: 5.35M, False: 70.6k]
  ------------------
  209|  5.35M|    const Point& point = points[i];
  210|  5.35M|    int flag = point.on_curve ? kGlyfOnCurve : 0;
  ------------------
  |  Branch (210:16): [True: 4.42M, False: 931k]
  ------------------
  211|  5.35M|    if (has_overlap_bit && i == 0) {
  ------------------
  |  Branch (211:9): [True: 2.25k, False: 5.35M]
  |  Branch (211:28): [True: 162, False: 2.09k]
  ------------------
  212|    162|      flag |= kOverlapSimple;
  213|    162|    }
  214|       |
  215|  5.35M|    int dx = point.x - last_x;
  216|  5.35M|    int dy = point.y - last_y;
  217|  5.35M|    if (dx == 0) {
  ------------------
  |  Branch (217:9): [True: 3.77M, False: 1.58M]
  ------------------
  218|  3.77M|      flag |= kGlyfThisXIsSame;
  219|  3.77M|    } else if (dx > -256 && dx < 256) {
  ------------------
  |  Branch (219:16): [True: 1.42M, False: 153k]
  |  Branch (219:29): [True: 1.24M, False: 179k]
  ------------------
  220|  1.24M|      flag |= kGlyfXShort | (dx > 0 ? kGlyfThisXIsSame : 0);
  ------------------
  |  Branch (220:30): [True: 501k, False: 746k]
  ------------------
  221|  1.24M|      x_bytes += 1;
  222|  1.24M|    } else {
  223|   332k|      x_bytes += 2;
  224|   332k|    }
  225|  5.35M|    if (dy == 0) {
  ------------------
  |  Branch (225:9): [True: 2.94M, False: 2.41M]
  ------------------
  226|  2.94M|      flag |= kGlyfThisYIsSame;
  227|  2.94M|    } else if (dy > -256 && dy < 256) {
  ------------------
  |  Branch (227:16): [True: 1.98M, False: 436k]
  |  Branch (227:29): [True: 1.61M, False: 360k]
  ------------------
  228|  1.61M|      flag |= kGlyfYShort | (dy > 0 ? kGlyfThisYIsSame : 0);
  ------------------
  |  Branch (228:30): [True: 542k, False: 1.07M]
  ------------------
  229|  1.61M|      y_bytes += 1;
  230|  1.61M|    } else {
  231|   797k|      y_bytes += 2;
  232|   797k|    }
  233|       |
  234|  5.35M|    if (flag == last_flag && repeat_count != 255) {
  ------------------
  |  Branch (234:9): [True: 2.68M, False: 2.67M]
  |  Branch (234:30): [True: 2.68M, False: 700]
  ------------------
  235|  2.68M|      dst[flag_offset - 1] |= kGlyfRepeat;
  236|  2.68M|      repeat_count++;
  237|  2.68M|    } else {
  238|  2.67M|      if (repeat_count != 0) {
  ------------------
  |  Branch (238:11): [True: 462k, False: 2.20M]
  ------------------
  239|   462k|        if (PREDICT_FALSE(flag_offset >= dst_size)) {
  ------------------
  |  |   48|   462k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 462k]
  |  |  ------------------
  ------------------
  240|      0|          return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  241|      0|        }
  242|   462k|        dst[flag_offset++] = repeat_count;
  243|   462k|      }
  244|  2.67M|      if (PREDICT_FALSE(flag_offset >= dst_size)) {
  ------------------
  |  |   48|  2.67M|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 2.67M]
  |  |  ------------------
  ------------------
  245|      0|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  246|      0|      }
  247|  2.67M|      dst[flag_offset++] = flag;
  248|  2.67M|      repeat_count = 0;
  249|  2.67M|    }
  250|  5.35M|    last_x = point.x;
  251|  5.35M|    last_y = point.y;
  252|  5.35M|    last_flag = flag;
  253|  5.35M|  }
  254|       |
  255|  70.6k|  if (repeat_count != 0) {
  ------------------
  |  Branch (255:7): [True: 32.2k, False: 38.3k]
  ------------------
  256|  32.2k|    if (PREDICT_FALSE(flag_offset >= dst_size)) {
  ------------------
  |  |   48|  32.2k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 32.2k]
  |  |  ------------------
  ------------------
  257|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  258|      0|    }
  259|  32.2k|    dst[flag_offset++] = repeat_count;
  260|  32.2k|  }
  261|  70.6k|  unsigned int xy_bytes = x_bytes + y_bytes;
  262|  70.6k|  if (PREDICT_FALSE(xy_bytes < x_bytes ||
  ------------------
  |  |   48|   282k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 70.6k]
  |  |  |  Branch (48:44): [True: 0, False: 70.6k]
  |  |  |  Branch (48:44): [True: 0, False: 70.6k]
  |  |  |  Branch (48:44): [True: 0, False: 70.6k]
  |  |  ------------------
  ------------------
  263|  70.6k|      flag_offset + xy_bytes < flag_offset ||
  264|  70.6k|      flag_offset + xy_bytes > dst_size)) {
  265|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  266|      0|  }
  267|       |
  268|  70.6k|  int x_offset = flag_offset;
  269|  70.6k|  int y_offset = flag_offset + x_bytes;
  270|  70.6k|  last_x = 0;
  271|  70.6k|  last_y = 0;
  272|  5.42M|  for (unsigned int i = 0; i < n_points; ++i) {
  ------------------
  |  Branch (272:28): [True: 5.35M, False: 70.6k]
  ------------------
  273|  5.35M|    int dx = points[i].x - last_x;
  274|  5.35M|    if (dx == 0) {
  ------------------
  |  Branch (274:9): [True: 3.77M, False: 1.58M]
  ------------------
  275|       |      // pass
  276|  3.77M|    } else if (dx > -256 && dx < 256) {
  ------------------
  |  Branch (276:16): [True: 1.42M, False: 153k]
  |  Branch (276:29): [True: 1.24M, False: 179k]
  ------------------
  277|  1.24M|      dst[x_offset++] = std::abs(dx);
  278|  1.24M|    } else {
  279|       |      // will always fit for valid input, but overflow is harmless
  280|   332k|      x_offset = Store16(dst, x_offset, dx);
  281|   332k|    }
  282|  5.35M|    last_x += dx;
  283|  5.35M|    int dy = points[i].y - last_y;
  284|  5.35M|    if (dy == 0) {
  ------------------
  |  Branch (284:9): [True: 2.94M, False: 2.41M]
  ------------------
  285|       |      // pass
  286|  2.94M|    } else if (dy > -256 && dy < 256) {
  ------------------
  |  Branch (286:16): [True: 1.98M, False: 436k]
  |  Branch (286:29): [True: 1.61M, False: 360k]
  ------------------
  287|  1.61M|      dst[y_offset++] = std::abs(dy);
  288|  1.61M|    } else {
  289|   797k|      y_offset = Store16(dst, y_offset, dy);
  290|   797k|    }
  291|  5.35M|    last_y += dy;
  292|  5.35M|  }
  293|  70.6k|  *glyph_size = y_offset;
  294|  70.6k|  return true;
  295|  70.6k|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_19StoreLocaERKNSt3__16vectorIjNS1_9allocatorIjEEEEiPjPNS_8WOFF2OutE:
  379|    106|               uint32_t* checksum, WOFF2Out* out) {
  380|       |  // TODO(user) figure out what index format to use based on whether max
  381|       |  // offset fits into uint16_t or not
  382|    106|  const uint64_t loca_size = loca_values.size();
  383|    106|  const uint64_t offset_size = index_format ? 4 : 2;
  ------------------
  |  Branch (383:32): [True: 43, False: 63]
  ------------------
  384|    106|  if (PREDICT_FALSE((loca_size << 2) >> 2 != loca_size)) {
  ------------------
  |  |   48|    106|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 106]
  |  |  ------------------
  ------------------
  385|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  386|      0|  }
  387|    106|  std::vector<uint8_t> loca_content(loca_size * offset_size);
  388|    106|  uint8_t* dst = &loca_content[0];
  389|    106|  size_t offset = 0;
  390|  65.8k|  for (size_t i = 0; i < loca_values.size(); ++i) {
  ------------------
  |  Branch (390:22): [True: 65.7k, False: 106]
  ------------------
  391|  65.7k|    uint32_t value = loca_values[i];
  392|  65.7k|    if (index_format) {
  ------------------
  |  Branch (392:9): [True: 47.7k, False: 17.9k]
  ------------------
  393|  47.7k|      offset = StoreU32(dst, offset, value);
  394|  47.7k|    } else {
  395|  17.9k|      offset = Store16(dst, offset, value >> 1);
  396|  17.9k|    }
  397|  65.7k|  }
  398|    106|  *checksum = ComputeULongSum(&loca_content[0], loca_content.size());
  399|    106|  if (PREDICT_FALSE(!out->Write(&loca_content[0], loca_content.size()))) {
  ------------------
  |  |   48|    106|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 106]
  |  |  ------------------
  ------------------
  400|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  401|      0|  }
  402|    106|  return true;
  403|    106|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_126ReconstructTransformedHmtxEPKhmttRKNSt3__16vectorIsNS3_9allocatorIsEEEEPjPNS_8WOFF2OutE:
  707|    114|                                WOFF2Out* out) {
  708|    114|  Buffer hmtx_buff_in(transformed_buf, transformed_size);
  709|       |
  710|    114|  uint8_t hmtx_flags;
  711|    114|  if (PREDICT_FALSE(!hmtx_buff_in.ReadU8(&hmtx_flags))) {
  ------------------
  |  |   48|    114|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 2, False: 112]
  |  |  ------------------
  ------------------
  712|      2|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      2|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  713|      2|  }
  714|       |
  715|    112|  std::vector<uint16_t> advance_widths;
  716|    112|  std::vector<int16_t> lsbs;
  717|    112|  bool has_proportional_lsbs = (hmtx_flags & 1) == 0;
  718|    112|  bool has_monospace_lsbs = (hmtx_flags & 2) == 0;
  719|       |
  720|       |  // Bits 2-7 are reserved and MUST be zero.
  721|    112|  if ((hmtx_flags & 0xFC) != 0) {
  ------------------
  |  Branch (721:7): [True: 21, False: 91]
  ------------------
  722|       |#ifdef FONT_COMPRESSION_BIN
  723|       |    fprintf(stderr, "Illegal hmtx flags; bits 2-7 must be 0\n");
  724|       |#endif
  725|     21|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     21|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  726|     21|  }
  727|       |
  728|       |  // you say you transformed but there is little evidence of it
  729|     91|  if (has_proportional_lsbs && has_monospace_lsbs) {
  ------------------
  |  Branch (729:7): [True: 44, False: 47]
  |  Branch (729:32): [True: 13, False: 31]
  ------------------
  730|     13|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     13|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  731|     13|  }
  732|       |
  733|     91|  assert(x_mins.size() == num_glyphs);
  ------------------
  |  Branch (733:3): [True: 78, False: 0]
  ------------------
  734|       |
  735|       |  // num_glyphs 0 is OK if there is no 'glyf' but cannot then xform 'hmtx'.
  736|     78|  if (PREDICT_FALSE(num_hmetrics > num_glyphs)) {
  ------------------
  |  |   48|     78|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 25, False: 53]
  |  |  ------------------
  ------------------
  737|     25|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|     25|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  738|     25|  }
  739|       |
  740|       |  // https://www.microsoft.com/typography/otspec/hmtx.htm
  741|       |  // "...only one entry need be in the array, but that entry is required."
  742|     53|  if (PREDICT_FALSE(num_hmetrics < 1)) {
  ------------------
  |  |   48|     53|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 3, False: 50]
  |  |  ------------------
  ------------------
  743|      3|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      3|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  744|      3|  }
  745|       |
  746|    286|  for (uint16_t i = 0; i < num_hmetrics; i++) {
  ------------------
  |  Branch (746:24): [True: 237, False: 49]
  ------------------
  747|    237|    uint16_t advance_width;
  748|    237|    if (PREDICT_FALSE(!hmtx_buff_in.ReadU16(&advance_width))) {
  ------------------
  |  |   48|    237|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 1, False: 236]
  |  |  ------------------
  ------------------
  749|      1|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      1|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  750|      1|    }
  751|    236|    advance_widths.push_back(advance_width);
  752|    236|  }
  753|       |
  754|    279|  for (uint16_t i = 0; i < num_hmetrics; i++) {
  ------------------
  |  Branch (754:24): [True: 231, False: 48]
  ------------------
  755|    231|    int16_t lsb;
  756|    231|    if (has_proportional_lsbs) {
  ------------------
  |  Branch (756:9): [True: 63, False: 168]
  ------------------
  757|     63|      if (PREDICT_FALSE(!hmtx_buff_in.ReadS16(&lsb))) {
  ------------------
  |  |   48|     63|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 1, False: 62]
  |  |  ------------------
  ------------------
  758|      1|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      1|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  759|      1|      }
  760|    168|    } else {
  761|    168|      lsb = x_mins[i];
  762|    168|    }
  763|    230|    lsbs.push_back(lsb);
  764|    230|  }
  765|       |
  766|    296|  for (uint16_t i = num_hmetrics; i < num_glyphs; i++) {
  ------------------
  |  Branch (766:35): [True: 249, False: 47]
  ------------------
  767|    249|    int16_t lsb;
  768|    249|    if (has_monospace_lsbs) {
  ------------------
  |  Branch (768:9): [True: 125, False: 124]
  ------------------
  769|    125|      if (PREDICT_FALSE(!hmtx_buff_in.ReadS16(&lsb))) {
  ------------------
  |  |   48|    125|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 1, False: 124]
  |  |  ------------------
  ------------------
  770|      1|        return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      1|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  771|      1|      }
  772|    125|    } else {
  773|    124|      lsb = x_mins[i];
  774|    124|    }
  775|    248|    lsbs.push_back(lsb);
  776|    248|  }
  777|       |
  778|       |  // bake me a shiny new hmtx table
  779|     47|  uint32_t hmtx_output_size = 2 * num_glyphs + 2 * num_hmetrics;
  780|     47|  std::vector<uint8_t> hmtx_table(hmtx_output_size);
  781|     47|  uint8_t* dst = &hmtx_table[0];
  782|     47|  size_t dst_offset = 0;
  783|    520|  for (uint32_t i = 0; i < num_glyphs; i++) {
  ------------------
  |  Branch (783:24): [True: 473, False: 47]
  ------------------
  784|    473|    if (i < num_hmetrics) {
  ------------------
  |  Branch (784:9): [True: 228, False: 245]
  ------------------
  785|    228|      Store16(advance_widths[i], &dst_offset, dst);
  786|    228|    }
  787|    473|    Store16(lsbs[i], &dst_offset, dst);
  788|    473|  }
  789|       |
  790|     47|  *checksum = ComputeULongSum(&hmtx_table[0], hmtx_output_size);
  791|     47|  if (PREDICT_FALSE(!out->Write(&hmtx_table[0], hmtx_output_size))) {
  ------------------
  |  |   48|     47|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 47]
  |  |  ------------------
  ------------------
  792|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  793|      0|  }
  794|       |
  795|     47|  return true;
  796|     47|}
woff2_dec.cc:_ZN5woff212_GLOBAL__N_14Pad4EPNS_8WOFF2OutE:
  363|  97.3k|bool Pad4(WOFF2Out* out) {
  364|  97.3k|  uint8_t zeroes[] = {0, 0, 0};
  365|  97.3k|  if (PREDICT_FALSE(out->Size() + 3 < out->Size())) {
  ------------------
  |  |   48|  97.3k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 97.3k]
  |  |  ------------------
  ------------------
  366|      0|    return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  367|      0|  }
  368|  97.3k|  uint32_t pad_bytes = Round4(out->Size()) - out->Size();
  369|  97.3k|  if (pad_bytes > 0) {
  ------------------
  |  Branch (369:7): [True: 53.3k, False: 44.0k]
  ------------------
  370|  53.3k|    if (PREDICT_FALSE(!out->Write(&zeroes, pad_bytes))) {
  ------------------
  |  |   48|  53.3k|#define PREDICT_FALSE(x) (__builtin_expect(x, 0))
  |  |  ------------------
  |  |  |  Branch (48:26): [True: 0, False: 53.3k]
  |  |  ------------------
  ------------------
  371|      0|      return FONT_COMPRESSION_FAILURE();
  ------------------
  |  |   40|      0|#define FONT_COMPRESSION_FAILURE() false
  ------------------
  372|      0|    }
  373|  53.3k|  }
  374|  97.3k|  return true;
  375|  97.3k|}

_ZN5woff214WOFF2StringOutC2EPNSt3__112basic_stringIcNS1_11char_traitsIcEENS1_9allocatorIcEEEE:
   14|  8.64k|    : buf_(buf), max_size_(kDefaultMaxSize), offset_(0) {}
_ZN5woff214WOFF2StringOut5WriteEPKvm:
   16|   154k|bool WOFF2StringOut::Write(const void *buf, size_t n) {
   17|   154k|  return Write(buf, offset_, n);
   18|   154k|}
_ZN5woff214WOFF2StringOut5WriteEPKvmm:
   20|   168k|bool WOFF2StringOut::Write(const void *buf, size_t offset, size_t n) {
   21|   168k|  if (offset > max_size_ || n > max_size_ - offset) {
  ------------------
  |  Branch (21:7): [True: 0, False: 168k]
  |  Branch (21:29): [True: 0, False: 168k]
  ------------------
   22|      0|    return false;
   23|      0|  }
   24|   168k|  if (offset == buf_->size()) {
  ------------------
  |  Branch (24:7): [True: 154k, False: 14.3k]
  ------------------
   25|   154k|    buf_->append(static_cast<const char*>(buf), n);
   26|   154k|  } else {
   27|  14.3k|    if (offset + n > buf_->size()) {
  ------------------
  |  Branch (27:9): [True: 0, False: 14.3k]
  ------------------
   28|      0|      buf_->append(offset + n - buf_->size(), 0);
   29|      0|    }
   30|  14.3k|    buf_->replace(offset, n, static_cast<const char*>(buf), n);
   31|  14.3k|  }
   32|   168k|  offset_ = std::max(offset_, offset + n);
   33|       |
   34|   168k|  return true;
   35|   168k|}
_ZN5woff214WOFF2StringOut10SetMaxSizeEm:
   37|  8.64k|void WOFF2StringOut::SetMaxSize(size_t max_size) {
   38|  8.64k|  max_size_ = max_size;
   39|  8.64k|  if (offset_ > max_size_) {
  ------------------
  |  Branch (39:7): [True: 0, False: 8.64k]
  ------------------
   40|      0|    offset_ = max_size_;
   41|      0|  }
   42|  8.64k|}

